]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/vertexingHF/AliRDHFCutsDstoKKpi.cxx
Possibility to get detailed PID output for Ds (Gian Michele
[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
e9c7c900 134 fPidOption=source.fPidOption;
135
e3d40058 136 return *this;
137}
138
139
140//---------------------------------------------------------------------------
a6003e0a 141void AliRDHFCutsDstoKKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters,AliAODEvent *aod) {
e3d40058 142 //
143 // Fills in vars the values of the variables
144 //
145
146 if(nvars!=fnVarsForOpt) {
147 printf("AliRDHFCutsDstoKKpi::GetCutsVarsForOpt: wrong number of variables\n");
148 return;
149 }
150
151 AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
a6003e0a 152
153 //recalculate vertex w/o daughters
154 Bool_t cleanvtx=kFALSE;
155 AliAODVertex *origownvtx=0x0;
156 if(fRemoveDaughtersFromPrimary) {
157 if(dd->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*dd->GetOwnPrimaryVtx());
158 cleanvtx=kTRUE;
159 if(!RecalcOwnPrimaryVtx(dd,aod)) {
160 CleanOwnPrimaryVtx(dd,aod,origownvtx);
161 cleanvtx=kFALSE;
162 }
163 }
164
4755453e 165 Int_t iter=-1;
166 if(fVarsForOpt[0]){
167 iter++;
0b4625fa 168 if(TMath::Abs(pdgdaughters[0])==321){
4755453e 169 vars[iter]=dd->InvMassDsKKpi();
170 }else{
171 vars[iter]=dd->InvMassDspiKK();
172 }
173 }
174 if(fVarsForOpt[1]){
175 iter++;
176 Float_t minPtDau=99999.;
177 for(Int_t iprong=0;iprong<3;iprong++){
178 if(TMath::Abs(pdgdaughters[iprong])==321 &&
179 dd->PtProng(iprong)<minPtDau) minPtDau=dd->PtProng(iprong);
180 }
181 vars[iter]=minPtDau;
182 }
183 if(fVarsForOpt[2]){
184 iter++;
185 for(Int_t iprong=0;iprong<3;iprong++){
186 if(TMath::Abs(pdgdaughters[iprong])==211) {
187 vars[iter]=dd->PtProng(iprong);
188 }
189 }
190 }
191 if(fVarsForOpt[3]){
192 iter++;
193 Float_t minImpParDau=99999.;
194 for(Int_t iprong=0;iprong<3;iprong++){
195 if(TMath::Abs(pdgdaughters[iprong])==321 &&
196 dd->Getd0Prong(iprong)<minImpParDau) minImpParDau=dd->Getd0Prong(iprong);
197 }
198 vars[iter]=minImpParDau;
199 }
200 if(fVarsForOpt[4]){
201 iter++;
202 for(Int_t iprong=0;iprong<3;iprong++){
203 if(TMath::Abs(pdgdaughters[iprong])==211) {
204 vars[iter]=dd->Getd0Prong(iprong);
205 }
206 }
207 }
208 if(fVarsForOpt[5]){
209 iter++;
210 Float_t minDistPair=TMath::Min(dd->GetDist12toPrim(),dd->GetDist23toPrim());
211 vars[iter]=minDistPair;
212 }
213 if(fVarsForOpt[6]){
214 iter++;
e0fb900a 215 vars[iter]=dd->GetSigmaVert(aod);
4755453e 216 }
217 if(fVarsForOpt[7]){
218 iter++;
219 vars[iter] = dd->DecayLength();
220 }
221 if(fVarsForOpt[8]){
222 iter++;
223 Float_t ptmax=0;
224 for(Int_t i=0;i<3;i++){
225 if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
226 }
227 vars[iter]=ptmax;
228 }
229 if(fVarsForOpt[9]){
230 iter++;
231 vars[iter]=dd->CosPointingAngle();
232 }
233 if(fVarsForOpt[10]){
234 iter++;
235 vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
236 }
237 if(fVarsForOpt[11]){
238 iter++;
239 Float_t maxDCA=0.;
240 for(Int_t i=0;i<3;i++){
241 if(d->GetDCA(i)>maxDCA) maxDCA=d->GetDCA(i);
242 }
243 vars[iter]=maxDCA;
244 }
245 if(fVarsForOpt[12]){
246 iter++;
2c3decce 247 Double_t mPDGPhi = TDatabasePDG::Instance()->GetParticle(333)->Mass();
0b4625fa 248 if(TMath::Abs(pdgdaughters[0])==321){
2c3decce 249
250 Double_t phimass01=d->InvMass2Prongs(0,1,321,321);
251 vars[iter]=TMath::Abs(phimass01-mPDGPhi);
252 // vars[iter]=dd->InvMass2Prongs(0,1,321,321);
4755453e 253 }else{
2c3decce 254 Double_t phimass12=d->InvMass2Prongs(1,2,321,321);
255 vars[iter]=TMath::Abs(phimass12-mPDGPhi);
256 // vars[iter]=dd->InvMass2Prongs(1,2,321,321);
4755453e 257 }
258 }
259 if(fVarsForOpt[13]){
260 iter++;
2c3decce 261 Double_t mPDGK0star = TDatabasePDG::Instance()->GetParticle(313)->Mass();
0b4625fa 262 if(TMath::Abs(pdgdaughters[0])==321){
2c3decce 263
264 Double_t mass12kpi=d->InvMass2Prongs(1,2,321,211);
265 vars[iter]=TMath::Abs(mass12kpi-mPDGK0star);
266 // vars[iter]=dd->InvMass2Prongs(1,2,321,211);
4755453e 267 }else{
2c3decce 268 Double_t mass01pik=d->InvMass2Prongs(0,1,211,321);
269 vars[iter]=TMath::Abs(mass01pik-mPDGK0star);
270 // vars[iter]=dd->InvMass2Prongs(0,1,211,321);
4755453e 271 }
272 }
2e153422 273 if(fVarsForOpt[14]){
274 iter++;
275 if(TMath::Abs(pdgdaughters[0])==321){
276 vars[iter]=dd->CosPiKPhiRFrameKKpi();
277 }else{
278 vars[iter]=dd->CosPiKPhiRFramepiKK();
279 }
280 }
281 if(fVarsForOpt[15]){
282 iter++;
283 if(TMath::Abs(pdgdaughters[0])==321){
284 vars[iter]=dd->CosPiDsLabFrameKKpi();
285 }else{
286 vars[iter]=dd->CosPiDsLabFramepiKK();
287 }
288 }
a6003e0a 289
290 if(cleanvtx)CleanOwnPrimaryVtx(dd,aod,origownvtx);
e3d40058 291 return;
292}
3787d195 293//---------------------------------------------------------------------------
294Bool_t AliRDHFCutsDstoKKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
295{
296 //
297 // Checking if Ds is in fiducial acceptance region
298 //
299
300 if(pt > 5.) {
301 // applying cut for pt > 5 GeV
302 AliDebug(2,Form("pt of Ds = %f (> 5), cutting at |y| < 0.8",pt));
303 if (TMath::Abs(y) > 0.8) return kFALSE;
304
305 } else {
306 // appliying smooth cut for pt < 5 GeV
307 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
308 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
309 AliDebug(2,Form("pt of Ds = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
310 if (y < minFiducialY || y > maxFiducialY) return kFALSE;
311 }
312
313 return kTRUE;
314}
315
45ab4739 316//---------------------------------------------------------------------------
317Int_t AliRDHFCutsDstoKKpi::IsSelectedPID(AliAODRecoDecayHF *rd) {
318 // PID selection
319 // return values: 0->NOT OK, 1->OK as KKpi, 2->OK as piKK, 3->OK as both
320 Int_t retCode=3;
321 Bool_t okKKpi=kTRUE;
322 Bool_t okpiKK=kTRUE;
323 if(!fUsePID || !rd) return retCode;
324 if(!fPidHF){
325 AliWarning("AliAODPidHF not created!");
326 return retCode;
327 }
fba41fa4 328
329 Double_t origCompatTOF=fPidHF->GetPCompatTOF();
330 Double_t origThreshTPC=fPidHF->GetPtThresholdTPC();
331 if(fPidOption==kStrong){
332 fPidHF->SetPCompatTOF(999999.);
333 fPidHF->SetPtThresholdTPC(999999.);
334 }
335
336
45ab4739 337 Int_t nKaons=0;
338 Int_t nNotKaons=0;
339 Int_t sign= rd->GetCharge();
340 for(Int_t iDaught=0; iDaught<3; iDaught++){
341 AliAODTrack *track=(AliAODTrack*)rd->GetDaughter(iDaught);
451c9a4e 342
45ab4739 343 Int_t isPion=fPidHF->MakeRawPid(track,AliPID::kPion);
344 Int_t isKaon=fPidHF->MakeRawPid(track,AliPID::kKaon);
345 Int_t isProton=fPidHF->MakeRawPid(track,AliPID::kProton);
346
fba41fa4 347 if(isProton>0 && isKaon<0 && isPion<0){
348 fPidHF->SetPCompatTOF(origCompatTOF);
349 fPidHF->SetPtThresholdTPC(origThreshTPC);
350 return 0;
351 }
45ab4739 352 if(sign!=track->Charge()){// must be kaon
fba41fa4 353 if(isKaon<0){
354 fPidHF->SetPCompatTOF(origCompatTOF);
355 fPidHF->SetPtThresholdTPC(origThreshTPC);
356 return 0;
357 }
358 if(fPidOption==kStrong && isKaon<=0){
359 fPidHF->SetPCompatTOF(origCompatTOF);
360 fPidHF->SetPtThresholdTPC(origThreshTPC);
361 return 0;
362 }
45ab4739 363 }
364 if(isKaon>0 && isPion<0) nKaons++;
365 if(isKaon<0) nNotKaons++;
366 if(iDaught==0){
367 if(isKaon<0) okKKpi=kFALSE;
fba41fa4 368 if(isPion<0) okpiKK=kFALSE;
369 if(fPidOption==kStrong){
370 if(isKaon<=0) okKKpi=kFALSE;
371 if(isPion<=0) okpiKK=kFALSE;
372 }
45ab4739 373 }
374 else if(iDaught==2){
375 if(isKaon<0) okpiKK=kFALSE;
376 if(isPion<0) okKKpi=kFALSE;
fba41fa4 377 if(fPidOption==kStrong){
378 if(isKaon<=0) okpiKK=kFALSE;
379 if(isPion<=0) okKKpi=kFALSE;
380 }
45ab4739 381 }
382 }
fba41fa4 383
384 fPidHF->SetPCompatTOF(origCompatTOF);
385 fPidHF->SetPtThresholdTPC(origThreshTPC);
45ab4739 386
387 if(nKaons>2)return 0;
388 if(nNotKaons>1) return 0;
389
390 if(!okKKpi) retCode-=1;
391 if(!okpiKK) retCode-=2;
392
393 return retCode;
394}
395
e3d40058 396//---------------------------------------------------------------------------
3787d195 397Int_t AliRDHFCutsDstoKKpi::IsSelected(TObject* obj,Int_t selectionLevel, AliAODEvent* aod) {
e3d40058 398 //
399 // Apply selection
400 //
401
402 if(!fCutsRD){
a5b9e447 403 cout<<"Cut matrix not inizialized. Exit..."<<endl;
e3d40058 404 return 0;
405 }
406 //PrintAll();
407 AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
408
409 if(!d){
410 cout<<"AliAODRecoDecayHF3Prong null"<<endl;
411 return 0;
412 }
fba41fa4 413
5e938293 414 if(fKeepSignalMC) if(IsSignalMC(d,aod,431)) return 3;
fba41fa4 415
51dc3cab 416 Double_t ptD=d->Pt();
417 if(ptD<fMinPtCand) return 0;
418 if(ptD>fMaxPtCand) return 0;
e3d40058 419
ba27eecd 420 if(d->HasBadDaughters()) return 0;
421
422
e3d40058 423 // selection on daughter tracks
424 if(selectionLevel==AliRDHFCuts::kAll ||
425 selectionLevel==AliRDHFCuts::kTracks) {
426 if(!AreDaughtersSelected(d)) return 0;
427 }
428
429
e3d40058 430
45ab4739 431
e3d40058 432 // selection on candidate
433 if(selectionLevel==AliRDHFCuts::kAll ||
434 selectionLevel==AliRDHFCuts::kCandidate) {
3787d195 435 //recalculate vertex w/o daughters
436 AliAODVertex *origownvtx=0x0;
3787d195 437 if(fRemoveDaughtersFromPrimary) {
793fdbec 438 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
439 if(!RecalcOwnPrimaryVtx(d,aod)) {
440 CleanOwnPrimaryVtx(d,aod,origownvtx);
441 return 0;
442 }
3787d195 443 }
e3d40058 444
4755453e 445 Int_t okDsKKpi=1;
446 Int_t okDspiKK=1;
0b4625fa 447 Int_t okMassPhiKKpi=0;
448 Int_t okMassPhipiKK=0;
449 Int_t okMassK0starKKpi=0;
450 Int_t okMassK0starpiKK=0;
451 Int_t okDsPhiKKpi=0;
452 Int_t okDsPhipiKK=0;
453 Int_t okDsK0starKKpi=0;
454 Int_t okDsK0starpiKK=0;
e3d40058 455
4755453e 456 Double_t pt=d->Pt();
457 Int_t ptbin=PtBin(pt);
a5b9e447 458 if (ptbin==-1) {
793fdbec 459 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 460 return 0;
461 }
462
4755453e 463 Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
464 Double_t mDsKKpi=d->InvMassDsKKpi();
465 Double_t mDspiKK=d->InvMassDspiKK();
466 if(TMath::Abs(mDsKKpi-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDsKKpi = 0;
467 if(TMath::Abs(mDspiKK-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDspiKK = 0;
a5b9e447 468 if(!okDsKKpi && !okDspiKK){
793fdbec 469 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 470 return 0;
4755453e 471 }
a5b9e447 472
473
4755453e 474
475 // cuts on resonant decays (via Phi or K0*)
476 Double_t mPhiPDG = TDatabasePDG::Instance()->GetParticle(333)->Mass();
477 Double_t mK0starPDG = TDatabasePDG::Instance()->GetParticle(313)->Mass();
478 if(okDsKKpi){
479 Double_t mass01phi=d->InvMass2Prongs(0,1,321,321);
480 Double_t mass12K0s=d->InvMass2Prongs(1,2,321,211);
0b4625fa 481 if(TMath::Abs(mass01phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhiKKpi=1;
482 if(TMath::Abs(mass12K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0starKKpi = 1;
483 if(!okMassPhiKKpi && !okMassK0starKKpi) okDsKKpi=0;
484 if(okMassPhiKKpi) okDsPhiKKpi=1;
485 if(okMassK0starKKpi) okDsK0starKKpi=1;
4755453e 486 }
487 if(okDspiKK){
488 Double_t mass01K0s=d->InvMass2Prongs(0,1,211,321);
489 Double_t mass12phi=d->InvMass2Prongs(1,2,321,321);
0b4625fa 490 if(TMath::Abs(mass01K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0starpiKK = 1;
491 if(TMath::Abs(mass12phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhipiKK=1;
492 if(!okMassPhipiKK && !okMassK0starpiKK) okDspiKK=0;
493 if(okMassPhipiKK) okDsPhipiKK=1;
494 if(okMassK0starpiKK) okDsK0starpiKK=1;
4755453e 495 }
a5b9e447 496 if(!okDsKKpi && !okDspiKK){
793fdbec 497 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 498 return 0;
499 }
4755453e 500
501 // Cuts on track pairs
a5b9e447 502 for(Int_t i=0;i<3;i++){
503 if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]){
793fdbec 504 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 505 return 0;
506 }
507 }
4755453e 508 if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)] ||
a5b9e447 509 d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]){
793fdbec 510 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 511 return 0;
512 }
513
4755453e 514
515
a5b9e447 516 //single track
517 if(TMath::Abs(d->Pt2Prong(1)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
518 TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]){
793fdbec 519 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 520 return 0;
521 }
522
523 if(okDsKKpi){
524 if(TMath::Abs(d->Pt2Prong(0)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
525 TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDsKKpi=0;
526 if(TMath::Abs(d->Pt2Prong(2)) < fCutsRD[GetGlobalIndex(2,ptbin)]*fCutsRD[GetGlobalIndex(2,ptbin)] ||
527 TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDsKKpi=0;
528 }
529 if(okDspiKK){
530 if(TMath::Abs(d->Pt2Prong(0)) < fCutsRD[GetGlobalIndex(2,ptbin)]*fCutsRD[GetGlobalIndex(2,ptbin)] ||
531 TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDspiKK=0;
532 if(TMath::Abs(d->Pt2Prong(2)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
533 TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDspiKK=0;
534 }
535 if(!okDsKKpi && !okDspiKK){
793fdbec 536 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 537 return 0;
538 }
0b4625fa 539
4755453e 540 // Cuts on candidate triplet
a5b9e447 541
a5b9e447 542
543 if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)]){
793fdbec 544 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 545 return 0;
546 }
547
548 if(d->Pt2Prong(0)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)] &&
549 d->Pt2Prong(1)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)] &&
550 d->Pt2Prong(2)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)]) {
793fdbec 551 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 552 return 0;
553 }
554
555 if(d->DecayLength2()<fCutsRD[GetGlobalIndex(7,ptbin)]*fCutsRD[GetGlobalIndex(7,ptbin)]){
793fdbec 556 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 557 return 0;
558 }
559
560
4755453e 561 Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
a5b9e447 562 if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)]){
793fdbec 563 CleanOwnPrimaryVtx(d,aod,origownvtx);
a5b9e447 564 return 0;
565 }
3787d195 566
981b4d38 567
e0fb900a 568 //sec vert
569 Double_t sigmavert=d->GetSigmaVert(aod);
570 if(sigmavert>fCutsRD[GetGlobalIndex(6,ptbin)]){
571 CleanOwnPrimaryVtx(d,aod,origownvtx);
572 return 0;
573 }
574
2e153422 575 if(okDsKKpi){
576 Double_t cosPiKPhiRFKKpi=d->CosPiKPhiRFrameKKpi();
577 Double_t kincutPiKPhiKKpi=TMath::Abs(cosPiKPhiRFKKpi*cosPiKPhiRFKKpi*cosPiKPhiRFKKpi);
578 if(kincutPiKPhiKKpi<fCutsRD[GetGlobalIndex(14,ptbin)]) okDsKKpi=0;
579 }
580 if(okDspiKK){
581 Double_t cosPiKPhiRFpiKK=d->CosPiKPhiRFramepiKK();
582 Double_t kincutPiKPhipiKK=TMath::Abs(cosPiKPhiRFpiKK*cosPiKPhiRFpiKK*cosPiKPhiRFpiKK);
583 if(kincutPiKPhipiKK<fCutsRD[GetGlobalIndex(14,ptbin)]) okDspiKK=0;
584 }
585 if(!okDsKKpi && !okDspiKK){
586 CleanOwnPrimaryVtx(d,aod,origownvtx);
587 return 0;
588 }
589
590
591
592 if(okDsKKpi){
593 Double_t cosPiDsLabFrameKKpi=d->CosPiDsLabFrameKKpi();
94a69908 594 if(cosPiDsLabFrameKKpi>fCutsRD[GetGlobalIndex(15,ptbin)]) okDsKKpi=0;
2e153422 595 }
596 if(okDspiKK){
597 Double_t cosPiDsLabFramepiKK=d->CosPiDsLabFramepiKK();
94a69908 598 if(cosPiDsLabFramepiKK>fCutsRD[GetGlobalIndex(15,ptbin)]) okDspiKK=0;
2e153422 599 }
600 if(!okDsKKpi && !okDspiKK){
601 CleanOwnPrimaryVtx(d,aod,origownvtx);
602 return 0;
603 }
604
981b4d38 605 // unset recalculated primary vertex when not needed any more
606 CleanOwnPrimaryVtx(d,aod,origownvtx);
607
2e153422 608
a5b9e447 609
0b4625fa 610 if(!okDsKKpi){
611 okDsPhiKKpi=0;
612 okDsK0starKKpi=0;
613 }
614 if(!okDspiKK){
615 okDsPhipiKK=0;
616 okDsK0starpiKK=0;
617 }
618
a5b9e447 619 // PID selection
620 Int_t returnvaluePID=3;
621 if(selectionLevel==AliRDHFCuts::kAll ||
622 selectionLevel==AliRDHFCuts::kCandidate ||
623 selectionLevel==AliRDHFCuts::kPID) {
624 returnvaluePID = IsSelectedPID(d);
625 fIsSelectedPID=returnvaluePID;
626 }
627 if(returnvaluePID==0)return 0;
628
629 Bool_t okPidDsKKpi=returnvaluePID&1;
630 Bool_t okPidDspiKK=returnvaluePID&2;
0b4625fa 631 if(!okPidDsKKpi){
632 okDsPhiKKpi=0;
633 okDsK0starKKpi=0;
634 }
635 if(!okPidDspiKK){
636 okDsPhipiKK=0;
637 okDsK0starpiKK=0;
638 }
639
028e5f2c 640 if((okPidDsKKpi && okDsKKpi)||(okPidDspiKK && okDspiKK)){
641 Int_t returnvalue=0;
642 if(okDsKKpi) returnvalue+=1;
643 if(okDspiKK) returnvalue+=2;
0b4625fa 644 if(okDsPhiKKpi) returnvalue+=4;
645 if(okDsPhipiKK) returnvalue+=8;
646 if(okDsK0starKKpi) returnvalue+=16;
647 if(okDsK0starpiKK) returnvalue+=32;
028e5f2c 648 return returnvalue;
649 }else{
650 return 0;
651 }
4755453e 652 }
a5b9e447 653 return 15;
e3d40058 654
655}
451c9a4e 656
657//--------------------------------------------------------------------------
658
659UInt_t AliRDHFCutsDstoKKpi::GetPIDTrackTPCTOFBitMap(AliAODTrack *track) const{
660
661 UInt_t bitmap=0;
662
663 Double_t sigmaTPCPionHyp=-999.;
664 Double_t sigmaTPCKaonHyp=-999.;
665 Double_t sigmaTPCProtonHyp=-999.;
666 Double_t sigmaTOFPionHyp=-999.;
667 Double_t sigmaTOFKaonHyp=-999.;
668 Double_t sigmaTOFProtonHyp=-999.;
669
670 Int_t oksigmaTPCPionHyp=fPidHF->GetnSigmaTPC(track,2,sigmaTPCPionHyp);
671 Int_t oksigmaTPCKaonHyp=fPidHF->GetnSigmaTPC(track,3,sigmaTPCKaonHyp);
672 Int_t oksigmaTPCProtonHyp=fPidHF->GetnSigmaTPC(track,4,sigmaTPCProtonHyp);
673 Int_t oksigmaTOFPionHyp=fPidHF->GetnSigmaTOF(track,2,sigmaTOFPionHyp);
674 Int_t oksigmaTOFKaonHyp=fPidHF->GetnSigmaTOF(track,3,sigmaTOFKaonHyp);
675 Int_t oksigmaTOFProtonHyp=fPidHF->GetnSigmaTOF(track,4,sigmaTOFProtonHyp);
676
677 if (oksigmaTPCPionHyp && sigmaTPCPionHyp>0.){
678 if (sigmaTPCPionHyp<2.) bitmap+=1<<kTPCPionLess2;
679 else { if (sigmaTPCPionHyp<3.) bitmap+=1<<kTPCPionMore2Less3; else bitmap+=1<<kTPCPionMore3;}
680 }
681 if (oksigmaTPCKaonHyp && sigmaTPCKaonHyp>0.){
682 if (sigmaTPCKaonHyp<2.) bitmap+=1<<kTPCKaonLess2;
683 else { if (sigmaTPCKaonHyp<3.) bitmap+=1<<kTPCKaonMore2Less3; else bitmap+=1<<kTPCKaonMore3;}
684 }
685 if (oksigmaTPCProtonHyp && sigmaTPCProtonHyp>0.){
686 if (sigmaTPCProtonHyp<2.) bitmap+=1<<kTPCProtonLess2;
687 else { if (sigmaTPCProtonHyp<3.) bitmap+=1<<kTPCProtonMore2Less3; else bitmap+=1<<kTPCProtonMore3;}
688 }
689
690 if (oksigmaTOFPionHyp && sigmaTOFPionHyp>0.){
691 if (sigmaTOFPionHyp<2.) bitmap+=1<<kTOFPionLess2;
692 else { if (sigmaTOFPionHyp<3.) bitmap+=1<<kTOFPionMore2Less3; else bitmap+=1<<kTOFPionMore3;}
693 }
694 if (oksigmaTOFKaonHyp && sigmaTOFKaonHyp>0.){
695 if (sigmaTOFKaonHyp<2.) bitmap+=1<<kTOFKaonLess2;
696 else { if (sigmaTOFKaonHyp<3.) bitmap+=1<<kTOFKaonMore2Less3; else bitmap+=1<<kTOFKaonMore3;}
697 }
698 if (oksigmaTOFProtonHyp && sigmaTOFProtonHyp>0.){
699 if (sigmaTOFProtonHyp<2.) bitmap+=1<<kTOFProtonLess2;
700 else { if (sigmaTOFProtonHyp<3.) bitmap+=1<<kTOFProtonMore2Less3; else bitmap+=1<<kTOFProtonMore3;}
701 }
702
703
704 return bitmap;
705
706}
707