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