Rename of version v4
[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 "TString.h"
24#include "TObjArray.h"
25#include "TVector3.h"
d15a28e7 26
27// --- AliRoot header files ---
28
daa2ae2f 29#include "AliGeometry.h"
468794ea 30
eb92d866 31#include "AliPHOSEMCAGeometry.h"
32#include "AliPHOSCPVGeometry.h"
33#include "AliPHOSPPSDGeometry.h"
ed19b2e1 34#include "AliPHOSSupportGeometry.h"
daa2ae2f 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
7b7c1533 76 Bool_t AbsToRelNumbering(const Int_t AbsId, Int_t * RelId) const ; // converts the absolute PHOS numbering to a relative
52a36ffd 77
7b7c1533 78 void EmcModuleCoverage(const Int_t m, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt = Radian() ) const ;
b2a60966 79 // calculates the angular coverage in theta and phi of a EMC module
7b7c1533 80 void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = Radian() ) const ;
52a36ffd 81 // calculates the angular coverage in theta and phi of a
82 // single crystal in a EMC module
cf0c2bc1 83
7b7c1533 84 void ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & z, Double_t & x) const ;
52a36ffd 85 // calculates the impact coordinates of a neutral particle
86 // emitted in direction theta and phi in ALICE
5ccb0008 87 Bool_t IsInEMC(const Int_t id) const ;
7b7c1533 88 void RelPosInModule(const Int_t * RelId, Float_t & y, Float_t & z) const ; // gets the position of element (pad or Xtal) relative to
daa2ae2f 89 // center of PHOS module
7b7c1533 90 void RelPosInAlice(const Int_t AbsId, TVector3 & pos) const ; // gets the position of element (pad or Xtal) relative to
daa2ae2f 91 // Alice
7b7c1533 92 Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) const ; // 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 ; }
ed4205d8 99 Int_t GetNPPSDModules(void) const { return fNPPSDModules ; }
100 Int_t GetNCPVModules(void) const { return fNModules - fNPPSDModules ; }
52a36ffd 101 Float_t GetPHOSAngle(Int_t index) const { return fPHOSAngle[index-1] ; }
102
103 // Return EMCA geometrical parameters
104
105 Float_t GetOuterBoxSize(Int_t index) const { return fGeometryEMCA->GetOuterBoxSize(index); }
106 Float_t GetAirFilledBoxSize(Int_t index) const { return fGeometryEMCA->GetAirFilledBoxSize(index) ; }
107 Float_t GetCrystalHolderThickness(void) const { return fGeometryEMCA->GetCrystalHolderThickness() ; }
108 Float_t GetCrystalSize(Int_t index) const { return fGeometryEMCA->GetCrystalSize(index) ; }
109 Float_t GetCrystalSupportHeight(void) const { return fGeometryEMCA->GetCrystalSupportHeight() ; }
110 Float_t GetCrystalWrapThickness(void) const { return fGeometryEMCA->GetCrystalWrapThickness() ; }
111 Float_t GetGapBetweenCrystals(void) const { return fGeometryEMCA->GetGapBetweenCrystals() ; }
112 Float_t GetIPtoCrystalSurface(void) const { return fGeometryEMCA->GetIPtoCrystalSurface() ; }
113 Float_t GetIPtoOuterCoverDistance(void) const { return fGeometryEMCA->GetIPtoOuterCoverDistance() ; }
114 Float_t GetLowerThermoPlateThickness(void) const { return fGeometryEMCA->GetLowerThermoPlateThickness() ; }
115 Float_t GetLowerTextolitPlateThickness(void) const { return fGeometryEMCA->GetLowerTextolitPlateThickness() ; }
116 Float_t GetModuleBoxThickness(void) const { return fGeometryEMCA->GetModuleBoxThickness() ; }
117 Int_t GetNPhi(void) const { return fGeometryEMCA->GetNPhi() ; }
118 Int_t GetNZ(void) const { return fGeometryEMCA->GetNZ() ; }
119 Float_t GetOuterBoxThickness(Int_t index) const { return fGeometryEMCA->GetOuterBoxThickness(index) ; }
120 Float_t GetPinDiodeSize(Int_t index) const { return fGeometryEMCA->GetPinDiodeSize(index) ; }
121 Float_t GetSecondUpperPlateThickness(void) const { return fGeometryEMCA->GetSecondUpperPlateThickness() ; }
122 Float_t GetSupportPlateThickness(void) const { return fGeometryEMCA->GetSupportPlateThickness() ; }
123 Float_t GetTextolitBoxSize(Int_t index) const { return fGeometryEMCA->GetTextolitBoxSize(index) ; }
124 Float_t GetTextolitBoxThickness(Int_t index) const { return fGeometryEMCA->GetTextolitBoxThickness(index); }
125 Float_t GetUpperPlateThickness(void) const { return fGeometryEMCA->GetUpperPlateThickness() ; }
126 Float_t GetUpperCoolingPlateThickness(void) const { return fGeometryEMCA->GetUpperCoolingPlateThickness() ; }
127
128 // Return PPSD geometrical parameters
129
ed4205d8 130 Float_t GetAnodeThickness(void) const { return fGeometryPPSD->GetAnodeThickness(); }
131 Float_t GetAvalancheGap(void) const { return fGeometryPPSD->GetAvalancheGap(); }
132 Float_t GetCathodeThickness(void) const { return fGeometryPPSD->GetCathodeThickness(); }
133 Float_t GetCompositeThickness(void) const { return fGeometryPPSD->GetCompositeThickness(); }
134 Float_t GetConversionGap(void) const { return fGeometryPPSD->GetConversionGap(); }
135 Float_t GetLeadConverterThickness(void) const { return fGeometryPPSD->GetLeadConverterThickness(); }
136 Float_t GetLeadToMicro2Gap(void) const { return fGeometryPPSD->GetLeadToMicro2Gap(); }
137 Float_t GetLidThickness(void) const { return fGeometryPPSD->GetLidThickness(); }
138 Float_t GetMicromegas1Thickness(void) const { return fGeometryPPSD->GetMicromegas1Thickness(); }
139 Float_t GetMicromegas2Thickness(void) const { return fGeometryPPSD->GetMicromegas2Thickness(); }
140 Float_t GetMicromegasWallThickness(void) const { return fGeometryPPSD->GetMicromegasWallThickness();}
141 Float_t GetMicro1ToLeadGap(void) const { return fGeometryPPSD->GetMicro1ToLeadGap(); }
142 Int_t GetNumberOfModulesPhi(void) const { return fGeometryPPSD->GetNumberOfModulesPhi(); }
143 Int_t GetNumberOfModulesZ(void) const { return fGeometryPPSD->GetNumberOfModulesZ(); }
144 Int_t GetNumberOfPadsPhi(void) const { return fGeometryPPSD->GetNumberOfPadsPhi(); }
145 Int_t GetNumberOfPadsZ(void) const { return fGeometryPPSD->GetNumberOfPadsZ(); }
146 Float_t GetPCThickness(void) const { return fGeometryPPSD->GetPCThickness(); }
147 Float_t GetPhiDisplacement(void) const { return fGeometryPPSD->GetPhiDisplacement(); }
148 Float_t GetPPSDModuleSize(Int_t index) const { return fGeometryPPSD->GetPPSDModuleSize(index); }
149 Float_t GetZDisplacement(void) const { return fGeometryPPSD->GetZDisplacement(); }
150 void SetLeadConverterThickness(Float_t x) const { fGeometryPPSD->SetLeadConverterThickness(x);}
52a36ffd 151
152 // Return CPV geometrical parameters
153
ed4205d8 154 Int_t GetNumberOfCPVLayers(void) const { return fGeometryCPV ->GetNumberOfCPVLayers(); }
155 Bool_t IsLeadConverterExists(void) const { return fGeometryCPV->IsLeadConverterExists(); }
156 Float_t GetCPVActiveSize(Int_t index) const { return fGeometryCPV->GetCPVActiveSize(index); }
157 Int_t GetNumberOfCPVChipsPhi(void) const { return fGeometryCPV->GetNumberOfCPVChipsPhi(); }
158 Int_t GetNumberOfCPVChipsZ(void) const { return fGeometryCPV->GetNumberOfCPVChipsZ(); }
159 Int_t GetNumberOfCPVPadsPhi(void) const { return fGeometryCPV->GetNumberOfCPVPadsPhi(); }
160 Int_t GetNumberOfCPVPadsZ(void) const { return fGeometryCPV->GetNumberOfCPVPadsZ(); }
161 Float_t GetPadSizePhi(void) const { return fGeometryCPV->GetCPVPadSizePhi(); }
162 Float_t GetPadSizeZ(void) const { return fGeometryCPV->GetCPVPadSizeZ(); }
163 Float_t GetGassiplexChipSize(Int_t index) const { return fGeometryCPV->GetGassiplexChipSize(index); }
164 Float_t GetCPVGasThickness(void) const { return fGeometryCPV->GetCPVGasThickness(); }
165 Float_t GetCPVTextoliteThickness(void) const { return fGeometryCPV->GetCPVTextoliteThickness(); }
166 Float_t GetCPVCuNiFoilThickness(void) const { return fGeometryCPV->GetCPVCuNiFoilThickness(); }
167 Float_t GetFTPosition(Int_t index) const { return fGeometryCPV->GetFTPosition(index); }
168 Float_t GetCPVFrameSize(Int_t index) const { return fGeometryCPV->GetCPVFrameSize(index); }
52a36ffd 169
170 // Common PPSD and CPV parameters
171
2f04ed65 172 Float_t GetCPVBoxSize(Int_t index) const ;
52a36ffd 173
174 // Mixed EMCA and PPSD parameters
175
176 Float_t GetIPtoPpsdUp(void) const {
177 return (GetIPtoOuterCoverDistance() - GetCPVBoxSize(1) + GetPPSDModuleSize(1)/2 ); }
178 Float_t GetIPtoTopLidDistance(void) const {
179 return GetIPtoOuterCoverDistance() - GetCPVBoxSize(1) - 1. ; }
180 Float_t GetIPtoPpsdLow(void) const {
181 return (GetIPtoOuterCoverDistance() - GetPPSDModuleSize(1)/2 ); }
182
183 // Mixed EMCA and CPV parameters
184
185 Float_t GetIPtoCPVDistance(void) const {
186 return GetIPtoOuterCoverDistance() - GetCPVBoxSize(1) - 1.0; }
daa2ae2f 187
ed19b2e1 188 // Return PHOS' support geometrical parameters
189
190 Float_t GetRailOuterSize(Int_t index) const { return fGeometrySUPP->GetRailOuterSize(index); }
191 Float_t GetRailPart1 (Int_t index) const { return fGeometrySUPP->GetRailPart1 (index); }
192 Float_t GetRailPart2 (Int_t index) const { return fGeometrySUPP->GetRailPart2 (index); }
193 Float_t GetRailPart3 (Int_t index) const { return fGeometrySUPP->GetRailPart3 (index); }
194 Float_t GetRailPos (Int_t index) const { return fGeometrySUPP->GetRailPos (index); }
195 Float_t GetRailLength () const { return fGeometrySUPP->GetRailLength (); }
196 Float_t GetDistanceBetwRails() const { return fGeometrySUPP->GetDistanceBetwRails(); }
197 Float_t GetRailsDistanceFromIP() const { return fGeometrySUPP->GetRailsDistanceFromIP();}
198 Float_t GetRailRoadSize (Int_t index) const { return fGeometrySUPP->GetRailRoadSize (index); }
199 Float_t GetCradleWallThickness() const { return fGeometrySUPP->GetCradleWallThickness();}
200 Float_t GetCradleWall (Int_t index) const { return fGeometrySUPP->GetCradleWall (index); }
201 Float_t GetCradleWheel (Int_t index) const { return fGeometrySUPP->GetCradleWheel (index); }
daa2ae2f 202
6c370def 203protected:
204
aafe457d 205 AliPHOSGeometry(const Text_t* name, const Text_t* title="") : AliGeometry(name, title) {
6c370def 206 // ctor only for internal usage (singleton)
207 Init() ;
52a36ffd 208 }
209 void Init(void) ; // steering method for PHOS and PPSD/CPV
6c370def 210
daa2ae2f 211private:
6c370def 212
eb92d866 213 Int_t fNModules ; // Number of modules constituing PHOS
ed4205d8 214 Int_t fNPPSDModules ; // Number of PPSD modules
215 Float_t fAngle ; // Position angles between modules
eb92d866 216 Float_t *fPHOSAngle ; //[fNModules] Position angles of modules
217 TObjArray *fRotMatrixArray ; // Liste of rotation matrices (one per phos module)
218 AliPHOSEMCAGeometry *fGeometryEMCA ; // Geometry object for Electromagnetic calorimeter
ed4205d8 219 AliPHOSCPVGeometry *fGeometryCPV ; // Geometry object for CPV (IHEP)
220 AliPHOSPPSDGeometry *fGeometryPPSD ; // Geometry object for PPSD (GPS2)
ed19b2e1 221 AliPHOSSupportGeometry *fGeometrySUPP ; // Geometry object for PHOS support
52a36ffd 222
ed4205d8 223 void SetPHOSAngles(); // calculates the PHOS modules PHI angle
daa2ae2f 224
88714635 225 static AliPHOSGeometry * fgGeom ; // pointer to the unique instance of the singleton
52a36ffd 226 static Bool_t fgInit ; // Tells if geometry has been succesfully set up
daa2ae2f 227
52a36ffd 228 ClassDef(AliPHOSGeometry,1) // PHOS geometry class
daa2ae2f 229
230} ;
231
232#endif // AliPHOSGEOMETRY_H