-#include "AliPHOSGeometry.h"
-#include "AliPHOSPpsdRecPoint.h"
-#include "AliConst.h"
-
-ClassImp(AliPHOSGeometry)
-
- AliPHOSGeometry * AliPHOSGeometry::fGeom = 0 ;
-
-//____________________________________________________________________________
-AliPHOSGeometry::~AliPHOSGeometry(void)
-{
- fRotMatrixArray->Delete() ;
- delete fRotMatrixArray ;
-}
-
-//____________________________________________________________________________
-Bool_t AliPHOSGeometry::AbsToRelNumbering(const Int_t AbsId, Int_t * RelId)
-{
- // RelId[0] = PHOS Module number 1:fNModules
- // RelId[1] = 0 if PbW04
- // = PPSD Module number 1:fNumberOfModulesPhi*fNumberOfModulesZ*2 (2->up and bottom level)
- // RelId[2] = Row number inside a PHOS or PPSD module
- // RelId[3] = Column number inside a PHOS or PPSD module
-
- Bool_t rv = kTRUE ;
- Float_t Id = AbsId ;
-
- Int_t PHOSModuleNumber = (Int_t)TMath:: Ceil( Id / ( GetNPhi() * GetNZ() ) ) ;
-
- if ( PHOSModuleNumber > GetNModules() ) { // its a PPSD pad
-
- Id -= GetNPhi() * GetNZ() * GetNModules() ;
- Float_t tempo = 2 * GetNumberOfModulesPhi() * GetNumberOfModulesZ() * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ;
- RelId[0] = (Int_t)TMath::Ceil( Id / tempo ) ;
- Id -= ( RelId[0] - 1 ) * tempo ;
- RelId[1] = (Int_t)TMath::Ceil( Id / ( GetNumberOfPadsPhi() * GetNumberOfPadsZ() ) ) ;
- Id -= ( RelId[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ;
- RelId[2] = (Int_t)TMath::Ceil( Id / GetNumberOfPadsPhi() ) ;
- RelId[3] = (Int_t) ( Id - ( RelId[2] - 1 ) * GetNumberOfPadsPhi() ) ;
- }
- else { // its a PW04 crystal
-
- RelId[0] = PHOSModuleNumber ;
- RelId[1] = 0 ;
- Id -= ( PHOSModuleNumber - 1 ) * GetNPhi() * GetNZ() ;
- RelId[2] = (Int_t)TMath::Ceil( Id / GetNPhi() ) ;
- RelId[3] = (Int_t)( Id - ( RelId[2] - 1 ) * GetNPhi() ) ;
- }
- return rv ;
-}
-
-//____________________________________________________________________________
-void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat)
-{
-
- AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ;
- TVector3 LocalPosition ;
-
- tmpPHOS->GetLocalPosition(gpos) ;
-
-
- if ( tmpPHOS->IsEmc() ) // it is a EMC crystal
- { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() +
- GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ;
-
- }
- else
- { // it is a PPSD pad
- AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ;
- if (tmpPpsd->GetUp() ) // it is an upper module
- {
- gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() -
- GetLeadToMicro2Gap() - GetLeadConverterThickness() -
- GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ;
- }
- else // it is a lower module
- gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ;
- }
-
- Float_t Phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ;
- Double_t const RADDEG = 180.0 / kPI ;
- Float_t rPhi = Phi / RADDEG ;
-
- TRotation Rot ;
- Rot.RotateZ(-rPhi) ; // a rotation around Z by angle
-
- TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame
- gpos.Transform(Rot) ; // rotate the baby
-}
-
-//____________________________________________________________________________
-void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos)
-{
- AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ;
- TVector3 LocalPosition ;
- tmpPHOS->GetLocalPosition(gpos) ;
-
-
- if ( tmpPHOS->IsEmc() ) // it is a EMC crystal
- { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() +
- GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ;
- }
- else
- { // it is a PPSD pad
- AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ;
- if (tmpPpsd->GetUp() ) // it is an upper module
- {
- gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() -
- GetLeadToMicro2Gap() - GetLeadConverterThickness() -
- GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ;
- }
- else // it is a lower module
- gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ;
- }
-
- Float_t Phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ;
- Double_t const RADDEG = 180.0 / kPI ;
- Float_t rPhi = Phi / RADDEG ;
-
- TRotation Rot ;
- Rot.RotateZ(-rPhi) ; // a rotation around Z by angle
-
- TRotation dummy = Rot.Invert() ; // to transform from original frame to rotate frame
- gpos.Transform(Rot) ; // rotate the baby
-}
-
-//____________________________________________________________________________
-void AliPHOSGeometry::Init(void)
-{
- fRotMatrixArray = new TObjArray(fNModules) ;
-
- cout << "PHOS geometry setup: parameters for option " << fName << " " << fTitle << endl ;
- if ( ((strcmp( fName, "default" )) == 0) || ((strcmp( fName, "GPS2" )) == 0) ) {
- fInit = kTRUE ;
- this->InitPHOS() ;
- this->InitPPSD() ;
- this->SetPHOSAngles() ;
- }
- else {
- fInit = kFALSE ;
- cout << "PHOS Geometry setup: option not defined " << fName << endl ;
- }
-}
-
-//____________________________________________________________________________
-void AliPHOSGeometry::InitPHOS(void)
-{
- // PHOS
-
- fNPhi = 64 ;
- fNZ = 64 ;
- fNModules = 5 ;
-
- fPHOSAngle[0] = 0.0 ; // Module position angles are set in CreateGeometry()
- fPHOSAngle[1] = 0.0 ;
- fPHOSAngle[2] = 0.0 ;
- fPHOSAngle[3] = 0.0 ;
-
- fXtlSize[0] = 2.2 ;
- fXtlSize[1] = 18.0 ;
- fXtlSize[2] = 2.2 ;
-
- // all these numbers coming next are subject to changes
-
- fOuterBoxThickness[0] = 2.8 ;
- fOuterBoxThickness[1] = 5.0 ;
- fOuterBoxThickness[2] = 5.0 ;
-
- fUpperPlateThickness = 4.0 ;
-
- fSecondUpperPlateThickness = 5.0 ;
-
- fCrystalSupportHeight = 6.95 ;
- fCrystalWrapThickness = 0.01 ;
- fCrystalHolderThickness = 0.005 ;
- fModuleBoxThickness = 2.0 ;
- fIPtoOuterCoverDistance = 447.0 ;
- fIPtoCrystalSurface = 460.0 ;
-
- fPinDiodeSize[0] = 1.0 ;
- fPinDiodeSize[1] = 0.1 ;
- fPinDiodeSize[2] = 1.0 ;
-
- fUpperCoolingPlateThickness = 0.06 ;
- fSupportPlateThickness = 10.0 ;
- fLowerThermoPlateThickness = 3.0 ;
- fLowerTextolitPlateThickness = 1.0 ;
- fGapBetweenCrystals = 0.03 ;
-
- fTextolitBoxThickness[0] = 1.5 ;
- fTextolitBoxThickness[1] = 0.0 ;
- fTextolitBoxThickness[2] = 3.0 ;
-
- fAirThickness[0] = 1.56 ;
- fAirThickness[1] = 20.5175 ;
- fAirThickness[2] = 2.48 ;
-
- Float_t XtalModulePhiSize = fNPhi * ( fXtlSize[0] + 2 * fGapBetweenCrystals ) ;
- Float_t XtalModuleZSize = fNZ * ( fXtlSize[2] + 2 * fGapBetweenCrystals ) ;
-
- // The next dimensions are calculated from the above parameters
-
- fOuterBoxSize[0] = XtalModulePhiSize + 2 * ( fAirThickness[0] + fModuleBoxThickness
- + fTextolitBoxThickness[0] + fOuterBoxThickness[0] ) ;
- fOuterBoxSize[1] = ( fXtlSize[1] + fCrystalSupportHeight + fCrystalWrapThickness + fCrystalHolderThickness )
- + 2 * (fAirThickness[1] + fModuleBoxThickness + fTextolitBoxThickness[1] + fOuterBoxThickness[1] ) ;
- fOuterBoxSize[2] = XtalModuleZSize + 2 * ( fAirThickness[2] + fModuleBoxThickness
- + fTextolitBoxThickness[2] + fOuterBoxThickness[2] ) ;
-
- fTextolitBoxSize[0] = fOuterBoxSize[0] - 2 * fOuterBoxThickness[0] ;
- fTextolitBoxSize[1] = fOuterBoxSize[1] - fOuterBoxThickness[1] - fUpperPlateThickness ;
- fTextolitBoxSize[2] = fOuterBoxSize[2] - 2 * fOuterBoxThickness[2] ;
-
- fAirFilledBoxSize[0] = fTextolitBoxSize[0] - 2 * fTextolitBoxThickness[0] ;
- fAirFilledBoxSize[1] = fTextolitBoxSize[1] - fSecondUpperPlateThickness ;
- fAirFilledBoxSize[2] = fTextolitBoxSize[2] - 2 * fTextolitBoxThickness[2] ;
-
-}
-
-//____________________________________________________________________________
-void AliPHOSGeometry::InitPPSD(void)
-{
- // PPSD
-
- fAnodeThickness = 0.0009 ;
- fAvalancheGap = 0.01 ;
- fCathodeThickness = 0.0009 ;
- fCompositeThickness = 0.3 ;
- fConversionGap = 0.3 ;
- fLeadConverterThickness = 0.56 ;
- fLeadToMicro2Gap = 0.1 ;
- fLidThickness = 0.2 ;
- fMicro1ToLeadGap = 0.1 ;
- fMicromegasWallThickness = 0.6 ;
- fNumberOfModulesPhi = 4 ;
- fNumberOfModulesZ = 4 ;
- fNumberOfPadsPhi = 24 ;
- fNumberOfPadsZ = 24 ;
- fPCThickness = 0.1 ;
- fPhiDisplacement = 0.8 ;
- fZDisplacement = 0.8 ;
-
- fMicromegas1Thickness = fLidThickness + 2 * fCompositeThickness + fCathodeThickness + fPCThickness
- + fAnodeThickness + fConversionGap + fAvalancheGap ;
- fMicromegas2Thickness = fMicromegas1Thickness ;
-
-
- fPPSDModuleSize[0] = 38.0 ;
- fPPSDModuleSize[1] = fMicromegas1Thickness ;
- fPPSDModuleSize[2] = 38.0 ;
+#include "AliGeometry.h"
+#include "AliPHOSRecPoint.h"
+
+class AliPHOSGeometry : public AliGeometry {
+
+public:
+
+ AliPHOSGeometry() {} ; // must be kept public for root persistency purposes
+ virtual ~AliPHOSGeometry(void) ;
+ static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title) ;
+ static AliPHOSGeometry * GetInstance() ;
+ virtual void GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat) ;
+ virtual void GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) ;
+
+protected:
+
+ AliPHOSGeometry(const Text_t* name, const Text_t* title) : AliGeometry(name, title) { Init() ; }
+ void Init(void) ; // steering method for PHOS and CPV
+ void InitPHOS(void) ; // defines the various PHOS geometry parameters
+ void InitPPSD(void) ; // defines the various PPSD geometry parameters
+
+public:
+
+ // General
+
+ Bool_t AbsToRelNumbering(const Int_t AbsId, Int_t * RelId) ; // converts the absolute PHOS numbering to a relative
+ void RelPosInModule(const Int_t * RelId, Float_t & y, Float_t & z) ; // gets the position of element (pad or Xtal) relative to
+ // center of PHOS module
+ void RelPosInAlice(const Int_t AbsId, TVector3 & pos) ; // gets the position of element (pad or Xtal) relative to
+ // Alice
+ Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) ; // converts the absolute PHOS numbering to a relative
+ // inlines
+
+ ///////////// PHOS related parameters
+
+ Bool_t IsInitialized(void) const { return fInit ; }
+ Float_t GetAirFilledBoxSize(Int_t index) const { return fAirFilledBoxSize[index] ;}
+ Float_t GetCrystalHolderThickness(void) const { return fCrystalHolderThickness ; }
+ Float_t GetCrystalSize(Int_t index) const { return fXtlSize[index] ; }
+ Float_t GetCrystalSupportHeight(void) const { return fCrystalSupportHeight ; }
+ Float_t GetCrystalWrapThickness(void) const { return fCrystalWrapThickness;}
+ Float_t GetGapBetweenCrystals(void) const { return fGapBetweenCrystals ; }
+ Float_t GetIPtoCrystalSurface(void) const { return fIPtoCrystalSurface ; }
+ Float_t GetIPtoOuterCoverDistance(void) const { return fIPtoOuterCoverDistance ; }
+ Float_t GetIPtoTopLidDistance(void) const { return fIPtoTopLidDistance ; }
+ Float_t GetLowerThermoPlateThickness(void) const { return fLowerThermoPlateThickness ; }
+ Float_t GetLowerTextolitPlateThickness(void) const { return fLowerTextolitPlateThickness ; }
+ Float_t GetModuleBoxThickness(void) const { return fModuleBoxThickness ; }
+ Int_t GetNPhi(void) const { return fNPhi ; }
+ Int_t GetNZ(void) const { return fNZ ; }
+ Int_t GetNModules(void) const { return fNModules ; }
+ Float_t GetOuterBoxSize(Int_t index) const { return fOuterBoxSize[index] ; }
+ Float_t GetOuterBoxThickness(Int_t index) const { return fOuterBoxThickness[index] ; }
+ Float_t GetPHOSAngle(Int_t index) const { return fPHOSAngle[index-1] ; }
+ Float_t GetPinDiodeSize(Int_t index) const { return fPinDiodeSize[index] ; }
+ Float_t GetSecondUpperPlateThickness(void) const { return fSecondUpperPlateThickness ; }
+ Float_t GetSupportPlateThickness(void) const { return fSupportPlateThickness ; }
+ Float_t GetTextolitBoxSize(Int_t index) const { return fTextolitBoxSize[index] ; }
+ Float_t GetTextolitBoxThickness(Int_t index) const { return fTextolitBoxThickness[index]; }
+ Float_t GetUpperPlateThickness(void) const { return fUpperPlateThickness ; }
+ Float_t GetUpperCoolingPlateThickness(void) const { return fUpperCoolingPlateThickness ; }
+
+private:
+
+ void SetPHOSAngles() ; // calculates the PHOS modules PHI angle
+
+public: