]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Tasks/AliFlowBayesianPID.h
update tof support specific version of TOF RunParams OCDB object
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / AliFlowBayesianPID.h
CommitLineData
f9d25f75 1/*
2-----------------------------------------------------------------------------------
3 AliFlowBayesianPID class implemented by F. Noferini (noferini@bo.infn.it)
4 needed to use Bayesian probability in the flow package (used in AliFlowTrackCuts)
5-----------------------------------------------------------------------------------
6*/
7#ifndef ALIFLOWBAYESIANPID_H
8#define ALIFLOWBAYESIANPID_H
2005b6be 9
2005b6be 10#include "AliESDpid.h"
11#include "AliPIDResponse.h"
12
f9d25f75 13class TObject;
2005b6be 14class TDatabasePDG;
15class AliESDEvent;
16class AliESDtrack;
d60cc79c 17class AliAODEvent;
18class AliAODTrack;
2005b6be 19class TH2D;
20class TSpline3;
21class TF1;
22class AliTOFGeometry;
23class AliTOFT0maker;
24
25/*
26HOW TO
27
281) in your main program:
29
30 AliFlowBayesianPID *mypid = new AliFlowBayesianPID();
31
32or (if you want a global AliESDpid object)
33
34 AliESDpid *PIDesd = new AliESDpid();
35 ....
2005b6be 36 AliFlowBayesianPID *mypid = new AliFlowBayesianPID(PIDesd);
37
38for data starting from the PbPb pass2 reconstruction
39
40 mypid->SetNewTrackParam();
41
42
d60cc79c 43before to loop on the on ESD tracks
44 mypid->SetDetResponse(esdEvent, centrality,AliESDpid::kTOF_T0,kFALSE); // centrality > 0 = PbPb or -1 for pp collisions
45
46before to loop on the on AOD tracks
47 mypid->SetDetResponse(aodEvent, centrality); // centrality > 0 = PbPb or -1 for pp collisions
48
49if you want to use a dE/dx depdence on DeltaPhi set the EP with its resolution otherwise it will be skipped
50 mypid->SetPsiCorrectionDeDx(psiEP,resEP);
51
2005b6be 52
2005b6be 53 for(...){ // track loop
d60cc79c 54 mypid->ComputeProb(track,centrality); // both for ESD and AOD tracks
55 Float_t *prob = mypid->GetProb(); // Bayesian Probability (from 0 to 4) (Combined TPC || TOF) including a tuning of priors and TOF mismatch parameterization
56 }
2005b6be 57
d60cc79c 58
59More details:
2005b6be 60 // for the single detector weights (no priors)
61 Float_t *tpcWeight = mypid->GetWeights(0); // TPC weights (equal weights in case of no kTPCpid)
62 Float_t *tofWeight = mypid->GetWeights(1); // TOF weights (equal weights in case of no kTOFpid)
63
64 // more tools
65 TSpline3 *mismatchShape = mypid->GetMismatch(); // time distribution of mismatched tracks - L/c (L is the distance of the pad from the PV)
66 TF1 *tpcprob = mypid->GetTPCprob(); // normalized TPC response function (in Nsigmas)
67 TF1 *tofprob = mypid->GetTOFprob(); // normalized TOF response function (in Nsigmas)
68
69 TH2D *hPr = mypid->GetHistoPriors(isp); // 2D (centrality - pT) histo for the priors of specie-isp (centrality < 0 means pp collisions)
70 // all the priors are normalized to the pion ones
71
2005b6be 72*/
73
d60cc79c 74class AliFlowBayesianPID : public AliPIDResponse{
2005b6be 75 public:
76 AliFlowBayesianPID(AliESDpid *esdpid=NULL);
9126fd0c 77 virtual ~AliFlowBayesianPID();
2005b6be 78
79 // virtual method of AliPIDResponse
b8f3f516 80 virtual Float_t NumberOfSigmasTOF(const AliVParticle *vtrack, AliPID::EParticleType type) const {if(vtrack) printf("Don't call AliFlowBayesianPID::NumberOfSigmasTOF method (%i)\n",type); return 0.0;} // do not use it
2005b6be 81
82 // setter
2005b6be 83 void SetDetResponse(AliESDEvent *esd,Float_t centrality=-1.0,EStartTimeType_t flagStart=AliESDpid::kTOF_T0,Bool_t recomputeT0TOF=kFALSE);
d60cc79c 84 void SetDetResponse(AliAODEvent *aod,Float_t centrality=-1.0);
2005b6be 85 void SetNewTrackParam(Bool_t flag=kTRUE){fNewTrackParam=flag;};
f9d25f75 86 void SetDetAND(Int_t idet){if(idet < fgkNdetectors && idet >= 0) fMaskAND[idet] = kTRUE;};
87 void SetDetOR(Int_t idet){if(idet < fgkNdetectors && idet >= 0) fMaskOR[idet] = kTRUE;};
88 void ResetDetAND(Int_t idet){if(idet < fgkNdetectors && idet >= 0) fMaskAND[idet] = kFALSE;};
89 void ResetDetOR(Int_t idet){if(idet < fgkNdetectors && idet >= 0) fMaskOR[idet] = kFALSE;};
d60cc79c 90 void SetPsiCorrectionDeDx(Float_t psi,Float_t res);
d4c1e280 91 void SetMC(Bool_t flag){fIsMC=flag;};
2005b6be 92
93 // getter
94 AliESDpid* GetESDpid(){return fPIDesd;};
f9d25f75 95 const TH2D *GetHistoPriors(Int_t specie) const {if(specie >=0 && specie < fgkNspecies) return fghPriors[specie]; else return NULL;};
2005b6be 96 TSpline3 *GetMismatch();
f9d25f75 97 const TF1 *GetTOFprob() const {return fTOFResponseF;};
98 const TF1 *GetTPCprob() const {return fTPCResponseF;};
99 const Float_t *GetWeights(Int_t det) const {if(det < fgkNdetectors && det >= 0){return fWeights[det];} else{return NULL;}};
100 Float_t *GetProb() {return fProb;};
101 Float_t GetTOFMismWeight() const {return fWTofMism;};
102 Float_t GetTOFMismProb() const {return fProbTofMism;};
103 Float_t GetMassOverZ() const {return fMassTOF;};
104 Float_t GetZ() const {return fZ;};
105 Bool_t GetDetANDstatus(Int_t idet) const {if(idet < fgkNdetectors && idet >= 0){return fMaskAND[idet];} else{return kFALSE;} };
106 Bool_t GetDetORstatus(Int_t idet) const {if(idet < fgkNdetectors && idet >= 0){return fMaskOR[idet];} else{return kFALSE;} };
107 Bool_t GetCurrentMask(Int_t idet) const {if(idet < fgkNdetectors && idet >= 0){return fMaskCurrent[idet];} else{return kFALSE;} };
108 Float_t GetExpDeDx(const AliESDtrack *t,Int_t iS) const;
d60cc79c 109 Float_t GetExpDeDx(const AliAODTrack *t,Int_t iS) const;
2005b6be 110
111 // methods for Bayesina Combined PID
b76f5f88 112 void ComputeWeights(const AliESDtrack *t);
113 void ComputeProb(const AliESDtrack *t,Float_t); // obsolete method
114 void ComputeProb(const AliESDtrack *t){ComputeProb(t,0.0);};
d4c1e280 115 void ComputeWeights(const AliAODTrack *t,AliAODEvent *aod=NULL);
116 void ComputeProb(const AliAODTrack *t,AliAODEvent *aod=NULL); // obsolete method
2005b6be 117
f9d25f75 118 void SetTOFres(Float_t res){fTOFresolution=res;};
2005b6be 119
587d006a 120 Float_t GetDeDx() const {return fDedx;};
121
2005b6be 122 private:
123 void SetPriors();
124
f9d25f75 125 static const Int_t fgkNdetectors = 2; // Number of detector used for PID
126 static const Int_t fgkNspecies = 8;// 0=el, 1=mu, 2=pi, 3=ka, 4=pr, 5=deuteron, 6=triton, 7=He3
127 static TH2D* fghPriors[fgkNspecies]; // histo with priors (hardcoded)
128 static TSpline3 *fgMism; // function for mismatch
129 static AliTOFGeometry *fgTofGeo; // TOF geometry needed to reproduce mismatch shape
2005b6be 130
131 AliESDpid *fPIDesd;//ESDpid object
132 TDatabasePDG *fDB; // Database pdg
f9d25f75 133 Double_t fMass[fgkNspecies]; // mass for el(0),mu(1),pi(2),K(3),p(4)
2005b6be 134
135 Bool_t fNewTrackParam; // switch for new tracking resolution TOF parameterization
f9d25f75 136 Float_t fTOFresolution; // TOF res needed only if T0-TOF should be recomputed
2005b6be 137
2005b6be 138 AliFlowBayesianPID(const AliFlowBayesianPID&); // not implemented
139 AliFlowBayesianPID& operator=(const AliFlowBayesianPID&); // not implemented
140
f9d25f75 141 TF1 *fTOFResponseF; // TOF Gaussian+tail response function (tail at 1.1 sigma)
142 TF1 *fTPCResponseF; // TPC Gaussian+tail response function (tail at 1.8 sigma)
2005b6be 143
144 AliTOFT0maker *fTOFmaker; //TOF-T0 maker object
145
f9d25f75 146 Float_t fWeights[fgkNdetectors][fgkNspecies]; // weights: 0=tpc,1=tof
147 Float_t fProb[fgkNspecies],fWTofMism,fProbTofMism; // Bayesian Combined PID + mismatch weights and probability
2005b6be 148
149 Float_t fZ,fMassTOF; //measured charge(Z) and mass/Z
150 TF1 *fBBdata; // Bethe Bloch function (needed to compute the charge of the particle)
151
f9d25f75 152 Bool_t fMaskAND[fgkNdetectors],fMaskOR[fgkNdetectors],fMaskCurrent[fgkNdetectors]; // mask detector should be used
65af732a 153
78fbf582 154 Float_t fCurrCentrality; // Centrality in current event
155
d60cc79c 156 Float_t fPsi,fPsiRes; // RP and its resolution for the event (999 if not available) to correct dEdx for p > 1
157
d4c1e280 158 Bool_t fIsMC; // switch for MC analysis
159
587d006a 160 Float_t fDedx; // dE/dx tuned for MC
161
d4c1e280 162 ClassDef(AliFlowBayesianPID, 6); // example of analysis
2005b6be 163};
164
165#endif
9126fd0c 166
2281e7c5 167
587d006a 168