]>
Commit | Line | Data |
---|---|---|
d15a28e7 | 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 | //_________________________________________________________________________ | |
17 | // Geometry class for PHOS version SUBATECH | |
18 | //*-- Author : Y. Schutz SUBATECH | |
19 | ////////////////////////////////////////////////////////////////////////////// | |
20 | ||
21 | // --- ROOT system --- | |
22 | ||
23 | #include "TVector3.h" | |
24 | #include "TRotation.h" | |
25 | ||
26 | // --- Standard library --- | |
27 | ||
9f616d61 | 28 | #include <iostream> |
29 | #include <cassert> | |
d15a28e7 | 30 | |
31 | // --- AliRoot header files --- | |
32 | ||
33 | #include "AliPHOSGeometry.h" | |
34 | #include "AliPHOSPpsdRecPoint.h" | |
35 | #include "AliConst.h" | |
36 | ||
37 | ClassImp(AliPHOSGeometry) | |
38 | ||
39 | AliPHOSGeometry * AliPHOSGeometry::fGeom = 0 ; | |
40 | ||
41 | //____________________________________________________________________________ | |
42 | AliPHOSGeometry::~AliPHOSGeometry(void) | |
43 | { | |
44 | fRotMatrixArray->Delete() ; | |
45 | delete fRotMatrixArray ; | |
46 | } | |
47 | ||
48 | //____________________________________________________________________________ | |
49 | Bool_t AliPHOSGeometry::AbsToRelNumbering(const Int_t AbsId, Int_t * RelId) | |
50 | { | |
51 | // RelId[0] = PHOS Module number 1:fNModules | |
52 | // RelId[1] = 0 if PbW04 | |
53 | // = PPSD Module number 1:fNumberOfModulesPhi*fNumberOfModulesZ*2 (2->up and bottom level) | |
54 | // RelId[2] = Row number inside a PHOS or PPSD module | |
55 | // RelId[3] = Column number inside a PHOS or PPSD module | |
56 | ||
57 | Bool_t rv = kTRUE ; | |
58 | Float_t Id = AbsId ; | |
59 | ||
60 | Int_t PHOSModuleNumber = (Int_t)TMath:: Ceil( Id / ( GetNPhi() * GetNZ() ) ) ; | |
61 | ||
62 | if ( PHOSModuleNumber > GetNModules() ) { // its a PPSD pad | |
63 | ||
64 | Id -= GetNPhi() * GetNZ() * GetNModules() ; | |
65 | Float_t tempo = 2 * GetNumberOfModulesPhi() * GetNumberOfModulesZ() * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ; | |
66 | RelId[0] = (Int_t)TMath::Ceil( Id / tempo ) ; | |
67 | Id -= ( RelId[0] - 1 ) * tempo ; | |
68 | RelId[1] = (Int_t)TMath::Ceil( Id / ( GetNumberOfPadsPhi() * GetNumberOfPadsZ() ) ) ; | |
69 | Id -= ( RelId[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ; | |
70 | RelId[2] = (Int_t)TMath::Ceil( Id / GetNumberOfPadsPhi() ) ; | |
71 | RelId[3] = (Int_t) ( Id - ( RelId[2] - 1 ) * GetNumberOfPadsPhi() ) ; | |
72 | } | |
73 | else { // its a PW04 crystal | |
74 | ||
75 | RelId[0] = PHOSModuleNumber ; | |
76 | RelId[1] = 0 ; | |
77 | Id -= ( PHOSModuleNumber - 1 ) * GetNPhi() * GetNZ() ; | |
78 | RelId[2] = (Int_t)TMath::Ceil( Id / GetNPhi() ) ; | |
79 | RelId[3] = (Int_t)( Id - ( RelId[2] - 1 ) * GetNPhi() ) ; | |
80 | } | |
81 | return rv ; | |
82 | } | |
9f616d61 | 83 | //____________________________________________________________________________ |
84 | void AliPHOSGeometry::EmcModuleCoverage(const Int_t mod, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt) | |
85 | { | |
86 | // calculates the angular coverage in theta and phi of a EMC module | |
87 | ||
88 | Double_t conv ; | |
89 | if ( opt == kRadian ) | |
90 | conv = 1. ; | |
91 | else if ( opt == kDegre ) | |
92 | conv = 180. / TMath::Pi() ; | |
93 | else { | |
94 | cout << "<I> AliPHOSGeometry::EmcXtalCoverage : " << opt << " unknown option; result in radian " << endl ; | |
95 | conv = 1. ; | |
96 | } | |
97 | ||
98 | Float_t phi = GetPHOSAngle(mod) * (TMath::Pi() / 180.) ; | |
99 | Float_t Y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness() | |
100 | + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ; | |
101 | ||
102 | Double_t angle = TMath::ATan( GetCrystalSize(0)*GetNPhi() / (2 * Y0) ) ; | |
103 | phi = phi + 1.5 * TMath::Pi() ; // to follow the convention of the particle generator(PHOS is between 230 and 310 deg.) | |
104 | Double_t m = phi - angle ; | |
105 | Double_t M = phi + angle ; | |
106 | pM = TMath::Max(M, m) * conv ; | |
107 | pm = TMath::Min(M, m) * conv ; | |
108 | ||
109 | angle = TMath::ATan( GetCrystalSize(2)*GetNZ() / (2 * Y0) ) ; | |
110 | M = TMath::Pi() / 2. + angle ; // to follow the convention of the particle generator(PHOS is at 90 deg.) | |
111 | m = TMath::Pi() / 2. - angle ; | |
112 | tM = TMath::Max(M, m) * conv ; | |
113 | tm = TMath::Min(M, m) * conv ; | |
114 | ||
115 | } | |
116 | ||
117 | //____________________________________________________________________________ | |
118 | void AliPHOSGeometry::EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt) | |
119 | { | |
120 | // calculates the angular coverage in theta and phi of a single crystal in a EMC module | |
121 | ||
122 | Double_t conv ; | |
123 | if ( opt == kRadian ) | |
124 | conv = 1. ; | |
125 | else if ( opt == kDegre ) | |
126 | conv = 180. / TMath::Pi() ; | |
127 | else { | |
128 | cout << "<I> AliPHOSGeometry::EmcXtalCoverage : " << opt << " unknown option; result in radian " << endl ; | |
129 | conv = 1. ; | |
130 | } | |
131 | ||
132 | Float_t Y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness() | |
133 | + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ; | |
134 | theta = 2 * TMath::ATan( GetCrystalSize(2) / (2 * Y0) ) * conv ; | |
135 | phi = 2 * TMath::ATan( GetCrystalSize(0) / (2 * Y0) ) * conv ; | |
136 | } | |
137 | ||
138 | ||
139 | //____________________________________________________________________________ | |
140 | void AliPHOSGeometry::ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & z, Double_t & x) | |
141 | { | |
142 | // calculates the impact coordinates of a neutral particle | |
143 | // emitted in direction theta and phi in ALICE | |
144 | ||
145 | // searches for the PHOS EMC module | |
146 | ModuleNumber = 0 ; | |
147 | Double_t tm, tM, pm, pM ; | |
148 | Int_t index = 1 ; | |
149 | while ( ModuleNumber == 0 && index <= GetNModules() ) { | |
150 | EmcModuleCoverage(index, tm, tM, pm, pM) ; | |
151 | if ( (theta >= tm && theta <= tM) && (phi >= pm && phi <= pM ) ) | |
152 | ModuleNumber = index ; | |
153 | index++ ; | |
154 | } | |
155 | if ( ModuleNumber != 0 ) { | |
156 | Float_t phi0 = GetPHOSAngle(ModuleNumber) * (TMath::Pi() / 180.) + 1.5 * TMath::Pi() ; | |
157 | Float_t Y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness() | |
158 | + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ; | |
159 | Double_t angle = phi - phi0; | |
160 | x = Y0 * TMath::Tan(angle) ; | |
161 | angle = theta - TMath::Pi() / 2 ; | |
162 | z = Y0 * TMath::Tan(angle) ; | |
163 | } | |
164 | } | |
d15a28e7 | 165 | |
166 | //____________________________________________________________________________ | |
167 | void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat) | |
168 | { | |
169 | ||
170 | AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ; | |
171 | TVector3 LocalPosition ; | |
172 | ||
173 | tmpPHOS->GetLocalPosition(gpos) ; | |
174 | ||
175 | ||
176 | if ( tmpPHOS->IsEmc() ) // it is a EMC crystal | |
177 | { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() + | |
178 | GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ; | |
179 | ||
180 | } | |
181 | else | |
182 | { // it is a PPSD pad | |
183 | AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ; | |
184 | if (tmpPpsd->GetUp() ) // it is an upper module | |
185 | { | |
186 | gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - | |
187 | GetLeadToMicro2Gap() - GetLeadConverterThickness() - | |
188 | GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ; | |
189 | } | |
190 | else // it is a lower module | |
191 | gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ; | |
192 | } | |
193 | ||
194 | Float_t Phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ; | |
195 | Double_t const RADDEG = 180.0 / kPI ; | |
196 | Float_t rPhi = Phi / RADDEG ; | |
197 | ||
198 | TRotation Rot ; | |
199 | Rot.RotateZ(-rPhi) ; // a rotation around Z by angle | |
200 | ||
201 | TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame | |
202 | gpos.Transform(Rot) ; // rotate the baby | |
203 | } | |
204 | ||
205 | //____________________________________________________________________________ | |
206 | void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) | |
207 | { | |
208 | AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ; | |
209 | TVector3 LocalPosition ; | |
210 | tmpPHOS->GetLocalPosition(gpos) ; | |
211 | ||
212 | ||
213 | if ( tmpPHOS->IsEmc() ) // it is a EMC crystal | |
214 | { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() + | |
215 | GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ; | |
216 | } | |
217 | else | |
218 | { // it is a PPSD pad | |
219 | AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ; | |
220 | if (tmpPpsd->GetUp() ) // it is an upper module | |
221 | { | |
222 | gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - | |
223 | GetLeadToMicro2Gap() - GetLeadConverterThickness() - | |
224 | GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ; | |
225 | } | |
226 | else // it is a lower module | |
227 | gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ; | |
228 | } | |
229 | ||
230 | Float_t Phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ; | |
231 | Double_t const RADDEG = 180.0 / kPI ; | |
232 | Float_t rPhi = Phi / RADDEG ; | |
233 | ||
234 | TRotation Rot ; | |
235 | Rot.RotateZ(-rPhi) ; // a rotation around Z by angle | |
236 | ||
237 | TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame | |
238 | gpos.Transform(Rot) ; // rotate the baby | |
239 | } | |
240 | ||
241 | //____________________________________________________________________________ | |
242 | void AliPHOSGeometry::Init(void) | |
243 | { | |
244 | fRotMatrixArray = new TObjArray(fNModules) ; | |
245 | ||
246 | cout << "PHOS geometry setup: parameters for option " << fName << " " << fTitle << endl ; | |
247 | if ( ((strcmp( fName, "default" )) == 0) || ((strcmp( fName, "GPS2" )) == 0) ) { | |
248 | fInit = kTRUE ; | |
249 | this->InitPHOS() ; | |
250 | this->InitPPSD() ; | |
251 | this->SetPHOSAngles() ; | |
252 | } | |
253 | else { | |
254 | fInit = kFALSE ; | |
255 | cout << "PHOS Geometry setup: option not defined " << fName << endl ; | |
256 | } | |
257 | } | |
258 | ||
259 | //____________________________________________________________________________ | |
260 | void AliPHOSGeometry::InitPHOS(void) | |
261 | { | |
262 | // PHOS | |
263 | ||
264 | fNPhi = 64 ; | |
265 | fNZ = 64 ; | |
266 | fNModules = 5 ; | |
267 | ||
268 | fPHOSAngle[0] = 0.0 ; // Module position angles are set in CreateGeometry() | |
269 | fPHOSAngle[1] = 0.0 ; | |
270 | fPHOSAngle[2] = 0.0 ; | |
271 | fPHOSAngle[3] = 0.0 ; | |
272 | ||
273 | fXtlSize[0] = 2.2 ; | |
274 | fXtlSize[1] = 18.0 ; | |
275 | fXtlSize[2] = 2.2 ; | |
276 | ||
277 | // all these numbers coming next are subject to changes | |
278 | ||
279 | fOuterBoxThickness[0] = 2.8 ; | |
280 | fOuterBoxThickness[1] = 5.0 ; | |
281 | fOuterBoxThickness[2] = 5.0 ; | |
282 | ||
283 | fUpperPlateThickness = 4.0 ; | |
284 | ||
285 | fSecondUpperPlateThickness = 5.0 ; | |
286 | ||
287 | fCrystalSupportHeight = 6.95 ; | |
288 | fCrystalWrapThickness = 0.01 ; | |
289 | fCrystalHolderThickness = 0.005 ; | |
290 | fModuleBoxThickness = 2.0 ; | |
291 | fIPtoOuterCoverDistance = 447.0 ; | |
292 | fIPtoCrystalSurface = 460.0 ; | |
293 | ||
294 | fPinDiodeSize[0] = 1.0 ; | |
295 | fPinDiodeSize[1] = 0.1 ; | |
296 | fPinDiodeSize[2] = 1.0 ; | |
297 | ||
298 | fUpperCoolingPlateThickness = 0.06 ; | |
299 | fSupportPlateThickness = 10.0 ; | |
300 | fLowerThermoPlateThickness = 3.0 ; | |
301 | fLowerTextolitPlateThickness = 1.0 ; | |
302 | fGapBetweenCrystals = 0.03 ; | |
303 | ||
304 | fTextolitBoxThickness[0] = 1.5 ; | |
305 | fTextolitBoxThickness[1] = 0.0 ; | |
306 | fTextolitBoxThickness[2] = 3.0 ; | |
307 | ||
308 | fAirThickness[0] = 1.56 ; | |
309 | fAirThickness[1] = 20.5175 ; | |
310 | fAirThickness[2] = 2.48 ; | |
311 | ||
312 | Float_t XtalModulePhiSize = fNPhi * ( fXtlSize[0] + 2 * fGapBetweenCrystals ) ; | |
313 | Float_t XtalModuleZSize = fNZ * ( fXtlSize[2] + 2 * fGapBetweenCrystals ) ; | |
314 | ||
315 | // The next dimensions are calculated from the above parameters | |
316 | ||
317 | fOuterBoxSize[0] = XtalModulePhiSize + 2 * ( fAirThickness[0] + fModuleBoxThickness | |
318 | + fTextolitBoxThickness[0] + fOuterBoxThickness[0] ) ; | |
319 | fOuterBoxSize[1] = ( fXtlSize[1] + fCrystalSupportHeight + fCrystalWrapThickness + fCrystalHolderThickness ) | |
320 | + 2 * (fAirThickness[1] + fModuleBoxThickness + fTextolitBoxThickness[1] + fOuterBoxThickness[1] ) ; | |
321 | fOuterBoxSize[2] = XtalModuleZSize + 2 * ( fAirThickness[2] + fModuleBoxThickness | |
322 | + fTextolitBoxThickness[2] + fOuterBoxThickness[2] ) ; | |
323 | ||
324 | fTextolitBoxSize[0] = fOuterBoxSize[0] - 2 * fOuterBoxThickness[0] ; | |
325 | fTextolitBoxSize[1] = fOuterBoxSize[1] - fOuterBoxThickness[1] - fUpperPlateThickness ; | |
326 | fTextolitBoxSize[2] = fOuterBoxSize[2] - 2 * fOuterBoxThickness[2] ; | |
327 | ||
328 | fAirFilledBoxSize[0] = fTextolitBoxSize[0] - 2 * fTextolitBoxThickness[0] ; | |
329 | fAirFilledBoxSize[1] = fTextolitBoxSize[1] - fSecondUpperPlateThickness ; | |
330 | fAirFilledBoxSize[2] = fTextolitBoxSize[2] - 2 * fTextolitBoxThickness[2] ; | |
331 | ||
332 | } | |
333 | ||
334 | //____________________________________________________________________________ | |
335 | void AliPHOSGeometry::InitPPSD(void) | |
336 | { | |
337 | // PPSD | |
338 | ||
339 | fAnodeThickness = 0.0009 ; | |
340 | fAvalancheGap = 0.01 ; | |
341 | fCathodeThickness = 0.0009 ; | |
342 | fCompositeThickness = 0.3 ; | |
9f616d61 | 343 | fConversionGap = 0.6 ; |
d15a28e7 | 344 | fLeadConverterThickness = 0.56 ; |
345 | fLeadToMicro2Gap = 0.1 ; | |
346 | fLidThickness = 0.2 ; | |
347 | fMicro1ToLeadGap = 0.1 ; | |
348 | fMicromegasWallThickness = 0.6 ; | |
349 | fNumberOfModulesPhi = 4 ; | |
350 | fNumberOfModulesZ = 4 ; | |
351 | fNumberOfPadsPhi = 24 ; | |
352 | fNumberOfPadsZ = 24 ; | |
353 | fPCThickness = 0.1 ; | |
354 | fPhiDisplacement = 0.8 ; | |
355 | fZDisplacement = 0.8 ; | |
356 | ||
357 | fMicromegas1Thickness = fLidThickness + 2 * fCompositeThickness + fCathodeThickness + fPCThickness | |
358 | + fAnodeThickness + fConversionGap + fAvalancheGap ; | |
359 | fMicromegas2Thickness = fMicromegas1Thickness ; | |
360 | ||
361 | ||
362 | fPPSDModuleSize[0] = 38.0 ; | |
363 | fPPSDModuleSize[1] = fMicromegas1Thickness ; | |
364 | fPPSDModuleSize[2] = 38.0 ; | |
365 | ||
366 | fPPSDBoxSize[0] = fNumberOfModulesPhi * fPPSDModuleSize[0] + 2 * fPhiDisplacement ; | |
367 | fPPSDBoxSize[1] = fMicromegas2Thickness + fMicromegas2Thickness + fLeadConverterThickness + fMicro1ToLeadGap + fLeadToMicro2Gap ; | |
368 | fPPSDBoxSize[2] = fNumberOfModulesZ * fPPSDModuleSize[2] + 2 * fZDisplacement ; | |
369 | ||
370 | fIPtoTopLidDistance = fIPtoOuterCoverDistance - fPPSDBoxSize[1] - 1. ; | |
371 | ||
372 | } | |
373 | ||
374 | //____________________________________________________________________________ | |
375 | AliPHOSGeometry * AliPHOSGeometry::GetInstance() | |
376 | { | |
d15a28e7 | 377 | return (AliPHOSGeometry *) fGeom ; |
378 | } | |
379 | ||
380 | //____________________________________________________________________________ | |
381 | AliPHOSGeometry * AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t* title) | |
382 | { | |
383 | AliPHOSGeometry * rv = 0 ; | |
384 | if ( fGeom == 0 ) { | |
385 | fGeom = new AliPHOSGeometry(name, title) ; | |
386 | rv = (AliPHOSGeometry * ) fGeom ; | |
387 | } | |
388 | else { | |
389 | if ( strcmp(fGeom->GetName(), name) != 0 ) { | |
390 | cout << "AliPHOSGeometry <E> : current geometry is " << fGeom->GetName() << endl | |
391 | << " you cannot call " << name << endl ; | |
392 | } | |
393 | else | |
394 | rv = (AliPHOSGeometry *) fGeom ; | |
395 | } | |
396 | return rv ; | |
397 | } | |
398 | ||
399 | //____________________________________________________________________________ | |
400 | Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) | |
401 | { | |
402 | ||
403 | // AbsId = 1:fNModules * fNPhi * fNZ -> PbWO4 | |
404 | // AbsId = 1:fNModules * 2 * (fNumberOfModulesPhi * fNumberOfModulesZ) * fNumberOfPadsPhi * fNumberOfPadsZ -> PPSD | |
405 | ||
406 | Bool_t rv = kTRUE ; | |
407 | ||
408 | if ( RelId[1] > 0 ) { // its a PPSD pad | |
409 | ||
410 | AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate emcal crystals from PPSD pads | |
411 | + ( RelId[0] - 1 ) * GetNumberOfModulesPhi() * GetNumberOfModulesZ() // the pads offset of PHOS modules | |
412 | * GetNumberOfPadsPhi() * GetNumberOfPadsZ() * 2 | |
413 | + ( RelId[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() // the pads offset of PPSD modules | |
414 | + ( RelId[2] - 1 ) * GetNumberOfPadsPhi() // the pads offset of a PPSD row | |
415 | + RelId[3] ; // the column number | |
416 | } | |
417 | else { | |
418 | if ( RelId[1] == 0 ) { // its a Phos crystal | |
419 | AbsId = ( RelId[0] - 1 ) * GetNPhi() * GetNZ() // the offset of PHOS modules | |
420 | + ( RelId[2] - 1 ) * GetNPhi() // the offset of a xtal row | |
421 | + RelId[3] ; // the column number | |
422 | } | |
423 | } | |
424 | ||
425 | return rv ; | |
426 | } | |
427 | ||
428 | //____________________________________________________________________________ | |
429 | ||
430 | void AliPHOSGeometry::RelPosInAlice(const Int_t Id, TVector3 & pos ) | |
431 | { | |
432 | if (Id > 0) { | |
433 | ||
434 | Int_t RelId[4] ; | |
435 | ||
436 | AbsToRelNumbering(Id , RelId) ; | |
437 | ||
438 | Int_t PHOSModule = RelId[0] ; | |
439 | ||
9f616d61 | 440 | Float_t Y0 ; |
441 | ||
d15a28e7 | 442 | if ( RelId[1] == 0 ) // it is a PbW04 crystal |
9f616d61 | 443 | { Y0 = -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() |
444 | + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ; | |
d15a28e7 | 445 | } |
446 | if ( RelId[1] > 0 ) { // its a PPSD pad | |
447 | if ( RelId[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() ) // its an bottom module | |
448 | { | |
9f616d61 | 449 | Y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ; |
d15a28e7 | 450 | } |
451 | else // its an upper module | |
9f616d61 | 452 | Y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - GetLeadToMicro2Gap() |
453 | - GetLeadConverterThickness() - GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0) ; | |
d15a28e7 | 454 | } |
455 | ||
456 | Float_t x, z ; | |
457 | RelPosInModule(RelId, x, z) ; | |
458 | ||
9f616d61 | 459 | pos.SetX(x) ; |
460 | pos.SetZ(z) ; | |
461 | pos.SetY( TMath::Sqrt(x*x + z*z + Y0*Y0) ) ; | |
462 | ||
d15a28e7 | 463 | |
464 | ||
465 | Float_t Phi = GetPHOSAngle( PHOSModule) ; | |
466 | Double_t const RADDEG = 180.0 / kPI ; | |
467 | Float_t rPhi = Phi / RADDEG ; | |
468 | ||
469 | TRotation Rot ; | |
470 | Rot.RotateZ(-rPhi) ; // a rotation around Z by angle | |
471 | ||
472 | TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame | |
473 | ||
474 | pos.Transform(Rot) ; // rotate the baby | |
475 | } | |
476 | else { | |
477 | pos.SetX(0.); | |
478 | pos.SetY(0.); | |
479 | pos.SetZ(0.); | |
480 | } | |
481 | } | |
482 | ||
483 | //____________________________________________________________________________ | |
484 | void AliPHOSGeometry::RelPosInModule(const Int_t * RelId, Float_t & x, Float_t & z) | |
485 | { | |
486 | Int_t PPSDModule ; | |
487 | Int_t Row = RelId[2] ; //offset along z axiz | |
488 | Int_t Column = RelId[3] ; //offset along x axiz | |
489 | ||
490 | Float_t PadSizeZ = GetPPSDModuleSize(2)/ GetNumberOfPadsZ(); | |
491 | Float_t PadSizeX = GetPPSDModuleSize(0)/ GetNumberOfPadsPhi(); | |
492 | ||
493 | if ( RelId[1] == 0 ) { // its a PbW04 crystal | |
494 | x = -( GetNPhi()/2. - Row + 0.5 ) * GetCrystalSize(0) ; // position ox Xtal with respect | |
495 | z = -( GetNZ() /2. - Column + 0.5 ) * GetCrystalSize(2) ; // of center of PHOS module | |
496 | } | |
497 | else { | |
498 | if ( RelId[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() ) | |
499 | PPSDModule = RelId[1]-GetNumberOfModulesPhi() * GetNumberOfModulesZ(); | |
500 | else PPSDModule = RelId[1] ; | |
501 | Int_t ModRow = 1+(Int_t)TMath::Ceil( (Float_t)PPSDModule / GetNumberOfModulesPhi()-1. ) ; | |
502 | Int_t ModCol = PPSDModule - ( ModRow-1 ) * GetNumberOfModulesPhi() ; | |
503 | Float_t x0 = ( GetNumberOfModulesPhi() / 2. - ModRow + 0.5 ) * GetPPSDModuleSize(0) ; | |
504 | Float_t z0 = ( GetNumberOfModulesZ() / 2. - ModCol + 0.5 ) * GetPPSDModuleSize(2) ; | |
505 | x = - ( GetNumberOfPadsPhi()/2. - Row - 0.5 ) * PadSizeX + x0 ; // position of pad with respect | |
506 | z = - ( GetNumberOfPadsZ()/2. - Column - 0.5 ) * PadSizeZ + z0 ; // of center of PHOS module | |
507 | } | |
508 | } | |
509 | ||
510 | //____________________________________________________________________________ | |
511 | void AliPHOSGeometry:: SetPHOSAngles() | |
512 | { | |
513 | Double_t const RADDEG = 180.0 / kPI ; | |
514 | Float_t PPHI = TMath::ATan( fOuterBoxSize[0] / ( 2.0 * fIPtoOuterCoverDistance ) ) ; | |
515 | PPHI *= RADDEG ; | |
516 | ||
517 | for( Int_t i = 1; i <= fNModules ; i++ ) { | |
518 | Float_t angle = PPHI * 2 * ( i - fNModules / 2.0 - 0.5 ) ; | |
519 | fPHOSAngle[i-1] = - angle ; | |
520 | } | |
521 | } | |
522 |