]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALGeometry.h
Record charged and neutral energy component separately.
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALGeometry.h
1 #ifndef ALIEMCALGEOMETRY_H
2 #define ALIEMCALGEOMETRY_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //_________________________________________________________________________
9 // Geometry class  for EMCAL : singleton
10 // EMCAL consists of a layers of scintillator, and lead.
11 //                  
12 //*-- Author: Sahal Yacoob (LBL / UCT)
13 //*--   and : Yves Schutz (Subatech)
14
15 #include <assert.h> 
16
17 // --- ROOT system ---
18   class TString ;
19 class TObjArray ;
20 class TVector3 ;
21 class TParticle ; 
22
23 // --- AliRoot header files ---
24
25 #include "AliGeometry.h"
26
27 class AliEMCALGeometry : public AliGeometry {
28 public:
29   AliEMCALGeometry() {
30     // default ctor,  must be kept public for root persistency purposes,
31     // but should never be called by the outside world
32   };
33   AliEMCALGeometry(const AliEMCALGeometry & geom) {
34     // cpy ctor requested by Coding Convention but not yet needed
35     assert(0==1);
36   };
37   virtual ~AliEMCALGeometry(void) ; 
38   static AliEMCALGeometry * GetInstance(const Text_t* name,
39                                         const Text_t* title="") ; 
40   static AliEMCALGeometry * GetInstance() ;
41   AliEMCALGeometry & operator = (const AliEMCALGeometry  & rvalue) const {
42     // assignement operator requested by coding convention but not needed
43     assert(0==1) ;
44     return *(GetInstance()) ; 
45   };
46
47   const Bool_t AreInSameTower(Int_t id1, Int_t id2) const ;  
48   virtual void GetGlobal(const AliRecPoint *, TVector3 &, TMatrix &) const {}
49   virtual void GetGlobal(const AliRecPoint *, TVector3 &) const {}
50   virtual Bool_t Impact(const TParticle * particle) const {return kTRUE;}
51   // General
52   Bool_t  IsInitialized(void) const { return fgInit ; }
53   // Return EMCA geometrical parameters
54   // geometry
55   const Float_t GetAlFrontThickness() const { return fAlFrontThick;}
56   const Float_t GetArm1PhiMin() const { return fArm1PhiMin ; }
57   const Float_t GetArm1PhiMax() const { return fArm1PhiMax ; }
58   const Float_t GetArm1EtaMin() const { return fArm1EtaMin;}
59   const Float_t GetArm1EtaMax() const { return fArm1EtaMax;}
60   const Float_t GetIPDistance() const { return fIPDistance  ; } 
61   const Float_t GetIP2PRESection()  const { return (GetIPDistance() + GetAlFrontThickness() +  GetGap2Active() ) ;}
62   const Float_t GetIP2ECALSection() const { return ( GetIP2PRESection() + GetNPRLayers() * (  GetPRScintThick() +  GetPRPbRadThick() ) ) ; }  
63   const Float_t GetIP2HCALSection() const { return ( GetIP2ECALSection() + GetNECLayers() * ( GetECScintThick() +  GetECPbRadThick() ) ) ; }  
64   const Float_t GetEnvelop(Int_t index) const { return fEnvelop[index] ; }  
65   const Float_t GetShellThickness() const { return fShellThickness ; }
66   const Float_t GetZLength() const { return fZLength ; } 
67   const Float_t GetGap2Active() const {return  fGap2Active ; }
68   const Float_t GetDeltaEta() const {return (fArm1EtaMax-fArm1EtaMin)/
69                                        ((Float_t)fNZ);}
70   const Float_t GetDeltaPhi() const {return (fArm1PhiMax-fArm1PhiMin)/
71                                        ((Float_t)fNPhi);}
72   const Int_t   GetNECLayers() const {return fNECLayers ;}
73   const Int_t   GetNHCLayers() const {return fNHCLayers ;}
74   const Int_t   GetNPRLayers() const {return fNPRLayers;}
75   const Int_t   GetNZ() const {return fNZ ;}
76   const Int_t   GetNEta() const {return fNZ ;}
77   const Int_t   GetNPhi() const {return fNPhi ;}
78   const Int_t   GetNTowers() const {return fNPhi * fNZ ;}
79   const Float_t GetPRPbRadThick()const {return fPRPbRadThickness;}
80   const Float_t GetECPbRadThick()const {return fECPbRadThickness;}
81   const Float_t GetHCCuRadThick()const {return fHCCuRadThickness;}
82   const Float_t GetPRScintThick() const {return fPRScintThick;}
83   const Float_t GetECScintThick() const {return fECScintThick;}
84   const Float_t GetHCScintThick() const {return fECScintThick;}
85   const Float_t GetSampling() const {return fSampling ; } 
86   const Float_t GetSummationFraction() const {return fSummationFraction ; } 
87   
88   const Bool_t IsInPRE(Int_t index) const  { if ( (index > (GetNZ() * GetNPhi()) && (index <= 2 * (GetNZ() * GetNPhi())))) return kTRUE; else return kFALSE ;} 
89   const Bool_t IsInECAL(Int_t index) const { if ( (index > 0 && (index <= GetNZ() * GetNPhi()))) return kTRUE; else return kFALSE ;}
90   const Bool_t IsInHCAL(Int_t index) const { if ( (index > 2*(GetNZ() * GetNPhi()) && (index <= 3 * (GetNZ() * GetNPhi())))) return kTRUE; else return kFALSE ;} ; 
91
92   Float_t AngleFromEta(Float_t eta){ // returns angle in radians for a given
93     // pseudorapidity.
94     return 2.0*TMath::ATan(TMath::Exp(-eta));
95   }
96   Float_t ZFromEtaR(Float_t r,Float_t eta){ // returns z in for a given
97     // pseudorapidity and r=sqrt(x*x+y*y).
98     return r/TMath::Tan(AngleFromEta(eta));
99   }
100   Int_t TowerIndex(Int_t iz,Int_t iphi) const; // returns tower index
101   // returns tower indexs iz, iphi.
102   void TowerIndexes(Int_t index,Int_t &iz,Int_t &iphi,Int_t &ipre) const;
103   // for a given tower index it returns eta and phi of center of that tower.
104   void EtaPhiFromIndex(Int_t index,Float_t &eta,Float_t &phi) const;
105   // returns x, y, and z (cm) on the inner surface of a given EMCAL Cell specified by relid.
106   void XYZFromIndex(const Int_t *relid,Float_t &x,Float_t &y, Float_t &z) const;
107   void XYZFromIndex(const Int_t absid, TVector3 &v) const;
108   // for a given eta and phi in the EMCAL it returns the tower index.
109   Int_t TowerIndexFromEtaPhi(Float_t eta,Float_t phi) const;
110   // for a given eta and phi in the EMCAL it returns the pretower index.
111   Int_t PreTowerIndexFromEtaPhi(Float_t eta,Float_t phi) const;
112   // Returns theta and phi (degree) for a given EMCAL cell indicated by relid or absid
113   void PosInAlice(const Int_t *relid, Float_t &theta, Float_t &phi) const ;
114   void PosInAlice(const Int_t absid, Float_t &theta, Float_t &phi) const ;
115   Bool_t AbsToRelNumbering(Int_t AbsId, Int_t *relid) const;
116   /*
117   // Returns kTRUE if the two indexs are neighboring towers or preshowers.
118   Boot_t AliEMCALGeometry::AreNeighbours(Int_t index1,Int_t index2) const;
119   */
120   
121   void SetNZ(Int_t nz) { fNZ= nz ; Info("SetNZ", "Number of modules in Z set to %d", fNZ) ; }
122   void SetNPhi(Int_t nphi) { fNPhi= nphi ; Info("SetNPhi", "Number of modules in Phi set to %d", fNPhi) ; }
123   void SetSampling(Float_t samp) { fSampling = samp; Info("SetSampling", "Sampling factor set to %f", fSampling) ; }
124
125 protected:
126   AliEMCALGeometry(const Text_t* name, const Text_t* title="") :
127     AliGeometry(name, title) {// ctor only for internal usage (singleton)
128     Init();
129   };
130   void Init(void) ;            // initializes the parameters of EMCAL
131   
132 private:
133   static AliEMCALGeometry * fgGeom ; // pointer to the unique instance
134   // of the singleton 
135   static Bool_t fgInit;// Tells if geometry has been succesfully set up.
136   Float_t fAlFrontThick; // Thickness of the front Al face of the support box
137
138   Float_t fPRPbRadThickness ;  // cm, Thickness of the Pb radiators for the preshower section 
139   Float_t fPRScintThick      ;  // cm, Thickness of the sintilator for the preshower section of the tower
140   Int_t   fNPRLayers        ;  // number of scintillator layers in the preshower section 
141   
142   Float_t fECPbRadThickness ;  // cm, Thickness of the Pb radiators for the EM calorimeter  section 
143   Float_t fECScintThick      ;  // cm, Thickness of the sintilator for the EM alorimeter section of the tower  
144   Int_t   fNECLayers        ;  // number of scintillator layers in the EM calorimeter section 
145   
146   Float_t fHCCuRadThickness ;  // cm, Thickness of the Cu radiators.
147   Float_t fHCScintThick      ;  // cm, Thickness of the sintilator for the hadronic alorimeter section of the tower  
148   Int_t   fNHCLayers        ;  // number of scintillator layers in the hadronic calorimeter section
149   
150   Float_t fArm1PhiMin; // Minimum angular position of EMCAL in Phi (degrees)
151   Float_t fArm1PhiMax; // Maximum angular position of EMCAL in Phi (degrees)
152   Float_t fArm1EtaMin; // Minimum pseudorapidity position of EMCAL in Eta
153   Float_t fArm1EtaMax; // Maximum pseudorapidity position of EMCAL in Eta
154   
155   // It is assumed that Arm1 and Arm2 have the same following parameters
156   Float_t fEnvelop[3];      // the GEANT TUB for the detector 
157   Float_t fIPDistance;      // Radial Distance of the inner surface of the EMCAL
158   Float_t fShellThickness;  // Total thickness in (x,y) direction
159   Float_t fZLength;         // Total length in z direction
160   Float_t fGap2Active;      // Gap between the envelop and the active material
161   Int_t   fNZ;             // Number of Towers in the Z direction
162   Int_t   fNPhi;           // Number of Towers in the Phi Direction
163   Float_t fSampling;       // Sampling factor
164   Float_t fSummationFraction; // Fraction of the energy collected in the PRE section to be added to the EC section
165   
166   ClassDef(AliEMCALGeometry,5) // EMCAL geometry class 
167     
168     };
169
170 #endif // AliEMCALGEOMETRY_H