]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliGeomManager.cxx
Updated misalignment macros and AliITSMisalignMaker class (R. Grosso)
[u/mrichter/AliRoot.git] / STEER / AliGeomManager.cxx
index ea8b1cf33b5ad5c157de60a23a496af15c800256..97c787d651eec374813c0b6aba8fa0015e6fbaeb 100644 (file)
@@ -441,16 +441,27 @@ const char* AliGeomManager::SymName(ELayerID layerId, Int_t modId)
   // Returns the symbolic volume name given for a given layer
   // and module ID
   //
+  if(!fgGeometry){
+    AliErrorClass("No geometry instance loaded yet!");
+    return NULL;
+  }
   if(modId<0 || modId>=fgLayerSize[layerId-kFirstLayer]){
     AliWarningClass(Form("Module number %d not in the valid range (0->%d) !",modId,fgLayerSize[layerId-kFirstLayer]-1));
     return NULL;
   }
 
-  return fgPNEntry[layerId-kFirstLayer][modId]->GetName();
+  TGeoPNEntry* pne = fgPNEntry[layerId-kFirstLayer][modId];
+  if(!pne)
+  {
+    AliWarningClass(Form("Module %d of layer %s is not activated!",modId,LayerName(layerId)));
+    return NULL;
+  }
+  return pne->GetName();
+
 }
 
 //_____________________________________________________________________________
-Bool_t AliGeomManager::CheckSymNamesLUT()
+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.
@@ -462,127 +473,339 @@ Bool_t AliGeomManager::CheckSymNamesLUT()
   // for TRD and TOF volumes which are missing in the partial geometry.
   // 
 
+//  TString detsString(detsToBeChecked);
+//  if(detsString.Contains("ALL")) detsString="ITS TPC TOF TRD HMPID PHOS EMCAL";
+
+  // Temporary measure to face the case of reconstruction over detectors not present in the geometry
+  TString detsString = "";
+  if(fgGeometry->CheckPath("ALIC_1/ITSV_1")) detsString+="ITS ";
+  if(fgGeometry->CheckPath("ALIC_1/TPC_M_1")) detsString+="TPC ";
+
+  TString tofsm;
+  TString baseTof("ALIC_1/B077_1/BSEGMO");
+  TString middleTof("_1/BTOF");
+  TString trailTof("_1/FTOA_0");
+  Bool_t tofActive=kFALSE;
+  Bool_t tofSMs[18];
+  for(Int_t sm=0; sm<18; sm++)
+  {
+    tofSMs[sm]=kFALSE;
+    tofsm=baseTof;
+    tofsm += sm;
+    tofsm += middleTof;
+    tofsm += sm;
+    tofsm += trailTof;
+    if(fgGeometry->CheckPath(tofsm.Data()))
+    {
+      tofActive=kTRUE;
+      tofSMs[sm]=kTRUE;
+    }
+  }
+  if(tofActive) detsString+="TOF ";
+  
+  TString trdsm;
+  TString baseTrd("ALIC_1/B077_1/BSEGMO");
+  TString middleTrd("_1/BTRD");
+  TString trailTrd("_1/UTR1_1");
+  Bool_t trdActive=kFALSE;
+  Bool_t trdSMs[18];
+  for(Int_t sm=0; sm<18; sm++)
+  {
+    trdSMs[sm]=kFALSE;
+    trdsm=baseTrd;
+    trdsm += sm;
+    trdsm += middleTrd;
+    trdsm += sm;
+    trdsm += trailTrd;
+    if(fgGeometry->CheckPath(trdsm.Data()))
+    {
+      trdActive=kTRUE;
+      trdSMs[sm]=kTRUE;
+    }
+  }
+  if(trdActive) detsString+="TRD ";
+
+  if(fgGeometry->CheckPath("ALIC_1/Hmp0_0")) detsString+="HMPID ";
+  
+  TString phosMod, cpvMod;
+  TString basePhos("ALIC_1/PHOS_");
+  Bool_t phosActive=kFALSE;
+  Bool_t cpvActive=kFALSE;
+  Bool_t phosMods[5];
+  for(Int_t pmod=0; pmod<5; pmod++)
+  {
+    phosMods[pmod]=kFALSE;
+    phosMod = basePhos;
+    phosMod += (pmod+1);
+    cpvMod = phosMod;
+    cpvMod += "/PCPV_1";
+    if(fgGeometry->CheckPath(phosMod.Data()))
+    {
+      phosActive=kTRUE;
+      phosMods[pmod]=kTRUE;
+      if(fgGeometry->CheckPath(cpvMod.Data())) cpvActive=kTRUE;
+    }
+  }
+  if(phosActive) detsString+="PHOS ";
+
+  if(fgGeometry->CheckPath("ALIC_1/XEN1_1")) detsString+="EMCAL";
+
   TString symname;
   const char* sname;
   TGeoPNEntry* pne = 0x0;
   Int_t uid; // global unique identity
   Int_t modnum; // unique id inside layer; in the following, set it to 0 at the start of each layer
 
