]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fixes from cholm to enable reading of geometry from a file
authorhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Jun 2010 11:09:45 +0000 (11:09 +0000)
committerhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Jun 2010 11:09:45 +0000 (11:09 +0000)
FMD/AliFMD.cxx
FMD/AliFMDGeometry.cxx

index e4d09cdc95372f6d5cfeecb446df0c6e3b2e5f2f..06b075e48c9d34f2cb3b9eaa79511b5c53879c2f 100644 (file)
@@ -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]));
index f9dadf432c1248e640fd27107cc426b3a31d8226..b1106658e1873176bc38ff3114c3fa623d357b3f 100644 (file)
@@ -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<TGeoNode*>(next()))) 
     if (CheckNodes(node, name, lvl) >= 0) return lvl;
   return -1;
+#endif
 }
 
 //____________________________________________________________________