]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSGeometry.h
Put vacuum in beam-pipe not air.
[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 #include <assert.h> 
20
21 // --- ROOT system ---
22
23 #include "TNamed.h"
24 #include "TString.h"
25 #include "TObjArray.h"
26 #include "TVector3.h" 
27
28 // --- AliRoot header files ---
29
30 #include "AliGeometry.h"
31 #include "AliPHOSEMCAGeometry.h"
32 #include "AliPHOSCPVGeometry.h"
33 #include "AliPHOSPPSDGeometry.h"
34 #include "AliPHOSSupportGeometry.h"
35 #include "AliPHOSRecPoint.h"
36
37
38 class AliPHOSGeometry : public AliGeometry {
39
40 public: 
41
42   AliPHOSGeometry() {
43     // default ctor 
44     // must be kept public for root persistency purposes, but should never be called by the outside world
45     fPHOSAngle = 0 ; 
46   } ;  
47
48   AliPHOSGeometry(const AliPHOSGeometry & geom) {
49     // cpy ctor requested by Coding Convention but not yet needed
50     assert(0==1) ;
51   } 
52   
53   virtual ~AliPHOSGeometry(void) ; 
54   static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title="") ; 
55   static AliPHOSGeometry * GetInstance() ; 
56   virtual void  GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat) const ;
57   virtual void  GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const ;
58
59   AliPHOSGeometry & operator = (const AliPHOSGeometry  & rvalue) const {
60     // assignement operator requested by coding convention but not needed
61     assert(0==1) ;
62     return *(GetInstance()) ; 
63   }
64  
65   // General
66
67   static TString Degre(void) {
68     // a global for degree (deg)
69     return TString("deg") ; 
70   }
71
72   static TString Radian(void) { 
73     // a global for radian (rad)
74     return TString("rad") ; 
75   }
76
77   Bool_t AbsToRelNumbering(const Int_t AbsId, Int_t * RelId) ; // converts the absolute PHOS numbering to a relative 
78
79   void EmcModuleCoverage(const Int_t m, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt = Radian() );
80                                                          // calculates the angular coverage in theta and phi of a EMC module
81   void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = Radian() ) ; 
82                                                          // calculates the angular coverage in theta and phi of a 
83                                                          // single crystal in a EMC module
84
85   void ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & z, Double_t & x) ; 
86                                                          // calculates the impact coordinates of a neutral particle  
87                                                          // emitted in direction theta and phi in ALICE
88  
89   void   RelPosInModule(const Int_t * RelId, Float_t & y, Float_t & z) ; // gets the position of element (pad or Xtal) relative to 
90                                                                          // center of PHOS module  
91   void   RelPosInAlice(const Int_t AbsId, TVector3 &  pos) ;             // gets the position of element (pad or Xtal) relative to 
92                                                                          // Alice
93   Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) ;         // converts the absolute PHOS numbering to a relative 
94
95   Bool_t  IsInitialized(void)                  const { return fgInit ; }  
96                                                                        
97   // Return general PHOS parameters
98
99   Int_t   GetNModules(void)                    const { return fNModules ; }
100   Int_t   GetNPPSDModules(void)                const { return fNPPSDModules ; }
101   Int_t   GetNCPVModules(void)                 const { return fNModules - fNPPSDModules ; }
102   Float_t GetPHOSAngle(Int_t index)            const { return fPHOSAngle[index-1] ; }
103
104   // Return EMCA geometrical parameters
105
106   Float_t GetOuterBoxSize(Int_t index)         const { return fGeometryEMCA->GetOuterBoxSize(index);            }
107   Float_t GetAirFilledBoxSize(Int_t index)     const { return fGeometryEMCA->GetAirFilledBoxSize(index) ;       }
108   Float_t GetCrystalHolderThickness(void)      const { return fGeometryEMCA->GetCrystalHolderThickness() ;      }
109   Float_t GetCrystalSize(Int_t index)          const { return fGeometryEMCA->GetCrystalSize(index) ;            }
110   Float_t GetCrystalSupportHeight(void)        const { return fGeometryEMCA->GetCrystalSupportHeight() ;        }
111   Float_t GetCrystalWrapThickness(void)        const { return fGeometryEMCA->GetCrystalWrapThickness() ;        }
112   Float_t GetGapBetweenCrystals(void)          const { return fGeometryEMCA->GetGapBetweenCrystals() ;          }
113   Float_t GetIPtoCrystalSurface(void)          const { return fGeometryEMCA->GetIPtoCrystalSurface() ;          }
114   Float_t GetIPtoOuterCoverDistance(void)      const { return fGeometryEMCA->GetIPtoOuterCoverDistance() ;      }
115   Float_t GetLowerThermoPlateThickness(void)   const { return fGeometryEMCA->GetLowerThermoPlateThickness() ;   }
116   Float_t GetLowerTextolitPlateThickness(void) const { return fGeometryEMCA->GetLowerTextolitPlateThickness() ; }
117   Float_t GetModuleBoxThickness(void)          const { return fGeometryEMCA->GetModuleBoxThickness() ;          }
118   Int_t   GetNPhi(void)                        const { return fGeometryEMCA->GetNPhi() ;                        }
119   Int_t   GetNZ(void)                          const { return fGeometryEMCA->GetNZ() ;                          }
120   Float_t GetOuterBoxThickness(Int_t index)    const { return fGeometryEMCA->GetOuterBoxThickness(index) ;      }
121   Float_t GetPinDiodeSize(Int_t index)         const { return fGeometryEMCA->GetPinDiodeSize(index) ;           }
122   Float_t GetSecondUpperPlateThickness(void)   const { return fGeometryEMCA->GetSecondUpperPlateThickness() ;   }
123   Float_t GetSupportPlateThickness(void)       const { return fGeometryEMCA->GetSupportPlateThickness() ;       }
124   Float_t GetTextolitBoxSize(Int_t index)      const { return fGeometryEMCA->GetTextolitBoxSize(index) ;        }
125   Float_t GetTextolitBoxThickness(Int_t index) const { return fGeometryEMCA->GetTextolitBoxThickness(index);    }
126   Float_t GetUpperPlateThickness(void)         const { return fGeometryEMCA->GetUpperPlateThickness() ;         }
127   Float_t GetUpperCoolingPlateThickness(void)  const { return fGeometryEMCA->GetUpperCoolingPlateThickness() ;  }
128
129   // Return PPSD geometrical parameters
130
131   Float_t GetAnodeThickness(void)              const { return fGeometryPPSD->GetAnodeThickness();         }
132   Float_t GetAvalancheGap(void)                const { return fGeometryPPSD->GetAvalancheGap();           }
133   Float_t GetCathodeThickness(void)            const { return fGeometryPPSD->GetCathodeThickness();       }
134   Float_t GetCompositeThickness(void)          const { return fGeometryPPSD->GetCompositeThickness();     }
135   Float_t GetConversionGap(void)               const { return fGeometryPPSD->GetConversionGap();          }
136   Float_t GetLeadConverterThickness(void)      const { return fGeometryPPSD->GetLeadConverterThickness(); }
137   Float_t GetLeadToMicro2Gap(void)             const { return fGeometryPPSD->GetLeadToMicro2Gap();        }
138   Float_t GetLidThickness(void)                const { return fGeometryPPSD->GetLidThickness();           }
139   Float_t GetMicromegas1Thickness(void)        const { return fGeometryPPSD->GetMicromegas1Thickness();   }
140   Float_t GetMicromegas2Thickness(void)        const { return fGeometryPPSD->GetMicromegas2Thickness();   }
141   Float_t GetMicromegasWallThickness(void)     const { return fGeometryPPSD->GetMicromegasWallThickness();}
142   Float_t GetMicro1ToLeadGap(void)             const { return fGeometryPPSD->GetMicro1ToLeadGap();        }
143   Int_t   GetNumberOfModulesPhi(void)          const { return fGeometryPPSD->GetNumberOfModulesPhi();     }
144   Int_t   GetNumberOfModulesZ(void)            const { return fGeometryPPSD->GetNumberOfModulesZ();       }
145   Int_t   GetNumberOfPadsPhi(void)             const { return fGeometryPPSD->GetNumberOfPadsPhi();        }
146   Int_t   GetNumberOfPadsZ(void)               const { return fGeometryPPSD->GetNumberOfPadsZ();          }
147   Float_t GetPCThickness(void)                 const { return fGeometryPPSD->GetPCThickness();            }
148   Float_t GetPhiDisplacement(void)             const { return fGeometryPPSD->GetPhiDisplacement();        }
149   Float_t GetPPSDModuleSize(Int_t index)       const { return fGeometryPPSD->GetPPSDModuleSize(index);    }
150   Float_t GetZDisplacement(void)               const { return fGeometryPPSD->GetZDisplacement();          }
151   void    SetLeadConverterThickness(Float_t x) const {        fGeometryPPSD->SetLeadConverterThickness(x);}
152
153   // Return CPV geometrical parameters
154
155   Int_t   GetNumberOfCPVLayers(void)           const { return fGeometryCPV ->GetNumberOfCPVLayers();      }
156   Bool_t  IsLeadConverterExists(void)          const { return fGeometryCPV->IsLeadConverterExists();      }
157   Float_t GetCPVActiveSize(Int_t index)        const { return fGeometryCPV->GetCPVActiveSize(index);      }
158   Int_t   GetNumberOfCPVChipsPhi(void)         const { return fGeometryCPV->GetNumberOfCPVChipsPhi();     }
159   Int_t   GetNumberOfCPVChipsZ(void)           const { return fGeometryCPV->GetNumberOfCPVChipsZ();       }
160   Int_t   GetNumberOfCPVPadsPhi(void)          const { return fGeometryCPV->GetNumberOfCPVPadsPhi();      }
161   Int_t   GetNumberOfCPVPadsZ(void)            const { return fGeometryCPV->GetNumberOfCPVPadsZ();        }
162   Float_t GetPadSizePhi(void)                  const { return fGeometryCPV->GetCPVPadSizePhi();           }
163   Float_t GetPadSizeZ(void)                    const { return fGeometryCPV->GetCPVPadSizeZ();             }
164   Float_t GetGassiplexChipSize(Int_t index)    const { return fGeometryCPV->GetGassiplexChipSize(index);  }
165   Float_t GetCPVGasThickness(void)             const { return fGeometryCPV->GetCPVGasThickness();         }
166   Float_t GetCPVTextoliteThickness(void)       const { return fGeometryCPV->GetCPVTextoliteThickness();   }
167   Float_t GetCPVCuNiFoilThickness(void)        const { return fGeometryCPV->GetCPVCuNiFoilThickness();    }
168   Float_t GetFTPosition(Int_t index)           const { return fGeometryCPV->GetFTPosition(index);         }
169   Float_t GetCPVFrameSize(Int_t index)         const { return fGeometryCPV->GetCPVFrameSize(index);       }
170
171   // Common PPSD and CPV parameters
172
173   Float_t GetCPVBoxSize(Int_t index)  const ;
174
175   // Mixed EMCA and PPSD parameters
176
177   Float_t GetIPtoPpsdUp(void)                  const {
178     return (GetIPtoOuterCoverDistance() - GetCPVBoxSize(1) + GetPPSDModuleSize(1)/2 ); } 
179   Float_t GetIPtoTopLidDistance(void)          const { 
180     return  GetIPtoOuterCoverDistance() - GetCPVBoxSize(1) - 1. ; } 
181   Float_t GetIPtoPpsdLow(void)                 const { 
182     return (GetIPtoOuterCoverDistance() - GetPPSDModuleSize(1)/2 ); } 
183
184   // Mixed EMCA and CPV parameters
185
186   Float_t GetIPtoCPVDistance(void)             const {
187     return  GetIPtoOuterCoverDistance() - GetCPVBoxSize(1) - 1.0; }
188
189   // Return PHOS' support geometrical parameters
190
191   Float_t GetRailOuterSize(Int_t index)  const { return fGeometrySUPP->GetRailOuterSize(index); }
192   Float_t GetRailPart1    (Int_t index)  const { return fGeometrySUPP->GetRailPart1    (index); }
193   Float_t GetRailPart2    (Int_t index)  const { return fGeometrySUPP->GetRailPart2    (index); }
194   Float_t GetRailPart3    (Int_t index)  const { return fGeometrySUPP->GetRailPart3    (index); }
195   Float_t GetRailPos      (Int_t index)  const { return fGeometrySUPP->GetRailPos      (index); }
196   Float_t GetRailLength   ()             const { return fGeometrySUPP->GetRailLength   ();      }
197   Float_t GetDistanceBetwRails()         const { return fGeometrySUPP->GetDistanceBetwRails();  }
198   Float_t GetRailsDistanceFromIP()       const { return fGeometrySUPP->GetRailsDistanceFromIP();}
199   Float_t GetRailRoadSize (Int_t index)  const { return fGeometrySUPP->GetRailRoadSize (index); }
200   Float_t GetCradleWallThickness()       const { return fGeometrySUPP->GetCradleWallThickness();}
201   Float_t GetCradleWall   (Int_t index)  const { return fGeometrySUPP->GetCradleWall   (index); }
202   Float_t GetCradleWheel  (Int_t index)  const { return fGeometrySUPP->GetCradleWheel  (index); }
203
204 protected:
205
206   AliPHOSGeometry(const Text_t* name, const Text_t* title="") : AliGeometry(name, title) { 
207     // ctor only for internal usage (singleton)
208     Init() ; 
209   }
210   void Init(void) ;            // steering method for PHOS and PPSD/CPV
211
212 private:
213
214   Int_t                    fNModules ;       // Number of modules constituing PHOS
215   Int_t                    fNPPSDModules ;   // Number of PPSD modules
216   Float_t                  fAngle ;          // Position angles between modules
217   Float_t                 *fPHOSAngle ;      //[fNModules] Position angles of modules
218   TObjArray               *fRotMatrixArray ; // Liste of rotation matrices (one per phos module)
219   AliPHOSEMCAGeometry     *fGeometryEMCA ;   // Geometry object for Electromagnetic calorimeter
220   AliPHOSCPVGeometry      *fGeometryCPV ;    // Geometry object for CPV  (IHEP)
221   AliPHOSPPSDGeometry     *fGeometryPPSD ;   // Geometry object for PPSD (GPS2)
222   AliPHOSSupportGeometry  *fGeometrySUPP ;   // Geometry object for PHOS support
223
224   void                     SetPHOSAngles();  // calculates the PHOS modules PHI angle
225
226   static AliPHOSGeometry * fgGeom ; // pointer to the unique instance of the singleton 
227   static Bool_t fgInit ;            // Tells if geometry has been succesfully set up 
228
229   ClassDef(AliPHOSGeometry,1)       // PHOS geometry class 
230
231 } ;
232
233 #endif // AliPHOSGEOMETRY_H