]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALGeometry.h
Removing meaningless const (icc)
[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 TGeoMatrix;
22 class TArrayD;
23 class TParticle ; 
24 class AliEMCALShishKebabTrd1Module;
25 class AliEMCALRecPoint;
26 class TClonesArray ;
27
28 // --- AliRoot header files ---
29 #include "AliGeometry.h"
30 #include "AliEMCALAlignData.h"
31
32 class AliEMCALGeometry : public AliGeometry {
33 public:
34   AliEMCALGeometry(const AliEMCALGeometry& geom):AliGeometry(geom) {
35     // cpy ctor requested by Coding Convention but not yet needed
36     Fatal("Cpy ctor", "Not implemented");
37   };
38   virtual ~AliEMCALGeometry(void); 
39
40   static AliEMCALGeometry * GetInstance(const Text_t* name,
41                                         const Text_t* title="") ; 
42   static AliEMCALGeometry * GetInstance() ;
43   AliEMCALGeometry & operator = (const AliEMCALGeometry  & /*rvalue*/) const {
44     // assignement operator requested by coding convention but not needed
45     Fatal("operator =", "not implemented");
46     return *(GetInstance()); 
47   };
48
49   // Have to call GetTransformationForSM() before calculation global charachteristics 
50   void GetGlobal(const Double_t *loc, Double_t *glob, int nsm) const;
51   void GetGlobal(const TVector3 &vloc, TVector3 &vglob, int nsm) const;
52   void GetGlobal(Int_t absId, TVector3 &vglob) const;
53   // for a given tower index it returns eta and phi of center of that tower.
54   void EtaPhiFromIndex(Int_t index,Float_t &eta,Float_t &phi) const;
55
56   //  virtual void GetGlobal(const AliEMCALRecPoint *rp, TVector3 &vglob) const;
57
58   virtual void GetGlobal(const AliRecPoint *rp, TVector3 &vglob) const;
59   // Bool_t AreInSameTower(Int_t id1, Int_t id2) const ;  
60
61   TClonesArray *  FillTRU(const TClonesArray * digits)  ;
62   virtual void GetGlobal(const AliRecPoint *, TVector3 &, TMatrixF &) const {}
63
64   virtual Bool_t Impact(const TParticle *) const {return kTRUE;}
65
66   Bool_t IsInEMCAL(Double_t x, Double_t y, Double_t z) const;
67   // General
68   Bool_t  IsInitialized(void) const { return fgInit ; }
69   // Return EMCAL geometrical parameters
70   // geometry
71   Char_t* GetNameOfEMCALEnvelope() const {return "XEN1";}
72   Float_t GetAlFrontThickness() const { return fAlFrontThick;}
73   Float_t GetArm1PhiMin() const { return fArm1PhiMin ; }
74   Float_t GetArm1PhiMax() const { return fArm1PhiMax ; }
75   Float_t GetArm1EtaMin() const { return fArm1EtaMin;}
76   Float_t GetArm1EtaMax() const { return fArm1EtaMax;}
77   Float_t GetIPDistance() const { return fIPDistance;}   
78   Float_t GetIP2ECASection() const { return ( GetIPDistance() + GetAlFrontThickness() + GetGap2Active() ) ; }   
79   Float_t GetEnvelop(Int_t index) const { return fEnvelop[index] ; }  
80   Float_t GetShellThickness() const { return fShellThickness ; }
81   Float_t GetZLength() const { return fZLength ; } 
82   Float_t GetGap2Active() const {return  fGap2Active ;}
83   Float_t GetDeltaEta() const {return (fArm1EtaMax-fArm1EtaMin)/
84                                        ((Float_t)fNZ);}
85   Float_t GetDeltaPhi() const {return (fArm1PhiMax-fArm1PhiMin)/
86                                        ((Float_t)fNPhi);}
87   Int_t   GetNECLayers() const {return fNECLayers ;}
88   Int_t   GetNZ() const {return fNZ ;}
89   Int_t   GetNEta() const {return fNZ ;}
90   Int_t   GetNPhi() const {return fNPhi ;}
91   Int_t   GetNTowers() const {return fNPhi * fNZ ;}
92   Float_t GetECPbRadThick()const {return fECPbRadThickness;}
93   Float_t GetECScintThick() const {return fECScintThick;}
94   Float_t GetSampling() const {return fSampling ; } 
95   Bool_t IsInECA(Int_t index) const { if ( (index > 0 && (index <= GetNZ() * GetNPhi()))) return kTRUE; else return kFALSE ;}
96
97   Int_t   GetNumberOfSuperModules() const {return fNumberOfSuperModules;}
98   Float_t GetfPhiGapForSuperModules() const {return fPhiGapForSM;}
99   Float_t GetPhiModuleSize() const  {return fPhiModuleSize;}
100   Float_t GetEtaModuleSize() const  {return fEtaModuleSize;}
101   Float_t GetFrontSteelStrip() const {return fFrontSteelStrip;}
102   Float_t GetLateralSteelStrip() const {return fLateralSteelStrip;}
103   Float_t GetPassiveScintThick() const {return fPassiveScintThick;}
104   Float_t GetPhiTileSize() const {return fPhiTileSize;}
105   Float_t GetEtaTileSize() const {return fEtaTileSize;}
106   Int_t   GetNPhiSuperModule() const {return fNPhiSuperModule;}
107   Int_t   GetNPHIdiv() const {return fNPHIdiv ;}
108   Int_t   GetNETAdiv() const {return fNETAdiv ;}
109   Int_t   GetNCells()  const {return fNCells;}
110
111   Int_t   GetNTRU() const    {return fNTRU ; }  
112   Int_t   GetNTRUEta() const {return fNTRUEta ; }  
113   Int_t   GetNTRUPhi() const {return fNTRUPhi ; }  
114
115   Float_t GetSteelFrontThickness() const { return fSteelFrontThick;}
116   Float_t GetLongModuleSize() const {return fLongModuleSize;}
117
118   Float_t GetTrd1Angle() const {return fTrd1Angle;}
119   Float_t Get2Trd1Dx2()  const {return f2Trd1Dx2;}
120   Float_t GetTrd2AngleY()const {return fTrd2AngleY;}
121   Float_t Get2Trd2Dy2()  const {return f2Trd2Dy2;}
122   Float_t GetTubsR()     const {return fTubsR;}
123   Float_t GetTubsTurnAngle() const {return fTubsTurnAngle;}
124
125   // TRD1 staff
126   void    CreateListOfTrd1Modules();
127   TList  *GetShishKebabTrd1Modules() const {return fShishKebabTrd1Modules;}
128   AliEMCALShishKebabTrd1Module *GetShishKebabModule(Int_t neta=0)
129   {
130     static AliEMCALShishKebabTrd1Module* trd1=0;
131     if(fShishKebabTrd1Modules && neta>=0 && neta<fShishKebabTrd1Modules->GetSize()) {
132       trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabTrd1Modules->At(neta);
133     } else trd1 = 0;
134     return trd1;
135   }
136   void     GetTransformationForSM();
137   Float_t *GetSuperModulesPars() {return fParSM;}
138   TGeoMatrix *GetTransformationForSM(int i) {
139   if(i>=0 && GetNumberOfSuperModules()) return fMatrixOfSM[i]; 
140                                         else return 0;}
141   // abs id <-> indexes; Shish-kebab case (TRD1 or TRD2)
142   Int_t   GetAbsCellId(Int_t nSupMod, Int_t nTower, Int_t nIphi, Int_t nIeta) const;
143   Bool_t  CheckAbsCellId(Int_t ind) const; // replace the IsInECA
144   Bool_t  GetCellIndex(Int_t absId, Int_t &nSupMod, Int_t &nTower, Int_t &nIphi, Int_t &nIeta) const;
145   void    GetTowerPhiEtaIndexInSModule(Int_t nSupMod, Int_t nTower, Int_t &iphit, Int_t &ietat) const;
146   void    GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nTower, Int_t nIphi, Int_t nIeta,
147                                       Int_t &iphi, Int_t &ieta) const ;
148   Int_t   GetSuperModuleNumber(Int_t absId)  const; 
149   // Methods for AliEMCALRecPoint - Frb 19, 2006
150   Bool_t   RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr);
151   // ---
152   Float_t AngleFromEta(Float_t eta) const { // returns theta in radians for a given pseudorapidity
153     return 2.0*TMath::ATan(TMath::Exp(-eta));
154   }
155   Float_t ZFromEtaR(Float_t r,Float_t eta) const { // returns z in for a given
156     // pseudorapidity and r=sqrt(x*x+y*y).
157     return r/TMath::Tan(AngleFromEta(eta));
158   }
159   // These methods are obsolete but use in AliEMCALRecPoint - keep it now
160   Int_t TowerIndex(Int_t iz,Int_t iphi) const; // returns tower index
161         // returns tower indexs iz, iphi.
162   void TowerIndexes(Int_t index,Int_t &iz,Int_t &iphi) const;
163         // returns x, y, and z (cm) on the inner surface of a given EMCAL Cell specified by relid.
164   void XYZFromIndex(const Int_t *relid,Float_t &x,Float_t &y, Float_t &z) const;
165   void XYZFromIndex(Int_t absid, TVector3 &v) const;
166         // for a given eta and phi in the EMCAL it returns the tower index.
167   Int_t TowerIndexFromEtaPhi(Float_t eta,Float_t phi) const;
168         // for a given eta and phi in the EMCAL it returns the pretower index.
169   void PosInAlice(const Int_t *relid, Float_t &theta, Float_t &phi) const ;
170   void PosInAlice(Int_t absid, Float_t &theta, Float_t &phi) const ;
171   Bool_t AbsToRelNumbering(Int_t AbsId, Int_t *relid) const;
172   // --
173   void SetNZ(Int_t nz) { fNZ= nz ; printf("SetNZ: Number of modules in Z set to %d", fNZ) ; }
174   void SetNPhi(Int_t nphi) { fNPhi= nphi ; printf("SetNPhi: Number of modules in Phi set to %d", fNPhi) ; }
175
176   void SetNTRU(Int_t ntru)    {fNTRU    = ntru; printf("SetNTRU: Number of TRUs per SuperModule set to %d", fNTRU) ; }
177   void SetNTRUEta(Int_t ntru) {fNTRUEta = ntru; ; printf("SetNTRU: Number of TRUs per SuperModule in Etaset to %d", fNTRUEta) ;}
178   void SetNTRUPhi(Int_t ntru) {fNTRUPhi = ntru; ; printf("SetNTRU: Number of TRUs per SuperModule in Phi set to %d", fNTRUPhi) ;}
179
180   void SetSampling(Float_t samp) { fSampling = samp; printf("SetSampling: Sampling factor set to %f", fSampling) ; }
181
182   Int_t GetNCellsInSupMod() const {return fNCellsInSupMod;}
183   Int_t GetNCellsInTower() const {return fNCellsInTower; }
184
185   AliEMCALGeometry() :
186     AliGeometry() {// ctor only for internal usage (singleton)
187    // default ctor 
188    // must be kept public for root persistency purposes, but should never be called 
189    // by the outside world    
190      CreateListOfTrd1Modules();
191   };
192
193 protected:
194   AliEMCALGeometry(const Text_t* name, const Text_t* title) :
195     AliGeometry(name, title) {// ctor only for internal usage (singleton)
196     Init();
197     CreateListOfTrd1Modules();
198   };
199
200   AliEMCALGeometry(const Text_t* name, const Text_t* title, AliEMCALAlignData* alignData) :
201     AliGeometry(name, title) {// Align data in action
202     fgAlignData = alignData;
203     Init();
204     CreateListOfTrd1Modules();
205   };
206
207   void Init(void);                      // initializes the parameters of EMCAL
208   void CheckAditionalOptions();         //
209   
210 private:
211   static AliEMCALGeometry * fgGeom;     // pointer to the unique instance of the singleton
212   static Bool_t fgInit;                 // Tells if geometry has been succesfully set up.
213   static AliEMCALAlignData *fgAlignData;// 
214
215   TObjArray *fArrayOpts;                //! array of geometry options
216
217   Float_t fAlFrontThick;                // Thickness of the front Al face of the support box  
218   Float_t fECPbRadThickness;            // cm, Thickness of the Pb radiators
219   Float_t fECScintThick;                // cm, Thickness of the scintillators
220   Int_t   fNECLayers;                   // number of scintillator layers
221   
222   Float_t fArm1PhiMin;                  // Minimum angular position of EMCAL in Phi (degrees)
223   Float_t fArm1PhiMax;                  // Maximum angular position of EMCAL in Phi (degrees)
224   Float_t fArm1EtaMin;                  // Minimum pseudorapidity position of EMCAL in Eta
225   Float_t fArm1EtaMax;                  // Maximum pseudorapidity position of EMCAL in Eta
226   
227   // Geometry Parameters
228   Float_t fEnvelop[3];                  // the GEANT TUB for the detector 
229   Float_t fIPDistance;                  // Radial Distance of the inner surface of the EMCAL
230   Float_t fShellThickness;              // Total thickness in (x,y) direction
231   Float_t fZLength;                     // Total length in z direction
232   Float_t fGap2Active;                  // Gap between the envelop and the active material
233   Int_t   fNZ;                          // Number of Towers in the Z direction
234   Int_t   fNPhi;                        // Number of Towers in the PHI direction
235   Float_t fSampling;                    // Sampling factor
236
237   // Shish-kebab option - 23-aug-04 by PAI; COMPACT, TWIST, TRD1 and TRD2
238   Int_t   fNumberOfSuperModules;         // default is 12 = 6 * 2 
239   Float_t fSteelFrontThick;              // Thickness of the front stell face of the support box - 9-sep-04
240   Float_t fFrontSteelStrip;              // 13-may-05
241   Float_t fLateralSteelStrip;            // 13-may-05
242   Float_t fPassiveScintThick;            // 13-may-05
243   Float_t fPhiModuleSize;                // Phi -> X 
244   Float_t fEtaModuleSize;                // Eta -> Y
245   Float_t fPhiTileSize;                  // 
246   Float_t fEtaTileSize;                  // 
247   Float_t fLongModuleSize;               // 
248   Int_t   fNPhiSuperModule;              // 6 - number supermodule in phi direction
249   Int_t   fNPHIdiv;                      // number phi divizion of module
250   Int_t   fNETAdiv;                      // number eta divizion of module
251   //
252   Int_t   fNCells;                       // number of cells in calo
253   Int_t   fNCellsInSupMod;               // number cell in super module
254   Int_t   fNCellsInTower;                // number cell in tower(or module)
255   //TRU parameters
256   Int_t   fNTRU ;                        //! Number of TRUs per module
257   Int_t   fNTRUEta ;                     //! Number of cell rows per Z in one TRU
258   Int_t   fNTRUPhi ;                     //! Number of cell rows per Phi in one TRU
259   // TRD1 options - 30-sep-04
260   Float_t fTrd1Angle;                    // angle in x-z plane (in degree) 
261   Float_t f2Trd1Dx2;                     // 2*dx2 for TRD1
262   Float_t fPhiGapForSM;                  // Gap betweeen supermodules in phi direction
263   Int_t   fKey110DEG;                    // for calculation abs cell id; 19-oct-05 
264   // TRD2 options - 27-jan-07
265   Float_t fTrd2AngleY;                   // angle in y-z plane (in degree) 
266   Float_t f2Trd2Dy2;                     // 2*dy2 for TRD2
267   Float_t fEmptySpace;                   // 2mm om fred drawing
268   // Super module as TUBS
269   Float_t fTubsR;                        // radius of tubs 
270   Float_t fTubsTurnAngle;                // turn angle of tubs in degree
271   // Local Coordinates of SM
272   TArrayD *fEtaCentersOfCells;           // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM)
273   TArrayD *fXCentersOfCells;             // size fNEta*fNETAdiv (for TRD1 only) (       x in SM)
274   TArrayD *fPhiCentersOfCells;           // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM)
275   // Move from AliEMCALv0 - Feb 19, 2006
276   TList *fShishKebabTrd1Modules; //! list of modules
277   // Local coordinates of SM for TRD1
278   Float_t     fParSM[3];       // SM sizes as in GEANT (TRD1)
279   TGeoMatrix* fMatrixOfSM[12]; //![fNumberOfSuperModules]; get from gGeoManager;
280
281   ClassDef(AliEMCALGeometry, 10) // EMCAL geometry class 
282   };
283
284 #endif // AliEMCALGEOMETRY_H