Merged ITS-working with HEAD. Improved some of the documentation and
[u/mrichter/AliRoot.git] / PHOS / AliPHOSGeometry.cxx
CommitLineData
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
37ClassImp(AliPHOSGeometry)
38
39 AliPHOSGeometry * AliPHOSGeometry::fGeom = 0 ;
40
41//____________________________________________________________________________
42AliPHOSGeometry::~AliPHOSGeometry(void)
43{
44 fRotMatrixArray->Delete() ;
45 delete fRotMatrixArray ;
46}
47
48//____________________________________________________________________________
92862013 49Bool_t AliPHOSGeometry::AbsToRelNumbering(const Int_t AbsId, Int_t * relid)
d15a28e7 50{
92862013 51 // relid[0] = PHOS Module number 1:fNModules
52 // relid[1] = 0 if PbW04
d15a28e7 53 // = PPSD Module number 1:fNumberOfModulesPhi*fNumberOfModulesZ*2 (2->up and bottom level)
92862013 54 // relid[2] = Row number inside a PHOS or PPSD module
55 // relid[3] = Column number inside a PHOS or PPSD module
d15a28e7 56
57 Bool_t rv = kTRUE ;
92862013 58 Float_t id = AbsId ;
d15a28e7 59
92862013 60 Int_t phosmodulenumber = (Int_t)TMath:: Ceil( id / ( GetNPhi() * GetNZ() ) ) ;
d15a28e7 61
92862013 62 if ( phosmodulenumber > GetNModules() ) { // its a PPSD pad
d15a28e7 63
92862013 64 id -= GetNPhi() * GetNZ() * GetNModules() ;
d15a28e7 65 Float_t tempo = 2 * GetNumberOfModulesPhi() * GetNumberOfModulesZ() * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ;
92862013 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() ) ;
d15a28e7 72 }
73 else { // its a PW04 crystal
74
92862013 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() ) ;
d15a28e7 80 }
81 return rv ;
82}
9f616d61 83//____________________________________________________________________________
84void 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.) ;
92862013 99 Float_t y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness()
9f616d61 100 + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ;
101
92862013 102 Double_t angle = TMath::ATan( GetCrystalSize(0)*GetNPhi() / (2 * y0) ) ;
9f616d61 103 phi = phi + 1.5 * TMath::Pi() ; // to follow the convention of the particle generator(PHOS is between 230 and 310 deg.)
92862013 104 Double_t max = phi - angle ;
105 Double_t min = phi + angle ;
106 pM = TMath::Max(max, min) * conv ;
107 pm = TMath::Min(max, min) * conv ;
9f616d61 108
92862013 109 angle = TMath::ATan( GetCrystalSize(2)*GetNZ() / (2 * y0) ) ;
110 max = TMath::Pi() / 2. + angle ; // to follow the convention of the particle generator(PHOS is at 90 deg.)
111 min = TMath::Pi() / 2. - angle ;
112 tM = TMath::Max(max, min) * conv ;
113 tm = TMath::Min(max, min) * conv ;
9f616d61 114
115}
116
117//____________________________________________________________________________
118void 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
92862013 132 Float_t y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness()
9f616d61 133 + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ;
92862013 134 theta = 2 * TMath::ATan( GetCrystalSize(2) / (2 * y0) ) * conv ;
135 phi = 2 * TMath::ATan( GetCrystalSize(0) / (2 * y0) ) * conv ;
9f616d61 136}
137
138
139//____________________________________________________________________________
140void 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() ;
92862013 157 Float_t y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness()
9f616d61 158 + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ;
159 Double_t angle = phi - phi0;
92862013 160 x = y0 * TMath::Tan(angle) ;
9f616d61 161 angle = theta - TMath::Pi() / 2 ;
92862013 162 z = y0 * TMath::Tan(angle) ;
9f616d61 163 }
164}
d15a28e7 165
166//____________________________________________________________________________
167void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat)
168{
169
170 AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ;
92862013 171 TVector3 localposition ;
d15a28e7 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
92862013 194 Float_t phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ;
195 Double_t const kRADDEG = 180.0 / kPI ;
196 Float_t rphi = phi / kRADDEG ;
d15a28e7 197
92862013 198 TRotation rot ;
199 rot.RotateZ(-rphi) ; // a rotation around Z by angle
d15a28e7 200
92862013 201 TRotation dummy = rot.Invert() ; // to transform from original frame to rotate frame
202 gpos.Transform(rot) ; // rotate the baby
6ad0bfa0 203
d15a28e7 204}
205
206//____________________________________________________________________________
207void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos)
208{
209 AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ;
92862013 210 TVector3 localposition ;
d15a28e7 211 tmpPHOS->GetLocalPosition(gpos) ;
212
213
214 if ( tmpPHOS->IsEmc() ) // it is a EMC crystal
215 { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() +
216 GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ;
217 }
218 else
219 { // it is a PPSD pad
220 AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ;
221 if (tmpPpsd->GetUp() ) // it is an upper module
222 {
223 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() -
224 GetLeadToMicro2Gap() - GetLeadConverterThickness() -
225 GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ;
226 }
227 else // it is a lower module
228 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ;
229 }
230
92862013 231 Float_t phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ;
232 Double_t const kRADDEG = 180.0 / kPI ;
233 Float_t rphi = phi / kRADDEG ;
d15a28e7 234
92862013 235 TRotation rot ;
236 rot.RotateZ(-rphi) ; // a rotation around Z by angle
d15a28e7 237
92862013 238 TRotation dummy = rot.Invert() ; // to transform from original frame to rotate frame
239 gpos.Transform(rot) ; // rotate the baby
d15a28e7 240}
241
242//____________________________________________________________________________
243void AliPHOSGeometry::Init(void)
244{
245 fRotMatrixArray = new TObjArray(fNModules) ;
246
247 cout << "PHOS geometry setup: parameters for option " << fName << " " << fTitle << endl ;
248 if ( ((strcmp( fName, "default" )) == 0) || ((strcmp( fName, "GPS2" )) == 0) ) {
249 fInit = kTRUE ;
250 this->InitPHOS() ;
251 this->InitPPSD() ;
252 this->SetPHOSAngles() ;
253 }
254 else {
255 fInit = kFALSE ;
256 cout << "PHOS Geometry setup: option not defined " << fName << endl ;
257 }
258}
259
260//____________________________________________________________________________
261void AliPHOSGeometry::InitPHOS(void)
262{
263 // PHOS
264
265 fNPhi = 64 ;
266 fNZ = 64 ;
267 fNModules = 5 ;
268
269 fPHOSAngle[0] = 0.0 ; // Module position angles are set in CreateGeometry()
270 fPHOSAngle[1] = 0.0 ;
271 fPHOSAngle[2] = 0.0 ;
272 fPHOSAngle[3] = 0.0 ;
273
274 fXtlSize[0] = 2.2 ;
275 fXtlSize[1] = 18.0 ;
276 fXtlSize[2] = 2.2 ;
277
278 // all these numbers coming next are subject to changes
279
280 fOuterBoxThickness[0] = 2.8 ;
281 fOuterBoxThickness[1] = 5.0 ;
282 fOuterBoxThickness[2] = 5.0 ;
283
284 fUpperPlateThickness = 4.0 ;
285
286 fSecondUpperPlateThickness = 5.0 ;
287
288 fCrystalSupportHeight = 6.95 ;
289 fCrystalWrapThickness = 0.01 ;
290 fCrystalHolderThickness = 0.005 ;
291 fModuleBoxThickness = 2.0 ;
292 fIPtoOuterCoverDistance = 447.0 ;
293 fIPtoCrystalSurface = 460.0 ;
294
92862013 295 fPinDiodeSize[0] = 1.71 ; //Values given by Odd Harald feb 2000
296 fPinDiodeSize[1] = 0.0280 ; // 0.0280 is the depth of active layer in the silicon
297 fPinDiodeSize[2] = 1.61 ;
d15a28e7 298
299 fUpperCoolingPlateThickness = 0.06 ;
300 fSupportPlateThickness = 10.0 ;
301 fLowerThermoPlateThickness = 3.0 ;
302 fLowerTextolitPlateThickness = 1.0 ;
303 fGapBetweenCrystals = 0.03 ;
304
305 fTextolitBoxThickness[0] = 1.5 ;
306 fTextolitBoxThickness[1] = 0.0 ;
307 fTextolitBoxThickness[2] = 3.0 ;
308
309 fAirThickness[0] = 1.56 ;
310 fAirThickness[1] = 20.5175 ;
311 fAirThickness[2] = 2.48 ;
312
92862013 313 Float_t xtalModulePhiSize = fNPhi * ( fXtlSize[0] + 2 * fGapBetweenCrystals ) ;
314 Float_t xtalModuleZSize = fNZ * ( fXtlSize[2] + 2 * fGapBetweenCrystals ) ;
d15a28e7 315
316 // The next dimensions are calculated from the above parameters
317
92862013 318 fOuterBoxSize[0] = xtalModulePhiSize + 2 * ( fAirThickness[0] + fModuleBoxThickness
d15a28e7 319 + fTextolitBoxThickness[0] + fOuterBoxThickness[0] ) ;
320 fOuterBoxSize[1] = ( fXtlSize[1] + fCrystalSupportHeight + fCrystalWrapThickness + fCrystalHolderThickness )
321 + 2 * (fAirThickness[1] + fModuleBoxThickness + fTextolitBoxThickness[1] + fOuterBoxThickness[1] ) ;
92862013 322 fOuterBoxSize[2] = xtalModuleZSize + 2 * ( fAirThickness[2] + fModuleBoxThickness
d15a28e7 323 + fTextolitBoxThickness[2] + fOuterBoxThickness[2] ) ;
324
325 fTextolitBoxSize[0] = fOuterBoxSize[0] - 2 * fOuterBoxThickness[0] ;
326 fTextolitBoxSize[1] = fOuterBoxSize[1] - fOuterBoxThickness[1] - fUpperPlateThickness ;
327 fTextolitBoxSize[2] = fOuterBoxSize[2] - 2 * fOuterBoxThickness[2] ;
328
329 fAirFilledBoxSize[0] = fTextolitBoxSize[0] - 2 * fTextolitBoxThickness[0] ;
330 fAirFilledBoxSize[1] = fTextolitBoxSize[1] - fSecondUpperPlateThickness ;
331 fAirFilledBoxSize[2] = fTextolitBoxSize[2] - 2 * fTextolitBoxThickness[2] ;
332
333}
334
335//____________________________________________________________________________
336void AliPHOSGeometry::InitPPSD(void)
337{
338 // PPSD
339
340 fAnodeThickness = 0.0009 ;
341 fAvalancheGap = 0.01 ;
342 fCathodeThickness = 0.0009 ;
343 fCompositeThickness = 0.3 ;
9f616d61 344 fConversionGap = 0.6 ;
d15a28e7 345 fLeadConverterThickness = 0.56 ;
346 fLeadToMicro2Gap = 0.1 ;
347 fLidThickness = 0.2 ;
348 fMicro1ToLeadGap = 0.1 ;
349 fMicromegasWallThickness = 0.6 ;
350 fNumberOfModulesPhi = 4 ;
351 fNumberOfModulesZ = 4 ;
352 fNumberOfPadsPhi = 24 ;
353 fNumberOfPadsZ = 24 ;
354 fPCThickness = 0.1 ;
355 fPhiDisplacement = 0.8 ;
356 fZDisplacement = 0.8 ;
357
358 fMicromegas1Thickness = fLidThickness + 2 * fCompositeThickness + fCathodeThickness + fPCThickness
359 + fAnodeThickness + fConversionGap + fAvalancheGap ;
360 fMicromegas2Thickness = fMicromegas1Thickness ;
361
362
363 fPPSDModuleSize[0] = 38.0 ;
364 fPPSDModuleSize[1] = fMicromegas1Thickness ;
365 fPPSDModuleSize[2] = 38.0 ;
366
367 fPPSDBoxSize[0] = fNumberOfModulesPhi * fPPSDModuleSize[0] + 2 * fPhiDisplacement ;
368 fPPSDBoxSize[1] = fMicromegas2Thickness + fMicromegas2Thickness + fLeadConverterThickness + fMicro1ToLeadGap + fLeadToMicro2Gap ;
369 fPPSDBoxSize[2] = fNumberOfModulesZ * fPPSDModuleSize[2] + 2 * fZDisplacement ;
370
371 fIPtoTopLidDistance = fIPtoOuterCoverDistance - fPPSDBoxSize[1] - 1. ;
372
373}
374
375//____________________________________________________________________________
376AliPHOSGeometry * AliPHOSGeometry::GetInstance()
377{
d15a28e7 378 return (AliPHOSGeometry *) fGeom ;
379}
380
381//____________________________________________________________________________
382AliPHOSGeometry * AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t* title)
383{
384 AliPHOSGeometry * rv = 0 ;
385 if ( fGeom == 0 ) {
386 fGeom = new AliPHOSGeometry(name, title) ;
387 rv = (AliPHOSGeometry * ) fGeom ;
388 }
389 else {
390 if ( strcmp(fGeom->GetName(), name) != 0 ) {
391 cout << "AliPHOSGeometry <E> : current geometry is " << fGeom->GetName() << endl
392 << " you cannot call " << name << endl ;
393 }
394 else
395 rv = (AliPHOSGeometry *) fGeom ;
396 }
397 return rv ;
398}
399
400//____________________________________________________________________________
92862013 401Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * relid, Int_t & AbsId)
d15a28e7 402{
403
404 // AbsId = 1:fNModules * fNPhi * fNZ -> PbWO4
405 // AbsId = 1:fNModules * 2 * (fNumberOfModulesPhi * fNumberOfModulesZ) * fNumberOfPadsPhi * fNumberOfPadsZ -> PPSD
406
407 Bool_t rv = kTRUE ;
408
92862013 409 if ( relid[1] > 0 ) { // its a PPSD pad
d15a28e7 410
411 AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate emcal crystals from PPSD pads
92862013 412 + ( relid[0] - 1 ) * GetNumberOfModulesPhi() * GetNumberOfModulesZ() // the pads offset of PHOS modules
d15a28e7 413 * GetNumberOfPadsPhi() * GetNumberOfPadsZ() * 2
92862013 414 + ( relid[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() // the pads offset of PPSD modules
415 + ( relid[2] - 1 ) * GetNumberOfPadsPhi() // the pads offset of a PPSD row
416 + relid[3] ; // the column number
d15a28e7 417 }
418 else {
92862013 419 if ( relid[1] == 0 ) { // its a Phos crystal
420 AbsId = ( relid[0] - 1 ) * GetNPhi() * GetNZ() // the offset of PHOS modules
421 + ( relid[2] - 1 ) * GetNPhi() // the offset of a xtal row
422 + relid[3] ; // the column number
d15a28e7 423 }
424 }
425
426 return rv ;
427}
428
429//____________________________________________________________________________
430
92862013 431void AliPHOSGeometry::RelPosInAlice(const Int_t id, TVector3 & pos )
d15a28e7 432{
92862013 433 if (id > 0) {
d15a28e7 434
92862013 435 Int_t relid[4] ;
d15a28e7 436
92862013 437 AbsToRelNumbering(id , relid) ;
d15a28e7 438
92862013 439 Int_t phosmodule = relid[0] ;
d15a28e7 440
92862013 441 Float_t y0 = 0 ;
9f616d61 442
92862013 443 if ( relid[1] == 0 ) // it is a PbW04 crystal
444 { y0 = -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness()
9f616d61 445 + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ;
d15a28e7 446 }
92862013 447 if ( relid[1] > 0 ) { // its a PPSD pad
448 if ( relid[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() ) // its an bottom module
d15a28e7 449 {
92862013 450 y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ;
d15a28e7 451 }
452 else // its an upper module
92862013 453 y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - GetLeadToMicro2Gap()
9f616d61 454 - GetLeadConverterThickness() - GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0) ;
d15a28e7 455 }
456
457 Float_t x, z ;
92862013 458 RelPosInModule(relid, x, z) ;
d15a28e7 459
9f616d61 460 pos.SetX(x) ;
461 pos.SetZ(z) ;
92862013 462 pos.SetY( TMath::Sqrt(x*x + z*z + y0*y0) ) ;
9f616d61 463
d15a28e7 464
465
92862013 466 Float_t phi = GetPHOSAngle( phosmodule) ;
467 Double_t const kRADDEG = 180.0 / kPI ;
468 Float_t rphi = phi / kRADDEG ;
d15a28e7 469
92862013 470 TRotation rot ;
471 rot.RotateZ(-rphi) ; // a rotation around Z by angle
d15a28e7 472
92862013 473 TRotation dummy = rot.Invert() ; // to transform from original frame to rotate frame
d15a28e7 474
92862013 475 pos.Transform(rot) ; // rotate the baby
d15a28e7 476 }
477 else {
478 pos.SetX(0.);
479 pos.SetY(0.);
480 pos.SetZ(0.);
481 }
482}
483
484//____________________________________________________________________________
92862013 485void AliPHOSGeometry::RelPosInModule(const Int_t * relid, Float_t & x, Float_t & z)
d15a28e7 486{
92862013 487 Int_t ppsdmodule ;
488 Int_t row = relid[2] ; //offset along z axiz
489 Int_t column = relid[3] ; //offset along x axiz
d15a28e7 490
92862013 491 Float_t padsizeZ = GetPPSDModuleSize(2)/ GetNumberOfPadsZ();
492 Float_t padsizeX = GetPPSDModuleSize(0)/ GetNumberOfPadsPhi();
d15a28e7 493
92862013 494 if ( relid[1] == 0 ) { // its a PbW04 crystal
495 x = -( GetNPhi()/2. - row + 0.5 ) * GetCrystalSize(0) ; // position ox Xtal with respect
496 z = ( GetNZ() /2. - column + 0.5 ) * GetCrystalSize(2) ; // of center of PHOS module
d15a28e7 497 }
498 else {
92862013 499 if ( relid[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() )
500 ppsdmodule = relid[1]-GetNumberOfModulesPhi() * GetNumberOfModulesZ();
501 else ppsdmodule = relid[1] ;
502 Int_t modrow = 1+(Int_t)TMath::Ceil( (Float_t)ppsdmodule / GetNumberOfModulesPhi()-1. ) ;
503 Int_t modcol = ppsdmodule - ( modrow - 1 ) * GetNumberOfModulesPhi() ;
504 Float_t x0 = ( GetNumberOfModulesPhi() / 2. - modrow + 0.5 ) * GetPPSDModuleSize(0) ;
505 Float_t z0 = ( GetNumberOfModulesZ() / 2. - modcol + 0.5 ) * GetPPSDModuleSize(2) ;
506 x = - ( GetNumberOfPadsPhi()/2. - row - 0.5 ) * padsizeX + x0 ; // position of pad with respect
507 z = ( GetNumberOfPadsZ()/2. - column - 0.5 ) * padsizeZ - z0 ; // of center of PHOS module
d15a28e7 508 }
509}
510
511//____________________________________________________________________________
c1afa0e3 512void AliPHOSGeometry::SetPHOSAngles()
d15a28e7 513{
92862013 514 Double_t const kRADDEG = 180.0 / kPI ;
515 Float_t pphi = TMath::ATan( fOuterBoxSize[0] / ( 2.0 * fIPtoOuterCoverDistance ) ) ;
516 pphi *= kRADDEG ;
d15a28e7 517
518 for( Int_t i = 1; i <= fNModules ; i++ ) {
92862013 519 Float_t angle = pphi * 2 * ( i - fNModules / 2.0 - 0.5 ) ;
d15a28e7 520 fPHOSAngle[i-1] = - angle ;
c1afa0e3 521 }
d15a28e7 522}
523
2f3366b6 524//____________________________________________________________________________
525void AliPHOSGeometry::SetLeadConverterThickness(Float_t e)
526{
527 // should ultimately disappear
528 cout << " AliPHOSGeometry WARNING : You have changed LeadConverterThickness from "
529 << fLeadConverterThickness << " to " << e << endl ;
530
531 fLeadConverterThickness = e ;
532}