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;
26 class AliEMCALPIDUtils;
28 class AliEMCALRecoUtils : public TNamed {
33 AliEMCALRecoUtils(const AliEMCALRecoUtils&);
34 AliEMCALRecoUtils& operator=(const AliEMCALRecoUtils&);
35 virtual ~AliEMCALRecoUtils() ;
37 enum NonlinearityFunctions{kPi0MC=0,kPi0GammaGamma=1,kPi0GammaConversion=2,kNoCorrection=3};
38 enum PositionAlgorithms{kUnchanged=-1,kPosTowerIndex=0, kPosTowerGlobal=1};
39 enum ParticleType{kPhoton=0, kElectron=1,kHadron =2, kUnknown=-1};
41 //Position recalculation
42 void RecalculateClusterPosition(AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu);
43 void RecalculateClusterPositionFromTowerIndex (AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu);
44 void RecalculateClusterPositionFromTowerGlobal(AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu);
46 Float_t GetCellWeight(const Float_t eCell, const Float_t eCluster) const { return TMath::Max( 0., fW0 + TMath::Log( eCell / eCluster ));}
48 Float_t GetDepth(const Float_t eCluster, const Int_t iParticle, const Int_t iSM) const ;
50 void GetMaxEnergyCell(AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu,
51 Int_t & absId, Int_t& iSupMod, Int_t& ieta, Int_t& iphi);
53 Float_t GetMisalTransShift(const Int_t i) const {
54 if(i < 15 ){return fMisalTransShift[i]; }
55 else { AliInfo(Form("Index %d larger than 15, do nothing\n",i)); return 0.;}
57 Float_t* GetMisalTransShiftArray() {return fMisalTransShift; }
59 void SetMisalTransShift(const Int_t i, const Float_t shift) {
60 if(i < 15 ){fMisalTransShift[i] = shift; }
61 else { AliInfo(Form("Index %d larger than 15, do nothing\n",i));}
63 void SetMisalTransShiftArray(Float_t * misal)
64 { for(Int_t i = 0; i < 15; i++)fMisalTransShift[i] = misal[i]; }
66 Float_t GetMisalRotShift(const Int_t i) const {
67 if(i < 15 ){return fMisalRotShift[i]; }
68 else { AliInfo(Form("Index %d larger than 15, do nothing\n",i)); return 0.;}
70 Float_t* GetMisalRotShiftArray() {return fMisalRotShift; }
72 void SetMisalRotShift(const Int_t i, const Float_t shift) {
73 if(i < 15 ){fMisalRotShift[i] = shift; }
74 else { AliInfo(Form("Index %d larger than 15, do nothing\n",i));}
76 void SetMisalRotShiftArray(Float_t * misal)
77 { for(Int_t i = 0; i < 15; i++)fMisalRotShift[i] = misal[i]; }
79 Int_t GetParticleType() const {return fParticleType ;}
80 void SetParticleType(Int_t particle) {fParticleType = particle ;}
82 Int_t GetPositionAlgorithm() const {return fPosAlgo;}
83 void SetPositionAlgorithm(Int_t alg) {fPosAlgo = alg ;}
85 Float_t GetW0() const {return fW0;}
86 void SetW0(Float_t w0) {fW0 = w0 ;}
90 Float_t CorrectClusterEnergyLinearity(AliVCluster* clu);
92 Float_t GetNonLinearityParam(const Int_t i) const {
93 if(i < 6 ){return fNonLinearityParams[i]; }
94 else { AliInfo(Form("Index %d larger than 6, do nothing\n",i)); return 0.;}
96 void SetNonLinearityParam(const Int_t i, const Float_t param) {
97 if(i < 6 ){fNonLinearityParams[i] = param; }
98 else { AliInfo(Form("Index %d larger than 6, do nothing\n",i));}
101 Int_t GetNonLinearityFunction() const {return fNonLinearityFunction;}
102 void SetNonLinearityFunction(Int_t fun) {fNonLinearityFunction = fun ;}
104 void Print(const Option_t*) const;
107 void RecalibrateClusterEnergy(AliEMCALGeometry* geom, AliVCluster* cluster, AliVCaloCells * cells);
109 Bool_t IsRecalibrationOn() const { return fRecalibration ; }
110 void SwitchOnRecalibration() {fRecalibration = kTRUE ; InitEMCALRecalibrationFactors();}
111 void SwitchOffRecalibration() {fRecalibration = kFALSE ; }
113 void InitEMCALRecalibrationFactors() ;
115 Float_t GetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow) const {
116 if(fEMCALRecalibrationFactors) return (Float_t) ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->GetBinContent(iCol,iRow);
119 void SetEMCALChannelRecalibrationFactor(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) {
120 if(!fEMCALRecalibrationFactors) InitEMCALRecalibrationFactors();
121 ((TH2F*)fEMCALRecalibrationFactors->At(iSM))->SetBinContent(iCol,iRow,c);}
123 TH2F * GetEMCALChannelRecalibrationFactors(Int_t iSM) const {return (TH2F*)fEMCALRecalibrationFactors->At(iSM);}
124 void SetEMCALChannelRecalibrationFactors(TObjArray *map) {fEMCALRecalibrationFactors = map;}
125 void SetEMCALChannelRecalibrationFactors(Int_t iSM , TH2F* h) {fEMCALRecalibrationFactors->AddAt(h,iSM);}
127 //Modules fiducial region, remove clusters in borders
128 Bool_t CheckCellFiducialRegion(AliEMCALGeometry* geom, AliVCluster* cluster, AliVCaloCells* cells) ;
129 void SetNumberOfCellsFromEMCALBorder(Int_t n) {fNCellsFromEMCALBorder = n; }
130 Int_t GetNumberOfCellsFromEMCALBorder() const {return fNCellsFromEMCALBorder; }
132 void SwitchOnNoFiducialBorderInEMCALEta0() {fNoEMCALBorderAtEta0 = kTRUE; }
133 void SwitchOffNoFiducialBorderInEMCALEta0() {fNoEMCALBorderAtEta0 = kFALSE; }
134 Bool_t IsEMCALNoBorderAtEta0() {return fNoEMCALBorderAtEta0;}
137 Bool_t IsBadChannelsRemovalSwitchedOn() const { return fRemoveBadChannels ; }
138 void SwitchOnBadChannelsRemoval () {fRemoveBadChannels = kTRUE ; InitEMCALBadChannelStatusMap();}
139 void SwitchOffBadChannelsRemoval() {fRemoveBadChannels = kFALSE ; }
141 void InitEMCALBadChannelStatusMap() ;
143 Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const {
144 if(fEMCALBadChannelMap) return (Int_t) ((TH2I*)fEMCALBadChannelMap->At(iSM))->GetBinContent(iCol,iRow);
145 else return 0;}//Channel is ok by default
147 void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) {
148 if(!fEMCALBadChannelMap)InitEMCALBadChannelStatusMap() ;
149 ((TH2I*)fEMCALBadChannelMap->At(iSM))->SetBinContent(iCol,iRow,c);}
151 TH2I * GetEMCALChannelStatusMap(Int_t iSM) const {return (TH2I*)fEMCALBadChannelMap->At(iSM);}
152 void SetEMCALChannelStatusMap(TObjArray *map) {fEMCALBadChannelMap = map;}
154 Bool_t ClusterContainsBadChannel(AliEMCALGeometry* geom, UShort_t* cellList, Int_t nCells);
156 //Recalculate other cluster parameters
157 void RecalculateClusterPID(AliVCluster * cluster);
158 AliEMCALPIDUtils * GetPIDUtils() { return fPIDUtils;}
160 void RecalculateClusterShowerShapeParameters(AliEMCALGeometry * geom, AliVCaloCells* cells, AliVCluster * cluster);
165 Float_t fMisalTransShift[15]; // Shift parameters
166 Float_t fMisalRotShift[15]; // Shift parameters
167 Int_t fNonLinearityFunction; // Non linearity function choice
168 Float_t fNonLinearityParams[6]; // Parameters for the non linearity function
169 Int_t fParticleType; // Particle type for depth calculation
170 Int_t fPosAlgo; // Position recalculation algorithm
171 Float_t fW0; // Weight0
173 Bool_t fRecalibration; // Switch on or off the recalibration
174 TObjArray* fEMCALRecalibrationFactors; // Array of histograms with map of recalibration factors, EMCAL
175 Bool_t fRemoveBadChannels; // Check the channel status provided and remove clusters with bad channels
176 TObjArray* fEMCALBadChannelMap; // Array of histograms with map of bad channels, EMCAL
177 Int_t fNCellsFromEMCALBorder; // Number of cells from EMCAL border the cell with maximum amplitude has to be.
178 Bool_t fNoEMCALBorderAtEta0; // Do fiducial cut in EMCAL region eta = 0?
180 AliEMCALPIDUtils * fPIDUtils; // Recalculate PID parameters
182 ClassDef(AliEMCALRecoUtils, 5)
186 #endif // ALIEMCALRECOUTILS_H