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