23#include <TGeoManager.h>
24#include <TGeoMaterial.h>
26#include <TGeoVolume.h>
37 , fStationPar(nullptr)
39 , fIsSimulation(kFALSE)
99 LOG(info) <<
"Using Mimosa style sensor";
196 if (
fIsSimulation) { LOG(fatal) <<
"This method is not supported in simulation mode"; }
198 gGeoManager->cd(path.Data());
202 LOG(debug2) <<
"this volume is " << name;
204 Double_t local[3] = {0., 0., 0.};
205 gGeoManager->LocalToMaster(local,
fGlobal);
207 if (path.Contains(
"-S0-") || path.Contains(
"_S0_"))
fStationNumber = 0;
208 else if (path.Contains(
"-S1-") || path.Contains(
"_S1_"))
210 else if (path.Contains(
"-S2-") || path.Contains(
"_S2_"))
212 else if (path.Contains(
"-S3-") || path.Contains(
"_S3_"))
215 LOG(fatal) <<
"couldn't find Station in volume name, something seems fishy ";
217 LOG(debug2) <<
"I am in path: " << path;
218 LOG(debug2) <<
"I am: " << name;
220 LOG(debug2) <<
"I am at X: " <<
fGlobal[0];
221 LOG(debug2) <<
"I am at Y: " <<
fGlobal[1];
222 LOG(debug2) <<
"I am at Z: " <<
fGlobal[2];
227 Double_t fGlobalMax[3];
228 gGeoManager->LocalToMaster(local, fGlobalMax);
233 Double_t fGlobalMin[3];
234 gGeoManager->LocalToMaster(local, fGlobalMin);
236 if (fGlobalMax[0] > fGlobalMin[0]) {
244 if (fGlobalMax[1] > fGlobalMin[1]) {
266 TString pipeName =
"pipe";
270 TObjArray* nodes = gGeoManager->GetTopNode()->GetNodes();
272 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
273 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
274 if (TString(node->GetName()).Contains(pipeName, TString::ECaseCompare::kIgnoreCase)) {
275 motherName = node->GetName();
276 fMother = Form(
"cave_1/%s/pipevac1_0", motherName.Data());
277 LOG(debug) <<
"MvdGeoHandler found Mother: " <<
fMother;
285 LOG(debug) <<
"Check for MVD outside of pipe";
287 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
288 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
289 if (TString(node->GetName()).Contains(
"mvd", TString::ECaseCompare::kIgnoreCase)) {
290 motherName = node->GetName();
292 LOG(debug) <<
"MvdGeoHandler found Mother: " <<
fMother;
293 LOG(warn) <<
"Mvd found outside of pipe, use this setup only in testing";
301 if (fail) LOG(fatal) <<
"MVD Geometry included, but pipe not found please check your setup";
309 if (gGeoManager->CheckPath(
fMother +
"/Beamtimeosetupoobgnum_0")) {
310 LOG(info) <<
"Found Beamtimesetupy";
313 else if (gGeoManager->CheckPath(
fMother +
"/MVDoMistraloquero012oStationo150umodigi_0")) {
314 LOG(debug) <<
"Found MVD with 3 Stations";
317 else if (gGeoManager->CheckPath(
fMother +
"/MVDo0123ohoFPCoextoHSoSo0123_0")) {
318 LOG(debug) <<
"Found MVD with 4 Stations";
322 else if (gGeoManager->CheckPath(
fMother +
"/MVDo1123ohoFPCoextoHSoSo1123_0")) {
323 LOG(debug) <<
"Found shifted MVD with 4 Stations";
327 else if (gGeoManager->CheckPath(
fMother +
"/MVDomCBM_0")) {
328 LOG(debug) <<
"Found mCBM MVD configuration";
332 else if (gGeoManager->CheckPath(
fMother +
"/MVDomCBMorotated_0")) {
333 LOG(debug) <<
"Found mCBM MVD rotated configuration";
337 else if (gGeoManager->CheckPath(
fMother +
"/TwoStation_0")) {
338 LOG(info) <<
"Found two station scripted MVD configuration";
342 else if (gGeoManager->CheckPath(
fMother +
"/MVDscripted_0")) {
343 LOG(info) <<
"Found scripted MVD configuration";
348 LOG(info) <<
"Try standard Geometry";
361 TString quadrantName;
364 gGeoManager->cd(path.Data());
366 sensorName = gGeoManager->GetMother(1)->GetName();
367 sensorName.Remove(0, 7);
368 Int_t sensorNumber = sensorName.Atoi();
370 quadrantName = gGeoManager->GetMother(2)->GetName();
371 stationName = quadrantName(10);
372 quadrantName.Remove(0, 12);
373 Int_t quadNumber = quadrantName.Atoi();
374 Int_t stationNumber = stationName.Atoi();
376 id = 1000 * stationNumber + 100 * quadNumber + sensorNumber;
400 LOG(error) <<
"Using old Geometry files within the new Digitizer is not supported, "
401 <<
"please use CbmMvdDigitizeL if you want to use this Geometry";
405 if (!
fDetector) LOG(fatal) <<
"GeometryHandler couldn't find a valid Detector";
408 for (Int_t StatNr = 0; StatNr < 4; StatNr++) {
412 fStationName = Form(
"/MVDo%iohoFPCoextoHSoS_1", StatNr);
413 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
416 fQuadrantName = Form(
"/St%iQ%iohoFPCoext_1", StatNr, QuadNr);
417 for (Int_t Layer = 0; Layer < 2; Layer++) {
419 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
420 fSensorHolding = Form(
"/MVD-S%i-Q%i-L%i-C%02i-P0oPartAss_1", StatNr, QuadNr, Layer, SensNr);
421 fSensorName = Form(
"MVD-S%i-Q%i-L%i-C%02i-P0", StatNr, QuadNr, Layer, SensNr);
424 for (Int_t SegmentNr = 0; SegmentNr < 50; SegmentNr++) {
425 fSectorName = Form(
"/S%iQ%iS%i_1", StatNr, QuadNr, SegmentNr);
428 LOG(debug) <<
"looking for " <<
fnodeName;
429 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
445 if (!
fDetector) LOG(fatal) <<
"GeometryHandler couldn't find a valid Detector";
449 for (Int_t StatNr = 0; StatNr < 4; StatNr++) {
452 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
454 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
458 LOG(debug1) <<
"looking for " <<
fnodeName;
459 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
473 <<
" and added to MVD Detector";
484 if (!
fDetector) LOG(fatal) <<
"GeometryHandler couldn't find a valid Detector";
486 for (Int_t StatNr = 0; StatNr < 2; StatNr++) {
489 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
491 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
495 LOG(debug1) <<
"looking for " <<
fnodeName;
496 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
510 <<
" and added to MVD Detector";
522 if (!
fDetector) LOG(fatal) <<
"GeometryHandler couldn't find a valid mCBM Detector";
525 for (Int_t StatNr = 0; StatNr < 2; StatNr++) {
529 for (Int_t Layer = 0; Layer < 2; Layer++) {
530 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
531 fQuadrantName = Form(
"/MVD-S%i-Q0-L%i-C%02i_1", StatNr, Layer, SensNr);
532 fSensorHolding = Form(
"/MVD-S%i-Q0-L%i-C%02i-P0oPartAss_1", StatNr, Layer, SensNr);
533 fSensorName = Form(
"MVD-S%i-Q0-L%i-C%02i-P0", StatNr, Layer, SensNr);
538 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
551 LOG(error) <<
"Tried to load an unsupported MVD Geometry";
580 for (Int_t StatNr = 0; StatNr < 4; StatNr++) {
583 fStationName = Form(
"/MVDo%iohoFPCoextoHSoS_1", StatNr);
584 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
587 fQuadrantName = Form(
"/St%iQ%iohoFPCoext_1", StatNr, QuadNr);
588 for (Int_t Layer = 0; Layer < 2; Layer++) {
589 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
590 fSensorHolding = Form(
"/MVD-S%i-Q%i-L%i-C%02i-P0oPartAss_1", StatNr, QuadNr, Layer, SensNr);
591 fSensorName = Form(
"MVD-S%i-Q%i-L%i-C%02i-P0", StatNr, QuadNr, Layer, SensNr);
594 for (Int_t SegmentNr = 0; SegmentNr < 50; SegmentNr++) {
595 fSectorName = Form(
"/S%iQ%iS%i_1", StatNr, QuadNr, SegmentNr);
598 LOG(debug) <<
"looking for " <<
fnodeName;
599 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
613 for (Int_t StatNr = 0; StatNr < 4; StatNr++) {
615 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
617 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
621 LOG(debug) <<
"looking for " <<
fnodeName;
622 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
626 LOG(debug) <<
"found " <<
fnodeName <<
" number: " << iStation <<
" ID: " <<
fVolId
627 <<
" and added to station map";
630 LOG(debug) <<
"Map now size: " <<
fStationMap.size();
641 for (Int_t StatNr = 0; StatNr < 2; StatNr++) {
643 for (Int_t QuadNr = 0; QuadNr < 4; QuadNr++) {
645 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
649 LOG(debug) <<
"looking for " <<
fnodeName;
650 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
654 LOG(debug) <<
"found " <<
fnodeName <<
" number: " << iStation <<
" ID: " <<
fVolId
655 <<
" and added to station map";
658 LOG(debug) <<
"Map now size: " <<
fStationMap.size();
670 TString volName = Form(
"mvdstation%02i", iStation);
671 volId = gGeoManager->GetUID(volName);
674 LOG(info) << GetName() <<
"::ConstructAsciiGeometry: "
675 <<
"Station No. " << iStation <<
", volume ID " << volId <<
", volume name " << volName;
678 }
while (volId > -1);
682 for (Int_t StatNr = 0; StatNr < 2; StatNr++) {
684 for (Int_t Layer = 0; Layer < 2; Layer++) {
685 for (Int_t SensNr = 0; SensNr < 50; SensNr++) {
686 fQuadrantName = Form(
"/MVD-S%i-Q0-L%i-C%02i_1", StatNr, Layer, SensNr);
687 fSensorHolding = Form(
"/MVD-S%i-Q0-L%i-C%02i-P0oPartAss_1", StatNr, Layer, SensNr);
688 fSensorName = Form(
"MVD-S%i-Q0-L%i-C%02i-P0", StatNr, Layer, SensNr);
695 Bool_t nodeFound = gGeoManager->CheckPath(
fnodeName.Data());
707 LOG(error) <<
"You tried to use an unsuported Geometry";
ClassImp(CbmConverterManager)
Helper class to extract information from the GeoManager. Addapted from TrdGeoHandler byFlorian Uhlig ...
void AddSensor(TString clearName, TString fullName, TString nodeName, CbmMvdSensorDataSheet *sensorData, Int_t sensorNr, Int_t volumeId, Double_t sensorStartTime, Int_t stationNr)
static CbmMvdDetector * Instance()
void SetParameterFile(CbmMvdStationPar *parameter)
~CbmMvdGeoHandler()
Destructor.
CbmMvdGeoHandler()
Constructor.
void Init(Bool_t isSimulation=kFALSE)
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
void AddYRes(Int_t stationNumber, Double_t yres)
void Init(Int_t nrOfStations)
void Print(Option_t *opt="") const
void AddZPosition(Int_t stationNumber, Double_t z, Double_t zThickness)
void AddBeamWidth(Int_t stationNumber, Double_t beamwidth)
void AddHeight(Int_t stationNumber, Double_t height)
void AddWidth(Int_t stationNumber, Double_t width)
void AddBeamHeight(Int_t stationNumber, Double_t beamheight)
void AddZRadThickness(Int_t stationNumber, Double_t length)
void AddXRes(Int_t stationNumber, Double_t xres)