Possibility to apply a cut on kaon PID in the 3 prong filtering
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliAnalysisVertexingHF.h
CommitLineData
c4cdf105 1#ifndef ALIANALYSISVERTEXINGHF_H
2#define ALIANALYSISVERTEXINGHF_H
6a213b59 3/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
27de2dfb 6/* $Id$ */
7
6a213b59 8//-------------------------------------------------------------------------
9// Class AliAnalysisVertexingHF
10// Reconstruction of heavy-flavour decay candidates
11//
2ff20727 12// Origin: E.Bruna, G.E.Bruno, A.Dainese, F.Prino, R.Romita, X.M.Zhang
a25935a9 13// Contact: andrea.dainese@pd.infn.it
6a213b59 14//-------------------------------------------------------------------------
15
16#include <TNamed.h>
19ccb888 17#include <TList.h>
18
19#include "AliAnalysisFilter.h"
20#include "AliESDtrackCuts.h"
6a213b59 21
0602cf99 22class AliPIDResponse;
c4cdf105 23class AliESDVertex;
e0732246 24class AliAODRecoDecay;
c4cdf105 25class AliAODRecoDecayHF;
26class AliAODRecoDecayHF2Prong;
27class AliAODRecoDecayHF3Prong;
28class AliAODRecoDecayHF4Prong;
29class AliAODRecoCascadeHF;
30class AliAnalysisFilter;
939850df 31class AliRDHFCuts;
f3014dc3 32class AliRDHFCutsD0toKpi;
e3d40058 33class AliRDHFCutsJpsitoee;
34class AliRDHFCutsDplustoKpipi;
35class AliRDHFCutsDstoKKpi;
36class AliRDHFCutsLctopKpi;
a07ad8e0 37class AliRDHFCutsLctoV0;
e3d40058 38class AliRDHFCutsD0toKpipipi;
da6fefc3 39class AliRDHFCutsDStartoKpipi;
dcb444c9 40class AliESDtrack;
41class AliVEvent;
42class AliAODVertex;
c7d3975b 43class AliVertexerTracks;
a07ad8e0 44class AliESDv0;
45class AliAODv0;
dcb444c9 46
6a213b59 47//-----------------------------------------------------------------------------
48class AliAnalysisVertexingHF : public TNamed {
49 public:
50 //
51 AliAnalysisVertexingHF();
13977a79 52 AliAnalysisVertexingHF(const AliAnalysisVertexingHF& source);
53 AliAnalysisVertexingHF& operator=(const AliAnalysisVertexingHF& source);
6a213b59 54 virtual ~AliAnalysisVertexingHF();
55
dcb444c9 56 void FindCandidates(AliVEvent *event,
57 TClonesArray *aodVerticesHFTClArr,
58 TClonesArray *aodD0toKpiTClArr,
59 TClonesArray *aodJPSItoEleTClArr,
60 TClonesArray *aodCharm3ProngTClArr,
2ff20727 61 TClonesArray *aodCharm4ProngTClArr,
dc963de9 62 TClonesArray *aodDstarTClArr,
a07ad8e0 63 TClonesArray *aodCascadesTClArr,
423fb9ae 64 TClonesArray *aodLikeSign2ProngTClArr,
65 TClonesArray *aodLikeSign3ProngTClArr);
dcb444c9 66
a9b75906 67 TList* FillListOfCuts();
37fc73f1 68 void FixReferences(AliAODEvent *aod);
6a213b59 69 void PrintStatus() const;
b82f6d67 70 void SetSecVtxWithKF() { fSecVtxWithKF=kTRUE; }
6a213b59 71 void SetD0toKpiOn() { fD0toKpi=kTRUE; }
72 void SetD0toKpiOff() { fD0toKpi=kFALSE; }
73 void SetJPSItoEleOn() { fJPSItoEle=kTRUE; }
74 void SetJPSItoEleOff() { fJPSItoEle=kFALSE; }
75 void Set3ProngOn() { f3Prong=kTRUE; }
76 void Set3ProngOff() { f3Prong=kFALSE; }
77 void Set4ProngOn() { f4Prong=kTRUE; }
78 void Set4ProngOff() { f4Prong=kFALSE; }
2ff20727 79 void SetDstarOn() { fDstar=kTRUE; }
80 void SetDstarOff() { fDstar=kFALSE; }
a07ad8e0 81 void SetCascadesOn() { fCascades=kTRUE; }
82 void SetCascadesOff() { fCascades=kFALSE; }
dc963de9 83 void SetLikeSignOn() { fLikeSign=kTRUE; }
1992284a 84 void SetLikeSignOff() {fLikeSign=kFALSE; fLikeSign3prong=kFALSE;}
85 void SetLikeSign3prongOn() { fLikeSign=kTRUE; fLikeSign3prong=kTRUE; }
86 void SetLikeSign3prongOff() { fLikeSign3prong=kFALSE; }
a25935a9 87 void SetMixEventOn() { fMixEvent=kTRUE; }
88 void SetMixEventOff() { fMixEvent=kFALSE; }
89 void SetInputAOD() { fInputAOD=kTRUE; }
c4cdf105 90 Bool_t GetD0toKpi() const { return fD0toKpi; }
91 Bool_t GetJPSItoEle() const { return fJPSItoEle; }
92 Bool_t Get3Prong() const { return f3Prong; }
93 Bool_t Get4Prong() const { return f4Prong; }
94 Bool_t GetDstar() const { return fDstar; }
a07ad8e0 95 Bool_t GetCascades() const { return fCascades; }
c4cdf105 96 Bool_t GetLikeSign() const { return fLikeSign; }
1992284a 97 Bool_t GetLikeSign3prong() const { return fLikeSign3prong; }
c4cdf105 98 Bool_t GetMixEvent() const { return fMixEvent; }
99 Bool_t GetInputAOD() const { return fInputAOD; }
100 Bool_t GetRecoPrimVtxSkippingTrks() const {return fRecoPrimVtxSkippingTrks;}
101 Bool_t GetRmTrksFromPrimVtx() const {return fRmTrksFromPrimVtx;}
eee95e18 102 void SetFindVertexForDstar(Bool_t vtx=kTRUE) { fFindVertexForDstar=vtx; }
a07ad8e0 103 void SetFindVertexForCascades(Bool_t vtx=kTRUE) { fFindVertexForCascades=vtx; }
6a213b59 104 void SetRecoPrimVtxSkippingTrks()
105 { fRecoPrimVtxSkippingTrks=kTRUE; fRmTrksFromPrimVtx=kFALSE;}
a25935a9 106 void UnsetRecoPrimVtxSkippingTrks()
107 { fRecoPrimVtxSkippingTrks=kFALSE; fRmTrksFromPrimVtx=kFALSE;}
6a213b59 108 void SetRmTrksFromPrimVtx()
109 {fRmTrksFromPrimVtx=kTRUE; fRecoPrimVtxSkippingTrks=kFALSE; }
19ccb888 110 void SetTrackFilter(AliAnalysisFilter* trackF) {
111 // switch off the TOF selection that cannot be applied with AODTracks
112 TList *l = (TList*)trackF->GetCuts();
113 AliESDtrackCuts *tcuts = (AliESDtrackCuts*)l->FindObject("AliESDtrackCuts");
114 if(tcuts->GetFlagCutTOFdistance()) tcuts->SetFlagCutTOFdistance(kFALSE);
115 fTrackFilter = trackF;
116 }
c7d3975b 117 void SetTrackFilter2prongPbCentral(Float_t maxPercentile, AliAnalysisFilter* trackF) {
118 // switch off the TOF selection that cannot be applied with AODTracks
119 TList *l = (TList*)trackF->GetCuts();
120 AliESDtrackCuts *tcuts = (AliESDtrackCuts*)l->FindObject("AliESDtrackCuts");
121 if(tcuts->GetFlagCutTOFdistance()) tcuts->SetFlagCutTOFdistance(kFALSE);
122 fTrackFilter2prongCentral = trackF;
123 fMaxCentPercentileForTightCuts=maxPercentile;
124 }
125 void SetTrackFilter3prongPbCentral(Float_t maxPercentile, AliAnalysisFilter* trackF) {
126 // switch off the TOF selection that cannot be applied with AODTracks
127 TList *l = (TList*)trackF->GetCuts();
128 AliESDtrackCuts *tcuts = (AliESDtrackCuts*)l->FindObject("AliESDtrackCuts");
129 if(tcuts->GetFlagCutTOFdistance()) tcuts->SetFlagCutTOFdistance(kFALSE);
130 fTrackFilter3prongCentral = trackF;
131 fMaxCentPercentileForTightCuts=maxPercentile;
132 }
19ccb888 133 void SetTrackFilterSoftPi(AliAnalysisFilter* trackF) {
134 // switch off the TOF selection that cannot be applied with AODTracks
135 TList *l = (TList*)trackF->GetCuts();
136 AliESDtrackCuts *tcuts = (AliESDtrackCuts*)l->FindObject("AliESDtrackCuts");
137 if(tcuts->GetFlagCutTOFdistance()) tcuts->SetFlagCutTOFdistance(kFALSE);
138 fTrackFilterSoftPi = trackF;
139 }
dc963de9 140 AliAnalysisFilter* GetTrackFilter() const { return fTrackFilter; }
141 AliAnalysisFilter* GetTrackFilterSoftPi() const { return fTrackFilterSoftPi; }
f3014dc3 142 void SetCutsD0toKpi(AliRDHFCutsD0toKpi* cuts) { fCutsD0toKpi = cuts; }
143 AliRDHFCutsD0toKpi* GetCutsD0toKpi() const { return fCutsD0toKpi; }
e3d40058 144 void SetCutsJpsitoee(AliRDHFCutsJpsitoee* cuts) { fCutsJpsitoee = cuts; }
145 AliRDHFCutsJpsitoee* GetCutsJpsitoee() const { return fCutsJpsitoee; }
146 void SetCutsDplustoKpipi(AliRDHFCutsDplustoKpipi* cuts) { fCutsDplustoKpipi = cuts; }
147 AliRDHFCutsDplustoKpipi* GetCutsDplustoKpipi() const { return fCutsDplustoKpipi; }
148 void SetCutsDstoKKpi(AliRDHFCutsDstoKKpi* cuts) { fCutsDstoKKpi = cuts; }
149 AliRDHFCutsDstoKKpi* GetCutsDstoKKpi() const { return fCutsDstoKKpi; }
150 void SetCutsLctopKpi(AliRDHFCutsLctopKpi* cuts) { fCutsLctopKpi = cuts; }
151 AliRDHFCutsLctopKpi* GetCutsLctopKpi() const { return fCutsLctopKpi; }
a07ad8e0 152 void SetCutsLctoV0(AliRDHFCutsLctoV0* cuts) { fCutsLctoV0 = cuts; }
153 AliRDHFCutsLctoV0* GetCutsLctoV0() const { return fCutsLctoV0; }
e3d40058 154 void SetCutsD0toKpipipi(AliRDHFCutsD0toKpipipi* cuts) { fCutsD0toKpipipi = cuts; }
155 AliRDHFCutsD0toKpipipi* GetCutsD0toKpipipi() const { return fCutsD0toKpipipi; }
da6fefc3 156 void SetCutsDStartoKpipi(AliRDHFCutsDStartoKpipi* cuts) { fCutsDStartoKpipi = cuts; }
157 AliRDHFCutsDStartoKpipi* GetCutsDStartoKpipi() const { return fCutsDStartoKpipi; }
e0732246 158 void SetMassCutBeforeVertexing(Bool_t flag) { fMassCutBeforeVertexing=flag; }
6ea608bf 159
c7d3975b 160 void SetMasses();
0602cf99 161 void SetUseKaonPIDfor3Prong(Bool_t opt=kTRUE){fUseKaonPIDfor3Prong=opt;}
162 void SetnSigmaTOFforKaonSel(Double_t nsl, Double_t nsh){
163 fnSigmaTOFKaonLow=nsl; fnSigmaTOFKaonHi=nsh;}
164 void SetPidResponse(AliPIDResponse* p){fPidResponse=p;}
c7d3975b 165
6a213b59 166 //
167 private:
168 //
c7d3975b 169 enum { kBitDispl = 0, kBitSoftPi = 1, kBit3Prong = 2 };
2ff20727 170
dcb444c9 171 Bool_t fInputAOD; // input from AOD (kTRUE) or ESD (kFALSE)
c8ab4e4f 172 Int_t fAODMapSize; // size of fAODMap
173 Int_t *fAODMap; //[fAODMapSize] map between index and ID for AOD tracks
dcb444c9 174
c7d3975b 175 AliVertexerTracks* fVertexerTracks; // vertexer, to compute secondary vertices
b82f6d67 176 Double_t fBzkG; // z componenent of field in kG
177
178 Bool_t fSecVtxWithKF; // if kTRUE use KF vertexer, else AliVertexerTracks
179
6a213b59 180 Bool_t fRecoPrimVtxSkippingTrks; // flag for primary vertex reco on the fly
181 // for each candidate, w/o its daughters
182 Bool_t fRmTrksFromPrimVtx; // flag for fast removal of daughters from
183 // the primary vertex
184
185 AliESDVertex *fV1; // primary vertex
186
6a213b59 187 // flag to enable candidates production
2ff20727 188 Bool_t fD0toKpi; // D0->Kpi
189 Bool_t fJPSItoEle; // Jpsi->ee
190 Bool_t f3Prong; // D+,Ds,Lc
191 Bool_t f4Prong; // D0->Kpipipi
192 Bool_t fDstar; // D*->D0pi
a07ad8e0 193 Bool_t fCascades; // cascades, Lc --> v0+track
dc963de9 194 Bool_t fLikeSign; // Like-sign pairs
1992284a 195 Bool_t fLikeSign3prong; // Like-sign triplets
a25935a9 196 Bool_t fMixEvent; // event mixing
6a213b59 197
0602cf99 198 AliPIDResponse* fPidResponse; // PID response
199 Bool_t fUseKaonPIDfor3Prong; // Kaon PID usage flag
200 Double_t fnSigmaTOFKaonLow; //Low cut value on number of sigmas for TOF PID
201 Double_t fnSigmaTOFKaonHi; //High cut value on number of sigmas for TOF PID
202
c7d3975b 203 Float_t fMaxCentPercentileForTightCuts; //max. centrality percentile for using tight cuts
204
6a213b59 205 // single-track cuts
2ff20727 206 AliAnalysisFilter *fTrackFilter; // Track Filter for displaced vertices
c7d3975b 207 AliAnalysisFilter *fTrackFilter2prongCentral; // Track Filter for displaced vertices in PbPb central events (tighter cuts) for 2 prong (D0->Kpi)
208 AliAnalysisFilter *fTrackFilter3prongCentral; // Track Filter for displaced vertices in PbPb central events (tighter cuts) for 3 prong (D+, Ds, Lc)
2ff20727 209 AliAnalysisFilter *fTrackFilterSoftPi; // Track Filter for D* soft pion
6a213b59 210 // candidates cuts
f3014dc3 211 AliRDHFCutsD0toKpi *fCutsD0toKpi; // D0->Kpi cuts
e3d40058 212 AliRDHFCutsJpsitoee *fCutsJpsitoee; // J/psi->ee cuts
213 AliRDHFCutsDplustoKpipi *fCutsDplustoKpipi; // D+->Kpipi cuts
214 AliRDHFCutsDstoKKpi *fCutsDstoKKpi; // Ds->KKpi cuts
215 AliRDHFCutsLctopKpi *fCutsLctopKpi; // Lc->pKpi cuts
a07ad8e0 216 AliRDHFCutsLctoV0 *fCutsLctoV0; // Lc --> v0 + bachelor cuts
e3d40058 217 AliRDHFCutsD0toKpipipi *fCutsD0toKpipipi; // D0->Kpipipi cuts
da6fefc3 218 AliRDHFCutsDStartoKpipi *fCutsDStartoKpipi; // Dstar->D0pi cuts
f3014dc3 219
a9b75906 220 TList *fListOfCuts; // pointer to list of cuts for output file
eee95e18 221 Bool_t fFindVertexForDstar; // reconstruct a secondary vertex or assume it's from the primary vertex
a07ad8e0 222 Bool_t fFindVertexForCascades; // reconstruct a secondary vertex or assume it's from the primary vertex
e0732246 223 Bool_t fMassCutBeforeVertexing; // to go faster in PbPb
224 // dummies for invariant mass calculation
225 AliAODRecoDecay *fMassCalc2; // for 2 prong
226 AliAODRecoDecay *fMassCalc3; // for 3 prong
227 AliAODRecoDecay *fMassCalc4; // for 4 prong
c7d3975b 228 Bool_t fOKInvMassD0; // pair fullfilling D0 inv mass selection
229 Bool_t fOKInvMassJpsi; // pair fullfilling Jpsi inv mass selection
230 Bool_t fOKInvMassDplus; // triplet fullfilling D+ inv mass selection
231 Bool_t fOKInvMassDs; // triplet fullfilling Ds inv mass selection
232 Bool_t fOKInvMassLc; // triplet fullfilling Lc inv mass selection
233 Bool_t fOKInvMassDstar; // combination fullfilling D* inv mass selection
234 Bool_t fOKInvMassD0to4p; // 4tracks fullfilling D0 inv mass selection
235 Bool_t fOKInvMassLctoV0; // triplet fullfilling Lc inv mass selection
5e938293 236
237 Int_t fnTrksTotal;
238 Int_t fnSeleTrksTotal;
239
c7d3975b 240 Double_t fMassDzero;
241 Double_t fMassDplus;
242 Double_t fMassDs;
243 Double_t fMassLambdaC;
244 Double_t fMassDstar;
245 Double_t fMassJpsi;
246
247
6a213b59 248 //
a9b75906 249 void AddRefs(AliAODVertex *v,AliAODRecoDecayHF *rd,const AliVEvent *event,
250 const TObjArray *trkArray) const;
c4cdf105 251 void AddDaughterRefs(AliAODVertex *v,const AliVEvent *event,
252 const TObjArray *trkArray) const;
dcb444c9 253 AliAODRecoDecayHF2Prong* Make2Prong(TObjArray *twoTrackArray1,AliVEvent *event,
254 AliAODVertex *secVert,Double_t dcap1n1,
c7d3975b 255 Bool_t &okD0,Bool_t &okJPSI,Bool_t &okD0fromDstar);
dcb444c9 256 AliAODRecoDecayHF3Prong* Make3Prong(TObjArray *threeTrackArray,AliVEvent *event,
257 AliAODVertex *secVert,
258 Double_t dispersion,
c4cdf105 259 const AliAODVertex *vertexp1n1,
260 const AliAODVertex *vertexp2n1,
dcb444c9 261 Double_t dcap1n1,Double_t dcap2n1,Double_t dcap1p2,
c7d3975b 262 Bool_t &ok3Prong);
dcb444c9 263 AliAODRecoDecayHF4Prong* Make4Prong(TObjArray *fourTrackArray,AliVEvent *event,
721c0b8f 264 AliAODVertex *secVert,
c4cdf105 265 const AliAODVertex *vertexp1n1,
266 const AliAODVertex *vertexp1n1p2,
721c0b8f 267 Double_t dcap1n1,Double_t dcap1n2,
268 Double_t dcap2n1,Double_t dcap2n2,
c7d3975b 269 Bool_t &ok4Prong);
2ff20727 270 AliAODRecoCascadeHF* MakeCascade(TObjArray *twoTrackArray,AliVEvent *event,
271 AliAODVertex *secVert,
272 AliAODRecoDecayHF2Prong *rd2Prong,
273 Double_t dca,
c7d3975b 274 Bool_t &okDstar);
a07ad8e0 275 AliAODRecoCascadeHF* MakeCascade(TObjArray *twoTrackArray,AliVEvent *event,
276 AliAODVertex *secVert,
277 AliAODv0 *v0,
278 Double_t dca,
c7d3975b 279 Bool_t &okCascades);
dcb444c9 280
c4cdf105 281 AliAODVertex* PrimaryVertex(const TObjArray *trkArray=0x0,AliVEvent *event=0x0) const;
dcfa35b3 282 AliAODVertex* ReconstructSecondaryVertex(TObjArray *trkArray,Double_t &dispersion,Bool_t useTRefArray=kTRUE) const;
c7d3975b 283
284 Bool_t SelectInvMassAndPt3prong(Double_t *px,Double_t *py,Double_t *pz);
285 Bool_t SelectInvMassAndPt4prong(Double_t *px,Double_t *py,Double_t *pz);
286 Bool_t SelectInvMassAndPtD0Kpi(Double_t *px,Double_t *py,Double_t *pz);
287 Bool_t SelectInvMassAndPtJpsiee(Double_t *px,Double_t *py,Double_t *pz);
288 Bool_t SelectInvMassAndPtDstarD0pi(Double_t *px,Double_t *py,Double_t *pz);
289 Bool_t SelectInvMassAndPtCascade(Double_t *px,Double_t *py,Double_t *pz);
290
291 Bool_t SelectInvMassAndPt3prong(TObjArray *trkArray);
292 Bool_t SelectInvMassAndPt4prong(TObjArray *trkArray);
293 Bool_t SelectInvMassAndPtDstarD0pi(TObjArray *trkArray);
294
e11ae259 295 void SelectTracksAndCopyVertex(const AliVEvent *event,Int_t trkEntries,
1992284a 296 TObjArray &seleTrksArray,
297 TObjArray &tracksAtVertex,
298 Int_t &nSeleTrks,
a25935a9 299 UChar_t *seleFlags,Int_t *evtNumber);
c3379416 300 void SetParametersAtVertex(AliESDtrack* esdt, const AliExternalTrackParam* extpar) const;
1992284a 301
c7d3975b 302 Bool_t SingleTrkCuts(AliESDtrack *trk,Float_t centralityperc, Bool_t &okDisplaced,Bool_t &okSoftPi, Bool_t &ok3prong) const;
a07ad8e0 303
c20e04a0 304 void SetSelectionBitForPID(AliRDHFCuts *cuts,AliAODRecoDecayHF *rd,Int_t bit);
939850df 305
a07ad8e0 306 AliAODv0* TransformESDv0toAODv0(AliESDv0 *esdv0,
307 TObjArray *twoTrackArrayV0);
308
6a213b59 309 //
0602cf99 310 ClassDef(AliAnalysisVertexingHF,21); // Reconstruction of HF decay candidates
6a213b59 311};
312
313
314#endif
315
316
317
318
319
320
321
322