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