35 Int_t currentModuleId = -1;
36 Int_t currentUnitId = -1;
38 TGeoIterator geoIterator(gGeoManager->GetTopNode()->GetVolume());
41 TGeoCombiTrans* unitToGlobalMatrix =
nullptr;
43 while ((curNode = geoIterator())) {
45 geoIterator.GetPath(nodePath);
51 TString nodeName(curNode->GetName());
53 currentUnitId = curNode->GetNumber();
54 const TGeoMatrix* curUnitMatrix = geoIterator.GetCurrentMatrix();
55 unitToGlobalMatrix =
new TGeoCombiTrans(*(curUnitMatrix));
58 unitSpecs->
fUnitId = currentUnitId;
59 unitSpecs->
fUnitName =
static_cast<TString
>(curNode->GetVolume()->GetName());
61 fUnitIdToSpecsMap.insert(pair<Int_t, CbmFsdUnitSpecs*>(currentUnitId, unitSpecs));
64 currentModuleId = curNode->GetNumber();
67 TGeoMatrix* moduleToUnitMatrix = curNode->GetMatrix();
68 TVector3 localModuleCoord(moduleToUnitMatrix->GetTranslation());
69 TVector3 globalModuleCoord;
70 if (!unitToGlobalMatrix) {
71 LOG(fatal) <<
"No parent (unit) matrix initialized!!";
73 unitToGlobalMatrix->LocalToMaster(&localModuleCoord[0], &globalModuleCoord[0]);
75 TGeoVolume* curScintillator =
nullptr;
76 for (
int idn = 0; idn < curNode->GetNdaughters(); idn++) {
77 TGeoNode* daughterNode = curNode->GetDaughter(idn);
78 if (TString(daughterNode->GetName()).Contains(
fActiveMatStr)) {
79 curScintillator = daughterNode->GetVolume();
83 const TGeoBBox*
shape = (
const TGeoBBox*) (curScintillator->GetShape());
86 moduleSpecs->
fX = globalModuleCoord[0];
87 moduleSpecs->
fY = globalModuleCoord[1];
88 moduleSpecs->
fZ = globalModuleCoord[2];
89 moduleSpecs->
dX =
shape->GetDX();
90 moduleSpecs->
dY =
shape->GetDY();
91 moduleSpecs->
dZ =
shape->GetDZ();
93 moduleSpecs->
fUnitId = currentUnitId;
98 LOG(info) <<
"CbmFsdGeoHandler has initialized maps";
132 Int_t upstreamOffset = 0;
133 while (((TString) vmc->CurrentVolOffName(upstreamOffset)).Length() > 0) {
134 if (((TString) vmc->CurrentVolOffName(upstreamOffset)).Contains(
fUnitStr)) {
135 vmc->CurrentVolOffID(upstreamOffset, unitID);
137 if (((TString) vmc->CurrentVolOffName(upstreamOffset)).Contains(
fModuleStr)) {
138 vmc->CurrentVolOffID(upstreamOffset, moduleID);
142 if (moduleID > -1 && unitID > -1) {
break; }
154 Int_t upstreamOffset = 0;
155 while (upstreamOffset <= geoMan->GetLevel()) {
156 TGeoNode* node = geoMan->GetMother(upstreamOffset);
157 if (((TString) node->GetVolume()->GetName()).Contains(
fUnitStr)) unitID = node->GetNumber();
158 if (((TString) node->GetVolume()->GetName()).Contains(
fModuleStr)) moduleID = node->GetNumber();
170 if (!geoPath.Contains(
fBranchStr)) { LOG(warning) << __func__ <<
": In geoPath " <<
fBranchStr <<
" was not found!"; }
171 else if (!geoPath.Contains(key)) {
172 LOG(warning) << __func__ <<
": In geoPath " << key <<
" was not found!";
175 Ssiz_t keyStart = geoPath.Index(key);
176 TString keyName = geoPath(keyStart, geoPath.Index(
"/", keyStart) - keyStart);
177 Ssiz_t copyNumStart = keyName.Last(
'_') + 1;
178 TString copyNumStr = keyName(copyNumStart, keyName.Length() - copyNumStart);
179 if (!copyNumStr.IsDigit()) {
180 LOG(warning) << __func__ <<
": Expected numerical part from " << geoPath <<
" using key " << key <<
" is "
181 << copyNumStr <<
" which does not contain only digits!";
184 copyNum = copyNumStr.Atoi();