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