]>
Commit | Line | Data |
---|---|---|
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 | 13 | class TObject; |
2005b6be | 14 | class TDatabasePDG; |
15 | class AliESDEvent; | |
16 | class AliESDtrack; | |
17 | class TH2D; | |
18 | class TSpline3; | |
19 | class TF1; | |
20 | class AliTOFGeometry; | |
21 | class AliTOFT0maker; | |
22 | ||
23 | /* | |
24 | HOW TO | |
25 | ||
26 | 1) in your main program: | |
27 | ||
28 | AliFlowBayesianPID *mypid = new AliFlowBayesianPID(); | |
29 | ||
30 | or (if you want a global AliESDpid object) | |
31 | ||
32 | AliESDpid *PIDesd = new AliESDpid(); | |
33 | .... | |
34 | gROOT->LoadMacro("AliFlowBayesianPID.cxx++g"); | |
35 | AliFlowBayesianPID *mypid = new AliFlowBayesianPID(PIDesd); | |
36 | ||
37 | for data starting from the PbPb pass2 reconstruction | |
38 | ||
39 | mypid->SetNewTrackParam(); | |
40 | ||
41 | ||
42 | 2) pass the pointer to your task | |
43 | ||
44 | 3) In your Task Exec: | |
45 | mypid->SetDetResponse(esdEvent, centrality,AliESDpid::kTOF_T0,kFALSE); // centrality = PbPb centrality class (0-100%) or -1 for pp collisions | |
46 | for(...){ // track loop | |
47 | mypid->ComputeProb(track,centrality); | |
48 | Float_t *prob = mypid->GetProb(); // Bayesian Probability (from 0 to 4) (Combined TPC || TOF) including a tuning of priors and TOF mismatch parameterization | |
49 | ||
50 | // for the single detector weights (no priors) | |
51 | Float_t *tpcWeight = mypid->GetWeights(0); // TPC weights (equal weights in case of no kTPCpid) | |
52 | Float_t *tofWeight = mypid->GetWeights(1); // TOF weights (equal weights in case of no kTOFpid) | |
53 | ||
54 | // more tools | |
55 | TSpline3 *mismatchShape = mypid->GetMismatch(); // time distribution of mismatched tracks - L/c (L is the distance of the pad from the PV) | |
56 | TF1 *tpcprob = mypid->GetTPCprob(); // normalized TPC response function (in Nsigmas) | |
57 | TF1 *tofprob = mypid->GetTOFprob(); // normalized TOF response function (in Nsigmas) | |
58 | ||
59 | TH2D *hPr = mypid->GetHistoPriors(isp); // 2D (centrality - pT) histo for the priors of specie-isp (centrality < 0 means pp collisions) | |
60 | // all the priors are normalized to the pion ones | |
61 | ||
62 | } | |
63 | ||
64 | */ | |
65 | ||
66 | class AliFlowBayesianPID : public AliPIDResponse { | |
67 | public: | |
68 | AliFlowBayesianPID(AliESDpid *esdpid=NULL); | |
9126fd0c | 69 | virtual ~AliFlowBayesianPID(); |
2005b6be | 70 | |
71 | // virtual method of AliPIDResponse | |
b8f3f516 | 72 | 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 | 73 | |
74 | // setter | |
2005b6be | 75 | void SetDetResponse(AliESDEvent *esd,Float_t centrality=-1.0,EStartTimeType_t flagStart=AliESDpid::kTOF_T0,Bool_t recomputeT0TOF=kFALSE); |
76 | void SetNewTrackParam(Bool_t flag=kTRUE){fNewTrackParam=flag;}; | |
f9d25f75 | 77 | void SetDetAND(Int_t idet){if(idet < fgkNdetectors && idet >= 0) fMaskAND[idet] = kTRUE;}; |
78 | void SetDetOR(Int_t idet){if(idet < fgkNdetectors && idet >= 0) fMaskOR[idet] = kTRUE;}; | |
79 | void ResetDetAND(Int_t idet){if(idet < fgkNdetectors && idet >= 0) fMaskAND[idet] = kFALSE;}; | |
80 | void ResetDetOR(Int_t idet){if(idet < fgkNdetectors && idet >= 0) fMaskOR[idet] = kFALSE;}; | |
2005b6be | 81 | |
82 | // getter | |
83 | AliESDpid* GetESDpid(){return fPIDesd;}; | |
f9d25f75 | 84 | const TH2D *GetHistoPriors(Int_t specie) const {if(specie >=0 && specie < fgkNspecies) return fghPriors[specie]; else return NULL;}; |
2005b6be | 85 | TSpline3 *GetMismatch(); |
f9d25f75 | 86 | const TF1 *GetTOFprob() const {return fTOFResponseF;}; |
87 | const TF1 *GetTPCprob() const {return fTPCResponseF;}; | |
88 | const Float_t *GetWeights(Int_t det) const {if(det < fgkNdetectors && det >= 0){return fWeights[det];} else{return NULL;}}; | |
89 | Float_t *GetProb() {return fProb;}; | |
90 | Float_t GetTOFMismWeight() const {return fWTofMism;}; | |
91 | Float_t GetTOFMismProb() const {return fProbTofMism;}; | |
92 | Float_t GetMassOverZ() const {return fMassTOF;}; | |
93 | Float_t GetZ() const {return fZ;}; | |
94 | Bool_t GetDetANDstatus(Int_t idet) const {if(idet < fgkNdetectors && idet >= 0){return fMaskAND[idet];} else{return kFALSE;} }; | |
95 | Bool_t GetDetORstatus(Int_t idet) const {if(idet < fgkNdetectors && idet >= 0){return fMaskOR[idet];} else{return kFALSE;} }; | |
96 | Bool_t GetCurrentMask(Int_t idet) const {if(idet < fgkNdetectors && idet >= 0){return fMaskCurrent[idet];} else{return kFALSE;} }; | |
97 | Float_t GetExpDeDx(const AliESDtrack *t,Int_t iS) const; | |
2005b6be | 98 | |
99 | // methods for Bayesina Combined PID | |
b76f5f88 | 100 | void ComputeWeights(const AliESDtrack *t); |
101 | void ComputeProb(const AliESDtrack *t,Float_t); // obsolete method | |
102 | void ComputeProb(const AliESDtrack *t){ComputeProb(t,0.0);}; | |
2005b6be | 103 | |
f9d25f75 | 104 | void SetTOFres(Float_t res){fTOFresolution=res;}; |
2005b6be | 105 | |
106 | private: | |
107 | void SetPriors(); | |
108 | ||
f9d25f75 | 109 | static const Int_t fgkNdetectors = 2; // Number of detector used for PID |
110 | static const Int_t fgkNspecies = 8;// 0=el, 1=mu, 2=pi, 3=ka, 4=pr, 5=deuteron, 6=triton, 7=He3 | |
111 | static TH2D* fghPriors[fgkNspecies]; // histo with priors (hardcoded) | |
112 | static TSpline3 *fgMism; // function for mismatch | |
113 | static AliTOFGeometry *fgTofGeo; // TOF geometry needed to reproduce mismatch shape | |
2005b6be | 114 | |
115 | AliESDpid *fPIDesd;//ESDpid object | |
116 | TDatabasePDG *fDB; // Database pdg | |
f9d25f75 | 117 | Double_t fMass[fgkNspecies]; // mass for el(0),mu(1),pi(2),K(3),p(4) |
2005b6be | 118 | |
119 | Bool_t fNewTrackParam; // switch for new tracking resolution TOF parameterization | |
f9d25f75 | 120 | Float_t fTOFresolution; // TOF res needed only if T0-TOF should be recomputed |
2005b6be | 121 | |
2005b6be | 122 | AliFlowBayesianPID(const AliFlowBayesianPID&); // not implemented |
123 | AliFlowBayesianPID& operator=(const AliFlowBayesianPID&); // not implemented | |
124 | ||
f9d25f75 | 125 | TF1 *fTOFResponseF; // TOF Gaussian+tail response function (tail at 1.1 sigma) |
126 | TF1 *fTPCResponseF; // TPC Gaussian+tail response function (tail at 1.8 sigma) | |
2005b6be | 127 | |
128 | AliTOFT0maker *fTOFmaker; //TOF-T0 maker object | |
129 | ||
f9d25f75 | 130 | Float_t fWeights[fgkNdetectors][fgkNspecies]; // weights: 0=tpc,1=tof |
131 | Float_t fProb[fgkNspecies],fWTofMism,fProbTofMism; // Bayesian Combined PID + mismatch weights and probability | |
2005b6be | 132 | |
133 | Float_t fZ,fMassTOF; //measured charge(Z) and mass/Z | |
134 | TF1 *fBBdata; // Bethe Bloch function (needed to compute the charge of the particle) | |
135 | ||
f9d25f75 | 136 | Bool_t fMaskAND[fgkNdetectors],fMaskOR[fgkNdetectors],fMaskCurrent[fgkNdetectors]; // mask detector should be used |
65af732a | 137 | |
78fbf582 | 138 | Float_t fCurrCentrality; // Centrality in current event |
139 | ||
f9d25f75 | 140 | ClassDef(AliFlowBayesianPID, 5); // example of analysis |
2005b6be | 141 | }; |
142 | ||
143 | #endif | |
9126fd0c | 144 | |
2281e7c5 | 145 |