]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSGeometry.h
New class AliPHOSCpvRecPoint
[u/mrichter/AliRoot.git] / PHOS / AliPHOSGeometry.h
CommitLineData
daa2ae2f 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
6ad0bfa0 6/* $Id$ */
7
b2a60966 8//_________________________________________________________________________
9// Geometry class for PHOS : singleton
10// The EMC modules are parametrized so that any configuration can be easily implemented
52a36ffd 11// The title is used to identify the type of CPV used. PPSD and CPV are implemented
b2a60966 12//
13//*-- Author: Yves Schutz (SUBATECH)
d15a28e7 14
6c370def 15#include <assert.h>
16
d15a28e7 17// --- ROOT system ---
18
daa2ae2f 19#include "TNamed.h"
20#include "TString.h"
21#include "TObjArray.h"
22#include "TVector3.h"
d15a28e7 23
24// --- AliRoot header files ---
25
daa2ae2f 26#include "AliGeometry.h"
eb92d866 27#include "AliPHOSEMCAGeometry.h"
28#include "AliPHOSCPVGeometry.h"
29#include "AliPHOSPPSDGeometry.h"
daa2ae2f 30#include "AliPHOSRecPoint.h"
31
9f616d61 32
daa2ae2f 33class AliPHOSGeometry : public AliGeometry {
34
35public:
36
88714635 37 AliPHOSGeometry() {
38 // default ctor
39 // must be kept public for root persistency purposes, but should never be called by the outside world
071153f8 40 fPHOSAngle = 0 ;
88714635 41 } ;
52a36ffd 42
6c370def 43 AliPHOSGeometry(const AliPHOSGeometry & geom) {
52a36ffd 44 // cpy ctor requested by Coding Convention but not yet needed
6c370def 45 assert(0==1) ;
46 }
47
daa2ae2f 48 virtual ~AliPHOSGeometry(void) ;
282c5906 49 static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title="") ;
daa2ae2f 50 static AliPHOSGeometry * GetInstance() ;
5cda30f6 51 virtual void GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat) const ;
52a36ffd 52 virtual void GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const ;
daa2ae2f 53
c6e196df 54 AliPHOSGeometry & operator = (const AliPHOSGeometry & rvalue) const {
52a36ffd 55 // assignement operator requested by coding convention but not needed
6c370def 56 assert(0==1) ;
57 return *(GetInstance()) ;
58 }
cf0c2bc1 59
daa2ae2f 60 // General
61
cf0c2bc1 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") ;
52a36ffd 70 }
71
b2a60966 72 Bool_t AbsToRelNumbering(const Int_t AbsId, Int_t * RelId) ; // converts the absolute PHOS numbering to a relative
52a36ffd 73
74 void EmcModuleCoverage(const Int_t m, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt = Radian() );
b2a60966 75 // calculates the angular coverage in theta and phi of a EMC module
cf0c2bc1 76 void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = Radian() ) ;
52a36ffd 77 // calculates the angular coverage in theta and phi of a
78 // single crystal in a EMC module
cf0c2bc1 79
9f616d61 80 void ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & x, Double_t & z) ;
52a36ffd 81 // calculates the impact coordinates of a neutral particle
82 // emitted in direction theta and phi in ALICE
cf0c2bc1 83
daa2ae2f 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
52a36ffd 89
90 Bool_t IsInitialized(void) const { return fgInit ; }
c198e326 91
52a36ffd 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
eb92d866 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(); }
52a36ffd 140
141 // Return CPV geometrical parameters
142
eb92d866 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); }
52a36ffd 153
154 // Common PPSD and CPV parameters
155
156 Int_t GetNumberOfCPVLayers(void) const {
157 if (strcmp(fName,"GPS2")==0) return 2;
eb92d866 158 else if (strcmp(fName,"IHEP")==0) return ((AliPHOSCPVGeometry*) fGeometryCPV)->GetNumberOfCPVLayers();
52a36ffd 159 else return 0;
160 }
daa2ae2f 161
52a36ffd 162 Float_t GetCPVBoxSize(Int_t index) const {
eb92d866 163 if (strcmp(fName,"GPS2")==0) return ((AliPHOSPPSDGeometry*) fGeometryCPV)->GetCPVBoxSize(index);
164 else if (strcmp(fName,"IHEP")==0) return ((AliPHOSCPVGeometry* ) fGeometryCPV)->GetCPVBoxSize(index);
52a36ffd 165 else return 0;
166 }
167
168 Int_t GetNumberOfModulesPhi(void) const {
eb92d866 169 if (strcmp(fName,"GPS2")==0) return ((AliPHOSPPSDGeometry*) fGeometryCPV)->GetNumberOfModulesPhi();
52a36ffd 170 else if (strcmp(fName,"IHEP")==0) return 1;
171 else return 0;
172 }
173
174 Int_t GetNumberOfModulesZ(void) const {
eb92d866 175 if (strcmp(fName,"GPS2")==0) return ((AliPHOSPPSDGeometry*) fGeometryCPV)->GetNumberOfModulesZ();
52a36ffd 176 else if (strcmp(fName,"IHEP")==0) return 1;
177 else return 0;
178 }
179
180 Int_t GetNumberOfPadsPhi(void) const {
eb92d866 181 if (strcmp(fName,"GPS2")==0) return ((AliPHOSPPSDGeometry*) fGeometryCPV)->GetNumberOfPadsPhi();
182 else if (strcmp(fName,"IHEP")==0) return ((AliPHOSCPVGeometry* ) fGeometryCPV)->GetNumberOfCPVPadsPhi();
52a36ffd 183 else return 0;
184 }
185
186 Int_t GetNumberOfPadsZ(void) const {
eb92d866 187 if (strcmp(fName,"GPS2")==0) return ((AliPHOSPPSDGeometry*) fGeometryCPV)->GetNumberOfPadsZ();
188 else if (strcmp(fName,"IHEP")==0) return ((AliPHOSCPVGeometry* ) fGeometryCPV)->GetNumberOfCPVPadsZ();
52a36ffd 189 else return 0;
190 }
191
192 Float_t GetPadSizePhi(void) const {
193 if (strcmp(fName,"GPS2")==0) return GetPPSDModuleSize(0) / GetNumberOfPadsPhi();
eb92d866 194 else if (strcmp(fName,"IHEP")==0) return ((AliPHOSCPVGeometry*) fGeometryCPV)->GetCPVPadSizePhi();
52a36ffd 195 else return 0;
196 }
197
198 Float_t GetPadSizeZ(void) const {
199 if (strcmp(fName,"GPS2")==0) return GetPPSDModuleSize(2) / GetNumberOfPadsZ();
eb92d866 200 else if (strcmp(fName,"IHEP")==0) return ((AliPHOSCPVGeometry*) fGeometryCPV)->GetCPVPadSizeZ();
52a36ffd 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; }
daa2ae2f 217
daa2ae2f 218
6c370def 219protected:
220
aafe457d 221 AliPHOSGeometry(const Text_t* name, const Text_t* title="") : AliGeometry(name, title) {
6c370def 222 // ctor only for internal usage (singleton)
223 Init() ;
52a36ffd 224 }
225 void Init(void) ; // steering method for PHOS and PPSD/CPV
6c370def 226
daa2ae2f 227private:
6c370def 228
eb92d866 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)
52a36ffd 234
235 void SetPHOSAngles(); // calculates the PHOS modules PHI angle
daa2ae2f 236
88714635 237 static AliPHOSGeometry * fgGeom ; // pointer to the unique instance of the singleton
52a36ffd 238 static Bool_t fgInit ; // Tells if geometry has been succesfully set up
daa2ae2f 239
52a36ffd 240 ClassDef(AliPHOSGeometry,1) // PHOS geometry class
daa2ae2f 241
242} ;
243
244#endif // AliPHOSGEOMETRY_H