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