62 gMC->CurrentVolOffID(1, copyNr);
64 string s(gMC->CurrentVolPath());
65 if (s.find(
"Volume") < s.size()) {
66 LOG(debug4) <<
"New geo " << gMC->CurrentVolPath();
68 gMC->CurrentVolOffID(2, copyNr);
71 LOG(debug4) <<
"Legacy geo " << gMC->CurrentVolPath();
76 string s(gGeoManager->GetPath());
77 if (s.find(
"Volume") < s.size()) {
78 LOG(debug4) <<
"New geo " << s;
82 LOG(debug4) <<
"Legacy geo " << s;
84 TGeoNode* node = gGeoManager->GetMother(nodeIdx);
86 copyNr = node->GetNumber();
88 LOG(debug4) <<
"CopyNr: " << copyNr;
93 if ((copyNr / 100000000) > 0)
96 layerId = ((copyNr / 1000) % 100) - 1;
97 moduleId = (copyNr % 1000) - 1;
98 LOG(debug4) <<
"2014 ";
103 layerId = ((copyNr / 100) % 100) - 1;
104 moduleId = (copyNr % 100) - 1;
105 LOG(debug4) <<
"2013 ";
108 LOG(debug4) << copyNr / 100000000 <<
" copy " << copyNr <<
" layerID " << layerId <<
" moduleId " << moduleId;
208 LOG(debug) <<
"CbmTrdGeoHandler::NavigateTo(" << path.Data() <<
")";
209 if (
fIsSimulation) { LOG(fatal) <<
"This method is not supported in simulation mode"; }
211 gGeoManager->cd(path.Data());
215 Double_t local[3] = {0., 0., 0.};
216 gGeoManager->LocalToMaster(local,
fGlobal);
219 string s(gGeoManager->GetPath());
220 if (s.find(
"Volume") < s.size()) {
221 LOG(debug) <<
"CbmTrdGeoHandler::NavigateTo(new geo)";
225 TGeoNode* modulenode = gGeoManager->GetMother(nodeIdx);
227 TGeoNode* layernode = gGeoManager->GetMother(nodeIdx + 1);
229 std::string moduleName = modulenode->GetName();
230 auto typeposstart = moduleName.find(
"module") + 6;
232 auto partoftype = moduleName.at(typeposstart);
233 while (std::isdigit(partoftype) && (ndigits + typeposstart) < moduleName.size()) {
234 partoftype = moduleName.at(typeposstart + ndigits);
237 fModuleType = std::atoi(moduleName.substr(typeposstart, ndigits).data());
240 Int_t layercopyNr = layernode->GetNumber();
242 fStation = ((layercopyNr / 10000) % 10);
244 fLayer = ((layercopyNr / 100) % 10);
247 Int_t modulecopyNr = modulenode->GetNumber();
249 if ((modulecopyNr / 100000000) > 0)
253 fRotation = ((modulecopyNr / 100000) % 10);
255 for (
int i = 0; i < modulenode->GetNdaughters(); i++) {
256 TString nDaughter(modulenode->GetDaughter(i)->GetName());
257 if (!nDaughter.BeginsWith(
"radiator") && !nDaughter.BeginsWith(
"Radiator"))
continue;
266 fRotation = ((modulecopyNr / 10000) % 10);
287 std::map<Int_t, TGeoPhysicalNode*> moduleMap;
289 TGeoNode* topNode = gGeoManager->GetTopNode();
290 TObjArray* nodes = topNode->GetNodes();
291 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
292 TGeoNode* node =
static_cast<TGeoNode*
>(nodes->At(iNode));
293 if (!TString(node->GetName()).Contains(
"trd", TString::kIgnoreCase))
295 TGeoNode* station = node;
297 TObjArray* layers = station->GetNodes();
298 for (Int_t iLayer = 0; iLayer < layers->GetEntriesFast(); iLayer++) {
299 TGeoNode* layer =
static_cast<TGeoNode*
>(layers->At(iLayer));
300 if (!TString(layer->GetName()).Contains(
"layer", TString::kIgnoreCase))
continue;
302 TObjArray* modules = layer->GetNodes();
303 for (Int_t iModule = 0; iModule < modules->GetEntriesFast(); iModule++) {
304 TGeoNode* module =
static_cast<TGeoNode*
>(modules->At(iModule));
305 TObjArray* parts =
module->GetNodes();
306 for (Int_t iPart = 0; iPart < parts->GetEntriesFast(); iPart++) {
307 TGeoNode* part =
static_cast<TGeoNode*
>(parts->At(iPart));
308 if (!TString(part->GetName()).Contains(
"gas", TString::kIgnoreCase))
continue;
314 TString path = TString(
"/") + topNode->GetName() +
"/" + station->GetName() +
"/" + layer->GetName() +
"/"
315 +
module->GetName() + "/" + part->GetName();
317 LOG(debug) <<
"Adding detector with path " << path;
319 TGeoPhysicalNode* pNode =
new TGeoPhysicalNode(path.Data());
321 moduleMap[address] = pNode;
static uint32_t GetAddress(int32_t layerId, int32_t moduleId, int32_t sectorId, int32_t rowId, int32_t columnId)
Return address from system ID, layer, module, sector, column and row IDs.