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
205 //____________________________________________________________________________
206 void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos)
208 AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ;
209 TVector3 LocalPosition ;
210 tmpPHOS->GetLocalPosition(gpos) ;
213 if ( tmpPHOS->IsEmc() ) // it is a EMC crystal
214 { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() +
215 GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ;
218 { // it is a PPSD pad
219 AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ;
220 if (tmpPpsd->GetUp() ) // it is an upper module
222 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() -
223 GetLeadToMicro2Gap() - GetLeadConverterThickness() -
224 GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ;
226 else // it is a lower module
227 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ;
230 Float_t Phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ;
231 Double_t const RADDEG = 180.0 / kPI ;
232 Float_t rPhi = Phi / RADDEG ;
235 Rot.RotateZ(-rPhi) ; // a rotation around Z by angle
237 TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame
238 gpos.Transform(Rot) ; // rotate the baby
241 //____________________________________________________________________________
242 void AliPHOSGeometry::Init(void)
244 fRotMatrixArray = new TObjArray(fNModules) ;
246 cout << "PHOS geometry setup: parameters for option " << fName << " " << fTitle << endl ;
247 if ( ((strcmp( fName, "default" )) == 0) || ((strcmp( fName, "GPS2" )) == 0) ) {
251 this->SetPHOSAngles() ;
255 cout << "PHOS Geometry setup: option not defined " << fName << endl ;
259 //____________________________________________________________________________
260 void AliPHOSGeometry::InitPHOS(void)
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 ;
277 // all these numbers coming next are subject to changes
279 fOuterBoxThickness[0] = 2.8 ;
280 fOuterBoxThickness[1] = 5.0 ;
281 fOuterBoxThickness[2] = 5.0 ;
283 fUpperPlateThickness = 4.0 ;
285 fSecondUpperPlateThickness = 5.0 ;
287 fCrystalSupportHeight = 6.95 ;
288 fCrystalWrapThickness = 0.01 ;
289 fCrystalHolderThickness = 0.005 ;
290 fModuleBoxThickness = 2.0 ;
291 fIPtoOuterCoverDistance = 447.0 ;
292 fIPtoCrystalSurface = 460.0 ;
294 fPinDiodeSize[0] = 1.0 ;
295 fPinDiodeSize[1] = 0.1 ;
296 fPinDiodeSize[2] = 1.0 ;
298 fUpperCoolingPlateThickness = 0.06 ;
299 fSupportPlateThickness = 10.0 ;
300 fLowerThermoPlateThickness = 3.0 ;
301 fLowerTextolitPlateThickness = 1.0 ;
302 fGapBetweenCrystals = 0.03 ;
304 fTextolitBoxThickness[0] = 1.5 ;
305 fTextolitBoxThickness[1] = 0.0 ;
306 fTextolitBoxThickness[2] = 3.0 ;
308 fAirThickness[0] = 1.56 ;
309 fAirThickness[1] = 20.5175 ;
310 fAirThickness[2] = 2.48 ;
312 Float_t XtalModulePhiSize = fNPhi * ( fXtlSize[0] + 2 * fGapBetweenCrystals ) ;
313 Float_t XtalModuleZSize = fNZ * ( fXtlSize[2] + 2 * fGapBetweenCrystals ) ;
315 // The next dimensions are calculated from the above parameters
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] ) ;
324 fTextolitBoxSize[0] = fOuterBoxSize[0] - 2 * fOuterBoxThickness[0] ;
325 fTextolitBoxSize[1] = fOuterBoxSize[1] - fOuterBoxThickness[1] - fUpperPlateThickness ;
326 fTextolitBoxSize[2] = fOuterBoxSize[2] - 2 * fOuterBoxThickness[2] ;
328 fAirFilledBoxSize[0] = fTextolitBoxSize[0] - 2 * fTextolitBoxThickness[0] ;
329 fAirFilledBoxSize[1] = fTextolitBoxSize[1] - fSecondUpperPlateThickness ;
330 fAirFilledBoxSize[2] = fTextolitBoxSize[2] - 2 * fTextolitBoxThickness[2] ;
334 //____________________________________________________________________________
335 void AliPHOSGeometry::InitPPSD(void)
339 fAnodeThickness = 0.0009 ;
340 fAvalancheGap = 0.01 ;
341 fCathodeThickness = 0.0009 ;
342 fCompositeThickness = 0.3 ;
343 fConversionGap = 0.6 ;
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 ;
354 fPhiDisplacement = 0.8 ;
355 fZDisplacement = 0.8 ;
357 fMicromegas1Thickness = fLidThickness + 2 * fCompositeThickness + fCathodeThickness + fPCThickness
358 + fAnodeThickness + fConversionGap + fAvalancheGap ;
359 fMicromegas2Thickness = fMicromegas1Thickness ;
362 fPPSDModuleSize[0] = 38.0 ;
363 fPPSDModuleSize[1] = fMicromegas1Thickness ;
364 fPPSDModuleSize[2] = 38.0 ;
366 fPPSDBoxSize[0] = fNumberOfModulesPhi * fPPSDModuleSize[0] + 2 * fPhiDisplacement ;
367 fPPSDBoxSize[1] = fMicromegas2Thickness + fMicromegas2Thickness + fLeadConverterThickness + fMicro1ToLeadGap + fLeadToMicro2Gap ;
368 fPPSDBoxSize[2] = fNumberOfModulesZ * fPPSDModuleSize[2] + 2 * fZDisplacement ;
370 fIPtoTopLidDistance = fIPtoOuterCoverDistance - fPPSDBoxSize[1] - 1. ;
374 //____________________________________________________________________________
375 AliPHOSGeometry * AliPHOSGeometry::GetInstance()
377 return (AliPHOSGeometry *) fGeom ;
380 //____________________________________________________________________________
381 AliPHOSGeometry * AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t* title)
383 AliPHOSGeometry * rv = 0 ;
385 fGeom = new AliPHOSGeometry(name, title) ;
386 rv = (AliPHOSGeometry * ) fGeom ;
389 if ( strcmp(fGeom->GetName(), name) != 0 ) {
390 cout << "AliPHOSGeometry <E> : current geometry is " << fGeom->GetName() << endl
391 << " you cannot call " << name << endl ;
394 rv = (AliPHOSGeometry *) fGeom ;
399 //____________________________________________________________________________
400 Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId)
403 // AbsId = 1:fNModules * fNPhi * fNZ -> PbWO4
404 // AbsId = 1:fNModules * 2 * (fNumberOfModulesPhi * fNumberOfModulesZ) * fNumberOfPadsPhi * fNumberOfPadsZ -> PPSD
408 if ( RelId[1] > 0 ) { // its a PPSD pad
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
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
428 //____________________________________________________________________________
430 void AliPHOSGeometry::RelPosInAlice(const Int_t Id, TVector3 & pos )
436 AbsToRelNumbering(Id , RelId) ;
438 Int_t PHOSModule = RelId[0] ;
442 if ( RelId[1] == 0 ) // it is a PbW04 crystal
443 { Y0 = -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness()
444 + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ;
446 if ( RelId[1] > 0 ) { // its a PPSD pad
447 if ( RelId[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() ) // its an bottom module
449 Y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ;
451 else // its an upper module
452 Y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - GetLeadToMicro2Gap()
453 - GetLeadConverterThickness() - GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0) ;
457 RelPosInModule(RelId, x, z) ;
461 pos.SetY( TMath::Sqrt(x*x + z*z + Y0*Y0) ) ;
465 Float_t Phi = GetPHOSAngle( PHOSModule) ;
466 Double_t const RADDEG = 180.0 / kPI ;
467 Float_t rPhi = Phi / RADDEG ;
470 Rot.RotateZ(-rPhi) ; // a rotation around Z by angle
472 TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame
474 pos.Transform(Rot) ; // rotate the baby
483 //____________________________________________________________________________
484 void AliPHOSGeometry::RelPosInModule(const Int_t * RelId, Float_t & x, Float_t & z)
487 Int_t Row = RelId[2] ; //offset along z axiz
488 Int_t Column = RelId[3] ; //offset along x axiz
490 Float_t PadSizeZ = GetPPSDModuleSize(2)/ GetNumberOfPadsZ();
491 Float_t PadSizeX = GetPPSDModuleSize(0)/ GetNumberOfPadsPhi();
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
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
510 //____________________________________________________________________________
511 void AliPHOSGeometry:: SetPHOSAngles()
513 Double_t const RADDEG = 180.0 / kPI ;
514 Float_t PPHI = TMath::ATan( fOuterBoxSize[0] / ( 2.0 * fIPtoOuterCoverDistance ) ) ;
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 ;