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