]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/CaloTrackCorrBase/AliCaloPID.h
adding possibility to correct with Event Mixing for multidimensional BF analysis
[u/mrichter/AliRoot.git] / PWG / CaloTrackCorrBase / AliCaloPID.h
CommitLineData
1c5acb87 1#ifndef ALICALOPID_H
2#define ALICALOPID_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
1c5acb87 5
6//_________________________________________________________________________
bdd2a262 7// Class for PID selection with calorimeters
49b5c49b 8// The Output of the main method GetIdentifiedParticleType is a PDG number identifying the cluster,
bdd2a262 9// being kPhoton, kElectron, kPi0 ... as defined in the header file
3c1d9afb 10// - GetIdentifiedParticleType(const AliVCluster * cluster)
49b5c49b 11// Assignes a PID tag to the cluster, right now there is the possibility to : use bayesian weights from reco,
12// recalculate them (EMCAL) or use other procedures not used in reco.
bdd2a262 13// In order to recalculate Bayesian, it is necessary to load the EMCALUtils library
14// and do SwitchOnBayesianRecalculation().
15// To change the PID parameters from Low to High like the ones by default, use the constructor
16// AliCaloPID(flux)
17// where flux is AliCaloPID::kLow or AliCaloPID::kHigh
18// If it is necessary to change the parameters use the constructor
19// AliCaloPID(AliEMCALPIDUtils *utils) and set the parameters before.
49b5c49b 20
3c1d9afb 21// - GetGetIdentifiedParticleTypeFromBayesian(const Double_t * pid, const Float_t energy)
49b5c49b 22// Reads the PID weights array of the ESDs and depending on its magnitude identifies the particle,
3c1d9afb 23// executed when bayesian is ON by GetIdentifiedParticleType(const AliVCluster * cluster)
9a6fa057 24// - SetPIDBits: Simple PID, depending on the thresholds fLOCut fTOFCut and even the
bdd2a262 25// result of the PID bayesian a different PID bit is set.
26//
1c5acb87 27//
28//*-- Author: Gustavo Conesa (INFN-LNF)
29
30// --- ROOT system ---
31#include <TObject.h>
32class TString ;
33class TLorentzVector ;
a5fb4114 34#include <TFormula.h>
f21fc003 35class TList;
d39cba7e 36class TH2F ;
1c5acb87 37
38//--- AliRoot system ---
0ae57829 39class AliVCluster;
3c1d9afb 40class AliVCaloCells;
1c5acb87 41class AliAODPWG4Particle;
c5693f62 42class AliEMCALPIDUtils;
f2ccb5b8 43class AliCalorimeterUtils;
49b5c49b 44class AliVEvent;
1c5acb87 45
46class AliCaloPID : public TObject {
47
477d6cee 48 public:
49
50 AliCaloPID() ; // ctor
bdd2a262 51 AliCaloPID(const Int_t particleFlux) ; // ctor, to be used when recalculating bayesian PID
f21fc003 52 AliCaloPID(const TNamed * emcalpid) ; // ctor, to be used when recalculating bayesian PID and need different parameters
477d6cee 53 virtual ~AliCaloPID() ;//virtual dtor
c5693f62 54
3c1d9afb 55 enum PidType
56 {
a5fb4114 57 kPhoton = 22,
58 kPi0 = 111,
59 kEta = 221,
60 kElectron = 11,
61 kEleCon =-11,
62 kNeutralHadron = 2112,
63 kChargedHadron = 211,
477d6cee 64 kNeutralUnknown = 130,
a5fb4114 65 kChargedUnknown = 321
477d6cee 66 };
67
68 enum TagType {kPi0Decay, kEtaDecay, kOtherDecay, kConversion, kNoTag = -1};
69
49b5c49b 70 // Main methods
71
a5fb4114 72 TList * GetCreateOutputObjects();
d39cba7e 73
a5fb4114 74 void InitParameters();
9a6fa057 75
3c1d9afb 76 Int_t GetIdentifiedParticleTypeFromBayesWeights(const Bool_t isEMCAL, const Double_t * pid, const Float_t energy) ;
77
78 Int_t GetIdentifiedParticleTypeFromClusterSplitting(AliVCluster * cluster, AliVCaloCells* cells,
79 AliCalorimeterUtils * caloutils,
80 Double_t vertex[3],
bfdcf7fb 81 Int_t & nLocMax, Double_t & mass, Double_t & angle,
82 Double_t & e1 , Double_t & e2 ) ;
477d6cee 83
3c1d9afb 84 Int_t GetIdentifiedParticleType(const AliVCluster * cluster) ;
477d6cee 85
9a6fa057 86 TString GetPIDParametersList();
477d6cee 87
49b5c49b 88 Bool_t IsTrackMatched(AliVCluster * cluster, AliCalorimeterUtils* cu, AliVEvent* event) const ;
89
3c1d9afb 90 void SetPIDBits(AliVCluster * cluster, AliAODPWG4Particle *aodph,
49b5c49b 91 AliCalorimeterUtils* cu, AliVEvent* event);
477d6cee 92
a5fb4114 93 void Print(const Option_t * opt)const;
94
3c1d9afb 95 void PrintClusterPIDWeights(const Double_t * pid) const;
96
49b5c49b 97 //Check if cluster photon-like. Uses photon cluster parameterization in real pp data
98 //Returns distance in sigmas. Recommended cut 2.5
99 Float_t TestPHOSDispersion(const Double_t pt, const Double_t m20, const Double_t m02) const ;
100 //Checks distance to the closest track. Takes into account
101 //non-perpendicular incidence of tracks.
102 Float_t TestPHOSChargedVeto(const Double_t dx, const Double_t dz, const Double_t ptTrack,
103 const Int_t chargeTrack, const Double_t mf) const ;
104
105 // Setters, getters
106
107 void SetDebug(Int_t deb) { fDebug = deb ; }
108 Int_t GetDebug() const { return fDebug ; }
109
110 enum eventType{kLow,kHigh};
111 void SetLowParticleFlux() { fParticleFlux = kLow ; }
112 void SetHighParticleFlux() { fParticleFlux = kHigh ; }
113 // not really used, only for bayesian recalculation in EMCAL, but could be useful in future
114
115 // Bayesian
116
117 void SwitchOnBayesian() { fUseBayesianWeights = kTRUE ; }
118 void SwitchOffBayesian() { fUseBayesianWeights = kFALSE; }
119 void SwitchOnBayesianRecalculation() { fRecalculateBayesian = kTRUE ; fUseBayesianWeights = kTRUE ;} // EMCAL
120 void SwitchOffBayesianRecalculation() { fRecalculateBayesian = kFALSE; } // EMCAL
121
c5693f62 122 AliEMCALPIDUtils * GetEMCALPIDUtils() ;
477d6cee 123
124 //Weight getters
49b5c49b 125 Float_t GetEMCALPhotonWeight() const { return fEMCALPhotonWeight ; }
126 Float_t GetEMCALPi0Weight() const { return fEMCALPi0Weight ; }
127 Float_t GetEMCALElectronWeight() const { return fEMCALElectronWeight ; }
128 Float_t GetEMCALChargeWeight() const { return fEMCALChargeWeight ; }
129 Float_t GetEMCALNeutralWeight() const { return fEMCALNeutralWeight ; }
130 Float_t GetPHOSPhotonWeight() const { return fPHOSPhotonWeight ; }
131 Float_t GetPHOSPi0Weight() const { return fPHOSPi0Weight ; }
132 Float_t GetPHOSElectronWeight() const { return fPHOSElectronWeight ; }
133 Float_t GetPHOSChargeWeight() const { return fPHOSChargeWeight ; }
134 Float_t GetPHOSNeutralWeight() const { return fPHOSNeutralWeight ; }
135
136 Bool_t IsPHOSPIDWeightFormulaOn() const { return fPHOSWeightFormula ; }
137
138 TFormula * GetPHOSPhotonWeightFormula() {
a5fb4114 139 if(!fPHOSPhotonWeightFormula)
140 fPHOSPhotonWeightFormula = new TFormula("phos_photon_weight",
141 fPHOSPhotonWeightFormulaExpression);
49b5c49b 142 return fPHOSPhotonWeightFormula ; }
477d6cee 143
49b5c49b 144 TFormula * GetPHOSPi0WeightFormula() {
a5fb4114 145 if(!fPHOSPi0WeightFormula)
146 fPHOSPi0WeightFormula = new TFormula("phos_pi0_weight",
147 fPHOSPi0WeightFormulaExpression);
49b5c49b 148 return fPHOSPi0WeightFormula ; }
5ae09196 149
49b5c49b 150 TString GetPHOSPhotonWeightFormulaExpression() const { return fPHOSPhotonWeightFormulaExpression ; }
151 TString GetPHOSPi0WeightFormulaExpression() const { return fPHOSPi0WeightFormulaExpression ; }
5ae09196 152
a5fb4114 153 //Weight setters
49b5c49b 154 void SetEMCALPhotonWeight (Float_t w) { fEMCALPhotonWeight = w ; }
155 void SetEMCALPi0Weight (Float_t w) { fEMCALPi0Weight = w ; }
156 void SetEMCALElectronWeight(Float_t w) { fEMCALElectronWeight = w ; }
157 void SetEMCALChargeWeight (Float_t w) { fEMCALChargeWeight = w ; }
158 void SetEMCALNeutralWeight (Float_t w) { fEMCALNeutralWeight = w ; }
159 void SetPHOSPhotonWeight (Float_t w) { fPHOSPhotonWeight = w ; }
160 void SetPHOSPi0Weight (Float_t w) { fPHOSPi0Weight = w ; }
161 void SetPHOSElectronWeight (Float_t w) { fPHOSElectronWeight = w ; }
162 void SetPHOSChargeWeight (Float_t w) { fPHOSChargeWeight = w ; }
163 void SetPHOSNeutralWeight (Float_t w) { fPHOSNeutralWeight = w ; }
164
165 void UsePHOSPIDWeightFormula (Bool_t ok ) { fPHOSWeightFormula = ok ; }
166 void SetPHOSPhotonWeightFormulaExpression(TString ph) { fPHOSPhotonWeightFormulaExpression = ph ; }
167 void SetPHOSPi0WeightFormulaExpression (TString pi) { fPHOSPi0WeightFormulaExpression = pi ; }
d39cba7e 168
49b5c49b 169 //PID cuts
d39cba7e 170
49b5c49b 171 void SetEMCALLambda0CutMax(Float_t lcut ) { fEMCALL0CutMax = lcut ; }
172 Float_t GetEMCALLambda0CutMax() const { return fEMCALL0CutMax ; }
173
174 void SetEMCALLambda0CutMin(Float_t lcut ) { fEMCALL0CutMin = lcut ; }
175 Float_t GetEMCALLambda0CutMin() const { return fEMCALL0CutMin ; }
176
177 void SetEMCALDEtaCut(Float_t dcut ) { fEMCALDEtaCut = dcut ; }
178 Float_t GetEMCALDEtaCut() const { return fEMCALDEtaCut ; }
179
180 void SetEMCALDPhiCut(Float_t dcut ) { fEMCALDPhiCut = dcut ; }
181 Float_t GetEMCALDPhiCut() const { return fEMCALDPhiCut ; }
182
183 void SetTOFCut(Float_t tcut ) { fTOFCut = tcut ; }
184 Float_t GetTOFCut() const { return fTOFCut ; }
185
186 void SetPHOSRCut(Float_t rcut ) { fPHOSRCut = rcut ; }
187 Float_t GetPHOSRCut() const { return fPHOSRCut ; }
a5fb4114 188
49b5c49b 189 void SetPHOSDispersionCut(Float_t dcut ) { fPHOSDispersionCut = dcut ; }
190 Float_t GetPHOSDispersionCut() const { return fPHOSDispersionCut ; }
191
3c1d9afb 192 // Cluster splitting analysis
193
194 void SwitchOnClusterSplittingPID() { fDoClusterSplitting = kTRUE ; }
195 void SwitchOffClusterplittingPID() { fDoClusterSplitting = kFALSE ; }
196
197 void SetClusterSplittingM02Cut(Float_t min=0, Float_t max=100)
198 { fSplitM02MinCut = min ; fSplitM02MaxCut = max ; }
199
200 void SetClusterSplittingMinNCells(Int_t cut) { fSplitMinNCells = cut ; }
201
202 Float_t GetPi0MinMass() const { return fMassPi0Min ; }
203 Float_t GetEtaMinMass() const { return fMassEtaMin ; }
204 Float_t GetPhotonMinMass() const { return fMassPhoMin ; }
205 Float_t GetPi0MaxMass() const { return fMassPi0Max ; }
206 Float_t GetEtaMaxMass() const { return fMassEtaMax ; }
207 Float_t GetPhotonMaxMass() const { return fMassPhoMax ; }
208
209 void SetPi0MassRange(Float_t min, Float_t max) { fMassPi0Min = min ; fMassPi0Max = max ; }
210 void SetEtaMassRange(Float_t min, Float_t max) { fMassEtaMin = min ; fMassEtaMax = max ; }
211 void SetPhotonMassRange(Float_t min, Float_t max) { fMassPhoMin = min ; fMassPhoMax = max ; }
d39cba7e 212
f2ccb5b8 213private:
477d6cee 214
49b5c49b 215 Int_t fDebug; // Debug level
216 Int_t fParticleFlux; // Particle flux for setting PID parameters
217
218 // Bayesian
219 AliEMCALPIDUtils * fEMCALPIDUtils; // Pointer to EMCALPID to redo the PID Bayesian calculation
220 Bool_t fUseBayesianWeights; // Select clusters based on weights calculated in reconstruction
221 Bool_t fRecalculateBayesian; // Recalculate PID bayesian or use simple PID?
222
223 Float_t fEMCALPhotonWeight; // Bayesian PID weight for photons in EMCAL
224 Float_t fEMCALPi0Weight; // Bayesian PID weight for pi0 in EMCAL
225 Float_t fEMCALElectronWeight; // Bayesian PID weight for electrons in EMCAL
226 Float_t fEMCALChargeWeight; // Bayesian PID weight for charged hadrons in EMCAL
227 Float_t fEMCALNeutralWeight; // Bayesian PID weight for neutral hadrons in EMCAL
228 Float_t fPHOSPhotonWeight; // Bayesian PID weight for photons in PHOS
229 Float_t fPHOSPi0Weight; // Bayesian PID weight for pi0 in PHOS
230 Float_t fPHOSElectronWeight; // Bayesian PID weight for electrons in PHOS
231 Float_t fPHOSChargeWeight; // Bayesian PID weight for charged hadrons in PHOS
232 Float_t fPHOSNeutralWeight; // Bayesian PID weight for neutral hadrons in PHOS
a5fb4114 233
9a6fa057 234 Bool_t fPHOSWeightFormula ; // Use parametrized weight threshold, function of energy
235 TFormula *fPHOSPhotonWeightFormula ; // Formula for photon weight
236 TFormula *fPHOSPi0WeightFormula ; // Formula for pi0 weight
a5fb4114 237 TString fPHOSPhotonWeightFormulaExpression; // Photon weight formula in string
238 TString fPHOSPi0WeightFormulaExpression; // Pi0 weight formula in string
239
49b5c49b 240 // PID calculation
241 Float_t fEMCALL0CutMax; // Max Cut on shower shape lambda0, used in PID evaluation, only EMCAL
242 Float_t fEMCALL0CutMin; // Min Cut on shower shape lambda0, used in PID evaluation, only EMCAL
243 Float_t fEMCALDEtaCut; // Track matching cut on Dz
244 Float_t fEMCALDPhiCut; // Track matching cut on Dx
ae182e60 245
49b5c49b 246 Float_t fTOFCut; // Cut on TOF, used in PID evaluation
247
248 Float_t fPHOSDispersionCut; // Shower shape elipse radious cut
249 Float_t fPHOSRCut; // Track-Cluster distance cut for track matching in PHOS
49b5c49b 250
3c1d9afb 251 // Cluster splitting mass ranges
252 Bool_t fDoClusterSplitting; // Cluster splitting analysis
253 Float_t fSplitM02MaxCut ; // Study clusters with l0 smaller than cut
254 Float_t fSplitM02MinCut ; // Study clusters with l0 larger than cut
255 Int_t fSplitMinNCells ; // Study clusters with ncells larger than cut
256 Float_t fMassEtaMin ; // Min Eta mass
257 Float_t fMassEtaMax ; // Max Eta mass
258 Float_t fMassPi0Min ; // Min Pi0 mass
259 Float_t fMassPi0Max ; // Min Pi0 mass
260 Float_t fMassPhoMin ; // Min Photon mass
261 Float_t fMassPhoMax ; // Min Photon mass
262
c5693f62 263 AliCaloPID & operator = (const AliCaloPID & g) ; // cpy assignment
09273901 264 AliCaloPID( const AliCaloPID & g) ; // cpy ctor
c5693f62 265
bfdcf7fb 266 ClassDef(AliCaloPID,13)
3c1d9afb 267
e5dbdaf0 268} ;
1c5acb87 269
270
271#endif //ALICALOPID_H
272
273
274