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