]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALGeometry.cxx
Add getters for exotic cell parameters, move E cross calculation to a separate method
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGeometry.cxx
index 7a3b3c605cd4f6dc894c66731e8bb219b186692d..cab671e6e206581ff2ffa13167f18f7f1bc35a70 100644 (file)
@@ -40,7 +40,9 @@
 //                the sizes updated with last information from production
 //                drawing (end of October 2010). 
 //      
-//   EMCAL_COMPLETEV1: Same fixes as FIRSTYEAR and 10 SM instead of 10+2 half SM
+//   EMCAL_COMPLETEV1: Same fixes as FIRSTYEAR and 10 SM instead of 10 + 2 one_third SM, for 2011 runs
+//
+//   EMCAL_COMPLETE12SMV1: contains 12 SM for runs from year 2012 and on
 //
 //   EMCAL_WSUC (Wayne State test stand)
 //      = no definite equivalent in old notation, was only used by
@@ -80,7 +82,7 @@
 //        You have to use just the correct name of geometry. If name is empty string the
 //        default name of geometry will be used.
 //         
-//  AliEMCALGeometry* geom = new AliEMCALGeometry("EMCAL_COMPLETEV1","EMCAL");
+//  AliEMCALGeometry* geom = new AliEMCALGeometry("EMCAL_COMPLETE12SMV1","EMCAL");
 //  TGeoManager::Import("geometry.root");
 //
 //  MC:   If you work with MC data you have to get geometry the next way: 
 //#include <Riostream.h>
 
 // --- AliRoot header files ---
+#include "AliLog.h"
 #include "AliEMCALGeometry.h"
 #include "AliEMCALShishKebabTrd1Module.h"
 
@@ -111,7 +114,7 @@ ClassImp(AliEMCALGeometry)
 
 // these initialisations are needed for a singleton
 AliEMCALGeometry  *AliEMCALGeometry::fgGeom      = 0;
-const Char_t*      AliEMCALGeometry::fgkDefaultGeometryName = "EMCAL_COMPLETEV1";
+const Char_t*      AliEMCALGeometry::fgkDefaultGeometryName = "EMCAL_COMPLETE12SMV1";
 
 //____________________________________________________________________________
 AliEMCALGeometry::AliEMCALGeometry():
@@ -157,6 +160,7 @@ AliEMCALGeometry::AliEMCALGeometry(const AliEMCALGeometry & geo)
     fIPDistance(geo.fIPDistance),fLongModuleSize(geo.fLongModuleSize),fShellThickness(geo.fShellThickness),
     fZLength(geo.fZLength),fSampling(geo.fSampling),fUseExternalMatrices(geo.fUseExternalMatrices)
 {
+  // Copy constarctor
   fEnvelop[0] = geo.fEnvelop[0];
   fEnvelop[1] = geo.fEnvelop[1];
   fEnvelop[2] = geo.fEnvelop[2];
@@ -171,7 +175,8 @@ AliEMCALGeometry::AliEMCALGeometry(const AliEMCALGeometry & geo)
 }
 
 //____________________________________________________________________________
-AliEMCALGeometry::AliEMCALGeometry(const Text_t* name, const Text_t* title) 
+AliEMCALGeometry::AliEMCALGeometry(const Text_t* name,   const Text_t* title,
+                                   const Text_t* mcname, const Text_t* mctitle) 
   : TNamed(name, title),
     fEMCGeometry(0x0),fGeoName(0),
     fKey110DEG(0),fNCellsInSupMod(0),fNETAdiv(0),fNPHIdiv(0),
@@ -187,8 +192,8 @@ AliEMCALGeometry::AliEMCALGeometry(const Text_t* name, const Text_t* title)
 { 
 
   // ctor only for normal usage 
-
-  fEMCGeometry = new AliEMCALEMCGeometry(name,title);
+  
+  fEMCGeometry = new AliEMCALEMCGeometry(name,title,mcname,mctitle);
 
   fGeoName = fEMCGeometry->GetGeoName();
   fKey110DEG = fEMCGeometry->GetKey110DEG();
@@ -272,7 +277,7 @@ AliEMCALGeometry::~AliEMCALGeometry(void)
         delete fkSModuleMatrix[smod] ;
         fkSModuleMatrix[smod]=0 ;
     }
