]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSGeometry.h
Several pointers were set to zero in the default constructors to avoid memory managem...
[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"
ed19b2e1 33#include "AliPHOSSupportGeometry.h"
daa2ae2f 34
9f616d61 35
daa2ae2f 36class AliPHOSGeometry : public AliGeometry {
37
38public:
39
88714635 40 AliPHOSGeometry() {
41 // default ctor
42 // must be kept public for root persistency purposes, but should never be called by the outside world
2685bf00 43 fPHOSAngle = 0 ;
44 fGeometryEMCA = 0;
45 fGeometrySUPP = 0;
46 fgGeom = 0;
47 }
52a36ffd 48
6c370def 49 AliPHOSGeometry(const AliPHOSGeometry & geom) {
52a36ffd 50 // cpy ctor requested by Coding Convention but not yet needed
6c370def 51 assert(0==1) ;
52 }
53
daa2ae2f 54 virtual ~AliPHOSGeometry(void) ;
282c5906 55 static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title="") ;
daa2ae2f 56 static AliPHOSGeometry * GetInstance() ;
5cda30f6 57 virtual void GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat) const ;
52a36ffd 58 virtual void GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const ;
daa2ae2f 59
c6e196df 60 AliPHOSGeometry & operator = (const AliPHOSGeometry & rvalue) const {
52a36ffd 61 // assignement operator requested by coding convention but not needed
6c370def 62 assert(0==1) ;
63 return *(GetInstance()) ;
64 }
cf0c2bc1 65
daa2ae2f 66 // General
67
710f859a 68 static TString Degre(void) { return TString("deg") ; } // a global for degree (deg)
cf0c2bc1 69
710f859a 70 static TString Radian(void){ return TString("rad") ; } // a global for radian (rad)
52a36ffd 71
710f859a 72 Bool_t AbsToRelNumbering(const Int_t AbsId, Int_t * RelId) const ;
73 // converts the absolute PHOS numbering to a relative
52a36ffd 74
710f859a 75 void EmcModuleCoverage(const Int_t m, Double_t & tm, Double_t & tM, Double_t & pm,
76 Double_t & pM, Option_t * opt = Radian() ) const ;
77 // calculates the angular coverage in theta and phi of a EMC module
7b7c1533 78 void EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt = Radian() ) const ;
710f859a 79 // calculates the angular coverage in theta and phi of a
80 // single crystal in a EMC module
81 void ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber,
82 Double_t & z, Double_t & x) const ;
83 // calculates the impact coordinates of a neutral particle
84 // emitted in direction theta and phi in ALICE
8f09b22b 85 Bool_t IsInEMC(const Int_t id) const { if (id > GetNModules() * GetNCristalsInModule() ) return kFALSE; return kTRUE; }
710f859a 86 void RelPosInModule(const Int_t * RelId, Float_t & y, Float_t & z) const ;
87 // gets the position of element (pad or Xtal) relative to
88 // center of PHOS module
89 void RelPosInAlice(const Int_t AbsId, TVector3 & pos) const ;
90 // gets the position of element (pad or Xtal) relative to Alice
91 Bool_t RelToAbsNumbering(const Int_t * RelId, Int_t & AbsId) const ;
92 // converts the absolute PHOS numbering to a relative
93
94 Bool_t IsInitialized(void) const { return fgInit ; }
c198e326 95
52a36ffd 96 // Return general PHOS parameters
710f859a 97 Int_t GetNModules(void) const { return fNModules ; }
98 Float_t GetPHOSAngle(Int_t index) const { return fPHOSAngle[index-1] ; }
99 Float_t* GetPHOSParams(void) { return fPHOSParams;} //Half-sizes of PHOS trapecoid
100 Float_t GetIPtoUpperCPVsurface(void) const { return fIPtoUpperCPVsurface ; }
101 Float_t GetOuterBoxSize(Int_t index) const { return 2.*fPHOSParams[index]; }
102 Float_t GetCrystalSize(Int_t index) const { return fGeometryEMCA->GetCrystalSize(index) ; }
103
104 // Return EMCA geometry parameters
105
106 AliPHOSEMCAGeometry * GetEMCAGeometry() const {return fGeometryEMCA ;}
107 Float_t GetIPtoCrystalSurface(void) const { return fGeometryEMCA->GetIPtoCrystalSurface() ; }
108 Float_t GetIPtoOuterCoverDistance(void) const { return fGeometryEMCA->GetIPtoOuterCoverDistance() ; }
109 Int_t GetNPhi(void) const { return fGeometryEMCA->GetNPhi() ; }
110 Int_t GetNZ(void) const { return fGeometryEMCA->GetNZ() ; }
111 Int_t GetNCristalsInModule(void) const { return fGeometryEMCA->GetNPhi() * fGeometryEMCA->GetNZ() ; }
112
113 // Return CPV geometry parameters
ed4205d8 114 Int_t GetNumberOfCPVLayers(void) const { return fGeometryCPV ->GetNumberOfCPVLayers(); }
ed4205d8 115 Float_t GetCPVActiveSize(Int_t index) const { return fGeometryCPV->GetCPVActiveSize(index); }
116 Int_t GetNumberOfCPVChipsPhi(void) const { return fGeometryCPV->GetNumberOfCPVChipsPhi(); }
117 Int_t GetNumberOfCPVChipsZ(void) const { return fGeometryCPV->GetNumberOfCPVChipsZ(); }
118 Int_t GetNumberOfCPVPadsPhi(void) const { return fGeometryCPV->GetNumberOfCPVPadsPhi(); }
119 Int_t GetNumberOfCPVPadsZ(void) const { return fGeometryCPV->GetNumberOfCPVPadsZ(); }
120 Float_t GetPadSizePhi(void) const { return fGeometryCPV->GetCPVPadSizePhi(); }
121 Float_t GetPadSizeZ(void) const { return fGeometryCPV->GetCPVPadSizeZ(); }
122 Float_t GetGassiplexChipSize(Int_t index) const { return fGeometryCPV->GetGassiplexChipSize(index); }
123 Float_t GetCPVGasThickness(void) const { return fGeometryCPV->GetCPVGasThickness(); }
124 Float_t GetCPVTextoliteThickness(void) const { return fGeometryCPV->GetCPVTextoliteThickness(); }
125 Float_t GetCPVCuNiFoilThickness(void) const { return fGeometryCPV->GetCPVCuNiFoilThickness(); }
126 Float_t GetFTPosition(Int_t index) const { return fGeometryCPV->GetFTPosition(index); }
127 Float_t GetCPVFrameSize(Int_t index) const { return fGeometryCPV->GetCPVFrameSize(index); }
710f859a 128 Float_t GetCPVBoxSize(Int_t index) const { return fGeometryCPV ->GetCPVBoxSize(index); }
129 Float_t GetIPtoCPVDistance(void) const { return GetIPtoOuterCoverDistance() -
130 GetCPVBoxSize(1) - 1.0; }
52a36ffd 131
710f859a 132 // Return PHOS' support geometry parameters
ed19b2e1 133
134 Float_t GetRailOuterSize(Int_t index) const { return fGeometrySUPP->GetRailOuterSize(index); }
135 Float_t GetRailPart1 (Int_t index) const { return fGeometrySUPP->GetRailPart1 (index); }
136 Float_t GetRailPart2 (Int_t index) const { return fGeometrySUPP->GetRailPart2 (index); }
137 Float_t GetRailPart3 (Int_t index) const { return fGeometrySUPP->GetRailPart3 (index); }
138 Float_t GetRailPos (Int_t index) const { return fGeometrySUPP->GetRailPos (index); }
710f859a 139 Float_t GetRailLength (void) const { return fGeometrySUPP->GetRailLength (); }
140 Float_t GetDistanceBetwRails(void) const { return fGeometrySUPP->GetDistanceBetwRails(); }
141 Float_t GetRailsDistanceFromIP(void) const { return fGeometrySUPP->GetRailsDistanceFromIP();}
ed19b2e1 142 Float_t GetRailRoadSize (Int_t index) const { return fGeometrySUPP->GetRailRoadSize (index); }
710f859a 143 Float_t GetCradleWallThickness(void) const { return fGeometrySUPP->GetCradleWallThickness();}
ed19b2e1 144 Float_t GetCradleWall (Int_t index) const { return fGeometrySUPP->GetCradleWall (index); }
145 Float_t GetCradleWheel (Int_t index) const { return fGeometrySUPP->GetCradleWheel (index); }
daa2ae2f 146
6c370def 147protected:
148
aafe457d 149 AliPHOSGeometry(const Text_t* name, const Text_t* title="") : AliGeometry(name, title) {
6c370def 150 // ctor only for internal usage (singleton)
151 Init() ;
52a36ffd 152 }
153 void Init(void) ; // steering method for PHOS and PPSD/CPV
6c370def 154
daa2ae2f 155private:
6c370def 156
eb92d866 157 Int_t fNModules ; // Number of modules constituing PHOS
ed4205d8 158 Float_t fAngle ; // Position angles between modules
eb92d866 159 Float_t *fPHOSAngle ; //[fNModules] Position angles of modules
710f859a 160 Float_t fPHOSParams[4] ; // Half-sizes of PHOS trapecoid
161 Float_t fIPtoUpperCPVsurface; // Minimal distance from IP to PHOS
eb92d866 162 TObjArray *fRotMatrixArray ; // Liste of rotation matrices (one per phos module)
163 AliPHOSEMCAGeometry *fGeometryEMCA ; // Geometry object for Electromagnetic calorimeter
ed4205d8 164 AliPHOSCPVGeometry *fGeometryCPV ; // Geometry object for CPV (IHEP)
ed19b2e1 165 AliPHOSSupportGeometry *fGeometrySUPP ; // Geometry object for PHOS support
52a36ffd 166
ed4205d8 167 void SetPHOSAngles(); // calculates the PHOS modules PHI angle
daa2ae2f 168
88714635 169 static AliPHOSGeometry * fgGeom ; // pointer to the unique instance of the singleton
52a36ffd 170 static Bool_t fgInit ; // Tells if geometry has been succesfully set up
daa2ae2f 171
52a36ffd 172 ClassDef(AliPHOSGeometry,1) // PHOS geometry class
daa2ae2f 173
174} ;
175
176#endif // AliPHOSGEOMETRY_H