]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALGeometry.h
"Version
[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
15 //#include <assert.h> 
16
17 // --- ROOT system ---
18 class TString ;
19 class TObjArray ;
20 class TVector3 ;
21 class TParticle ; 
22
23 // --- AliRoot header files ---
24
25 #include "AliGeometry.h"
26
27 class AliEMCALGeometry : public AliGeometry {
28 public:
29   AliEMCALGeometry() {
30     // default ctor,  must be kept public for root persistency purposes,
31     // but should never be called by the outside world
32   };
33   AliEMCALGeometry(const AliEMCALGeometry& geom):AliGeometry(geom) {
34     // cpy ctor requested by Coding Convention but not yet needed
35     Fatal("Cpy ctor", "Not implemented");
36   };
37   virtual ~AliEMCALGeometry(void) ; 
38   static AliEMCALGeometry * GetInstance(const Text_t* name,
39                                         const Text_t* title="") ; 
40   static AliEMCALGeometry * GetInstance() ;
41   AliEMCALGeometry & operator = (const AliEMCALGeometry  & /*rvalue*/) const {
42     // assignement operator requested by coding convention but not needed
43     Fatal("operator =", "not implemented");
44     return *(GetInstance()) ; 
45   };
46
47   Bool_t AreInSameTower(Int_t id1, Int_t id2) const ;  
48   virtual void GetGlobal(const AliRecPoint *, TVector3 &, TMatrix &) const {}
49   virtual void GetGlobal(const AliRecPoint *, TVector3 &) const {}
50   virtual Bool_t Impact(const TParticle *) const {return kTRUE;}
51
52   Bool_t IsInEMCAL(Double_t x, Double_t y, Double_t z) const;
53   // General
54   Bool_t  IsInitialized(void) const { return fgInit ; }
55         // Return EMCA geometrical parameters
56   // geometry
57   Float_t GetAlFrontThickness() const { return fAlFrontThick;}
58   Float_t GetArm1PhiMin() const { return fArm1PhiMin ; }
59   Float_t GetArm1PhiMax() const { return fArm1PhiMax ; }
60   Float_t GetArm1EtaMin() const { return fArm1EtaMin;}
61   Float_t GetArm1EtaMax() const { return fArm1EtaMax;}
62   Float_t GetIPDistance() const { return fIPDistance;}   
63   Float_t GetIP2ECASection() const { return ( GetIPDistance() + GetAlFrontThickness() + GetGap2Active() ) ; }   
64   Float_t GetEnvelop(Int_t index) const { return fEnvelop[index] ; }  
65   Float_t GetShellThickness() const { return fShellThickness ; }
66   Float_t GetZLength() const { return fZLength ; } 
67   Float_t GetGap2Active() const {return  fGap2Active ; }
68   Float_t GetDeltaEta() const {return (fArm1EtaMax-fArm1EtaMin)/
69                                        ((Float_t)fNZ);}
70   Float_t GetDeltaPhi() const {return (fArm1PhiMax-fArm1PhiMin)/
71                                        ((Float_t)fNPhi);}
72   Int_t   GetNECLayers() const {return fNECLayers ;}
73   Int_t   GetNZ() const {return fNZ ;}
74   Int_t   GetNEta() const {return fNZ ;}
75   Int_t   GetNPhi() const {return fNPhi ;}
76   Int_t   GetNTowers() const {return fNPhi * fNZ ;}
77   Float_t GetECPbRadThick()const {return fECPbRadThickness;}
78   Float_t GetECScintThick() const {return fECScintThick;}
79   Float_t GetSampling() const {return fSampling ; } 
80   Bool_t IsInECA(Int_t index) const { if ( (index > 0 && (index <= GetNZ() * GetNPhi()))) return kTRUE; else return kFALSE ;}
81
82   Int_t   GetNumberOfSuperModules() {return fNumberOfSuperModules;}
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   Float_t GetSteelFrontThickness() const { return fSteelFrontThick;}
95   Float_t GetLongModuleSize() const {return fLongModuleSize;}
96
97   Float_t GetTrd1Angle() const {return fTrd1Angle;}
98   Float_t Get2Trd1Dx2()  const {return f2Trd1Dx2;}
99   Float_t GetTrd2AngleY()const {return fTrd2AngleY;}
100   Float_t Get2Trd2Dy2()  const {return f2Trd2Dy2;}
101   Float_t GetTubsR()     const {return fTubsR;}
102   Float_t GetTubsTurnAngle() const {return fTubsTurnAngle;}
103   // Dabs id <-> indexes; Shish-kebab case 
104   Int_t   GetAbsCellId(const Int_t nSupMod, const Int_t nTower, const Int_t nIphi, const Int_t nIeta);
105   Bool_t  GetCellIndex(const Int_t absId, Int_t &nSupMod, Int_t &nTower, Int_t &nIphi, Int_t &nIeta);
106   void    GetCellPhiEtaIndexInSModule(const Int_t nTower, const Int_t nIphi, const Int_t nIeta, Int_t &iphi, Int_t &ieta);
107   Bool_t  CheckAbsCellId(Int_t ind); // replace the IsInECA
108   // ---
109   Float_t AngleFromEta(Float_t eta){ // returns theta in radians for a given pseudorapidity
110     return 2.0*TMath::ATan(TMath::Exp(-eta));
111   }
112   Float_t ZFromEtaR(Float_t r,Float_t eta){ // returns z in for a given
113     // pseudorapidity and r=sqrt(x*x+y*y).
114     return r/TMath::Tan(AngleFromEta(eta));
115   }
116   Int_t TowerIndex(Int_t iz,Int_t iphi) const; // returns tower index
117         // returns tower indexs iz, iphi.
118   void TowerIndexes(Int_t index,Int_t &iz,Int_t &iphi) const;
119         // for a given tower index it returns eta and phi of center of that tower.
120   void EtaPhiFromIndex(Int_t index,Float_t &eta,Float_t &phi) const;
121         // returns x, y, and z (cm) on the inner surface of a given EMCAL Cell specified by relid.
122   void XYZFromIndex(const Int_t *relid,Float_t &x,Float_t &y, Float_t &z) const;
123   void XYZFromIndex(Int_t absid, TVector3 &v) const;
124         // for a given eta and phi in the EMCAL it returns the tower index.
125   Int_t TowerIndexFromEtaPhi(Float_t eta,Float_t phi) const;
126         // for a given eta and phi in the EMCAL it returns the pretower index.
127   void PosInAlice(const Int_t *relid, Float_t &theta, Float_t &phi) const ;
128   void PosInAlice(Int_t absid, Float_t &theta, Float_t &phi) const ;
129   Bool_t AbsToRelNumbering(Int_t AbsId, Int_t *relid) const;
130   void SetNZ(Int_t nz) { fNZ= nz ; printf("SetNZ: Number of modules in Z set to %d", fNZ) ; }
131   void SetNPhi(Int_t nphi) { fNPhi= nphi ; printf("SetNPhi: Number of modules in Phi set to %d", fNPhi) ; }
132   void SetSampling(Float_t samp) { fSampling = samp; printf("SetSampling: Sampling factor set to %f", fSampling) ; }
133
134 protected:
135   AliEMCALGeometry(const Text_t* name, const Text_t* title="") :
136     AliGeometry(name, title) {// ctor only for internal usage (singleton)
137     Init();
138   };
139   void Init(void);                      // initializes the parameters of EMCAL
140   
141 private:
142   static AliEMCALGeometry * fgGeom;     // pointer to the unique instance of the singleton
143   static Bool_t fgInit;                 // Tells if geometry has been succesfully set up.
144   Float_t fAlFrontThick;                // Thickness of the front Al face of the support box
145   
146   Float_t fECPbRadThickness;            // cm, Thickness of the Pb radiators
147   Float_t fECScintThick;                // cm, Thickness of the scintillators
148   Int_t   fNECLayers;                   // number of scintillator layers
149   
150   Float_t fArm1PhiMin;                  // Minimum angular position of EMCAL in Phi (degrees)
151   Float_t fArm1PhiMax;                  // Maximum angular position of EMCAL in Phi (degrees)
152   Float_t fArm1EtaMin;                  // Minimum pseudorapidity position of EMCAL in Eta
153   Float_t fArm1EtaMax;                  // Maximum pseudorapidity position of EMCAL in Eta
154   
155   // Geometry Parameters
156   Float_t fEnvelop[3];                  // the GEANT TUB for the detector 
157   Float_t fIPDistance;                  // Radial Distance of the inner surface of the EMCAL
158   Float_t fShellThickness;              // Total thickness in (x,y) direction
159   Float_t fZLength;                     // Total length in z direction
160   Float_t fGap2Active;                  // Gap between the envelop and the active material
161   Int_t   fNZ;                          // Number of Towers in the Z direction
162   Int_t   fNPhi;                        // Number of Towers in the PHI direction
163   Float_t fSampling;                    // Sampling factor
164
165   // Shish-kebab option - 23-aug-04 by PAI; COMPACT, TWIST, TRD1 and TRD2
166   Int_t   fNumberOfSuperModules;         // default is 12 = 6 * 2 
167   Float_t fSteelFrontThick;              // Thickness of the front stell face of the support box - 9-sep-04
168   Float_t fFrontSteelStrip;              // 13-may-05
169   Float_t fLateralSteelStrip;            // 13-may-05
170   Float_t fPassiveScintThick;            // 13-may-05
171   Float_t fPhiModuleSize;                // Phi -> X 
172   Float_t fEtaModuleSize;                // Eta -> Y
173   Float_t fPhiTileSize;                  // 
174   Float_t fEtaTileSize;                  // 
175   Float_t fLongModuleSize;               // 
176   Int_t   fNPhiSuperModule;              // 6 - number supermodule in phi direction
177   Int_t   fNPHIdiv;                      // number phi dvizion
178   Int_t   fNETAdiv;                      // number eta divizion
179   //
180   Int_t   fNCells;                       // number of cells in calo
181   Int_t   fNCellsInSupMod;               // number cell in super module
182   Int_t   fNCellsInTower;                // number cell in tower
183   // TRD1 options - 30-sep-04
184   Float_t fTrd1Angle;                    // angle in x-z plane (in degree) 
185   Float_t f2Trd1Dx2;                     // 2*dx2 for TRD1
186   // TRD2 options - 27-jan-07
187   Float_t fTrd2AngleY;                   // angle in y-z plane (in degree) 
188   Float_t f2Trd2Dy2;                     // 2*dy2 for TRD2
189   Float_t fEmptySpace;                   // 2mm om fred drawing
190   // Sumper module as TUBS
191   Float_t fTubsR;                        // radius of tubs 
192   Float_t fTubsTurnAngle;                // turn angle of tubs in degree
193
194   ClassDef(AliEMCALGeometry,9) // EMCAL geometry class 
195     };
196
197 #endif // AliEMCALGEOMETRY_H