AliPhysics  c7b8e89 (c7b8e89)
AliRDHFCutsDstoKKpi.cxx
Go to the documentation of this file.
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 
16 /* $Id$ */
17 
19 //
20 // Class for cuts on AOD reconstructed Ds->KKpi
21 //
22 // Author: A.Dainese, andrea.dainese@pd.infn.it
24 
25 #include <TDatabasePDG.h>
26 #include <Riostream.h>
27 
28 #include "AliRDHFCutsDstoKKpi.h"
30 #include "AliAODTrack.h"
31 #include "AliESDtrack.h"
32 
33 using std::cout;
34 using std::endl;
35 
37 ClassImp(AliRDHFCutsDstoKKpi);
39 
40 
41 //--------------------------------------------------------------------------
43  AliRDHFCuts(name),
44  fCutOnResonances(kTRUE),
45  fPidOption(0),
46  fMaxPtStrongPid(0.),
47  fMaxPStrongPidK(0.),
48  fMaxPStrongPidpi(0.),
49  fDistToMaxProb(0.01),
50  fBayesThreshold(0.05),
51  fWeightKKpi(1.),
52  fWeightpiKK(1.),
53  fPhiMassRef(1.019),
54  fUseRefPhiMass(kFALSE),
55  fUsed0MeasMinusExpCut(kFALSE),
56  fMaxd0MeasMinusExp(0x0),
57  fUsed0Cut(kFALSE),
58  fMaxd0(0x0),
59  fCheckK0star(kTRUE)
60 {
61  //
62  // Default Constructor
63  //
64  Int_t nvars=20;
65  SetNVars(nvars);
66  TString varNames[20]={"inv. mass [GeV]",
67  "pTK [GeV/c]",
68  "pTPi [GeV/c]",
69  "d0K [cm]",
70  "d0Pi [cm]",
71  "dist12 [cm]",
72  "sigmavert [cm]",
73  "decLen [cm]",
74  "ptMax [GeV/c]",
75  "cosThetaPoint",
76  "Sum d0^2 (cm^2)",
77  "dca [cm]",
78  "inv. mass (Mphi-MKK) [GeV]",
79  "inv. mass (MKo*-MKpi) [GeV]",
80  "Abs(CosineKpiPhiRFrame)^3",
81  "CosPiDsLabFrame",
82  "decLenXY [cm]"
83  "NormdecLen",
84  "NormdecLenXY [cm]",
85  "cosThetaPointXY"};
86 
87  Bool_t isUpperCut[20]={kTRUE,
88  kFALSE,
89  kFALSE,
90  kFALSE,
91  kFALSE,
92  kFALSE,
93  kTRUE,
94  kFALSE,
95  kFALSE,
96  kFALSE,
97  kFALSE,
98  kTRUE,
99  kTRUE,
100  kTRUE,
101  kFALSE,
102  kTRUE,
103  kFALSE,
104  kFALSE,
105  kFALSE,
106  kFALSE};
107  SetVarNames(20,varNames,isUpperCut);
108  Bool_t forOpt[20]={kFALSE,
109  kFALSE,
110  kFALSE,
111  kFALSE,
112  kFALSE,
113  kFALSE,
114  kTRUE,
115  kTRUE,
116  kTRUE,
117  kTRUE,
118  kTRUE,
119  kFALSE,
120  kTRUE,
121  kTRUE,
122  kFALSE,
123  kFALSE,
124  kTRUE,
125  kTRUE,
126  kTRUE,
127  kTRUE};
128 
129  SetVarsForOpt(11,forOpt);
130  Float_t limits[2]={0,999999999.};
131  SetPtBins(2,limits);
132  if(fPidHF)delete fPidHF;
133  fPidHF=new AliAODPidHF();
134  Double_t plim[2]={0.6,0.8};
135  Double_t nsigma[5]={2.,1.,2.,3.,0.};
136 
137  fPidHF->SetPLimit(plim,2);
138  fPidHF->SetAsym(kTRUE);
139  fPidHF->SetSigma(nsigma);
140  fPidHF->SetMatch(1);
141  fPidHF->SetTPC(1);
142  fPidHF->SetTOF(1);
143  fPidHF->SetITS(0);
144  fPidHF->SetTRD(0);
145  fPidHF->SetCompat(kTRUE);
146 
147 }
148 //--------------------------------------------------------------------------
150  AliRDHFCuts(source),
152  fPidOption(source.fPidOption),
158  fWeightKKpi(source.fWeightKKpi),
159  fWeightpiKK(source.fWeightpiKK),
160  fPhiMassRef(source.fPhiMassRef),
163  fMaxd0MeasMinusExp(0x0),
164  fUsed0Cut(source.fUsed0Cut),
165  fMaxd0(0x0),
166  fCheckK0star(source.fCheckK0star)
167 {
168  //
169  // Copy constructor
170  //
172  if(source.fMaxd0) Setd0Cut(source.fnPtBins,source.fMaxd0);
173 }
174 //--------------------------------------------------------------------------
176 {
177  //
178  // assignment operator
179  //
180  if(&source == this) return *this;
181 
182  AliRDHFCuts::operator=(source);
183 
185  fPidOption=source.fPidOption;
191  fWeightKKpi=source.fWeightKKpi;
192  fWeightpiKK=source.fWeightpiKK;
193  fPhiMassRef=source.fPhiMassRef;
196  fUsed0Cut=source.fUsed0Cut;
198  if(source.fMaxd0) Setd0Cut(source.fnPtBins,source.fMaxd0);
199  if(source.fCheckK0star) fCheckK0star=source.fCheckK0star;
200 
201  return *this;
202 }
203 
204 //---------------------------------------------------------------------------
206  //
207  // store the cuts
208  //
209  if(nPtBins!=fnPtBins) {
210  printf("Wrong number of pt bins: it has to be %d\n",fnPtBins);
211  AliFatal("exiting");
212  }
214  for(Int_t ib=0; ib<fnPtBins; ib++) fMaxd0MeasMinusExp[ib] = cutval[ib];
215  fUsed0MeasMinusExpCut=kTRUE;
216  return;
217 }
218 
219 //---------------------------------------------------------------------------
221  //
222  // store the cuts
223  //
224  if(nPtBins!=fnPtBins) {
225  printf("Wrong number of pt bins: it has to be %d\n",fnPtBins);
226  AliFatal("exiting");
227  }
228  if(!fMaxd0) fMaxd0 = new Float_t[fnPtBins];
229  for(Int_t ib=0; ib<fnPtBins; ib++) fMaxd0[ib] = cutval[ib];
230  fUsed0Cut=kTRUE;
231  return;
232 }
233 
234 //---------------------------------------------------------------------------
236  //
237  // apply pre selection
238  //
239  if(!fUsePreselect) return 3;
240  Int_t retVal=3;
241 
242  //compute pt
243  Double_t px=0, py=0;
244  AliAODTrack *track[3];
245  for(Int_t iDaught=0; iDaught<3; iDaught++) {
246  track[iDaught] = (AliAODTrack*)aodTracks.At(iDaught);
247  if(!track[iDaught]) return retVal;
248  px += track[iDaught]->Px();
249  py += track[iDaught]->Py();
250  }
251 
252  Double_t ptD=TMath::Sqrt(px*px+py*py);
253 
254  Int_t pidoptmem = fPidOption;
256  retVal=IsSelectedPID(ptD,aodTracks);
257  fPidOption=pidoptmem;
258 
259  if(fUsePreselect==1) return retVal;
260 
261  Int_t ptbin=PtBin(ptD);
262  Double_t mPhiPDG = TDatabasePDG::Instance()->GetParticle(333)->Mass();
263  Double_t mK0starPDG = TDatabasePDG::Instance()->GetParticle(313)->Mass();
264 
265  Bool_t okDsKKpi = (retVal==1 || retVal==3) ? kTRUE : kFALSE;
266  Bool_t okDspiKK = (retVal==2 || retVal==3) ? kTRUE : kFALSE;
267 
268  if(okDsKKpi){
269  //compute min and max with 20% tolerance
270  Double_t minmassphi2=(mPhiPDG-fCutsRD[GetGlobalIndex(12,ptbin)]*1.2)*(mPhiPDG-fCutsRD[GetGlobalIndex(12,ptbin)]*1.2);
271  Double_t maxmassphi2=(mPhiPDG+fCutsRD[GetGlobalIndex(12,ptbin)]*1.2)*(mPhiPDG+fCutsRD[GetGlobalIndex(12,ptbin)]*1.2);
272 
273  Double_t mass01phi2=ComputeInvMass2(track[0],track[1],321,321);
274 
275  if(mass01phi2<minmassphi2 || mass01phi2>maxmassphi2) okDsKKpi=kFALSE;
276 
277  if(!okDsKKpi && fCheckK0star){
278  //compute min and max with 20% tolerance
279  Double_t minmassK0s2=(mK0starPDG-fCutsRD[GetGlobalIndex(13,ptbin)]*1.2)*(mK0starPDG-fCutsRD[GetGlobalIndex(13,ptbin)]*1.2);
280  Double_t maxmassK0s2=(mK0starPDG+fCutsRD[GetGlobalIndex(13,ptbin)]*1.2)*(mK0starPDG+fCutsRD[GetGlobalIndex(13,ptbin)]*1.2);
281 
282  Double_t mass12K0s=ComputeInvMass2(track[1],track[2],321,211);
283 
284  if(mass12K0s<minmassK0s2 || mass12K0s>maxmassK0s2) okDsKKpi=kFALSE;
285  }
286  }
287  if(okDspiKK){
288  //compute min and max with 20% tolerance
289  Double_t minmassphi2=(mPhiPDG-fCutsRD[GetGlobalIndex(12,ptbin)]*1.2)*(mPhiPDG-fCutsRD[GetGlobalIndex(12,ptbin)]*1.2);
290  Double_t maxmassphi2=(mPhiPDG+fCutsRD[GetGlobalIndex(12,ptbin)]*1.2)*(mPhiPDG+fCutsRD[GetGlobalIndex(12,ptbin)]*1.2);
291 
292  Double_t mass01phi2=ComputeInvMass2(track[1],track[2],321,321);
293 
294  if(mass01phi2<minmassphi2 || mass01phi2>maxmassphi2) okDsKKpi=kFALSE;
295 
296  if(!okDsKKpi && fCheckK0star){
297  //compute min and max with 20% tolerance
298  Double_t minmassK0s2=(mK0starPDG-fCutsRD[GetGlobalIndex(13,ptbin)]*1.2)*(mK0starPDG-fCutsRD[GetGlobalIndex(13,ptbin)]*1.2);
299  Double_t maxmassK0s2=(mK0starPDG+fCutsRD[GetGlobalIndex(13,ptbin)]*1.2)*(mK0starPDG+fCutsRD[GetGlobalIndex(13,ptbin)]*1.2);
300 
301  Double_t mass12K0s=ComputeInvMass2(track[0],track[1],211,321);
302 
303  if(mass12K0s<minmassK0s2 || mass12K0s>maxmassK0s2) okDsKKpi=kFALSE;
304  }
305  }
306 
307  if(okDsKKpi && okDspiKK) retVal=3;
308  else if(okDsKKpi && !okDspiKK) retVal=1;
309  else if(!okDsKKpi && okDspiKK) retVal=2;
310 
311  return retVal;
312 }
313 
314 //---------------------------------------------------------------------------
316  //
317  // Fills in vars the values of the variables
318  //
319 
320  if(nvars!=fnVarsForOpt) {
321  printf("AliRDHFCutsDstoKKpi::GetCutsVarsForOpt: wrong number of variables\n");
322  return;
323  }
324 
326 
327  //recalculate vertex w/o daughters
328  Bool_t cleanvtx=kFALSE;
329  AliAODVertex *origownvtx=0x0;
331  if(dd->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*dd->GetOwnPrimaryVtx());
332  cleanvtx=kTRUE;
333  if(!RecalcOwnPrimaryVtx(dd,aod)) {
334  CleanOwnPrimaryVtx(dd,aod,origownvtx);
335  cleanvtx=kFALSE;
336  }
337  }
338 
339  Int_t iter=-1;
340  if(fVarsForOpt[0]){
341  iter++;
342  if(TMath::Abs(pdgdaughters[0])==321){
343  vars[iter]=dd->InvMassDsKKpi();
344  }else{
345  vars[iter]=dd->InvMassDspiKK();
346  }
347  }
348  if(fVarsForOpt[1]){
349  iter++;
350  Float_t minPtDau=99999.;
351  for(Int_t iprong=0;iprong<3;iprong++){
352  if(TMath::Abs(pdgdaughters[iprong])==321 &&
353  dd->PtProng(iprong)<minPtDau) minPtDau=dd->PtProng(iprong);
354  }
355  vars[iter]=minPtDau;
356  }
357  if(fVarsForOpt[2]){
358  iter++;
359  for(Int_t iprong=0;iprong<3;iprong++){
360  if(TMath::Abs(pdgdaughters[iprong])==211) {
361  vars[iter]=dd->PtProng(iprong);
362  }
363  }
364  }
365  if(fVarsForOpt[3]){
366  iter++;
367  Float_t minImpParDau=99999.;
368  for(Int_t iprong=0;iprong<3;iprong++){
369  if(TMath::Abs(pdgdaughters[iprong])==321 &&
370  dd->Getd0Prong(iprong)<minImpParDau) minImpParDau=dd->Getd0Prong(iprong);
371  }
372  vars[iter]=minImpParDau;
373  }
374  if(fVarsForOpt[4]){
375  iter++;
376  for(Int_t iprong=0;iprong<3;iprong++){
377  if(TMath::Abs(pdgdaughters[iprong])==211) {
378  vars[iter]=dd->Getd0Prong(iprong);
379  }
380  }
381  }
382  if(fVarsForOpt[5]){
383  iter++;
384  Float_t minDistPair=TMath::Min(dd->GetDist12toPrim(),dd->GetDist23toPrim());
385  vars[iter]=minDistPair;
386  }
387  if(fVarsForOpt[6]){
388  iter++;
389  vars[iter]=dd->GetSigmaVert(aod);
390  }
391  if(fVarsForOpt[7]){
392  iter++;
393  vars[iter] = dd->DecayLength();
394  }
395  if(fVarsForOpt[8]){
396  iter++;
397  Float_t ptmax=0;
398  for(Int_t i=0;i<3;i++){
399  if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
400  }
401  vars[iter]=ptmax;
402  }
403  if(fVarsForOpt[9]){
404  iter++;
405  vars[iter]=dd->CosPointingAngle();
406  }
407  if(fVarsForOpt[10]){
408  iter++;
409  vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
410  }
411  if(fVarsForOpt[11]){
412  iter++;
413  Float_t maxDCA=0.;
414  for(Int_t i=0;i<3;i++){
415  if(d->GetDCA(i)>maxDCA) maxDCA=d->GetDCA(i);
416  }
417  vars[iter]=maxDCA;
418  }
419  if(fVarsForOpt[12]){
420  iter++;
421  Double_t mPDGPhi = TDatabasePDG::Instance()->GetParticle(333)->Mass();
422  if(TMath::Abs(pdgdaughters[0])==321){
423 
424  Double_t phimass01=d->InvMass2Prongs(0,1,321,321);
425  vars[iter]=TMath::Abs(phimass01-mPDGPhi);
426  // vars[iter]=dd->InvMass2Prongs(0,1,321,321);
427  }else{
428  Double_t phimass12=d->InvMass2Prongs(1,2,321,321);
429  vars[iter]=TMath::Abs(phimass12-mPDGPhi);
430  // vars[iter]=dd->InvMass2Prongs(1,2,321,321);
431  }
432  }
433  if(fVarsForOpt[13]){
434  iter++;
435  Double_t mPDGK0star = TDatabasePDG::Instance()->GetParticle(313)->Mass();
436  if(TMath::Abs(pdgdaughters[0])==321){
437 
438  Double_t mass12kpi=d->InvMass2Prongs(1,2,321,211);
439  vars[iter]=TMath::Abs(mass12kpi-mPDGK0star);
440  // vars[iter]=dd->InvMass2Prongs(1,2,321,211);
441  }else{
442  Double_t mass01pik=d->InvMass2Prongs(0,1,211,321);
443  vars[iter]=TMath::Abs(mass01pik-mPDGK0star);
444  // vars[iter]=dd->InvMass2Prongs(0,1,211,321);
445  }
446  }
447  if(fVarsForOpt[14]){
448  iter++;
449  if(TMath::Abs(pdgdaughters[0])==321){
450  vars[iter]=dd->CosPiKPhiRFrameKKpi();
451  }else{
452  vars[iter]=dd->CosPiKPhiRFramepiKK();
453  }
454  }
455  if(fVarsForOpt[15]){
456  iter++;
457  if(TMath::Abs(pdgdaughters[0])==321){
458  vars[iter]=dd->CosPiDsLabFrameKKpi();
459  }else{
460  vars[iter]=dd->CosPiDsLabFramepiKK();
461  }
462  }
463 
464  if(fVarsForOpt[16]){
465  iter++;
466  vars[iter]=dd->DecayLengthXY();
467  }
468 
469  if(fVarsForOpt[17]){
470  iter++;
471  vars[iter]=dd->NormalizedDecayLength();
472  }
473 
474  if(fVarsForOpt[18]){
475  iter++;
476  vars[iter]=dd->NormalizedDecayLengthXY();
477  }
478 
479  if(fVarsForOpt[19]){
480  iter++;
481  vars[iter]=dd->CosPointingAngleXY();
482  }
483 
484  if(cleanvtx)CleanOwnPrimaryVtx(dd,aod,origownvtx);
485  return;
486 }
487 //---------------------------------------------------------------------------
489 {
490  //
491  // Checking if Ds is in fiducial acceptance region
492  //
493 
494  if(fMaxRapidityCand>-998.){
495  if(TMath::Abs(y) > fMaxRapidityCand) return kFALSE;
496  else return kTRUE;
497  }
498 
499  if(pt > 5.) {
500  // applying cut for pt > 5 GeV
501  AliDebug(2,Form("pt of Ds = %f (> 5), cutting at |y| < 0.8",pt));
502  if (TMath::Abs(y) > 0.8) return kFALSE;
503 
504  } else {
505  // appliying smooth cut for pt < 5 GeV
506  Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
507  Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
508  AliDebug(2,Form("pt of Ds = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
509  if (y < minFiducialY || y > maxFiducialY) return kFALSE;
510  }
511 
512  return kTRUE;
513 }
514 
515 //---------------------------------------------------------------------------
517  Int_t retCode=3;
518  if(rd) {
519  Double_t Pt = rd->Pt();
520  TObjArray aodtracks(3);
521  for(Int_t iDaught=0; iDaught<3; iDaught++) {
522  aodtracks.AddAt(rd->GetDaughter(iDaught),iDaught);
523  }
524  retCode = IsSelectedPIDBayes(Pt,aodtracks);
525  }
526 
527  return retCode;
528 }
529 
530 //---------------------------------------------------------------------------
532  Int_t retCode=3;
533  Bool_t okKKpi=kTRUE;
534  Bool_t okpiKK=kTRUE;
535 
536  AliAODTrack *track[3];
537  for(Int_t iDaught=0; iDaught<3; iDaught++){
538  track[iDaught]=(AliAODTrack*)aodtracks.At(iDaught);
539  }
540  Int_t sign = track[0]->Charge();
541 
542  if(!fUsePID || !track[0] || !track[1] || !track[2]) return retCode;
543  if(!fPidHF){
544  AliWarning("AliAODPidHF not created!");
545  return retCode;
546  }
548  AliWarning("Wrong call to Bayesian PID");
549  return retCode;
550  }
551 
552  AliPIDCombined* copid=fPidHF->GetPidCombined();
553  copid->SetDetectorMask(AliPIDResponse::kDetTPC | AliPIDResponse::kDetTOF);
554  AliPIDResponse* pidres=fPidHF->GetPidResponse();
555  Double_t bayesProb[AliPID::kSPECIES];
556  Int_t nKaons=0;
557  Int_t nNotKaons=0;
558  fWeightKKpi=1.;
559  fWeightpiKK=1.;
560  for(Int_t iDaught=0; iDaught<3; iDaught++){
561 
562  Int_t isPion=0;
563  Int_t isKaon=0;
564  Int_t isProton=0;
565  UInt_t usedDet=copid->ComputeProbabilities(track[iDaught],pidres,bayesProb);
566  if(usedDet!=0){
568  Double_t maxProb=TMath::MaxElement(AliPID::kSPECIES,bayesProb);
569  if(TMath::Abs(maxProb-bayesProb[AliPID::kPion])<fDistToMaxProb) isPion=1;
570  else isPion=-1;
571  if(TMath::Abs(maxProb-bayesProb[AliPID::kKaon])<fDistToMaxProb) isKaon=1;
572  else isKaon=-1;
573  if(TMath::Abs(maxProb-bayesProb[AliPID::kProton])<fDistToMaxProb) isProton=1;
574  else isProton=-1;
575  }
577  if(bayesProb[AliPID::kPion]>fBayesThreshold) isPion=1;
578  else isPion=-1;
579  if(bayesProb[AliPID::kKaon]>fBayesThreshold) isKaon=1;
580  else isKaon=-1;
581  if(bayesProb[AliPID::kProton]>fBayesThreshold) isProton=1;
582  else isProton=-1;
583  }
584  }
585  if(fPidOption==kBayesianWeights){ // store the probabilities in the case kBayesianWeights
586  if(iDaught==0){
587  fWeightKKpi*=bayesProb[AliPID::kKaon];
588  fWeightpiKK*=bayesProb[AliPID::kPion];
589  }else if(iDaught==1){
590  fWeightKKpi*=bayesProb[AliPID::kKaon];
591  fWeightpiKK*=bayesProb[AliPID::kKaon];
592  }else if(iDaught==2){
593  fWeightKKpi*=bayesProb[AliPID::kPion];
594  fWeightpiKK*=bayesProb[AliPID::kKaon];
595  }
596  }else{ // selection for the other cases
597  if(isProton>0 && isKaon<0 && isPion<0) return 0;
598  if(sign!=track[iDaught]->Charge()){// must be kaon
599  if(isKaon<0) return 0;
600  }
601  if(isKaon>0 && isPion<0) nKaons++;
602  if(isKaon<0) nNotKaons++;
603  if(iDaught==0){
604  if(isKaon<0) okKKpi=kFALSE;
605  if(isPion<0) okpiKK=kFALSE;
606  }else if(iDaught==2){
607  if(isKaon<0) okpiKK=kFALSE;
608  if(isPion<0) okKKpi=kFALSE;
609  }
610  }
611  }
612  if(fPidOption==kBayesianWeights) return retCode;
613 
614  if(nKaons>2)return 0;
615  if(nNotKaons>1) return 0;
616 
617  if(!okKKpi) retCode-=1;
618  if(!okpiKK) retCode-=2;
619 
620  return retCode;
621 }
622 
623 //---------------------------------------------------------------------------
625  // PID selection
626  // return values: 0->NOT OK, 1->OK as KKpi, 2->OK as piKK, 3->OK as both
627  Int_t retCode=3;
628  if(!fUsePID) return retCode;
629  if(rd) {
630  Double_t Pt = rd->Pt();
631  TObjArray aodtracks(3);
632  for(Int_t iDaught=0; iDaught<3; iDaught++) {
633  aodtracks.AddAt(rd->GetDaughter(iDaught),iDaught);
634  }
635  retCode = IsSelectedPID(Pt,aodtracks);
636  }
637 
638  return retCode;
639 }
640 
641 //---------------------------------------------------------------------------
643  // PID selection
644  // return values: 0->NOT OK, 1->OK as KKpi, 2->OK as piKK, 3->OK as both
645 
646  Int_t retCode=3;
647  Bool_t okKKpi=kTRUE;
648  Bool_t okpiKK=kTRUE;
649 
650  AliAODTrack *track[3];
651  for(Int_t iDaught=0; iDaught<3; iDaught++){
652  track[iDaught]=(AliAODTrack*)aodtracks.At(iDaught);
653  }
654 
655  if(!fUsePID || !track[0] || !track[1] || !track[2]) return retCode;
656 
657  Int_t sign = track[0]->Charge();
658  if(!fPidHF){
659  AliWarning("AliAODPidHF not created!");
660  return retCode;
661  }
663  // call method for Bayesian probability
664  return IsSelectedPIDBayes(Pt,aodtracks);
665  }
666 
667  Double_t origCompatTOF=fPidHF->GetPCompatTOF();
668  Double_t origThreshTPC=fPidHF->GetPtThresholdTPC();
669  if(fPidOption==kStrong){
670  fPidHF->SetPCompatTOF(999999.);
671  fPidHF->SetPtThresholdTPC(999999.);
672  }
673 
674  Int_t nKaons=0;
675  Int_t nNotKaons=0;
676  for(Int_t iDaught=0; iDaught<3; iDaught++){
677 
678  Int_t isPion=fPidHF->MakeRawPid(track[iDaught],AliPID::kPion);
679  Int_t isKaon=fPidHF->MakeRawPid(track[iDaught],AliPID::kKaon);
680  Int_t isProton=fPidHF->MakeRawPid(track[iDaught],AliPID::kProton);
681 
682  if(isProton>0 && isKaon<0 && isPion<0){
683  fPidHF->SetPCompatTOF(origCompatTOF);
684  fPidHF->SetPtThresholdTPC(origThreshTPC);
685  return 0;
686  }
687  if(sign!=track[iDaught]->Charge()){// must be kaon
688  if(isKaon<0){
689  fPidHF->SetPCompatTOF(origCompatTOF);
690  fPidHF->SetPtThresholdTPC(origThreshTPC);
691  return 0;
692  }
693  if(fPidOption==kStrong && Pt<fMaxPtStrongPid && isKaon<=0){
694  fPidHF->SetPCompatTOF(origCompatTOF);
695  fPidHF->SetPtThresholdTPC(origThreshTPC);
696  return 0;
697  }
699  if(isKaon<=0 && track[iDaught]->P()<fMaxPStrongPidK) return 0;
700  }
701  }
702 
703  if(isKaon>0 && isPion<0) nKaons++;
704  if(isKaon<0) nNotKaons++;
705  if(iDaught==0){
706  if(isKaon<0) okKKpi=kFALSE;
707  if(isPion<0) okpiKK=kFALSE;
709  if(isKaon<=0) okKKpi=kFALSE;
710  if(isPion<=0) okpiKK=kFALSE;
711  }
713  if(isKaon<=0 && track[iDaught]->P()<fMaxPStrongPidK) okKKpi=kFALSE;
714  if(isPion<=0 && track[iDaught]->P()<fMaxPStrongPidpi) okpiKK=kFALSE;
715  }
716  }
717  else if(iDaught==2){
718  if(isKaon<0) okpiKK=kFALSE;
719  if(isPion<0) okKKpi=kFALSE;
721  if(isKaon<=0) okpiKK=kFALSE;
722  if(isPion<=0) okKKpi=kFALSE;
723  }
725  if(isKaon<=0 && track[iDaught]->P()<fMaxPStrongPidK) okpiKK=kFALSE;
726  if(isPion<=0 && track[iDaught]->P()<fMaxPStrongPidpi) okKKpi=kFALSE;
727  }
728  }
729  }
730 
731  fPidHF->SetPCompatTOF(origCompatTOF);
732  fPidHF->SetPtThresholdTPC(origThreshTPC);
733 
734  if(nKaons>2)return 0;
735  if(nNotKaons>1) return 0;
736 
737  if(!okKKpi) retCode-=1;
738  if(!okpiKK) retCode-=2;
739 
740  return retCode;
741 }
742 
743 //---------------------------------------------------------------------------
745  //
746  // Apply selection
747  //
748 
749  if(!fCutsRD){
750  cout<<"Cut matrix not inizialized. Exit..."<<endl;
751  return 0;
752  }
753  //PrintAll();
755 
756  if(!d){
757  cout<<"AliAODRecoDecayHF3Prong null"<<endl;
758  return 0;
759  }
760 
761  if(fKeepSignalMC) if(IsSignalMC(d,aod,431)) return 3;
762 
763  Double_t ptD=d->Pt();
764  if(ptD<fMinPtCand) return 0;
765  if(ptD>fMaxPtCand) return 0;
766 
768 
769 
770  // selection on daughter tracks
771  if(selectionLevel==AliRDHFCuts::kAll ||
772  selectionLevel==AliRDHFCuts::kTracks) {
773  if(!AreDaughtersSelected(d,aod)) return 0;
774  }
775 
776 
777 
778 
779  // selection on candidate
780  if(selectionLevel==AliRDHFCuts::kAll ||
781  selectionLevel==AliRDHFCuts::kCandidate) {
782  //recalculate vertex w/o daughters
783  AliAODVertex *origownvtx=0x0;
785  if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
786  if(!RecalcOwnPrimaryVtx(d,aod)) {
787  CleanOwnPrimaryVtx(d,aod,origownvtx);
788  return 0;
789  }
790  }
791 
792  Int_t okDsKKpi=1;
793  Int_t okDspiKK=1;
794  Int_t okMassPhiKKpi=0;
795  Int_t okMassPhipiKK=0;
796  Int_t okMassK0starKKpi=0;
797  Int_t okMassK0starpiKK=0;
798  Int_t okDsPhiKKpi=0;
799  Int_t okDsPhipiKK=0;
800  Int_t okDsK0starKKpi=0;
801  Int_t okDsK0starpiKK=0;
802 
803  Double_t pt=d->Pt();
804  Int_t ptbin=PtBin(pt);
805  if (ptbin==-1) {
806  CleanOwnPrimaryVtx(d,aod,origownvtx);
807  return 0;
808  }
809 
810  Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
811  Double_t mDsKKpi=d->InvMassDsKKpi();
812  Double_t mDspiKK=d->InvMassDspiKK();
813  if(TMath::Abs(mDsKKpi-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDsKKpi = 0;
814  if(TMath::Abs(mDspiKK-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDspiKK = 0;
815  if(!okDsKKpi && !okDspiKK){
816  CleanOwnPrimaryVtx(d,aod,origownvtx);
817  return 0;
818  }
819 
820 
821 
822  // cuts on resonant decays (via Phi or K0*)
823  if(fCutOnResonances){
824  Double_t mPhiPDG = TDatabasePDG::Instance()->GetParticle(333)->Mass();
825  Double_t mK0starPDG = TDatabasePDG::Instance()->GetParticle(313)->Mass();
826  Double_t mPhiRef = mPhiPDG;
827  if(fUseRefPhiMass) mPhiRef = fPhiMassRef;
828  if(okDsKKpi){
829  Double_t mass01phi=d->InvMass2Prongs(0,1,321,321);
830  if(TMath::Abs(mass01phi-mPhiRef)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhiKKpi=1;
831  if(fCheckK0star){
832  Double_t mass12K0s=d->InvMass2Prongs(1,2,321,211);
833  if(TMath::Abs(mass12K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0starKKpi = 1;
834  }
835  if(!okMassPhiKKpi && !okMassK0starKKpi) okDsKKpi=0;
836  if(okMassPhiKKpi) okDsPhiKKpi=1;
837  if(okMassK0starKKpi) okDsK0starKKpi=1;
838  }
839  if(okDspiKK){
840  if(fCheckK0star){
841  Double_t mass01K0s=d->InvMass2Prongs(0,1,211,321);
842  if(TMath::Abs(mass01K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0starpiKK = 1;
843  }
844  Double_t mass12phi=d->InvMass2Prongs(1,2,321,321);
845  if(TMath::Abs(mass12phi-mPhiRef)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhipiKK=1;
846  if(!okMassPhipiKK && !okMassK0starpiKK) okDspiKK=0;
847  if(okMassPhipiKK) okDsPhipiKK=1;
848  if(okMassK0starpiKK) okDsK0starpiKK=1;
849  }
850  if(!okDsKKpi && !okDspiKK){
851  CleanOwnPrimaryVtx(d,aod,origownvtx);
852  return 0;
853  }
854  }
855 
856  // Cuts on track pairs
857  for(Int_t i=0;i<3;i++){
858  if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]){
859  CleanOwnPrimaryVtx(d,aod,origownvtx);
860  return 0;
861  }
862  }
863  if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)] ||
864  d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]){
865  CleanOwnPrimaryVtx(d,aod,origownvtx);
866  return 0;
867  }
868 
869 
870 
871  //single track
872  if(TMath::Abs(d->Pt2Prong(1)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
873  TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]){
874  CleanOwnPrimaryVtx(d,aod,origownvtx);
875  return 0;
876  }
877 
878  if(okDsKKpi){
879  if(TMath::Abs(d->Pt2Prong(0)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
880  TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDsKKpi=0;
881  if(TMath::Abs(d->Pt2Prong(2)) < fCutsRD[GetGlobalIndex(2,ptbin)]*fCutsRD[GetGlobalIndex(2,ptbin)] ||
882  TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDsKKpi=0;
883  }
884  if(okDspiKK){
885  if(TMath::Abs(d->Pt2Prong(0)) < fCutsRD[GetGlobalIndex(2,ptbin)]*fCutsRD[GetGlobalIndex(2,ptbin)] ||
886  TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDspiKK=0;
887  if(TMath::Abs(d->Pt2Prong(2)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
888  TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDspiKK=0;
889  }
890  if(!okDsKKpi && !okDspiKK){
891  CleanOwnPrimaryVtx(d,aod,origownvtx);
892  return 0;
893  }
894 
895  // Cuts on candidate triplet
896 
897 
898  if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)]){
899  CleanOwnPrimaryVtx(d,aod,origownvtx);
900  return 0;
901  }
902 
903  if(d->Pt2Prong(0)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)] &&
904  d->Pt2Prong(1)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)] &&
905  d->Pt2Prong(2)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)]) {
906  CleanOwnPrimaryVtx(d,aod,origownvtx);
907  return 0;
908  }
909 
910  if(d->DecayLength2()<fCutsRD[GetGlobalIndex(7,ptbin)]*fCutsRD[GetGlobalIndex(7,ptbin)]){
911  CleanOwnPrimaryVtx(d,aod,origownvtx);
912  return 0;
913  }
914 
915 
916  Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
917  if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)]){
918  CleanOwnPrimaryVtx(d,aod,origownvtx);
919  return 0;
920  }
921 
922 
923  //sec vert
924  Double_t sigmavert=d->GetSigmaVert(aod);
925  if(sigmavert>fCutsRD[GetGlobalIndex(6,ptbin)]){
926  CleanOwnPrimaryVtx(d,aod,origownvtx);
927  return 0;
928  }
929 
930  // decay length XY
931  if(d->DecayLengthXY()<fCutsRD[GetGlobalIndex(16,ptbin)]){
932  CleanOwnPrimaryVtx(d,aod,origownvtx);
933  return 0;
934  }
935 
936  //norm decay length
937  if(d->NormalizedDecayLength()<fCutsRD[GetGlobalIndex(17,ptbin)]){
938  CleanOwnPrimaryVtx(d,aod,origownvtx);
939  return 0;
940  }
941 
942  //norm decay length XY
943  if(d->NormalizedDecayLengthXY()<fCutsRD[GetGlobalIndex(18,ptbin)]){
944  CleanOwnPrimaryVtx(d,aod,origownvtx);
945  return 0;
946  }
947 
948  //cos pointing XY
949  if(d->CosPointingAngleXY()<fCutsRD[GetGlobalIndex(19,ptbin)]){
950  CleanOwnPrimaryVtx(d,aod,origownvtx);
951  return 0;
952  }
953 
954 
955  if(okDsKKpi){
956  Double_t cosPiKPhiRFKKpi=d->CosPiKPhiRFrameKKpi();
957  Double_t kincutPiKPhiKKpi=TMath::Abs(cosPiKPhiRFKKpi*cosPiKPhiRFKKpi*cosPiKPhiRFKKpi);
958  if(kincutPiKPhiKKpi<fCutsRD[GetGlobalIndex(14,ptbin)]) okDsKKpi=0;
959  }
960  if(okDspiKK){
961  Double_t cosPiKPhiRFpiKK=d->CosPiKPhiRFramepiKK();
962  Double_t kincutPiKPhipiKK=TMath::Abs(cosPiKPhiRFpiKK*cosPiKPhiRFpiKK*cosPiKPhiRFpiKK);
963  if(kincutPiKPhipiKK<fCutsRD[GetGlobalIndex(14,ptbin)]) okDspiKK=0;
964  }
965  if(!okDsKKpi && !okDspiKK){
966  CleanOwnPrimaryVtx(d,aod,origownvtx);
967  return 0;
968  }
969 
970 
971 
972  if(okDsKKpi){
973  Double_t cosPiDsLabFrameKKpi=d->CosPiDsLabFrameKKpi();
974  if(cosPiDsLabFrameKKpi>fCutsRD[GetGlobalIndex(15,ptbin)]) okDsKKpi=0;
975  }
976  if(okDspiKK){
977  Double_t cosPiDsLabFramepiKK=d->CosPiDsLabFramepiKK();
978  if(cosPiDsLabFramepiKK>fCutsRD[GetGlobalIndex(15,ptbin)]) okDspiKK=0;
979  }
980  if(!okDsKKpi && !okDspiKK){
981  CleanOwnPrimaryVtx(d,aod,origownvtx);
982  return 0;
983  }
984 
985  // d0meas-exp
987  Double_t dd0max=0;
988  for(Int_t ipr=0; ipr<3; ipr++) {
989  Double_t diffIP, errdiffIP;
990  d->Getd0MeasMinusExpProng(ipr,aod->GetMagneticField(),diffIP,errdiffIP);
991  Double_t normdd0=0.;
992  if(errdiffIP>0) normdd0=diffIP/errdiffIP;
993  if(ipr==0) dd0max=normdd0;
994  else if(TMath::Abs(normdd0)>TMath::Abs(dd0max)) dd0max=normdd0;
995  }
996  if(TMath::Abs(dd0max)>fMaxd0MeasMinusExp[ptbin]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
997  }
998 
999  // d0
1000  if(fUsed0Cut){
1001  Double_t d0=d->ImpParXY()*10000.;
1002  if(TMath::Abs(d0)>fMaxd0[ptbin]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
1003  }
1004 
1005 
1006  // unset recalculated primary vertex when not needed any more
1007  CleanOwnPrimaryVtx(d,aod,origownvtx);
1008 
1009 
1010 
1011  if(!okDsKKpi){
1012  okDsPhiKKpi=0;
1013  okDsK0starKKpi=0;
1014  }
1015  if(!okDspiKK){
1016  okDsPhipiKK=0;
1017  okDsK0starpiKK=0;
1018  }
1019 
1020  // PID selection
1021  Int_t returnvaluePID=3;
1022  if(selectionLevel==AliRDHFCuts::kAll ||
1023  selectionLevel==AliRDHFCuts::kCandidate ||
1024  selectionLevel==AliRDHFCuts::kPID) {
1025  returnvaluePID = IsSelectedPID(d);
1026  fIsSelectedPID=returnvaluePID;
1027  }
1028  if(returnvaluePID==0)return 0;
1029 
1030  Bool_t okPidDsKKpi=returnvaluePID&1;
1031  Bool_t okPidDspiKK=returnvaluePID&2;
1032  if(!okPidDsKKpi){
1033  okDsPhiKKpi=0;
1034  okDsK0starKKpi=0;
1035  }
1036  if(!okPidDspiKK){
1037  okDsPhipiKK=0;
1038  okDsK0starpiKK=0;
1039  }
1040 
1041  if((okPidDsKKpi && okDsKKpi)||(okPidDspiKK && okDspiKK)){
1042  Int_t returnvalue=0;
1043  if(okDsKKpi) returnvalue+=1;
1044  if(okDspiKK) returnvalue+=2;
1045  if(okDsPhiKKpi) returnvalue+=4;
1046  if(okDsPhipiKK) returnvalue+=8;
1047  if(okDsK0starKKpi) returnvalue+=16;
1048  if(okDsK0starpiKK) returnvalue+=32;
1049  return returnvalue;
1050  }else{
1051  return 0;
1052  }
1053  }
1054  return 15;
1055 
1056 }
1057 
1058 //--------------------------------------------------------------------------
1059 
1061 
1062  UInt_t bitmap=0;
1063 
1064  Double_t sigmaTPCPionHyp=-999.;
1065  Double_t sigmaTPCKaonHyp=-999.;
1066  Double_t sigmaTPCProtonHyp=-999.;
1067  Double_t sigmaTOFPionHyp=-999.;
1068  Double_t sigmaTOFKaonHyp=-999.;
1069  Double_t sigmaTOFProtonHyp=-999.;
1070 
1071  Int_t oksigmaTPCPionHyp=fPidHF->GetnSigmaTPC(track,2,sigmaTPCPionHyp);
1072  Int_t oksigmaTPCKaonHyp=fPidHF->GetnSigmaTPC(track,3,sigmaTPCKaonHyp);
1073  Int_t oksigmaTPCProtonHyp=fPidHF->GetnSigmaTPC(track,4,sigmaTPCProtonHyp);
1074  Int_t oksigmaTOFPionHyp=fPidHF->GetnSigmaTOF(track,2,sigmaTOFPionHyp);
1075  Int_t oksigmaTOFKaonHyp=fPidHF->GetnSigmaTOF(track,3,sigmaTOFKaonHyp);
1076  Int_t oksigmaTOFProtonHyp=fPidHF->GetnSigmaTOF(track,4,sigmaTOFProtonHyp);
1077 
1078  sigmaTPCPionHyp=TMath::Abs(sigmaTPCPionHyp);
1079  sigmaTPCKaonHyp=TMath::Abs(sigmaTPCKaonHyp);
1080  sigmaTPCProtonHyp=TMath::Abs(sigmaTPCProtonHyp);
1081  sigmaTOFPionHyp=TMath::Abs(sigmaTOFPionHyp);
1082  sigmaTOFKaonHyp=TMath::Abs(sigmaTOFKaonHyp);
1083  sigmaTOFProtonHyp=TMath::Abs(sigmaTOFProtonHyp);
1084 
1085  if (oksigmaTPCPionHyp && sigmaTPCPionHyp>0.){
1086  if (sigmaTPCPionHyp<1.) bitmap+=1<<kTPCPionLess1;
1087  else{
1088  if (sigmaTPCPionHyp<2.) bitmap+=1<<kTPCPionMore1Less2;
1089  else {
1090  if (sigmaTPCPionHyp<3.) bitmap+=1<<kTPCPionMore2Less3;
1091  else bitmap+=1<<kTPCPionMore3;
1092  }
1093  }
1094  }
1095 
1096  if (oksigmaTPCKaonHyp && sigmaTPCKaonHyp>0.){
1097  if (sigmaTPCKaonHyp<1.) bitmap+=1<<kTPCKaonLess1;
1098  else{
1099  if (sigmaTPCKaonHyp<2.) bitmap+=1<<kTPCKaonMore1Less2;
1100  else {
1101  if (sigmaTPCKaonHyp<3.) bitmap+=1<<kTPCKaonMore2Less3;
1102  else bitmap+=1<<kTPCKaonMore3;
1103  }
1104  }
1105  }
1106 
1107  if (oksigmaTPCProtonHyp && sigmaTPCProtonHyp>0.){
1108  if (sigmaTPCProtonHyp<1.) bitmap+=1<<kTPCProtonLess1;
1109  else{
1110  if (sigmaTPCProtonHyp<2.) bitmap+=1<<kTPCProtonMore1Less2;
1111  else {
1112  if (sigmaTPCProtonHyp<3.) bitmap+=1<<kTPCProtonMore2Less3;
1113  else bitmap+=1<<kTPCProtonMore3;
1114  }
1115  }
1116  }
1117 
1118  if (oksigmaTOFPionHyp && sigmaTOFPionHyp>0.){
1119  if (sigmaTOFPionHyp<1.) bitmap+=1<<kTOFPionLess1;
1120  else{
1121  if (sigmaTOFPionHyp<2.) bitmap+=1<<kTOFPionMore1Less2;
1122  else {
1123  if (sigmaTOFPionHyp<3.) bitmap+=1<<kTOFPionMore2Less3;
1124  else bitmap+=1<<kTOFPionMore3;
1125  }
1126  }
1127  }
1128 
1129  if (oksigmaTOFKaonHyp && sigmaTOFKaonHyp>0.){
1130  if (sigmaTOFKaonHyp<1.) bitmap+=1<<kTOFKaonLess1;
1131  else{
1132  if (sigmaTOFKaonHyp<2.) bitmap+=1<<kTOFKaonMore1Less2;
1133  else {
1134  if (sigmaTOFKaonHyp<3.) bitmap+=1<<kTOFKaonMore2Less3;
1135  else bitmap+=1<<kTOFKaonMore3;
1136  }
1137  }
1138  }
1139 
1140  if (oksigmaTOFProtonHyp && sigmaTOFProtonHyp>0.){
1141  if (sigmaTOFProtonHyp<1.) bitmap+=1<<kTOFProtonLess1;
1142  else{
1143  if (sigmaTOFProtonHyp<2.) bitmap+=1<<kTOFProtonMore1Less2;
1144  else {
1145  if (sigmaTOFProtonHyp<3.) bitmap+=1<<kTOFProtonMore2Less3;
1146  else bitmap+=1<<kTOFProtonMore3;
1147  }
1148  }
1149  }
1150 
1151 
1152 
1153  return bitmap;
1154 
1155 }
1156 
1157 
1158 //---------------------------------------------------------------------------
1159 
1161  //
1162  //STANDARD CUTS USED FOR 2010 pp analysis
1163  //
1164 
1165  SetName("DstoKKpiCutsStandard");
1166  SetTitle("Standard Cuts for D+s analysis");
1167 
1168  // PILE UP REJECTION
1170 
1171  // EVENT CUTS
1172  SetMinVtxContr(1);
1173 
1174  AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
1175  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1176  //default
1177  esdTrackCuts->SetRequireTPCRefit(kTRUE);
1178  esdTrackCuts->SetRequireITSRefit(kTRUE);
1179  //esdTrackCuts->SetMinNClustersITS(4); // default is 5
1180  esdTrackCuts->SetMinNClustersTPC(70);
1181  esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1182  AliESDtrackCuts::kAny);
1183  // default is kBoth, otherwise kAny
1184  esdTrackCuts->SetMinDCAToVertexXY(0.);
1185  esdTrackCuts->SetPtRange(0.3,1.e10);
1186 
1187  AddTrackCuts(esdTrackCuts);
1188  delete esdTrackCuts;
1189  esdTrackCuts=NULL;
1190 
1191 
1192  const Int_t nptbins=4;
1193  Float_t ptbins[nptbins+1];
1194  ptbins[0]=2.;
1195  ptbins[1]=4.;
1196  ptbins[2]=6.;
1197  ptbins[3]=8.;
1198  ptbins[4]=12.;
1199 
1200  const Int_t nvars=20;
1201 
1202  Float_t** anacutsval;
1203  anacutsval=new Float_t*[nvars];
1204 
1205  for(Int_t ic=0;ic<nvars;ic++){anacutsval[ic]=new Float_t[nptbins];}
1206  for(Int_t ipt=0;ipt<nptbins;ipt++){
1207 
1208  anacutsval[0][ipt]=0.35;
1209  anacutsval[1][ipt]=0.3;
1210  anacutsval[2][ipt]=0.3;
1211  anacutsval[3][ipt]=0.;
1212  anacutsval[4][ipt]=0.;
1213  anacutsval[5][ipt]=0.005;
1214  anacutsval[8][ipt]=0.;
1215  anacutsval[10][ipt]=0.;
1216  anacutsval[11][ipt]=1000.0;
1217  anacutsval[13][ipt]=0.1;
1218  anacutsval[16][ipt]=0.;
1219  anacutsval[17][ipt]=0.;
1220  anacutsval[18][ipt]=0.;
1221  anacutsval[19][ipt]=-1.;
1222 
1223 
1224  }
1225 
1226  //sigmavertex
1227 
1228  anacutsval[6][0]=0.020;
1229  anacutsval[6][1]=0.030;
1230  anacutsval[6][2]=0.030;
1231  anacutsval[6][3]=0.060;
1232 
1233  //Decay length
1234 
1235  anacutsval[7][0]=0.035;
1236  anacutsval[7][1]=0.035;
1237  anacutsval[7][2]=0.040;
1238  anacutsval[7][3]=0.040;
1239 
1240  //cosThetaPoint
1241 
1242  anacutsval[9][0]=0.94;
1243  anacutsval[9][1]=0.94;
1244  anacutsval[9][2]=0.94;
1245  anacutsval[9][3]=0.94;
1246 
1247  //phi DeltaMass
1248 
1249  anacutsval[12][0]=0.0080;
1250  anacutsval[12][1]=0.0050;
1251  anacutsval[12][2]=0.0045;
1252  anacutsval[12][3]=0.0090;
1253 
1254  //Kin1
1255 
1256  anacutsval[14][0]=0.10;
1257  anacutsval[14][1]=0.05;
1258  anacutsval[14][2]=0.0;
1259  anacutsval[14][3]=0.05;
1260 
1261  //Kin2
1262 
1263  anacutsval[15][0]=0.95;
1264  anacutsval[15][1]=0.95;
1265  anacutsval[15][2]=1.;
1266  anacutsval[15][3]=0.95;
1267 
1268  fPidHF->SetOldPid(kTRUE);
1269  SetUsePID(kTRUE);
1270  SetPidOption(1);
1271  SetMaxPtStrongPid(9999.);
1272  SetGlobalIndex(nvars,nptbins);
1273  SetPtBins(nptbins+1,ptbins);
1274  SetCuts(nvars,nptbins,anacutsval);
1276 
1277  // PrintAll();
1278 
1279  for(Int_t iic=0;iic<nvars;iic++){delete [] anacutsval[iic];}
1280  delete [] anacutsval;
1281  anacutsval=NULL;
1282 
1283  return;
1284 }
1285 
1286 Double_t AliRDHFCutsDstoKKpi::ComputeInvMass2(AliAODTrack* track1, AliAODTrack* track2, Int_t pdg1, Int_t pdg2) {
1287 
1288  Double_t mass1 = TDatabasePDG::Instance()->GetParticle(pdg1)->Mass();
1289  Double_t mass2 = TDatabasePDG::Instance()->GetParticle(pdg2)->Mass();
1290 
1291  Double_t px1 = track1->Px();
1292  Double_t py1 = track1->Py();
1293  Double_t pz1 = track1->Pz();
1294  Double_t px2 = track2->Px();
1295  Double_t py2 = track2->Py();
1296  Double_t pz2 = track2->Pz();
1297 
1298  Double_t E12 = TMath::Sqrt(mass1*mass1+px1*px1+py1*py1+pz1*pz1)+TMath::Sqrt(mass2*mass2+px2*px2+py2*py2+pz2*pz2);
1299 
1300  return E12*E12-((px1+px2)*(px1+px2)+(py1+py2)*(py1+py2)+(pz1+pz2)*(pz1+pz2));
1301 }
Double_t NormalizedDecayLengthXY() const
Double_t NormalizedDecayLength() const
void SetAsym(Bool_t asym)
Definition: AliAODPidHF.h:88
#define P(T, U, S)
double Double_t
Definition: External.C:58
AliRDHFCutsDstoKKpi(const char *name="CutsDstoKKpi")
Bool_t IsSignalMC(AliAODRecoDecay *d, AliAODEvent *aod, Int_t pdg) const
Double_t GetPCompatTOF() const
Definition: AliAODPidHF.h:154
void Getd0MeasMinusExpProng(Int_t ip, Double_t magf, Double_t &d0diff, Double_t &errd0diff) const
Int_t GetnSigmaTOF(AliAODTrack *track, Int_t species, Double_t &sigma) const
void SetTRD(Bool_t trd)
Definition: AliAODPidHF.h:97
void SetPidOption(Int_t opt)
Bool_t fRemoveDaughtersFromPrimary
Definition: AliRDHFCuts.h:442
Double_t fPhiMassRef
weight for piKK for kBayesianWeights
Int_t GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &sigma) const
void Setd0Cut(Int_t nPtBins, Float_t *cutval)
virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d, Float_t *vars, Int_t nvars, Int_t *pdgdaughters)
Double_t CosPiDsLabFrameKKpi() const
virtual Int_t IsSelectedPIDBayes(AliAODRecoDecayHF *rd)
Double_t ImpParXY() const
Double_t fWeightKKpi
Threshold for Bayesian PID probability.
Bool_t fUsed0MeasMinusExpCut
swicth to the usage of Reference Phi mass (instead of PDG value)
void SetPCompatTOF(Double_t pTOF)
Definition: AliAODPidHF.h:106
void SetNVars(Int_t nVars)
Definition: AliRDHFCuts.h:407
Double_t CosPointingAngleXY() const
Double_t fMaxRapidityCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:462
Float_t fMaxPtStrongPid
pid option
void SetGlobalIndex()
Definition: AliRDHFCuts.h:202
AliRDHFCuts & operator=(const AliRDHFCuts &source)
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
virtual Int_t IsSelectedPID(AliAODRecoDecayHF *rd)
Bool_t fUsePID
Definition: AliRDHFCuts.h:437
Double_t GetPtThresholdTPC()
Definition: AliAODPidHF.h:158
UInt_t GetPIDTrackTPCTOFBitMap(AliAODTrack *track) const
void SetTOF(Bool_t tof)
Definition: AliAODPidHF.h:95
Int_t fPidOption
switch for the cuts on phi and K0* inv. mass
Bool_t HasBadDaughters() const
const Int_t nPtBins
void SetMinVtxContr(Int_t contr=1)
Definition: AliRDHFCuts.h:60
int Int_t
Definition: External.C:63
Bool_t fUseTrackSelectionWithFilterBits
flag to reject kink daughters
Definition: AliRDHFCuts.h:472
void SetCuts(Int_t nVars, Int_t nPtBins, Float_t **cutsRD)
Int_t fnVarsForOpt
Definition: AliRDHFCuts.h:432
unsigned int UInt_t
Definition: External.C:33
AliPIDCombined * GetPidCombined() const
Definition: AliAODPidHF.h:161
void SetMaxPtStrongPid(Float_t spid)
float Float_t
Definition: External.C:68
const Double_t ptmax
void SetPtThresholdTPC(Double_t ptThresholdTPC)
Definition: AliAODPidHF.h:109
Double_t fMaxPtCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:461
Double_t CosPiKPhiRFrameKKpi() const
Double_t ComputeInvMass2(AliAODTrack *track1, AliAODTrack *track2, Int_t pdg1, Int_t pdg2)
AliAODVertex * GetOwnPrimaryVtx() const
Bool_t fKeepSignalMC
max rapidity of candidate (if !=-999 overrides IsInFiducialAcceptance)
Definition: AliRDHFCuts.h:463
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
Double_t GetSigmaVert(const AliAODEvent *aod=0x0)
virtual void SetStandardCutsPP2010()
AliRDHFCutsDstoKKpi & operator=(const AliRDHFCutsDstoKKpi &source)
Int_t fIsSelectedPID
outcome of cuts selection
Definition: AliRDHFCuts.h:459
Double_t nsigma
Int_t MakeRawPid(AliAODTrack *track, Int_t specie)
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
void SetSigma(Double_t *sigma)
Definition: AliAODPidHF.h:39
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:435
Double_t DecayLength2() const
kinematics & topology
Float_t fMaxPStrongPidK
Maximum pt of candidate to apply strong Pid p dependent.
Int_t fUsePreselect
Definition: AliRDHFCuts.h:488
Double_t CosPiDsLabFramepiKK() const
void SetVarsForOpt(Int_t nVars, Bool_t *forOpt)
Double_t DecayLengthXY() const
void SetVarNames(Int_t nVars, TString *varNames, Bool_t *isUpperCut)
Bool_t * fVarsForOpt
number of cut vars to be optimized for candidates
Definition: AliRDHFCuts.h:433
Bool_t AreDaughtersSelected(AliAODRecoDecayHF *rd, const AliAODEvent *aod=0x0) const
Double_t fWeightpiKK
weight for KKpi for kBayesianWeights
virtual Int_t PreSelect(TObjArray aodTracks)
Bool_t fUseRefPhiMass
Reference Phi mass to be used for the cut on delta phi mass (instead of PDG value) ...
Double_t fDistToMaxProb
Maximum P of track to apply strong Pid on pi.
Double_t fBayesThreshold
Difference between max probability.
Float_t * fMaxd0MeasMinusExp
switch for cut on d0meas-d0exp
void SetUsePID(Bool_t flag=kTRUE)
Definition: AliRDHFCuts.h:210
void CleanOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod, AliAODVertex *origownvtx) const
void SetRemoveDaughtersFromPrim(Bool_t removeDaughtersPrim)
Definition: AliRDHFCuts.h:220
Float_t fMaxPStrongPidpi
Maximum P of track to apply strong Pid on K.
void SetOldPid(Bool_t oldPid)
Definition: AliAODPidHF.h:108
void SetPtBins(Int_t nPtBinLimits, Float_t *ptBinLimits)
Float_t * fMaxd0
switch for cut on d0
void SetITS(Bool_t its)
Definition: AliAODPidHF.h:96
void SetMatch(Int_t match)
Definition: AliAODPidHF.h:98
void AddTrackCuts(const AliESDtrackCuts *cuts)
Definition: AliRDHFCuts.h:208
void SetPLimit(Double_t *plim, Int_t npLim)
void SetTPC(Bool_t tpc)
Definition: AliAODPidHF.h:94
bool Bool_t
Definition: External.C:53
Double_t CosPointingAngle() const
Int_t fnPtBins
cuts on the candidate
Definition: AliRDHFCuts.h:427
void SetCompat(Bool_t comp)
Definition: AliAODPidHF.h:100
AliAODPidHF * fPidHF
enable AOD049 centrality cleanup
Definition: AliRDHFCuts.h:439
void Setd0MeasMinusExpCut(Int_t nPtBins, Float_t *cutval)
Bool_t RecalcOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod) const
Int_t PtBin(Double_t pt) const
void SetOptPileup(Int_t opt=0)
Definition: AliRDHFCuts.h:224
Int_t GetGlobalIndex(Int_t iVar, Int_t iPtBin) const
Double_t DecayLength() const
Double_t CosPiKPhiRFramepiKK() const
Int_t nptbins
Double_t fMinPtCand
outcome of PID selection
Definition: AliRDHFCuts.h:460