]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALGeometry.h
Correcting compiler warnings
[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 TParticle ; 
23 class AliEMCALShishKebabTrd1Module;
24 class AliEMCALRecPoint;
25 class TClonesArray ;
26
27 // --- AliRoot header files ---
28 #include <TArrayD.h>
29 #include <TMath.h>
30
31 #include "AliGeometry.h"
32
33 class AliEMCALGeometry : public AliGeometry {
34 public:
35   AliEMCALGeometry(const AliEMCALGeometry& geom);
36   virtual ~AliEMCALGeometry(void); 
37
38   static AliEMCALGeometry * GetInstance(const Text_t* name,
39                                         const Text_t* title="") ; 
40   static AliEMCALGeometry * GetInstance();
41   AliEMCALGeometry & operator = (const AliEMCALGeometry  & /*rvalue*/) {
42     // assignement operator requested by coding convention but not needed
43     Fatal("operator =", "not implemented");
44     return *this;
45   };
46   static Char_t* GetDefaulGeometryName() {return fgDefaultGeometryName;}
47   void PrintGeometry();                                           //*MENU*  
48   void PrintCellIndexes(Int_t absId=0, int pri=0, char *tit="");  //*MENU*
49   virtual void Browse(TBrowser* b);
50   virtual Bool_t  IsFolder() const;
51
52   void FillTRU(const TClonesArray * digits, TClonesArray * amptru, TClonesArray * ampmod, TClonesArray * timeRtru)  ; //Fills Trigger Unit matrices with digit amplitudes and time
53   void GetCellPhiEtaIndexInSModuleFromTRUIndex(Int_t itru, Int_t iphitru, Int_t ietatru, Int_t &ietaSM, Int_t &iphiSM) const ; // Tranforms Eta-Phi Cell index in TRU into Eta-Phi index in Super Module
54   
55   // Have to call GetTransformationForSM() before calculation global charachteristics 
56   void GetGlobal(const Double_t *loc, Double_t *glob, int ind) const;
57   void GetGlobal(const TVector3 &vloc, TVector3 &vglob, int ind) const;
58   void GetGlobal(Int_t absId, Double_t glob[3]) const;
59   void GetGlobal(Int_t absId, TVector3 &vglob) const;
60   // for a given tower index absId returns eta and phi of gravity center of tower.
61   void EtaPhiFromIndex(Int_t absId, Double_t &eta, Double_t &phi) const;
62   void EtaPhiFromIndex(Int_t absId, Float_t &eta, Float_t &phi) const;
63   // 
64   Bool_t GetPhiBoundariesOfSM   (Int_t nSupMod, Double_t &phiMin, Double_t &phiMax) const;
65   Bool_t GetPhiBoundariesOfSMGap(Int_t nPhiSec, Double_t &phiMin, Double_t &phiMax) const;
66   Bool_t SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi, Int_t &nSupMod) const;
67
68   Bool_t GetAbsCellIdFromEtaPhi(Double_t eta,Double_t phi, Int_t &absId) const;
69
70   //  virtual void GetGlobal(const AliEMCALRecPoint *rp, TVector3 &vglob) const;
71
72   virtual void GetGlobal(const AliRecPoint *rp, TVector3 &vglob) const;
73   // Bool_t AreInSameTower(Int_t id1, Int_t id2) const ;  
74
75   virtual void GetGlobal(const AliRecPoint *, TVector3 &, TMatrixF &) const {}
76
77   virtual Bool_t Impact(const TParticle *) const {return kTRUE;}
78
79   Bool_t IsInEMCAL(Double_t x, Double_t y, Double_t z) const;
80   // General
81   Bool_t  IsInitialized(void) const { return fgInit ; }
82   // Return EMCAL geometrical parameters
83   // geometry
84   Char_t* GetNameOfEMCALEnvelope() const {return "XEN1";}
85   Float_t GetAlFrontThickness() const { return fAlFrontThick;}
86   Float_t GetArm1PhiMin() const { return fArm1PhiMin ; }
87   Float_t GetArm1PhiMax() const { return fArm1PhiMax ; }
88   Float_t GetArm1EtaMin() const { return fArm1EtaMin;}
89   Float_t GetArm1EtaMax() const { return fArm1EtaMax;}
90   Float_t GetIPDistance() const { return fIPDistance;}   
91   Float_t GetIP2ECASection() const { return ( GetIPDistance() + GetAlFrontThickness() + GetGap2Active() ) ; }   
92   Float_t GetEnvelop(Int_t index) const { return fEnvelop[index] ; }  
93   Float_t GetShellThickness() const { return fShellThickness ; }
94   Float_t GetZLength() const { return fZLength ; } 
95   Float_t GetGap2Active() const {return  fGap2Active ;}
96   Float_t GetDeltaEta() const {return (fArm1EtaMax-fArm1EtaMin)/
97                                        ((Float_t)fNZ);}
98   Float_t GetDeltaPhi() const {return (fArm1PhiMax-fArm1PhiMin)/
99                                        ((Float_t)fNPhi);}
100   Int_t   GetNECLayers() const {return fNECLayers ;}
101   Int_t   GetNZ() const {return fNZ ;}
102   Int_t   GetNEta() const {return fNZ ;}
103   Int_t   GetNPhi() const {return fNPhi ;}
104   Int_t   GetNTowers() const {return fNPhi * fNZ ;}
105   Float_t GetECPbRadThick()const {return fECPbRadThickness;}
106   Float_t GetECScintThick() const {return fECScintThick;}
107   Float_t GetSampling() const {return fSampling ; } 
108   //  Bool_t IsInECA(Int_t index) const { if ( (index > 0 && (index <= GetNZ() * GetNPhi()))) return kTRUE; else return kFALSE ;}
109
110   Int_t   GetNumberOfSuperModules() const {return fNumberOfSuperModules;}
111   Float_t GetfPhiGapForSuperModules() const {return fPhiGapForSM;}
112   Float_t GetPhiModuleSize() const  {return fPhiModuleSize;}
113   Float_t GetEtaModuleSize() const  {return fEtaModuleSize;}
114   Float_t GetFrontSteelStrip() const {return fFrontSteelStrip;}
115   Float_t GetLateralSteelStrip() const {return fLateralSteelStrip;}
116   Float_t GetPassiveScintThick() const {return fPassiveScintThick;}
117   Float_t GetPhiTileSize() const {return fPhiTileSize;}
118   Float_t GetEtaTileSize() const {return fEtaTileSize;}
119   Int_t   GetNPhiSuperModule() const {return fNPhiSuperModule;}
120   Int_t   GetNPHIdiv() const {return fNPHIdiv ;}
121   Int_t   GetNETAdiv() const {return fNETAdiv ;}
122   Int_t   GetNCells()  const {return fNCells;}
123
124   Int_t   GetNTRU() const    {return fNTRU ; }  
125   Int_t   GetNTRUEta() const {return fNTRUEta ; }  
126   Int_t   GetNTRUPhi() const {return fNTRUPhi ; }  
127
128   Float_t GetSteelFrontThickness() const { return fSteelFrontThick;}
129   Float_t GetLongModuleSize() const {return fLongModuleSize;}
130
131   Float_t GetTrd1Angle() const {return fTrd1Angle;}
132   Float_t Get2Trd1Dx2()  const {return f2Trd1Dx2;}
133   Float_t GetTrd2AngleY()const {return fTrd2AngleY;}
134   Float_t Get2Trd2Dy2()  const {return f2Trd2Dy2;}
135   Float_t GetTubsR()     const {return fTubsR;}
136   Float_t GetTubsTurnAngle() const {return fTubsTurnAngle;}
137
138   // TRD1 staff
139   void    CreateListOfTrd1Modules();
140   TList  *GetShishKebabTrd1Modules() const {return fShishKebabTrd1Modules;}
141   AliEMCALShishKebabTrd1Module *GetShishKebabModule(Int_t neta);
142
143   void     GetTransformationForSM();
144   Float_t *GetSuperModulesPars() {return fParSM;}
145   TGeoMatrix *GetTransformationForSM(int i) {
146   if(i>=0 && i<GetNumberOfSuperModules()) return fMatrixOfSM[i]; 
147                                         else return 0;}
148   // May 31, 2006; ALICE numbering scheme: 
149   // see ALICE-INT-2003-038: ALICE Coordinate System and Software Numbering Convention
150   // All indexes are stared from zero now.
151   // 
152   // abs id <-> indexes; Shish-kebab case, only TRD1 now.
153   // EMCAL -> Super Module -> module -> tower(or cell) - logic tree of EMCAL
154   // 
155   //**  Usual name of variable - Dec 18,2006 **
156   //  nSupMod - index of super module (SM)
157   //  nModule - index of module in SM
158   //  nIphi   - phi index of tower(cell) in module
159   //  nIeta   - eta index of tower(cell) in module
160   //  
161   //  Inside SM
162   //  iphim   - phi index of module in SM  
163   //  ietam   - eta index of module in SM  
164   //
165   //  iphi    - phi index of tower(cell) in SM  
166   //  ieta    - eta index of tower(cell) in SM  
167   Int_t   GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta) const;
168   Bool_t  CheckAbsCellId(Int_t absId) const;
169   Bool_t  GetCellIndex(Int_t absId, Int_t &nSupMod, Int_t &nModule, Int_t &nIphi, Int_t &nIeta) const;
170   // Local coordinate of Super Module 
171   void    GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t &iphim, Int_t &ietam) const;
172   void    GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta,
173                                       Int_t &iphi, Int_t &ieta) const ;
174   Int_t   GetSuperModuleNumber(Int_t absId)  const;
175   Int_t   GetNumberOfModuleInPhiDirection(Int_t nSupMod)  const
176   {
177     // inline function
178     if(fKey110DEG == 1 && nSupMod>=10) return fNPhi/2;
179     else                               return fNPhi;
180   }
181   // From cell indexes to abs cell id
182   void    GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod, Int_t iphi, Int_t ieta, 
183           Int_t &iphim, Int_t &ietam, Int_t &nModule) const;
184   Int_t   GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const;
185   // Methods for AliEMCALRecPoint - Feb 19, 2006
186   Bool_t   RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const;
187   Bool_t   RelPosCellInSModule(Int_t absId, Double_t loc[3]) const;
188   Bool_t   RelPosCellInSModule(Int_t absId, TVector3 &vloc) const;
189   // ---
190   Float_t AngleFromEta(Float_t eta) const { // returns theta in radians for a given pseudorapidity
191     return 2.0*TMath::ATan(TMath::Exp(-eta));
192   }
193   Float_t ZFromEtaR(Float_t r,Float_t eta) const { // returns z in for a given
194     // pseudorapidity and r=sqrt(x*x+y*y).
195     return r/TMath::Tan(AngleFromEta(eta));
196   }
197   void SetNZ(Int_t nz) { fNZ= nz ; printf("SetNZ: Number of modules in Z set to %d", fNZ) ; }
198   void SetNPhi(Int_t nphi) { fNPhi= nphi ; printf("SetNPhi: Number of modules in Phi set to %d", fNPhi) ; }
199
200   void SetNTRU(Int_t ntru)    {fNTRU    = ntru; printf("SetNTRU: Number of TRUs per SuperModule set to %d", fNTRU) ; }
201   void SetNTRUEta(Int_t ntru) {fNTRUEta = ntru; ; printf("SetNTRU: Number of TRUs per SuperModule in Etaset to %d", fNTRUEta) ;}
202   void SetNTRUPhi(Int_t ntru) {fNTRUPhi = ntru; ; printf("SetNTRU: Number of TRUs per SuperModule in Phi set to %d", fNTRUPhi) ;}
203
204   void SetSampling(Float_t samp) { fSampling = samp; printf("SetSampling: Sampling factor set to %f", fSampling) ; }
205
206   Int_t GetNCellsInSupMod() const {return fNCellsInSupMod;}
207   Int_t GetNCellsInModule()  const {return fNCellsInModule; }
208   Int_t GetKey110DEG()      const {return fKey110DEG;}
209   Int_t GetILOSS() const {return fILOSS;}
210   Int_t GetIHADR() const {return fIHADR;}
211
212   AliEMCALGeometry(); // default ctor only for internal usage (singleton)
213
214 protected:
215   AliEMCALGeometry(const Text_t* name, const Text_t* title);// ctor only for internal usage (singleton)
216
217   void Init(void);                      // initializes the parameters of EMCAL
218   void CheckAdditionalOptions();        //
219   void DefineSamplingFraction();        // Jun 5, 2006
220   
221 private:
222   static AliEMCALGeometry * fgGeom;     // pointer to the unique instance of the singleton
223   static Bool_t  fgInit;                // Tells if geometry has been succesfully set up.
224   static Char_t* fgDefaultGeometryName; // Default name of geometry
225
226   TString fGeoName;                     //geometry name
227
228   TObjArray *fArrayOpts;                //! array of geometry options
229
230   Float_t fAlFrontThick;                // Thickness of the front Al face of the support box  
231   Float_t fECPbRadThickness;            // cm, Thickness of the Pb radiators
232   Float_t fECScintThick;                // cm, Thickness of the scintillators
233   Int_t   fNECLayers;                   // number of scintillator layers
234   
235   Float_t fArm1PhiMin;                  // Minimum angular position of EMCAL in Phi (degrees)
236   Float_t fArm1PhiMax;                  // Maximum angular position of EMCAL in Phi (degrees)
237   Float_t fArm1EtaMin;                  // Minimum pseudorapidity position of EMCAL in Eta
238   Float_t fArm1EtaMax;                  // Maximum pseudorapidity position of EMCAL in Eta
239   
240   // Geometry Parameters
241   Float_t fEnvelop[3];                  // the GEANT TUB for the detector 
242   Float_t fIPDistance;                  // Radial Distance of the inner surface of the EMCAL
243   Float_t fShellThickness;              // Total thickness in (x,y) direction
244   Float_t fZLength;                     // Total length in z direction
245   Float_t fGap2Active;                  // Gap between the envelop and the active material
246   Int_t   fNZ;                          // Number of Towers in the Z direction
247   Int_t   fNPhi;                        // Number of Towers in the PHI direction
248   Float_t fSampling;                    // Sampling factor
249
250   // Shish-kebab option - 23-aug-04 by PAI; COMPACT, TWIST, TRD1 and TRD2
251   Int_t   fNumberOfSuperModules;         // default is 12 = 6 * 2 
252   Float_t fSteelFrontThick;              // Thickness of the front stell face of the support box - 9-sep-04
253   Float_t fFrontSteelStrip;              // 13-may-05
254   Float_t fLateralSteelStrip;            // 13-may-05
255   Float_t fPassiveScintThick;            // 13-may-05
256   Float_t fPhiModuleSize;                // Phi -> X 
257   Float_t fEtaModuleSize;                // Eta -> Y
258   Float_t fPhiTileSize;                  // Size of phi tile
259   Float_t fEtaTileSize;                  // Size of eta tile
260   Float_t fLongModuleSize;               // Size of long module
261   Int_t   fNPhiSuperModule;              // 6 - number supermodule in phi direction
262   Int_t   fNPHIdiv;                      // number phi divizion of module
263   Int_t   fNETAdiv;                      // number eta divizion of module
264   //
265   Int_t   fNCells;                       // number of cells in calo
266   Int_t   fNCellsInSupMod;               // number cell in super module
267   Int_t   fNCellsInModule;               // number cell in module)
268   //TRU parameters
269   Int_t   fNTRU ;                        //! Number of TRUs per module
270   Int_t   fNTRUEta ;                     //! Number of cell rows per Z in one TRU
271   Int_t   fNTRUPhi ;                     //! Number of cell rows per Phi in one TRU
272   // TRD1 options - 30-sep-04
273   Float_t fTrd1Angle;                    // angle in x-z plane (in degree) 
274   Float_t f2Trd1Dx2;                     // 2*dx2 for TRD1
275   Float_t fPhiGapForSM;                  // Gap betweeen supermodules in phi direction
276   Int_t   fKey110DEG;                    // for calculation abs cell id; 19-oct-05 
277   TArrayD fPhiBoundariesOfSM;            // phi boundaries of SM in rad; size is fNumberOfSuperModules;
278   TArrayD fPhiCentersOfSM;                // phi of centers of SMl size is fNumberOfSuperModules/2
279   Float_t fEtaMaxOfTRD1;                 // max eta in case of TRD1 geometry (see AliEMCALShishKebabTrd1Module)
280   // TRD2 options - 27-jan-07
281   Float_t fTrd2AngleY;                   // angle in y-z plane (in degree) 
282   Float_t f2Trd2Dy2;                     // 2*dy2 for TRD2
283   Float_t fEmptySpace;                   // 2mm om fred drawing
284   // Super module as TUBS
285   Float_t fTubsR;                        // radius of tubs 
286   Float_t fTubsTurnAngle;                // turn angle of tubs in degree
287   // Local Coordinates of SM
288   TArrayD  fCentersOfCellsEtaDir;        // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm)
289   TArrayD  fCentersOfCellsXDir;          // size fNEta*fNETAdiv (for TRD1 only) (       x in SM, in cm)
290   TArrayD  fCentersOfCellsPhiDir;        // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
291   //
292   TArrayD  fEtaCentersOfCells;           // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position; 
293   TArrayD  fPhiCentersOfCells;           // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.)
294   // Move from AliEMCALv0 - Feb 19, 2006
295   TList *fShishKebabTrd1Modules; //! list of modules
296   // Local coordinates of SM for TRD1
297   Float_t     fParSM[3];       // SM sizes as in GEANT (TRD1)
298   TGeoMatrix* fMatrixOfSM[12]; //![fNumberOfSuperModules]; get from gGeoManager;
299
300   char *fAdditionalOpts[6];  //! some additional options for the geometry type and name
301   int  fNAdditionalOpts;     //! size of additional options parameter
302
303   // Options for Geant (MIP business) - will call in AliEMCAL
304   Int_t fILOSS;
305   Int_t fIHADR;
306
307   ClassDef(AliEMCALGeometry, 11) // EMCAL geometry class 
308   };
309
310 #endif // AliEMCALGEOMETRY_H