+  if(detsString.Contains("ITS")){
   /*********************       ITS layers  ***********************/
-  TString strSPD = "ITS/SPD";
-  TString strSDD = "ITS/SDD";
-  TString strSSD = "ITS/SSD";
-  TString strStave = "/Stave";
-  TString strHalfStave = "/HalfStave";
-  TString strLadder = "/Ladder";
-  TString strSector = "/Sector";
-  TString strSensor = "/Sensor";
-  TString strEntryName1;
-  TString strEntryName2;
-  TString strEntryName3;
-
-  /*********************       SPD layer1  ***********************/
-  {
-    modnum = 0;
-    
-    for(Int_t cSect = 0; cSect<10; cSect++){
-      strEntryName1 = strSPD;
-      strEntryName1 += 0;
-      strEntryName1 += strSector;
-      strEntryName1 += cSect;
-      
-      for(Int_t cStave =0; cStave<2; cStave++){
-       strEntryName2 = strEntryName1;
-       strEntryName2 += strStave;
-       strEntryName2 += cStave;
-
-       for (Int_t cHS=0; cHS<2; cHS++) {
-         strEntryName3 = strEntryName2;
-         strEntryName3 += strHalfStave;
-         strEntryName3 += cHS;
-         
-         for(Int_t cLad =0; cLad<2; cLad++){
-           symname = strEntryName3;
-           symname += strLadder;
-           symname += cLad+cHS*2;
-           uid = LayerToVolUID(kSPD1,modnum++);
-           pne = fgGeometry->GetAlignableEntryByUID(uid);
-           if(!pne)
-           {
-             AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
-             return kFALSE;
-           }
-           sname = pne->GetName();
-           if(symname.CompareTo(sname)) 
-           {
-             AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d."
-                   "Expected was %s, found was %s!", uid, symname.Data(), sname));
-             return kFALSE;
+    AliDebugClass(2,"Checking consistency of symbolic names for ITS layers");
+    TString strSPD = "ITS/SPD";
+    TString strSDD = "ITS/SDD";
+    TString strSSD = "ITS/SSD";
+    TString strStave = "/Stave";
+    TString strHalfStave = "/HalfStave";
+    TString strLadder = "/Ladder";
+    TString strSector = "/Sector";
+    TString strSensor = "/Sensor";
+    TString strEntryName1;
+    TString strEntryName2;
+    TString strEntryName3;
+
+    /*********************       SPD layer1  ***********************/
+    {
+      modnum = 0;
+
+      for(Int_t cSect = 0; cSect<10; cSect++){
+       strEntryName1 = strSPD;
+       strEntryName1 += 0;
+       strEntryName1 += strSector;
+       strEntryName1 += cSect;
+
+       for(Int_t cStave =0; cStave<2; cStave++){
+         strEntryName2 = strEntryName1;
+         strEntryName2 += strStave;
+         strEntryName2 += cStave;
+
+         for (Int_t cHS=0; cHS<2; cHS++) {
+           strEntryName3 = strEntryName2;
+           strEntryName3 += strHalfStave;
+           strEntryName3 += cHS;
+
+           for(Int_t cLad =0; cLad<2; cLad++){
+             symname = strEntryName3;
+             symname += strLadder;
+             symname += cLad+cHS*2;
+             uid = LayerToVolUID(kSPD1,modnum++);
+             pne = fgGeometry->GetAlignableEntryByUID(uid);
+             if(!pne)
+             {
+               AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
+               return kFALSE;
+             }
+             sname = pne->GetName();
+             if(symname.CompareTo(sname)) 
+             {
+               AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d."
+                     "Expected was %s, found was %s!", uid, symname.Data(), sname));
+               return kFALSE;
+             }
            }
          }
        }
       }
     }
-  }
-  
-  /*********************       SPD layer2  ***********************/
-  {
-    modnum = 0;
-
-    for(Int_t cSect = 0; cSect<10; cSect++){
-      strEntryName1 = strSPD;
-      strEntryName1 += 1;
-      strEntryName1 += strSector;
-      strEntryName1 += cSect;
-
-      for(Int_t cStave =0; cStave<4; cStave++){
-       strEntryName2 = strEntryName1;
-       strEntryName2 += strStave;
-       strEntryName2 += cStave;
-
-       for (Int_t cHS=0; cHS<2; cHS++) {
-         strEntryName3 = strEntryName2;
-         strEntryName3 += strHalfStave;
-         strEntryName3 += cHS;
-
-         for(Int_t cLad =0; cLad<2; cLad++){
-           symname = strEntryName3;
-           symname += strLadder;
-           symname += cLad+cHS*2;
-           uid = LayerToVolUID(kSPD2,modnum++);
-           pne = fgGeometry->GetAlignableEntryByUID(uid);
-           if(!pne)
-           {
-             AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
-             return kFALSE;
-           }
-           sname = pne->GetName();
-           if(symname.CompareTo(sname)) 
-           {
-             AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d."
-                   "Expected was %s, found was %s!", uid, symname.Data(), sname));
-             return kFALSE;
+
+    /*********************       SPD layer2  ***********************/
+    {
+      modnum = 0;
+
+      for(Int_t cSect = 0; cSect<10; cSect++){
+       strEntryName1 = strSPD;
+       strEntryName1 += 1;
+       strEntryName1 += strSector;
+       strEntryName1 += cSect;
+
+       for(Int_t cStave =0; cStave<4; cStave++){
+         strEntryName2 = strEntryName1;
+         strEntryName2 += strStave;
+         strEntryName2 += cStave;
+
+         for (Int_t cHS=0; cHS<2; cHS++) {
+           strEntryName3 = strEntryName2;
+           strEntryName3 += strHalfStave;
+           strEntryName3 += cHS;
+
+           for(Int_t cLad =0; cLad<2; cLad++){
+             symname = strEntryName3;
+             symname += strLadder;
+             symname += cLad+cHS*2;
+             uid = LayerToVolUID(kSPD2,modnum++);
+             pne = fgGeometry->GetAlignableEntryByUID(uid);
+             if(!pne)
+             {
+               AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
+               return kFALSE;
+             }
+             sname = pne->GetName();
+             if(symname.CompareTo(sname)) 
+             {
+               AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d."
+                     "Expected was %s, found was %s!", uid, symname.Data(), sname));
+               return kFALSE;
+             }
            }
          }
        }
       }
     }
+
+    /*********************       SDD layer1  ***********************/
+    {
+      modnum=0;
+
+      for(Int_t c1 = 1; c1<=14; c1++){
+       strEntryName1 = strSDD;
+       strEntryName1 += 2;
+       strEntryName1 +=strLadder;
+       strEntryName1 += (c1-1);
+       for(Int_t c2 =1; c2<=6; c2++){
+         symname = strEntryName1;
+         symname += strSensor;
+         symname += (c2-1);
+         uid = LayerToVolUID(kSDD1,modnum++);
+         pne = fgGeometry->GetAlignableEntryByUID(uid);
+         if(!pne)
+         {
+           AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
+           return kFALSE;
+         }
+         sname = pne->GetName();
+         if(symname.CompareTo(sname)) 
+         {
+           AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
+                 "Expected was %s, found was %s!", uid, symname.Data(), sname));
+           return kFALSE;
+         }
+       }
+      }
+    }
+
+    /*********************       SDD layer2  ***********************/
+    {
+      modnum=0;
+
+      for(Int_t c1 = 1; c1<=22; c1++){
+       strEntryName1 = strSDD;
+       strEntryName1 += 3;
+       strEntryName1 +=strLadder;
+       strEntryName1 += (c1-1);
+       for(Int_t c2 = 1; c2<=8; c2++){
+         symname = strEntryName1;
+         symname += strSensor;
+         symname += (c2-1);
+         uid = LayerToVolUID(kSDD2,modnum++);
+         pne = fgGeometry->GetAlignableEntryByUID(uid);
+         if(!pne)
+         {
+           AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
+           return kFALSE;
+         }
+         sname = pne->GetName();
+         if(symname.CompareTo(sname)) 
+         {
+           AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
+                 "Expected was %s, found was %s!", uid, symname.Data(), sname));
+           return kFALSE;
+         }
+       }
+      }
+    }
+
+    /*********************       SSD layer1  ***********************/
+    {
+      modnum=0;
+
+      for(Int_t c1 = 1; c1<=34; c1++){
+       strEntryName1 = strSSD;
+       strEntryName1 += 4;
+       strEntryName1 +=strLadder;
+       strEntryName1 += (c1-1);
+       for(Int_t c2 = 1; c2<=22; c2++){
+         symname = strEntryName1;
+         symname += strSensor;
+         symname += (c2-1);
+         uid = LayerToVolUID(kSSD1,modnum++);
+         pne = fgGeometry->GetAlignableEntryByUID(uid);
+         if(!pne)
+         {
+           AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
+           return kFALSE;
+         }
+         sname = pne->GetName();
+         if(symname.CompareTo(sname)) 
+         {
+           AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
+                 "Expected was %s, found was %s!", uid, symname.Data(), sname));
+           return kFALSE;
+         }
+       }
+      }
+    }
+
+    /*********************       SSD layer2  ***********************/
+    {
+      modnum=0;
+
+      for(Int_t c1 = 1; c1<=38; c1++){
+       strEntryName1 = strSSD;
+       strEntryName1 += 5;
+       strEntryName1 +=strLadder;
+       strEntryName1 += (c1-1);
+       for(Int_t c2 = 1; c2<=25; c2++){
+         symname = strEntryName1;
+         symname += strSensor;
+         symname += (c2-1);
+         uid = LayerToVolUID(kSSD2,modnum++);
+         pne = fgGeometry->GetAlignableEntryByUID(uid);
+         if(!pne)
+         {
+           AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
+           return kFALSE;
+         }
+         sname = pne->GetName();
+         if(symname.CompareTo(sname)) 
+         {
+           AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
+                 "Expected was %s, found was %s!", uid, symname.Data(), sname));
+           return kFALSE;
+         }
+       }
+      }
+    }
+
+    AliDebugClass(2,"Consistency check for ITS symbolic names finished successfully.");
   }
 
