34 Int_t currentModuleId = -1;
35 Int_t currentUnitId = -1;
37 TGeoIterator geoIterator(gGeoManager->GetTopNode()->GetVolume());
40 TGeoCombiTrans* unitToGlobalMatrix =
nullptr;
42 while ((curNode = geoIterator())) {
44 geoIterator.GetPath(nodePath);
50 TString nodeName(curNode->GetName());
52 currentUnitId = curNode->GetNumber();
53 const TGeoMatrix* curUnitMatrix = geoIterator.GetCurrentMatrix();
54 unitToGlobalMatrix =
new TGeoCombiTrans(*(curUnitMatrix));
57 unitSpecs->
fUnitId = currentUnitId;
58 unitSpecs->
fUnitName =
static_cast<TString
>(curNode->GetVolume()->GetName());
60 fUnitIdToSpecsMap.insert(pair<Int_t, CbmFsdUnitSpecs*>(currentUnitId, unitSpecs));
63 currentModuleId = curNode->GetNumber();
66 TGeoMatrix* moduleToUnitMatrix = curNode->GetMatrix();
67 TVector3 localModuleCoord(moduleToUnitMatrix->GetTranslation());
68 TVector3 globalModuleCoord;
69 if (!unitToGlobalMatrix) {
70 LOG(fatal) <<
"No parent (unit) matrix initialized!!";
72 unitToGlobalMatrix->LocalToMaster(&localModuleCoord[0], &globalModuleCoord[0]);
74 TGeoVolume* curScintillator =
nullptr;
75 for (
int idn = 0; idn < curNode->GetNdaughters(); idn++) {
76 TGeoNode* daughterNode = curNode->GetDaughter(idn);
77 if (TString(daughterNode->GetName()).Contains(
fActiveMatStr)) {
78 curScintillator = daughterNode->GetVolume();
82 const TGeoBBox*
shape = (
const TGeoBBox*) (curScintillator->GetShape());
85 moduleSpecs->
fX = globalModuleCoord[0];
86 moduleSpecs->
fY = globalModuleCoord[1];
87 moduleSpecs->
fZ = globalModuleCoord[2];
88 moduleSpecs->
dX =
shape->GetDX();
89 moduleSpecs->
dY =
shape->GetDY();
90 moduleSpecs->
dZ =
shape->GetDZ();
92 moduleSpecs->
fUnitId = currentUnitId;
97 LOG(info) <<
"CbmFsdGeoHandler has initialized maps";
131 Int_t upstreamOffset = 0;
132 while (((TString) vmc->CurrentVolOffName(upstreamOffset)).Length() > 0) {
133 if (((TString) vmc->CurrentVolOffName(upstreamOffset)).Contains(
fUnitStr)) {
134 vmc->CurrentVolOffID(upstreamOffset, unitID);
136 if (((TString) vmc->CurrentVolOffName(upstreamOffset)).Contains(
fModuleStr)) {
137 vmc->CurrentVolOffID(upstreamOffset, moduleID);
141 if (moduleID > -1 && unitID > -1) {
break; }
153 Int_t upstreamOffset = 0;
154 while (upstreamOffset <= geoMan->GetLevel()) {
155 TGeoNode* node = geoMan->GetMother(upstreamOffset);
156 if (((TString) node->GetVolume()->GetName()).Contains(
fUnitStr)) unitID = node->GetNumber();
157 if (((TString) node->GetVolume()->GetName()).Contains(
fModuleStr)) moduleID = node->GetNumber();
169 if (!geoPath.Contains(
fBranchStr)) { LOG(warning) << __func__ <<
": In geoPath " <<
fBranchStr <<
" was not found!"; }
170 else if (!geoPath.Contains(key)) {
171 LOG(warning) << __func__ <<
": In geoPath " << key <<
" was not found!";
174 Ssiz_t keyStart = geoPath.Index(key);
175 TString keyName = geoPath(keyStart, geoPath.Index(
"/", keyStart) - keyStart);
176 Ssiz_t copyNumStart = keyName.Last(
'_') + 1;
177 TString copyNumStr = keyName(copyNumStart, keyName.Length() - copyNumStart);
178 if (!copyNumStr.IsDigit()) {
179 LOG(warning) << __func__ <<
": Expected numerical part from " << geoPath <<
" using key " << key <<
" is "
180 << copyNumStr <<
" which does not contain only digits!";
183 copyNum = copyNumStr.Atoi();