CbmRoot
Loading...
Searching...
No Matches
CbmMvdGeoHandler.cxx
Go to the documentation of this file.
1/* Copyright (C) 2014-2020 Institut fuer Kernphysik, Goethe-Universitaet Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Philipp Sitzmann [committer], Florian Uhlig */
4
10
11
12#include "CbmMvdGeoHandler.h"
13
14#include "CbmMvdDetector.h" // for CbmMvdDetector
15#include "CbmMvdHelper.h" // for CbmMvdSensorTyp
16#include "CbmMvdMimosa26AHR.h" // for CbmMvdMimosa26AHR
17#include "CbmMvdMimosis.h" // for CbmMvdMimosis
18#include "CbmMvdStationPar.h" // for CbmMvdStationPar
19
20#include <Logger.h> // for LOG, Logger
21
22#include <TGeoBBox.h> // for TGeoBBox
23#include <TGeoManager.h> // for TGeoManager, gGeoManager
24#include <TGeoMaterial.h> // for TGeoMaterial
25#include <TGeoNode.h> // for TGeoNode
26#include <TGeoVolume.h> // for TGeoVolume
27#include <TObjArray.h> // for TObjArray
28#include <TString.h> // for TString, operator+, Form, operator<<
29
30#include <cmath> // for fabs
31
32//--------------------------------------------------------------------------
34 : TObject()
36 , fDetector(nullptr)
37 , fStationPar(nullptr)
38 , fStationMap()
39 , fIsSimulation(kFALSE)
40 , fGeoPathHash()
41 ,
43 ,
45 ,
46 fGlobal()
47 ,
49 ,
50 fLayerId(-1)
51 ,
52 fModuleId(-1)
53 ,
54 fModuleType(-1)
55 ,
56 fStation(-1)
57 ,
58 fMother("")
59 , fGeoTyp()
60 , fVolId()
61 , fStationNumber(-1)
62 , fWidth(0.)
63 , fHeight(0.)
64 , fZRadThickness(0.)
65 , fBeamwidth(0.)
66 , fBeamheight(0.)
67 , fZThickness(0.)
68 , fXres(0.)
69 , fYres(0.)
70 , fStationName("")
71 , fDetectorName("")
72 , fSectorName("")
73 , fQuadrantName("")
74 , fSensorHolding("")
75 , fSensorName("")
76 , fnodeName("")
77{
78}
79//--------------------------------------------------------------------------
80
81//--------------------------------------------------------------------------
83
84//--------------------------------------------------------------------------
85
86//--------------------------------------------------------------------------
87void CbmMvdGeoHandler::Init(Bool_t isSimulation, Int_t mcbmFlag)
88{
89 fIsSimulation = isSimulation;
90 GetMother();
91 //GetMother(mcbmFlag);
93
94 if (!isSimulation) {
95 if (fSensorTyp == CbmMvdSensorTyp::MIMOSIS) LOG(info) << "Using Mimosis style sensor";
96 else
97 LOG(info) << "Using Mimosa style sensor";
100 fDetector->SetParameterFile(fStationPar);
101 switch (fGeoTyp) {
102 case FourStation:
103 case scripted: fStationPar->Init(4); break;
104 case FourStationShift: fStationPar->Init(4); break;
105 case ThreeStation: fStationPar->Init(3); break;
106 case TwoStation: fStationPar->Init(2); break;
107 case MiniCbm: fStationPar->Init(2); break;
108 //CbmMvdStationPar::AddWidth(Int_t iStation, Double_t value) { SetParameterMax(fWidths, iStation, value);
109 case v25a_mcbm:
110 fStationPar->Init(2);
111 fStationPar->AddWidth(0, 10);
112 fStationPar->AddWidth(1, 10);
113 break; // mini-CBM 2 Stations each with 1 Quadrand with 1 sensor.
114 default: fStationPar->Init(0);
115 }
116 }
117}
118
119//--------------------------------------------------------------------------
120//--------------------------------------------------------------------------
122{
123 // In the simulation we can not rely on the TGeoManager information
124 // In the simulation we get the correct information only from gMC
125
126 return 1;
127}
128//--------------------------------------------------------------------------
129
130//--------------------------------------------------------------------------
132{
133 if (fGeoPathHash != path.Hash()) { NavigateTo(path); }
134 return GetSensorAddress();
135}
136//--------------------------------------------------------------------------
137
138//--------------------------------------------------------------------------
139Double_t CbmMvdGeoHandler::GetSizeX(const TString& path)
140{
141 if (fGeoPathHash != path.Hash()) { NavigateTo(path); }
142 return fVolumeShape->GetDX();
143}
144//--------------------------------------------------------------------------
145
146//--------------------------------------------------------------------------
147Double_t CbmMvdGeoHandler::GetSizeY(const TString& path)
148{
149 if (fGeoPathHash != path.Hash()) { NavigateTo(path); }
150 return fVolumeShape->GetDY();
151}
152//--------------------------------------------------------------------------
153
154//--------------------------------------------------------------------------
155Double_t CbmMvdGeoHandler::GetSizeZ(const TString& path)
156{
157 if (fGeoPathHash != path.Hash()) { NavigateTo(path); }
158 return fVolumeShape->GetDZ();
159}
160//--------------------------------------------------------------------------
161
162//--------------------------------------------------------------------------
163Double_t CbmMvdGeoHandler::GetZ(const TString& path)
164{
165 if (fGeoPathHash != path.Hash()) { NavigateTo(path); }
166 return fGlobal[2];
167}
168//--------------------------------------------------------------------------
169
170//--------------------------------------------------------------------------
171Double_t CbmMvdGeoHandler::GetY(const TString& path)
172{
173 if (fGeoPathHash != path.Hash()) { NavigateTo(path); }
174 return fGlobal[1];
175}
176//--------------------------------------------------------------------------
177
178//--------------------------------------------------------------------------
179Double_t CbmMvdGeoHandler::GetX(const TString& path)
180{
181 if (fGeoPathHash != path.Hash()) { NavigateTo(path); }
182 return fGlobal[0];
183}
184//--------------------------------------------------------------------------
185
186
187//--------------------------------------------------------------------------
189{
190 if (fGeoPathHash != path.Hash()) { NavigateTo(path); }
191 return fStation;
192}
193//--------------------------------------------------------------------------
194
195
196//--------------------------------------------------------------------------
197void CbmMvdGeoHandler::NavigateTo(const TString& path)
198{
199 //LOG(info) << "path : " << path.Data();
200 if (fIsSimulation) { LOG(fatal) << "This method is not supported in simulation mode"; }
201 else {
202 gGeoManager->cd(path.Data());
203 fGeoPathHash = path.Hash();
204 fCurrentVolume = gGeoManager->GetCurrentVolume();
205 TString name = fCurrentVolume->GetName();
206 LOG(debug2) << "this volume is " << name;
207 fVolumeShape = (TGeoBBox*) fCurrentVolume->GetShape();
208 Double_t local[3] = {0., 0., 0.}; // Local center of volume
209 gGeoManager->LocalToMaster(local, fGlobal);
210 fGlobalMatrix = gGeoManager->GetCurrentMatrix();
211 if (path.Contains("-S0-") || path.Contains("_S0_"))
212 fStationNumber = 0;
213 else if (path.Contains("-S1-") || path.Contains("_S1_"))
214 fStationNumber = 1;
215 else if (path.Contains("-S2-") || path.Contains("_S2_"))
216 fStationNumber = 2;
217 else if (path.Contains("-S3-") || path.Contains("_S3_"))
218 fStationNumber = 3;
219 else
220 LOG(fatal) << "couldn't find Station in volume name, something seems fishy ";
221
222 LOG(debug) << "I am in path: " << path;
223 LOG(debug) << "I am: " << name;
224 LOG(debug) << "I am on station: " << fStationNumber;
225 LOG(debug) << "I am at X: " << fGlobal[0];
226 LOG(debug) << "I am at Y: " << fGlobal[1];
227 LOG(debug) << "I am at Z: " << fGlobal[2];
228
229 local[0] = fVolumeShape->GetDX();
230 local[1] = fVolumeShape->GetDY();
231 local[2] = fVolumeShape->GetDZ();
232 Double_t fGlobalMax[3];
233 gGeoManager->LocalToMaster(local, fGlobalMax);
234
235 local[0] = -1 * fVolumeShape->GetDX();
236 local[1] = -1 * fVolumeShape->GetDY();
237 local[2] = -1 * fVolumeShape->GetDZ();
238 Double_t fGlobalMin[3];
239 gGeoManager->LocalToMaster(local, fGlobalMin);
240
241 if (fGlobalMax[0] > fGlobalMin[0]) {
242 fWidth = fGlobalMax[0];
243 fBeamwidth = fGlobalMin[0];
244 }
245 else {
246 fWidth = fGlobalMin[0];
247 fBeamwidth = fGlobalMax[0];
248 }
249 if (fGlobalMax[1] > fGlobalMin[1]) {
250 fHeight = fGlobalMax[1];
251 fBeamheight = fGlobalMin[1];
252 }
253 else {
254 fHeight = fGlobalMin[1];
255 fBeamheight = fGlobalMax[1];
256 }
257
258 fZThickness = fabs(fGlobalMax[2] - fGlobalMin[2]);
259 Double_t radLength = fCurrentVolume->GetMaterial()->GetRadLen();
260 fZRadThickness = fZThickness / radLength;
261
262 fXres = 3.8; // TODO: pixelSizeX / sqrt{12}
263 fYres = 3.8; // TODO: pixelSizeY / sqrt{12}
264 }
265}
266//--------------------------------------------------------------------------
267
268//--------------------------------------------------------------------------
269//void CbmMvdGeoHandler::GetMother(Int_t mcbmFlag)
271{
272 LOG(debug) << "Trying to find mother.";
273
274 TString pipeName = "pipe";
275 TString motherName;
276 Bool_t fail = kTRUE;
277
278 TObjArray* nodes = gGeoManager->GetTopNode()->GetNodes();
279
280 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
281 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
282 if (TString(node->GetName()).Contains(pipeName, TString::ECaseCompare::kIgnoreCase)) {
283 motherName = node->GetName();
284 LOG(debug) << " monther name: " << motherName;
285 fMother = Form("cave_1/%s/pipevac1_0", motherName.Data());
286 LOG(debug) << "MvdGeoHandler checking existance of mother: " << fMother;
287 if (gGeoManager->CheckPath(fMother)) fail = kFALSE;
288 break;
289 }
290 else
291 continue;
292 }
293 if (fail) {
294 LOG(debug) << "Check for MVD outside of pipe";
295 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
296 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
297 if (TString(node->GetName()).Contains("mvd", TString::ECaseCompare::kIgnoreCase)) {
298 motherName = node->GetName();
299 fMother = "cave_1";
300 LOG(debug) << "MvdGeoHandler found Mother: " << fMother;
301 LOG(warn) << "Mvd found outside of pipe";
302 fail = kFALSE;
303 break;
304 }
305 else
306 continue;
307 }
308 }
309 if (fail) LOG(fatal) << "MVD Geometry included, but pipe not found please check your setup";
310}
311//--------------------------------------------------------------------------
312
313//--------------------------------------------------------------------------
314
316{
317 if (gGeoManager->CheckPath(fMother + "/Beamtimeosetupoobgnum_0")) {
318 LOG(info) << "Found Beamtimesetupy";
320 }
321 else if (gGeoManager->CheckPath(fMother + "/MVDoMistraloquero012oStationo150umodigi_0")) {
322 LOG(debug) << "Found MVD with 3 Stations";
324 }
325 else if (gGeoManager->CheckPath(fMother + "/MVDo0123ohoFPCoextoHSoSo0123_0")) {
326 LOG(debug) << "Found MVD with 4 Stations";
328 fDetectorName = "/MVDo0123ohoFPCoextoHSoSo0123_0";
329 }
330 else if (gGeoManager->CheckPath(fMother + "/MVDo1123ohoFPCoextoHSoSo1123_0")) {
331 LOG(debug) << "Found shifted MVD with 4 Stations";
333 fDetectorName = "/MVDo1123ohoFPCoextoHSoSo1123_0";
334 }
335 else if (gGeoManager->CheckPath("cave_1/mvd_v25a_mcbm_0")) {
336 LOG(info) << "Found mCBM MVD with 2 Stations each with 1 Quadrand with 1 sensor ";
338 fDetectorName = "/mvd_v25a_mcbm_0";
339 }
340 else if (gGeoManager->CheckPath(fMother + "/MVDomCBM_0")) {
341 LOG(debug) << "Found mCBM MVD configuration";
342 fDetectorName = "/MVDomCBM_0";
344 }
345 else if (gGeoManager->CheckPath(fMother + "/MVDomCBMorotated_0")) {
346 LOG(debug) << "Found mCBM MVD rotated configuration";
347 fDetectorName = "/MVDomCBMorotated_0";
349 }
350 else if (gGeoManager->CheckPath(fMother + "/TwoStation_0")) {
351 LOG(info) << "Found two station scripted MVD configuration";
352 fDetectorName = "/TwoStation_0";
354 }
355 else if (gGeoManager->CheckPath(fMother + "/MVDscripted_0")) {
356 LOG(info) << "Found scripted MVD configuration";
357 fDetectorName = "/MVDscripted_0";
359 }
360 else {
361 LOG(info) << "Try standard Geometry";
363 }
364}
365//--------------------------------------------------------------------------
366
367//--------------------------------------------------------------------------
369{
370 // path is build as: cave_1/*pipe/MVDscripted_0/quadrant_S*_*/sensor_*/sensorActive
371 Int_t id = 0;
372 TString sensorName;
373
374 TString quadrantName;
375 TString stationName;
376
377 gGeoManager->cd(path.Data());
378
379 sensorName = gGeoManager->GetMother(1)->GetName();
380 sensorName.Remove(0, 7);
381 Int_t sensorNumber = sensorName.Atoi();
382
383 quadrantName = gGeoManager->GetMother(2)->GetName();
384 stationName = quadrantName(10);
385 quadrantName.Remove(0, 12);
386 Int_t quadNumber = quadrantName.Atoi();
387 Int_t stationNumber = stationName.Atoi();
388
389 id = 1000 * stationNumber + 100 * quadNumber + sensorNumber;
390
391 // LOG(debug) << "We are on Station: " << stationNumber << " in Quadrant: " << quadNumber << " and Sensor: " << sensorNumber;
392 // LOG(debug) << "This ID is: " << id;
393
394 return id;
395}
396//--------------------------------------------------------------------------
397
398
399//--------------------------------------------------------------------------
401{
402
403 if (fIsSimulation) {
405 }
406 else {
407 FillDetector();
408 };
409}
410//--------------------------------------------------------------------------
411
412//--------------------------------------------------------------------------
414{
415
416 if (fGeoTyp == Default)
417 LOG(error) << "Using old Geometry files within the new Digitizer is not supported, "
418 << "please use CbmMvdDigitizeL if you want to use this Geometry";
419
421
422 if (!fDetector) LOG(fatal) << "GeometryHandler couldn't find a valid Detector";
423
424 Int_t iStation = 0;
425 for (Int_t StatNr = 0; StatNr < 4; StatNr++) {
426 fStationNumber = StatNr;
427 if (StatNr == 0 && fGeoTyp == FourStation) fStationName = "/MVDo0ohoFPCoHSoS_1";
428 else
429 fStationName = Form("/MVDo%iohoFPCoextoHSoS_1", StatNr);
430 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
431 if (StatNr == 0 && fGeoTyp == 4) fQuadrantName = Form("/St0Q%iohoFPC_1", QuadNr);
432 else
433 fQuadrantName = Form("/St%iQ%iohoFPCoext_1", StatNr, QuadNr);
434 for (Int_t Layer = 0; Layer < 2; Layer++) {
435
436 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
437 fSensorHolding = Form("/MVD-S%i-Q%i-L%i-C%02i-P0oPartAss_1", StatNr, QuadNr, Layer, SensNr);
438 fSensorName = Form("MVD-S%i-Q%i-L%i-C%02i-P0", StatNr, QuadNr, Layer, SensNr);
439 fVolId = gGeoManager->GetUID(fSensorName);
440 if (fVolId > -1)
441 for (Int_t SegmentNr = 0; SegmentNr < 50; SegmentNr++) {
442 fSectorName = Form("/S%iQ%iS%i_1", StatNr, QuadNr, SegmentNr);
444 + fSensorName + "_1";
445 LOG(debug) << "looking for " << fnodeName;
446 Bool_t nodeFound = gGeoManager->CheckPath(fnodeName.Data());
447 if (nodeFound) {
449 0.0, StatNr);
450 iStation++;
452 }
453 }
454 }
455 }
456 }
457 }
458 }
459
460 else if (fGeoTyp == scripted) {
461 fSensorName = "sensorActive";
462 if (!fDetector) LOG(fatal) << "GeometryHandler couldn't find a valid Detector";
463
464
465 Int_t iStation = 0;
466 for (Int_t StatNr = 0; StatNr < 4; StatNr++) {
467 fStationNumber = StatNr;
468 fStationName = Form("/station_S%d_1", StatNr);
469 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
470 fQuadrantName = Form("/quadrant_S%d_%d", StatNr, QuadNr);
471 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
472 fSensorHolding = Form("/sensor_%d", SensNr);
473 fnodeName =
475 LOG(debug1) << "looking for " << fnodeName;
476 Bool_t nodeFound = gGeoManager->CheckPath(fnodeName.Data());
477 if (nodeFound) {
478 gGeoManager->cd(fnodeName);
480
482 fDetector->AddSensor(fSensorName, fSensorName, fnodeName, new CbmMvdMimosis, iStation, fVolId, 0.0,
483 StatNr);
484 else
485 fDetector->AddSensor(fSensorName, fSensorName, fnodeName, new CbmMvdMimosa26AHR, iStation, fVolId, 0.0,
486 StatNr);
487 iStation++;
489 LOG(debug1) << "found " << fSensorHolding + "/" + fSensorName << " number: " << fVolId
490 << " and added to MVD Detector";
491 }
492 else
493 break;
494 }
495 }
496 }
497 }
498
499 else if (fGeoTyp == TwoStation) {
500 fSensorName = "sensorActive";
501 if (!fDetector) LOG(fatal) << "GeometryHandler couldn't find a valid Detector";
502 Int_t iStation = 0;
503 for (Int_t StatNr = 0; StatNr < 2; StatNr++) {
504 fStationNumber = StatNr;
505 fStationName = Form("/station_S%d_1", StatNr);
506 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
507 fQuadrantName = Form("/quadrant_S%d_%d", StatNr, QuadNr);
508 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
509 fSensorHolding = Form("/sensor_%d", SensNr);
510 fnodeName =
512 LOG(debug1) << "looking for " << fnodeName;
513 Bool_t nodeFound = gGeoManager->CheckPath(fnodeName.Data());
514 if (nodeFound) {
515 gGeoManager->cd(fnodeName);
518 fDetector->AddSensor(fSensorName, fSensorName, fnodeName, new CbmMvdMimosis, iStation, fVolId, 0.0,
519 StatNr);
520 else
521 fDetector->AddSensor(fSensorName, fSensorName, fnodeName, new CbmMvdMimosa26AHR, iStation, fVolId, 0.0,
522 StatNr);
523 iStation++;
525 LOG(debug1) << "found " << fSensorHolding + "/" + fSensorName << " number: " << fVolId
526 << " and added to MVD Detector";
527 }
528 else
529 break;
530 }
531 }
532 }
533 }
534
535 else if (fGeoTyp == v25a_mcbm) {
536 LOG(debug) << "Fill v25a";
537 fSensorName = "sensorActive";
538 if (!fDetector) LOG(fatal) << "GeometryHandler couldn't find a valid Detector";
539 Int_t iStation = 0;
540 for (Int_t StatNr = 0; StatNr < 2; StatNr++) {
541 fStationNumber = StatNr;
542 fStationName = Form("/station_S%d_1", StatNr);
543 for (Int_t QuadNr = 0; QuadNr < 1; QuadNr++) {
544 fQuadrantName = Form("/quadrant_S%d_%d", StatNr, QuadNr);
545 for (Int_t SensNr = 0; SensNr < 1; SensNr++) {
546 fSensorHolding = Form("/sensor_%d", SensNr);
547 // fnodeName = fMother + fDetectorName + fStationName + fQuadrantName + fSensorHolding + "/" + fSensorName + "_1";
548 fnodeName =
549 "cave_1/mvd_v25a_mcbm_0" + fStationName + fQuadrantName + fSensorHolding + "/" + fSensorName + "_1";
550 Bool_t nodeFound = gGeoManager->CheckPath(fnodeName.Data());
551 if (nodeFound) {
552 gGeoManager->cd(fnodeName);
554 fDetector->AddSensor(fSensorName, fSensorName, fnodeName, new CbmMvdMimosis, iStation, fVolId, 0.0, StatNr);
555 iStation++;
557 }
558 else
559 break;
560 }
561 }
562 }
563 }
564
565
566 else if (fGeoTyp == MiniCbm) {
567
568 if (!fDetector) LOG(fatal) << "GeometryHandler couldn't find a valid mCBM Detector";
569
570 Int_t iStation = 0;
571 for (Int_t StatNr = 0; StatNr < 2; StatNr++) {
572 fStationNumber = StatNr;
573 fStationName = Form("/MVDomCBMoS%i_1", StatNr);
574
575 for (Int_t Layer = 0; Layer < 2; Layer++) {
576 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
577 fQuadrantName = Form("/MVD-S%i-Q0-L%i-C%02i_1", StatNr, Layer, SensNr);
578 fSensorHolding = Form("/MVD-S%i-Q0-L%i-C%02i-P0oPartAss_1", StatNr, Layer, SensNr);
579 fSensorName = Form("MVD-S%i-Q0-L%i-C%02i-P0", StatNr, Layer, SensNr);
580 fVolId = gGeoManager->GetUID(fSensorName);
581 if (fVolId > -1) {
582 fnodeName =
584 Bool_t nodeFound = gGeoManager->CheckPath(fnodeName.Data());
585 if (nodeFound) {
586 fDetector->AddSensor(fSensorName, fSensorName, fnodeName, new CbmMvdMimosa26AHR, iStation, fVolId, 0.0,
587 StatNr);
588 iStation++;
590 }
591 }
592 }
593 }
594 }
595 }
596 else {
597 LOG(error) << "Tried to load an unsupported MVD Geometry";
598 }
599}
600//--------------------------------------------------------------------------
601
602//--------------------------------------------------------------------------
615//--------------------------------------------------------------------------
616
617//--------------------------------------------------------------------------
619//--------------------------------------------------------------------------
620
621//--------------------------------------------------------------------------
623{
624
626 Int_t iStation = 0;
627 for (Int_t StatNr = 0; StatNr < 4; StatNr++) {
628 if (StatNr == 0 && fGeoTyp == FourStation) fStationName = "/MVDo0ohoFPCoHSoS_1";
629 else
630 fStationName = Form("/MVDo%iohoFPCoextoHSoS_1", StatNr);
631 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
632 if (StatNr == 0 && fGeoTyp == 4) fQuadrantName = Form("/St0Q%iohoFPC_1", QuadNr);
633 else
634 fQuadrantName = Form("/St%iQ%iohoFPCoext_1", StatNr, QuadNr);
635 for (Int_t Layer = 0; Layer < 2; Layer++) {
636 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
637 fSensorHolding = Form("/MVD-S%i-Q%i-L%i-C%02i-P0oPartAss_1", StatNr, QuadNr, Layer, SensNr);
638 fSensorName = Form("MVD-S%i-Q%i-L%i-C%02i-P0", StatNr, QuadNr, Layer, SensNr);
639 fVolId = gGeoManager->GetUID(fSensorName);
640 if (fVolId > -1)
641 for (Int_t SegmentNr = 0; SegmentNr < 50; SegmentNr++) {
642 fSectorName = Form("/S%iQ%iS%i_1", StatNr, QuadNr, SegmentNr);
644 + fSensorName + "_1";
645 Bool_t nodeFound = gGeoManager->CheckPath(fnodeName.Data());
646 if (nodeFound) {
647 fStationMap[fVolId] = iStation;
648 iStation++;
649 }
650 }
651 }
652 }
653 }
654 }
655 }
656 else if (fGeoTyp == scripted) {
657 fSensorName = "sensorActive";
658 Int_t iStation = 0;
659 for (Int_t StatNr = 0; StatNr < 4; StatNr++) {
660 fStationName = Form("/station_S%d_1", StatNr);
661 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
662 fQuadrantName = Form("/quadrant_S%d_%d", StatNr, QuadNr);
663 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
664 fSensorHolding = Form("/sensor_%d", SensNr);
665 fnodeName =
667 LOG(debug) << "looking for " << fnodeName;
668 Bool_t nodeFound = gGeoManager->CheckPath(fnodeName.Data());
669 if (nodeFound) {
670 gGeoManager->cd(fnodeName);
672 LOG(debug) << "found " << fnodeName << " number: " << iStation << " ID: " << fVolId
673 << " and added to station map";
674 fStationMap[fVolId] = iStation;
675 iStation++;
676 LOG(debug) << "Map now size: " << fStationMap.size();
677 }
678 else
679 break;
680 }
681 }
682 }
683 }
684 else if (fGeoTyp == TwoStation) {
685 fSensorName = "sensorActive";
686 Int_t iStation = 0;
687 for (Int_t StatNr = 0; StatNr < 2; StatNr++) {
688 fStationName = Form("/station_S%d_1", StatNr);
689 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
690 fQuadrantName = Form("/quadrant_S%d_%d", StatNr, QuadNr);
691 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
692 fSensorHolding = Form("/sensor_%d", SensNr);
693 fnodeName =
695 LOG(debug) << "looking for " << fnodeName;
696 Bool_t nodeFound = gGeoManager->CheckPath(fnodeName.Data());
697 if (nodeFound) {
698 gGeoManager->cd(fnodeName);
700 LOG(debug) << "found " << fnodeName << " number: " << iStation << " ID: " << fVolId
701 << " and added to station map";
702 fStationMap[fVolId] = iStation;
703 iStation++;
704 LOG(debug) << "Map now size: " << fStationMap.size();
705 }
706 else
707 break;
708 }
709 }
710 }
711 }
712 else if (fGeoTyp == v25a_mcbm) {
713 LOG(info) << "Filling v25a mcbm";
714
715 fSensorName = "sensorActive";
716 Int_t iStation = 0;
717 for (Int_t StatNr = 0; StatNr < 2; StatNr++) {
718 fStationName = Form("/station_S%d_1", StatNr);
719 for (Int_t QuadNr = 0; QuadNr < 1; QuadNr++) {
720 fQuadrantName = Form("/quadrant_S%d_%d", StatNr, QuadNr);
721 for (Int_t SensNr = 0; SensNr < 1; SensNr++) {
722 fSensorHolding = Form("/sensor_%d", SensNr);
723 fnodeName =
725 Bool_t nodeFound = gGeoManager->CheckPath(fnodeName.Data());
726 if (nodeFound) {
727 gGeoManager->cd(fnodeName);
729 fStationMap[fVolId] = iStation;
730 iStation++;
731 }
732 else
733 break;
734 }
735 }
736 }
737 LOG(debug) << "MVD v25a mcbm station filled";
738 }
739 else if (fGeoTyp == Default) {
740 Int_t iStation = 1;
741 Int_t volId = -1;
742 do {
743 TString volName = Form("mvdstation%02i", iStation);
744 volId = gGeoManager->GetUID(volName);
745 if (volId > -1) {
746 fStationMap[volId] = iStation;
747 iStation++;
748 }
749 } while (volId > -1);
750 }
751 else if (fGeoTyp == MiniCbm) {
752 Int_t iStation = 0;
753 for (Int_t StatNr = 0; StatNr < 2; StatNr++) {
754 fStationName = Form("/MVDomCBMoS%i_1", StatNr);
755 for (Int_t Layer = 0; Layer < 2; Layer++) {
756 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
757 fQuadrantName = Form("/MVD-S%i-Q0-L%i-C%02i_1", StatNr, Layer, SensNr);
758 fSensorHolding = Form("/MVD-S%i-Q0-L%i-C%02i-P0oPartAss_1", StatNr, Layer, SensNr);
759 fSensorName = Form("MVD-S%i-Q0-L%i-C%02i-P0", StatNr, Layer, SensNr);
760 fVolId = gGeoManager->GetUID(fSensorName);
761 if (fVolId > -1) {
762 fnodeName =
764 Bool_t nodeFound = gGeoManager->CheckPath(fnodeName.Data());
765 if (nodeFound) {
766 fStationMap[fVolId] = iStation;
767 iStation++;
768 }
769 }
770 }
771 }
772 }
773 }
774 else {
775 LOG(error) << "You tried to use an unsuported Geometry";
776 }
777}
778//--------------------------------------------------------------------------
779
ClassImp(CbmConverterManager)
Helper class to extract information from the GeoManager. Addapted from TrdGeoHandler byFlorian Uhlig ...
@ scripted
@ ThreeStation
@ TwoStation
@ Default
@ FourStationShift
@ MiniCbm
@ beamtest
@ FourStation
@ v25a_mcbm
CbmMvdSensorTyp
Definition CbmMvdHelper.h:8
int Int_t
bool Bool_t
static CbmMvdDetector * Instance()
void Init(Bool_t isSimulation=kFALSE, Int_t mcbmFlag=0)
~CbmMvdGeoHandler()
Destructor.
CbmMvdGeoHandler()
Constructor.
TGeoHMatrix * fGlobalMatrix
Global center of volume.
std::map< Int_t, Int_t > fStationMap
Double_t GetZ(const TString &path)
Double_t GetSizeZ(const TString &path)
TString fMother
StationTypeID, 1..3.
Int_t GetIDfromPath(TString path)
Double_t GetSizeY(const TString &path)
Int_t GetStation(const TString &path)
CbmMvdSensorTyp fSensorTyp
Double_t GetSizeX(const TString &path)
Int_t GetSensorAddress()
Return module address calculated based on the current node in the TGeoManager.
Double_t GetY(const TString &path)
void NavigateTo(const TString &sensor)
CbmMvdDetector * fDetector
Double_t GetX(const TString &path)
TGeoVolume * fCurrentVolume
CbmMvdStationPar * fStationPar