]>
Commit | Line | Data |
---|---|---|
0c5b726e | 1 | #ifndef ALIEMCALGEOUTILS_H |
2 | #define ALIEMCALGEOUTILS_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | //_________________________________________________________________________ | |
7 | // class for geometry transformations in EMCAL | |
8 | // this class contains AliRoot-independent transformations, | |
9 | // AliRoot part is in AliEMCALGeometry | |
10 | // | |
11 | //*-- Author: Magali Estienne | |
12 | ||
13 | // --- ROOT system --- | |
14 | #include <TNamed.h> | |
15 | #include <TMath.h> | |
16 | #include <TArrayD.h> | |
17 | #include <TVector3.h> | |
fa911ba9 | 18 | #include <TGeoMatrix.h> |
0c5b726e | 19 | class TBrowser ; |
20 | class TParticle ; | |
0c5b726e | 21 | |
22 | // --- AliRoot header files --- | |
23 | #include "AliEMCALEMCGeometry.h" | |
24 | class AliEMCALShishKebabTrd1Module; | |
25 | #include "AliLog.h" | |
26 | ||
27 | class AliEMCALGeoUtils : public TNamed { | |
28 | ||
29 | public: | |
30 | ||
31 | AliEMCALGeoUtils(); | |
32 | AliEMCALGeoUtils(const Text_t* name, const Text_t* title=""); | |
33 | AliEMCALGeoUtils(const AliEMCALGeoUtils & geom); | |
34 | ||
35 | virtual ~AliEMCALGeoUtils(void); | |
36 | AliEMCALGeoUtils & operator = (const AliEMCALGeoUtils & rvalue); | |
37 | ||
38 | ///////////// | |
39 | // TRD1 stuff | |
40 | void CreateListOfTrd1Modules(); | |
41 | TList *GetShishKebabTrd1Modules() const {return fShishKebabTrd1Modules;} | |
42 | AliEMCALShishKebabTrd1Module *GetShishKebabModule(Int_t neta) const; | |
43 | ||
44 | void PrintGeometry(); | |
45 | void PrintCellIndexes(Int_t absId=0, int pri=0, const char *tit="") const ; //*MENU* | |
46 | virtual void Browse(TBrowser* b); | |
47 | virtual Bool_t IsFolder() const; | |
48 | ||
49 | virtual Bool_t Impact(const TParticle *) const; | |
50 | void ImpactOnEmcal(TVector3 vtx, Double_t theta, Double_t phi, Int_t & absId, TVector3 & vimpact) const; | |
51 | Bool_t IsInEMCAL(Double_t x, Double_t y, Double_t z) const; | |
52 | ||
53 | ||
54 | AliEMCALEMCGeometry* GetEMCGeometry() const { return fEMCGeometry;} | |
55 | ||
56 | ////////////////////////// | |
57 | // Global geometry methods | |
58 | // | |
59 | void GetGlobal(const Double_t *loc, Double_t *glob, int ind) const; | |
60 | void GetGlobal(const TVector3 &vloc, TVector3 &vglob, int ind) const; | |
61 | void GetGlobal(Int_t absId, Double_t glob[3]) const; | |
62 | void GetGlobal(Int_t absId, TVector3 &vglob) const; | |
63 | ||
64 | //////////////////////////////////////// | |
65 | // May 31, 2006; ALICE numbering scheme: | |
66 | // see ALICE-INT-2003-038: ALICE Coordinate System and Software Numbering Convention | |
67 | // All indexes are stared from zero now. | |
68 | // | |
69 | // abs id <-> indexes; Shish-kebab case, only TRD1 now. | |
70 | // EMCAL -> Super Module -> module -> tower(or cell) - logic tree of EMCAL | |
71 | // | |
72 | //** Usual name of variable - Dec 18,2006 ** | |
73 | // nSupMod - index of super module (SM) | |
74 | // nModule - index of module in SM | |
75 | // nIphi - phi index of tower(cell) in module | |
76 | // nIeta - eta index of tower(cell) in module | |
77 | // | |
78 | // Inside SM | |
79 | // iphim - phi index of module in SM | |
80 | // ietam - eta index of module in SM | |
81 | // | |
82 | // iphi - phi index of tower(cell) in SM | |
83 | // ieta - eta index of tower(cell) in SM | |
84 | // | |
85 | // for a given tower index absId returns eta and phi of gravity center of tower. | |
86 | void EtaPhiFromIndex(Int_t absId, Double_t &eta, Double_t &phi) const; | |
87 | void EtaPhiFromIndex(Int_t absId, Float_t &eta, Float_t &phi) const; | |
88 | ||
89 | Bool_t GetAbsCellIdFromEtaPhi(Double_t eta,Double_t phi, Int_t &absId) const; | |
90 | Bool_t SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi, Int_t &nSupMod) const; | |
91 | Int_t GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta) const; | |
92 | Bool_t CheckAbsCellId(Int_t absId) const; | |
93 | Bool_t GetCellIndex(Int_t absId, Int_t &nSupMod, Int_t &nModule, Int_t &nIphi, | |
94 | Int_t &nIeta) const; | |
95 | // Local coordinate of Super Module | |
96 | void GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t &iphim, | |
97 | Int_t &ietam) const; | |
98 | void GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta, | |
99 | Int_t &iphi, Int_t &ieta) const ; | |
100 | Int_t GetSuperModuleNumber(Int_t absId) const; | |
101 | Int_t GetNumberOfModuleInPhiDirection(Int_t nSupMod) const | |
102 | { | |
103 | if(fKey110DEG == 1 && nSupMod>=10) return fNPhi/2; | |
104 | else return fNPhi; | |
105 | } | |
106 | // From cell indexes to abs cell id | |
107 | void GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod, Int_t iphi, Int_t ieta, | |
108 | Int_t &iphim, Int_t &ietam, Int_t &nModule) const; | |
109 | Int_t GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const; | |
110 | ||
111 | // Methods for AliEMCALRecPoint - Feb 19, 2006 | |
112 | Bool_t RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const; | |
113 | Bool_t RelPosCellInSModule(Int_t absId, Double_t loc[3]) const; | |
114 | Bool_t RelPosCellInSModule(Int_t absId, TVector3 &vloc) const; | |
115 | ||
116 | // Local Coordinates of SM | |
117 | TArrayD GetCentersOfCellsEtaDir() const {return fCentersOfCellsEtaDir;} // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm) | |
118 | TArrayD GetCentersOfCellsXDir() const {return fCentersOfCellsXDir;} // size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm) | |
119 | TArrayD GetCentersOfCellsPhiDir() const {return fCentersOfCellsPhiDir;} // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm) | |
120 | // | |
121 | TArrayD GetEtaCentersOfCells() const {return fEtaCentersOfCells;} // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position; | |
122 | TArrayD GetPhiCentersOfCells() const {return fPhiCentersOfCells;} // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.) | |
123 | ||
124 | // | |
125 | // Tranforms Eta-Phi Module index in TRU into Eta-Phi index in Super Module | |
126 | void GetModulePhiEtaIndexInSModuleFromTRUIndex( | |
127 | Int_t itru, Int_t iphitru, Int_t ietatru, Int_t &ietaSM, Int_t &iphiSM) const; | |
128 | Int_t GetAbsTRUNumberFromNumberInSm(const Int_t row, const Int_t col, const Int_t sm) const ; | |
916f1e76 | 129 | Bool_t GetAbsFastORIndexFromTRU(const Int_t iTRU, const Int_t iADC, Int_t& id) const; |
130 | Bool_t GetAbsFastORIndexFromPositionInTRU(const Int_t iTRU, const Int_t iEta, const Int_t iPhi, Int_t& id) const; | |
131 | Bool_t GetTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iADC) const; | |
132 | Bool_t GetPositionInTRUFromAbsFastORIndex(const Int_t id, Int_t& iTRU, Int_t& iEta, Int_t& iPhi) const; | |
133 | Bool_t GetPositionInSMFromAbsFastORIndex(const Int_t id, Int_t& iSM, Int_t& iEta, Int_t& iPhi) const; | |
0c5b726e | 134 | |
135 | ||
136 | ||
137 | /////////////////// | |
138 | // useful utilities | |
139 | // | |
140 | Float_t AngleFromEta(Float_t eta) const { // returns theta in radians for a given pseudorapidity | |
141 | return 2.0*TMath::ATan(TMath::Exp(-eta)); | |
142 | } | |
143 | Float_t ZFromEtaR(Float_t r,Float_t eta) const { // returns z in for a given | |
144 | // pseudorapidity and r=sqrt(x*x+y*y). | |
145 | return r/TMath::Tan(AngleFromEta(eta)); | |
146 | } | |
147 | ||
148 | //Method to set shift-rotational matrixes from ESDHeader | |
149 | void SetMisalMatrix(const TGeoHMatrix * m, Int_t smod) { | |
fa911ba9 | 150 | if (smod >= 0 && smod < fEMCGeometry->GetNumberOfSuperModules()){ |
151 | if(!fkSModuleMatrix[smod]) fkSModuleMatrix[smod] = new TGeoHMatrix(*m) ; //Set only if not set yet | |
152 | } | |
0c5b726e | 153 | else AliFatal(Form("Wrong supermodule index -> %d",smod)); |
154 | } | |
155 | ||
156 | protected: | |
157 | //Returns shift-rotational matrixes for different volumes | |
158 | const TGeoHMatrix * GetMatrixForSuperModule(Int_t smod)const ; | |
159 | ||
160 | protected: | |
161 | ||
162 | // ctor only for internal usage (singleton) | |
163 | // AliEMCALGeoUtils(const Text_t* name, const Text_t* title); | |
164 | AliEMCALEMCGeometry *fEMCGeometry; // Geometry object for Electromagnetic calorimeter | |
165 | ||
166 | void Init(void); // initializes the parameters of EMCAL | |
167 | ||
168 | TString fGeoName; //geometry name | |
169 | ||
170 | Int_t fKey110DEG; // for calculation abs cell id; 19-oct-05 | |
171 | Int_t fNCellsInSupMod; // number cell in super module | |
172 | Int_t fNETAdiv; // number eta divizion of module | |
173 | Int_t fNPHIdiv; // number phi divizion of module | |
174 | Int_t fNCellsInModule; // number cell in module | |
175 | TArrayD fPhiBoundariesOfSM; // phi boundaries of SM in rad; size is fNumberOfSuperModules; | |
176 | TArrayD fPhiCentersOfSM; // phi of centers of SMl size is fNumberOfSuperModules/2 | |
177 | // Local Coordinates of SM | |
178 | TArrayD fPhiCentersOfCells; // [fNPhi*fNPHIdiv] from center of SM (-10. < phi < +10.) | |
179 | TArrayD fCentersOfCellsEtaDir; // size fNEta*fNETAdiv (for TRD1 only) (eta or z in SM, in cm) | |
180 | TArrayD fCentersOfCellsPhiDir; // size fNPhi*fNPHIdiv (for TRD1 only) (phi or y in SM, in cm) | |
181 | TArrayD fEtaCentersOfCells; // [fNEta*fNETAdiv*fNPhi*fNPHIdiv], positive direction (eta>0); eta depend from phi position; | |
182 | Int_t fNCells; // number of cells in calo | |
183 | Int_t fNPhi; // Number of Towers in the PHI direction | |
184 | TArrayD fCentersOfCellsXDir; // size fNEta*fNETAdiv (for TRD1 only) ( x in SM, in cm) | |
185 | Float_t fEnvelop[3]; // the GEANT TUB for the detector | |
186 | Float_t fArm1EtaMin; // Minimum pseudorapidity position of EMCAL in Eta | |
187 | Float_t fArm1EtaMax; // Maximum pseudorapidity position of EMCAL in Eta | |
188 | Float_t fArm1PhiMin; // Minimum angular position of EMCAL in Phi (degrees) | |
189 | Float_t fArm1PhiMax; // Maximum angular position of EMCAL in Phi (degrees) | |
190 | Float_t fEtaMaxOfTRD1; // Max eta in case of TRD1 geometry (see AliEMCALShishKebabTrd1Module) | |
191 | TList *fShishKebabTrd1Modules; //! list of modules | |
192 | Float_t *fParSM; // SM sizes as in GEANT (TRD1) | |
193 | Float_t fPhiModuleSize; // Phi -> X | |
194 | Float_t fEtaModuleSize; // Eta -> Y | |
195 | Float_t fPhiTileSize; // Size of phi tile | |
196 | Float_t fEtaTileSize; // Size of eta tile | |
197 | Int_t fNZ; // Number of Towers in the Z direction | |
198 | Float_t fIPDistance; // Radial Distance of the inner surface of the EMCAL | |
199 | Float_t fLongModuleSize; // Size of long module | |
200 | // Geometry Parameters | |
201 | Float_t fShellThickness; // Total thickness in (x,y) direction | |
202 | Float_t fZLength; // Total length in z direction | |
203 | Float_t fSampling; // Sampling factor | |
204 | ||
fa911ba9 | 205 | TGeoHMatrix* fkSModuleMatrix[12] ; //Orientations of EMCAL super modules |
0c5b726e | 206 | |
207 | ||
208 | ClassDef(AliEMCALGeoUtils,1) // EMCAL geometry class | |
209 | ||
210 | } ; | |
211 | ||
212 | #endif // AliEMCALGEOUTILS_H |