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