]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALGeoUtils.h
Next round of fixes (Jochen)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGeoUtils.h
index 8cac92cd4ac4a4ad287ecb3056ed67eed13133b4..e71b3f1eb49a31df1bf49d93ebc56b0c62c3137e 100644 (file)
 #include <TMath.h>
 #include <TArrayD.h>
 #include <TVector3.h>
+#include <TGeoMatrix.h> 
 class TBrowser ;
 class TParticle ;
-class TGeoHMatrix ;
 
 // --- AliRoot header files ---
 #include "AliEMCALEMCGeometry.h"
+#include "AliEMCALGeoParams.h"
 class AliEMCALShishKebabTrd1Module;
 #include "AliLog.h"
 
@@ -43,6 +44,7 @@ public:
 
   void PrintGeometry(); 
   void PrintCellIndexes(Int_t absId=0, int pri=0, const char *tit="") const ;  //*MENU*
+  void PrintLocalTrd1(Int_t pri=0) const;  //*MENU*
   virtual void Browse(TBrowser* b);
   virtual Bool_t  IsFolder() const;
 
@@ -126,9 +128,23 @@ public:
   void     GetModulePhiEtaIndexInSModuleFromTRUIndex(
               Int_t itru, Int_t iphitru, Int_t ietatru, Int_t &ietaSM, Int_t &iphiSM) const;
   Int_t   GetAbsTRUNumberFromNumberInSm(const Int_t row, const Int_t col, const Int_t sm) const ;
-  
-
 
+       
+  void     BuildFastOR2DMap();
+  Bool_t   GetAbsFastORIndexFromTRU(const Int_t iTRU, const Int_t iADC, Int_t& id) const;
+  Bool_t                    GetAbsFastORIndexFromPositionInTRU(const Int_t iTRU, const Int_t iEta, const Int_t iPhi, Int_t& id) const; 
+  Bool_t                    GetAbsFastORIndexFromPositionInSM( const Int_t  iSM, const Int_t iEta, const Int_t iPhi, Int_t& id) const; 
+  Bool_t                    GetAbsFastORIndexFromPositionInEMCAL(                const Int_t iEta, const Int_t iPhi, Int_t& id) const;
+  Bool_t             GetTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iADC) const;
+  Bool_t   GetPositionInTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iEta, Int_t& iPhi) const;
+  Bool_t    GetPositionInSMFromAbsFastORIndex(const Int_t id, Int_t& iSM, Int_t& iEta, Int_t& iPhi) const;
+  Bool_t GetPositionInEMCALFromAbsFastORIndex(const Int_t id, Int_t& iEta, Int_t& iPhi) const;
+  Bool_t          GetFastORIndexFromCellIndex(const Int_t id, Int_t& idx) const;
+  Bool_t          GetCellIndexFromFastORIndex(const Int_t id, Int_t idx[4]) const;
+  Bool_t              GetTRUIndexFromSTUIndex(const Int_t id, Int_t& idx) const;
+  Int_t               GetTRUIndexFromSTUIndex(const Int_t id) const;
+  Bool_t            GetFastORIndexFromL0Index(const Int_t iTRU, const Int_t id, Int_t idx[], const Int_t size) const;
+       
   ///////////////////
   // useful utilities
   //
@@ -142,11 +158,16 @@ public:
 
   //Method to set shift-rotational matrixes from ESDHeader
   void SetMisalMatrix(const TGeoHMatrix * m, Int_t smod) {
-         if (smod >= 0 && smod < fEMCGeometry->GetNumberOfSuperModules()) fkSModuleMatrix[smod] = m ;
+         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));
   }
        
-protected:
+  //Alternate geometry that allows to calculate tower position for different particles and different alignments
+  void RecalculateTowerPosition(Float_t drow, Float_t dcol, const Int_t sm, const Float_t depth,
+                                     const Float_t misaligTransShifts[15], const Float_t misaligRotShifts[15],Float_t global[3]) const;
+  
   //Returns shift-rotational matrixes for different volumes
   const TGeoHMatrix * GetMatrixForSuperModule(Int_t smod)const ;
        
@@ -191,11 +212,13 @@ protected:
   Float_t  fIPDistance;                         // Radial Distance of the inner surface of the EMCAL
   Float_t  fLongModuleSize;          // Size of long module
   // Geometry Parameters
-  Float_t  fShellThickness;                 // Total thickness in (x,y) direction
-  Float_t  fZLength;                        // Total length in z direction
-  Float_t  fSampling;                       // Sampling factor
+  Float_t  fShellThickness;         // Total thickness in (x,y) direction
+  Float_t  fZLength;                // Total length in z direction
+  Float_t  fSampling;               // Sampling factor
 
-  const TGeoHMatrix* fkSModuleMatrix[12] ; //Orientations of EMCAL super modules
+  Int_t    fFastOR2DMap[48][64];        // FastOR 2D Map over full EMCal
+       
+  TGeoHMatrix* fkSModuleMatrix[AliEMCALGeoParams::fgkEMCALModules] ; //Orientations of EMCAL super modules
 
        
   ClassDef(AliEMCALGeoUtils,1)       // EMCAL geometry class 
@@ -203,3 +226,4 @@ protected:
 } ;
 
 #endif // AliEMCALGEOUTILS_H
+