]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSGeometry.h
Calculation of cluster properties dep. on vertex posponed to TrackSegmentMaker
[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 // --- AliRoot header files ---
22
23 #include "AliGeometry.h"
24 #include "AliPHOSEMCAGeometry.h"
25 #include "AliPHOSCPVGeometry.h"
26 #include "AliPHOSSupportGeometry.h"
27
28
29 class AliPHOSGeometry : public AliGeometry {
30
31 public: 
32
33   AliPHOSGeometry() ;
34   AliPHOSGeometry(const AliPHOSGeometry & geom) ;
35   
36   virtual ~AliPHOSGeometry(void) ; 
37   static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title="") ; 
38   static AliPHOSGeometry * GetInstance() ; 
39   virtual void   GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrixF & gmat) const ;
40   virtual void   GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const ;
41   virtual Bool_t Impact(const TParticle * particle) const ;
42
43   AliPHOSGeometry & operator = (const AliPHOSGeometry  & /*rvalue*/) {
44     Fatal("operator =", "not implemented") ;
45     return *this ;    
46   }
47  
48   // General
49
50   static TString Degre(void) { return TString("deg") ; }  // a global for degree (deg)
51
52   static TString Radian(void){ return TString("rad") ; }  // a global for radian (rad)
53
54   Bool_t AbsToRelNumbering(Int_t AbsId, Int_t * RelId) const ; 
55                                           // converts the absolute PHOS numbering to a relative 
56
57   void EmcModuleCoverage(Int_t m, Double_t & tm, Double_t & tM, Double_t & pm, 
58                                           Double_t & pM, Option_t * opt = Radian() ) const ;
59                                          // calculates the angular coverage in theta and phi of a EMC module
60   void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = Radian() ) const ; 
61                                          // calculates the angular coverage in theta and phi of a  
62                                          // single crystal in a EMC module
63   void ImpactOnEmc(Double_t theta, Double_t phi, Int_t & ModuleNumber, 
64                          Double_t & z, Double_t & x) const ; 
65   void ImpactOnEmc(const TVector3& vec, Int_t & ModuleNumber, 
66                          Double_t & z, Double_t & x) const ; 
67   void ImpactOnEmc(const TParticle& p, Int_t & ModuleNumber, 
68                          Double_t & z, Double_t & x) const ; 
69                                         // calculates the impact coordinates of a neutral particle  
70                                          // emitted in direction theta and phi in ALICE
71   Bool_t IsInEMC(Int_t id) const { if (id > GetNModules() *  GetNCristalsInModule() ) return kFALSE; return kTRUE; } 
72   void RelPosInModule(const Int_t * RelId, Float_t & y, Float_t & z) const ; 
73                                          // gets the position of element (pad or Xtal) relative to 
74                                          // center of PHOS module  
75   void RelPosInAlice(Int_t AbsId, TVector3 &  pos) const ;             
76                                          // gets the position of element (pad or Xtal) relative to Alice
77   Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) const ;         
78                                          // converts the absolute PHOS numbering to a relative 
79   void  RelPosToAbsId(Int_t module, Double_t x, Double_t z, Int_t & AbsId) const; 
80                                          // converts local PHOS-module (x, z) coordinates to absId 
81
82   Bool_t IsInitialized(void)                  const { return fgInit ; }  
83                                                                        
84   // Return general PHOS parameters
85   Int_t    GetNModules(void)                    const { return fNModules ; }
86   Float_t  GetPHOSAngle(Int_t index)            const { return fPHOSAngle[index-1] ; }
87   Float_t* GetPHOSParams(void)                        { return fPHOSParams;}  //Half-sizes of PHOS trapecoid
88   Float_t  GetIPtoUpperCPVsurface(void)         const { return fIPtoUpperCPVsurface ; }
89   Float_t  GetOuterBoxSize(Int_t index)         const { return 2.*fPHOSParams[index]; }
90   Float_t  GetCrystalSize(Int_t index)          const { return fGeometryEMCA->GetCrystalSize(index) ;  }
91   Float_t  GetCellStep(void)                    const { return 2*(fGeometryEMCA->GetAirCellHalfSize()[0] + 
92                                                                   fGeometryEMCA->GetStripWallWidthOut()) ;}
93
94   Float_t GetModuleCenter(Int_t module, Int_t axis) const {
95     return fModuleCenter[module][axis];}
96   Float_t GetModuleAngle(Int_t module, Int_t axis, Int_t angle) const {
97     return fModuleAngle[module][axis][angle];}
98   
99
100   // Return EMCA geometry parameters
101
102   AliPHOSEMCAGeometry * GetEMCAGeometry()      const {return fGeometryEMCA ;}
103   Float_t   GetIPtoCrystalSurface(void)        const { return fGeometryEMCA->GetIPtoCrystalSurface() ; }
104   Float_t   GetIPtoOuterCoverDistance(void)    const { return fGeometryEMCA->GetIPtoOuterCoverDistance() ; }
105   Int_t     GetNPhi(void)                      const { return fGeometryEMCA->GetNPhi() ; }
106   Int_t     GetNZ(void)                        const { return fGeometryEMCA->GetNZ() ; }
107   Int_t     GetNCristalsInModule(void)         const { return fGeometryEMCA->GetNPhi() * fGeometryEMCA->GetNZ() ; }
108
109   // Return CPV geometry parameters
110   Int_t   GetNumberOfCPVLayers(void)           const { return fGeometryCPV ->GetNumberOfCPVLayers();      }
111   Float_t GetCPVActiveSize(Int_t index)        const { return fGeometryCPV->GetCPVActiveSize(index);      }
112   Int_t   GetNumberOfCPVChipsPhi(void)         const { return fGeometryCPV->GetNumberOfCPVChipsPhi();     }
113   Int_t   GetNumberOfCPVChipsZ(void)           const { return fGeometryCPV->GetNumberOfCPVChipsZ();       }
114   Int_t   GetNumberOfCPVPadsPhi(void)          const { return fGeometryCPV->GetNumberOfCPVPadsPhi();      }
115   Int_t   GetNumberOfCPVPadsZ(void)            const { return fGeometryCPV->GetNumberOfCPVPadsZ();        }
116   Float_t GetPadSizePhi(void)                  const { return fGeometryCPV->GetCPVPadSizePhi();           }
117   Float_t GetPadSizeZ(void)                    const { return fGeometryCPV->GetCPVPadSizeZ();             }
118   Float_t GetGassiplexChipSize(Int_t index)    const { return fGeometryCPV->GetGassiplexChipSize(index);  }
119   Float_t GetCPVGasThickness(void)             const { return fGeometryCPV->GetCPVGasThickness();         }
120   Float_t GetCPVTextoliteThickness(void)       const { return fGeometryCPV->GetCPVTextoliteThickness();   }
121   Float_t GetCPVCuNiFoilThickness(void)        const { return fGeometryCPV->GetCPVCuNiFoilThickness();    }
122   Float_t GetFTPosition(Int_t index)           const { return fGeometryCPV->GetFTPosition(index);         }
123   Float_t GetCPVFrameSize(Int_t index)         const { return fGeometryCPV->GetCPVFrameSize(index);       }
124   Float_t GetCPVBoxSize(Int_t index)           const { return fGeometryCPV ->GetCPVBoxSize(index);        } 
125   Float_t GetIPtoCPVDistance(void)             const { return  GetIPtoOuterCoverDistance() - 
126                                                                GetCPVBoxSize(1) - 1.0; }
127   void GetModuleCenter(TVector3& center, const char *det, Int_t module) const;
128   void Global2Local(TVector3& localPosition,
129                     const TVector3& globalPosition,
130                     Int_t module) const;
131
132   // Return PHOS' support geometry parameters
133
134   Float_t GetRailOuterSize(Int_t index)  const { return fGeometrySUPP->GetRailOuterSize(index); }
135   Float_t GetRailPart1    (Int_t index)  const { return fGeometrySUPP->GetRailPart1    (index); }
136   Float_t GetRailPart2    (Int_t index)  const { return fGeometrySUPP->GetRailPart2    (index); }
137   Float_t GetRailPart3    (Int_t index)  const { return fGeometrySUPP->GetRailPart3    (index); }
138   Float_t GetRailPos      (Int_t index)  const { return fGeometrySUPP->GetRailPos      (index); }
139   Float_t GetRailLength   (void)         const { return fGeometrySUPP->GetRailLength   ();      }
140   Float_t GetDistanceBetwRails(void)     const { return fGeometrySUPP->GetDistanceBetwRails();  }
141   Float_t GetRailsDistanceFromIP(void)   const { return fGeometrySUPP->GetRailsDistanceFromIP();}
142   Float_t GetRailRoadSize (Int_t index)  const { return fGeometrySUPP->GetRailRoadSize (index); }
143   Float_t GetCradleWallThickness(void)   const { return fGeometrySUPP->GetCradleWallThickness();}
144   Float_t GetCradleWall   (Int_t index)  const { return fGeometrySUPP->GetCradleWall   (index); }
145   Float_t GetCradleWheel  (Int_t index)  const { return fGeometrySUPP->GetCradleWheel  (index); }
146   void Init(void) ;            // steering method for PHOS and PPSD/CPV
147
148
149 protected:
150
151   AliPHOSGeometry(const Text_t* name, const Text_t* title="") ;
152 private:
153
154   Int_t                    fNModules ;       // Number of modules constituing PHOS
155   Float_t                  fAngle ;          // Position angles between modules
156   Float_t                 *fPHOSAngle ;      //[fNModules] Position angles of modules
157   Float_t                  fPHOSParams[4] ;  // Half-sizes of PHOS trapecoid
158   Float_t                  fIPtoUpperCPVsurface; // Minimal distance from IP to PHOS
159   TObjArray               *fRotMatrixArray ; // Liste of rotation matrices (one per phos module)
160   AliPHOSEMCAGeometry     *fGeometryEMCA ;   // Geometry object for Electromagnetic calorimeter
161   AliPHOSCPVGeometry      *fGeometryCPV ;    // Geometry object for CPV  (IHEP)
162   AliPHOSSupportGeometry  *fGeometrySUPP ;   // Geometry object for PHOS support
163   Float_t fModuleCenter[5][3];   // xyz-position of the module center
164   Float_t fModuleAngle[5][3][2]; // polar and azymuth angles for 3 axes of modules
165
166   void                     SetPHOSAngles();  // calculates the PHOS modules PHI angle
167
168   static AliPHOSGeometry * fgGeom ; // pointer to the unique instance of the singleton 
169   static Bool_t fgInit ;            // Tells if geometry has been succesfully set up 
170
171   ClassDef(AliPHOSGeometry,2)       // PHOS geometry class 
172
173 } ;
174
175 #endif // AliPHOSGEOMETRY_H