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