]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSGeometry.h
initialize pointer data member to zero in the default ctor to avoid problems with...
[u/mrichter/AliRoot.git] / PHOS / AliPHOSGeometry.h
index f379400585a73686e012abc373657d7d30d46774..88fbffc7800c42aac5c24d6f6a025f4b7fc53bbd 100644 (file)
@@ -12,6 +12,8 @@
 //                  
 //*-- Author: Yves Schutz (SUBATECH)
 
+#include <assert.h> 
+
 // --- ROOT system ---
 
 #include "TNamed.h"
@@ -24,8 +26,6 @@
 #include "AliGeometry.h"
 #include "AliPHOSRecPoint.h"
 
-static const TString kDegre("deg") ; 
-static const TString kRadian("rad") ; 
 
 class AliPHOSGeometry : public AliGeometry {
 
@@ -34,33 +34,51 @@ public:
   AliPHOSGeometry() {
     // default ctor 
     // must be kept public for root persistency purposes, but should never be called by the outside world
+    fPHOSAngle = 0 ; 
+
   } ;  
+  AliPHOSGeometry(const AliPHOSGeometry & geom) {
+    // cpy ctor requested by Coding Convention 
+    // but not yet needed
+    assert(0==1) ;
+  } 
+  
   virtual ~AliPHOSGeometry(void) ; 
-  static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title) ; 
+  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: 
-
+  AliPHOSGeometry & operator = (const AliPHOSGeometry  & rvalue) const {
+    // assignement operator requested by coding convention
+    // but not needed
+    assert(0==1) ;
+    return *(GetInstance()) ; 
+  }
   // General
 
+  static TString Degre(void) {
+    // a global for degree (deg)
+    return TString("deg") ; 
+  }
+
+  static TString Radian(void) { 
+    // a global for radian (rad)
+    return TString("rad") ; 
+  } 
+   
   Bool_t AbsToRelNumbering(const Int_t AbsId, Int_t * RelId) ; // converts the absolute PHOS numbering to a relative 
-  void EmcModuleCoverage(const Int_t m, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt = kRadian);    
+  void EmcModuleCoverage(const Int_t m, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt = Radian() );    
                                                          // calculates the angular coverage in theta and phi of a EMC module
-  void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = kRadian) ; 
+  void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = Radian() ) ; 
                                                                          // calculates the angular coverage in theta and phi of a 
                                                                          // single crystal in a EMC module
+
   void ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & x, Double_t & z) ; 
-                                                                         // calculates the impact coordinates of a neutral particle  
-                                                                         // emitted in direction theta and phi in ALICE
+                                                                          // calculates the impact coordinates of a neutral particle  
+                                                                          // emitted in direction theta and phi in ALICE
   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 
@@ -70,69 +88,174 @@ public:
 
   ///////////// 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    GetIPtoPpsdUp(void)                  const { return (fIPtoOuterCoverDistance - fPPSDBoxSize[1] + fPPSDModuleSize[1]/2 ); } 
