From 53a1201d8d279d7424dc2c3a25321caa0b9c953c Mon Sep 17 00:00:00 2001 From: hdalsgaa Date: Fri, 4 Jun 2010 11:09:45 +0000 Subject: [PATCH] Fixes from cholm to enable reading of geometry from a file --- FMD/AliFMD.cxx | 21 ++++++++++++++++++++- FMD/AliFMDGeometry.cxx | 24 ++++++++++++++++++++---- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/FMD/AliFMD.cxx b/FMD/AliFMD.cxx index e4d09cdc953..06b075e48c9 100644 --- a/FMD/AliFMD.cxx +++ b/FMD/AliFMD.cxx @@ -493,9 +493,28 @@ AliFMD::Init() AliFMDDebug(1, ("Initialising FMD detector object")); TVirtualMC* mc = TVirtualMC::GetMC(); AliFMDGeometry* fmd = AliFMDGeometry::Instance(); - const TArrayI& actGeo = fmd->ActiveIds(); + TArrayI actGeo = fmd->ActiveIds(); + bool valid = true; + if (actGeo.fN <= 0) valid = false; + else { + for (int i = 0; i < actGeo.fN; i++) { + if (actGeo[i] < 0) { + valid = false; + break; + } + } + } + if (!valid) { + AliFMDDebug(1, ("Extracting geometry info from loaded geometry")); + fmd->ExtractGeomInfo(); + actGeo = fmd->ActiveIds(); + } TArrayI actVmc(actGeo.fN); for (Int_t i = 0; i < actGeo.fN; i++) { + if (actGeo[i] < 0) { + AliError(Form("Invalid id: %d", actGeo[i])); + continue; + } TGeoVolume *sens = gGeoManager->GetVolume(actGeo[i]); if (!sens) { AliError(Form("No TGeo volume for sensitive volume ID=%d",actGeo[i])); diff --git a/FMD/AliFMDGeometry.cxx b/FMD/AliFMDGeometry.cxx index f9dadf432c1..b1106658e18 100644 --- a/FMD/AliFMDGeometry.cxx +++ b/FMD/AliFMDGeometry.cxx @@ -428,10 +428,11 @@ AliFMDGeometry::ExtractGeomInfo() // and so on - that is, all the geometric information we need for // futher processing, such as simulation, digitization, // reconstruction, etc. - Int_t detectorDepth = FindNodeDepth("FMD1_1", "ALIC"); - Int_t ringDepth = FindNodeDepth(Form("FMDI_%d", Int_t('I')), "ALIC"); - Int_t moduleDepth = FindNodeDepth("FIFV_0", "ALIC"); - Int_t sectorDepth = FindNodeDepth("FISE_1", "ALIC"); + Int_t detectorDepth = FindNodeDepth("F1MT_1", "ALIC"); + Int_t ringDepth = FindNodeDepth(Form("FITV_%d", int('I')), "ALIC"); + Int_t moduleDepth = FindNodeDepth("FIBH_0", "ALIC"); + Int_t sectorDepth = FindNodeDepth("FISC_1", "ALIC"); + fActive.Set(0); fActive.Reset(-1); AliFMDDebug(1, ("Geometry depths:\n" " Sector: %d\n" @@ -521,6 +522,20 @@ FindNodeDepth(const char* name, const char* volname) std::cerr << "No top volume defined" << std::endl; return -1; } + + TGeoIterator next(vol); + TGeoNode* node = 0; + TString sName(name); + while ((node = next())) { + // std::cout << "Checking node " << node->GetName() << std::endl; + if (sName == node->GetName()) { + std::cout << "Found node " << node->GetName() << " at level " + << next.GetLevel() << std::endl; + return next.GetLevel(); + } + } + return -1; +#if 0 TObjArray* nodes = vol->GetNodes(); if (!nodes) { std::cerr << "No nodes in top volume" << std::endl; @@ -532,6 +547,7 @@ FindNodeDepth(const char* name, const char* volname) while ((node = static_cast(next()))) if (CheckNodes(node, name, lvl) >= 0) return lvl; return -1; +#endif } //____________________________________________________________________ -- 2.43.0