10 #include "FairLogger.h"
13 #include "TGeoManager.h"
14 #include "TGeoMatrix.h"
16 #include "TGeoVolume.h"
18 #include "TVirtualMC.h"
38 , fIsSimulation(kFALSE)
94 LOG(info) <<
"Using Mimosis style sensor";
96 LOG(info) <<
"Using Mimosa style sensor";
184 LOG(fatal) <<
"This method is not supported in simulation mode";
186 gGeoManager->cd(path.Data());
190 LOG(debug2) <<
"this volume is " << name;
192 Double_t local[3] = {0., 0., 0.};
193 gGeoManager->LocalToMaster(local,
fGlobal);
195 if (path.Contains(
"-S0-") || path.Contains(
"_S0_"))
197 else if (path.Contains(
"-S1-") || path.Contains(
"_S1_"))
199 else if (path.Contains(
"-S2-") || path.Contains(
"_S2_"))
201 else if (path.Contains(
"-S3-") || path.Contains(
"_S3_"))
205 <<
"couldn't find Station in volume name, something seems fishy ";
207 LOG(debug2) <<
"I am in path: " << path;
208 LOG(debug2) <<
"I am: " << name;
210 LOG(debug2) <<
"I am at X: " <<
fGlobal[0];
211 LOG(debug2) <<
"I am at Y: " <<
fGlobal[1];
212 LOG(debug2) <<
"I am at Z: " <<
fGlobal[2];
216 Double_t fGlobalMax[3];
217 gGeoManager->LocalToMaster(local, fGlobalMax);
221 Double_t fGlobalMin[3];
222 gGeoManager->LocalToMaster(local, fGlobalMin);
224 if (fGlobalMax[0] > fGlobalMin[0]) {
231 if (fGlobalMax[1] > fGlobalMin[1]) {
257 TString pipeName =
"pipe";
261 TObjArray* nodes = gGeoManager->GetTopNode()->GetNodes();
263 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
264 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
265 if (TString(node->GetName())
266 .Contains(pipeName, TString::ECaseCompare::kIgnoreCase)) {
267 motherName = node->GetName();
268 fMother = Form(
"cave_1/%s/pipevac1_0", motherName.Data());
269 LOG(debug) <<
"MvdGeoHandler found Mother: " <<
fMother;
276 LOG(debug) <<
"Check for MVD outside of pipe";
278 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
279 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
280 if (TString(node->GetName())
281 .Contains(
"mvd", TString::ECaseCompare::kIgnoreCase)) {
282 motherName = node->GetName();
284 LOG(debug) <<
"MvdGeoHandler found Mother: " <<
fMother;
286 <<
"Mvd found outside of pipe, use this setup only in testing";
295 <<
"MVD Geometry included, but pipe not found please check your setup";
302 if (gGeoManager->CheckPath(
fMother +
"/Beamtimeosetupoobgnum_0")) {
303 LOG(info) <<
"Found Beamtimesetupy";
305 }
else if (gGeoManager->CheckPath(
306 fMother +
"/MVDoMistraloquero012oStationo150umodigi_0")) {
307 LOG(debug) <<
"Found MVD with 3 Stations";
309 }
else if (gGeoManager->CheckPath(
fMother
310 +
"/MVDo0123ohoFPCoextoHSoSo0123_0")) {
311 LOG(debug) <<
"Found MVD with 4 Stations";
314 }
else if (gGeoManager->CheckPath(
fMother
315 +
"/MVDo1123ohoFPCoextoHSoSo1123_0")) {
316 LOG(debug) <<
"Found shifted MVD with 4 Stations";
319 }
else if (gGeoManager->CheckPath(
fMother +
"/MVDomCBM_0")) {
320 LOG(debug) <<
"Found mCBM MVD configuration";
323 }
else if (gGeoManager->CheckPath(
fMother +
"/MVDomCBMorotated_0")) {
324 LOG(debug) <<
"Found mCBM MVD rotated configuration";
327 }
else if (gGeoManager->CheckPath(
fMother +
"/MVDscripted_0")) {
328 LOG(debug) <<
"Found scripted MVD configuration";
332 LOG(info) <<
"Try standard Geometry";
344 TString quadrantName;
347 gGeoManager->cd(path.Data());
349 sensorName = gGeoManager->GetMother(1)->GetName();
350 sensorName.Remove(0, 7);
351 Int_t sensorNumber = sensorName.Atoi();
353 quadrantName = gGeoManager->GetMother(2)->GetName();
354 stationName = quadrantName(10);
355 quadrantName.Remove(0, 12);
356 Int_t quadNumber = quadrantName.Atoi();
357 Int_t stationNumber = stationName.Atoi();
359 id = 1000 * stationNumber + 100 * quadNumber + sensorNumber;
383 <<
"Using old Geometry files within the new Digitizer is not supported, "
384 <<
"please use CbmMvdDigitizeL if you want to use this Geometry";
389 LOG(fatal) <<
"GeometryHandler couldn't find a valid Detector";
392 for (Int_t StatNr = 0; StatNr < 4; StatNr++) {
397 fStationName = Form(
"/MVDo%iohoFPCoextoHSoS_1", StatNr);
398 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
399 if (StatNr == 0 &&
fGeoTyp == 4)
402 fQuadrantName = Form(
"/St%iQ%iohoFPCoext_1", StatNr, QuadNr);
403 for (Int_t Layer = 0; Layer < 2; Layer++) {
405 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
412 Form(
"MVD-S%i-Q%i-L%i-C%02i-P0", StatNr, QuadNr, Layer, SensNr);
415 for (Int_t SegmentNr = 0; SegmentNr < 50; SegmentNr++) {
416 fSectorName = Form(
"/S%iQ%iS%i_1", StatNr, QuadNr, SegmentNr);
420 LOG(debug) <<
"looking for " <<
fnodeName;
421 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
444 LOG(fatal) <<
"GeometryHandler couldn't find a valid Detector";
447 for (Int_t StatNr = 0; StatNr < 4; StatNr++) {
450 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
452 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
456 LOG(debug1) <<
"looking for " <<
fnodeName;
457 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
484 <<
" and added to MVD Detector";
496 LOG(fatal) <<
"GeometryHandler couldn't find a valid mCBM Detector";
499 for (Int_t StatNr = 0; StatNr < 2; StatNr++) {
503 for (Int_t Layer = 0; Layer < 2; Layer++) {
504 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
506 Form(
"/MVD-S%i-Q0-L%i-C%02i_1", StatNr, Layer, SensNr);
508 Form(
"/MVD-S%i-Q0-L%i-C%02i-P0oPartAss_1", StatNr, Layer, SensNr);
509 fSensorName = Form(
"MVD-S%i-Q0-L%i-C%02i-P0", StatNr, Layer, SensNr);
514 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
532 LOG(error) <<
"Tried to load an unsupported MVD Geometry";
562 for (Int_t StatNr = 0; StatNr < 4; StatNr++) {
566 fStationName = Form(
"/MVDo%iohoFPCoextoHSoS_1", StatNr);
567 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
568 if (StatNr == 0 &&
fGeoTyp == 4)
571 fQuadrantName = Form(
"/St%iQ%iohoFPCoext_1", StatNr, QuadNr);
572 for (Int_t Layer = 0; Layer < 2; Layer++) {
573 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
580 Form(
"MVD-S%i-Q%i-L%i-C%02i-P0", StatNr, QuadNr, Layer, SensNr);
583 for (Int_t SegmentNr = 0; SegmentNr < 50; SegmentNr++) {
584 fSectorName = Form(
"/S%iQ%iS%i_1", StatNr, QuadNr, SegmentNr);
588 LOG(debug) <<
"looking for " <<
fnodeName;
589 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
602 for (Int_t StatNr = 0; StatNr < 4; StatNr++) {
604 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
606 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
610 LOG(debug) <<
"looking for " <<
fnodeName;
611 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
615 LOG(debug) <<
"found " <<
fnodeName <<
" number: " << iStation
616 <<
" ID: " <<
fVolId <<
" and added to station map";
619 LOG(debug) <<
"Map now size: " <<
fStationMap.size();
629 TString volName = Form(
"mvdstation%02i", iStation);
630 volId = gGeoManager->GetUID(volName);
633 LOG(info) << GetName() <<
"::ConstructAsciiGeometry: "
634 <<
"Station No. " << iStation <<
", volume ID " << volId
635 <<
", volume name " << volName;
638 }
while (volId > -1);
641 for (Int_t StatNr = 0; StatNr < 2; StatNr++) {
643 for (Int_t Layer = 0; Layer < 2; Layer++) {
644 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
646 Form(
"/MVD-S%i-Q0-L%i-C%02i_1", StatNr, Layer, SensNr);
648 Form(
"/MVD-S%i-Q0-L%i-C%02i-P0oPartAss_1", StatNr, Layer, SensNr);
649 fSensorName = Form(
"MVD-S%i-Q0-L%i-C%02i-P0", StatNr, Layer, SensNr);
656 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
667 LOG(error) <<
"You tried to use an unsuported Geometry";