Correction for actual vertex position implemented
[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
19// --- ROOT system ---
20
d15a28e7 21// --- AliRoot header files ---
22
daa2ae2f 23#include "AliGeometry.h"
eb92d866 24#include "AliPHOSEMCAGeometry.h"
25#include "AliPHOSCPVGeometry.h"
ed19b2e1 26#include "AliPHOSSupportGeometry.h"
daa2ae2f 27
9f616d61 28
daa2ae2f 29class AliPHOSGeometry : public AliGeometry {
30
31public:
32
e957fea8 33 AliPHOSGeometry() ;
3663622c 34 AliPHOSGeometry(const AliPHOSGeometry & geom) ;
6c370def 35
daa2ae2f 36 virtual ~AliPHOSGeometry(void) ;
282c5906 37 static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title="") ;
daa2ae2f 38 static AliPHOSGeometry * GetInstance() ;
ccb05665 39 virtual void GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrixF & /* gmat */) const
40 {GetGlobal(RecPoint,gpos); }
1c9d8212 41 virtual void GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const ;
42 virtual Bool_t Impact(const TParticle * particle) const ;
daa2ae2f 43
3663622c 44 AliPHOSGeometry & operator = (const AliPHOSGeometry & /*rvalue*/) {
45 Fatal("operator =", "not implemented") ;
46 return *this ;
47 }
cf0c2bc1 48
daa2ae2f 49 // General
50
2725c395 51 static TString Degre(void) { return TString("deg") ; } // a global for degree (deg)
cf0c2bc1 52
2725c395 53 static TString Radian(void){ return TString("rad") ; } // a global for radian (rad)
52a36ffd 54
fc7e2f43 55 Bool_t AbsToRelNumbering(Int_t AbsId, Int_t * RelId) const ;
710f859a 56 // converts the absolute PHOS numbering to a relative
52a36ffd 57
ccb05665 58// void EmcModuleCoverage(Int_t m, Double_t & tm, Double_t & tM, Double_t & pm,
59// Double_t & pM, Option_t * opt = Radian() ) const ;
60// // calculates the angular coverage in theta and phi of a EMC module
61// void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = Radian() ) const ;
62// // calculates the angular coverage in theta and phi of a
63// // single crystal in a EMC module
64
65 void ImpactOnEmc(Double_t * vtx, Double_t theta, Double_t phi,
66 Int_t & ModuleNumber, Double_t & z, Double_t & x) const ;
67// void ImpactOnEmc(const TVector3& vec, Int_t & ModuleNumber,
68// Double_t & z, Double_t & x) const ;
69// void ImpactOnEmc(const TParticle& p, Int_t & ModuleNumber,
70// Double_t & z, Double_t & x) const ;
71// // calculates the impact coordinates of a neutral particle
72// // emitted in direction theta and phi in ALICE
fc7e2f43 73 Bool_t IsInEMC(Int_t id) const { if (id > GetNModules() * GetNCristalsInModule() ) return kFALSE; return kTRUE; }
710f859a 74 void RelPosInModule(const Int_t * RelId, Float_t & y, Float_t & z) const ;
75 // gets the position of element (pad or Xtal) relative to
76 // center of PHOS module
fc7e2f43 77 void RelPosInAlice(Int_t AbsId, TVector3 & pos) const ;
710f859a 78 // gets the position of element (pad or Xtal) relative to Alice
79 Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) const ;
80 // converts the absolute PHOS numbering to a relative
5d0435dd 81 void RelPosToAbsId(Int_t module, Double_t x, Double_t z, Int_t & AbsId) const;
842988a5 82 // converts local PHOS-module (x, z) coordinates to absId
407d15b3 83 void GetIncidentVector(const TVector3 &vtx, Int_t module, Float_t x, Float_t z, TVector3& vInc) const ;
ccb05665 84 //calculates vector from vertex to current point in module local frame
85 void Local2Global(Int_t module, Float_t x, Float_t z, TVector3 &globaPos) const ;
88cb7938 86
710f859a 87 Bool_t IsInitialized(void) const { return fgInit ; }
c198e326 88
52a36ffd 89 // Return general PHOS parameters
710f859a 90 Int_t GetNModules(void) const { return fNModules ; }
91 Float_t GetPHOSAngle(Int_t index) const { return fPHOSAngle[index-1] ; }
92 Float_t* GetPHOSParams(void) { return fPHOSParams;} //Half-sizes of PHOS trapecoid
93 Float_t GetIPtoUpperCPVsurface(void) const { return fIPtoUpperCPVsurface ; }
94 Float_t GetOuterBoxSize(Int_t index) const { return 2.*fPHOSParams[index]; }
95 Float_t GetCrystalSize(Int_t index) const { return fGeometryEMCA->GetCrystalSize(index) ; }
66c3e8ff 96 Float_t GetCellStep(void) const { return 2*(fGeometryEMCA->GetAirCellHalfSize()[0] +
97 fGeometryEMCA->GetStripWallWidthOut()) ;}
710f859a 98
05d33a3d 99 Float_t GetModuleCenter(Int_t module, Int_t axis) const {
100 return fModuleCenter[module][axis];}
101 Float_t GetModuleAngle(Int_t module, Int_t axis, Int_t angle) const {
102 return fModuleAngle[module][axis][angle];}
103
104
ccb05665 105 // Return ideal EMCA geometry parameters
710f859a 106
107 AliPHOSEMCAGeometry * GetEMCAGeometry() const {return fGeometryEMCA ;}
108 Float_t GetIPtoCrystalSurface(void) const { return fGeometryEMCA->GetIPtoCrystalSurface() ; }
109 Float_t GetIPtoOuterCoverDistance(void) const { return fGeometryEMCA->GetIPtoOuterCoverDistance() ; }
110 Int_t GetNPhi(void) const { return fGeometryEMCA->GetNPhi() ; }
111 Int_t GetNZ(void) const { return fGeometryEMCA->GetNZ() ; }
112 Int_t GetNCristalsInModule(void) const { return fGeometryEMCA->GetNPhi() * fGeometryEMCA->GetNZ() ; }
113
ccb05665 114 // Return ideal CPV geometry parameters
ed4205d8 115 Int_t GetNumberOfCPVLayers(void) const { return fGeometryCPV ->GetNumberOfCPVLayers(); }
ed4205d8 116 Float_t GetCPVActiveSize(Int_t index) const { return fGeometryCPV->GetCPVActiveSize(index); }
117 Int_t GetNumberOfCPVChipsPhi(void) const { return fGeometryCPV->GetNumberOfCPVChipsPhi(); }
118 Int_t GetNumberOfCPVChipsZ(void) const { return fGeometryCPV->GetNumberOfCPVChipsZ(); }
119 Int_t GetNumberOfCPVPadsPhi(void) const { return fGeometryCPV->GetNumberOfCPVPadsPhi(); }
120 Int_t GetNumberOfCPVPadsZ(void) const { return fGeometryCPV->GetNumberOfCPVPadsZ(); }
121 Float_t GetPadSizePhi(void) const { return fGeometryCPV->GetCPVPadSizePhi(); }
122 Float_t GetPadSizeZ(void) const { return fGeometryCPV->GetCPVPadSizeZ(); }
123 Float_t GetGassiplexChipSize(Int_t index) const { return fGeometryCPV->GetGassiplexChipSize(index); }
124 Float_t GetCPVGasThickness(void) const { return fGeometryCPV->GetCPVGasThickness(); }
125 Float_t GetCPVTextoliteThickness(void) const { return fGeometryCPV->GetCPVTextoliteThickness(); }
126 Float_t GetCPVCuNiFoilThickness(void) const { return fGeometryCPV->GetCPVCuNiFoilThickness(); }
127 Float_t GetFTPosition(Int_t index) const { return fGeometryCPV->GetFTPosition(index); }
128 Float_t GetCPVFrameSize(Int_t index) const { return fGeometryCPV->GetCPVFrameSize(index); }
710f859a 129 Float_t GetCPVBoxSize(Int_t index) const { return fGeometryCPV ->GetCPVBoxSize(index); }
130 Float_t GetIPtoCPVDistance(void) const { return GetIPtoOuterCoverDistance() -
131 GetCPVBoxSize(1) - 1.0; }
ccb05665 132
133
134 // Return real CPV geometry parameters
7b51037f 135 void GetModuleCenter(TVector3& center, const char *det, Int_t module) const;
136 void Global2Local(TVector3& localPosition,
137 const TVector3& globalPosition,
138 Int_t module) const;
52a36ffd 139
710f859a 140 // Return PHOS' support geometry parameters
ed19b2e1 141
142 Float_t GetRailOuterSize(Int_t index) const { return fGeometrySUPP->GetRailOuterSize(index); }
143 Float_t GetRailPart1 (Int_t index) const { return fGeometrySUPP->GetRailPart1 (index); }
144 Float_t GetRailPart2 (Int_t index) const { return fGeometrySUPP->GetRailPart2 (index); }
145 Float_t GetRailPart3 (Int_t index) const { return fGeometrySUPP->GetRailPart3 (index); }
146 Float_t GetRailPos (Int_t index) const { return fGeometrySUPP->GetRailPos (index); }
710f859a 147 Float_t GetRailLength (void) const { return fGeometrySUPP->GetRailLength (); }
148 Float_t GetDistanceBetwRails(void) const { return fGeometrySUPP->GetDistanceBetwRails(); }
149 Float_t GetRailsDistanceFromIP(void) const { return fGeometrySUPP->GetRailsDistanceFromIP();}
ed19b2e1 150 Float_t GetRailRoadSize (Int_t index) const { return fGeometrySUPP->GetRailRoadSize (index); }
710f859a 151 Float_t GetCradleWallThickness(void) const { return fGeometrySUPP->GetCradleWallThickness();}
ed19b2e1 152 Float_t GetCradleWall (Int_t index) const { return fGeometrySUPP->GetCradleWall (index); }
153 Float_t GetCradleWheel (Int_t index) const { return fGeometrySUPP->GetCradleWheel (index); }
05d33a3d 154 void Init(void) ; // steering method for PHOS and PPSD/CPV
155
156
6c370def 157protected:
158
3663622c 159 AliPHOSGeometry(const Text_t* name, const Text_t* title="") ;
daa2ae2f 160private:
6c370def 161
eb92d866 162 Int_t fNModules ; // Number of modules constituing PHOS
ed4205d8 163 Float_t fAngle ; // Position angles between modules
eb92d866 164 Float_t *fPHOSAngle ; //[fNModules] Position angles of modules
710f859a 165 Float_t fPHOSParams[4] ; // Half-sizes of PHOS trapecoid
166 Float_t fIPtoUpperCPVsurface; // Minimal distance from IP to PHOS
eb92d866 167 TObjArray *fRotMatrixArray ; // Liste of rotation matrices (one per phos module)
168 AliPHOSEMCAGeometry *fGeometryEMCA ; // Geometry object for Electromagnetic calorimeter
ed4205d8 169 AliPHOSCPVGeometry *fGeometryCPV ; // Geometry object for CPV (IHEP)
ed19b2e1 170 AliPHOSSupportGeometry *fGeometrySUPP ; // Geometry object for PHOS support
05d33a3d 171 Float_t fModuleCenter[5][3]; // xyz-position of the module center
172 Float_t fModuleAngle[5][3][2]; // polar and azymuth angles for 3 axes of modules
52a36ffd 173
ed4205d8 174 void SetPHOSAngles(); // calculates the PHOS modules PHI angle
daa2ae2f 175
88714635 176 static AliPHOSGeometry * fgGeom ; // pointer to the unique instance of the singleton
52a36ffd 177 static Bool_t fgInit ; // Tells if geometry has been succesfully set up
daa2ae2f 178
05d33a3d 179 ClassDef(AliPHOSGeometry,2) // PHOS geometry class
daa2ae2f 180
181} ;
182
183#endif // AliPHOSGEOMETRY_H