-  /*********************       SDD layer1  ***********************/
+  if(detsString.Contains("TPC"))
   {
-    modnum=0;
+    /***************    TPC inner and outer layers    ****************/
+    
+    AliDebugClass(2,"Checking consistency of symbolic names for TPC layers");
+    TString sAsector="TPC/EndcapA/Sector";
+    TString sCsector="TPC/EndcapC/Sector";
+    TString sInner="/InnerChamber";
+    TString sOuter="/OuterChamber";
 
-    for(Int_t c1 = 1; c1<=14; c1++){
-      strEntryName1 = strSDD;
-      strEntryName1 += 2;
-      strEntryName1 +=strLadder;
-      strEntryName1 += (c1-1);
-      for(Int_t c2 =1; c2<=6; c2++){
-       symname = strEntryName1;
-       symname += strSensor;
-       symname += (c2-1);
-       uid = LayerToVolUID(kSDD1,modnum++);
+    /***************    TPC inner chambers' layer    ****************/
+    {
+      modnum = 0;
+
+      for(Int_t cnt=1; cnt<=18; cnt++)
+      {
+       symname = sAsector;
+       symname += cnt;
+       symname += sInner;
+       uid = LayerToVolUID(kTPC1,modnum++);
        pne = fgGeometry->GetAlignableEntryByUID(uid);
        if(!pne)
        {
@@ -597,23 +820,13 @@ Bool_t AliGeomManager::CheckSymNamesLUT()
          return kFALSE;
        }
       }
-    }
-  }
-
-  /*********************       SDD layer2  ***********************/
-  {
-    modnum=0;
 
-    for(Int_t c1 = 1; c1<=22; c1++){
-      strEntryName1 = strSDD;
-      strEntryName1 += 3;
-      strEntryName1 +=strLadder;
-      strEntryName1 += (c1-1);
-      for(Int_t c2 = 1; c2<=8; c2++){
-       symname = strEntryName1;
-       symname += strSensor;
-       symname += (c2-1);
-       uid = LayerToVolUID(kSDD2,modnum++);
+      for(Int_t cnt=1; cnt<=18; cnt++)
+      {
+       symname = sCsector;
+       symname += cnt;
+       symname += sInner;
+       uid = LayerToVolUID(kTPC1,modnum++);
        pne = fgGeometry->GetAlignableEntryByUID(uid);
        if(!pne)
        {
@@ -629,22 +842,17 @@ Bool_t AliGeomManager::CheckSymNamesLUT()
        }
       }
     }
-  }
 
-  /*********************       SSD layer1  ***********************/
-  {
-    modnum=0;
+    /***************    TPC outer chambers' layer    ****************/
+    {
+      modnum = 0;
 
-    for(Int_t c1 = 1; c1<=34; c1++){
-      strEntryName1 = strSSD;
-      strEntryName1 += 4;
-      strEntryName1 +=strLadder;
-      strEntryName1 += (c1-1);
-      for(Int_t c2 = 1; c2<=22; c2++){
-       symname = strEntryName1;
-       symname += strSensor;
-       symname += (c2-1);
-       uid = LayerToVolUID(kSSD1,modnum++);
+      for(Int_t cnt=1; cnt<=18; cnt++)
+      {
+       symname = sAsector;
+       symname += cnt;
+       symname += sOuter;
+       uid = LayerToVolUID(kTPC2,modnum++);
        pne = fgGeometry->GetAlignableEntryByUID(uid);
        if(!pne)
        {
@@ -659,23 +867,13 @@ Bool_t AliGeomManager::CheckSymNamesLUT()
          return kFALSE;
        }
       }
-    }
-  }
-
-  /*********************       SSD layer2  ***********************/
-  {
-    modnum=0;
 
-    for(Int_t c1 = 1; c1<=38; c1++){
-      strEntryName1 = strSSD;
-      strEntryName1 += 5;
-      strEntryName1 +=strLadder;
-      strEntryName1 += (c1-1);
-      for(Int_t c2 = 1; c2<=25; c2++){
-       symname = strEntryName1;
-       symname += strSensor;
-       symname += (c2-1);
-       uid = LayerToVolUID(kSSD2,modnum++);
+      for(Int_t cnt=1; cnt<=18; cnt++)
+      {
+       symname = sCsector;
+       symname += cnt;
+       symname += sOuter;
+       uid = LayerToVolUID(kTPC2,modnum++);
        pne = fgGeometry->GetAlignableEntryByUID(uid);
        if(!pne)
        {
@@ -691,115 +889,23 @@ Bool_t AliGeomManager::CheckSymNamesLUT()
        }
       }
     }
-  }
-
 
-  /***************    TPC inner and outer layers    ****************/
-  TString sAsector="TPC/EndcapA/Sector";
-  TString sCsector="TPC/EndcapC/Sector";
-  TString sInner="/InnerChamber";
-  TString sOuter="/OuterChamber";
-  
-  /***************    TPC inner chambers' layer    ****************/
-  {
-    modnum = 0;
-    
-    for(Int_t cnt=1; cnt<=18; cnt++){
-      symname = sAsector;
-      symname += cnt;
-      symname += sInner;
-      uid = LayerToVolUID(kTPC1,modnum++);
-      pne = fgGeometry->GetAlignableEntryByUID(uid);
-      if(!pne)
-      {
-       AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
-       return kFALSE;
-      }
-      sname = pne->GetName();
-      if(symname.CompareTo(sname)) 
-      {
-       AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
-             "Expected was %s, found was %s!", uid, symname.Data(), sname));
-       return kFALSE;
-      }
-    }
-    for(Int_t cnt=1; cnt<=18; cnt++){
-      symname = sCsector;
-      symname += cnt;
-      symname += sInner;
-      uid = LayerToVolUID(kTPC1,modnum++);
-      pne = fgGeometry->GetAlignableEntryByUID(uid);
-      if(!pne)
-      {
-       AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
-       return kFALSE;
-      }
-      sname = pne->GetName();
-      if(symname.CompareTo(sname)) 
-      {
-       AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
-             "Expected was %s, found was %s!", uid, symname.Data(), sname));
-       return kFALSE;
-      }
-    }
+    AliDebugClass(2,"Consistency check for TPC symbolic names finished successfully.");
   }
 
-  /***************    TPC outer chambers' layer    ****************/
+  if(detsString.Contains("TOF"))
   {
-    modnum = 0;
-    
-    for(Int_t cnt=1; cnt<=18; cnt++){
-      symname = sAsector;
-      symname += cnt;
-      symname += sOuter;
-      uid = LayerToVolUID(kTPC2,modnum++);
-      pne = fgGeometry->GetAlignableEntryByUID(uid);
-      if(!pne)
-      {
-       AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
-       return kFALSE;
-      }
-      sname = pne->GetName();
-      if(symname.CompareTo(sname)) 
-      {
-       AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
-             "Expected was %s, found was %s!", uid, symname.Data(), sname));
-       return kFALSE;
-      }
-    }
-    for(Int_t cnt=1; cnt<=18; cnt++){
-      symname = sCsector;
-      symname += cnt;
-      symname += sOuter;
-      uid = LayerToVolUID(kTPC2,modnum++);
-      pne = fgGeometry->GetAlignableEntryByUID(uid);
-      if(!pne)
-      {
-       AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
-       return kFALSE;
-      }
-      sname = pne->GetName();
-      if(symname.CompareTo(sname)) 
-      {
-       AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
-             "Expected was %s, found was %s!", uid, symname.Data(), sname));
-       return kFALSE;
-      }
-    }
-  }    
+    /*********************       TOF layer   ***********************/
 
