119 JParser<> zap(
"Auxiliary program to draw a given module in 3D.");
127 catch(
const exception &error) {
128 FATAL(error.what() << endl);
145 FATAL(
"Empty detector.");
151 if (moduleID == -1) {
153 module = detector.front();
160 FATAL(
"Missing module " << moduleID << endl);
162 module = router.getModule(moduleID);
166 module -= module.getPosition();
173 TApplication* tp =
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");
178 ((TRootCanvas *)
c1->GetCanvasImp())->Connect(
"CloseWindow()",
"TApplication", tp,
"Terminate()");
183 p1->SetBorderSize(0);
184 p1->SetTextSize(0.03);
186 TGeoManager* gGeoManager =
new TGeoManager(
"geometry",
"");
188 TGeoMaterial* mat =
new TGeoMaterial(
"vacuum", 0, 0, 0);
189 TGeoMedium* med =
new TGeoMedium (
"vacuum", 1, mat);
190 TGeoVolume* top = gGeoManager->MakeBox(
"top", med, 30.0, 30.0, 30.0);
202 const double dz = 3.0;
203 const double R1 = 2.0;
204 const double R2 = 4.0;
207 const Int_t color[] = { kRed, kOrange, kYellow, kGreen, kBlue, kMagenta };
209 for (
unsigned int tdc = 0; tdc !=
module.size(); ++tdc) {
212 const int index = address.
ring -
'A';
216 os[0] <<
"PMT " << setw(1) << address.
ring << setw(1) << address.
position;
217 os[1] <<
"TDC " << setw(2) << tdc;
219 TGeoVolumeAssembly* pPMT =
new TGeoVolumeAssembly(
"PMT");
224 for (
int i = 0; i !=
sizeof(os)/
sizeof(os[0]); ++i) {
229 pTube->SetLineColor(color[index]);
230 pCone->SetLineColor(color[index]);
232 pPMT->AddNode(pTube, 0,
new TGeoTranslation(0.0, 0.0, -dz));
233 pPMT->AddNode(pCone, 1,
new TGeoTranslation(0.0, 0.0, 0.0));
235 const JPMT& pmt =
module.getPMT(tdc);
237 const Double_t x = pmt.
getX() * 100;
238 const Double_t y = pmt.
getY() * 100;
239 const Double_t z = pmt.
getZ() * 100;
241 const Double_t theta = pmt.
getTheta() * 180.0 / PI;
242 const Double_t phi = pmt.
getPhi() * 180.0 / PI;
245 << setw(1) << address.
ring
246 << setw(1) << address.
position <<
" "
247 << setw(8) << pmt.
getID() <<
" "
249 << setw(2) << tdc <<
" "
250 <<
FIXED(3,0) << x <<
" [cm] "
251 <<
FIXED(3,0) << y <<
" [cm] "
252 <<
FIXED(3,0) << z <<
" [cm] "
253 <<
FIXED(4,0) << theta <<
" [deg] "
254 <<
FIXED(4,0) << phi <<
" [deg] "
257 TGeoRotation* rot =
new TGeoRotation();
262 top->AddNode(pPMT, tdc,
new TGeoCombiTrans(x,y,z,rot));
265 gGeoManager->SetTopVolume(top);
266 gGeoManager->CloseGeometry();
270 c1->GetView()->ShowAxis();