-  Float_t    GetIPtoPpsdLow(void)                 const { return (fIPtoOuterCoverDistance - fPPSDModuleSize[1]/2 ); } 
-  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:
+  Bool_t     IsInitialized(void)                  const { 
+    // 
+    return fgInit ; }  
+  Float_t    GetAirFilledBoxSize(Int_t index)     const { 
+    // Getter
+    return fAirFilledBoxSize[index] ;}
+  Float_t    GetCrystalHolderThickness(void)      const { 
+    // Getter
+    return fCrystalHolderThickness ; } 
+  Float_t    GetCrystalSize(Int_t index)          const { 
+    // Getter
+    return fXtlSize[index] ; }
+  Float_t    GetCrystalSupportHeight(void)        const { 
+    // Getter 
+    return fCrystalSupportHeight ; } 
+  Float_t    GetCrystalWrapThickness(void)        const { 
+    // Getter
+    return fCrystalWrapThickness;}
+  Float_t    GetGapBetweenCrystals(void)          const { 
+    // Getter
+    return fGapBetweenCrystals ; }
+  Float_t    GetIPtoCrystalSurface(void)          const { 
+    // Getter
+    return fIPtoCrystalSurface ; }
+  Float_t    GetIPtoOuterCoverDistance(void)      const { 
+    // Getter
+    return fIPtoOuterCoverDistance ; }
+  Float_t    GetIPtoPpsdUp(void)                  const { 
+    // Getter
+    return (fIPtoOuterCoverDistance - fPPSDBoxSize[1] + fPPSDModuleSize[1]/2 ); } 
+  Float_t    GetIPtoPpsdLow(void)                 const { 
+    // Getter
+    return (fIPtoOuterCoverDistance - fPPSDModuleSize[1]/2 ); } 
+  Float_t    GetIPtoTopLidDistance(void)          const { 
+    // Getter
+    return fIPtoTopLidDistance ; }
+  Float_t    GetLowerThermoPlateThickness(void)   const { 
+    // Getter
+    return fLowerThermoPlateThickness ; }
+  Float_t    GetLowerTextolitPlateThickness(void) const { 
+    // Getter
+    return fLowerTextolitPlateThickness ; }
+  Float_t    GetModuleBoxThickness(void)          const { 
+    // Getter
+    return fModuleBoxThickness ; }
+  Int_t      GetNPhi(void)                        const { 
+    // Getter
+    return fNPhi ; }
+  Int_t      GetNZ(void)                          const { 
+    // Getter
+    return fNZ ; }
+  Int_t      GetNModules(void)                    const { 
+    // Getter
+    return fNModules ; }
+  Float_t    GetOuterBoxSize(Int_t index)         const { 
+    // Getter
+    return fOuterBoxSize[index] ;    }
+  Float_t    GetOuterBoxThickness(Int_t index)    const { 
+    // Getter
+    return fOuterBoxThickness[index] ; } 
+  Float_t    GetPHOSAngle(Int_t index)            const { 
+    // Getter
+    return fPHOSAngle[index-1] ; } 
+  Float_t    GetPinDiodeSize(Int_t index)         const { 
+    // Getter
+    return fPinDiodeSize[index] ; }
+  Float_t    GetSecondUpperPlateThickness(void)   const { 
+    // Getter
+    return fSecondUpperPlateThickness ; }
+  Float_t    GetSupportPlateThickness(void)       const { 
+    // Getter
+    return fSupportPlateThickness ; }    
+  Float_t    GetTextolitBoxSize(Int_t index)      const { 
+    // Getter
+    return fTextolitBoxSize[index] ; }
+  Float_t    GetTextolitBoxThickness(Int_t index) const { 
+    // Getter
+    return fTextolitBoxThickness[index]; } 
+  Float_t    GetUpperPlateThickness(void)         const { 
+    // Getter
+    return fUpperPlateThickness ; }
+  Float_t    GetUpperCoolingPlateThickness(void)  const { 
+    // Getter
+    return fUpperCoolingPlateThickness ; }
 
-  void       SetPHOSAngles() ; // calculates the PHOS modules PHI angle
-
-public: 
  
   ///////////// PPSD (PHOS PRE SHOWER DETECTOR)  related parameters
 
 