-  /*********************       TOF layer   ***********************/
-  {
+    AliDebugClass(2,"Checking consistency of symbolic names for TOF layers");
     modnum=0;
-    
+
     Int_t nstrA=15;
     Int_t nstrB=19;
     Int_t nstrC=19;
     Int_t nSectors=18;
     Int_t nStrips=nstrA+2*nstrB+2*nstrC;
 
-    Int_t activeSectors[18]={0,0,1,1,1,0,1,1,0,0,0,-1,-1,0,1,1,1,1};// as in config-file for partial geometry
-    
     TString snSM  = "TOF/sm";
     TString snSTRIP = "/strip";
     
@@ -810,7 +916,8 @@ Bool_t AliGeomManager::CheckSymNamesLUT()
        symname += snSTRIP;
        symname += Form("%02d",istr);
        uid = LayerToVolUID(kTOF,modnum++);
-       if(!activeSectors[isect]) continue; // taking possible missing TOF sectors (partial geometry) into account
+       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)
@@ -827,10 +934,15 @@ Bool_t AliGeomManager::CheckSymNamesLUT()
        }
       }
     }
+    
+    AliDebugClass(2,"Consistency check for TOF symbolic names finished successfully.");
   } 
 
-  /*********************      HMPID layer   ***********************/
+  if(detsString.Contains("HMPID"))
   {
+    /*********************      HMPID layer   ***********************/
+
+    AliDebugClass(2,"Checking consistency of symbolic names for HMPID layers");
     TString str = "/HMPID/Chamber";
 
     for (modnum=0; modnum < 7; modnum++) {
@@ -851,15 +963,18 @@ Bool_t AliGeomManager::CheckSymNamesLUT()
        return kFALSE;
       }
     }
