Modification for new Eve (Marian)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGeometry.h
CommitLineData
2012850d 1#ifndef ALIEMCALGEOMETRY_H
2#define ALIEMCALGEOMETRY_H
1963b290 3/* Copyright(c) 1998-2004, ALICE Experiment at CERN, All rights reserved. *
2012850d 4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8//_________________________________________________________________________
9// Geometry class for EMCAL : singleton
b13bbe81 10// EMCAL consists of a layers of scintillator, and lead.
2012850d 11//
b13bbe81 12//*-- Author: Sahal Yacoob (LBL / UCT)
13//*-- and : Yves Schutz (Subatech)
c63c3c5d 14//*-- and : Aleksei Pavlinov (WSU) - shashlyk staff
f0377b23 15//*-- and : Gustavo Conesa: Add TRU mapping. TRU parameters still not fixed.
2012850d 16
17// --- ROOT system ---
d64c959b 18class TString ;
c63c3c5d 19class TObjArray;
e52475ed 20class TVector3;
21class TGeoMatrix;
cad18b88 22class TParticle ;
f0377b23 23class TClonesArray ;
37890aaf 24#include <TMath.h>
25#include <TArrayD.h>
26class assert;
27class Riostream;
28class TClonesArray;
29class TGeoNode;
30class TGeoManager;
2012850d 31
2012850d 32// --- AliRoot header files ---
37890aaf 33class AliEMCALGeometry;
34class AliEMCALShishKebabTrd1Module;
35class AliEMCALRecPoint;
36class AliEMCALDigit;
090026bf 37
2012850d 38#include "AliGeometry.h"
39
2012850d 40class AliEMCALGeometry : public AliGeometry {
a97849a9 41public:
0a4cb131 42 AliEMCALGeometry(const AliEMCALGeometry& geom);
d434833b 43 virtual ~AliEMCALGeometry(void);
44
a97849a9 45 static AliEMCALGeometry * GetInstance(const Text_t* name,
46 const Text_t* title="") ;
89557f6d 47 static AliEMCALGeometry * GetInstance();
9cff4509 48 AliEMCALGeometry & operator = (const AliEMCALGeometry & /*rvalue*/) {
a97849a9 49 // assignement operator requested by coding convention but not needed
fdebddeb 50 Fatal("operator =", "not implemented");
9cff4509 51 return *this;
a97849a9 52 };
937d0661 53
54 AliEMCALGeometry(); // default ctor only for internal usage (singleton)
55
56 //////////
57 // General
58 //
59 Bool_t IsInitialized(void) const { return fgInit ; }
60 static Char_t* GetDefaultGeometryName() {return fgDefaultGeometryName;}
1d46d1f6 61 void PrintGeometry(); //*MENU*
62 void PrintCellIndexes(Int_t absId=0, int pri=0, char *tit=""); //*MENU*
6f377f0c 63 virtual void Browse(TBrowser* b);
1d46d1f6 64 virtual Bool_t IsFolder() const;
356fd0a9 65
937d0661 66 //////////////////////////
67 // Global geometry methods
68 //
14e75ea7 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;
21cf2b24 72 void GetGlobal(Int_t absId, TVector3 &vglob) const;
937d0661 73 //
e52475ed 74 virtual void GetGlobal(const AliRecPoint *rp, TVector3 &vglob) const;
937d0661 75 virtual void GetGlobal(const AliRecPoint *rp, TVector3 & gpos, TMatrixF & /* gmat */)
76 const {GetGlobal(rp,gpos); }
9aa6a5f6 77 virtual void GetGlobalEMCAL(const AliEMCALRecPoint *rp, TVector3 &vglob) const;
937d0661 78 virtual void GetGlobalEMCAL(const AliEMCALRecPoint *rp, TVector3 & gpos, TMatrixF & /* gmat */)
79 const {GetGlobalEMCAL(rp,gpos); }
ab37d09c 80
937d0661 81 /////////////
82 // TRD1 stuff
83 void CreateListOfTrd1Modules();
84 TList *GetShishKebabTrd1Modules() const {return fShishKebabTrd1Modules;}
85 AliEMCALShishKebabTrd1Module *GetShishKebabModule(Int_t neta) const;
86
87 //////////////////////////////////////
c63c3c5d 88 // Return EMCAL geometrical parameters
937d0661 89 //
e52475ed 90 Char_t* GetNameOfEMCALEnvelope() const {return "XEN1";}
09884213 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;}
09884213 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 ; }
09884213 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 ;}
09884213 103 Float_t GetECPbRadThick()const {return fECPbRadThickness;}
104 Float_t GetECScintThick() const {return fECScintThick;}
105 Float_t GetSampling() const {return fSampling ; }
e52475ed 106 Int_t GetNumberOfSuperModules() const {return fNumberOfSuperModules;}
107 Float_t GetfPhiGapForSuperModules() const {return fPhiGapForSM;}
1963b290 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;}
937d0661 119 Float_t GetLongModuleSize() const {return fLongModuleSize;}
120 Float_t GetTrd1Angle() const {return fTrd1Angle;}
121 Float_t Get2Trd1Dx2() const {return f2Trd1Dx2;}
85c25c2e 122 // --
937d0661 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;}
85c25c2e 128 // For gamma(Jet) trigger simulations
937d0661 129 Int_t GetNTRU() const {return fNTRUEta*fNTRUPhi ; }
85c25c2e 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);
137
138 // --
937d0661 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 ;}
142 //
9aa6a5f6 143 Double_t GetPhiCenterOfSM(Int_t nsupmod) const;
e52475ed 144 Float_t *GetSuperModulesPars() {return fParSM;}
937d0661 145 //
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;
148 //
149 virtual Bool_t Impact(const TParticle *) const {return kTRUE;}
150 Bool_t IsInEMCAL(Double_t x, Double_t y, Double_t z) const;
b8b0f8c2 151
937d0661 152 ////////////////////////////////////////
dc7da436 153 // May 31, 2006; ALICE numbering scheme:
154 // see ALICE-INT-2003-038: ALICE Coordinate System and Software Numbering Convention
155 // All indexes are stared from zero now.
2bb3725c 156 //
157 // abs id <-> indexes; Shish-kebab case, only TRD1 now.
158 // EMCAL -> Super Module -> module -> tower(or cell) - logic tree of EMCAL
159 //
160 //** Usual name of variable - Dec 18,2006 **
161 // nSupMod - index of super module (SM)
162 // nModule - index of module in SM
163 // nIphi - phi index of tower(cell) in module
164 // nIeta - eta index of tower(cell) in module
165 //
166 // Inside SM
167 // iphim - phi index of module in SM
168 // ietam - eta index of module in SM
169 //
170 // iphi - phi index of tower(cell) in SM
171 // ieta - eta index of tower(cell) in SM
937d0661 172 //
173 // for a given tower index absId returns eta and phi of gravity center of tower.
174 void EtaPhiFromIndex(Int_t absId, Double_t &eta, Double_t &phi) const;
175 void EtaPhiFromIndex(Int_t absId, Float_t &eta, Float_t &phi) const;
176 //
85c25c2e 177 // Tranforms Eta-Phi Module index in TRU into Eta-Phi index in Super Module
178 void GetModulePhiEtaIndexInSModuleFromTRUIndex(
179 Int_t itru, Int_t iphitru, Int_t ietatru, Int_t &ietaSM, Int_t &iphiSM) const ;
180
937d0661 181 Bool_t GetAbsCellIdFromEtaPhi(Double_t eta,Double_t phi, Int_t &absId) const;
182 Bool_t SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi, Int_t &nSupMod) const;
2bb3725c 183 Int_t GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta) const;
dc7da436 184 Bool_t CheckAbsCellId(Int_t absId) const;
937d0661 185 Bool_t GetCellIndex(Int_t absId, Int_t &nSupMod, Int_t &nModule, Int_t &nIphi,
186 Int_t &nIeta) const;
dc7da436 187 // Local coordinate of Super Module
937d0661 188 void GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t &iphim,
189 Int_t &ietam) const;
2bb3725c 190 void GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta,
e52475ed 191 Int_t &iphi, Int_t &ieta) const ;
1d46d1f6 192 Int_t GetSuperModuleNumber(Int_t absId) const;
193 Int_t GetNumberOfModuleInPhiDirection(Int_t nSupMod) const
194 {
1d46d1f6 195 if(fKey110DEG == 1 && nSupMod>=10) return fNPhi/2;
196 else return fNPhi;
197 }
198 // From cell indexes to abs cell id
199 void GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod, Int_t iphi, Int_t ieta,
937d0661 200 Int_t &iphim, Int_t &ietam, Int_t &nModule) const;
1d46d1f6 201 Int_t GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const;
937d0661 202
14e75ea7 203 // Methods for AliEMCALRecPoint - Feb 19, 2006
204 Bool_t RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const;
205 Bool_t RelPosCellInSModule(Int_t absId, Double_t loc[3]) const;
206 Bool_t RelPosCellInSModule(Int_t absId, TVector3 &vloc) const;
1ae500a2 207 // Methods for AliEMCALRecPoint with taking into account energy of rec.point - Jul 30. 2007
937d0661 208 Bool_t RelPosCellInSModule(Int_t absId,Double_t distEff,Double_t &xr,Double_t &yr,
209 Double_t & zr) const;
210 Bool_t RelPosCellInSModule(Int_t absId,Int_t maxAbsId,Double_t distEff,Double_t &xr,
211 Double_t &yr,Double_t &zr) const;
1ae500a2 212
937d0661 213 ///////////////////////////////
214 //Geometry data member setters
215 //
216 void SetNZ(Int_t nz) { fNZ= nz;
217 printf("SetNZ: Number of modules in Z set to %d", fNZ) ; }
218 void SetNPhi(Int_t nphi) { fNPhi= nphi;
219 printf("SetNPhi: Number of modules in Phi set to %d", fNPhi) ; }
220 void SetNTRUEta(Int_t ntru) {fNTRUEta = ntru;
221 printf("SetNTRU: Number of TRUs per SuperModule in Etaset to %d", fNTRUEta) ;}
222 void SetNTRUPhi(Int_t ntru) {fNTRUPhi = ntru;
223 printf("SetNTRU: Number of TRUs per SuperModule in Phi set to %d", fNTRUPhi) ;}
224 void SetSampling(Float_t samp) { fSampling = samp;
225 printf("SetSampling: Sampling factor set to %f", fSampling) ; }
226
227 ///////////////////
228 // useful utilities
229 //
e52475ed 230 Float_t AngleFromEta(Float_t eta) const { // returns theta in radians for a given pseudorapidity
a97849a9 231 return 2.0*TMath::ATan(TMath::Exp(-eta));
232 }
e52475ed 233 Float_t ZFromEtaR(Float_t r,Float_t eta) const { // returns z in for a given
a97849a9 234 // pseudorapidity and r=sqrt(x*x+y*y).
235 return r/TMath::Tan(AngleFromEta(eta));
236 }
f0377b23 237
937d0661 238 //////////////////////////////////////////////////
239 // Obsolete methods to be thrown out when feasible
240 Float_t GetAlFrontThickness() const { return fAlFrontThick;}
241 Float_t GetGap2Active() const {return fGap2Active ;}
242 Float_t GetSteelFrontThickness() const { return fSteelFrontThick;}
243 Float_t GetTrd2AngleY()const {return fTrd2AngleY;}
244 Float_t Get2Trd2Dy2() const {return f2Trd2Dy2;}
245 Float_t GetTubsR() const {return fTubsR;}
246 Float_t GetTubsTurnAngle() const {return fTubsTurnAngle;}
247 Float_t GetIP2ECASection() const { return ( GetIPDistance() + GetAlFrontThickness()
248 + GetGap2Active() ) ; }
249 //////////////////////////////////////////////////
d434833b 250
a97849a9 251protected:
937d0661 252
253 // ctor only for internal usage (singleton)
254 AliEMCALGeometry(const Text_t* name, const Text_t* title);
d434833b 255
fdebddeb 256 void Init(void); // initializes the parameters of EMCAL
25b033cf 257 void CheckAdditionalOptions(); //
258 void DefineSamplingFraction(); // Jun 5, 2006
a97849a9 259
260private:
937d0661 261
262 //Member data
fdebddeb 263 static AliEMCALGeometry * fgGeom; // pointer to the unique instance of the singleton
89557f6d 264 static Bool_t fgInit; // Tells if geometry has been succesfully set up.
265 static Char_t* fgDefaultGeometryName; // Default name of geometry
fc575e27 266
267 TString fGeoName; //geometry name
d434833b 268
c63c3c5d 269 TObjArray *fArrayOpts; //! array of geometry options
937d0661 270 char *fAdditionalOpts[6]; //! some additional options for the geometry type and name
271 int fNAdditionalOpts; //! size of additional options parameter
c63c3c5d 272
fdebddeb 273 Float_t fECPbRadThickness; // cm, Thickness of the Pb radiators
274 Float_t fECScintThick; // cm, Thickness of the scintillators
275 Int_t fNECLayers; // number of scintillator layers
395c7ba2 276
fdebddeb 277 Float_t fArm1PhiMin; // Minimum angular position of EMCAL in Phi (degrees)
278 Float_t fArm1PhiMax; // Maximum angular position of EMCAL in Phi (degrees)
279 Float_t fArm1EtaMin; // Minimum pseudorapidity position of EMCAL in Eta
280 Float_t fArm1EtaMax; // Maximum pseudorapidity position of EMCAL in Eta
a97849a9 281
fdebddeb 282 // Geometry Parameters
283 Float_t fEnvelop[3]; // the GEANT TUB for the detector
284 Float_t fIPDistance; // Radial Distance of the inner surface of the EMCAL
285 Float_t fShellThickness; // Total thickness in (x,y) direction
286 Float_t fZLength; // Total length in z direction
fdebddeb 287 Int_t fNZ; // Number of Towers in the Z direction
1963b290 288 Int_t fNPhi; // Number of Towers in the PHI direction
fdebddeb 289 Float_t fSampling; // Sampling factor
1963b290 290
291 // Shish-kebab option - 23-aug-04 by PAI; COMPACT, TWIST, TRD1 and TRD2
292 Int_t fNumberOfSuperModules; // default is 12 = 6 * 2
1963b290 293 Float_t fFrontSteelStrip; // 13-may-05
294 Float_t fLateralSteelStrip; // 13-may-05
295 Float_t fPassiveScintThick; // 13-may-05
296 Float_t fPhiModuleSize; // Phi -> X
297 Float_t fEtaModuleSize; // Eta -> Y
fc575e27 298 Float_t fPhiTileSize; // Size of phi tile
299 Float_t fEtaTileSize; // Size of eta tile
300 Float_t fLongModuleSize; // Size of long module
1963b290 301 Int_t fNPhiSuperModule; // 6 - number supermodule in phi direction
d87bd045 302 Int_t fNPHIdiv; // number phi divizion of module
303 Int_t fNETAdiv; // number eta divizion of module
1963b290 304 //
305 Int_t fNCells; // number of cells in calo
306 Int_t fNCellsInSupMod; // number cell in super module
2bb3725c 307 Int_t fNCellsInModule; // number cell in module)
f0377b23 308 //TRU parameters
9946f2fe 309 Int_t fNTRUEta ; // Number of TRUs per module in eta
310 Int_t fNTRUPhi ; // Number of TRUs per module in phi
85c25c2e 311 Int_t fNModulesInTRUEta; // Number of modules per TRU in eta
312 Int_t fNModulesInTRUPhi; // Number of modules per TRU in phi
313 Int_t fNEtaSubOfTRU; // Number of eta (z) subregiohi
9946f2fe 314
1963b290 315 // TRD1 options - 30-sep-04
316 Float_t fTrd1Angle; // angle in x-z plane (in degree)
317 Float_t f2Trd1Dx2; // 2*dx2 for TRD1
905263da 318 Float_t fPhiGapForSM; // Gap betweeen supermodules in phi direction
d87bd045 319 Int_t fKey110DEG; // for calculation abs cell id; 19-oct-05
1d46d1f6 320 TArrayD fPhiBoundariesOfSM; // phi boundaries of SM in rad; size is fNumberOfSuperModules;
321 TArrayD fPhiCentersOfSM; // phi of centers of SMl size is fNumberOfSuperModules/2
322 Float_t fEtaMaxOfTRD1; // max eta in case of TRD1 geometry (see AliEMCALShishKebabTrd1Module)
e52475ed 323 // Local Coordinates of SM
1d46d1f6 324 TArrayD fCentersOfCellsEtaDir; // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm)
325 TArrayD fCentersOfCellsXDir; // size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm)
326 TArrayD fCentersOfCellsPhiDir; // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm)
327 //
328 TArrayD fEtaCentersOfCells; // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position;
329 TArrayD fPhiCentersOfCells; // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.)
e52475ed 330 // Move from AliEMCALv0 - Feb 19, 2006
331 TList *fShishKebabTrd1Modules; //! list of modules
332 // Local coordinates of SM for TRD1
333 Float_t fParSM[3]; // SM sizes as in GEANT (TRD1)
1963b290 334
37890aaf 335 Int_t fILOSS; // Options for Geant (MIP business) - will call in AliEMCAL
336 Int_t fIHADR; // Options for Geant (MIP business) - will call in AliEMCAL
fc575e27 337
937d0661 338 ////////////////////////////////////////////////////////////
339 //Obsolete member data that will be thrown out when feasible
340 //
341 Float_t fAlFrontThick; // Thickness of the front Al face of the support box
342 Float_t fGap2Active; // Gap between the envelop and the active material
343 Float_t fSteelFrontThick; // Thickness of the front stell face of the support box - 9-sep-04
344 // TRD2 options - 27-jan-07
345 Float_t fTrd2AngleY; // angle in y-z plane (in degree)
346 Float_t f2Trd2Dy2; // 2*dy2 for TRD2
347 Float_t fEmptySpace; // 2mm om fred drawing
348 // Super module as TUBS
349 Float_t fTubsR; // radius of tubs
350 Float_t fTubsTurnAngle; // turn angle of tubs in degree
351
352 ///////////////////////////////////////////////////////////
353
b8b0f8c2 354 ClassDef(AliEMCALGeometry, 13) // EMCAL geometry class
9946f2fe 355};
2012850d 356
357#endif // AliEMCALGEOMETRY_H