-    delete fEMCGeometry; fEMCGeometry = 0 ;
+    delete fEMCGeometry; // fEMCGeometry = 0 ;
   }
 }
 
@@ -285,16 +290,16 @@ AliEMCALGeometry *  AliEMCALGeometry::GetInstance(){
 }
 
 //______________________________________________________________________
-AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name,
-                                                const Text_t* title){
+AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name,   const Text_t* title,
+                                                const Text_t* mcname, const Text_t* mctitle ){
   // Returns the pointer of the unique instance
-  
+    
   AliEMCALGeometry * rv = 0; 
   if ( fgGeom == 0 ) {
     if ( strcmp(name,"") == 0 ) { // get default geometry
-      fgGeom = new AliEMCALGeometry(fgkDefaultGeometryName, title);
+      fgGeom = new AliEMCALGeometry(fgkDefaultGeometryName, title,mcname,mctitle);
     } else {
-      fgGeom = new AliEMCALGeometry(name, title);
+      fgGeom = new AliEMCALGeometry(name, title,mcname,mctitle);
     }  // end if strcmp(name,"")
     if ( AliEMCALEMCGeometry::fgInit ) rv = (AliEMCALGeometry * ) fgGeom;
     else {
@@ -456,8 +461,10 @@ Int_t AliEMCALGeometry::GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi,
   // 0 <= nIeta   < fNETAdiv
   // 0 <= absid   < fNCells
   static Int_t id=0; // have to change from 0 to fNCells-1
-  if(fKey110DEG == 1 && nSupMod >= 10) { // 110 degree case; last two supermodules
+  if(fKey110DEG == 1 && nSupMod >= 10 && !fGeoName.Contains("12SMV1")) { // 110 degree case; last two supermodules halfsupermodules 
     id  = fNCellsInSupMod*10 + (fNCellsInSupMod/2)*(nSupMod-10);
+  } else if(fKey110DEG == 1 && nSupMod >= 10 && fGeoName.Contains("12SMV1")) { // 110 degree case; last two supermodules 1/3 supermodules 
+    id  = fNCellsInSupMod*10 + (fNCellsInSupMod/3)*(nSupMod-10);
   } else {
     id  = fNCellsInSupMod*nSupMod;
   }
@@ -494,6 +501,16 @@ void  AliEMCALGeometry::GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod,
 Int_t  AliEMCALGeometry::GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const
 {
   // Transition from super module number(nSupMod) and cell indexes (ieta,iphi) to absId
+  
+  // Check if the indeces correspond to existing SM or tower indeces
+  if(iphi    < 0 || iphi    >= AliEMCALGeoParams::fgkEMCALRows || 
+     ieta    < 0 || ieta    >= AliEMCALGeoParams::fgkEMCALCols ||
+     nSupMod < 0 || nSupMod >= GetNumberOfSuperModules()         )
+  {
+    AliDebug(1,Form("Wrong cell indexes : SM %d, column (eta) %d, row (phi) %d", nSupMod,ieta,iphi));
+    return -1 ;
+  }
+  
   static Int_t ietam=-1, iphim=-1, nModule=-1;
   static Int_t nIeta=-1, nIphi=-1; // cell indexes in module
 
@@ -502,7 +519,7 @@ Int_t  AliEMCALGeometry::GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi,
   nIeta = ieta%fNETAdiv;
   nIeta = fNETAdiv - 1 - nIeta;
   nIphi = iphi%fNPHIdiv;
-
+  
   return GetAbsCellId(nSupMod, nModule, nIphi, nIeta);
 }
 
@@ -545,10 +562,14 @@ Bool_t AliEMCALGeometry::GetAbsCellIdFromEtaPhi(Double_t eta, Double_t phi, Int_
     phi    = TVector2::Phi_0_2pi(phi);
     phiLoc = phi - fPhiCentersOfSM[nSupMod/2];
     nphi   = fPhiCentersOfCells.GetSize();
-    if(nSupMod>=10) {
-      phiLoc = phi - 190.*TMath::DegToRad();
+    if(nSupMod>=10 && !fGeoName.Contains("12SMV1")) {
+      phiLoc = phi - 190.*TMath::DegToRad(); // half-size case... the reference for the loc  is still 190 deg..?
       nphi  /= 2;
     }
+    if(nSupMod>=10 && fGeoName.Contains("12SMV1")) {
+     // in the one_third case the variable fPhiCentersOfSM behaves like for the full_module.
+      nphi  /= 3;
+    }
 
     dmin   = TMath::Abs(fPhiCentersOfCells[0]-phiLoc);
     iphi   = 0;
@@ -575,19 +596,11 @@ Bool_t AliEMCALGeometry::GetAbsCellIdFromEtaPhi(Double_t eta, Double_t phi, Int_
       }
     }
     AliDebug(2,Form(" ieta %i : dmin %f (eta=%f) : nSupMod %i ", ieta, dmin, eta, nSupMod));
-
-    if(eta<0) iphi = (nphi-1) - iphi;
-         
-       //patch for mapping following alice convention  
-       if(nSupMod%2 == 0)                
-                 ieta = (fCentersOfCellsEtaDir.GetSize()-1)-ieta;// 47-ieta, revert the ordering on A side in order to keep convention.
-       else {
-               if(nSupMod<10) 
-                               iphi = (fCentersOfCellsPhiDir.GetSize()-1)  -iphi;// 23-iphi, revert the ordering on C side in order to keep convention.
-               else 
-                               iphi = (fCentersOfCellsPhiDir.GetSize()/2-1)-iphi;// 11-iphi, revert the ordering on C side in order to keep convention.
-       }
-  
+     
+   //patch for mapping following alice convention  
+   if(nSupMod%2 == 0)            
+      ieta = (fCentersOfCellsEtaDir.GetSize()-1)-ieta;// 47-ieta, revert the ordering on A side in order to keep convention.
+   
     absId = GetAbsCellIdFromCellIndexes(nSupMod, iphi, ieta);
 
     return kTRUE;
@@ -621,10 +634,13 @@ Bool_t AliEMCALGeometry::GetCellIndex(Int_t absId,Int_t &nSupMod,Int_t &nModule,
   if(!CheckAbsCellId(absId)) return kFALSE;
 
   sm10 = fNCellsInSupMod*10;
-  if(fKey110DEG == 1 && absId >= sm10) { // 110 degree case; last two supermodules  
+  if(fKey110DEG == 1 && absId >= sm10 && !fGeoName.Contains("12SMV1")) { // 110 degree case; last two supermodules are halfsupermodules 
     nSupMod = (absId-sm10) / (fNCellsInSupMod/2) + 10;
     tmp     = (absId-sm10) % (fNCellsInSupMod/2);
-  } else {
+  } else if(fKey110DEG == 1 && absId >= sm10 && fGeoName.Contains("12SMV1")) { // 110 degree case; last two supermodules are 1/3 supermodules 
+    nSupMod = (absId-sm10) / (fNCellsInSupMod/3) + 10;
+    tmp     = (absId-sm10) % (fNCellsInSupMod/3);
+  } else { 
     nSupMod = absId / fNCellsInSupMod;
     tmp     = absId % fNCellsInSupMod;
   }
@@ -658,8 +674,9 @@ void AliEMCALGeometry::GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nModul
   // iphim - have to change from 0 to nphi-1 (fNPhi-1 or fNPhi/2-1)
   static Int_t nphi=-1;
 
-  if(fKey110DEG == 1 && nSupMod>=10) nphi = fNPhi/2;
-  else                               nphi = fNPhi;
+  if(fKey110DEG == 1 && nSupMod>=10 && !fGeoName.Contains("12SMV1") )      nphi = fNPhi/2; // halfSM
+  else if(fKey110DEG == 1 && nSupMod>=10 && fGeoName.Contains("12SMV1") )  nphi = fNPhi/3; // 1/3 SM
+  else                                                               nphi = fNPhi;   // full SM
 
   ietam = nModule/nphi;
   iphim = nModule%nphi;
@@ -710,8 +727,15 @@ Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t
   // xr,yr,zr - x,y,z coordinates of cell with absId inside SM 
 
   // Shift index taking into account the difference between standard SM 
-  // and SM of half size in phi direction
-  const Int_t kphiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2
+  // and SM of half (or one third) size in phi direction
+   Int_t workaround; // a small trick to be able to define the const variable kphiIndexShift
+   //if half, two parts, 1/4 wide, should be remove. In case of one_third SM, the two parts to be removed are 1/3 each
+   if(fKey110DEG == 1 && !fGeoName.Contains("12SMV1")) workaround=4; // half SM case
+   else workaround=3; // one third of SM case 
+   const Int_t kphiIndexShift = fCentersOfCellsPhiDir.GetSize()/workaround; 
+   const Int_t kphiRangeSmallSM = fCentersOfCellsPhiDir.GetSize()-2*kphiIndexShift;  
+      
   static Int_t nSupMod=-1, nModule=-1, nIphi=-1, nIeta=-1, iphi=-1, ieta=-1;
   if(!CheckAbsCellId(absId)) return kFALSE;
 
@@ -734,7 +758,7 @@ Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t
          
   } else {
                if(nSupMod%2 != 0) 
-                       iphi2 = (fCentersOfCellsPhiDir.GetSize()/2-1)-iphi;// 11-iphi, revert the ordering on C side in order to keep convention.
+                       iphi2 = (kphiRangeSmallSM-1)-iphi;// 11-iphi [1/2SM] or 7-iphi [1/3SM], revert the ordering on C side in order to keep convention.
                yr = fCentersOfCellsPhiDir.At(iphi2 + kphiIndexShift);
   }
   AliDebug(1,Form("absId %i nSupMod %i iphi %i ieta %i xr %f yr %f zr %f ",absId,nSupMod,iphi,ieta,xr,yr,zr));
@@ -786,8 +810,15 @@ Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t distEff, Doub
   // xr,yr,zr - x,y,z coordinates of cell with absId inside SM 
   
   // Shift index taking into account the difference between standard SM 
-  // and SM of half size in phi direction
-  const  Int_t kphiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2
+  // and SM of half (or one third) size in phi direction
+   
+   Int_t workaround; // a small trick to be able to define the const variable kphiIndexShift
+   //if half, two parts, 1/4 wide, should be remove. In case of one_third SM, the two parts to be removed are 1/3 each
+   if(fKey110DEG == 1 && !fGeoName.Contains("12SMV1")) workaround=4; // half SM case
+   else workaround=3; // one third of SM case 
+   const Int_t kphiIndexShift = fCentersOfCellsPhiDir.GetSize()/workaround; 
+   const Int_t kphiRangeSmallSM = fCentersOfCellsPhiDir.GetSize()-2*kphiIndexShift; 
+   
   static Int_t nSupMod=0, nModule=-1, nIphi=-1, nIeta=-1, iphi=-1, ieta=-1;
   static Int_t iphim=-1, ietam=-1;
   static AliEMCALShishKebabTrd1Module *mod = 0;
@@ -817,9 +848,9 @@ Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t distEff, Doub
     yr = fCentersOfCellsPhiDir.At(iphi2);
     
   } else {
-    if(nSupMod%2 != 0) 
-      iphi2 = (fCentersOfCellsPhiDir.GetSize()/2-1)-iphi;// 11-iphi, revert the ordering on C side in order to keep convention.
-    yr = fCentersOfCellsPhiDir.At(iphi2 + kphiIndexShift);
+               if(nSupMod%2 != 0) 
+                       iphi2 = (kphiRangeSmallSM-1)-iphi;// 11-iphi [1/2SM] or 7-iphi [1/3SM], revert the ordering on C side in order to keep convention.
+               yr = fCentersOfCellsPhiDir.At(iphi2 + kphiIndexShift);
   }
   
   AliDebug(1,Form("absId %i nSupMod %i iphi %i ieta %i xr %f yr %f zr %f ",absId,nSupMod,iphi,ieta,xr,yr,zr));
@@ -1293,7 +1324,7 @@ Bool_t AliEMCALGeometry::GetAbsFastORIndexFromPositionInEMCAL(const Int_t iEta,
 
        if (iEta < 0 || iEta > 47 || iPhi < 0 || iPhi > 63 ) 
        {
-               AliError("Out of range!");
+               AliError(Form("Out of range! eta: %2d phi: %2d", iEta, iPhi));
                return kFALSE;
        }
        
@@ -1407,6 +1438,86 @@ void AliEMCALGeometry::BuildFastOR2DMap()
        }
 }
 
+//________________________________________________________________________________________________
+Bool_t AliEMCALGeometry::GetTRUIndexFromOnlineIndex(const Int_t id, Int_t& idx) const
+{
+       //Trigger mapping method, from STU index get TRU index 
+       
+       if (id > 31 || id < 0) 
+       {
+               AliError(Form("TRU index out of range: %d",id));
+               return kFALSE;
+       }
+       
+       if (id == 31) {
+           idx = 31;
+           return kTRUE;
+       }
+
+       idx = ((id % 6) < 3) ? 6 * int(id / 6) + 2 * (id % 3) : 6 * int(id / 6) + 2 * (2 - (id % 3)) + 1;
+
+       return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Int_t AliEMCALGeometry::GetTRUIndexFromOnlineIndex(const Int_t id) const
+{
+       //Trigger mapping method, from STU index get TRU index 
+       
+       if (id > 31 || id < 0) 
+       {
+               AliError(Form("TRU index out of range: %d",id));
+       }
+
+       if (id == 31) {
+           return 31;
+       }
+
+       Int_t idx = ((id % 6) < 3) ? 6 * int(id / 6) + 2 * (id % 3) : 6 * int(id / 6) + 2 * (2 - (id % 3)) + 1;
+       
+       return idx;
+}
+
+//________________________________________________________________________________________________
+Bool_t AliEMCALGeometry::GetOnlineIndexFromTRUIndex(const Int_t id, Int_t& idx) const
+{
+       //Trigger mapping method, from STU index get TRU index 
+       
+       if (id > 31 || id < 0) 
+       {
+               AliError(Form("TRU index out of range: %d",id));
+               return kFALSE;
+       }
+       
+       if (id == 31) {
+           idx = 31;
+           return kTRUE;
+       }
+
+       idx = (id % 2) ? int((6 - (id % 6)) / 2) + 3 * (2 * int(id / 6) + 1) : 3 * int(id / 6) + int(id / 2);
+       
+       return kTRUE;
+}
+
+//________________________________________________________________________________________________
+Int_t AliEMCALGeometry::GetOnlineIndexFromTRUIndex(const Int_t id) const
+{
+       //Trigger mapping method, from STU index get TRU index 
+       
+       if (id > 31 || id < 0) 
+       {
+               AliError(Form("TRU index out of range: %d",id));
+       }
+
+       if (id == 31) {
+           return 31;
+       }
+       
+       Int_t idx = (id % 2) ? int((6 - (id % 6)) / 2) + 3 * (2 * int(id / 6) + 1) : 3 * int(id / 6) + int(id / 2);
+       
+       return idx;
+}
+
 //________________________________________________________________________________________________
 Bool_t AliEMCALGeometry::GetFastORIndexFromL0Index(const Int_t iTRU, const Int_t id, Int_t idx[], const Int_t size) const
 {
@@ -1473,23 +1584,28 @@ const TGeoHMatrix * AliEMCALGeometry::GetMatrixForSuperModule(Int_t smod) const
     }  
   }//external matrices
   
-       if(gGeoManager){
+   if(gGeoManager){
     const Int_t buffersize = 255;
-               char path[buffersize] ;
-               snprintf(path,buffersize,"/ALIC_1/XEN1_1/SMOD_%d",smod+1) ;
-               //TString volpath = "ALIC_1/XEN1_1/SMOD_";
-           //volpath += smod+1;
-
-               if(fKey110DEG && smod >= 10){
-                         snprintf(path,buffersize,"/ALIC_1/XEN1_1/SM10_%d",smod-10+1) ;
-                       //volpath = "ALIC_1/XEN1_1/SM10_";
-                       //volpath += smod-10+1;
-               }
-               if (!gGeoManager->cd(path)){
-                       AliFatal(Form("Geo manager can not find path %s!\n",path));
-               }
-               return gGeoManager->GetCurrentMatrix();
-       }
+      char path[buffersize] ;
+      snprintf(path,buffersize,"/ALIC_1/XEN1_1/SMOD_%d",smod+1) ;
+      //TString volpath = "ALIC_1/XEN1_1/SMOD_";
+       //volpath += smod+1;
+
+      if(fKey110DEG && smod >= 10 && !fGeoName.Contains("12SMV1") ){
+         snprintf(path,buffersize,"/ALIC_1/XEN1_1/SM10_%d",smod-10+1) ;
+         //volpath = "ALIC_1/XEN1_1/SM10_";
+         //volpath += smod-10+1;
+      }
+      if(fKey110DEG && smod >= 10 && fGeoName.Contains("12SMV1") ){
+         snprintf(path,buffersize,"/ALIC_1/XEN1_1/SM3rd_%d",smod-10+1) ;
+         //volpath = "ALIC_1/XEN1_1/SM10_";
+         //volpath += smod-10+1;
+      }
+      if (!gGeoManager->cd(path)){
+         AliFatal(Form("Geo manager can not find path %s!\n",path));
+      }
+      return gGeoManager->GetCurrentMatrix();
+      }
 
        return 0 ;
 }
@@ -1509,8 +1625,6 @@ void AliEMCALGeometry::GetModulePhiEtaIndexInSModuleFromTRUIndex(Int_t itru, Int
    
   iphiSM = fEMCGeometry->GetNModulesInTRUPhi()*row + iphitru  ;
   ietaSM = fEMCGeometry->GetNModulesInTRUEta()*col + ietatru  ; 
-  //printf(" GetModulePhiEtaIndexInSModuleFromTRUIndex : itru %2i iphitru %2i ietatru %2i iphiSM %2i ietaSM %2i \n", 
-  // itru, iphitru, ietatru, iphiSM, ietaSM);
 }
 
 //__________________________________________________________________________________________________________________
@@ -1557,7 +1671,7 @@ void AliEMCALGeometry::RecalculateTowerPosition(Float_t drow, Float_t dcol, cons
     Int_t istrip = 0;
     Float_t z0   = 0;
     Float_t zb   = 0;
-    Float_t z_is = 0;
+    Float_t zIs = 0;
     
     Float_t x,y,z; // return variables in terry's RF
     
@@ -1600,16 +1714,16 @@ void AliEMCALGeometry::RecalculateTowerPosition(Float_t drow, Float_t dcol, cons
       
       teta1 = TMath::DegToRad() * (is*1.5 + 0.75);
       if(is==0)
-        z_is = z_is + 2*dz*TMath::Cos(teta1);
+        zIs = zIs + 2*dz*TMath::Cos(teta1);
       else
-        z_is = z_is + 2*dz*TMath::Cos(teta1) + 2*dz*TMath::Sin(teta1)*TMath::Tan(teta1-0.75*TMath::DegToRad());
+        zIs = zIs + 2*dz*TMath::Cos(teta1) + 2*dz*TMath::Sin(teta1)*TMath::Tan(teta1-0.75*TMath::DegToRad());
       
     }
     
     z0 = dz*(dcol-2*istrip+0.5);
     zb = (2*dz-z0-depth*TMath::Tan(teta1));
     
-    z = z_is - zb*TMath::Cos(teta1);
+    z = zIs - zb*TMath::Cos(teta1);
     y = depth/TMath::Cos(teta1) + zb*TMath::Sin(teta1);
     
     x = (drow + 0.5)*dx;
@@ -1652,3 +1766,14 @@ void AliEMCALGeometry::RecalculateTowerPosition(Float_t drow, Float_t dcol, cons
   }
   
 }
+
+void AliEMCALGeometry::SetMisalMatrix(const TGeoHMatrix * m, Int_t smod) 
+{
+// Method to set shift-rotational matrixes from ESDHeader
+// Move from header due to coding violations : Dec 2,2011 by PAI
+  fUseExternalMatrices = kTRUE;
+
+  if (smod >= 0 && smod < fEMCGeometry->GetNumberOfSuperModules()){
+    if(!fkSModuleMatrix[smod]) fkSModuleMatrix[smod] = new TGeoHMatrix(*m) ; //Set only if not set yet
+  } else AliFatal(Form("Wrong supermodule index -> %d",smod));
+}