]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/vertexingHF/AliRDHFCutsDstoKKpi.cxx
Add selection on track filter mask in D meson tasks
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliRDHFCutsDstoKKpi.cxx
CommitLineData
e3d40058 1/**************************************************************************
2 * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
27de2dfb 16/* $Id$ */
17
e3d40058 18/////////////////////////////////////////////////////////////
19//
20// Class for cuts on AOD reconstructed Ds->KKpi
21//
22// Author: A.Dainese, andrea.dainese@pd.infn.it
23/////////////////////////////////////////////////////////////
24
25#include <TDatabasePDG.h>
26#include <Riostream.h>
27
28#include "AliRDHFCutsDstoKKpi.h"
29#include "AliAODRecoDecayHF3Prong.h"
30#include "AliAODTrack.h"
31#include "AliESDtrack.h"
32
33ClassImp(AliRDHFCutsDstoKKpi)
34
35//--------------------------------------------------------------------------
a9b75906 36AliRDHFCutsDstoKKpi::AliRDHFCutsDstoKKpi(const char* name) :
fba41fa4 37AliRDHFCuts(name),
38fPidOption(0)
e3d40058 39{
40 //
41 // Default Constructor
42 //
2e153422 43 Int_t nvars=16;
e3d40058 44 SetNVars(nvars);
2e153422 45 TString varNames[16]={"inv. mass [GeV]",
4755453e 46 "pTK [GeV/c]",
47 "pTPi [GeV/c]",
48 "d0K [cm]",
49 "d0Pi [cm]",
50 "dist12 [cm]",
51 "sigmavert [cm]",
52 "decLen [cm]",
53 "ptMax [GeV/c]",
54 "cosThetaPoint",
55 "Sum d0^2 (cm^2)",
56 "dca [cm]",
57 "inv. mass (Mphi-MKK) [GeV]",
2e153422 58 "inv. mass (MKo*-MKpi) [GeV]",
59 "Abs(CosineKpiPhiRFrame)^3",
60 "CosPiDsLabFrame"};
61
62 Bool_t isUpperCut[16]={kTRUE,
4755453e 63 kFALSE,
64 kFALSE,
65 kFALSE,
66 kFALSE,
67 kFALSE,
68 kTRUE,
69 kFALSE,
70 kFALSE,
71 kFALSE,
72 kFALSE,
73 kTRUE,
74 kTRUE,
2e153422 75 kTRUE,
76 kFALSE,
4755453e 77 kTRUE};
2e153422 78 SetVarNames(16,varNames,isUpperCut);
79 Bool_t forOpt[16]={kFALSE,
4755453e 80 kFALSE,
e3d40058 81 kFALSE,
82 kFALSE,
83 kFALSE,
84 kFALSE,
85 kTRUE,
4755453e 86 kTRUE,
87 kTRUE,
88 kTRUE,
89 kTRUE,
90 kFALSE,
91 kTRUE,
2e153422 92 kTRUE,
93 kFALSE,
94 kFALSE};
4755453e 95 SetVarsForOpt(7,forOpt);
e3d40058 96 Float_t limits[2]={0,999999999.};
97 SetPtBins(2,limits);
3787d195 98 if(fPidHF)delete fPidHF;
99 fPidHF=new AliAODPidHF();
100 Double_t plim[2]={0.6,0.8};
101 Double_t nsigma[5]={2.,1.,2.,3.,0.};
102
103 fPidHF->SetPLimit(plim);
104 fPidHF->SetAsym(kTRUE);
105 fPidHF->SetSigma(nsigma);
106 fPidHF->SetMatch(1);
107 fPidHF->SetTPC(1);
108 fPidHF->SetTOF(1);
109 fPidHF->SetITS(0);
110 fPidHF->SetTRD(0);
111 fPidHF->SetCompat(kTRUE);
112
e3d40058 113}
114//--------------------------------------------------------------------------
115AliRDHFCutsDstoKKpi::AliRDHFCutsDstoKKpi(const AliRDHFCutsDstoKKpi &source) :
fba41fa4 116 AliRDHFCuts(source),
117 fPidOption(source.fPidOption)
e3d40058 118{
119 //
120 // Copy constructor
121 //
122
123}
124//--------------------------------------------------------------------------
125AliRDHFCutsDstoKKpi &AliRDHFCutsDstoKKpi::operator=(const AliRDHFCutsDstoKKpi &source)
126{
127 //
128 // assignment operator
129 //
130 if(&source == this) return *this;
131
132 AliRDHFCuts::operator=(source);
133
134 return *this;
135}
136
137
138//---------------------------------------------------------------------------
a6003e0a 139void AliRDHFCutsDstoKKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters,AliAODEvent *aod) {
e3d40058 140 //
141 // Fills in vars the values of the variables
142 //
143
144 if(nvars!=fnVarsForOpt) {
145 printf("AliRDHFCutsDstoKKpi::GetCutsVarsForOpt: wrong number of variables\n");
146 return;
147 }
148
149 AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
a6003e0a 150
151 //recalculate vertex w/o daughters
152 Bool_t cleanvtx=kFALSE;
153 AliAODVertex *origownvtx=0x0;
154 if(fRemoveDaughtersFromPrimary) {
155 if(dd->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*dd->GetOwnPrimaryVtx());
156 cleanvtx=kTRUE;
157 if(!RecalcOwnPrimaryVtx(dd,aod)) {
158 CleanOwnPrimaryVtx(dd,aod,origownvtx);
159 cleanvtx=kFALSE;
160 }
161 }
162
4755453e 163 Int_t iter=-1;
164 if(fVarsForOpt[0]){
165 iter++;
0b4625fa 166 if(TMath::Abs(pdgdaughters[0])==321){
4755453e 167 vars[iter]=dd->InvMassDsKKpi();
168 }else{
169 vars[iter]=dd->InvMassDspiKK();
170 }
171 }
172 if(fVarsForOpt[1]){
173 iter++;
174 Float_t minPtDau=99999.;
175 for(Int_t iprong=0;iprong<3;iprong++){
176 if(TMath::Abs(pdgdaughters[iprong])==321 &&
177 dd->PtProng(iprong)<minPtDau) minPtDau=dd->PtProng(iprong);
178 }
179 vars[iter]=minPtDau;
180 }
181 if(fVarsForOpt[2]){
182 iter++;
183 for(Int_t iprong=0;iprong<3;iprong++){
184 if(TMath::Abs(pdgdaughters[iprong])==211) {
185 vars[iter]=dd->PtProng(iprong);
186 }
187 }
188 }
189 if(fVarsForOpt[3]){
190 iter++;
191 Float_t minImpParDau=99999.;
192 for(Int_t iprong=0;iprong<3;iprong++){
193 if(TMath::Abs(pdgdaughters[iprong])==321 &&
194 dd->Getd0Prong(iprong)<minImpParDau) minImpParDau=dd->Getd0Prong(iprong);
195 }
196 vars[iter]=minImpParDau;
197 }
198 if(fVarsForOpt[4]){
199 iter++;
200 for(Int_t iprong=0;iprong<3;iprong++){
201 if(TMath::Abs(pdgdaughters[iprong])==211) {
202 vars[iter]=dd->Getd0Prong(iprong);
203 }
204 }
205 }
206 if(fVarsForOpt[5]){
207 iter++;
208 Float_t minDistPair=TMath::Min(dd->GetDist12toPrim(),dd->GetDist23toPrim());
209 vars[iter]=minDistPair;
210 }
211 if(fVarsForOpt[6]){
212 iter++;
213 vars[iter]=dd->GetSigmaVert();
214 }
215 if(fVarsForOpt[7]){
216 iter++;
217 vars[iter] = dd->DecayLength();
218 }
219 if(fVarsForOpt[8]){
220 iter++;
221 Float_t ptmax=0;
222 for(Int_t i=0;i<3;i++){
223 if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
224 }
225 vars[iter]=ptmax;
226 }
227 if(fVarsForOpt[9]){
228 iter++;
229 vars[iter]=dd->CosPointingAngle();
230 }
231 if(fVarsForOpt[10]){
232 iter++;
233 vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
234 }
235 if(fVarsForOpt[11]){
236 iter++;
237 Float_t maxDCA=0.;
238 for(Int_t i=0;i<3;i++){
239 if(d->GetDCA(i)>maxDCA) maxDCA=d->GetDCA(i);
240 }
241 vars[iter]=maxDCA;
242 }
243 if(fVarsForOpt[12]){
244 iter++;
2c3decce 245 Double_t mPDGPhi = TDatabasePDG::Instance()->GetParticle(333)->Mass();
0b4625fa 246 if(TMath::Abs(pdgdaughters[0])==321){
2c3decce 247
248 Double_t phimass01=d->InvMass2Prongs(0,1,321,321);
249 vars[iter]=TMath::Abs(phimass01-mPDGPhi);
250 // vars[iter]=dd->InvMass2Prongs(0,1,321,321);
4755453e 251 }else{
2c3decce 252 Double_t phimass12=d->InvMass2Prongs(1,2,321,321);
253 vars[iter]=TMath::Abs(phimass12-mPDGPhi);
254 // vars[iter]=dd->InvMass2Prongs(1,2,321,321);
4755453e 255 }
256 }
257 if(fVarsForOpt[13]){
258 iter++;
2c3decce 259 Double_t mPDGK0star = TDatabasePDG::Instance()->GetParticle(313)->Mass();
0b4625fa 260 if(TMath::Abs(pdgdaughters[0])==321){
2c3decce 261
262 Double_t mass12kpi=d->InvMass2Prongs(1,2,321,211);
263 vars[iter]=TMath::Abs(mass12kpi-mPDGK0star);
264 // vars[iter]=dd->InvMass2Prongs(1,2,321,211);
4755453e 265 }else{
2c3decce 266 Double_t mass01pik=d->InvMass2Prongs(0,1,211,321);
267 vars[iter]=TMath::Abs(mass01pik-mPDGK0star);
268 // vars[iter]=dd->InvMass2Prongs(0,1,211,321);
4755453e 269 }
270 }
2e153422 271 if(fVarsForOpt[14]){
272 iter++;
273 if(TMath::Abs(pdgdaughters[0])==321){
274 vars[iter]=dd->CosPiKPhiRFrameKKpi();
275 }else{
276 vars[iter]=dd->CosPiKPhiRFramepiKK();
277 }
278 }
279 if(fVarsForOpt[15]){
280 iter++;
281 if(TMath::Abs(pdgdaughters[0])==321){
282 vars[iter]=dd->CosPiDsLabFrameKKpi();
283 }else{
284 vars[iter]=dd->CosPiDsLabFramepiKK();
285 }
286 }
a6003e0a 287
288 if(cleanvtx)CleanOwnPrimaryVtx(dd,aod,origownvtx);
e3d40058 289 return;
290}
3787d195 291//---------------------------------------------------------------------------
292Bool_t AliRDHFCutsDstoKKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
293{
294 //
295 // Checking if Ds is in fiducial acceptance region
296 //
297
298 if(pt > 5.) {
299 // applying cut for pt > 5 GeV
300 AliDebug(2,Form("pt of Ds = %f (> 5), cutting at |y| < 0.8",pt));
301 if (TMath::Abs(y) > 0.8) return kFALSE;
302
303 } else {
304 // appliying smooth cut for pt < 5 GeV
305 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
306 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
307 AliDebug(2,Form("pt of Ds = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
308 if (y < minFiducialY || y > maxFiducialY) return kFALSE;
309 }
310
311 return kTRUE;
312}
313
45ab4739 314//---------------------------------------------------------------------------
315Int_t AliRDHFCutsDstoKKpi::IsSelectedPID(AliAODRecoDecayHF *rd) {
316 // PID selection
317 // return values: 0->NOT OK, 1->OK as KKpi, 2->OK as piKK, 3->OK as both
318 Int_t retCode=3;
319 Bool_t okKKpi=kTRUE;
320 Bool_t okpiKK=kTRUE;
321 if(!fUsePID || !rd) return retCode;
322 if(!fPidHF){
323 AliWarning("AliAODPidHF not created!");
324 return retCode;
325 }
fba41fa4 326
327 Double_t origCompatTOF=fPidHF->GetPCompatTOF();
328 Double_t origThreshTPC=fPidHF->GetPtThresholdTPC();
329 if(fPidOption==kStrong){
330 fPidHF->SetPCompatTOF(999999.);
331 fPidHF->SetPtThresholdTPC(999999.);
332 }
333
334
45ab4739 335 Int_t nKaons=0;
336 Int_t nNotKaons=0;
337 Int_t sign= rd->GetCharge();
338 for(Int_t iDaught=0; iDaught<3; iDaught++){
339 AliAODTrack *track=(AliAODTrack*)rd->GetDaughter(iDaught);
340 Int_t isPion=fPidHF->MakeRawPid(track,AliPID::kPion);
341 Int_t isKaon=fPidHF->MakeRawPid(track,AliPID::kKaon);
342 Int_t isProton=fPidHF->MakeRawPid(track,AliPID::kProton);
343
fba41fa4 344 if(isProton>0 && isKaon<0 && isPion<0){
345 fPidHF->SetPCompatTOF(origCompatTOF);
346 fPidHF->SetPtThresholdTPC(origThreshTPC);
347 return 0;
348 }
45ab4739 349 if(sign!=track->Charge()){// must be kaon
fba41fa4 350 if(isKaon<0){
351 fPidHF->SetPCompatTOF(origCompatTOF);
352 fPidHF->SetPtThresholdTPC(origThreshTPC);
353 return 0;
354 }
355 if(fPidOption==kStrong && isKaon<=0){
356 fPidHF->SetPCompatTOF(origCompatTOF);
357 fPidHF->SetPtThresholdTPC(origThreshTPC);
358 return 0;
359 }
45ab4739 360 }
361 if(isKaon>0 && isPion<0) nKaons++;
362 if(isKaon<0) nNotKaons++;
363 if(iDaught==0){
364 if(isKaon<0) okKKpi=kFALSE;
fba41fa4 365 if(isPion<0) okpiKK=kFALSE;
366 if(fPidOption==kStrong){
367 if(isKaon<=0) okKKpi=kFALSE;
368 if(isPion<=0) okpiKK=kFALSE;
369 }
45ab4739 370 }
371 else if(iDaught==2){
372 if(isKaon<0) okpiKK=kFALSE;
373 if(isPion<0) okKKpi=kFALSE;
fba41fa4 374 if(fPidOption==kStrong){
375 if(isKaon<=0) okpiKK=kFALSE;
376 if(isPion<=0) okKKpi=kFALSE;
377 }
45ab4739 378 }
379 }
fba41fa4 380
381 fPidHF->SetPCompatTOF(origCompatTOF);
382 fPidHF->SetPtThresholdTPC(origThreshTPC);
45ab4739 383
384 if(nKaons>2)return 0;
385 if(nNotKaons>1) return 0;
386
387 if(!okKKpi) retCode-=1;
388 if(!okpiKK) retCode-=2;
389
390 return retCode;
391}
392
e3d40058 393//---------------------------------------------------------------------------
3787d195 394Int_t AliRDHFCutsDstoKKpi::IsSelected(TObject* obj,Int_t selectionLevel, AliAODEvent* aod) {
e3d40058 395 //
396 // Apply selection
397 //
398
399 if(!fCutsRD){
a5b9e447 400 cout<<"Cut matrix not inizialized. Exit..."<<endl;
e3d40058 401 return 0;
402 }
403 //PrintAll();
404 AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
405
406 if(!d){
407 cout<<"AliAODRecoDecayHF3Prong null"<<endl;
408 return 0;
409 }
fba41fa4 410
5e938293 411 if(fKeepSignalMC) if(IsSignalMC(d,aod,431)) return 3;
fba41fa4 412
51dc3cab 413 Double_t ptD=d->Pt();
414 if(ptD<fMinPtCand) return 0;
415 if(ptD>fMaxPtCand) return 0;
e3d40058 416
ba27eecd 417 if(d->HasBadDaughters()) return 0;
418
419
e3d40058 420 // selection on daughter tracks
421 if(selectionLevel==AliRDHFCuts::kAll ||
422 selectionLevel==AliRDHFCuts::kTracks) {
423 if(!AreDaughtersSelected(d)) return 0;
424 }
425
426
e3d40058 427
45ab4739 428
e3d40058 429 // selection on candidate
430 if(selectionLevel==AliRDHFCuts::kAll ||
431 selectionLevel==AliRDHFCuts::kCandidate) {
3787d195 432 //recalculate vertex w/o daughters
433 AliAODVertex *origownvtx=0x0;
3787d195 434 if(fRemoveDaughtersFromPrimary) {
793fdbec 435 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
436 if(!RecalcOwnPrimaryVtx(d,aod)) {
437 CleanOwnPrimaryVtx(d,aod,origownvtx);
438 return 0;
439 }
3787d195 440 }
e3d40058 441
4755453e 442 Int_t okDsKKpi=1;
443 Int_t okDspiKK=1;
0b4625fa 444 Int_t okMassPhiKKpi=0;
445 Int_t okMassPhipiKK=0;
446 Int_t okMassK0starKKpi=0;
447 Int_t okMassK0starpiKK=0;
448 Int_t okDsPhiKKpi=0;
449 Int_t okDsPhipiKK=0;
450 Int_t okDsK0starKKpi=0;
451 Int_t okDsK0starpiKK=0;
e3d40058 452
4755453e 453 Double_t pt=d->Pt();
454 Int_t ptbin=PtBin(pt);
a5b9e447 455 if (ptbin==-1) {
793fdbec 456 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 457 return 0;
458 }
459
4755453e 460 Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
461 Double_t mDsKKpi=d->InvMassDsKKpi();
462 Double_t mDspiKK=d->InvMassDspiKK();
463 if(TMath::Abs(mDsKKpi-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDsKKpi = 0;
464 if(TMath::Abs(mDspiKK-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDspiKK = 0;
a5b9e447 465 if(!okDsKKpi && !okDspiKK){
793fdbec 466 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 467 return 0;
4755453e 468 }
a5b9e447 469
470
4755453e 471
472 // cuts on resonant decays (via Phi or K0*)
473 Double_t mPhiPDG = TDatabasePDG::Instance()->GetParticle(333)->Mass();
474 Double_t mK0starPDG = TDatabasePDG::Instance()->GetParticle(313)->Mass();
475 if(okDsKKpi){
476 Double_t mass01phi=d->InvMass2Prongs(0,1,321,321);
477 Double_t mass12K0s=d->InvMass2Prongs(1,2,321,211);
0b4625fa 478 if(TMath::Abs(mass01phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhiKKpi=1;
479 if(TMath::Abs(mass12K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0starKKpi = 1;
480 if(!okMassPhiKKpi && !okMassK0starKKpi) okDsKKpi=0;
481 if(okMassPhiKKpi) okDsPhiKKpi=1;
482 if(okMassK0starKKpi) okDsK0starKKpi=1;
4755453e 483 }
484 if(okDspiKK){
485 Double_t mass01K0s=d->InvMass2Prongs(0,1,211,321);
486 Double_t mass12phi=d->InvMass2Prongs(1,2,321,321);
0b4625fa 487 if(TMath::Abs(mass01K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0starpiKK = 1;
488 if(TMath::Abs(mass12phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhipiKK=1;
489 if(!okMassPhipiKK && !okMassK0starpiKK) okDspiKK=0;
490 if(okMassPhipiKK) okDsPhipiKK=1;
491 if(okMassK0starpiKK) okDsK0starpiKK=1;
4755453e 492 }
a5b9e447 493 if(!okDsKKpi && !okDspiKK){
793fdbec 494 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 495 return 0;
496 }
4755453e 497
498 // Cuts on track pairs
a5b9e447 499 for(Int_t i=0;i<3;i++){
500 if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]){
793fdbec 501 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 502 return 0;
503 }
504 }
4755453e 505 if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)] ||
a5b9e447 506 d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]){
793fdbec 507 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 508 return 0;
509 }
510
4755453e 511
512
a5b9e447 513 //single track
514 if(TMath::Abs(d->Pt2Prong(1)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
515 TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]){
793fdbec 516 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 517 return 0;
518 }
519
520 if(okDsKKpi){
521 if(TMath::Abs(d->Pt2Prong(0)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
522 TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDsKKpi=0;
523 if(TMath::Abs(d->Pt2Prong(2)) < fCutsRD[GetGlobalIndex(2,ptbin)]*fCutsRD[GetGlobalIndex(2,ptbin)] ||
524 TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDsKKpi=0;
525 }
526 if(okDspiKK){
527 if(TMath::Abs(d->Pt2Prong(0)) < fCutsRD[GetGlobalIndex(2,ptbin)]*fCutsRD[GetGlobalIndex(2,ptbin)] ||
528 TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDspiKK=0;
529 if(TMath::Abs(d->Pt2Prong(2)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
530 TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDspiKK=0;
531 }
532 if(!okDsKKpi && !okDspiKK){
793fdbec 533 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 534 return 0;
535 }
0b4625fa 536
4755453e 537 // Cuts on candidate triplet
a5b9e447 538
539 if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)]){
793fdbec 540 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 541 return 0;
542 }
543
544 if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)]){
793fdbec 545 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 546 return 0;
547 }
548
549 if(d->Pt2Prong(0)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)] &&
550 d->Pt2Prong(1)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)] &&
551 d->Pt2Prong(2)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)]) {
793fdbec 552 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 553 return 0;
554 }
555
556 if(d->DecayLength2()<fCutsRD[GetGlobalIndex(7,ptbin)]*fCutsRD[GetGlobalIndex(7,ptbin)]){
793fdbec 557 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 558 return 0;
559 }
560
561
4755453e 562 Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
a5b9e447 563 if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)]){
793fdbec 564 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 565 return 0;
566 }
3787d195 567
981b4d38 568
2e153422 569 if(okDsKKpi){
570 Double_t cosPiKPhiRFKKpi=d->CosPiKPhiRFrameKKpi();
571 Double_t kincutPiKPhiKKpi=TMath::Abs(cosPiKPhiRFKKpi*cosPiKPhiRFKKpi*cosPiKPhiRFKKpi);
572 if(kincutPiKPhiKKpi<fCutsRD[GetGlobalIndex(14,ptbin)]) okDsKKpi=0;
573 }
574 if(okDspiKK){
575 Double_t cosPiKPhiRFpiKK=d->CosPiKPhiRFramepiKK();
576 Double_t kincutPiKPhipiKK=TMath::Abs(cosPiKPhiRFpiKK*cosPiKPhiRFpiKK*cosPiKPhiRFpiKK);
577 if(kincutPiKPhipiKK<fCutsRD[GetGlobalIndex(14,ptbin)]) okDspiKK=0;
578 }
579 if(!okDsKKpi && !okDspiKK){
580 CleanOwnPrimaryVtx(d,aod,origownvtx);
581 return 0;
582 }
583
584
585
586 if(okDsKKpi){
587 Double_t cosPiDsLabFrameKKpi=d->CosPiDsLabFrameKKpi();
94a69908 588 if(cosPiDsLabFrameKKpi>fCutsRD[GetGlobalIndex(15,ptbin)]) okDsKKpi=0;
2e153422 589 }
590 if(okDspiKK){
591 Double_t cosPiDsLabFramepiKK=d->CosPiDsLabFramepiKK();
94a69908 592 if(cosPiDsLabFramepiKK>fCutsRD[GetGlobalIndex(15,ptbin)]) okDspiKK=0;
2e153422 593 }
594 if(!okDsKKpi && !okDspiKK){
595 CleanOwnPrimaryVtx(d,aod,origownvtx);
596 return 0;
597 }
598
981b4d38 599 // unset recalculated primary vertex when not needed any more
600 CleanOwnPrimaryVtx(d,aod,origownvtx);
601
2e153422 602
a5b9e447 603
0b4625fa 604 if(!okDsKKpi){
605 okDsPhiKKpi=0;
606 okDsK0starKKpi=0;
607 }
608 if(!okDspiKK){
609 okDsPhipiKK=0;
610 okDsK0starpiKK=0;
611 }
612
a5b9e447 613 // PID selection
614 Int_t returnvaluePID=3;
615 if(selectionLevel==AliRDHFCuts::kAll ||
616 selectionLevel==AliRDHFCuts::kCandidate ||
617 selectionLevel==AliRDHFCuts::kPID) {
618 returnvaluePID = IsSelectedPID(d);
619 fIsSelectedPID=returnvaluePID;
620 }
621 if(returnvaluePID==0)return 0;
622
623 Bool_t okPidDsKKpi=returnvaluePID&1;
624 Bool_t okPidDspiKK=returnvaluePID&2;
0b4625fa 625 if(!okPidDsKKpi){
626 okDsPhiKKpi=0;
627 okDsK0starKKpi=0;
628 }
629 if(!okPidDspiKK){
630 okDsPhipiKK=0;
631 okDsK0starpiKK=0;
632 }
633
028e5f2c 634 if((okPidDsKKpi && okDsKKpi)||(okPidDspiKK && okDspiKK)){
635 Int_t returnvalue=0;
636 if(okDsKKpi) returnvalue+=1;
637 if(okDspiKK) returnvalue+=2;
0b4625fa 638 if(okDsPhiKKpi) returnvalue+=4;
639 if(okDsPhipiKK) returnvalue+=8;
640 if(okDsK0starKKpi) returnvalue+=16;
641 if(okDsK0starpiKK) returnvalue+=32;
028e5f2c 642 return returnvalue;
643 }else{
644 return 0;
645 }
4755453e 646 }
a5b9e447 647 return 15;
e3d40058 648
649}
650//---------------------------------------------------------------------------