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