]>
Commit | Line | Data |
---|---|---|
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 | |
20 | // EMCAL consists of layers of scintillator and lead | |
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 | |
26 | // EMCALArch2x has more modules along both phi and eta | |
27 | // EMCALArchxa has less Layers in the Radial Direction | |
28 | //*-- Author: Sahal Yacoob (LBL / UCT) | |
29 | // and : Yves Schutz (SUBATECH) | |
30 | // and : Jennifer Klay (LBL) | |
31 | ||
32 | // --- ROOT system --- | |
33 | ||
34 | // --- Standard library --- | |
35 | #include <stdlib.h> | |
36 | ||
37 | // --- AliRoot header files --- | |
38 | #include <TMath.h> | |
39 | ||
40 | // -- ALICE Headers. | |
41 | #include "AliConst.h" | |
42 | ||
43 | // --- EMCAL headers | |
44 | #include "AliEMCALGeometry.h" | |
45 | ||
46 | ClassImp(AliEMCALGeometry); | |
47 | ||
48 | AliEMCALGeometry *AliEMCALGeometry::fgGeom = 0; | |
49 | Bool_t AliEMCALGeometry::fgInit = kFALSE; | |
50 | ||
51 | //______________________________________________________________________ | |
52 | AliEMCALGeometry::~AliEMCALGeometry(void){ | |
53 | // dtor | |
54 | } | |
55 | ||
56 | //______________________________________________________________________ | |
57 | const Bool_t AliEMCALGeometry::AreInSameTower(Int_t id1, Int_t id2) const { | |
58 | Int_t idmax = TMath::Max(id1, id2) ; | |
59 | Int_t idmin = TMath::Min(id1, id2) ; | |
60 | if ( ((idmax - GetNZ() * GetNPhi()) == idmin ) || | |
61 | ((idmax - 2 * GetNZ() * GetNPhi()) == idmin ) ) | |
62 | return kTRUE ; | |
63 | else | |
64 | return kFALSE ; | |
65 | } | |
66 | ||
67 | //______________________________________________________________________ | |
68 | void AliEMCALGeometry::Init(void){ | |
69 | // Initializes the EMCAL parameters | |
70 | // naming convention : GUV_L_WX_N_YZ_M gives the composition of a tower | |
71 | // UV inform about the compsition of the pre-shower section: | |
72 | // thickness in mm of Pb radiator (U) and of scintillator (V), and number of scintillator layers (L) | |
73 | // WX inform about the composition of the EM calorimeter section: | |
74 | // thickness in mm of Pb radiator (W) and of scintillator (X), and number of scintillator layers (N) | |
75 | // YZ inform about the composition of the hadron calorimeter section: | |
76 | // thickness in mm of Cu radiator (Y) and of scintillator (Z), and number of scintillator layers (M) | |
77 | // Valid geometries are G56_2_55_19_104_14 | |
78 | // G56_2_55_19 or EMCAL_5655_21 | |
79 | // G65_2_64_19 or EMCAL_6564_21 | |
80 | ||
81 | fgInit = kFALSE; // Assume failer untill proven otherwise. | |
82 | TString name(GetName()) ; | |
83 | ||
84 | if ( name == "G56_2_55_19_104_14" ) { | |
85 | fPRPbRadThickness = 0.5; // cm, Thickness of the Pb radiators for the preshower section | |
86 | fPRScintThick = 0.6; // cm, Thickness of the sintilator for the preshower section of the tower | |
87 | fNPRLayers = 2; // number of scintillator layers in the preshower section | |
88 | ||
89 | fECPbRadThickness = 0.5; // cm, Thickness of the Pb radiators for the EM calorimeter section | |
90 | fECScintThick = 0.5; // cm, Thickness of the sintilator for the EM alorimeter section of the tower | |
91 | fNECLayers = 19; // number of scintillator layers in the EM calorimeter section | |
92 | ||
93 | fHCCuRadThickness = 1.0; // cm, Thickness of the Cu radiators. | |
94 | fHCScintThick = 0.4; // cm, Thickness of the sintilator for the hadronic alorimeter section of the tower | |
95 | fNHCLayers = 14; // number of scintillator layers in the hadronic calorimeter section | |
96 | ||
97 | fSampling = 12. ; | |
98 | fSummationFraction = 0.8 ; | |
99 | ||
100 | fAlFrontThick = 3.0; // cm, Thickness of front Al layer | |
101 | fGap2Active = 1.0; // cm, Gap between Al and 1st Scintillator | |
102 | } | |
103 | else if ( name == "G56_2_55_19" || name == "EMCAL_5655_21" ) { | |
104 | fPRPbRadThickness = 0.5; // cm, Thickness of the Pb radiators for the preshower section | |
105 | fPRScintThick = 0.6; // cm, Thickness of the sintilator for the preshower section of the tower | |
106 | fNPRLayers = 2; // number of scintillator layers in the preshower section | |
107 | ||
108 | fECPbRadThickness = 0.5; // cm, Thickness of the Pb radiators for the EM calorimeter section | |
109 | fECScintThick = 0.5; // cm, Thickness of the sintilator for the EM alorimeter section of the tower | |
110 | fNECLayers = 19; // number of scintillator layers in the EM calorimeter section | |
111 | ||
112 | fHCCuRadThickness = 0.0; // cm, Thickness of the Cu radiators. | |
113 | fHCScintThick = 0.0; // cm, Thickness of the sintilator for the hadronic alorimeter section of the tower | |
114 | fNHCLayers = 0; // number of scintillator layers in the hadronic calorimeter section | |
115 | ||
116 | fSampling = 12. ; | |
117 | fSummationFraction = 0.8 ; | |
118 | ||
119 | fAlFrontThick = 3.0; // cm, Thickness of front Al layer | |
120 | fGap2Active = 1.0; // cm, Gap between Al and 1st Scintillator | |
121 | } | |
122 | else if ( name == "G65_2_64_19" || name == "EMCAL_6564_21" ) { | |
123 | fPRPbRadThickness = 0.6; // cm, Thickness of the Pb radiators for the preshower section | |
124 | fPRScintThick = 0.5; // cm, Thickness of the sintilator for the preshower section of the tower | |
125 | fNPRLayers = 2; // number of scintillator layers in the preshower section | |
126 | ||
127 | fECPbRadThickness = 0.6; // cm, Thickness of the Pb radiators for the EM calorimeter section | |
128 | fECScintThick = 0.4; // cm, Thickness of the sintilator for the EM alorimeter section of the tower | |
129 | fNECLayers = 19; // number of scintillator layers in the EM calorimeter section | |
130 | ||
131 | fHCCuRadThickness = 0.0; // cm, Thickness of the Cu radiators. | |
132 | fHCScintThick = 0.0; // cm, Thickness of the sintilator for the hadronic alorimeter section of the tower | |
133 | fNHCLayers = 0; // number of scintillator layers in the hadronic calorimeter section | |
134 | ||
135 | fSampling = 12. ; | |
136 | fSummationFraction = 0.8 ; | |
137 | ||
138 | fAlFrontThick = 3.0; // cm, Thickness of front Al layer | |
139 | fGap2Active = 1.0; // cm, Gap between Al and 1st Scintillator | |
140 | } | |
141 | else | |
142 | Fatal("Init", "%s is an undefined geometry!", name.Data()) ; | |
143 | ||
144 | // if( name != "EMCALArch1a" && | |
145 | // name != "EMCALArch1b" && | |
146 | // name != "EMCALArch2a" && | |
147 | // name != "EMCALArch2b" && | |
148 | // name != "EMCALArch1aN" ){ | |
149 | // Fatal("Init", "%s is not a known geometry (choose among EMCALArch1a, EMCALArch1b, EMCALArch2a and EMCALArch2b, EMCALArch1aN)", name.Data()) ; | |
150 | // } // end if | |
151 | // // | |
152 | // if ( name == "EMCALArch1a" || | |
153 | // name == "EMCALArch1b" || | |
154 | // name == "EMCALArch1aN") { | |
155 | // fNZ = 96; | |
156 | // fNPhi = 144; | |
157 | // } // end if | |
158 | // if ( name == "EMCALArch2a" || | |
159 | // name == "EMCALArch2b" ) { | |
160 | // fNZ = 112; | |
161 | // fNPhi = 168; | |
162 | // } // end if | |
163 | // if ( name == "EMCALArch1a" || | |
164 | // name == "EMCALArch2a" ) { | |
165 | // fNPRLayers = 2; | |
166 | // fNECLayers = 19; | |
167 | // fNHCLayers = 0; | |
168 | // } // end if | |
169 | // if ( name == "EMCALArch1b" || | |
170 | // name == "EMCALArch2b" ) { | |
171 | // fNPRLayers = 2; | |
172 | // fNECLayers = 23; | |
173 | // fNHCLayers = 0; | |
174 | // } // end if | |
175 | // if ( name == "EMCALArch1aN") { | |
176 | // fNPRLayers = 2; | |
177 | // fNECLayers = 19; | |
178 | // fNHCLayers = 14; | |
179 | // } | |
180 | ||
181 | // geometry | |
182 | fNZ = 96; // granularity along Z (eta) | |
183 | fNPhi = 144; // granularity in phi (azimuth) | |
184 | fArm1PhiMin = 60.0; // degrees, Starting EMCAL Phi position | |
185 | fArm1PhiMax = 180.0; // degrees, Ending EMCAL Phi position | |
186 | fArm1EtaMin = -0.7; // pseudorapidity, Starting EMCAL Eta position | |
187 | fArm1EtaMax = +0.7; // pseudorapidity, Ending EMCAL Eta position | |
188 | ||
189 | fIPDistance = 454.0; // cm, Radial distance to inner surface of EMCAL | |
190 | fShellThickness = fAlFrontThick + fGap2Active + 2.*(GetPRScintThick() + GetPRPbRadThick()) + // pre shower | |
191 | (fNECLayers-1)*(GetECScintThick()+ GetECPbRadThick()) + // E cal -1 because the last element is a scintillator | |
192 | fNHCLayers*(GetHCScintThick()+ GetHCCuRadThick()) + // H cal | |
193 | GetHCScintThick() ; // last scintillator | |
194 | fZLength = 2.*ZFromEtaR(fIPDistance+fShellThickness,fArm1EtaMax); // Z coverage | |
195 | fEnvelop[0] = fIPDistance; // mother volume inner radius | |
196 | fEnvelop[1] = fIPDistance + fShellThickness; // mother volume outer r. | |
197 | fEnvelop[2] = 1.00001*fZLength; // add some padding for mother volume. | |
198 | ||
199 | fgInit = kTRUE; | |
200 | ||
201 | Info("Init", "geometry of EMCAL named %s is as follows:", name.Data()); | |
202 | printf( "Tower geometry pre-shower: %d x (%f mm Pb, %f mm Sc) \n", GetNPRLayers(), GetPRPbRadThick(), GetPRScintThick() ) ; | |
203 | printf( " ECAL : %d x (%f mm Pb, %f mm Sc) \n", GetNECLayers(), GetECPbRadThick(), GetECScintThick() ) ; | |
204 | if ( GetNHCLayers() > 0 ) | |
205 | printf( " HCAL : %d x (%f mm Pb, %f mm Sc) \n", GetNHCLayers(), GetHCCuRadThick(), GetHCScintThick() ) ; | |
206 | printf("Granularity: %d in eta and %d in phi\n", GetNZ(), GetNPhi()) ; | |
207 | printf("Layout: phi = (%f, %f), eta = (%f, %f), y = %f\n", | |
208 | GetArm1PhiMin(), GetArm1PhiMax(),GetArm1EtaMin(), GetArm1EtaMax(), GetIPDistance() ) ; | |
209 | } | |
210 | ||
211 | //______________________________________________________________________ | |
212 | AliEMCALGeometry * AliEMCALGeometry::GetInstance(){ | |
213 | // Returns the pointer of the unique instance | |
214 | ||
215 | return static_cast<AliEMCALGeometry *>( fgGeom ) ; | |
216 | } | |
217 | ||
218 | //______________________________________________________________________ | |
219 | AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name, | |
220 | const Text_t* title){ | |
221 | // Returns the pointer of the unique instance | |
222 | ||
223 | AliEMCALGeometry * rv = 0; | |
224 | if ( fgGeom == 0 ) { | |
225 | if ( strcmp(name,"") == 0 ) rv = 0; | |
226 | else { | |
227 | fgGeom = new AliEMCALGeometry(name, title); | |
228 | if ( fgInit ) rv = (AliEMCALGeometry * ) fgGeom; | |
229 | else { | |
230 | rv = 0; | |
231 | delete fgGeom; | |
232 | fgGeom = 0; | |
233 | } // end if fgInit | |
234 | } // end if strcmp(name,"") | |
235 | }else{ | |
236 | if ( strcmp(fgGeom->GetName(), name) != 0 ) { | |
237 | TString message("\n") ; | |
238 | message += "current geometry is " ; | |
239 | message += fgGeom->GetName() ; | |
240 | message += "\n you cannot call " ; | |
241 | message += name ; | |
242 | ::Info("GetGeometry", message.Data() ) ; | |
243 | }else{ | |
244 | rv = (AliEMCALGeometry *) fgGeom; | |
245 | } // end if | |
246 | } // end if fgGeom | |
247 | return rv; | |
248 | } | |
249 | ||
250 | //______________________________________________________________________ | |
251 | Int_t AliEMCALGeometry::TowerIndex(Int_t ieta,Int_t iphi) const { | |
252 | // Returns the tower index number from the based on the Z and Phi | |
253 | // index numbers. There are 2 times the number of towers to separate | |
254 | // out the full towers from the pre-showers. | |
255 | // Inputs: | |
256 | // Int_t ieta // index allong z axis [1-fNZ] | |
257 | // Int_t iphi // index allong phi axis [1-fNPhi] | |
258 | // Int_t where // 1 = PRE section, 0 = EC section, 2 = HC section | |
259 | // Outputs: | |
260 | // none. | |
261 | // Returned | |
262 | // Int_t index // Tower index number | |
263 | ||
264 | if ( (ieta <= 0 || ieta>GetNEta()) || | |
265 | (iphi <= 0 || iphi>GetNPhi())) | |
266 | Fatal("TowerIndex", "Unexpected parameters eta = %d phi = %d!", ieta, iphi) ; | |
267 | ||
268 | return ( (iphi - 1)*GetNEta() + ieta ); | |
269 | } | |
270 | ||
271 | //______________________________________________________________________ | |
272 | void AliEMCALGeometry::TowerIndexes(Int_t index,Int_t &ieta,Int_t &iphi, | |
273 | Int_t &ipre) const { | |
274 | // Inputs: | |
275 | // Int_t index // Tower index number [1-i*fNZ*fNPhi] PRE(i=1)/ECAL(i=2)/HCAL(i=3) | |
276 | // Outputs: | |
277 | // Int_t ieta // index allong z axis [1-fNZ] | |
278 | // Int_t iphi // index allong phi axis [1-fNPhi] | |
279 | // Int_t ipre // 0 = ECAL section, 1 = Pre-shower section, 2 = HCAL section | |
280 | // Returned | |
281 | // none. | |
282 | ||
283 | ||
284 | Int_t nindex = 0, itowers = GetNEta() * GetNPhi(); | |
285 | ||
286 | if ( IsInPRE(index) ) { // PRE index | |
287 | nindex = index - itowers; | |
288 | ipre = 1 ; | |
289 | } | |
290 | else if ( IsInECAL(index) ) { // ECAL index | |
291 | nindex = index ; | |
292 | ipre = 0 ; | |
293 | } | |
294 | else if ( IsInHCAL(index) ) { // HCAL index | |
295 | nindex = index - 2*itowers; | |
296 | ipre = 2 ; | |
297 | } | |
298 | else | |
299 | Fatal("TowerIndexes", "Unexpected Id number!") ; | |
300 | ||
301 | if (nindex%GetNZ()) | |
302 | iphi = nindex / GetNZ() + 1 ; | |
303 | else | |
304 | iphi = nindex / GetNZ() ; | |
305 | ieta = nindex - (iphi - 1) * GetNZ() ; | |
306 | ||
307 | if (gDebug==2) | |
308 | Info("TowerIndexes", "index=%d,%d, ieta=%d, iphi = %d", index, nindex,ieta, iphi) ; | |
309 | return; | |
310 | ||
311 | } | |
312 | ||
313 | //______________________________________________________________________ | |
314 | void AliEMCALGeometry::EtaPhiFromIndex(Int_t index,Float_t &eta,Float_t &phi) const { | |
315 | // given the tower index number it returns the based on the eta and phi | |
316 | // of the tower. | |
317 | // Inputs: | |
318 | // Int_t index // Tower index number [1-i*fNZ*fNPhi] PRE(i=1)/ECAL(i=2)/HCAL(i=3) | |
319 | // Outputs: | |
320 | // Float_t eta // eta of center of tower in pseudorapidity | |
321 | // Float_t phi // phi of center of tower in degrees | |
322 | // Returned | |
323 | // none. | |
324 | Int_t ieta, iphi, ipre ; | |
325 | Float_t deta, dphi ; | |
326 | ||
327 | TowerIndexes(index,ieta,iphi,ipre); | |
328 | ||
329 | if (gDebug == 2) | |
330 | Info("EtaPhiFromIndex","index = %d, ieta = %d, iphi = %d", index, ieta, iphi) ; | |
331 | ||
332 | deta = (GetArm1EtaMax()-GetArm1EtaMin())/(static_cast<Float_t>(GetNEta())); | |
333 | eta = GetArm1EtaMin() + ((static_cast<Float_t>(ieta) - 0.5 ))*deta; | |
334 | ||
335 | dphi = (GetArm1PhiMax() - GetArm1PhiMin())/(static_cast<Float_t>(GetNPhi())); // in degrees. | |
336 | phi = GetArm1PhiMin() + dphi*(static_cast<Float_t>(iphi) - 0.5);//iphi range [1-fNphi]. | |
337 | } | |
338 | ||
339 | //______________________________________________________________________ | |
340 | Int_t AliEMCALGeometry::TowerIndexFromEtaPhi(Float_t eta,Float_t phi) const { | |
341 | // returns the tower index number based on the eta and phi of the tower. | |
342 | // Inputs: | |
343 | // Float_t eta // eta of center of tower in pseudorapidity | |
344 | // Float_t phi // phi of center of tower in degrees | |
345 | // Outputs: | |
346 | // none. | |
347 | // Returned | |
348 | // Int_t index // Tower index number [1-fNZ*fNPhi] | |
349 | ||
350 | Int_t ieta,iphi; | |
351 | ||
352 | ieta = static_cast<Int_t> ( 1 + (static_cast<Float_t>(GetNEta()) * (eta - GetArm1EtaMin()) / (GetArm1EtaMax() - GetArm1EtaMin())) ) ; | |
353 | ||
354 | if( ieta <= 0 || ieta > GetNEta() ) { | |
355 | Error("TowerIndexFromEtaPhi", "Unexpected (eta, phi) = (%f, %f) value, outside of EMCAL!", eta, phi) ; | |
356 | return -1 ; | |
357 | } | |
358 | ||
359 | iphi = static_cast<Int_t> ( 1 + (static_cast<Float_t>(GetNPhi()) * (phi - GetArm1PhiMin()) / (GetArm1PhiMax() - GetArm1PhiMin())) ) ; | |
360 | ||
361 | if( iphi <= 0 || iphi > GetNPhi() ) { | |
362 | Error("TowerIndexFromEtaPhi", "Unexpected (eta, phi) = (%f, %f) value, outside of EMCAL!", eta, phi) ; | |
363 | return -1 ; | |
364 | } | |
365 | ||
366 | return TowerIndex(ieta,iphi); | |
367 | } | |
368 | ||
369 | //______________________________________________________________________ | |
370 | Int_t AliEMCALGeometry::PreTowerIndexFromEtaPhi(Float_t eta,Float_t phi) const { | |
371 | // returns the pretower index number based on the eta and phi of the tower. | |
372 | // Inputs: | |
373 | // Float_t eta // eta of center of tower in pseudorapidity | |
374 | // Float_t phi // phi of center of tower in degrees | |
375 | // Outputs: | |
376 | // none. | |
377 | // Returned | |
378 | // Int_t index // PreTower index number [fNZ*fNPhi-2*fNZ*fNPhi] | |
379 | ||
380 | return GetNEta()*GetNPhi()+TowerIndexFromEtaPhi(eta,phi); | |
381 | } | |
382 | ||
383 | //______________________________________________________________________ | |
384 | Bool_t AliEMCALGeometry::AbsToRelNumbering(Int_t AbsId, Int_t *relid) const { | |
385 | // Converts the absolute numbering into the following array/ | |
386 | // relid[0] = EMCAL Arm number 1:1 | |
387 | // relid[1] = 0 ECAL section ; = 1 PRE section; = 2 HCA section | |
388 | // relid[2] = Row number inside EMCAL | |
389 | // relid[3] = Column number inside EMCAL | |
390 | // Input: | |
391 | // Int_t AbsId // Tower index number [1-2*fNZ*fNPhi] | |
392 | // Outputs: | |
393 | // Int_t *relid // array of 5. Discribed above. | |
394 | Bool_t rv = kTRUE ; | |
395 | Int_t ieta=0,iphi=0,ipre=0,index=AbsId; | |
396 | ||
397 | TowerIndexes(index,ieta,iphi,ipre); | |
398 | relid[0] = 1; | |
399 | relid[1] = ipre; | |
400 | relid[2] = ieta; | |
401 | relid[3] = iphi; | |
402 | ||
403 | return rv; | |
404 | } | |
405 | ||
406 | //______________________________________________________________________ | |
407 | void AliEMCALGeometry::PosInAlice(const Int_t *relid, Float_t &theta, Float_t &phi) const | |
408 | { | |
409 | // Converts the relative numbering into the local EMCAL-module (x, z) | |
410 | // coordinates | |
411 | Int_t sect = relid[1]; // PRE/ECAL/HCAL section 1/0/2 | |
412 | Int_t ieta = relid[2]; // offset along x axis | |
413 | Int_t iphi = relid[3]; // offset along z axis | |
414 | Int_t index; | |
415 | Float_t eta; | |
416 | ||
417 | index = TowerIndex(ieta,iphi); | |
418 | EtaPhiFromIndex(index,eta,phi); | |
419 | theta = 180.*(2.0*TMath::ATan(TMath::Exp(-eta)))/TMath::Pi(); | |
420 | ||
421 | // correct for distance to IP different in PRE/ECAL/HCAL | |
422 | Float_t d = 0. ; | |
423 | if (sect == 1) | |
424 | d = GetIP2PRESection() - GetIPDistance() ; | |
425 | else if (sect == 0) | |
426 | d = GetIP2ECALSection() - GetIPDistance() ; | |
427 | else if (sect == 2) | |
428 | d = GetIP2HCALSection() - GetIPDistance() ; | |
429 | else | |
430 | Fatal("PosInAlice", "Unexpected tower section!") ; | |
431 | ||
432 | Float_t correction = 1 + d/GetIPDistance() ; | |
433 | Float_t tantheta = TMath::Tan(theta) * correction ; | |
434 | theta = TMath::ATan(tantheta) * TMath::RadToDeg() ; | |
435 | if (theta < 0 ) | |
436 | theta += 180. ; | |
437 | ||
438 | return; | |
439 | } | |
440 | ||
441 | //______________________________________________________________________ | |
442 | void AliEMCALGeometry::PosInAlice(const Int_t absid, Float_t &theta, Float_t &phi) const | |
443 | { | |
444 | // Converts the relative numbering into the local EMCAL-module (x, z) | |
445 | // coordinates | |
446 | ||
447 | Int_t relid[4] ; | |
448 | AbsToRelNumbering(absid, relid) ; | |
449 | Int_t ieta = relid[2]; // offset along x axis | |
450 | Int_t iphi = relid[3]; // offset along z axis | |
451 | Int_t index; | |
452 | Float_t eta; | |
453 | ||
454 | index = TowerIndex(ieta,iphi); | |
455 | EtaPhiFromIndex(index,eta,phi); | |
456 | theta = 2.0*TMath::ATan(TMath::Exp(-eta)) ; | |
457 | ||
458 | // correct for distance to IP different in PRE/ECAL/HCAL | |
459 | Float_t d = 0. ; | |
460 | if (IsInPRE(absid)) | |
461 | d = GetIP2PRESection() - GetIPDistance() ; | |
462 | else if (IsInECAL(absid)) | |
463 | d = GetIP2ECALSection() - GetIPDistance() ; | |
464 | else if (IsInHCAL(absid)) | |
465 | d = GetIP2HCALSection() - GetIPDistance() ; | |
466 | else | |
467 | Fatal("PosInAlice", "Unexpected id # %d!", absid) ; | |
468 | ||
469 | Float_t correction = 1 + d/GetIPDistance() ; | |
470 | Float_t tantheta = TMath::Tan(theta) * correction ; | |
471 | theta = TMath::ATan(tantheta) * TMath::RadToDeg() ; | |
472 | if (theta < 0 ) | |
473 | theta += 180. ; | |
474 | ||
475 | return; | |
476 | } | |
477 | ||
478 | //______________________________________________________________________ | |
479 | void AliEMCALGeometry::XYZFromIndex(const Int_t *relid,Float_t &x,Float_t &y, Float_t &z) const { | |
480 | // given the tower relative number it returns the X, Y and Z | |
481 | // of the tower. | |
482 | ||
483 | // Outputs: | |
484 | // Float_t x // x of center of tower in cm | |
485 | // Float_t y // y of center of tower in cm | |
486 | // Float_t z // z of centre of tower in cm | |
487 | // Returned | |
488 | // none. | |
489 | ||
490 | Float_t eta,theta, phi,cyl_radius=0. ; | |
491 | ||
492 | Int_t ieta = relid[2]; // offset along x axis | |
493 | Int_t iphi = relid[3]; // offset along z axis | |
494 | Int_t ipre = relid[1]; // indicates 0 ECAL section, 1 PRE section, 2 HCAL section. | |
495 | Int_t index; | |
496 | ||
497 | index = TowerIndex(ieta,iphi); | |
498 | EtaPhiFromIndex(index,eta,phi); | |
499 | theta = 180.*(2.0*TMath::ATan(TMath::Exp(-eta)))/TMath::Pi(); | |
500 | ||
501 | if ( ipre == 0 ) | |
502 | cyl_radius = GetIP2ECALSection() ; | |
503 | else if ( ipre == 1 ) | |
504 | cyl_radius = GetIP2PRESection() ; | |
505 | else if ( ipre == 2 ) | |
506 | cyl_radius = GetIP2HCALSection() ; | |
507 | else | |
508 | Fatal("XYZFromIndex", "Unexpected Tower section # %d", ipre) ; | |
509 | ||
510 | Double_t kDeg2Rad = TMath::DegToRad() ; | |
511 | x = cyl_radius * TMath::Cos(phi * kDeg2Rad ) ; | |
512 | y = cyl_radius * TMath::Sin(phi * kDeg2Rad ) ; | |
513 | z = cyl_radius / TMath::Tan(theta * kDeg2Rad ) ; | |
514 | ||
515 | return; | |
516 | } | |
517 | ||
518 | //______________________________________________________________________ | |
519 | void AliEMCALGeometry::XYZFromIndex(const Int_t absid, TVector3 &v) const { | |
520 | // given the tower relative number it returns the X, Y and Z | |
521 | // of the tower. | |
522 | ||
523 | // Outputs: | |
524 | // Float_t x // x of center of tower in cm | |
525 | // Float_t y // y of center of tower in cm | |
526 | // Float_t z // z of centre of tower in cm | |
527 | // Returned | |
528 | // none. | |
529 | ||
530 | Float_t theta, phi,cyl_radius=0. ; | |
531 | ||
532 | PosInAlice(absid, theta, phi) ; | |
533 | ||
534 | if ( IsInECAL(absid) ) | |
535 | cyl_radius = GetIP2ECALSection() ; | |
536 | else if ( IsInPRE(absid) ) | |
537 | cyl_radius = GetIP2PRESection() ; | |
538 | else if ( IsInHCAL(absid) ) | |
539 | cyl_radius = GetIP2HCALSection() ; | |
540 | else | |
541 | Fatal("XYZFromIndex", "Unexpected Tower section") ; | |
542 | ||
543 | Double_t kDeg2Rad = TMath::DegToRad() ; | |
544 | v.SetX(cyl_radius * TMath::Cos(phi * kDeg2Rad ) ); | |
545 | v.SetY(cyl_radius * TMath::Sin(phi * kDeg2Rad ) ); | |
546 | v.SetZ(cyl_radius / TMath::Tan(theta * kDeg2Rad ) ) ; | |
547 | ||
548 | return; | |
549 | } | |
550 | ||
551 | //______________________________________________________________________ | |
552 | /* | |
553 | Boot_t AliEMCALGeometry::AreNeighbours(Int_t index1,Int_t index2) const { | |
554 | // Returns kTRUE if the two towers are neighbours or not, including | |
555 | // diagonals. Both indexes are required to be either towers or preshower. | |
556 | // Inputs: | |
557 | // Int_t index1 // index of tower 1 | |
558 | // Int_t index2 // index of tower 2 | |
559 | // Outputs: | |
560 | // none. | |
561 | // Returned | |
562 | // Boot_t kTRUE if the towers are neighbours otherwise false. | |
563 | Boot_t anb = kFALSE; | |
564 | Int_t ieta1 = 0, ieta2 = 0, iphi1 = 0, iphi2 = 0, ipre1 = 0, ipre2 = 0; | |
565 | ||
566 | TowerIndexes(index1,ieta1,iphi1,ipre1); | |
567 | TowerIndexes(index2,ieta2,iphi2,ipre2); | |
568 | if(ipre1!=ipre2) return anb; | |
569 | if((ieta1>=ieta2-1 && ieta1<=ieta2+1) && (iphi1>=iphi2-1 &&iphi1<=iphi2+1)) | |
570 | anb = kTRUE; | |
571 | return anb; | |
572 | } | |
573 | */ |