+
+    AliDebugClass(2,"Consistency check for HMPID symbolic names finished successfully.");
   }
 
-  /*********************      TRD layers 1-6   *******************/
-  //!! 6 layers with index increasing in outwards direction
+  if(detsString.Contains("TRD"))
   {
+    /*********************      TRD layers 1-6   *******************/
+    //!! 6 layers with index increasing in outwards direction
+    
+    AliDebugClass(2,"Checking consistency of symbolic names for TRD layers");
     Int_t arTRDlayId[6] = {kTRD1, kTRD2, kTRD3, kTRD4, kTRD5, kTRD6};
 
-    Int_t activeSectors[18]={0,0,1,1,1,0,1,0,0,0,0,1,1,0,1,1,0,0};// as in config-file for partial geometry
-    
     TString snStr  = "TRD/sm";
     TString snApp1 = "/st";
     TString snApp2 = "/pl";
@@ -875,7 +990,8 @@ Bool_t AliGeomManager::CheckSymNamesLUT()
          symname += snApp2;
          symname += layer;
          uid = LayerToVolUID(arTRDlayId[layer],modnum++);
-         if(!activeSectors[isect]) continue;
+         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)
@@ -893,63 +1009,63 @@ Bool_t AliGeomManager::CheckSymNamesLUT()
        }
       }
     }