-  Float_t GetAnodeThickness(void)          const { return fAnodeThickness ; } 
-  Float_t GetAvalancheGap(void)            const { return fAvalancheGap ; }
-  Float_t GetCathodeThickness(void)        const { return fCathodeThickness ; } 
-  Float_t GetCompositeThickness(void)      const { return fCompositeThickness ; } 
-  Float_t GetConversionGap(void)           const { return fConversionGap ; } 
-  Float_t GetLeadConverterThickness(void)  const { return fLeadConverterThickness ; }
-  Float_t GetLeadToMicro2Gap(void)         const { return fLeadToMicro2Gap ; }       
-  Float_t GetLidThickness(void)            const { return fLidThickness ; }
-  Float_t GetMicromegas1Thickness(void)    const { return fMicromegas1Thickness ; } 
-  Float_t GetMicromegas2Thickness(void)    const { return fMicromegas2Thickness ; } 
-  Float_t GetMicromegasWallThickness(void) const { return fMicromegasWallThickness ; } 
-  Float_t GetMicro1ToLeadGap(void)         const { return fMicro1ToLeadGap ; } 
-  Int_t   GetNumberOfPadsPhi(void)         const { return fNumberOfPadsPhi ; }
-  Int_t   GetNumberOfPadsZ(void)           const { return fNumberOfPadsZ ; }
-  Int_t   GetNumberOfModulesPhi(void)      const { return fNumberOfModulesPhi ; }          
-  Int_t   GetNumberOfModulesZ(void)        const { return fNumberOfModulesZ ; }               
-  Float_t GetPCThickness(void)             const { return fPCThickness ; }   
-  Float_t GetPhiDisplacement(void)         const { return fPhiDisplacement ; }                           
-  Float_t GetPPSDBoxSize(Int_t index)      const { return fPPSDBoxSize[index] ; }
-  Float_t GetPPSDModuleSize(Int_t index)   const { return fPPSDModuleSize[index] ; } 
-  Float_t GetZDisplacement(void)           const { return fZDisplacement ; }                           
+  Float_t GetAnodeThickness(void)          const { 
+    // Getter
+    return fAnodeThickness ; } 
+  Float_t GetAvalancheGap(void)            const { 
+    // Getter
+    return fAvalancheGap ; }
+  Float_t GetCathodeThickness(void)        const { 
+    // Getter
+    return fCathodeThickness ; } 
+  Float_t GetCompositeThickness(void)      const { 
+    // Getter
+    return fCompositeThickness ; } 
+  Float_t GetConversionGap(void)           const { 
+    // Getter
+    return fConversionGap ; } 
+  Float_t GetLeadConverterThickness(void)  const { 
+    // Getter
+    return fLeadConverterThickness ; }
+  Float_t GetLeadToMicro2Gap(void)         const { 
+    // Getter
+    return fLeadToMicro2Gap ; }       
+  Float_t GetLidThickness(void)            const { 
+    // Getter
+    return fLidThickness ; }
+  Float_t GetMicromegas1Thickness(void)    const { 
+    // Getter
+    return fMicromegas1Thickness ; } 
+  Float_t GetMicromegas2Thickness(void)    const { 
+    // Getter
+    return fMicromegas2Thickness ; } 
+  Float_t GetMicromegasWallThickness(void) const { 
+    // Getter
+    return fMicromegasWallThickness ; } 
+  Float_t GetMicro1ToLeadGap(void)         const { 
+    // Getter
+    return fMicro1ToLeadGap ; } 
+  Int_t   GetNumberOfPadsPhi(void)         const { 
+    // Getter
+    return fNumberOfPadsPhi ; }
+  Int_t   GetNumberOfPadsZ(void)           const { 
+    // Getter
+    return fNumberOfPadsZ ; }
+  Int_t   GetNumberOfModulesPhi(void)      const { 
+    // Getter
+    return fNumberOfModulesPhi ; }          
+  Int_t   GetNumberOfModulesZ(void)        const { 
+    // Getter
+    return fNumberOfModulesZ ; }               
+  Float_t GetPCThickness(void)             const { 
+    // Getter
+    return fPCThickness ; }   
+  Float_t GetPhiDisplacement(void)         const { 
+    // Getter
+    return fPhiDisplacement ; }                           
+  Float_t GetPPSDBoxSize(Int_t index)      const { 
+    // Getter
+    return fPPSDBoxSize[index] ; }
+  Float_t GetPPSDModuleSize(Int_t index)   const { 
+    // Getter
+    return fPPSDModuleSize[index] ; } 
+  Float_t GetZDisplacement(void)           const { 
+    // Getter
+    return fZDisplacement ; }                           
  
   void SetLeadConverterThickness(Float_t e) ; // should ultimately disappear 
 
+protected:
+
+  AliPHOSGeometry(const Text_t* name, const Text_t* title="") : AliGeometry(name, title) { 
+    // ctor only for internal usage (singleton)
+    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
+
 private:
+
+  void       SetPHOSAngles() ; // calculates the PHOS modules PHI angle
   
   ///////////// PHOS related parameters
 
@@ -142,7 +265,6 @@ private:
   Float_t fCrystalWrapThickness ;         // Thickness of Tyvek wrapping the crystal
   Float_t fCrystalHolderThickness ;       // Titanium holder of the crystal
   Float_t fGapBetweenCrystals ;           // Total Gap between two adjacent crystals 
-  Bool_t  fInit ;                         // Tells if geometry has been succesfully set up 
   Float_t fIPtoOuterCoverDistance ;       // Distances from interaction point to outer cover 
   Float_t fIPtoCrystalSurface ;           // Distances from interaction point to Xtal surface
   Float_t fModuleBoxThickness ;           // Thickness of the thermo insulating box containing one crystals module 
@@ -191,6 +313,7 @@ private:
   Float_t fZDisplacement ;                // Z displacement of micromegas1 with respect to micromegas2  
 
   static AliPHOSGeometry * fgGeom ; // pointer to the unique instance of the singleton 
+  static Bool_t  fgInit ;            // Tells if geometry has been succesfully set up 
 
   ClassDef(AliPHOSGeometry,1)  // PHOS geometry class