]>
Commit | Line | Data |
---|---|---|
2012850d | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$*/ | |
17 | ||
18 | //_________________________________________________________________________ | |
19 | // Geometry class for EMCAL : singleton | |
b13bbe81 | 20 | // EMCAL consists of layers of scintillator and lead |
ffa6d63b | 21 | // Places the the Barrel Geometry of The EMCAL at Midrapidity |
22 | // between 0 and 120 degrees of Phi and | |
23 | // -0.7 to 0.7 in eta | |
24 | // Number of Modules and Layers may be controlled by | |
25 | // the name of the instance defined | |
b13bbe81 | 26 | //*-- Author: Sahal Yacoob (LBL / UCT) |
27 | // and : Yves Schutz (SUBATECH) | |
28 | // and : Jennifer Klay (LBL) | |
1963b290 | 29 | // SHASHLYK : Aleksei Pavlinov (WSU) |
2012850d | 30 | |
2012850d | 31 | // --- AliRoot header files --- |
ca8f5bd0 | 32 | #include <TMath.h> |
116cbefd | 33 | #include <TVector3.h> |
173558f2 | 34 | |
ca8f5bd0 | 35 | // -- ALICE Headers. |
d64c959b | 36 | //#include "AliConst.h" |
173558f2 | 37 | |
ca8f5bd0 | 38 | // --- EMCAL headers |
39 | #include "AliEMCALGeometry.h" | |
2012850d | 40 | |
925e6570 | 41 | ClassImp(AliEMCALGeometry) |
2012850d | 42 | |
b13bbe81 | 43 | AliEMCALGeometry *AliEMCALGeometry::fgGeom = 0; |
44 | Bool_t AliEMCALGeometry::fgInit = kFALSE; | |
1963b290 | 45 | TString name; // contains name of geometry |
2012850d | 46 | |
b13bbe81 | 47 | //______________________________________________________________________ |
48 | AliEMCALGeometry::~AliEMCALGeometry(void){ | |
49 | // dtor | |
2012850d | 50 | } |
b13bbe81 | 51 | |
395c7ba2 | 52 | //______________________________________________________________________ |
09884213 | 53 | Bool_t AliEMCALGeometry::AreInSameTower(Int_t id1, Int_t id2) const { |
fdebddeb | 54 | // Find out whether two hits are in the same tower |
395c7ba2 | 55 | Int_t idmax = TMath::Max(id1, id2) ; |
56 | Int_t idmin = TMath::Min(id1, id2) ; | |
57 | if ( ((idmax - GetNZ() * GetNPhi()) == idmin ) || | |
58 | ((idmax - 2 * GetNZ() * GetNPhi()) == idmin ) ) | |
59 | return kTRUE ; | |
60 | else | |
61 | return kFALSE ; | |
62 | } | |
05a92d59 | 63 | |
395c7ba2 | 64 | //______________________________________________________________________ |
65 | void AliEMCALGeometry::Init(void){ | |
66 | // Initializes the EMCAL parameters | |
fdebddeb | 67 | // naming convention : GUV_WX_N_ gives the composition of a tower |
395c7ba2 | 68 | // WX inform about the composition of the EM calorimeter section: |
fdebddeb | 69 | // thickness in mm of Pb radiator (W) and of scintillator (X), and number of scintillator layers (N) |
70 | // New geometry: EMCAL_55_25 | |
1963b290 | 71 | // 24-aug-04 for shish-kebab |
72 | // SHISH_25 or SHISH_62 | |
fdebddeb | 73 | fgInit = kFALSE; // Assume failed until proven otherwise. |
1963b290 | 74 | name = GetName(); |
75 | name.ToUpper(); | |
76 | ||
77 | fNZ = 114; // granularity along Z (eta) | |
78 | fNPhi = 168; // granularity in phi (azimuth) | |
79 | fArm1PhiMin = 60.0; // degrees, Starting EMCAL Phi position | |
80 | fArm1PhiMax = 180.0; // degrees, Ending EMCAL Phi position | |
81 | fArm1EtaMin = -0.7; // pseudorapidity, Starting EMCAL Eta position | |
82 | fArm1EtaMax = +0.7; // pseudorapidity, Ending EMCAL Eta position | |
83 | fIPDistance = 454.0; // cm, Radial distance to inner surface of EMCAL | |
84 | ||
85 | // geometry | |
fdebddeb | 86 | if (name == "EMCAL_55_25") { |
87 | fECPbRadThickness = 0.5; // cm, Thickness of the Pb radiators | |
88 | fECScintThick = 0.5; // cm, Thickness of the scintillator | |
89 | fNECLayers = 25; // number of scintillator layers | |
395c7ba2 | 90 | |
57c473a6 | 91 | fSampling = 13.1; // calculated with Birk's law implementation |
395c7ba2 | 92 | |
fdebddeb | 93 | fAlFrontThick = 3.5; // cm, Thickness of front Al layer |
395c7ba2 | 94 | fGap2Active = 1.0; // cm, Gap between Al and 1st Scintillator |
95 | } | |
fdebddeb | 96 | else if( name == "G56_2_55_19" || name == "EMCAL_5655_21" || name == "G56_2_55_19_104_14"|| name == "G65_2_64_19" || name == "EMCAL_6564_21"){ |
97 | Fatal("Init", "%s is an old geometry! Please update your Config file", name.Data()) ; | |
395c7ba2 | 98 | } |
1963b290 | 99 | else if(name.Contains("SHISH")){ |
100 | fNumberOfSuperModules = 12; // 12 = 6 * 2 (6 in phi, 2 in Z); | |
101 | fSteelFrontThick = 2.54; // 9-sep-04 | |
102 | fIPDistance = 460.0; | |
103 | fFrontSteelStrip = fPassiveScintThick = 0.0; // 13-may-05 | |
104 | fLateralSteelStrip = 0.025; // before MAY 2005 | |
105 | fPhiModuleSize = fEtaModuleSize = 11.4; | |
106 | fPhiTileSize = fEtaTileSize = 5.52; // (11.4-5.52*2)/2. = 0.18 cm (wall thickness) | |
107 | fNPhi = 14; | |
108 | fNZ = 30; | |
109 | fAlFrontThick = fGap2Active = 0; | |
110 | fNPHIdiv = fNETAdiv = 2; | |
111 | ||
112 | fNECLayers = 62; | |
113 | fECScintThick = fECPbRadThickness = 0.2; | |
114 | fSampling = 1.; // 30-aug-04 - should be calculated | |
115 | if(name.Contains("TWIST")) { // all about EMCAL module | |
116 | fNZ = 27; // 16-sep-04 | |
117 | } else if(name.Contains("TRD")) { | |
118 | fIPDistance = 428.0; // 11-may-05 | |
119 | fSteelFrontThick = 0.0; // 3.17 -> 0.0; 28-mar-05 : no stell plate | |
120 | fNPhi = 12; | |
121 | fSampling = 12.327; | |
122 | fPhiModuleSize = fEtaModuleSize = 12.26; | |
123 | fNZ = 26; // 11-oct-04 | |
124 | fTrd1Angle = 1.3; // in degree | |
125 | // 18-nov-04; 1./0.08112=12.327 | |
126 | // http://pdsfweb01.nersc.gov/~pavlinov/ALICE/SHISHKEBAB/RES/linearityAndResolutionForTRD1.html | |
127 | if(name.Contains("TRD1")) { // 30-jan-05 | |
128 | // for final design | |
129 | if(name.Contains("MAY05") || name.Contains("WSUC")){ | |
130 | fNumberOfSuperModules = 12; // 20-may-05 | |
131 | if(name.Contains("WSUC")) fNumberOfSuperModules = 1; // 27-may-05 | |
132 | fNECLayers = 77; // (13-may-05 from V.Petrov) | |
133 | fPhiModuleSize = 12.5; // 20-may-05 - rectangular shape | |
134 | fEtaModuleSize = 11.9; | |
135 | fECScintThick = fECPbRadThickness = 0.16;// (13-may-05 from V.Petrov) | |
136 | fFrontSteelStrip = 0.025;// 0.025cm = 0.25mm (13-may-05 from V.Petrov) | |
137 | fLateralSteelStrip = 0.01; // 0.01cm = 0.1mm (13-may-05 from V.Petrov) - was 0.025 | |
138 | fPassiveScintThick = 0.8; // 0.8cm = 8mm (13-may-05 from V.Petrov) | |
139 | fNZ = 24; | |
140 | fTrd1Angle = 1.5; // 1.3 or 1.5 | |
141 | } | |
142 | } else if(name.Contains("TRD2")) { // 30-jan-05 | |
143 | fSteelFrontThick = 0.0; // 11-mar-05 | |
144 | fIPDistance+= fSteelFrontThick; // 1-feb-05 - compensate absence of steel plate | |
145 | fTrd1Angle = 1.64; // 1.3->1.64 | |
146 | fTrd2AngleY = fTrd1Angle; // symmetric case now | |
147 | fEmptySpace = 0.2; // 2 mm | |
148 | fTubsR = fIPDistance; // 31-jan-05 - as for Fred case | |
149 | ||
150 | fPhiModuleSize = fTubsR*2.*TMath::Tan(fTrd2AngleY*TMath::DegToRad()/2.); | |
151 | fPhiModuleSize -= fEmptySpace/2.; // 11-mar-05 | |
152 | fEtaModuleSize = fPhiModuleSize; // 20-may-05 | |
153 | fTubsTurnAngle = 3.; | |
154 | } | |
155 | fNPHIdiv = fNETAdiv = 2; // 13-oct-04 - division again | |
156 | if(name.Contains("3X3")) { // 23-nov-04 | |
157 | fNPHIdiv = fNETAdiv = 3; | |
158 | } else if(name.Contains("4X4")) { | |
159 | fNPHIdiv = fNETAdiv = 4; | |
160 | } | |
161 | } | |
162 | fPhiTileSize = fPhiModuleSize/2. - fLateralSteelStrip; // 13-may-05 | |
163 | fEtaTileSize = fEtaModuleSize/2. - fLateralSteelStrip; // 13-may-05 | |
164 | ||
165 | if(name.Contains("25")){ | |
166 | fNECLayers = 25; | |
167 | fECScintThick = fECPbRadThickness = 0.5; | |
168 | } | |
169 | if(name.Contains("WSUC")){ // 18-may-05 - about common structure | |
170 | fShellThickness = 30.; // should be change | |
171 | fNPhi = fNZ = 4; | |
172 | } | |
173 | // constant for transition absid <--> indexes | |
174 | fNCellsInTower = fNPHIdiv*fNETAdiv; | |
175 | fNCellsInSupMod = fNCellsInTower*fNPhi*fNZ; | |
176 | fNCells = fNCellsInSupMod*fNumberOfSuperModules; | |
177 | ||
178 | fLongModuleSize = fNECLayers*(fECScintThick + fECPbRadThickness); | |
179 | if(name.Contains("MAY05")) fLongModuleSize += (fFrontSteelStrip + fPassiveScintThick); | |
180 | ||
181 | // 30-sep-04 | |
182 | if(name.Contains("TRD")) { | |
183 | f2Trd1Dx2 = fEtaModuleSize + 2.*fLongModuleSize*TMath::Tan(fTrd1Angle*TMath::DegToRad()/2.); | |
184 | if(name.Contains("TRD2")) { // 27-jan-05 | |
185 | f2Trd2Dy2 = fPhiModuleSize + 2.*fLongModuleSize*TMath::Tan(fTrd2AngleY*TMath::DegToRad()/2.); | |
186 | } | |
187 | } | |
188 | } | |
395c7ba2 | 189 | else |
190 | Fatal("Init", "%s is an undefined geometry!", name.Data()) ; | |
05a92d59 | 191 | |
fdebddeb | 192 | |
1963b290 | 193 | fNPhiSuperModule = fNumberOfSuperModules/2; |
194 | if(fNPhiSuperModule<1) fNPhiSuperModule = 1; | |
fdebddeb | 195 | //There is always one more scintillator than radiator layer because of the first block of aluminium |
196 | fShellThickness = fAlFrontThick + fGap2Active + fNECLayers*GetECScintThick()+(fNECLayers-1)*GetECPbRadThick(); | |
1963b290 | 197 | if(name.Contains("SHISH")) { |
198 | fShellThickness = fSteelFrontThick + fLongModuleSize; | |
199 | if(name.Contains("TWIST")) { // 13-sep-04 | |
200 | fShellThickness = TMath::Sqrt(fLongModuleSize*fLongModuleSize + fPhiModuleSize*fEtaModuleSize); | |
201 | fShellThickness += fSteelFrontThick; | |
202 | } else if(name.Contains("TRD")) { // 1-oct-04 | |
203 | fShellThickness = TMath::Sqrt(fLongModuleSize*fLongModuleSize + f2Trd1Dx2*f2Trd1Dx2); | |
204 | fShellThickness += fSteelFrontThick; | |
205 | } | |
206 | } | |
fdebddeb | 207 | |
395c7ba2 | 208 | fZLength = 2.*ZFromEtaR(fIPDistance+fShellThickness,fArm1EtaMax); // Z coverage |
209 | fEnvelop[0] = fIPDistance; // mother volume inner radius | |
210 | fEnvelop[1] = fIPDistance + fShellThickness; // mother volume outer r. | |
211 | fEnvelop[2] = 1.00001*fZLength; // add some padding for mother volume. | |
212 | ||
213 | fgInit = kTRUE; | |
214 | ||
1963b290 | 215 | if (kTRUE) { |
216 | printf("Init: geometry of EMCAL named %s is as follows:\n", name.Data()); | |
88cb7938 | 217 | printf( " ECAL : %d x (%f mm Pb, %f mm Sc) \n", GetNECLayers(), GetECPbRadThick(), GetECScintThick() ) ; |
1963b290 | 218 | if(name.Contains("SHISH")){ |
219 | printf(" fIPDistance %6.3f cm \n", fIPDistance); | |
220 | if(fSteelFrontThick>0.) | |
221 | printf(" fSteelFrontThick %6.3f cm \n", fSteelFrontThick); | |
222 | printf(" fNPhi %i | fNZ %i \n", fNPhi, fNZ); | |
223 | if(name.Contains("MAY05")){ | |
224 | printf(" fFrontSteelStrip %6.4f cm (thickness of front steel strip)\n", | |
225 | fFrontSteelStrip); | |
226 | printf(" fLateralSteelStrip %6.4f cm (thickness of lateral steel strip)\n", | |
227 | fLateralSteelStrip); | |
228 | printf(" fPassiveScintThick %6.4f cm (thickness of front passive Sc tile)\n", | |
229 | fPassiveScintThick); | |
230 | } | |
231 | printf(" X:Y module size %6.3f , %6.3f cm \n", fPhiModuleSize, fEtaModuleSize); | |
232 | printf(" X:Y tile size %6.3f , %6.3f cm \n", fPhiTileSize, fEtaTileSize); | |
233 | printf(" fLongModuleSize %6.3f cm \n", fLongModuleSize); | |
234 | printf(" #supermodule in phi direction %i \n", fNPhiSuperModule ); | |
235 | } | |
236 | if(name.Contains("TRD")) { | |
237 | printf(" fTrd1Angle %7.4f\n", fTrd1Angle); | |
238 | printf(" f2Trd1Dx2 %7.4f\n", f2Trd1Dx2); | |
239 | if(name.Contains("TRD2")) { | |
240 | printf(" fTrd2AngleY %7.4f\n", fTrd2AngleY); | |
241 | printf(" f2Trd2Dy2 %7.4f\n", f2Trd2Dy2); | |
242 | printf(" fTubsR %7.2f\n", fTubsR); | |
243 | printf(" fTubsTurnAngle %7.4f\n", fTubsTurnAngle); | |
244 | printf(" fEmptySpace %7.4f\n", fEmptySpace); | |
245 | } | |
246 | } | |
88cb7938 | 247 | printf("Granularity: %d in eta and %d in phi\n", GetNZ(), GetNPhi()) ; |
1963b290 | 248 | printf("Layout: phi = (%7.1f, %7.1f), eta = (%5.2f, %5.2f), IP = %7.2f\n", |
249 | GetArm1PhiMin(), GetArm1PhiMax(),GetArm1EtaMin(), GetArm1EtaMax(), GetIPDistance() ); | |
88cb7938 | 250 | } |
2012850d | 251 | } |
173558f2 | 252 | |
b13bbe81 | 253 | //______________________________________________________________________ |
254 | AliEMCALGeometry * AliEMCALGeometry::GetInstance(){ | |
05a92d59 | 255 | // Returns the pointer of the unique instance |
256 | ||
257 | return static_cast<AliEMCALGeometry *>( fgGeom ) ; | |
2012850d | 258 | } |
173558f2 | 259 | |
b13bbe81 | 260 | //______________________________________________________________________ |
261 | AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name, | |
262 | const Text_t* title){ | |
263 | // Returns the pointer of the unique instance | |
264 | ||
265 | AliEMCALGeometry * rv = 0; | |
266 | if ( fgGeom == 0 ) { | |
267 | if ( strcmp(name,"") == 0 ) rv = 0; | |
268 | else { | |
269 | fgGeom = new AliEMCALGeometry(name, title); | |
270 | if ( fgInit ) rv = (AliEMCALGeometry * ) fgGeom; | |
271 | else { | |
272 | rv = 0; | |
273 | delete fgGeom; | |
274 | fgGeom = 0; | |
275 | } // end if fgInit | |
276 | } // end if strcmp(name,"") | |
277 | }else{ | |
278 | if ( strcmp(fgGeom->GetName(), name) != 0 ) { | |
fdebddeb | 279 | printf("\ncurrent geometry is ") ; |
280 | printf(fgGeom->GetName()); | |
281 | printf("\n you cannot call "); | |
282 | printf(name); | |
b13bbe81 | 283 | }else{ |
9859bfc0 | 284 | rv = (AliEMCALGeometry *) fgGeom; |
b13bbe81 | 285 | } // end if |
286 | } // end if fgGeom | |
287 | return rv; | |
2012850d | 288 | } |
173558f2 | 289 | |
ca8f5bd0 | 290 | //______________________________________________________________________ |
395c7ba2 | 291 | Int_t AliEMCALGeometry::TowerIndex(Int_t ieta,Int_t iphi) const { |
292 | // Returns the tower index number from the based on the Z and Phi | |
fdebddeb | 293 | // index numbers. |
395c7ba2 | 294 | // Inputs: |
fdebddeb | 295 | // Int_t ieta // index along z axis [1-fNZ] |
296 | // Int_t iphi // index along phi axis [1-fNPhi] | |
395c7ba2 | 297 | // Outputs: |
298 | // none. | |
299 | // Returned | |
300 | // Int_t index // Tower index number | |
301 | ||
302 | if ( (ieta <= 0 || ieta>GetNEta()) || | |
f1da4a27 | 303 | (iphi <= 0 || iphi>GetNPhi())) { |
304 | Error("TowerIndex", "Unexpected parameters eta = %d phi = %d!", ieta, iphi) ; | |
305 | return -1; | |
306 | } | |
395c7ba2 | 307 | return ( (iphi - 1)*GetNEta() + ieta ); |
ca8f5bd0 | 308 | } |
173558f2 | 309 | |
ca8f5bd0 | 310 | //______________________________________________________________________ |
fdebddeb | 311 | void AliEMCALGeometry::TowerIndexes(Int_t index,Int_t &ieta,Int_t &iphi) const { |
395c7ba2 | 312 | // Inputs: |
fdebddeb | 313 | // Int_t index // Tower index number [1-fNZ*fNPhi] |
395c7ba2 | 314 | // Outputs: |
315 | // Int_t ieta // index allong z axis [1-fNZ] | |
316 | // Int_t iphi // index allong phi axis [1-fNPhi] | |
395c7ba2 | 317 | // Returned |
318 | // none. | |
395c7ba2 | 319 | |
fdebddeb | 320 | Int_t nindex = 0; |
395c7ba2 | 321 | |
fdebddeb | 322 | if ( IsInECA(index) ) { // ECAL index |
395c7ba2 | 323 | nindex = index ; |
395c7ba2 | 324 | } |
f1da4a27 | 325 | else { |
326 | Error("TowerIndexes", "Unexpected Id number!") ; | |
327 | ieta = -1; | |
328 | iphi = -1; | |
329 | return; | |
330 | } | |
331 | ||
395c7ba2 | 332 | if (nindex%GetNZ()) |
333 | iphi = nindex / GetNZ() + 1 ; | |
334 | else | |
335 | iphi = nindex / GetNZ() ; | |
336 | ieta = nindex - (iphi - 1) * GetNZ() ; | |
337 | ||
338 | if (gDebug==2) | |
fdebddeb | 339 | printf("TowerIndexes: index=%d,%d, ieta=%d, iphi = %d", index, nindex,ieta, iphi) ; |
395c7ba2 | 340 | return; |
341 | ||
ca8f5bd0 | 342 | } |
173558f2 | 343 | |
ca8f5bd0 | 344 | //______________________________________________________________________ |
a34b7b9f | 345 | void AliEMCALGeometry::EtaPhiFromIndex(Int_t index,Float_t &eta,Float_t &phi) const { |
ca8f5bd0 | 346 | // given the tower index number it returns the based on the eta and phi |
347 | // of the tower. | |
348 | // Inputs: | |
fdebddeb | 349 | // Int_t index // Tower index number [1-fNZ*fNPhi] |
ca8f5bd0 | 350 | // Outputs: |
351 | // Float_t eta // eta of center of tower in pseudorapidity | |
352 | // Float_t phi // phi of center of tower in degrees | |
353 | // Returned | |
354 | // none. | |
fdebddeb | 355 | Int_t ieta, iphi; |
395c7ba2 | 356 | Float_t deta, dphi ; |
ca8f5bd0 | 357 | |
fdebddeb | 358 | TowerIndexes(index,ieta,iphi); |
395c7ba2 | 359 | |
360 | if (gDebug == 2) | |
fdebddeb | 361 | printf("EtaPhiFromIndex: index = %d, ieta = %d, iphi = %d", index, ieta, iphi) ; |
395c7ba2 | 362 | |
363 | deta = (GetArm1EtaMax()-GetArm1EtaMin())/(static_cast<Float_t>(GetNEta())); | |
364 | eta = GetArm1EtaMin() + ((static_cast<Float_t>(ieta) - 0.5 ))*deta; | |
365 | ||
366 | dphi = (GetArm1PhiMax() - GetArm1PhiMin())/(static_cast<Float_t>(GetNPhi())); // in degrees. | |
367 | phi = GetArm1PhiMin() + dphi*(static_cast<Float_t>(iphi) - 0.5);//iphi range [1-fNphi]. | |
ca8f5bd0 | 368 | } |
173558f2 | 369 | |
ca8f5bd0 | 370 | //______________________________________________________________________ |
a34b7b9f | 371 | Int_t AliEMCALGeometry::TowerIndexFromEtaPhi(Float_t eta,Float_t phi) const { |
ca8f5bd0 | 372 | // returns the tower index number based on the eta and phi of the tower. |
373 | // Inputs: | |
374 | // Float_t eta // eta of center of tower in pseudorapidity | |
375 | // Float_t phi // phi of center of tower in degrees | |
376 | // Outputs: | |
377 | // none. | |
378 | // Returned | |
379 | // Int_t index // Tower index number [1-fNZ*fNPhi] | |
395c7ba2 | 380 | |
e908f07f | 381 | Int_t ieta,iphi; |
ca8f5bd0 | 382 | |
395c7ba2 | 383 | ieta = static_cast<Int_t> ( 1 + (static_cast<Float_t>(GetNEta()) * (eta - GetArm1EtaMin()) / (GetArm1EtaMax() - GetArm1EtaMin())) ) ; |
384 | ||
385 | if( ieta <= 0 || ieta > GetNEta() ) { | |
386 | Error("TowerIndexFromEtaPhi", "Unexpected (eta, phi) = (%f, %f) value, outside of EMCAL!", eta, phi) ; | |
387 | return -1 ; | |
388 | } | |
389 | ||
390 | iphi = static_cast<Int_t> ( 1 + (static_cast<Float_t>(GetNPhi()) * (phi - GetArm1PhiMin()) / (GetArm1PhiMax() - GetArm1PhiMin())) ) ; | |
391 | ||
392 | if( iphi <= 0 || iphi > GetNPhi() ) { | |
393 | Error("TowerIndexFromEtaPhi", "Unexpected (eta, phi) = (%f, %f) value, outside of EMCAL!", eta, phi) ; | |
394 | return -1 ; | |
395 | } | |
396 | ||
397 | return TowerIndex(ieta,iphi); | |
ca8f5bd0 | 398 | } |
173558f2 | 399 | |
ca8f5bd0 | 400 | //______________________________________________________________________ |
a34b7b9f | 401 | Bool_t AliEMCALGeometry::AbsToRelNumbering(Int_t AbsId, Int_t *relid) const { |
ca8f5bd0 | 402 | // Converts the absolute numbering into the following array/ |
2608a1fc | 403 | // relid[0] = Row number inside EMCAL |
404 | // relid[1] = Column number inside EMCAL | |
ca8f5bd0 | 405 | // Input: |
406 | // Int_t AbsId // Tower index number [1-2*fNZ*fNPhi] | |
407 | // Outputs: | |
2608a1fc | 408 | // Int_t *relid // array of 2. Described above. |
ca8f5bd0 | 409 | Bool_t rv = kTRUE ; |
fdebddeb | 410 | Int_t ieta=0,iphi=0,index=AbsId; |
ca8f5bd0 | 411 | |
fdebddeb | 412 | TowerIndexes(index,ieta,iphi); |
2608a1fc | 413 | relid[0] = ieta; |
414 | relid[1] = iphi; | |
ca8f5bd0 | 415 | |
416 | return rv; | |
417 | } | |
173558f2 | 418 | |
ca8f5bd0 | 419 | //______________________________________________________________________ |
395c7ba2 | 420 | void AliEMCALGeometry::PosInAlice(const Int_t *relid, Float_t &theta, Float_t &phi) const |
421 | { | |
422 | // Converts the relative numbering into the local EMCAL-module (x, z) | |
423 | // coordinates | |
2608a1fc | 424 | Int_t ieta = relid[0]; // offset along x axis |
425 | Int_t iphi = relid[1]; // offset along z axis | |
395c7ba2 | 426 | Int_t index; |
427 | Float_t eta; | |
428 | ||
429 | index = TowerIndex(ieta,iphi); | |
430 | EtaPhiFromIndex(index,eta,phi); | |
fdebddeb | 431 | //theta = 180.*(2.0*TMath::ATan(TMath::Exp(-eta)))/TMath::Pi(); |
432 | theta = 2.0*TMath::ATan(TMath::Exp(-eta)); | |
395c7ba2 | 433 | |
fdebddeb | 434 | // correct for distance to IP |
435 | Float_t d = GetIP2ECASection() - GetIPDistance() ; | |
395c7ba2 | 436 | |
437 | Float_t correction = 1 + d/GetIPDistance() ; | |
438 | Float_t tantheta = TMath::Tan(theta) * correction ; | |
439 | theta = TMath::ATan(tantheta) * TMath::RadToDeg() ; | |
440 | if (theta < 0 ) | |
441 | theta += 180. ; | |
442 | ||
443 | return; | |
444 | } | |
ca8f5bd0 | 445 | |
395c7ba2 | 446 | //______________________________________________________________________ |
09884213 | 447 | void AliEMCALGeometry::PosInAlice(Int_t absid, Float_t &theta, Float_t &phi) const |
395c7ba2 | 448 | { |
449 | // Converts the relative numbering into the local EMCAL-module (x, z) | |
450 | // coordinates | |
2608a1fc | 451 | Int_t relid[2] ; |
395c7ba2 | 452 | AbsToRelNumbering(absid, relid) ; |
2608a1fc | 453 | Int_t ieta = relid[0]; // offset along x axis |
454 | Int_t iphi = relid[1]; // offset along z axis | |
395c7ba2 | 455 | Int_t index; |
456 | Float_t eta; | |
457 | ||
458 | index = TowerIndex(ieta,iphi); | |
459 | EtaPhiFromIndex(index,eta,phi); | |
460 | theta = 2.0*TMath::ATan(TMath::Exp(-eta)) ; | |
461 | ||
fdebddeb | 462 | // correct for distance to IP |
395c7ba2 | 463 | Float_t d = 0. ; |
fdebddeb | 464 | if (IsInECA(absid)) |
88cb7938 | 465 | d = GetIP2ECASection() - GetIPDistance() ; |
f1da4a27 | 466 | else { |
467 | Error("PosInAlice", "Unexpected id # %d!", absid) ; | |
468 | return; | |
469 | } | |
395c7ba2 | 470 | |
471 | Float_t correction = 1 + d/GetIPDistance() ; | |
472 | Float_t tantheta = TMath::Tan(theta) * correction ; | |
473 | theta = TMath::ATan(tantheta) * TMath::RadToDeg() ; | |
474 | if (theta < 0 ) | |
475 | theta += 180. ; | |
476 | ||
477 | return; | |
ca8f5bd0 | 478 | } |
6119e5db | 479 | |
480 | //______________________________________________________________________ | |
481 | void AliEMCALGeometry::XYZFromIndex(const Int_t *relid,Float_t &x,Float_t &y, Float_t &z) const { | |
482 | // given the tower relative number it returns the X, Y and Z | |
483 | // of the tower. | |
484 | ||
485 | // Outputs: | |
486 | // Float_t x // x of center of tower in cm | |
487 | // Float_t y // y of center of tower in cm | |
488 | // Float_t z // z of centre of tower in cm | |
489 | // Returned | |
490 | // none. | |
491 | ||
fdebddeb | 492 | Float_t eta,theta, phi,cylradius=0. ; |
6119e5db | 493 | |
2608a1fc | 494 | Int_t ieta = relid[0]; // offset along x axis |
495 | Int_t iphi = relid[1]; // offset along z axis. | |
6119e5db | 496 | Int_t index; |
497 | ||
395c7ba2 | 498 | index = TowerIndex(ieta,iphi); |
6119e5db | 499 | EtaPhiFromIndex(index,eta,phi); |
500 | theta = 180.*(2.0*TMath::ATan(TMath::Exp(-eta)))/TMath::Pi(); | |
6119e5db | 501 | |
fdebddeb | 502 | cylradius = GetIP2ECASection() ; |
a97849a9 | 503 | |
395c7ba2 | 504 | Double_t kDeg2Rad = TMath::DegToRad() ; |
fdebddeb | 505 | x = cylradius * TMath::Cos(phi * kDeg2Rad ) ; |
506 | y = cylradius * TMath::Sin(phi * kDeg2Rad ) ; | |
507 | z = cylradius / TMath::Tan(theta * kDeg2Rad ) ; | |
6119e5db | 508 | |
509 | return; | |
510 | } | |
511 | ||
395c7ba2 | 512 | //______________________________________________________________________ |
09884213 | 513 | void AliEMCALGeometry::XYZFromIndex(Int_t absid, TVector3 &v) const { |
395c7ba2 | 514 | // given the tower relative number it returns the X, Y and Z |
515 | // of the tower. | |
516 | ||
517 | // Outputs: | |
518 | // Float_t x // x of center of tower in cm | |
519 | // Float_t y // y of center of tower in cm | |
520 | // Float_t z // z of centre of tower in cm | |
521 | // Returned | |
522 | // none. | |
523 | ||
fdebddeb | 524 | Float_t theta, phi,cylradius=0. ; |
395c7ba2 | 525 | |
526 | PosInAlice(absid, theta, phi) ; | |
527 | ||
88cb7938 | 528 | if ( IsInECA(absid) ) |
fdebddeb | 529 | cylradius = GetIP2ECASection() ; |
f1da4a27 | 530 | else { |
531 | Error("XYZFromIndex", "Unexpected Tower section") ; | |
532 | return; | |
533 | } | |
395c7ba2 | 534 | |
535 | Double_t kDeg2Rad = TMath::DegToRad() ; | |
fdebddeb | 536 | v.SetX(cylradius * TMath::Cos(phi * kDeg2Rad ) ); |
537 | v.SetY(cylradius * TMath::Sin(phi * kDeg2Rad ) ); | |
538 | v.SetZ(cylradius / TMath::Tan(theta * kDeg2Rad ) ) ; | |
395c7ba2 | 539 | |
540 | return; | |
541 | } | |
ab37d09c | 542 | |
543 | Bool_t AliEMCALGeometry::IsInEMCAL(Double_t x, Double_t y, Double_t z) const { | |
544 | // Checks whether point is inside the EMCal volume | |
545 | // | |
546 | // Code uses cylindrical approximation made of inner radius (for speed) | |
547 | // | |
548 | // Points behind EMCAl, i.e. R > outer radius, but eta, phi in acceptance | |
549 | // are considered to inside | |
550 | ||
551 | Double_t r=sqrt(x*x+y*y); | |
552 | ||
553 | if ( r > fEnvelop[0] ) { | |
554 | Double_t theta; | |
555 | theta = TMath::ATan2(r,z); | |
556 | Double_t eta; | |
557 | if(theta == 0) | |
558 | eta = 9999; | |
559 | else | |
560 | eta = -TMath::Log(TMath::Tan(theta/2.)); | |
561 | if (eta < fArm1EtaMin || eta > fArm1EtaMax) | |
562 | return 0; | |
563 | ||
564 | Double_t phi = TMath::ATan2(y,x) * 180./TMath::Pi(); | |
565 | if (phi > fArm1PhiMin && phi < fArm1PhiMax) | |
566 | return 1; | |
567 | } | |
568 | return 0; | |
569 | } | |
1963b290 | 570 | |
571 | // | |
572 | // == Shish-kebab cases == | |
573 | // | |
574 | Int_t AliEMCALGeometry::GetAbsCellId(const int nSupMod, const int nTower, const int nIphi, const int nIeta) | |
575 | { // 27-aug-04; corr. 21-sep-04 | |
576 | static Int_t id; // have to change from 1 to fNCells | |
577 | id = fNCellsInSupMod*(nSupMod-1); | |
578 | id += fNCellsInTower *(nTower-1); | |
579 | id += fNPHIdiv *(nIphi-1); | |
580 | id += nIeta; | |
581 | if(id<=0 || id > fNCells) { | |
582 | printf(" wrong numerations !!\n"); | |
583 | printf(" id %6i(will be force to -1)\n", id); | |
584 | printf(" fNCells %6i\n", fNCells); | |
585 | printf(" nSupMod %6i\n", nSupMod); | |
586 | printf(" nTower %6i\n", nTower); | |
587 | printf(" nIphi %6i\n", nIphi); | |
588 | printf(" nIeta %6i\n", nIeta); | |
589 | id = -1; | |
590 | } | |
591 | return id; | |
592 | } | |
593 | ||
594 | Bool_t AliEMCALGeometry::CheckAbsCellId(Int_t ind) | |
595 | { // 17-niv-04 - analog of IsInECA | |
596 | if(name.Contains("TRD")) { | |
597 | if(ind<=0 || ind > fNCells) return kFALSE; | |
598 | else return kTRUE; | |
599 | } else return IsInECA(ind); | |
600 | } | |
601 | ||
602 | Bool_t AliEMCALGeometry::GetCellIndex(const Int_t absId,Int_t &nSupMod,Int_t &nTower,Int_t &nIphi,Int_t &nIeta) | |
603 | { // 21-sep-04 | |
604 | static Int_t tmp=0; | |
605 | if(absId<=0 || absId>fNCells) { | |
606 | Info("GetCellIndex"," wrong abs Id %i !! \n", absId); | |
607 | return kFALSE; | |
608 | } | |
609 | nSupMod = (absId-1) / fNCellsInSupMod + 1; | |
610 | tmp = (absId-1) % fNCellsInSupMod; | |
611 | ||
612 | nTower = tmp / fNCellsInTower + 1; | |
613 | tmp = tmp % fNCellsInTower; | |
614 | ||
615 | nIphi = tmp / fNPHIdiv + 1; | |
616 | nIeta = tmp % fNPHIdiv + 1; | |
617 | ||
618 | return kTRUE; | |
619 | } | |
620 | ||
621 | void AliEMCALGeometry::GetCellPhiEtaIndexInSModule(const int nTower, const int nIphi, const int nIeta, | |
622 | int &iphi, int &ieta) | |
623 | { // don't check validity of nTower, nIphi and nIeta index | |
624 | // have to change - 1-nov-04 ?? | |
625 | static Int_t iphit, ietat; | |
626 | ||
627 | ietat = (nTower-1)/fNPhi; | |
628 | ieta = ietat*fNETAdiv + nIeta; // change from 1 to fNZ*fNETAdiv | |
629 | ||
630 | iphit = (nTower-1)%fNPhi; | |
631 | iphi = iphit*fNPHIdiv + nIphi; // change from 1 to fNPhi*fNPHIdiv | |
632 | } |