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() ) ;
84 //____________________________________________________________________________
85 void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat)
88 AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ;
89 TVector3 LocalPosition ;
91 tmpPHOS->GetLocalPosition(gpos) ;
94 if ( tmpPHOS->IsEmc() ) // it is a EMC crystal
95 { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() +
96 GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ;
100 { // it is a PPSD pad
101 AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ;
102 if (tmpPpsd->GetUp() ) // it is an upper module
104 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() -
105 GetLeadToMicro2Gap() - GetLeadConverterThickness() -
106 GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ;
108 else // it is a lower module
109 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ;
112 Float_t Phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ;
113 Double_t const RADDEG = 180.0 / kPI ;
114 Float_t rPhi = Phi / RADDEG ;
117 Rot.RotateZ(-rPhi) ; // a rotation around Z by angle
119 TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame
120 gpos.Transform(Rot) ; // rotate the baby
123 //____________________________________________________________________________
124 void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos)
126 AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ;
127 TVector3 LocalPosition ;
128 tmpPHOS->GetLocalPosition(gpos) ;
131 if ( tmpPHOS->IsEmc() ) // it is a EMC crystal
132 { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() +
133 GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ;
136 { // it is a PPSD pad
137 AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ;
138 if (tmpPpsd->GetUp() ) // it is an upper module
140 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() -
141 GetLeadToMicro2Gap() - GetLeadConverterThickness() -
142 GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ;
144 else // it is a lower module
145 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ;
148 Float_t Phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ;
149 Double_t const RADDEG = 180.0 / kPI ;
150 Float_t rPhi = Phi / RADDEG ;
153 Rot.RotateZ(-rPhi) ; // a rotation around Z by angle
155 TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame
156 gpos.Transform(Rot) ; // rotate the baby
159 //____________________________________________________________________________
160 void AliPHOSGeometry::Init(void)
162 fRotMatrixArray = new TObjArray(fNModules) ;
164 cout << "PHOS geometry setup: parameters for option " << fName << " " << fTitle << endl ;
165 if ( ((strcmp( fName, "default" )) == 0) || ((strcmp( fName, "GPS2" )) == 0) ) {
169 this->SetPHOSAngles() ;
173 cout << "PHOS Geometry setup: option not defined " << fName << endl ;
177 //____________________________________________________________________________
178 void AliPHOSGeometry::InitPHOS(void)
186 fPHOSAngle[0] = 0.0 ; // Module position angles are set in CreateGeometry()
187 fPHOSAngle[1] = 0.0 ;
188 fPHOSAngle[2] = 0.0 ;
189 fPHOSAngle[3] = 0.0 ;
195 // all these numbers coming next are subject to changes
197 fOuterBoxThickness[0] = 2.8 ;
198 fOuterBoxThickness[1] = 5.0 ;
199 fOuterBoxThickness[2] = 5.0 ;
201 fUpperPlateThickness = 4.0 ;
203 fSecondUpperPlateThickness = 5.0 ;
205 fCrystalSupportHeight = 6.95 ;
206 fCrystalWrapThickness = 0.01 ;
207 fCrystalHolderThickness = 0.005 ;
208 fModuleBoxThickness = 2.0 ;
209 fIPtoOuterCoverDistance = 447.0 ;
210 fIPtoCrystalSurface = 460.0 ;
212 fPinDiodeSize[0] = 1.0 ;
213 fPinDiodeSize[1] = 0.1 ;
214 fPinDiodeSize[2] = 1.0 ;
216 fUpperCoolingPlateThickness = 0.06 ;
217 fSupportPlateThickness = 10.0 ;
218 fLowerThermoPlateThickness = 3.0 ;
219 fLowerTextolitPlateThickness = 1.0 ;
220 fGapBetweenCrystals = 0.03 ;
222 fTextolitBoxThickness[0] = 1.5 ;
223 fTextolitBoxThickness[1] = 0.0 ;
224 fTextolitBoxThickness[2] = 3.0 ;
226 fAirThickness[0] = 1.56 ;
227 fAirThickness[1] = 20.5175 ;
228 fAirThickness[2] = 2.48 ;
230 Float_t XtalModulePhiSize = fNPhi * ( fXtlSize[0] + 2 * fGapBetweenCrystals ) ;
231 Float_t XtalModuleZSize = fNZ * ( fXtlSize[2] + 2 * fGapBetweenCrystals ) ;
233 // The next dimensions are calculated from the above parameters
235 fOuterBoxSize[0] = XtalModulePhiSize + 2 * ( fAirThickness[0] + fModuleBoxThickness
236 + fTextolitBoxThickness[0] + fOuterBoxThickness[0] ) ;
237 fOuterBoxSize[1] = ( fXtlSize[1] + fCrystalSupportHeight + fCrystalWrapThickness + fCrystalHolderThickness )
238 + 2 * (fAirThickness[1] + fModuleBoxThickness + fTextolitBoxThickness[1] + fOuterBoxThickness[1] ) ;
239 fOuterBoxSize[2] = XtalModuleZSize + 2 * ( fAirThickness[2] + fModuleBoxThickness
240 + fTextolitBoxThickness[2] + fOuterBoxThickness[2] ) ;
242 fTextolitBoxSize[0] = fOuterBoxSize[0] - 2 * fOuterBoxThickness[0] ;
243 fTextolitBoxSize[1] = fOuterBoxSize[1] - fOuterBoxThickness[1] - fUpperPlateThickness ;
244 fTextolitBoxSize[2] = fOuterBoxSize[2] - 2 * fOuterBoxThickness[2] ;
246 fAirFilledBoxSize[0] = fTextolitBoxSize[0] - 2 * fTextolitBoxThickness[0] ;
247 fAirFilledBoxSize[1] = fTextolitBoxSize[1] - fSecondUpperPlateThickness ;
248 fAirFilledBoxSize[2] = fTextolitBoxSize[2] - 2 * fTextolitBoxThickness[2] ;
252 //____________________________________________________________________________
253 void AliPHOSGeometry::InitPPSD(void)
257 fAnodeThickness = 0.0009 ;
258 fAvalancheGap = 0.01 ;
259 fCathodeThickness = 0.0009 ;
260 fCompositeThickness = 0.3 ;
261 fConversionGap = 0.3 ;
262 fLeadConverterThickness = 0.56 ;
263 fLeadToMicro2Gap = 0.1 ;
264 fLidThickness = 0.2 ;
265 fMicro1ToLeadGap = 0.1 ;
266 fMicromegasWallThickness = 0.6 ;
267 fNumberOfModulesPhi = 4 ;
268 fNumberOfModulesZ = 4 ;
269 fNumberOfPadsPhi = 24 ;
270 fNumberOfPadsZ = 24 ;
272 fPhiDisplacement = 0.8 ;
273 fZDisplacement = 0.8 ;
275 fMicromegas1Thickness = fLidThickness + 2 * fCompositeThickness + fCathodeThickness + fPCThickness
276 + fAnodeThickness + fConversionGap + fAvalancheGap ;
277 fMicromegas2Thickness = fMicromegas1Thickness ;
280 fPPSDModuleSize[0] = 38.0 ;
281 fPPSDModuleSize[1] = fMicromegas1Thickness ;
282 fPPSDModuleSize[2] = 38.0 ;
284 fPPSDBoxSize[0] = fNumberOfModulesPhi * fPPSDModuleSize[0] + 2 * fPhiDisplacement ;
285 fPPSDBoxSize[1] = fMicromegas2Thickness + fMicromegas2Thickness + fLeadConverterThickness + fMicro1ToLeadGap + fLeadToMicro2Gap ;
286 fPPSDBoxSize[2] = fNumberOfModulesZ * fPPSDModuleSize[2] + 2 * fZDisplacement ;
288 fIPtoTopLidDistance = fIPtoOuterCoverDistance - fPPSDBoxSize[1] - 1. ;
292 //____________________________________________________________________________
293 AliPHOSGeometry * AliPHOSGeometry::GetInstance()
296 return (AliPHOSGeometry *) fGeom ;
299 //____________________________________________________________________________
300 AliPHOSGeometry * AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t* title)
302 AliPHOSGeometry * rv = 0 ;
304 fGeom = new AliPHOSGeometry(name, title) ;
305 rv = (AliPHOSGeometry * ) fGeom ;
308 if ( strcmp(fGeom->GetName(), name) != 0 ) {
309 cout << "AliPHOSGeometry <E> : current geometry is " << fGeom->GetName() << endl
310 << " you cannot call " << name << endl ;
313 rv = (AliPHOSGeometry *) fGeom ;
318 //____________________________________________________________________________
319 Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId)
322 // AbsId = 1:fNModules * fNPhi * fNZ -> PbWO4
323 // AbsId = 1:fNModules * 2 * (fNumberOfModulesPhi * fNumberOfModulesZ) * fNumberOfPadsPhi * fNumberOfPadsZ -> PPSD
327 if ( RelId[1] > 0 ) { // its a PPSD pad
329 AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate emcal crystals from PPSD pads
330 + ( RelId[0] - 1 ) * GetNumberOfModulesPhi() * GetNumberOfModulesZ() // the pads offset of PHOS modules
331 * GetNumberOfPadsPhi() * GetNumberOfPadsZ() * 2
332 + ( RelId[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() // the pads offset of PPSD modules
333 + ( RelId[2] - 1 ) * GetNumberOfPadsPhi() // the pads offset of a PPSD row
334 + RelId[3] ; // the column number
337 if ( RelId[1] == 0 ) { // its a Phos crystal
338 AbsId = ( RelId[0] - 1 ) * GetNPhi() * GetNZ() // the offset of PHOS modules
339 + ( RelId[2] - 1 ) * GetNPhi() // the offset of a xtal row
340 + RelId[3] ; // the column number
347 //____________________________________________________________________________
349 void AliPHOSGeometry::RelPosInAlice(const Int_t Id, TVector3 & pos )
355 AbsToRelNumbering(Id , RelId) ;
357 Int_t PHOSModule = RelId[0] ;
360 if ( RelId[1] == 0 ) // it is a PbW04 crystal
361 { pos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness()
362 + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ;
364 if ( RelId[1] > 0 ) { // its a PPSD pad
365 if ( RelId[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() ) // its an bottom module
367 pos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ;
369 else // its an upper module
370 pos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - GetLeadToMicro2Gap()
371 - GetLeadConverterThickness() - GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0) ) ;
375 RelPosInModule(RelId, x, z) ;
381 Float_t Phi = GetPHOSAngle( PHOSModule) ;
382 Double_t const RADDEG = 180.0 / kPI ;
383 Float_t rPhi = Phi / RADDEG ;
386 Rot.RotateZ(-rPhi) ; // a rotation around Z by angle
388 TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame
390 pos.Transform(Rot) ; // rotate the baby
399 //____________________________________________________________________________
400 void AliPHOSGeometry::RelPosInModule(const Int_t * RelId, Float_t & x, Float_t & z)
403 Int_t Row = RelId[2] ; //offset along z axiz
404 Int_t Column = RelId[3] ; //offset along x axiz
406 Float_t PadSizeZ = GetPPSDModuleSize(2)/ GetNumberOfPadsZ();
407 Float_t PadSizeX = GetPPSDModuleSize(0)/ GetNumberOfPadsPhi();
409 if ( RelId[1] == 0 ) { // its a PbW04 crystal
410 x = -( GetNPhi()/2. - Row + 0.5 ) * GetCrystalSize(0) ; // position ox Xtal with respect
411 z = -( GetNZ() /2. - Column + 0.5 ) * GetCrystalSize(2) ; // of center of PHOS module
414 if ( RelId[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() )
415 PPSDModule = RelId[1]-GetNumberOfModulesPhi() * GetNumberOfModulesZ();
416 else PPSDModule = RelId[1] ;
417 Int_t ModRow = 1+(Int_t)TMath::Ceil( (Float_t)PPSDModule / GetNumberOfModulesPhi()-1. ) ;
418 Int_t ModCol = PPSDModule - ( ModRow-1 ) * GetNumberOfModulesPhi() ;
419 Float_t x0 = ( GetNumberOfModulesPhi() / 2. - ModRow + 0.5 ) * GetPPSDModuleSize(0) ;
420 Float_t z0 = ( GetNumberOfModulesZ() / 2. - ModCol + 0.5 ) * GetPPSDModuleSize(2) ;
421 x = - ( GetNumberOfPadsPhi()/2. - Row - 0.5 ) * PadSizeX + x0 ; // position of pad with respect
422 z = - ( GetNumberOfPadsZ()/2. - Column - 0.5 ) * PadSizeZ + z0 ; // of center of PHOS module
426 //____________________________________________________________________________
427 void AliPHOSGeometry:: SetPHOSAngles()
429 Double_t const RADDEG = 180.0 / kPI ;
430 Float_t PPHI = TMath::ATan( fOuterBoxSize[0] / ( 2.0 * fIPtoOuterCoverDistance ) ) ;
433 for( Int_t i = 1; i <= fNModules ; i++ ) {
434 Float_t angle = PPHI * 2 * ( i - fNModules / 2.0 - 0.5 ) ;
435 fPHOSAngle[i-1] = - angle ;