119     JParser<> zap(
"Auxiliary program to draw a given module in 3D.");
 
  127   catch(
const exception &error) {
 
  128     FATAL(error.what() << endl);
 
  138     load(detectorFile, detector);
 
  140   catch(
const JException& error) {
 
  144   if (detector.empty()) {
 
  145     FATAL(
"Empty detector.");
 
  151   if (moduleID == -1) {
 
  153     module = detector.front();
 
  157     JModuleRouter router(detector);
 
  159     if (!router.hasModule(moduleID)) {
 
  160       FATAL(
"Missing module " << moduleID << endl);
 
  162       module = router.getModule(moduleID);
 
  166   module -= module.getPosition();        
 
  170   const JModuleAddressMap&   memo = demo.
get(module.getID());
 
  173   TApplication* app = 
new TApplication(
"user", NULL, NULL);
 
  175   c1 = 
new TCanvas(
"module", detectorFile.c_str(), 600, 600);
 
  176   p1 = 
new TPaveText(0.7, 0.9, 1.0, 1.0, 
"NB");
 
  181   p1->SetBorderSize(0);
 
  182   p1->SetTextSize(0.03);
 
  184   TGeoManager*  gGeoManager = 
new TGeoManager(
"geometry", 
"");
 
  186   TGeoMaterial* mat = 
new TGeoMaterial(
"vacuum", 0, 0, 0);
 
  187   TGeoMedium*   med = 
new TGeoMedium  (
"vacuum", 1, mat);
 
  188   TGeoVolume*   top = gGeoManager->MakeBox(
"top", med, 30.0, 30.0, 30.0);
 
  200   const double dz   =  3.0;  
 
  201   const double R1   =  2.0;  
 
  202   const double R2   =  4.0;  
 
  205   const Int_t color[] = { kRed, kOrange, kYellow, kGreen, kBlue, kMagenta };
 
  207   for (
unsigned int tdc = 0; tdc != module.size(); ++tdc) {
 
  209     const JPMTAddressTranslator& address = memo.getAddressTranslator(tdc);
 
  210     const int                    index   = address.ring     - 
'A';
 
  214     os[0] << 
"PMT " << setw(1) << address.ring << setw(1) << address.position;
 
  215     os[1] << 
"TDC " << setw(2) << tdc;
 
  217     TGeoVolumeAssembly* pPMT = 
new TGeoVolumeAssembly(
"PMT");
 
  220     JGeoVolume* pCone = 
new JGeoVolume(
"cathode", 
new TGeoCone(
"", 0.5 * dz, 0.0, R1, 0.0,  R2), med);
 
  222     for (
int i = 0; i != 
sizeof(os)/
sizeof(os[0]); ++i) {
 
  227     pTube->SetLineColor(color[index]);
 
  228     pCone->SetLineColor(color[index]);
 
  230     pPMT->AddNode(pTube, 0, 
new TGeoTranslation(0.0, 0.0, -dz));
 
  231     pPMT->AddNode(pCone, 1, 
new TGeoTranslation(0.0, 0.0, 0.0));
 
  233     const JPMT& pmt = module.getPMT(tdc);
 
  235     const Double_t x     = pmt.getX() * 100;             
 
  236     const Double_t y     = pmt.getY() * 100;             
 
  237     const Double_t z     = pmt.getZ() * 100;             
 
  239     const Double_t theta = pmt.getTheta() * 180.0 / 
PI;  
 
  240     const Double_t phi   = pmt.getPhi()   * 180.0 / 
PI;  
 
  243           << setw(1) << address.ring     
 
  244           << setw(1) << address.position                  << 
" " 
  246           << setw(2) << tdc                               << 
" " 
  247           << 
FIXED(3,0) << x     << 
" [cm] "  
  248           << 
FIXED(3,0) << y     << 
" [cm] "  
  249           << 
FIXED(3,0) << z     << 
" [cm] "  
  250           << 
FIXED(4,0) << theta << 
" [deg] "  
  251           << 
FIXED(4,0) << phi   << 
" [deg] "  
  254     TGeoRotation* rot = 
new TGeoRotation();
 
  259     top->AddNode(pPMT, tdc, 
new TGeoCombiTrans(x,y,z,rot));
 
  262   gGeoManager->SetTopVolume(top);
 
  263   gGeoManager->CloseGeometry();
 
  267   c1->GetView()->ShowAxis();
 
Utility class to parse command line options. 
 
void AddText(const std::string &text)
Add text to buffer. 
 
Auxiliary data structure for floating point format specification. 
 
const JModuleAddressMap & get(const int id) const 
Get module address map. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
void load(const JString &file_name, JDetector &detector)
Load detector from input file. 
 
JDetectorAddressMap & getDetectorAddressMap()
Get detector address map. 
 
TCanvas * c1
Global variables to handle mouse events. 
 
#define DEBUG(A)
Message macros.