]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALGeometry.h
New Trigger class, TRU mapping method included in Geometry
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGeometry.h
1 #ifndef ALIEMCALGEOMETRY_H
2 #define ALIEMCALGEOMETRY_H
3 /* Copyright(c) 1998-2004, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //_________________________________________________________________________
9 // Geometry class  for EMCAL : singleton
10 // EMCAL consists of a layers of scintillator, and lead.
11 //                  
12 //*-- Author: Sahal Yacoob (LBL / UCT)
13 //*--   and : Yves Schutz (Subatech)
14 //*--   and : Aleksei Pavlinov (WSU) - shashlyk staff
15 //*--   and : Gustavo Conesa: Add TRU mapping. TRU parameters still not fixed.
16
17 // --- ROOT system ---
18 class TString ;
19 class TObjArray;
20 class TVector3 ;
21 class TParticle ; 
22 class TClonesArray ;
23
24 // --- AliRoot header files ---
25 #include "AliGeometry.h"
26
27 class AliEMCALGeometry : public AliGeometry {
28 public:
29   AliEMCALGeometry(const AliEMCALGeometry& geom):AliGeometry(geom) {
30     // cpy ctor requested by Coding Convention but not yet needed
31     Fatal("Cpy ctor", "Not implemented");
32   };
33   virtual ~AliEMCALGeometry(void) ; 
34   static AliEMCALGeometry * GetInstance(const Text_t* name,
35                                         const Text_t* title="") ; 
36   static AliEMCALGeometry * GetInstance() ;
37   AliEMCALGeometry & operator = (const AliEMCALGeometry  & /*rvalue*/) const {
38     // assignement operator requested by coding convention but not needed
39     Fatal("operator =", "not implemented");
40     return *(GetInstance()) ; 
41   };
42
43   Bool_t AreInSameTower(Int_t id1, Int_t id2) const ;  
44
45   TClonesArray *  FillTRU(const TClonesArray * digits)  ;
46   
47   virtual void GetGlobal(const AliRecPoint *, TVector3 &, TMatrixF &) const {}
48   virtual void GetGlobal(const AliRecPoint *, TVector3 &) const {}
49   virtual Bool_t Impact(const TParticle *) const {return kTRUE;}
50
51   Bool_t IsInEMCAL(Double_t x, Double_t y, Double_t z) const;
52   // General
53   Bool_t  IsInitialized(void) const { return fgInit ; }
54   // Return EMCAL geometrical parameters
55   // geometry
56   Float_t GetAlFrontThickness() const { return fAlFrontThick;}
57   Float_t GetArm1PhiMin() const { return fArm1PhiMin ; }
58   Float_t GetArm1PhiMax() const { return fArm1PhiMax ; }
59   Float_t GetArm1EtaMin() const { return fArm1EtaMin;}
60   Float_t GetArm1EtaMax() const { return fArm1EtaMax;}
61   Float_t GetIPDistance() const { return fIPDistance;}   
62   Float_t GetIP2ECASection() const { return ( GetIPDistance() + GetAlFrontThickness() + GetGap2Active() ) ; }   
63   Float_t GetEnvelop(Int_t index) const { return fEnvelop[index] ; }  
64   Float_t GetShellThickness() const { return fShellThickness ; }
65   Float_t GetZLength() const { return fZLength ; } 
66   Float_t GetGap2Active() const {return  fGap2Active ;}
67   Float_t GetDeltaEta() const {return (fArm1EtaMax-fArm1EtaMin)/
68                                        ((Float_t)fNZ);}
69   Float_t GetDeltaPhi() const {return (fArm1PhiMax-fArm1PhiMin)/
70                                        ((Float_t)fNPhi);}
71   Int_t   GetNECLayers() const {return fNECLayers ;}
72   Int_t   GetNZ() const {return fNZ ;}
73   Int_t   GetNEta() const {return fNZ ;}
74   Int_t   GetNPhi() const {return fNPhi ;}
75   Int_t   GetNTowers() const {return fNPhi * fNZ ;}
76   Float_t GetECPbRadThick()const {return fECPbRadThickness;}
77   Float_t GetECScintThick() const {return fECScintThick;}
78   Float_t GetSampling() const {return fSampling ; } 
79   Bool_t IsInECA(Int_t index) const { if ( (index > 0 && (index <= GetNZ() * GetNPhi()))) return kTRUE; else return kFALSE ;}
80
81   Int_t   GetNumberOfSuperModules() {return fNumberOfSuperModules;}
82   Float_t GetfPhiGapForSuperModules() {return fPhiGapForSM;}
83   Float_t GetPhiModuleSize() const  {return fPhiModuleSize;}
84   Float_t GetEtaModuleSize() const  {return fEtaModuleSize;}
85   Float_t GetFrontSteelStrip() const {return fFrontSteelStrip;}
86   Float_t GetLateralSteelStrip() const {return fLateralSteelStrip;}
87   Float_t GetPassiveScintThick() const {return fPassiveScintThick;}
88   Float_t GetPhiTileSize() const {return fPhiTileSize;}
89   Float_t GetEtaTileSize() const {return fEtaTileSize;}
90   Int_t   GetNPhiSuperModule() const {return fNPhiSuperModule;}
91   Int_t   GetNPHIdiv() const {return fNPHIdiv ;}
92   Int_t   GetNETAdiv() const {return fNETAdiv ;}
93   Int_t   GetNCells()  const {return fNCells;}
94
95   Int_t   GetNTRU() const    {return fNTRU ; }  
96   Int_t   GetNTRUEta() const {return fNTRUEta ; }  
97   Int_t   GetNTRUPhi() const {return fNTRUPhi ; }  
98
99   Float_t GetSteelFrontThickness() const { return fSteelFrontThick;}
100   Float_t GetLongModuleSize() const {return fLongModuleSize;}
101
102   Float_t GetTrd1Angle() const {return fTrd1Angle;}
103   Float_t Get2Trd1Dx2()  const {return f2Trd1Dx2;}
104   Float_t GetTrd2AngleY()const {return fTrd2AngleY;}
105   Float_t Get2Trd2Dy2()  const {return f2Trd2Dy2;}
106   Float_t GetTubsR()     const {return fTubsR;}
107   Float_t GetTubsTurnAngle() const {return fTubsTurnAngle;}
108   // Dabs id <-> indexes; Shish-kebab case 
109   Int_t   GetAbsCellId(Int_t nSupMod, Int_t nTower, Int_t nIphi, Int_t nIeta);
110   Bool_t  GetCellIndex(Int_t absId, Int_t &nSupMod, Int_t &nTower, Int_t &nIphi, Int_t &nIeta);
111   void    GetTowerPhiEtaIndexInSModule(Int_t nSupMod, Int_t nTower, Int_t &iphit, Int_t &ietat);
112   void    GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nTower, Int_t nIphi, Int_t nIeta,
113                                       Int_t &iphi, Int_t &ieta);
114   Bool_t  CheckAbsCellId(Int_t ind); // replace the IsInECA
115   // ---
116   Float_t AngleFromEta(Float_t eta){ // returns theta in radians for a given pseudorapidity
117     return 2.0*TMath::ATan(TMath::Exp(-eta));
118   }
119   Float_t ZFromEtaR(Float_t r,Float_t eta){ // returns z in for a given
120     // pseudorapidity and r=sqrt(x*x+y*y).
121     return r/TMath::Tan(AngleFromEta(eta));
122   }
123   // These methods are obsolete but use in AliEMCALRecPoint - keep it now
124   Int_t TowerIndex(Int_t iz,Int_t iphi) const; // returns tower index
125         // returns tower indexs iz, iphi.
126   void TowerIndexes(Int_t index,Int_t &iz,Int_t &iphi) const;
127         // for a given tower index it returns eta and phi of center of that tower.
128   void EtaPhiFromIndex(Int_t index,Float_t &eta,Float_t &phi) const;
129         // returns x, y, and z (cm) on the inner surface of a given EMCAL Cell specified by relid.
130   void XYZFromIndex(const Int_t *relid,Float_t &x,Float_t &y, Float_t &z) const;
131   void XYZFromIndex(Int_t absid, TVector3 &v) const;
132         // for a given eta and phi in the EMCAL it returns the tower index.
133   Int_t TowerIndexFromEtaPhi(Float_t eta,Float_t phi) const;
134         // for a given eta and phi in the EMCAL it returns the pretower index.
135   void PosInAlice(const Int_t *relid, Float_t &theta, Float_t &phi) const ;
136   void PosInAlice(Int_t absid, Float_t &theta, Float_t &phi) const ;
137   Bool_t AbsToRelNumbering(Int_t AbsId, Int_t *relid) const;
138   // --
139   void SetNZ(Int_t nz) { fNZ= nz ; printf("SetNZ: Number of modules in Z set to %d", fNZ) ; }
140   void SetNPhi(Int_t nphi) { fNPhi= nphi ; printf("SetNPhi: Number of modules in Phi set to %d", fNPhi) ; }
141
142   void SetNTRU(Int_t ntru)    {fNTRU    = ntru; printf("SetNTRU: Number of TRUs per SuperModule set to %d", fNTRU) ; }
143   void SetNTRUEta(Int_t ntru) {fNTRUEta = ntru; ; printf("SetNTRU: Number of TRUs per SuperModule in Etaset to %d", fNTRUEta) ;}
144   void SetNTRUPhi(Int_t ntru) {fNTRUPhi = ntru; ; printf("SetNTRU: Number of TRUs per SuperModule in Phi set to %d", fNTRUPhi) ;}
145
146   void SetSampling(Float_t samp) { fSampling = samp; printf("SetSampling: Sampling factor set to %f", fSampling) ; }
147
148 protected:
149   AliEMCALGeometry(const Text_t* name, const Text_t* title="") :
150     AliGeometry(name, title) {// ctor only for internal usage (singleton)
151     Init();
152   };
153   AliEMCALGeometry() :
154     AliGeometry() {// ctor only for internal usage (singleton)
155     Init();
156   };
157   void Init(void);                      // initializes the parameters of EMCAL
158   void CheckAditionalOptions();              //
159   
160 private:
161   static AliEMCALGeometry * fgGeom;     // pointer to the unique instance of the singleton
162   static Bool_t fgInit;                 // Tells if geometry has been succesfully set up.
163   TObjArray *fArrayOpts;                //! array of geometry options
164
165   Float_t fAlFrontThick;                // Thickness of the front Al face of the support box  
166   Float_t fECPbRadThickness;            // cm, Thickness of the Pb radiators
167   Float_t fECScintThick;                // cm, Thickness of the scintillators
168   Int_t   fNECLayers;                   // number of scintillator layers
169   
170   Float_t fArm1PhiMin;                  // Minimum angular position of EMCAL in Phi (degrees)
171   Float_t fArm1PhiMax;                  // Maximum angular position of EMCAL in Phi (degrees)
172   Float_t fArm1EtaMin;                  // Minimum pseudorapidity position of EMCAL in Eta
173   Float_t fArm1EtaMax;                  // Maximum pseudorapidity position of EMCAL in Eta
174   
175   // Geometry Parameters
176   Float_t fEnvelop[3];                  // the GEANT TUB for the detector 
177   Float_t fIPDistance;                  // Radial Distance of the inner surface of the EMCAL
178   Float_t fShellThickness;              // Total thickness in (x,y) direction
179   Float_t fZLength;                     // Total length in z direction
180   Float_t fGap2Active;                  // Gap between the envelop and the active material
181   Int_t   fNZ;                          // Number of Towers in the Z direction
182   Int_t   fNPhi;                        // Number of Towers in the PHI direction
183   Float_t fSampling;                    // Sampling factor
184
185   // Shish-kebab option - 23-aug-04 by PAI; COMPACT, TWIST, TRD1 and TRD2
186   Int_t   fNumberOfSuperModules;         // default is 12 = 6 * 2 
187   Float_t fSteelFrontThick;              // Thickness of the front stell face of the support box - 9-sep-04
188   Float_t fFrontSteelStrip;              // 13-may-05
189   Float_t fLateralSteelStrip;            // 13-may-05
190   Float_t fPassiveScintThick;            // 13-may-05
191   Float_t fPhiModuleSize;                // Phi -> X 
192   Float_t fEtaModuleSize;                // Eta -> Y
193   Float_t fPhiTileSize;                  // 
194   Float_t fEtaTileSize;                  // 
195   Float_t fLongModuleSize;               // 
196   Int_t   fNPhiSuperModule;              // 6 - number supermodule in phi direction
197   Int_t   fNPHIdiv;                      // number phi divizion of module
198   Int_t   fNETAdiv;                      // number eta divizion of module
199   //
200   Int_t   fNCells;                       // number of cells in calo
201   Int_t   fNCellsInSupMod;               // number cell in super module
202   Int_t   fNCellsInTower;                // number cell in tower(or module)
203   //TRU parameters
204   Int_t   fNTRU ;                        //! Number of TRUs per module
205   Int_t   fNTRUEta ;                     //! Number of cell rows per Z in one TRU
206   Int_t   fNTRUPhi ;                     //! Number of cell rows per Phi in one TRU
207   // TRD1 options - 30-sep-04
208   Float_t fTrd1Angle;                    // angle in x-z plane (in degree) 
209   Float_t f2Trd1Dx2;                     // 2*dx2 for TRD1
210   Float_t fPhiGapForSM;                  // Gap betweeen supermodules in phi direction
211   Int_t   fKey110DEG;                    // for calculation abs cell id; 19-oct-05 
212   // TRD2 options - 27-jan-07
213   Float_t fTrd2AngleY;                   // angle in y-z plane (in degree) 
214   Float_t f2Trd2Dy2;                     // 2*dy2 for TRD2
215   Float_t fEmptySpace;                   // 2mm om fred drawing
216   // Super module as TUBS
217   Float_t fTubsR;                        // radius of tubs 
218   Float_t fTubsTurnAngle;                // turn angle of tubs in degree
219   // Service routine 
220   static int ParseString(const TString &topt, TObjArray &Opt);
221
222   ClassDef(AliEMCALGeometry,10) // EMCAL geometry class 
223   };
224
225 #endif // AliEMCALGEOMETRY_H