33{
36
37 string detectorFile;
39
40 try {
41
42 JParser<> zap(
"Auxiliary program to draw the detector in 3D.");
43
46
47 zap(argc, argv);
48 }
49 catch(const exception &error) {
50 FATAL(error.what() << endl);
51 }
52
53
55
56 try {
58 }
61 }
62
64 FATAL(
"Empty detector " << detectorFile << endl);
65 }
66
68
69 NOTICE(
"Detector volume: " << cylinder << endl);
70
71 TApplication* tp = new TApplication("user", NULL, NULL);
72 TCanvas* cv = new TCanvas("a", detectorFile.c_str(), 1200, 1200);
73
74 ((TRootCanvas *) cv->GetCanvasImp())->Connect("CloseWindow()", "TApplication", tp, "Terminate()");
75
76 cv->SetFillColor(0);
77
78 TGeoManager* geom = new TGeoManager ("geometry", "");
79 TGeoMaterial* material = new TGeoMaterial("vacuum", 0, 0, 0);
80 TGeoMedium* medium = new TGeoMedium ("vacuum", 1, material);
81 TGeoVolume* top = geom->MakeBox ("Top", medium, cylinder.getRadius(), cylinder.getRadius(), cylinder.getZmax() - cylinder.getZmin());
82 TGeoVolume* shape = geom->MakeSphere("Module", medium, 0.4, 0.5);
83
84 shape->SetLineColor(kBlue);
85
86 int N = 0;
87
88 for (JDetector::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
89 top->AddNode(shape, N++, new TGeoTranslation(i->getX() - cylinder.getX(), i->getY() - cylinder.getY(), i->getZ() - cylinder.getZmin()));
90 }
91
92 geom->SetTopVolume(top);
93 geom->CloseGeometry();
94
95
96 top->Draw();
97
98 cv->GetView()->ShowAxis();
99 cv->Update();
100
101 tp->Run();
102}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).