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 */
8 //_________________________________________________________________________
9 // Geometry class for EMCAL : singleton
10 // EMCAL consists of a layers of scintillator, and lead.
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.
17 // --- ROOT system ---
32 // --- AliRoot header files ---
33 class AliEMCALGeometry;
34 class AliEMCALShishKebabTrd1Module;
35 class AliEMCALRecPoint;
38 #include "AliGeometry.h"
40 class AliEMCALGeometry : public AliGeometry {
42 AliEMCALGeometry(const AliEMCALGeometry& geom);
43 virtual ~AliEMCALGeometry(void);
45 static AliEMCALGeometry * GetInstance(const Text_t* name,
46 const Text_t* title="") ;
47 static AliEMCALGeometry * GetInstance();
48 AliEMCALGeometry & operator = (const AliEMCALGeometry & /*rvalue*/) {
49 // assignement operator requested by coding convention but not needed
50 Fatal("operator =", "not implemented");
54 AliEMCALGeometry(); // default ctor only for internal usage (singleton)
59 Bool_t IsInitialized(void) const { return fgInit ; }
60 static const Char_t* GetDefaultGeometryName() {return fgDefaultGeometryName;}
61 void PrintGeometry(); //*MENU*
62 void PrintCellIndexes(Int_t absId=0, int pri=0, const char *tit=""); //*MENU*
63 virtual void Browse(TBrowser* b);
64 virtual Bool_t IsFolder() const;
66 //////////////////////////
67 // Global geometry methods
69 void GetGlobal(const Double_t *loc, Double_t *glob, int ind) const;
70 void GetGlobal(const TVector3 &vloc, TVector3 &vglob, int ind) const;
71 void GetGlobal(Int_t absId, Double_t glob[3]) const;
72 void GetGlobal(Int_t absId, TVector3 &vglob) const;
74 virtual void GetGlobal(const AliRecPoint *rp, TVector3 &vglob) const;
75 virtual void GetGlobal(const AliRecPoint *rp, TVector3 & gpos, TMatrixF & /* gmat */)
76 const {GetGlobal(rp,gpos); }
77 virtual void GetGlobalEMCAL(const AliEMCALRecPoint *rp, TVector3 &vglob) const;
78 virtual void GetGlobalEMCAL(const AliEMCALRecPoint *rp, TVector3 & gpos, TMatrixF & /* gmat */)
79 const {GetGlobalEMCAL(rp,gpos); }
83 void CreateListOfTrd1Modules();
84 TList *GetShishKebabTrd1Modules() const {return fShishKebabTrd1Modules;}
85 AliEMCALShishKebabTrd1Module *GetShishKebabModule(Int_t neta) const;
87 //////////////////////////////////////
88 // Return EMCAL geometrical parameters
90 const Char_t* GetNameOfEMCALEnvelope() const { const Char_t* env = "XEN1"; return env ;}
91 Float_t GetArm1PhiMin() const { return fArm1PhiMin ; }
92 Float_t GetArm1PhiMax() const { return fArm1PhiMax ; }
93 Float_t GetArm1EtaMin() const { return fArm1EtaMin;}
94 Float_t GetArm1EtaMax() const { return fArm1EtaMax;}
95 Float_t GetIPDistance() const { return fIPDistance;}
96 Float_t GetEnvelop(Int_t index) const { return fEnvelop[index] ; }
97 Float_t GetShellThickness() const { return fShellThickness ; }
98 Float_t GetZLength() const { return fZLength ; }
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 Float_t GetECPbRadThick()const {return fECPbRadThickness;}
104 Float_t GetECScintThick() const {return fECScintThick;}
105 Float_t GetSampling() const {return fSampling ; }
106 Int_t GetNumberOfSuperModules() const {return fNumberOfSuperModules;}
107 Float_t GetfPhiGapForSuperModules() const {return fPhiGapForSM;}
108 Float_t GetPhiModuleSize() const {return fPhiModuleSize;}
109 Float_t GetEtaModuleSize() const {return fEtaModuleSize;}
110 Float_t GetFrontSteelStrip() const {return fFrontSteelStrip;}
111 Float_t GetLateralSteelStrip() const {return fLateralSteelStrip;}
112 Float_t GetPassiveScintThick() const {return fPassiveScintThick;}
113 Float_t GetPhiTileSize() const {return fPhiTileSize;}
114 Float_t GetEtaTileSize() const {return fEtaTileSize;}
115 Int_t GetNPhiSuperModule() const {return fNPhiSuperModule;}
116 Int_t GetNPHIdiv() const {return fNPHIdiv ;}
117 Int_t GetNETAdiv() const {return fNETAdiv ;}
118 Int_t GetNCells() const {return fNCells;}
119 Float_t GetLongModuleSize() const {return fLongModuleSize;}
120 Float_t GetTrd1Angle() const {return fTrd1Angle;}
121 Float_t Get2Trd1Dx2() const {return f2Trd1Dx2;}
123 Int_t GetNCellsInSupMod() const {return fNCellsInSupMod;}
124 Int_t GetNCellsInModule() const {return fNCellsInModule; }
125 Int_t GetKey110DEG() const {return fKey110DEG;}
126 Int_t GetILOSS() const {return fILOSS;}
127 Int_t GetIHADR() const {return fIHADR;}
128 // For gamma(Jet) trigger simulations
129 Int_t GetNTRU() const {return fNTRUEta*fNTRUPhi ; }
130 Int_t GetNTRUEta() const {return fNTRUEta ; }
131 Int_t GetNTRUPhi() const {return fNTRUPhi ; }
132 Int_t GetNEtaSubOfTRU() const {return fNEtaSubOfTRU;}
133 Int_t GetNModulesInTRU() const {return fNModulesInTRUEta*fNModulesInTRUPhi; }
134 Int_t GetNModulesInTRUEta() const {return fNModulesInTRUEta ; }
135 Int_t GetNModulesInTRUPhi() const {return fNModulesInTRUPhi ; }
136 Int_t GetAbsTRUNumberFromNumberInSm(const Int_t row, const Int_t col, const Int_t sm);
139 Float_t GetDeltaEta() const {return (fArm1EtaMax-fArm1EtaMin)/ ((Float_t)fNZ);}
140 Float_t GetDeltaPhi() const {return (fArm1PhiMax-fArm1PhiMin)/ ((Float_t)fNPhi);}
141 Int_t GetNTowers() const {return fNPhi * fNZ ;}
143 Double_t GetPhiCenterOfSM(Int_t nsupmod) const;
144 Float_t *GetSuperModulesPars() {return fParSM;}
146 Bool_t GetPhiBoundariesOfSM (Int_t nSupMod, Double_t &phiMin, Double_t &phiMax) const;
147 Bool_t GetPhiBoundariesOfSMGap(Int_t nPhiSec, Double_t &phiMin, Double_t &phiMax) const;
150 virtual Bool_t Impact(const TParticle *) const;
151 void ImpactOnEmcal(TVector3 vtx, Double_t theta, Double_t phi, Int_t & absId, TVector3 & vimpact) const;
152 Bool_t IsInEMCAL(Double_t x, Double_t y, Double_t z) const;
154 ////////////////////////////////////////
155 // May 31, 2006; ALICE numbering scheme:
156 // see ALICE-INT-2003-038: ALICE Coordinate System and Software Numbering Convention
157 // All indexes are stared from zero now.
159 // abs id <-> indexes; Shish-kebab case, only TRD1 now.
160 // EMCAL -> Super Module -> module -> tower(or cell) - logic tree of EMCAL
162 //** Usual name of variable - Dec 18,2006 **
163 // nSupMod - index of super module (SM)
164 // nModule - index of module in SM
165 // nIphi - phi index of tower(cell) in module
166 // nIeta - eta index of tower(cell) in module
169 // iphim - phi index of module in SM
170 // ietam - eta index of module in SM
172 // iphi - phi index of tower(cell) in SM
173 // ieta - eta index of tower(cell) in SM
175 // for a given tower index absId returns eta and phi of gravity center of tower.
176 void EtaPhiFromIndex(Int_t absId, Double_t &eta, Double_t &phi) const;
177 void EtaPhiFromIndex(Int_t absId, Float_t &eta, Float_t &phi) const;
179 // Tranforms Eta-Phi Module index in TRU into Eta-Phi index in Super Module
180 void GetModulePhiEtaIndexInSModuleFromTRUIndex(
181 Int_t itru, Int_t iphitru, Int_t ietatru, Int_t &ietaSM, Int_t &iphiSM) const ;
183 Bool_t GetAbsCellIdFromEtaPhi(Double_t eta,Double_t phi, Int_t &absId) const;
184 Bool_t SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi, Int_t &nSupMod) const;
185 Int_t GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta) const;
186 Bool_t CheckAbsCellId(Int_t absId) const;
187 Bool_t GetCellIndex(Int_t absId, Int_t &nSupMod, Int_t &nModule, Int_t &nIphi,
189 // Local coordinate of Super Module
190 void GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t &iphim,
192 void GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta,
193 Int_t &iphi, Int_t &ieta) const ;
194 Int_t GetSuperModuleNumber(Int_t absId) const;
195 Int_t GetNumberOfModuleInPhiDirection(Int_t nSupMod) const
197 if(fKey110DEG == 1 && nSupMod>=10) return fNPhi/2;
200 // From cell indexes to abs cell id
201 void GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod, Int_t iphi, Int_t ieta,
202 Int_t &iphim, Int_t &ietam, Int_t &nModule) const;
203 Int_t GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const;
205 // Methods for AliEMCALRecPoint - Feb 19, 2006
206 Bool_t RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const;
207 Bool_t RelPosCellInSModule(Int_t absId, Double_t loc[3]) const;
208 Bool_t RelPosCellInSModule(Int_t absId, TVector3 &vloc) const;
209 // Methods for AliEMCALRecPoint with taking into account energy of rec.point - Jul 30. 2007
210 Bool_t RelPosCellInSModule(Int_t absId,Double_t distEff,Double_t &xr,Double_t &yr,
211 Double_t & zr) const;
212 Bool_t RelPosCellInSModule(Int_t absId,Int_t maxAbsId,Double_t distEff,Double_t &xr,
213 Double_t &yr,Double_t &zr) const;
215 ///////////////////////////////
216 //Geometry data member setters
218 void SetNZ(Int_t nz) { fNZ= nz;
219 printf("SetNZ: Number of modules in Z set to %d", fNZ) ; }
220 void SetNPhi(Int_t nphi) { fNPhi= nphi;
221 printf("SetNPhi: Number of modules in Phi set to %d", fNPhi) ; }
222 void SetNTRUEta(Int_t ntru) {fNTRUEta = ntru;
223 printf("SetNTRU: Number of TRUs per SuperModule in Etaset to %d", fNTRUEta) ;}
224 void SetNTRUPhi(Int_t ntru) {fNTRUPhi = ntru;
225 printf("SetNTRU: Number of TRUs per SuperModule in Phi set to %d", fNTRUPhi) ;}
226 void SetSampling(Float_t samp) { fSampling = samp;
227 printf("SetSampling: Sampling factor set to %f", fSampling) ; }
232 Float_t AngleFromEta(Float_t eta) const { // returns theta in radians for a given pseudorapidity
233 return 2.0*TMath::ATan(TMath::Exp(-eta));
235 Float_t ZFromEtaR(Float_t r,Float_t eta) const { // returns z in for a given
236 // pseudorapidity and r=sqrt(x*x+y*y).
237 return r/TMath::Tan(AngleFromEta(eta));
240 //////////////////////////////////////////////////
241 // Obsolete methods to be thrown out when feasible
242 Float_t GetAlFrontThickness() const { return fAlFrontThick;}
243 Float_t GetGap2Active() const {return fGap2Active ;}
244 Float_t GetSteelFrontThickness() const { return fSteelFrontThick;}
245 Float_t GetTrd2AngleY()const {return fTrd2AngleY;}
246 Float_t Get2Trd2Dy2() const {return f2Trd2Dy2;}
247 Float_t GetTubsR() const {return fTubsR;}
248 Float_t GetTubsTurnAngle() const {return fTubsTurnAngle;}
249 Float_t GetIP2ECASection() const { return ( GetIPDistance() + GetAlFrontThickness()
250 + GetGap2Active() ) ; }
251 //////////////////////////////////////////////////
255 // ctor only for internal usage (singleton)
256 AliEMCALGeometry(const Text_t* name, const Text_t* title);
258 void Init(void); // initializes the parameters of EMCAL
259 void CheckAdditionalOptions(); //
260 void DefineSamplingFraction(); // Jun 5, 2006
265 static AliEMCALGeometry * fgGeom; // pointer to the unique instance of the singleton
266 static Bool_t fgInit; // Tells if geometry has been succesfully set up.
267 static const Char_t* fgDefaultGeometryName; // Default name of geometry
269 TString fGeoName; //geometry name
271 TObjArray *fArrayOpts; //! array of geometry options
272 const char *fAdditionalOpts[6]; //! some additional options for the geometry type and name
273 int fNAdditionalOpts; //! size of additional options parameter
275 Float_t fECPbRadThickness; // cm, Thickness of the Pb radiators
276 Float_t fECScintThick; // cm, Thickness of the scintillators
277 Int_t fNECLayers; // number of scintillator layers
279 Float_t fArm1PhiMin; // Minimum angular position of EMCAL in Phi (degrees)
280 Float_t fArm1PhiMax; // Maximum angular position of EMCAL in Phi (degrees)
281 Float_t fArm1EtaMin; // Minimum pseudorapidity position of EMCAL in Eta
282 Float_t fArm1EtaMax; // Maximum pseudorapidity position of EMCAL in Eta
284 // Geometry Parameters
285 Float_t fEnvelop[3]; // the GEANT TUB for the detector
286 Float_t fIPDistance; // Radial Distance of the inner surface of the EMCAL
287 Float_t fShellThickness; // Total thickness in (x,y) direction
288 Float_t fZLength; // Total length in z direction
289 Int_t fNZ; // Number of Towers in the Z direction
290 Int_t fNPhi; // Number of Towers in the PHI direction
291 Float_t fSampling; // Sampling factor
293 // Shish-kebab option - 23-aug-04 by PAI; COMPACT, TWIST, TRD1 and TRD2
294 Int_t fNumberOfSuperModules; // default is 12 = 6 * 2
295 Float_t fFrontSteelStrip; // 13-may-05
296 Float_t fLateralSteelStrip; // 13-may-05
297 Float_t fPassiveScintThick; // 13-may-05
298 Float_t fPhiModuleSize; // Phi -> X
299 Float_t fEtaModuleSize; // Eta -> Y
300 Float_t fPhiTileSize; // Size of phi tile
301 Float_t fEtaTileSize; // Size of eta tile
302 Float_t fLongModuleSize; // Size of long module
303 Int_t fNPhiSuperModule; // 6 - number supermodule in phi direction
304 Int_t fNPHIdiv; // number phi divizion of module
305 Int_t fNETAdiv; // number eta divizion of module
307 Int_t fNCells; // number of cells in calo
308 Int_t fNCellsInSupMod; // number cell in super module
309 Int_t fNCellsInModule; // number cell in module)
311 Int_t fNTRUEta ; // Number of TRUs per module in eta
312 Int_t fNTRUPhi ; // Number of TRUs per module in phi
313 Int_t fNModulesInTRUEta; // Number of modules per TRU in eta
314 Int_t fNModulesInTRUPhi; // Number of modules per TRU in phi
315 Int_t fNEtaSubOfTRU; // Number of eta (z) subregiohi
317 // TRD1 options - 30-sep-04
318 Float_t fTrd1Angle; // angle in x-z plane (in degree)
319 Float_t f2Trd1Dx2; // 2*dx2 for TRD1
320 Float_t fPhiGapForSM; // Gap betweeen supermodules in phi direction
321 Int_t fKey110DEG; // for calculation abs cell id; 19-oct-05
322 TArrayD fPhiBoundariesOfSM; // phi boundaries of SM in rad; size is fNumberOfSuperModules;
323 TArrayD fPhiCentersOfSM; // phi of centers of SMl size is fNumberOfSuperModules/2
324 Float_t fEtaMaxOfTRD1; // max eta in case of TRD1 geometry (see AliEMCALShishKebabTrd1Module)
325 // Local Coordinates of SM
326 TArrayD fCentersOfCellsEtaDir; // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm)
327 TArrayD fCentersOfCellsXDir; // size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm)
328 TArrayD fCentersOfCellsPhiDir; // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
330 TArrayD fEtaCentersOfCells; // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position;
331 TArrayD fPhiCentersOfCells; // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.)
332 // Move from AliEMCALv0 - Feb 19, 2006
333 TList *fShishKebabTrd1Modules; //! list of modules
334 // Local coordinates of SM for TRD1
335 Float_t fParSM[3]; // SM sizes as in GEANT (TRD1)
337 Int_t fILOSS; // Options for Geant (MIP business) - will call in AliEMCAL
338 Int_t fIHADR; // Options for Geant (MIP business) - will call in AliEMCAL
340 ////////////////////////////////////////////////////////////
341 //Obsolete member data that will be thrown out when feasible
343 Float_t fAlFrontThick; // Thickness of the front Al face of the support box
344 Float_t fGap2Active; // Gap between the envelop and the active material
345 Float_t fSteelFrontThick; // Thickness of the front stell face of the support box - 9-sep-04
346 // TRD2 options - 27-jan-07
347 Float_t fTrd2AngleY; // angle in y-z plane (in degree)
348 Float_t f2Trd2Dy2; // 2*dy2 for TRD2
349 Float_t fEmptySpace; // 2mm om fred drawing
350 // Super module as TUBS
351 Float_t fTubsR; // radius of tubs
352 Float_t fTubsTurnAngle; // turn angle of tubs in degree
354 ///////////////////////////////////////////////////////////
356 ClassDef(AliEMCALGeometry, 13) // EMCAL geometry class
359 #endif // AliEMCALGEOMETRY_H