1 #ifndef ALIEMCALRECOUTILS_H
2 #define ALIEMCALRECOUTILS_H
4 /* $Id: AliEMCALRecoUtils.h 33808 2009-07-15 09:48:08Z gconesab $ */
6 ///////////////////////////////////////////////////////////////////////////////
8 // Class AliEMCALRecoUtils
9 // Some utilities to recalculate the cluster position or energy linearity
12 // Author: Gustavo Conesa (LPSC- Grenoble)
13 ///////////////////////////////////////////////////////////////////////////////
18 #include "TObjArray.h"
25 class AliEMCALGeometry;
27 class AliEMCALRecoUtils : public TNamed {
32 AliEMCALRecoUtils(const AliEMCALRecoUtils&);
33 AliEMCALRecoUtils& operator=(const AliEMCALRecoUtils&);
34 virtual ~AliEMCALRecoUtils() ;
36 enum NonlinearityFunctions{kPi0MC=0,kPi0GammaGamma=1,kPi0GammaConversion=2,kNoCorrection=3};
37 enum PositionAlgorithms{kPosTowerIndex=0, kPosTowerGlobal};
38 enum ParticleType{kPhoton=0, kElectron=1,kHadron =2, kUnknown=-1};
40 //Position recalculation
41 void RecalculateClusterPosition(AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu);
42 void RecalculateClusterPositionFromTowerIndex (AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu);
43 void RecalculateClusterPositionFromTowerGlobal(AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu);
45 Float_t GetCellWeight(const Float_t eCell, const Float_t eCluster) const { return TMath::Max( 0., fW0 + TMath::Log( eCell / eCluster ));}
47 Float_t GetDepth(const Float_t eCluster, const Int_t iParticle, const Int_t iSM) const ;
49 void GetMaxEnergyCell(AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu,
50 Int_t & absId, Int_t& iSupMod, Int_t& ieta, Int_t& iphi);
52 Float_t GetMisalTransShift(const Int_t i) const {
53 if(i < 15 ){return fMisalTransShift[i]; }
54 else { AliInfo(Form("Index %d larger than 15, do nothing\n",i)); return 0.;}
56 Float_t* GetMisalTransShiftArray() {return fMisalTransShift; }
58 void SetMisalTransShift(const Int_t i, const Float_t shift) {
59 if(i < 15 ){fMisalTransShift[i] = shift; }
60 else { AliInfo(Form("Index %d larger than 15, do nothing\n",i));}
62 void SetMisalTransShiftArray(Float_t * misal)
63 { for(Int_t i = 0; i < 15; i++)fMisalTransShift[i] = misal[i]; }
65 Float_t GetMisalRotShift(const Int_t i) const {
66 if(i < 15 ){return fMisalRotShift[i]; }
67 else { AliInfo(Form("Index %d larger than 15, do nothing\n",i)); return 0.;}
69 Float_t* GetMisalRotShiftArray() {return fMisalRotShift; }
71 void SetMisalRotShift(const Int_t i, const Float_t shift) {
72 if(i < 15 ){fMisalRotShift[i] = shift; }
73 else { AliInfo(Form("Index %d larger than 15, do nothing\n",i));}
75 void SetMisalRotShiftArray(Float_t * misal)
76 { for(Int_t i = 0; i < 15; i++)fMisalRotShift[i] = misal[i]; }
78 Int_t GetParticleType() const {return fParticleType ;}
79 void SetParticleType(Int_t particle) {fParticleType = particle ;}
81 Int_t GetPositionAlgorithm() const {return fPosAlgo;}
82 void SetPositionAlgorithm(Int_t alg) {fPosAlgo = alg ;}
84 Float_t GetW0() const {return fW0;}
85 void SetW0(Float_t w0) {fW0 = w0 ;}
89 Float_t CorrectClusterEnergyLinearity(AliVCluster* clu);
91 Float_t GetNonLinearityParam(const Int_t i) const {
92 if(i < 6 ){return fNonLinearityParams[i]; }
93 else { AliInfo(Form("Index %d larger than 6, do nothing\n",i)); return 0.;}
95 void SetNonLinearityParam(const Int_t i, const Float_t param) {
96 if(i < 6 ){fNonLinearityParams[i] = param; }
97 else { AliInfo(Form("Index %d larger than 6, do nothing\n",i));}
100 Int_t GetNonLinearityFunction() const {return fNonLinearityFunction;}
101 void SetNonLinearityFunction(Int_t fun) {fNonLinearityFunction = fun ;}
103 void Print(const Option_t*) const;
106 void RecalibrateClusterEnergy(AliEMCALGeometry* geom, AliVCluster* cluster, AliVCaloCells * cells);
108 Bool_t IsRecalibrationOn() const { return fRecalibration ; }
109 void SwitchOnRecalibration() {fRecalibration = kTRUE ; InitEMCALRecalibrationFactors();}
110 void SwitchOffRecalibration() {fRecalibration = kFALSE ; }
112 void InitEMCALRecalibrationFactors() ;
114 Float_t GetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow) const {
115 if(fEMCALRecalibrationFactors) return (Float_t) ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->GetBinContent(iCol,iRow);
118 void SetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) {
119 if(!fEMCALRecalibrationFactors) InitEMCALRecalibrationFactors();
120 ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->SetBinContent(iCol,iRow,c);}
122 TH2F * GetEMCALChannelRecalibrationFactors(Int_t iSM) const {return (TH2F*)fEMCALRecalibrationFactors->At(iSM);}
123 void SetEMCALChannelRecalibrationFactors(TObjArray *map) {fEMCALRecalibrationFactors = map;}
124 void SetEMCALChannelRecalibrationFactors(Int_t iSM , TH2F* h) {fEMCALRecalibrationFactors->AddAt(h,iSM);}
128 Float_t fMisalTransShift[15]; // Shift parameters
129 Float_t fMisalRotShift[15]; // Shift parameters
130 Int_t fNonLinearityFunction; // Non linearity function choice
131 Float_t fNonLinearityParams[6]; // Parameters for the non linearity function
132 Int_t fParticleType; // Particle type for depth calculation
133 Int_t fPosAlgo; // Position recalculation algorithm
134 Float_t fW0; // Weight0
135 Bool_t fRecalibration; // Switch on or off the recalibration
136 TObjArray * fEMCALRecalibrationFactors; // Array of histograms with map of recalibration factors, EMCAL
138 ClassDef(AliEMCALRecoUtils, 3)
142 #endif // ALIEMCALRECOUTILS_H