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