]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALGeoUtils.h
Coverity 16620
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGeoUtils.h
index a9e0b588aea5e0b98573589ff4caef671ad9342a..a47e28a13ad671a57ba8a534ff0a62e167e2ce91 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"
 
@@ -41,8 +42,9 @@ public:
   TList  *GetShishKebabTrd1Modules() const {return fShishKebabTrd1Modules;}
   AliEMCALShishKebabTrd1Module *GetShishKebabModule(Int_t neta) const;
 
-  void PrintGeometry(); 
+  void PrintGeometryGeoUtils();   // *MENU*  
   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;
 
@@ -114,9 +116,9 @@ public:
   Bool_t  RelPosCellInSModule(Int_t absId, TVector3 &vloc) const;
 
   // Local Coordinates of SM
-  TArrayD  GetCentersOfCellsEtaDir() const {return fCentersOfCellsEtaDir;}        // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm)
-  TArrayD  GetCentersOfCellsXDir()   const {return fCentersOfCellsXDir;}          // size fNEta*fNETAdiv (for TRD1 only) (       x in SM, in cm)
-  TArrayD  GetCentersOfCellsPhiDir() const {return fCentersOfCellsPhiDir;}        // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
+  TArrayD  GetCentersOfCellsEtaDir() const {return fCentersOfCellsEtaDir;}     // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm)
+  TArrayD  GetCentersOfCellsXDir()   const {return fCentersOfCellsXDir;}       // size fNEta*fNETAdiv (for TRD1 only) (       x in SM, in cm)
+  TArrayD  GetCentersOfCellsPhiDir() const {return fCentersOfCellsPhiDir;}     // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
   //
   TArrayD  GetEtaCentersOfCells() const {return fEtaCentersOfCells;}           // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position; 
   TArrayD  GetPhiCentersOfCells() const {return fPhiCentersOfCells;}           // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.)
@@ -126,14 +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
   //
@@ -147,11 +158,17 @@ 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 ;
+    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));
   }
        
-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 ;
        
@@ -160,10 +177,10 @@ protected:
   // ctor only for internal usage (singleton)
   //  AliEMCALGeoUtils(const Text_t* name, const Text_t* title);
   AliEMCALEMCGeometry     *fEMCGeometry;   // Geometry object for Electromagnetic calorimeter
+  
+  void Init(void);                                // initializes the parameters of EMCAL
 
-  void Init(void);                          // initializes the parameters of EMCAL
-
-  TString  fGeoName;                     //geometry name
+  TString  fGeoName;                 // geometry name
 
   Int_t    fKey110DEG;               // for calculation abs cell id; 19-oct-05 
   Int_t    fNCellsInSupMod;          // number cell in super module
@@ -178,7 +195,7 @@ protected:
   TArrayD  fCentersOfCellsPhiDir;    // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
   TArrayD  fEtaCentersOfCells;       // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position; 
   Int_t    fNCells;                  // number of cells in calo
-  Int_t    fNPhi;                           // Number of Towers in the PHI direction
+  Int_t    fNPhi;                               // Number of Towers in the PHI direction
   TArrayD  fCentersOfCellsXDir;      // size fNEta*fNETAdiv (for TRD1 only) (       x in SM, in cm)
   Float_t  fEnvelop[3];              // the GEANT TUB for the detector 
   Float_t  fArm1EtaMin;              // Minimum pseudorapidity position of EMCAL in Eta
@@ -186,25 +203,28 @@ protected:
   Float_t  fArm1PhiMin;              // Minimum angular position of EMCAL in Phi (degrees)
   Float_t  fArm1PhiMax;              // Maximum angular position of EMCAL in Phi (degrees)
   Float_t  fEtaMaxOfTRD1;            // Max eta in case of TRD1 geometry (see AliEMCALShishKebabTrd1Module)
-  TList    *fShishKebabTrd1Modules;  //! list of modules
-  Float_t  *fParSM;                  // SM sizes as in GEANT (TRD1)
+  TList   *fShishKebabTrd1Modules;   //! list of modules
+  Float_t  fParSM[3];                // SM sizes as in GEANT (TRD1)
   Float_t  fPhiModuleSize;           // Phi -> X 
   Float_t  fEtaModuleSize;           // Eta -> Y 
   Float_t  fPhiTileSize;             // Size of phi tile
   Float_t  fEtaTileSize;             // Size of eta tile
   Int_t    fNZ;                      // Number of Towers in the Z direction
-  Float_t  fIPDistance;                         // Radial Distance of the inner surface of the EMCAL
+  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
-
-  const TGeoHMatrix* fkSModuleMatrix[12] ; //Orientations of EMCAL super modules
+  Float_t  fShellThickness;             // Total thickness in (x,y) direction
+  Float_t  fZLength;                        // Total length in z direction
+  Float_t  fSampling;                       // Sampling factor
 
+  Int_t    fFastOR2DMap[48][64];          // FastOR 2D Map over full EMCal
+       
+  TGeoHMatrix* fkSModuleMatrix[AliEMCALGeoParams::fgkEMCALModules] ; //Orientations of EMCAL super modules
+  Bool_t   fUseExternalMatrices;     // Use the matrices set in fkSModuleMatrix and not those in the geoManager
        
-  ClassDef(AliEMCALGeoUtils,1)       // EMCAL geometry class 
+  ClassDef(AliEMCALGeoUtils,2)       // EMCAL geometry class 
 
 } ;
 
 #endif // AliEMCALGEOUTILS_H
+