]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALRecoUtils.h
Add new utils for cluster selections, checking user selected bad channels and cluster...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALRecoUtils.h
CommitLineData
d9b3567c 1#ifndef ALIEMCALRECOUTILS_H
2#define ALIEMCALRECOUTILS_H
3
4/* $Id: AliEMCALRecoUtils.h 33808 2009-07-15 09:48:08Z gconesab $ */
5
6///////////////////////////////////////////////////////////////////////////////
7//
8// Class AliEMCALRecoUtils
9// Some utilities to recalculate the cluster position or energy linearity
10//
11//
12// Author: Gustavo Conesa (LPSC- Grenoble)
13///////////////////////////////////////////////////////////////////////////////
14
15//Root includes
16#include "TNamed.h"
094786cc 17#include "TMath.h"
18#include "TObjArray.h"
17688f67 19#include "TH2F.h"
d9b3567c 20
21//AliRoot includes
22class AliVCluster;
23class AliVCaloCells;
24#include "AliLog.h"
094786cc 25class AliEMCALGeometry;
d9b3567c 26
27class AliEMCALRecoUtils : public TNamed {
28
29public:
30
31 AliEMCALRecoUtils();
32 AliEMCALRecoUtils(const AliEMCALRecoUtils&);
33 AliEMCALRecoUtils& operator=(const AliEMCALRecoUtils&);
094786cc 34 virtual ~AliEMCALRecoUtils() ;
d9b3567c 35
36 enum NonlinearityFunctions{kPi0MC=0,kPi0GammaGamma=1,kPi0GammaConversion=2,kNoCorrection=3};
fd6df01c 37 enum PositionAlgorithms{kUnchanged=-1,kPosTowerIndex=0, kPosTowerGlobal=1};
094786cc 38 enum ParticleType{kPhoton=0, kElectron=1,kHadron =2, kUnknown=-1};
d9b3567c 39
40 //Position recalculation
094786cc 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);
44
45 Float_t GetCellWeight(const Float_t eCell, const Float_t eCluster) const { return TMath::Max( 0., fW0 + TMath::Log( eCell / eCluster ));}
46
47 Float_t GetDepth(const Float_t eCluster, const Int_t iParticle, const Int_t iSM) const ;
48
49 void GetMaxEnergyCell(AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu,
d9b3567c 50 Int_t & absId, Int_t& iSupMod, Int_t& ieta, Int_t& iphi);
51
2a71e873 52 Float_t GetMisalTransShift(const Int_t i) const {
53 if(i < 15 ){return fMisalTransShift[i]; }
d9b3567c 54 else { AliInfo(Form("Index %d larger than 15, do nothing\n",i)); return 0.;}
55 }
094786cc 56 Float_t* GetMisalTransShiftArray() {return fMisalTransShift; }
d9b3567c 57
2a71e873 58 void SetMisalTransShift(const Int_t i, const Float_t shift) {
59 if(i < 15 ){fMisalTransShift[i] = shift; }
d9b3567c 60 else { AliInfo(Form("Index %d larger than 15, do nothing\n",i));}
61 }
2a71e873 62 void SetMisalTransShiftArray(Float_t * misal)
63 { for(Int_t i = 0; i < 15; i++)fMisalTransShift[i] = misal[i]; }
d9b3567c 64
2a71e873 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.;}
68 }
094786cc 69 Float_t* GetMisalRotShiftArray() {return fMisalRotShift; }
2a71e873 70
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));}
74 }
75 void SetMisalRotShiftArray(Float_t * misal)
76 { for(Int_t i = 0; i < 15; i++)fMisalRotShift[i] = misal[i]; }
77
094786cc 78 Int_t GetParticleType() const {return fParticleType ;}
79 void SetParticleType(Int_t particle) {fParticleType = particle ;}
2a71e873 80
094786cc 81 Int_t GetPositionAlgorithm() const {return fPosAlgo;}
82 void SetPositionAlgorithm(Int_t alg) {fPosAlgo = alg ;}
2a71e873 83
094786cc 84 Float_t GetW0() const {return fW0;}
85 void SetW0(Float_t w0) {fW0 = w0 ;}
86
d9b3567c 87 //Non Linearity
88
89 Float_t CorrectClusterEnergyLinearity(AliVCluster* clu);
90
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.;}
94 }
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));}
98 }
99
094786cc 100 Int_t GetNonLinearityFunction() const {return fNonLinearityFunction;}
d9b3567c 101 void SetNonLinearityFunction(Int_t fun) {fNonLinearityFunction = fun ;}
102
103 void Print(const Option_t*) const;
104
094786cc 105 //Recalibration
106 void RecalibrateClusterEnergy(AliEMCALGeometry* geom, AliVCluster* cluster, AliVCaloCells * cells);
107
108 Bool_t IsRecalibrationOn() const { return fRecalibration ; }
109 void SwitchOnRecalibration() {fRecalibration = kTRUE ; InitEMCALRecalibrationFactors();}
110 void SwitchOffRecalibration() {fRecalibration = kFALSE ; }
111
112 void InitEMCALRecalibrationFactors() ;
113
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);
116 else return 1;}
117
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);}
121
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);}
125
fd6df01c 126 //Modules fiducial region, remove clusters in borders
127 Bool_t CheckCellFiducialRegion(AliEMCALGeometry* geom, AliVCluster* cluster, AliVCaloCells* cells) ;
128 void SetNumberOfCellsFromEMCALBorder(Int_t n) {fNCellsFromEMCALBorder = n; }
129 Int_t GetNumberOfCellsFromEMCALBorder() const {return fNCellsFromEMCALBorder; }
130
131 void SwitchOnNoFiducialBorderInEMCALEta0() {fNoEMCALBorderAtEta0 = kTRUE; }
132 void SwitchOffNoFiducialBorderInEMCALEta0() {fNoEMCALBorderAtEta0 = kFALSE; }
133 Bool_t IsEMCALNoBorderAtEta0() {return fNoEMCALBorderAtEta0;}
134
135 // Bad channels
136 Bool_t IsBadChannelsRemovalSwitchedOn() const { return fRemoveBadChannels ; }
137 void SwitchOnBadChannelsRemoval () {fRemoveBadChannels = kTRUE ; InitEMCALBadChannelStatusMap();}
138 void SwitchOffBadChannelsRemoval() {fRemoveBadChannels = kFALSE ; }
139
140 void InitEMCALBadChannelStatusMap() ;
141
142 Int_t GetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow) const {
143 if(fEMCALBadChannelMap) return (Int_t) ((TH2I*)fEMCALBadChannelMap->At(iSM))->GetBinContent(iCol,iRow);
144 else return 0;}//Channel is ok by default
145
146 void SetEMCALChannelStatus(Int_t iSM , Int_t iCol, Int_t iRow, Double_t c = 1) {
147 if(!fEMCALBadChannelMap)InitEMCALBadChannelStatusMap() ;
148 ((TH2I*)fEMCALBadChannelMap->At(iSM))->SetBinContent(iCol,iRow,c);}
149
150 TH2I * GetEMCALChannelStatusMap(Int_t iSM) const {return (TH2I*)fEMCALBadChannelMap->At(iSM);}
151 void SetEMCALChannelStatusMap(TObjArray *map) {fEMCALBadChannelMap = map;}
152
153 Bool_t ClusterContainsBadChannel(AliEMCALGeometry* geom, UShort_t* cellList, Int_t nCells);
154
155
d9b3567c 156private:
157
2a71e873 158 Float_t fMisalTransShift[15]; // Shift parameters
159 Float_t fMisalRotShift[15]; // Shift parameters
d9b3567c 160 Int_t fNonLinearityFunction; // Non linearity function choice
161 Float_t fNonLinearityParams[6]; // Parameters for the non linearity function
094786cc 162 Int_t fParticleType; // Particle type for depth calculation
163 Int_t fPosAlgo; // Position recalculation algorithm
164 Float_t fW0; // Weight0
fd6df01c 165
166 Bool_t fRecalibration; // Switch on or off the recalibration
167 TObjArray* fEMCALRecalibrationFactors; // Array of histograms with map of recalibration factors, EMCAL
168 Bool_t fRemoveBadChannels; // Check the channel status provided and remove clusters with bad channels
169 TObjArray* fEMCALBadChannelMap; // Array of histograms with map of bad channels, EMCAL
170 Int_t fNCellsFromEMCALBorder; // Number of cells from EMCAL border the cell with maximum amplitude has to be.
171 Bool_t fNoEMCALBorderAtEta0; // Do fiducial cut in EMCAL region eta = 0?
d9b3567c 172
fd6df01c 173 ClassDef(AliEMCALRecoUtils, 4)
d9b3567c 174
175};
176
177#endif // ALIEMCALRECOUTILS_H
178
179