]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliGeomManager.cxx
OADB classes and root files for the physics selection
[u/mrichter/AliRoot.git] / STEER / AliGeomManager.cxx
index e29a817dbecb256f93a409f572e79fe74ca188c2..3c262c23e23efefc46e420a9a780d3cc8856e32e 100644 (file)
@@ -293,7 +293,7 @@ AliGeomManager::ELayerID AliGeomManager::VolUIDToLayerSafe(UShort_t voluid, Int_
   // Checks the validity of the given voluid
   //
   ELayerID layId = VolUIDToLayerSafe(voluid);
-  if(layId){
+  if(layId != AliGeomManager::kInvalidLayer){
     Int_t mId = Int_t(voluid & 0x7ff);
     if( mId>=0 && mId<LayerSize(layId)){
       modId = mId;
@@ -477,7 +477,7 @@ Bool_t AliGeomManager::CheckSymNamesLUT(const char* /*detsToBeChecked*/)
 {
   // Check the look-up table which associates the unique numerical identity of
   // each alignable volume to the corresponding symbolic volume name.
-  // The LUT is now hold inside the geometry and handled by TGeo.
+  // The LUT is now held inside the geometry and handled by TGeo.
   // The method is meant to be launched when loading a geometry to verify that
   // no changes in the symbolic names have been introduced, which would prevent
   // backward compatibility with alignment objects.
@@ -560,7 +560,29 @@ Bool_t AliGeomManager::CheckSymNamesLUT(const char* /*detsToBeChecked*/)
   }
   if(phosActive) detsString+="PHOS ";
 
-  if(fgGeometry->CheckPath("ALIC_1/XEN1_1")) detsString+="EMCAL";
+  // Check over the ten EMCAL full supermodules and the two EMCAL half supermodules
+  TString emcalSM;
+  TString baseEmcalSM("ALIC_1/XEN1_1/SM");
+  Bool_t emcalActive=kFALSE;
+  Bool_t emcalSMs[12] = {kFALSE};
+  for(Int_t sm=0; sm<12; sm++)
+  {
+    emcalSM=baseEmcalSM;
+    if(sm<10){
+       emcalSM += "OD_";
+       emcalSM += (sm+1);
+    }else{
+       emcalSM += "10_";
+       emcalSM += (sm-9);
+    }
+    if(fgGeometry->CheckPath(emcalSM.Data()))
+    {
+      emcalActive=kTRUE;
+      emcalSMs[sm]=kTRUE;
+    }
+  }
+  if(emcalActive) detsString+="EMCAL ";
+  
 
   TString symname;
   const char* sname;
@@ -922,6 +944,7 @@ Bool_t AliGeomManager::CheckSymNamesLUT(const char* /*detsToBeChecked*/)
     TString snSTRIP = "/strip";
     
     for (Int_t isect = 0; isect < nSectors; isect++) {
+       if(tofSMs[isect]) AliDebugClass(3,Form("Consistency check for symnames of TOF supermodule %d.",isect));
       for (Int_t istr = 1; istr <= nStrips; istr++) {  
        symname  = snSM;
        symname += Form("%02d",isect);
@@ -929,7 +952,6 @@ Bool_t AliGeomManager::CheckSymNamesLUT(const char* /*detsToBeChecked*/)
        symname += Form("%02d",istr);
        uid = LayerToVolUID(kTOF,modnum++);
        if(!tofSMs[isect]) continue; // taking possible missing TOF sectors (partial geometry) into account
-       AliDebugClass(2,Form("Consistency check for symnames of TOF supermodule %d.",isect));
        if ((isect==13 || isect==14 || isect==15) && (istr >= 39 && istr <= 53)) continue; //taking holes into account
        pne = fgGeometry->GetAlignableEntryByUID(uid);
        if(!pne)
@@ -993,6 +1015,7 @@ Bool_t AliGeomManager::CheckSymNamesLUT(const char* /*detsToBeChecked*/)
     
     for(Int_t layer=0; layer<6; layer++){
       modnum=0;
+      AliDebugClass(3,Form("Consistency check for symnames of TRD layer %d.",layer));
       for (Int_t isect = 0; isect < 18; isect++) {
        for (Int_t icham = 0; icham < 5; icham++) {
          symname  = snStr;
@@ -1003,7 +1026,6 @@ Bool_t AliGeomManager::CheckSymNamesLUT(const char* /*detsToBeChecked*/)
          symname += layer;
          uid = LayerToVolUID(arTRDlayId[layer],modnum++);
          if(!trdSMs[isect]) continue;
-         AliDebugClass(2,Form("Consistency check for symnames of TRD supermodule %d.",isect));
          if ((isect==13 || isect==14 || isect==15) && icham==2) continue; //keeping holes into account
          pne = fgGeometry->GetAlignableEntryByUID(uid);
          if(!pne)
@@ -1082,6 +1104,7 @@ Bool_t AliGeomManager::CheckSymNamesLUT(const char* /*detsToBeChecked*/)
     modnum=0;
 
     for (Int_t iModule=1; iModule <= 12; iModule++) {
+      if(!emcalSMs[iModule-1]) continue;
       symname = str;
       symname += iModule;
       if(iModule >10) {
@@ -1510,8 +1533,9 @@ void AliGeomManager::CheckOverlapsOverPNs(Double_t threshold)
 //_____________________________________________________________________________
 Int_t AliGeomManager::GetNalignable(const char* module)
 {
-  // Get number of declared alignable volumes for given detector in current geometry
-  //
+  // Get number of declared alignable volumes in current geometry
+  // for the given detector "module" passed as a vaild detector name
+  // if the detector name is invalid return -1
   
   // return the detector index corresponding to detector
   Int_t index = -1 ;
@@ -1519,6 +1543,7 @@ Int_t AliGeomManager::GetNalignable(const char* module)
     if ( strcmp(module, fgkDetectorName[index]) == 0 )
       break ;
   }
+  if(index==fgkNDetectors) return -1;
   return fgNalignable[index];
 }
   
@@ -1580,7 +1605,7 @@ Bool_t AliGeomManager::ApplyAlignObjsFromCDB(const char* AlignDetsList)
   
   while((str = (TObjString*) iter.Next())){
     TString det(str->String());
-    AliInfoClass(Form("Loading alignment objs for %s",det.Data()));
+    AliDebugClass(5,Form("Loading alignment objs for %s",det.Data()));
     if(!LoadAlignObjsFromCDBSingleDet(det.Data(),alignObjArray)){
       alObjsNotLoaded += det.Data();
       alObjsNotLoaded += " ";
@@ -1594,7 +1619,8 @@ Bool_t AliGeomManager::ApplyAlignObjsFromCDB(const char* AlignDetsList)
 
   if(!alObjsLoaded.IsNull()) AliInfoClass(Form("Alignment objects loaded for: %s",
                                               alObjsLoaded.Data()));
-  if(!alObjsNotLoaded.IsNull()) AliInfoClass(Form("Didn't/couldn't load alignment objects for: %s",
+  if(!alObjsNotLoaded.IsNull())
+      AliFatalClass(Form("Could not load alignment objects from OCDB for: %s",
                                                  alObjsNotLoaded.Data()));
  
   return ApplyAlignObjsToGeom(alignObjArray);
@@ -1645,40 +1671,40 @@ Bool_t AliGeomManager::LoadAlignObjsFromCDBSingleDet(const char* detName, TObjAr
 //_____________________________________________________________________________
 Bool_t AliGeomManager::ApplyAlignObjsToGeom(TObjArray& alignObjArray, Bool_t ovlpcheck)
 {
-  // Read collection of alignment objects (AliAlignObj derived) saved
-  // in the TClonesArray alObjArray and apply them to gGeoManager
-  //
-  alignObjArray.Sort();
-  Int_t nvols = alignObjArray.GetEntriesFast();
+    // Read collection of alignment objects (AliAlignObj derived) saved
+    // in the TClonesArray alObjArray and apply them to gGeoManager
+    //
+    alignObjArray.Sort();
+    Int_t nvols = alignObjArray.GetEntriesFast();
 
-  Bool_t flag = kTRUE;
+    Bool_t flag = kTRUE;
 
-  for(Int_t j=0; j<nvols; j++)
-  {
-    AliAlignObj* alobj = (AliAlignObj*) alignObjArray.UncheckedAt(j);
-    flag = alobj->ApplyToGeometry(ovlpcheck);
-    if(!flag)
+    for(Int_t j=0; j<nvols; j++)
     {
-      AliDebugClass(5,Form("Error applying alignment object for volume %s !",alobj->GetSymName()));
-    }else{
-      AliDebugClass(5,Form("Alignment object for volume %s applied successfully",alobj->GetSymName()));
-    }
+       AliAlignObj* alobj = (AliAlignObj*) alignObjArray.UncheckedAt(j);
+       if(!alobj->ApplyToGeometry(ovlpcheck))
+       {
+           flag = kFALSE;
+           AliDebugClass(5,Form("Error applying alignment object for volume %s !",alobj->GetSymName()));
+       }else{
+           AliDebugClass(5,Form("Alignment object for volume %s applied successfully",alobj->GetSymName()));
+       }
 
-  }
+    }
 
-  if (AliDebugLevelClass() > 5) {
-    fgGeometry->CheckOverlaps(0.001);
-    TObjArray* ovexlist = fgGeometry->GetListOfOverlaps();
-    if(ovexlist->GetEntriesFast()){  
-      AliErrorClass("The application of alignment objects to the geometry caused huge overlaps/extrusions!");
-      fgGeometry->PrintOverlaps();
-   }
-  }
+    if (AliDebugLevelClass() > 5) {
+       fgGeometry->CheckOverlaps(0.001);
+       TObjArray* ovexlist = fgGeometry->GetListOfOverlaps();
+       if(ovexlist->GetEntriesFast()){  
+           AliErrorClass("The application of alignment objects to the geometry caused huge overlaps/extrusions!");
+           fgGeometry->PrintOverlaps();
+       }
+    }
 
-  // Update the TGeoPhysicalNodes
-  fgGeometry->RefreshPhysicalNodes();
+    // Update the TGeoPhysicalNodes
+    fgGeometry->RefreshPhysicalNodes();
 
-  return flag;
+    return flag;
 
 }