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 **************************************************************************/
18 //_________________________________________________________________________
19 // Geometry class for PHOS : singleton
20 // PHOS consists of the electromagnetic calorimeter (EMCA)
21 // and a charged particle veto either in the Subatech's version (PPSD)
22 // or in the IHEP's one (CPV).
23 // The EMCA/PPSD/CPV modules are parametrized so that any configuration
24 // can be easily implemented
25 // The title is used to identify the version of CPV used.
27 //*-- Author: Yves Schutz (SUBATECH)
29 // --- ROOT system ---
32 #include "TRotation.h"
36 // --- Standard library ---
41 // --- AliRoot header files ---
43 #include "AliPHOSGeometry.h"
44 #include "AliPHOSEMCAGeometry.h"
45 #include "AliPHOSPpsdRecPoint.h"
48 ClassImp(AliPHOSGeometry) ;
50 // these initialisations are needed for a singleton
51 AliPHOSGeometry * AliPHOSGeometry::fgGeom = 0 ;
52 Bool_t AliPHOSGeometry::fgInit = kFALSE ;
54 //____________________________________________________________________________
55 AliPHOSGeometry::~AliPHOSGeometry(void)
59 if (fRotMatrixArray) fRotMatrixArray->Delete() ;
60 if (fRotMatrixArray) delete fRotMatrixArray ;
61 if (fPHOSAngle ) delete fPHOSAngle ;
64 //____________________________________________________________________________
66 void AliPHOSGeometry::Init(void)
68 // Initializes the PHOS parameters :
69 // IHEP is the Protvino CPV (cathode pad chambers)
70 // GPS2 is the Subatech Pre-Shower (two micromegas sandwiching a passive lead converter)
71 // MIXT 4 PHOS modules withe the IHEP CPV qnd one PHOS module with the Subatche Pre-Shower
73 if ( ((strcmp( fName, "GPS2" )) == 0) ||
74 ((strcmp( fName, "IHEP" )) == 0) ||
75 ((strcmp( fName, "MIXT" )) == 0) ) {
82 fGeometryEMCA = new AliPHOSEMCAGeometry();
83 if ( ((strcmp( fName, "GPS2" )) == 0) ) {
84 fGeometryPPSD = new AliPHOSPPSDGeometry();
86 fNPPSDModules = fNModules;
88 else if ( ((strcmp( fName, "IHEP" )) == 0) ) {
89 fGeometryCPV = new AliPHOSCPVGeometry ();
93 else if ( ((strcmp( fName, "MIXT" )) == 0) ) {
94 fGeometryCPV = new AliPHOSCPVGeometry ();
95 fGeometryPPSD = new AliPHOSPPSDGeometry();
98 fGeometrySUPP = new AliPHOSSupportGeometry();
100 fPHOSAngle = new Float_t[fNModules] ;
102 for ( index = 0; index < fNModules; index++ )
103 fPHOSAngle[index] = 0.0 ; // Module position angles are set in CreateGeometry()
105 this->SetPHOSAngles() ;
106 fRotMatrixArray = new TObjArray(fNModules) ;
108 // post the geometry into the appropriate folder
109 TFolder * folder = (TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/Geometry/PHOS");
111 cerr << "ERROR: AliPHOSGeometry::Init -> No WhiteBoard/Geometry/PHOS found !" << endl ;
120 cout << "PHOS Geometry setup: option not defined " << fName << endl ;
125 //____________________________________________________________________________
126 Bool_t AliPHOSGeometry::IsInEMC(const Int_t id) const {
128 AbsToRelNumbering(id, relid) ;
135 //____________________________________________________________________________
136 Float_t AliPHOSGeometry::GetCPVBoxSize(Int_t index) const
138 // returns the coarse dimension CPV depending on the CPV option set
140 if (strcmp(fName,"GPS2") ==0 )
141 return fGeometryPPSD->GetCPVBoxSize(index);
142 else if (strcmp(fName,"IHEP")==0)
143 return fGeometryCPV ->GetCPVBoxSize(index);
144 else if (strcmp(fName,"MIXT")==0)
145 return TMath::Max(fGeometryCPV ->GetCPVBoxSize(index), fGeometryPPSD->GetCPVBoxSize(index));
150 //____________________________________________________________________________
151 AliPHOSGeometry * AliPHOSGeometry::GetInstance()
153 // Returns the pointer of the unique instance; singleton specific
155 return (AliPHOSGeometry *) fgGeom ;
158 //____________________________________________________________________________
159 AliPHOSGeometry * AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t* title)
161 // Returns the pointer of the unique instance
162 // Creates it with the specified options (name, title) if it does not exist yet
164 AliPHOSGeometry * rv = 0 ;
166 if ( strcmp(name,"") == 0 )
169 fgGeom = new AliPHOSGeometry(name, title) ;
171 rv = (AliPHOSGeometry * ) fgGeom ;
180 if ( strcmp(fgGeom->GetName(), name) != 0 ) {
181 cout << "AliPHOSGeometry <E> : current geometry is " << fgGeom->GetName() << endl
182 << " you cannot call " << name << endl ;
185 rv = (AliPHOSGeometry *) fgGeom ;
190 //____________________________________________________________________________
191 void AliPHOSGeometry::SetPHOSAngles()
193 // Calculates the position of the PHOS modules in ALICE global coordinate system
195 Double_t const kRADDEG = 180.0 / kPI ;
196 Float_t pphi = 2 * TMath::ATan( GetOuterBoxSize(0) / ( 2.0 * GetIPtoOuterCoverDistance() ) ) ;
198 if (pphi > fAngle) cout << "AliPHOSGeometry: PHOS modules overlap!\n";
201 for( Int_t i = 1; i <= fNModules ; i++ ) {
202 Float_t angle = pphi * ( i - fNModules / 2.0 - 0.5 ) ;
203 fPHOSAngle[i-1] = - angle ;
207 //____________________________________________________________________________
208 Bool_t AliPHOSGeometry::AbsToRelNumbering(const Int_t AbsId, Int_t * relid) const
210 // Converts the absolute numbering into the following array/
211 // relid[0] = PHOS Module number 1:fNModules
212 // relid[1] = 0 if PbW04
213 // = PPSD Module number 1:fNumberOfModulesPhi*fNumberOfModulesZ*2 (2->up and bottom level)
214 // relid[2] = Row number inside a PHOS or PPSD module
215 // relid[3] = Column number inside a PHOS or PPSD module
220 Int_t phosmodulenumber = (Int_t)TMath:: Ceil( id / ( GetNPhi() * GetNZ() ) ) ;
222 if ( phosmodulenumber > GetNModules() ) { // it is a PPSD or CPV pad
224 if ( strcmp(fName,"GPS2") == 0 ) {
225 id -= GetNPhi() * GetNZ() * GetNModules() ;
226 Float_t tempo = 2 * GetNumberOfModulesPhi() * GetNumberOfModulesZ() * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ;
227 relid[0] = (Int_t)TMath::Ceil( id / tempo ) ;
228 id -= ( relid[0] - 1 ) * tempo ;
229 relid[1] = (Int_t)TMath::Ceil( id / ( GetNumberOfPadsPhi() * GetNumberOfPadsZ() ) ) ;
230 id -= ( relid[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ;
231 relid[2] = (Int_t)TMath::Ceil( id / GetNumberOfPadsPhi() ) ;
232 relid[3] = (Int_t) ( id - ( relid[2] - 1 ) * GetNumberOfPadsPhi() ) ;
234 else if ( strcmp(fName,"IHEP") == 0 ) {
235 id -= GetNPhi() * GetNZ() * GetNModules() ;
236 Float_t nCPV = GetNumberOfCPVPadsPhi() * GetNumberOfCPVPadsZ() ;
237 relid[0] = (Int_t) TMath::Ceil( id / nCPV ) ;
239 id -= ( relid[0] - 1 ) * nCPV ;
240 relid[2] = (Int_t) TMath::Ceil( id / GetNumberOfCPVPadsZ() ) ;
241 relid[3] = (Int_t) ( id - ( relid[2] - 1 ) * GetNumberOfCPVPadsZ() ) ;
243 else if ( strcmp(fName,"MIXT") == 0 ) {
244 id -= GetNPhi() * GetNZ() * GetNModules() ;
245 Float_t nPPSD = 2 * GetNumberOfModulesPhi() * GetNumberOfModulesZ() * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ;
246 Float_t nCPV = GetNumberOfCPVPadsPhi() * GetNumberOfCPVPadsZ() ;
247 if (id <= nCPV*GetNCPVModules()) { // this pad belons to CPV
248 relid[0] = (Int_t) TMath::Ceil( id / nCPV ) ;
250 id -= ( relid[0] - 1 ) * nCPV ;
251 relid[2] = (Int_t) TMath::Ceil( id / GetNumberOfCPVPadsZ() ) ;
252 relid[3] = (Int_t) ( id - ( relid[2] - 1 ) * GetNumberOfCPVPadsZ() ) ;
254 else { // this pad belons to PPSD
255 id -= nCPV*GetNCPVModules();
256 relid[0] = (Int_t)TMath::Ceil( id / nPPSD );
257 id -= ( relid[0] - 1 ) * nPPSD ;
258 relid[0] += GetNCPVModules();
259 relid[1] = (Int_t)TMath::Ceil( id / ( GetNumberOfPadsPhi() * GetNumberOfPadsZ() ) ) ;
260 id -= ( relid[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ;
261 relid[2] = (Int_t)TMath::Ceil( id / GetNumberOfPadsPhi() ) ;
262 relid[3] = (Int_t) ( id - ( relid[2] - 1 ) * GetNumberOfPadsPhi() ) ;
266 else { // its a PW04 crystal
268 relid[0] = phosmodulenumber ;
270 id -= ( phosmodulenumber - 1 ) * GetNPhi() * GetNZ() ;
271 relid[2] = (Int_t)TMath::Ceil( id / GetNPhi() ) ;
272 relid[3] = (Int_t)( id - ( relid[2] - 1 ) * GetNPhi() ) ;
277 //____________________________________________________________________________
278 void AliPHOSGeometry::EmcModuleCoverage(const Int_t mod, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt) const
280 // calculates the angular coverage in theta and phi of one EMC (=PHOS) module
283 if ( opt == Radian() )
285 else if ( opt == Degre() )
286 conv = 180. / TMath::Pi() ;
288 cout << "<I> AliPHOSGeometry::EmcXtalCoverage : " << opt << " unknown option; result in radian " << endl ;
292 Float_t phi = GetPHOSAngle(mod) * (TMath::Pi() / 180.) ;
293 Float_t y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness()
294 + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ;
296 Double_t angle = TMath::ATan( GetCrystalSize(0)*GetNPhi() / (2 * y0) ) ;
297 phi = phi + 1.5 * TMath::Pi() ; // to follow the convention of the particle generator(PHOS is between 230 and 310 deg.)
298 Double_t max = phi - angle ;
299 Double_t min = phi + angle ;
300 pM = TMath::Max(max, min) * conv ;
301 pm = TMath::Min(max, min) * conv ;
303 angle = TMath::ATan( GetCrystalSize(2)*GetNZ() / (2 * y0) ) ;
304 max = TMath::Pi() / 2. + angle ; // to follow the convention of the particle generator(PHOS is at 90 deg.)
305 min = TMath::Pi() / 2. - angle ;
306 tM = TMath::Max(max, min) * conv ;
307 tm = TMath::Min(max, min) * conv ;
311 //____________________________________________________________________________
312 void AliPHOSGeometry::EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt) const
314 // calculates the angular coverage in theta and phi of a single crystal in a EMC(=PHOS) module
317 if ( opt == Radian() )
319 else if ( opt == Degre() )
320 conv = 180. / TMath::Pi() ;
322 cout << "<I> AliPHOSGeometry::EmcXtalCoverage : " << opt << " unknown option; result in radian " << endl ;
326 Float_t y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness()
327 + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ;
328 theta = 2 * TMath::ATan( GetCrystalSize(2) / (2 * y0) ) * conv ;
329 phi = 2 * TMath::ATan( GetCrystalSize(0) / (2 * y0) ) * conv ;
333 //____________________________________________________________________________
334 void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat) const
336 // Calculates the coordinates of a RecPoint and the error matrix in the ALICE global coordinate system
338 AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ;
339 TVector3 localposition ;
341 tmpPHOS->GetLocalPosition(gpos) ;
344 if ( tmpPHOS->IsEmc() ) // it is a EMC crystal
345 { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() +
346 GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ;
350 { // it is a PPSD pad
351 AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ;
352 if (tmpPpsd->GetUp() ) // it is an upper module
354 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() -
355 GetLeadToMicro2Gap() - GetLeadConverterThickness() -
356 GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ;
358 else // it is a lower module
359 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ;
362 Float_t phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ;
363 Double_t const kRADDEG = 180.0 / kPI ;
364 Float_t rphi = phi / kRADDEG ;
367 rot.RotateZ(-rphi) ; // a rotation around Z by angle
369 TRotation dummy = rot.Invert() ; // to transform from original frame to rotate frame
370 gpos.Transform(rot) ; // rotate the baby
374 //____________________________________________________________________________
375 void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const
377 // Calculates the coordinates of a RecPoint in the ALICE global coordinate system
379 AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ;
380 TVector3 localposition ;
381 tmpPHOS->GetLocalPosition(gpos) ;
384 if ( tmpPHOS->IsEmc() ) // it is a EMC crystal
385 { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() +
386 GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ;
389 { // it is a PPSD pad
390 AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ;
391 if (tmpPpsd->GetUp() ) // it is an upper module
393 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() -
394 GetLeadToMicro2Gap() - GetLeadConverterThickness() -
395 GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ;
397 else // it is a lower module
398 gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ;
401 Float_t phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ;
402 Double_t const kRADDEG = 180.0 / kPI ;
403 Float_t rphi = phi / kRADDEG ;
406 rot.RotateZ(-rphi) ; // a rotation around Z by angle
408 TRotation dummy = rot.Invert() ; // to transform from original frame to rotate frame
409 gpos.Transform(rot) ; // rotate the baby
412 //____________________________________________________________________________
413 void AliPHOSGeometry::ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & z, Double_t & x) const
415 // calculates the impact coordinates on PHOS of a neutral particle
416 // emitted in the direction theta and phi in the ALICE global coordinate system
418 // searches for the PHOS EMC module
420 Double_t tm, tM, pm, pM ;
422 while ( ModuleNumber == 0 && index <= GetNModules() ) {
423 EmcModuleCoverage(index, tm, tM, pm, pM) ;
424 if ( (theta >= tm && theta <= tM) && (phi >= pm && phi <= pM ) )
425 ModuleNumber = index ;
428 if ( ModuleNumber != 0 ) {
429 Float_t phi0 = GetPHOSAngle(ModuleNumber) * (TMath::Pi() / 180.) + 1.5 * TMath::Pi() ;
430 Float_t y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness()
431 + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ;
432 Double_t angle = phi - phi0;
433 x = y0 * TMath::Tan(angle) ;
434 angle = theta - TMath::Pi() / 2 ;
435 z = y0 * TMath::Tan(angle) ;
439 //____________________________________________________________________________
440 Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * relid, Int_t & AbsId) const
442 // Converts the relative numbering into the absolute numbering
444 // AbsId = from 1 to fNModules * fNPhi * fNZ
446 // AbsId = from N(total EMCA crystals) + 1
447 // to NCPVModules * fNumberOfCPVPadsPhi * fNumberOfCPVPadsZ +
448 // fNModules * 2 * (fNumberOfModulesPhi * fNumberOfModulesZ) * fNumberOfPadsPhi * fNumberOfPadsZ
450 // AbsId = from N(total PHOS crystals) + 1
451 // to NCPVModules * fNumberOfCPVPadsPhi * fNumberOfCPVPadsZ
455 if ( relid[1] > 0 && strcmp(fName,"GPS2")==0) { // it is a PPSD pad
456 AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate EMCA crystals from PPSD pads
457 + ( relid[0] - 1 ) * GetNumberOfModulesPhi() * GetNumberOfModulesZ() // the pads offset of PPSD modules
458 * GetNumberOfPadsPhi() * GetNumberOfPadsZ() * 2
459 + ( relid[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() // the pads offset of PPSD modules
460 + ( relid[2] - 1 ) * GetNumberOfPadsPhi() // the pads offset of a PPSD row
461 + relid[3] ; // the column number
464 else if ( relid[1] > 0 && strcmp(fName,"MIXT")==0) { // it is a PPSD pad
465 AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate EMCA crystals from PPSD pads
466 + GetNCPVModules() * GetNumberOfCPVPadsPhi() * GetNumberOfCPVPadsZ() // the pads offset of CPV modules if any
467 + ( relid[0] - 1 - GetNCPVModules())
468 * GetNumberOfModulesPhi() * GetNumberOfModulesZ() // the pads offset of PPSD modules
469 * GetNumberOfPadsPhi() * GetNumberOfPadsZ() * 2
470 + ( relid[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() // the pads offset of PPSD modules
471 + ( relid[2] - 1 ) * GetNumberOfPadsPhi() // the pads offset of a PPSD row
472 + relid[3] ; // the column number
475 else if ( relid[1] == 0 ) { // it is a Phos crystal
477 ( relid[0] - 1 ) * GetNPhi() * GetNZ() // the offset of PHOS modules
478 + ( relid[2] - 1 ) * GetNPhi() // the offset of a xtal row
479 + relid[3] ; // the column number
482 else if ( relid[1] == -1 ) { // it is a CPV pad
483 AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate EMCA crystals from CPV pads
484 + ( relid[0] - 1 ) * GetNumberOfCPVPadsPhi() * GetNumberOfCPVPadsZ() // the pads offset of PHOS modules
485 + ( relid[2] - 1 ) * GetNumberOfCPVPadsZ() // the pads offset of a CPV row
486 + relid[3] ; // the column number
492 //____________________________________________________________________________
494 void AliPHOSGeometry::RelPosInAlice(const Int_t id, TVector3 & pos ) const
496 // Converts the absolute numbering into the global ALICE coordinate system
497 // It works only for the GPS2 geometry
499 if (id > 0 && strcmp(fName,"GPS2")==0) {
503 AbsToRelNumbering(id , relid) ;
505 Int_t phosmodule = relid[0] ;
509 if ( relid[1] == 0 ) { // it is a PbW04 crystal
510 y0 = -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness()
511 + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ;
513 if ( relid[1] > 0 ) { // its a PPSD pad
514 if ( relid[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() ) { // its an bottom module
515 y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ;
517 else // its an upper module
518 y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - GetLeadToMicro2Gap()
519 - GetLeadConverterThickness() - GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0) ;
523 RelPosInModule(relid, x, z) ;
527 pos.SetY(- TMath::Sqrt(x*x + z*z + y0*y0) ) ;
531 Float_t phi = GetPHOSAngle( phosmodule) ;
532 Double_t const kRADDEG = 180.0 / kPI ;
533 Float_t rphi = phi / kRADDEG ;
536 rot.RotateZ(-rphi) ; // a rotation around Z by angle
538 TRotation dummy = rot.Invert() ; // to transform from original frame to rotate frame
540 cout << "before X,Y,Z " << pos.X() << endl << pos.Y() << endl << pos.Z() << endl;
541 pos.Transform(rot) ; // rotate the baby
542 cout << "X,Y,Z " << pos.X() << endl << pos.Y() << endl << pos.Z() << endl;
551 //____________________________________________________________________________
552 void AliPHOSGeometry::RelPosInModule(const Int_t * relid, Float_t & x, Float_t & z) const
554 // Converts the relative numbering into the local PHOS-module (x, z) coordinates
555 // Note: sign of z differs from that in the previous version (Yu.Kharlov, 12 Oct 2000)
557 Bool_t padOfCPV = (strcmp(fName,"IHEP")==0) ||
558 ((strcmp(fName,"MIXT")==0) && relid[0]<=GetNCPVModules()) ;
559 Bool_t padOfPPSD = (strcmp(fName,"GPS2")==0) ||
560 ((strcmp(fName,"MIXT")==0) && relid[0]> GetNCPVModules()) ;
564 Int_t row = relid[2] ; //offset along x axiz
565 Int_t column = relid[3] ; //offset along z axiz
567 Float_t padsizeZ = 0;
568 Float_t padsizeX = 0;
569 Int_t nOfPadsPhi = 0;
572 padsizeZ = GetPPSDModuleSize(2) / GetNumberOfPadsZ();
573 padsizeX = GetPPSDModuleSize(0) / GetNumberOfPadsPhi();
574 nOfPadsPhi = GetNumberOfPadsPhi();
575 nOfPadsZ = GetNumberOfPadsZ();
577 else if ( padOfCPV ) {
578 padsizeZ = GetPadSizeZ();
579 padsizeX = GetPadSizePhi();
580 nOfPadsPhi = GetNumberOfCPVPadsPhi();
581 nOfPadsZ = GetNumberOfCPVPadsZ();
584 if ( relid[1] == 0 ) { // its a PbW04 crystal
585 x = - ( GetNPhi()/2. - row + 0.5 ) * GetCrystalSize(0) ; // position ox Xtal with respect
586 z = ( GetNZ() /2. - column + 0.5 ) * GetCrystalSize(2) ; // of center of PHOS module
590 if ( relid[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() )
591 ppsdmodule = relid[1]-GetNumberOfModulesPhi() * GetNumberOfModulesZ();
593 ppsdmodule = relid[1] ;
594 Int_t modrow = 1+(Int_t)TMath::Ceil( (Float_t)ppsdmodule / GetNumberOfModulesPhi()-1. ) ;
595 Int_t modcol = ppsdmodule - ( modrow - 1 ) * GetNumberOfModulesPhi() ;
596 x0 = ( GetNumberOfModulesPhi() / 2. - modrow + 0.5 ) * GetPPSDModuleSize(0) ;
597 z0 = ( GetNumberOfModulesZ() / 2. - modcol + 0.5 ) * GetPPSDModuleSize(2) ;
602 x = - ( nOfPadsPhi/2. - row - 0.5 ) * padsizeX + x0 ; // position of pad with respect
603 z = ( nOfPadsZ /2. - column - 0.5 ) * padsizeZ - z0 ; // of center of PHOS module