]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/PartCorrBase/AliCaloPID.h
AliCalorimeterUtils: Fix to be able to use PHOS bad map and geometry matrices
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / 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 */
5/* $Id: $ */
6
7//_________________________________________________________________________
bdd2a262 8// Class for PID selection with calorimeters
49b5c49b 9// The Output of the main method GetIdentifiedParticleType is a PDG number identifying the cluster,
bdd2a262 10// being kPhoton, kElectron, kPi0 ... as defined in the header file
49b5c49b 11// - GetIdentifiedParticleType(const TString calo, const TLorentzVector mom, const AliVCluster * cluster)
12// Assignes a PID tag to the cluster, right now there is the possibility to : use bayesian weights from reco,
13// recalculate them (EMCAL) or use other procedures not used in reco.
bdd2a262 14// In order to recalculate Bayesian, it is necessary to load the EMCALUtils library
15// and do SwitchOnBayesianRecalculation().
16// To change the PID parameters from Low to High like the ones by default, use the constructor
17// AliCaloPID(flux)
18// where flux is AliCaloPID::kLow or AliCaloPID::kHigh
19// If it is necessary to change the parameters use the constructor
20// AliCaloPID(AliEMCALPIDUtils *utils) and set the parameters before.
49b5c49b 21
22// - GetGetIdentifiedParticleTypeFromBayesian(const TString calo, const Double_t * pid, const Float_t energy)
23// Reads the PID weights array of the ESDs and depending on its magnitude identifies the particle,
24// executed when bayesian is ON by GetIdentifiedParticleType(const TString calo, const TLorentzVector mom, const AliVCluster * cluster)
9a6fa057 25// - SetPIDBits: Simple PID, depending on the thresholds fLOCut fTOFCut and even the
bdd2a262 26// result of the PID bayesian a different PID bit is set.
27//
1c5acb87 28//
29//*-- Author: Gustavo Conesa (INFN-LNF)
30
31// --- ROOT system ---
32#include <TObject.h>
33class TString ;
34class TLorentzVector ;
a5fb4114 35#include <TFormula.h>
f21fc003 36class TList;
d39cba7e 37class TH2F ;
1c5acb87 38
39//--- AliRoot system ---
0ae57829 40class AliVCluster;
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
477d6cee 55 enum PidType {
a5fb4114 56 kPhoton = 22,
57 kPi0 = 111,
58 kEta = 221,
59 kElectron = 11,
60 kEleCon =-11,
61 kNeutralHadron = 2112,
62 kChargedHadron = 211,
477d6cee 63 kNeutralUnknown = 130,
a5fb4114 64 kChargedUnknown = 321
477d6cee 65 };
66
67 enum TagType {kPi0Decay, kEtaDecay, kOtherDecay, kConversion, kNoTag = -1};
68
49b5c49b 69 // Main methods
70
a5fb4114 71 TList * GetCreateOutputObjects();
d39cba7e 72
a5fb4114 73 void InitParameters();
9a6fa057 74
49b5c49b 75 Int_t GetIdentifiedParticleTypeFromBayesWeights(const TString calo, const Double_t * pid, const Float_t energy) ;
477d6cee 76
bbb09837 77 Int_t GetIdentifiedParticleType(const TString calo, const TLorentzVector mom, const AliVCluster * cluster) ;
477d6cee 78
9a6fa057 79 TString GetPIDParametersList();
477d6cee 80
49b5c49b 81 Bool_t IsTrackMatched(AliVCluster * cluster, AliCalorimeterUtils* cu, AliVEvent* event) const ;
82
83 void SetPIDBits(const TString calo, AliVCluster * cluster, AliAODPWG4Particle *aodph,
84 AliCalorimeterUtils* cu, AliVEvent* event);
477d6cee 85
a5fb4114 86 void Print(const Option_t * opt)const;
87
49b5c49b 88 //Check if cluster photon-like. Uses photon cluster parameterization in real pp data
89 //Returns distance in sigmas. Recommended cut 2.5
90 Float_t TestPHOSDispersion(const Double_t pt, const Double_t m20, const Double_t m02) const ;
91 //Checks distance to the closest track. Takes into account
92 //non-perpendicular incidence of tracks.
93 Float_t TestPHOSChargedVeto(const Double_t dx, const Double_t dz, const Double_t ptTrack,
94 const Int_t chargeTrack, const Double_t mf) const ;
95
96 // Setters, getters
97
98 void SetDebug(Int_t deb) { fDebug = deb ; }
99 Int_t GetDebug() const { return fDebug ; }
100
101 enum eventType{kLow,kHigh};
102 void SetLowParticleFlux() { fParticleFlux = kLow ; }
103 void SetHighParticleFlux() { fParticleFlux = kHigh ; }
104 // not really used, only for bayesian recalculation in EMCAL, but could be useful in future
105
106 // Bayesian
107
108 void SwitchOnBayesian() { fUseBayesianWeights = kTRUE ; }
109 void SwitchOffBayesian() { fUseBayesianWeights = kFALSE; }
110 void SwitchOnBayesianRecalculation() { fRecalculateBayesian = kTRUE ; fUseBayesianWeights = kTRUE ;} // EMCAL
111 void SwitchOffBayesianRecalculation() { fRecalculateBayesian = kFALSE; } // EMCAL
112
c5693f62 113 AliEMCALPIDUtils * GetEMCALPIDUtils() ;
477d6cee 114
115 //Weight getters
49b5c49b 116 Float_t GetEMCALPhotonWeight() const { return fEMCALPhotonWeight ; }
117 Float_t GetEMCALPi0Weight() const { return fEMCALPi0Weight ; }
118 Float_t GetEMCALElectronWeight() const { return fEMCALElectronWeight ; }
119 Float_t GetEMCALChargeWeight() const { return fEMCALChargeWeight ; }
120 Float_t GetEMCALNeutralWeight() const { return fEMCALNeutralWeight ; }
121 Float_t GetPHOSPhotonWeight() const { return fPHOSPhotonWeight ; }
122 Float_t GetPHOSPi0Weight() const { return fPHOSPi0Weight ; }
123 Float_t GetPHOSElectronWeight() const { return fPHOSElectronWeight ; }
124 Float_t GetPHOSChargeWeight() const { return fPHOSChargeWeight ; }
125 Float_t GetPHOSNeutralWeight() const { return fPHOSNeutralWeight ; }
126
127 Bool_t IsPHOSPIDWeightFormulaOn() const { return fPHOSWeightFormula ; }
128
129 TFormula * GetPHOSPhotonWeightFormula() {
a5fb4114 130 if(!fPHOSPhotonWeightFormula)
131 fPHOSPhotonWeightFormula = new TFormula("phos_photon_weight",
132 fPHOSPhotonWeightFormulaExpression);
49b5c49b 133 return fPHOSPhotonWeightFormula ; }
477d6cee 134
49b5c49b 135 TFormula * GetPHOSPi0WeightFormula() {
a5fb4114 136 if(!fPHOSPi0WeightFormula)
137 fPHOSPi0WeightFormula = new TFormula("phos_pi0_weight",
138 fPHOSPi0WeightFormulaExpression);
49b5c49b 139 return fPHOSPi0WeightFormula ; }
5ae09196 140
49b5c49b 141 TString GetPHOSPhotonWeightFormulaExpression() const { return fPHOSPhotonWeightFormulaExpression ; }
142 TString GetPHOSPi0WeightFormulaExpression() const { return fPHOSPi0WeightFormulaExpression ; }
5ae09196 143
a5fb4114 144 //Weight setters
49b5c49b 145 void SetEMCALPhotonWeight (Float_t w) { fEMCALPhotonWeight = w ; }
146 void SetEMCALPi0Weight (Float_t w) { fEMCALPi0Weight = w ; }
147 void SetEMCALElectronWeight(Float_t w) { fEMCALElectronWeight = w ; }
148 void SetEMCALChargeWeight (Float_t w) { fEMCALChargeWeight = w ; }
149 void SetEMCALNeutralWeight (Float_t w) { fEMCALNeutralWeight = w ; }
150 void SetPHOSPhotonWeight (Float_t w) { fPHOSPhotonWeight = w ; }
151 void SetPHOSPi0Weight (Float_t w) { fPHOSPi0Weight = w ; }
152 void SetPHOSElectronWeight (Float_t w) { fPHOSElectronWeight = w ; }
153 void SetPHOSChargeWeight (Float_t w) { fPHOSChargeWeight = w ; }
154 void SetPHOSNeutralWeight (Float_t w) { fPHOSNeutralWeight = w ; }
155
156 void UsePHOSPIDWeightFormula (Bool_t ok ) { fPHOSWeightFormula = ok ; }
157 void SetPHOSPhotonWeightFormulaExpression(TString ph) { fPHOSPhotonWeightFormulaExpression = ph ; }
158 void SetPHOSPi0WeightFormulaExpression (TString pi) { fPHOSPi0WeightFormulaExpression = pi ; }
d39cba7e 159
49b5c49b 160 //PID cuts
d39cba7e 161
49b5c49b 162 void SetEMCALLambda0CutMax(Float_t lcut ) { fEMCALL0CutMax = lcut ; }
163 Float_t GetEMCALLambda0CutMax() const { return fEMCALL0CutMax ; }
164
165 void SetEMCALLambda0CutMin(Float_t lcut ) { fEMCALL0CutMin = lcut ; }
166 Float_t GetEMCALLambda0CutMin() const { return fEMCALL0CutMin ; }
167
168 void SetEMCALDEtaCut(Float_t dcut ) { fEMCALDEtaCut = dcut ; }
169 Float_t GetEMCALDEtaCut() const { return fEMCALDEtaCut ; }
170
171 void SetEMCALDPhiCut(Float_t dcut ) { fEMCALDPhiCut = dcut ; }
172 Float_t GetEMCALDPhiCut() const { return fEMCALDPhiCut ; }
173
174 void SetTOFCut(Float_t tcut ) { fTOFCut = tcut ; }
175 Float_t GetTOFCut() const { return fTOFCut ; }
176
177 void SetPHOSRCut(Float_t rcut ) { fPHOSRCut = rcut ; }
178 Float_t GetPHOSRCut() const { return fPHOSRCut ; }
a5fb4114 179
49b5c49b 180 void SetPHOSDispersionCut(Float_t dcut ) { fPHOSDispersionCut = dcut ; }
181 Float_t GetPHOSDispersionCut() const { return fPHOSDispersionCut ; }
182
a5fb4114 183 // Track matching histogrammes setters and getters
d39cba7e 184
185 virtual void SetHistoERangeAndNBins(Float_t min, Float_t max, Int_t n) {
49b5c49b 186 fHistoNEBins = n ; fHistoEMax = max ; fHistoEMin = min ; }
d39cba7e 187
188 virtual void SetHistoDEtaRangeAndNBins(Float_t min, Float_t max, Int_t n) {
49b5c49b 189 fHistoNDEtaBins = n ; fHistoDEtaMax = max ; fHistoDEtaMin = min ; }
d39cba7e 190
d39cba7e 191 virtual void SetHistoDPhiRangeAndNBins(Float_t min, Float_t max, Int_t n) {
49b5c49b 192 fHistoNDPhiBins = n ; fHistoDPhiMax = max ; fHistoDPhiMin = min ; }
a5fb4114 193
d39cba7e 194
f2ccb5b8 195private:
477d6cee 196
49b5c49b 197 Int_t fDebug; // Debug level
198 Int_t fParticleFlux; // Particle flux for setting PID parameters
199
200 // Bayesian
201 AliEMCALPIDUtils * fEMCALPIDUtils; // Pointer to EMCALPID to redo the PID Bayesian calculation
202 Bool_t fUseBayesianWeights; // Select clusters based on weights calculated in reconstruction
203 Bool_t fRecalculateBayesian; // Recalculate PID bayesian or use simple PID?
204
205 Float_t fEMCALPhotonWeight; // Bayesian PID weight for photons in EMCAL
206 Float_t fEMCALPi0Weight; // Bayesian PID weight for pi0 in EMCAL
207 Float_t fEMCALElectronWeight; // Bayesian PID weight for electrons in EMCAL
208 Float_t fEMCALChargeWeight; // Bayesian PID weight for charged hadrons in EMCAL
209 Float_t fEMCALNeutralWeight; // Bayesian PID weight for neutral hadrons in EMCAL
210 Float_t fPHOSPhotonWeight; // Bayesian PID weight for photons in PHOS
211 Float_t fPHOSPi0Weight; // Bayesian PID weight for pi0 in PHOS
212 Float_t fPHOSElectronWeight; // Bayesian PID weight for electrons in PHOS
213 Float_t fPHOSChargeWeight; // Bayesian PID weight for charged hadrons in PHOS
214 Float_t fPHOSNeutralWeight; // Bayesian PID weight for neutral hadrons in PHOS
a5fb4114 215
9a6fa057 216 Bool_t fPHOSWeightFormula ; // Use parametrized weight threshold, function of energy
217 TFormula *fPHOSPhotonWeightFormula ; // Formula for photon weight
218 TFormula *fPHOSPi0WeightFormula ; // Formula for pi0 weight
a5fb4114 219 TString fPHOSPhotonWeightFormulaExpression; // Photon weight formula in string
220 TString fPHOSPi0WeightFormulaExpression; // Pi0 weight formula in string
221
49b5c49b 222 // PID calculation
223 Float_t fEMCALL0CutMax; // Max Cut on shower shape lambda0, used in PID evaluation, only EMCAL
224 Float_t fEMCALL0CutMin; // Min Cut on shower shape lambda0, used in PID evaluation, only EMCAL
225 Float_t fEMCALDEtaCut; // Track matching cut on Dz
226 Float_t fEMCALDPhiCut; // Track matching cut on Dx
ae182e60 227
49b5c49b 228 Float_t fTOFCut; // Cut on TOF, used in PID evaluation
229
230 Float_t fPHOSDispersionCut; // Shower shape elipse radious cut
231 Float_t fPHOSRCut; // Track-Cluster distance cut for track matching in PHOS
ae182e60 232
a5fb4114 233 // Track matching control histograms
49b5c49b 234 Int_t fHistoNEBins ; // Number of bins in cluster E axis
235 Float_t fHistoEMax ; // Maximum value of cluster E histogram range
236 Float_t fHistoEMin ; // Minimum value of cluster E histogram range
237 Int_t fHistoNDEtaBins ; // Number of bins in dEta (cluster-track) axis
238 Float_t fHistoDEtaMax ; // Maximum value of dEta (cluster-track) histogram range
239 Float_t fHistoDEtaMin ; // Minimum value of dEta (cluster-track) histogram range
240 Int_t fHistoNDPhiBins ; // Number of bins in dPhi axis
241 Float_t fHistoDPhiMax ; // Maximum value of dPhi (cluster-track) histogram range
242 Float_t fHistoDPhiMin ; // Minimum value of dPhi (cluster-track) histogram range
243
244 TH2F *fhTrackMatchedDEta ; //! Eta distance between track and cluster vs cluster E
245 TH2F *fhTrackMatchedDPhi ; //! Phi distance between track and cluster vs cluster E
246 TH2F *fhTrackMatchedDEtaDPhi ; //! Eta vs Phi distance between track and cluster, E cluster > 0.5 GeV
247
c5693f62 248 AliCaloPID & operator = (const AliCaloPID & g) ; // cpy assignment
249 AliCaloPID(const AliCaloPID & g) ; // cpy ctor
250
49b5c49b 251 ClassDef(AliCaloPID,10)
e5dbdaf0 252} ;
1c5acb87 253
254
255#endif //ALICALOPID_H
256
257
258