-  }
-
-  /*********************      PHOS EMC layer   ***********************/
-  {
-    TString str = "PHOS/Module";
-    modnum=0;
 
-    for (Int_t iModule=1; iModule <= 5; iModule++) {
-      symname = str;
-      symname += iModule;
-      modnum = iModule-1;
-      uid = LayerToVolUID(kPHOS1,modnum);
-      pne = fgGeometry->GetAlignableEntryByUID(uid);
-      if(!pne)
-      {
-       AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
-       return kFALSE;
-      }
-      sname = pne->GetName();
-      if(symname.CompareTo(sname)) 
-      {
-       AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
-             "Expected was %s, found was %s!", uid, symname.Data(), sname));
-       return kFALSE;
-      }
-    }
+    AliDebugClass(2,"Consistency check for TRD symbolic names finished successfully.");
   }
 
-  /*********************      PHOS CPV layer   ***********************/
+  if(detsString.Contains("PHOS"))
   {
-    TString str = "PHOS/Module";
-    modnum=0;
+    /*********************      PHOS EMC layer   ***********************/
 
-    for (Int_t iModule=1; iModule <= 5; iModule++) {
-      symname = str;
-      symname += iModule;
-      symname += "/CPV";
-      modnum = iModule-1;
-      uid = LayerToVolUID(kPHOS2,modnum);
-      pne = fgGeometry->GetAlignableEntryByUID(uid);
-      if(!pne)
-      {
-       AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
-       return kFALSE;
-      }
-      sname = pne->GetName();
-      if(symname.CompareTo(sname)) 
-      {
-       AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
-             "Expected was %s, found was %s!", uid, symname.Data(), sname));
-       return kFALSE;
+    AliDebugClass(2,"Checking consistency of symbolic names for PHOS layers");
+    
+      TString str = "PHOS/Module";
+      modnum=0;
+
+      for (Int_t iModule=0; iModule < 5; iModule++) {
+       if(!phosMods[iModule]) continue;
+       symname = str;
+       symname += (iModule+1);
+       uid = LayerToVolUID(kPHOS1,iModule);
+       pne = fgGeometry->GetAlignableEntryByUID(uid);
+       if(!pne)
+       {
+         AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
+         return kFALSE;
+       }
+       sname = pne->GetName();
+       if(symname.CompareTo(sname)) 
+       {
+         AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
+               "Expected was %s, found was %s!", uid, symname.Data(), sname));
+         return kFALSE;
+       }
+       /*********************      PHOS CPV layer   ***********************/
+       if(!cpvActive) continue;
+       symname += "/CPV";
+       uid = LayerToVolUID(kPHOS2,iModule);
+       pne = fgGeometry->GetAlignableEntryByUID(uid);
+       if(!pne)
+       {
+         AliErrorClass(Form("In the currently loaded geometry there is no TGeoPNEntry with unique id %d",uid));
+         return kFALSE;
+       }
+       sname = pne->GetName();
+       if(symname.CompareTo(sname)) 
+       {
+         AliErrorClass(Form("Current loaded geometry differs in the definition of symbolic name for uid %d"
+               "Expected was %s, found was %s!", uid, symname.Data(), sname));
+         return kFALSE;
+       }
       }
