]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSGeometry.h
coding conventions corrections
[u/mrichter/AliRoot.git] / PHOS / AliPHOSGeometry.h
1 #ifndef ALIPHOSGEOMETRY_H
2 #define ALIPHOSGEOMETRY_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //_________________________________________________________________________
9 // Geometry class  for PHOS : singleton
10 // PHOS consists of the electromagnetic calorimeter (EMCA)
11 // and a charged particle veto either in the Subatech's version (PPSD)
12 // or in the IHEP's one (CPV).
13 // The EMCA/PPSD/CPV modules are parametrized so that any configuration
14 // can be easily implemented 
15 // The title is used to identify the version of CPV used.
16 // 
17 //*-- Author: Yves Schutz (SUBATECH)
18
19 // --- ROOT system ---
20
21 #include "TString.h"
22 #include "TObjArray.h"
23 #include "TParticle.h"
24 #include "TVector3.h" 
25
26 // --- AliRoot header files ---
27
28 #include "AliGeometry.h"
29
30 #include "AliPHOSEMCAGeometry.h"
31 #include "AliPHOSCPVGeometry.h"
32 #include "AliPHOSSupportGeometry.h"
33
34
35 class AliPHOSGeometry : public AliGeometry {
36
37 public: 
38
39   AliPHOSGeometry() ;
40
41   AliPHOSGeometry(const AliPHOSGeometry & geom) {
42     // cpy ctor requested by Coding Convention but not yet needed
43     Fatal("cpy ctor", "not implemented") ;
44   } 
45   
46   virtual ~AliPHOSGeometry(void) ; 
47   static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title="") ; 
48   static AliPHOSGeometry * GetInstance() ; 
49   virtual void   GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat) const ;
50   virtual void   GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const ;
51   virtual Bool_t Impact(const TParticle * particle) const ;
52
53   AliPHOSGeometry & operator = (const AliPHOSGeometry  & rvalue) const {
54     // assignement operator requested by coding convention but not needed
55     Fatal("operator =", "not implemented") ; return *(GetInstance()) ; 
56   }
57  
58   // General
59
60   static TString Degre(void) { return TString("deg") ; }  // a global for degree (deg)
61
62   static TString Radian(void){ return TString("rad") ; }  // a global for radian (rad)
63
64   Bool_t AbsToRelNumbering(const Int_t AbsId, Int_t * RelId) const ; 
65                                           // converts the absolute PHOS numbering to a relative 
66
67   void EmcModuleCoverage(const Int_t m, Double_t & tm, Double_t & tM, Double_t & pm, 
68                                           Double_t & pM, Option_t * opt = Radian() ) const ;
69                                          // calculates the angular coverage in theta and phi of a EMC module
70   void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = Radian() ) const ; 
71                                          // calculates the angular coverage in theta and phi of a  
72                                          // single crystal in a EMC module
73   void ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, 
74                          Double_t & z, Double_t & x) const ; 
75                                          // calculates the impact coordinates of a neutral particle  
76                                          // emitted in direction theta and phi in ALICE
77   Bool_t IsInEMC(const Int_t id) const { if (id > GetNModules() *  GetNCristalsInModule() ) return kFALSE; return kTRUE; } 
78   void RelPosInModule(const Int_t * RelId, Float_t & y, Float_t & z) const ; 
79                                          // gets the position of element (pad or Xtal) relative to 
80                                          // center of PHOS module  
81   void RelPosInAlice(const Int_t AbsId, TVector3 &  pos) const ;             
82                                          // gets the position of element (pad or Xtal) relative to Alice
83   Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) const ;         
84                                          // converts the absolute PHOS numbering to a relative 
85   void RelPosToAbsId(const Int_t module , const Double_t x, const Double_t z, Int_t & AbsId)const;                       // Converts local PHOS-module (x, z) coordinates to absId
86   Bool_t IsInitialized(void)                  const { return fgInit ; }  
87                                                                        
88   // Return general PHOS parameters
89   Int_t    GetNModules(void)                    const { return fNModules ; }
90   Float_t  GetPHOSAngle(Int_t index)            const { return fPHOSAngle[index-1] ; }
91   Float_t* GetPHOSParams(void)                        { return fPHOSParams;}  //Half-sizes of PHOS trapecoid
92   Float_t  GetIPtoUpperCPVsurface(void)         const { return fIPtoUpperCPVsurface ; }
93   Float_t  GetOuterBoxSize(Int_t index)         const { return 2.*fPHOSParams[index]; }
94   Float_t  GetCrystalSize(Int_t index)          const { return fGeometryEMCA->GetCrystalSize(index) ;  }
95   Float_t  GetCellStep(void)                    const { return 2*(fGeometryEMCA->GetAirCellHalfSize()[0] + 
96                                                                   fGeometryEMCA->GetStripWallWidthOut()) ;}
97
98   // Return EMCA geometry parameters
99
100   AliPHOSEMCAGeometry * GetEMCAGeometry()      const {return fGeometryEMCA ;}
101   Float_t   GetIPtoCrystalSurface(void)        const { return fGeometryEMCA->GetIPtoCrystalSurface() ; }
102   Float_t   GetIPtoOuterCoverDistance(void)    const { return fGeometryEMCA->GetIPtoOuterCoverDistance() ; }
103   Int_t     GetNPhi(void)                      const { return fGeometryEMCA->GetNPhi() ; }
104   Int_t     GetNZ(void)                        const { return fGeometryEMCA->GetNZ() ; }
105   Int_t     GetNCristalsInModule(void)         const { return fGeometryEMCA->GetNPhi() * fGeometryEMCA->GetNZ() ; }
106
107   // Return CPV geometry parameters
108   Int_t   GetNumberOfCPVLayers(void)           const { return fGeometryCPV ->GetNumberOfCPVLayers();      }
109   Float_t GetCPVActiveSize(Int_t index)        const { return fGeometryCPV->GetCPVActiveSize(index);      }
110   Int_t   GetNumberOfCPVChipsPhi(void)         const { return fGeometryCPV->GetNumberOfCPVChipsPhi();     }
111   Int_t   GetNumberOfCPVChipsZ(void)           const { return fGeometryCPV->GetNumberOfCPVChipsZ();       }
112   Int_t   GetNumberOfCPVPadsPhi(void)          const { return fGeometryCPV->GetNumberOfCPVPadsPhi();      }
113   Int_t   GetNumberOfCPVPadsZ(void)            const { return fGeometryCPV->GetNumberOfCPVPadsZ();        }
114   Float_t GetPadSizePhi(void)                  const { return fGeometryCPV->GetCPVPadSizePhi();           }
115   Float_t GetPadSizeZ(void)                    const { return fGeometryCPV->GetCPVPadSizeZ();             }
116   Float_t GetGassiplexChipSize(Int_t index)    const { return fGeometryCPV->GetGassiplexChipSize(index);  }
117   Float_t GetCPVGasThickness(void)             const { return fGeometryCPV->GetCPVGasThickness();         }
118   Float_t GetCPVTextoliteThickness(void)       const { return fGeometryCPV->GetCPVTextoliteThickness();   }
119   Float_t GetCPVCuNiFoilThickness(void)        const { return fGeometryCPV->GetCPVCuNiFoilThickness();    }
120   Float_t GetFTPosition(Int_t index)           const { return fGeometryCPV->GetFTPosition(index);         }
121   Float_t GetCPVFrameSize(Int_t index)         const { return fGeometryCPV->GetCPVFrameSize(index);       }
122   Float_t GetCPVBoxSize(Int_t index)           const { return fGeometryCPV ->GetCPVBoxSize(index);        } 
123   Float_t GetIPtoCPVDistance(void)             const { return  GetIPtoOuterCoverDistance() - 
124                                                                GetCPVBoxSize(1) - 1.0; }
125
126   // Return PHOS' support geometry parameters
127
128   Float_t GetRailOuterSize(Int_t index)  const { return fGeometrySUPP->GetRailOuterSize(index); }
129   Float_t GetRailPart1    (Int_t index)  const { return fGeometrySUPP->GetRailPart1    (index); }
130   Float_t GetRailPart2    (Int_t index)  const { return fGeometrySUPP->GetRailPart2    (index); }
131   Float_t GetRailPart3    (Int_t index)  const { return fGeometrySUPP->GetRailPart3    (index); }
132   Float_t GetRailPos      (Int_t index)  const { return fGeometrySUPP->GetRailPos      (index); }
133   Float_t GetRailLength   (void)         const { return fGeometrySUPP->GetRailLength   ();      }
134   Float_t GetDistanceBetwRails(void)     const { return fGeometrySUPP->GetDistanceBetwRails();  }
135   Float_t GetRailsDistanceFromIP(void)   const { return fGeometrySUPP->GetRailsDistanceFromIP();}
136   Float_t GetRailRoadSize (Int_t index)  const { return fGeometrySUPP->GetRailRoadSize (index); }
137   Float_t GetCradleWallThickness(void)   const { return fGeometrySUPP->GetCradleWallThickness();}
138   Float_t GetCradleWall   (Int_t index)  const { return fGeometrySUPP->GetCradleWall   (index); }
139   Float_t GetCradleWheel  (Int_t index)  const { return fGeometrySUPP->GetCradleWheel  (index); }
140
141 protected:
142
143   AliPHOSGeometry(const Text_t* name, const Text_t* title="") : AliGeometry(name, title) { 
144     // ctor only for internal usage (singleton)
145     Init() ; 
146   }
147   void Init(void) ;            // steering method for PHOS and PPSD/CPV
148
149 private:
150
151   Int_t                    fNModules ;       // Number of modules constituing PHOS
152   Float_t                  fAngle ;          // Position angles between modules
153   Float_t                 *fPHOSAngle ;      //[fNModules] Position angles of modules
154   Float_t                  fPHOSParams[4] ;  // Half-sizes of PHOS trapecoid
155   Float_t                  fIPtoUpperCPVsurface; // Minimal distance from IP to PHOS
156   TObjArray               *fRotMatrixArray ; // Liste of rotation matrices (one per phos module)
157   AliPHOSEMCAGeometry     *fGeometryEMCA ;   // Geometry object for Electromagnetic calorimeter
158   AliPHOSCPVGeometry      *fGeometryCPV ;    // Geometry object for CPV  (IHEP)
159   AliPHOSSupportGeometry  *fGeometrySUPP ;   // Geometry object for PHOS support
160
161   void                     SetPHOSAngles();  // calculates the PHOS modules PHI angle
162
163   static AliPHOSGeometry * fgGeom ; // pointer to the unique instance of the singleton 
164   static Bool_t fgInit ;            // Tells if geometry has been succesfully set up 
165
166   ClassDef(AliPHOSGeometry,1)       // PHOS geometry class 
167
168 } ;
169
170 #endif // AliPHOSGEOMETRY_H