1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //_________________________________________________________________________
17 // Geometry class for PHOS version SUBATECH
18 //*-- Author : Y. Schutz SUBATECH
19 //////////////////////////////////////////////////////////////////////////////
21 // --- ROOT system ---
24 #include "TRotation.h"
26 // --- Standard library ---
31 // --- AliRoot header files ---
33 #include "AliPHOSGeometry.h"
34 #include "AliPHOSPpsdRecPoint.h"
37 ClassImp(AliPHOSGeometry)
39 AliPHOSGeometry * AliPHOSGeometry::fGeom = 0 ;
41 //____________________________________________________________________________
42 AliPHOSGeometry::~AliPHOSGeometry(void)
44 fRotMatrixArray->Delete() ;
45 delete fRotMatrixArray ;
48 //____________________________________________________________________________
49 Bool_t AliPHOSGeometry::AbsToRelNumbering(const Int_t AbsId, Int_t * RelId)
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
60 Int_t PHOSModuleNumber = (Int_t)TMath:: Ceil( Id / ( GetNPhi() * GetNZ() ) ) ;
62 if ( PHOSModuleNumber > GetNModules() ) { // its a PPSD pad
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() ) ;
73 else { // its a PW04 crystal
75 RelId[0] = PHOSModuleNumber ;
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() ) ;
83 //____________________________________________________________________________
84 void AliPHOSGeometry::EmcModuleCoverage(const Int_t mod, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt)
86 // calculates the angular coverage in theta and phi of a EMC module
91 else if ( opt == kDegre )
92 conv = 180. / TMath::Pi() ;
94 cout << "<I> AliPHOSGeometry::EmcXtalCoverage : " << opt << " unknown option; result in radian " << endl ;
98 Float_t phi = GetPHOSAngle(mod) * (TMath::Pi() / 180.) ;
99 Float_t Y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness()
100 + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ;
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 ;
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 ;
117 //____________________________________________________________________________
118 void AliPHOSGeometry::EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt)
120 // calculates the angular coverage in theta and phi of a single crystal in a EMC module
123 if ( opt == kRadian )
125 else if ( opt == kDegre )
126 conv = 180. / TMath::Pi() ;
128 cout << "<I> AliPHOSGeometry::EmcXtalCoverage : " << opt << " unknown option; result in radian " << endl ;
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 ;
139 //____________________________________________________________________________
140 void AliPHOSGeometry::ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & z, Double_t & x)
142 // calculates the impact coordinates of a neutral particle
143 // emitted in direction theta and phi in ALICE
145 // searches for the PHOS EMC module
147 Double_t tm, tM, pm, pM ;
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 ;
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) ;
166 //____________________________________________________________________________
167 void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat)
170 AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ;
171 TVector3 LocalPosition ;
173 tmpPHOS->GetLocalPosition(gpos) ;
176 if ( tmpPHOS->IsEmc() ) // it is a EMC crystal
177 { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() +
178 GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ;
182 { // it is a PPSD pad
183 AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ;
184 if (tmpPpsd->GetUp() ) // it is an upper module
186 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() -
187 GetLeadToMicro2Gap() - GetLeadConverterThickness() -
188 GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ;
190 else // it is a lower module
191 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ;
194 Float_t Phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ;
195 Double_t const RADDEG = 180.0 / kPI ;
196 Float_t rPhi = Phi / RADDEG ;
199 Rot.RotateZ(-rPhi) ; // a rotation around Z by angle
201 TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame
202 gpos.Transform(Rot) ; // rotate the baby
206 //____________________________________________________________________________
207 void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos)
209 AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ;
210 TVector3 LocalPosition ;
211 tmpPHOS->GetLocalPosition(gpos) ;
214 if ( tmpPHOS->IsEmc() ) // it is a EMC crystal
215 { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() +
216 GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ;
219 { // it is a PPSD pad
220 AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ;
221 if (tmpPpsd->GetUp() ) // it is an upper module
223 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() -
224 GetLeadToMicro2Gap() - GetLeadConverterThickness() -
225 GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ;
227 else // it is a lower module
228 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ;
231 Float_t Phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ;
232 Double_t const RADDEG = 180.0 / kPI ;
233 Float_t rPhi = Phi / RADDEG ;
236 Rot.RotateZ(-rPhi) ; // a rotation around Z by angle
238 TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame
239 gpos.Transform(Rot) ; // rotate the baby
242 //____________________________________________________________________________
243 void AliPHOSGeometry::Init(void)
245 fRotMatrixArray = new TObjArray(fNModules) ;
247 cout << "PHOS geometry setup: parameters for option " << fName << " " << fTitle << endl ;
248 if ( ((strcmp( fName, "default" )) == 0) || ((strcmp( fName, "GPS2" )) == 0) ) {
252 this->SetPHOSAngles() ;
256 cout << "PHOS Geometry setup: option not defined " << fName << endl ;
260 //____________________________________________________________________________
261 void AliPHOSGeometry::InitPHOS(void)
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 ;
278 // all these numbers coming next are subject to changes
280 fOuterBoxThickness[0] = 2.8 ;
281 fOuterBoxThickness[1] = 5.0 ;
282 fOuterBoxThickness[2] = 5.0 ;
284 fUpperPlateThickness = 4.0 ;
286 fSecondUpperPlateThickness = 5.0 ;
288 fCrystalSupportHeight = 6.95 ;
289 fCrystalWrapThickness = 0.01 ;
290 fCrystalHolderThickness = 0.005 ;
291 fModuleBoxThickness = 2.0 ;
292 fIPtoOuterCoverDistance = 447.0 ;
293 fIPtoCrystalSurface = 460.0 ;
295 fPinDiodeSize[0] = 1.0 ;
296 fPinDiodeSize[1] = 0.1 ;
297 fPinDiodeSize[2] = 1.0 ;
299 fUpperCoolingPlateThickness = 0.06 ;
300 fSupportPlateThickness = 10.0 ;
301 fLowerThermoPlateThickness = 3.0 ;
302 fLowerTextolitPlateThickness = 1.0 ;
303 fGapBetweenCrystals = 0.03 ;
305 fTextolitBoxThickness[0] = 1.5 ;
306 fTextolitBoxThickness[1] = 0.0 ;
307 fTextolitBoxThickness[2] = 3.0 ;
309 fAirThickness[0] = 1.56 ;
310 fAirThickness[1] = 20.5175 ;
311 fAirThickness[2] = 2.48 ;
313 Float_t XtalModulePhiSize = fNPhi * ( fXtlSize[0] + 2 * fGapBetweenCrystals ) ;
314 Float_t XtalModuleZSize = fNZ * ( fXtlSize[2] + 2 * fGapBetweenCrystals ) ;
316 // The next dimensions are calculated from the above parameters
318 fOuterBoxSize[0] = XtalModulePhiSize + 2 * ( fAirThickness[0] + fModuleBoxThickness
319 + fTextolitBoxThickness[0] + fOuterBoxThickness[0] ) ;
320 fOuterBoxSize[1] = ( fXtlSize[1] + fCrystalSupportHeight + fCrystalWrapThickness + fCrystalHolderThickness )
321 + 2 * (fAirThickness[1] + fModuleBoxThickness + fTextolitBoxThickness[1] + fOuterBoxThickness[1] ) ;
322 fOuterBoxSize[2] = XtalModuleZSize + 2 * ( fAirThickness[2] + fModuleBoxThickness
323 + fTextolitBoxThickness[2] + fOuterBoxThickness[2] ) ;
325 fTextolitBoxSize[0] = fOuterBoxSize[0] - 2 * fOuterBoxThickness[0] ;
326 fTextolitBoxSize[1] = fOuterBoxSize[1] - fOuterBoxThickness[1] - fUpperPlateThickness ;
327 fTextolitBoxSize[2] = fOuterBoxSize[2] - 2 * fOuterBoxThickness[2] ;
329 fAirFilledBoxSize[0] = fTextolitBoxSize[0] - 2 * fTextolitBoxThickness[0] ;
330 fAirFilledBoxSize[1] = fTextolitBoxSize[1] - fSecondUpperPlateThickness ;
331 fAirFilledBoxSize[2] = fTextolitBoxSize[2] - 2 * fTextolitBoxThickness[2] ;
335 //____________________________________________________________________________
336 void AliPHOSGeometry::InitPPSD(void)
340 fAnodeThickness = 0.0009 ;
341 fAvalancheGap = 0.01 ;
342 fCathodeThickness = 0.0009 ;
343 fCompositeThickness = 0.3 ;
344 fConversionGap = 0.6 ;
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 ;
355 fPhiDisplacement = 0.8 ;
356 fZDisplacement = 0.8 ;
358 fMicromegas1Thickness = fLidThickness + 2 * fCompositeThickness + fCathodeThickness + fPCThickness
359 + fAnodeThickness + fConversionGap + fAvalancheGap ;
360 fMicromegas2Thickness = fMicromegas1Thickness ;
363 fPPSDModuleSize[0] = 38.0 ;
364 fPPSDModuleSize[1] = fMicromegas1Thickness ;
365 fPPSDModuleSize[2] = 38.0 ;
367 fPPSDBoxSize[0] = fNumberOfModulesPhi * fPPSDModuleSize[0] + 2 * fPhiDisplacement ;
368 fPPSDBoxSize[1] = fMicromegas2Thickness + fMicromegas2Thickness + fLeadConverterThickness + fMicro1ToLeadGap + fLeadToMicro2Gap ;
369 fPPSDBoxSize[2] = fNumberOfModulesZ * fPPSDModuleSize[2] + 2 * fZDisplacement ;
371 fIPtoTopLidDistance = fIPtoOuterCoverDistance - fPPSDBoxSize[1] - 1. ;
375 //____________________________________________________________________________
376 AliPHOSGeometry * AliPHOSGeometry::GetInstance()
378 return (AliPHOSGeometry *) fGeom ;
381 //____________________________________________________________________________
382 AliPHOSGeometry * AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t* title)
384 AliPHOSGeometry * rv = 0 ;
386 fGeom = new AliPHOSGeometry(name, title) ;
387 rv = (AliPHOSGeometry * ) fGeom ;
390 if ( strcmp(fGeom->GetName(), name) != 0 ) {
391 cout << "AliPHOSGeometry <E> : current geometry is " << fGeom->GetName() << endl
392 << " you cannot call " << name << endl ;
395 rv = (AliPHOSGeometry *) fGeom ;
400 //____________________________________________________________________________
401 Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId)
404 // AbsId = 1:fNModules * fNPhi * fNZ -> PbWO4
405 // AbsId = 1:fNModules * 2 * (fNumberOfModulesPhi * fNumberOfModulesZ) * fNumberOfPadsPhi * fNumberOfPadsZ -> PPSD
409 if ( RelId[1] > 0 ) { // its a PPSD pad
411 AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate emcal crystals from PPSD pads
412 + ( RelId[0] - 1 ) * GetNumberOfModulesPhi() * GetNumberOfModulesZ() // the pads offset of PHOS modules
413 * GetNumberOfPadsPhi() * GetNumberOfPadsZ() * 2
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
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
429 //____________________________________________________________________________
431 void AliPHOSGeometry::RelPosInAlice(const Int_t Id, TVector3 & pos )
437 AbsToRelNumbering(Id , RelId) ;
439 Int_t PHOSModule = RelId[0] ;
443 if ( RelId[1] == 0 ) // it is a PbW04 crystal
444 { Y0 = -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness()
445 + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ;
447 if ( RelId[1] > 0 ) { // its a PPSD pad
448 if ( RelId[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() ) // its an bottom module
450 Y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ;
452 else // its an upper module
453 Y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - GetLeadToMicro2Gap()
454 - GetLeadConverterThickness() - GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0) ;
458 RelPosInModule(RelId, x, z) ;
462 pos.SetY( TMath::Sqrt(x*x + z*z + Y0*Y0) ) ;
466 Float_t Phi = GetPHOSAngle( PHOSModule) ;
467 Double_t const RADDEG = 180.0 / kPI ;
468 Float_t rPhi = Phi / RADDEG ;
471 Rot.RotateZ(-rPhi) ; // a rotation around Z by angle
473 TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame
475 pos.Transform(Rot) ; // rotate the baby
484 //____________________________________________________________________________
485 void AliPHOSGeometry::RelPosInModule(const Int_t * RelId, Float_t & x, Float_t & z)
488 Int_t Row = RelId[2] ; //offset along z axiz
489 Int_t Column = RelId[3] ; //offset along x axiz
491 Float_t PadSizeZ = GetPPSDModuleSize(2)/ GetNumberOfPadsZ();
492 Float_t PadSizeX = GetPPSDModuleSize(0)/ GetNumberOfPadsPhi();
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
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
511 //____________________________________________________________________________
512 void AliPHOSGeometry:: SetPHOSAngles()
514 Double_t const RADDEG = 180.0 / kPI ;
515 Float_t PPHI = TMath::ATan( fOuterBoxSize[0] / ( 2.0 * fIPtoOuterCoverDistance ) ) ;
518 for( Int_t i = 1; i <= fNModules ; i++ ) {
519 Float_t angle = PPHI * 2 * ( i - fNModules / 2.0 - 0.5 ) ;
520 fPHOSAngle[i-1] = - angle ;