-    }
+    AliDebugClass(2,"Consistency check for PHOS symbolic names finished successfully.");
   }
 
-  /*********************      EMCAL layer   ***********************/
+  if(detsString.Contains("EMCAL"))
   {
+    /*********************      EMCAL layer   ***********************/
+
+    AliDebugClass(2,"Checking consistency of symbolic names for EMCAL layers");
     TString str = "EMCAL/FullSupermodule";
     modnum=0;
 
@@ -976,6 +1092,8 @@ Bool_t AliGeomManager::CheckSymNamesLUT()
        return kFALSE;
       }
     }
+  
+    AliDebugClass(2,"Consistency check for EMCAL symbolic names finished successfully.");
   }
   
   return kTRUE;
@@ -1379,6 +1497,65 @@ void AliGeomManager::CheckOverlapsOverPNs(Double_t threshold)
   delete overlaps;
 }
 
+//_____________________________________________________________________________
+Bool_t AliGeomManager::IsModuleInGeom(const char* module)
+{
+  // Return true if the module passed as argument is present in the current geometry
+  //
+  
+  TString subdet(module);
+
+  if(subdet==TString("ACORDE"))
+  {
+      if(fgGeometry->GetAlignableEntry("ACORDE/Array1")) return kTRUE;
+  }else if(subdet==TString("EMCAL"))
+  {
+      if(fgGeometry->GetAlignableEntry("EMCAL/FullSupermodule0") || fgGeometry->GetAlignableEntry("EMCAL/CosmicTestSupermodule0")) return kTRUE;
+  }else if(subdet==TString("FMD"))
+  {
+      if(fgGeometry->GetAlignableEntry("FMD/FMD1_T")) return kTRUE;
+  }else if(subdet==TString("HMPID"))
+  {
+      if(fgGeometry->GetAlignableEntry("/HMPID/Chamber0")) return kTRUE;
+  }else if(subdet==TString("ITS"))
+  {
+      if(fgGeometry->GetAlignableEntry("ITS")) return kTRUE;
+  }else if(subdet==TString("MUON"))
+  {
+      if(fgGeometry->GetAlignableEntry("/MUON/GM0")) return kTRUE;
+  }else if(subdet==TString("PMD"))
+  {
+      if(fgGeometry->GetAlignableEntry("PMD/Sector1")) return kTRUE;
+  }else if(subdet==TString("PHOS"))
+  {
+      if(fgGeometry->GetAlignableEntry("PHOS/Cradle0")) return kTRUE;
+  }else if(subdet==TString("T0"))
+  {
+      if(fgGeometry->GetAlignableEntry("/ALIC_1/0STR_1")) return kTRUE;
+  }else if(subdet==TString("TRD"))
+  {
+      if(fgGeometry->GetAlignableEntry("TRD/sm00")) return kTRUE;
+  }else if(subdet==TString("TPC"))
+  {
+      if(fgGeometry->GetAlignableEntry("TPC/EndcapA/Sector1/InnerChamber")) return kTRUE;
+  }else if(subdet==TString("TOF"))
+  {
+      if(fgGeometry->GetAlignableEntry("TOF/sm00/strip01")) return kTRUE;
+  }else if(subdet==TString("VZERO"))
+  {
+      if(fgGeometry->GetAlignableEntry("VZERO/V0C")) return kTRUE;
+  }else if(subdet==TString("ZDC"))
+  {
+      if(fgGeometry->GetAlignableEntry("ZDC/NeutronZDC_C")) return kTRUE;
+  }else if(subdet==TString("FRAME"))
+  {
+      if(fgGeometry->GetAlignableEntry("FRAME/Sector0")) return kTRUE;
+  }else
+      AliErrorClass(Form("%s is not a valid ALICE module name",module));
+
+  return kFALSE;
+}
+
 //_____________________________________________________________________________
 Bool_t AliGeomManager::ApplyAlignObjsFromCDB(const char* AlignDetsList)
 {
@@ -1480,16 +1657,24 @@ Bool_t AliGeomManager::ApplyAlignObjsToGeom(TObjArray& alignObjArray, Bool_t ovl
   Bool_t flag = kTRUE;
 
   for(Int_t j=0; j<nvols; j++)
+  {
+    AliAlignObj* alobj = (AliAlignObj*) alignObjArray.UncheckedAt(j);
+    flag = alobj->ApplyToGeometry(ovlpcheck);
+    if(!flag)
     {
-      AliAlignObj* alobj = (AliAlignObj*) alignObjArray.UncheckedAt(j);
-      if (alobj->ApplyToGeometry(ovlpcheck) == kFALSE) flag = kFALSE;
+      AliWarningClass(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() >= 1) {
-    fgGeometry->GetTopNode()->CheckOverlaps(1);
+  }
+
+  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();
    }
   }
 
@@ -1575,3 +1760,5 @@ Bool_t AliGeomManager::ApplyAlignObjsToGeom(const char* detName, Int_t runnum, I
 
   return ApplyAlignObjsToGeom(*alignObjArray);
 }
+
+