AliPhysics  a3be53f (a3be53f)
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 
541  if(!fUsePID || !track[0] || !track[1] || !track[2]) return retCode;
542 
543  Int_t sign = track[0]->Charge();
544  if(!fPidHF){
545  AliWarning("AliAODPidHF not created!");
546  return retCode;
547  }
549  AliWarning("Wrong call to Bayesian PID");
550  return retCode;
551  }
552 
553  AliPIDCombined* copid=fPidHF->GetPidCombined();
554  copid->SetDetectorMask(AliPIDResponse::kDetTPC | AliPIDResponse::kDetTOF);
555  AliPIDResponse* pidres=fPidHF->GetPidResponse();
556  Double_t bayesProb[AliPID::kSPECIES];
557  Int_t nKaons=0;
558  Int_t nNotKaons=0;
559  fWeightKKpi=1.;
560  fWeightpiKK=1.;
561  for(Int_t iDaught=0; iDaught<3; iDaught++){
562 
563  Int_t isPion=0;
564  Int_t isKaon=0;
565  Int_t isProton=0;
566  UInt_t usedDet=copid->ComputeProbabilities(track[iDaught],pidres,bayesProb);
567  if(usedDet!=0){
569  Double_t maxProb=TMath::MaxElement(AliPID::kSPECIES,bayesProb);
570  if(TMath::Abs(maxProb-bayesProb[AliPID::kPion])<fDistToMaxProb) isPion=1;
571  else isPion=-1;
572  if(TMath::Abs(maxProb-bayesProb[AliPID::kKaon])<fDistToMaxProb) isKaon=1;
573  else isKaon=-1;
574  if(TMath::Abs(maxProb-bayesProb[AliPID::kProton])<fDistToMaxProb) isProton=1;
575  else isProton=-1;
576  }
578  if(bayesProb[AliPID::kPion]>fBayesThreshold) isPion=1;
579  else isPion=-1;
580  if(bayesProb[AliPID::kKaon]>fBayesThreshold) isKaon=1;
581  else isKaon=-1;
582  if(bayesProb[AliPID::kProton]>fBayesThreshold) isProton=1;
583  else isProton=-1;
584  }
585  }
586  if(fPidOption==kBayesianWeights){ // store the probabilities in the case kBayesianWeights
587  if(iDaught==0){
588  fWeightKKpi*=bayesProb[AliPID::kKaon];
589  fWeightpiKK*=bayesProb[AliPID::kPion];
590  }else if(iDaught==1){
591  fWeightKKpi*=bayesProb[AliPID::kKaon];
592  fWeightpiKK*=bayesProb[AliPID::kKaon];
593  }else if(iDaught==2){
594  fWeightKKpi*=bayesProb[AliPID::kPion];
595  fWeightpiKK*=bayesProb[AliPID::kKaon];
596  }
597  }else{ // selection for the other cases
598  if(isProton>0 && isKaon<0 && isPion<0) return 0;
599  if(sign!=track[iDaught]->Charge()){// must be kaon
600  if(isKaon<0) return 0;
601  }
602  if(isKaon>0 && isPion<0) nKaons++;
603  if(isKaon<0) nNotKaons++;
604  if(iDaught==0){
605  if(isKaon<0) okKKpi=kFALSE;
606  if(isPion<0) okpiKK=kFALSE;
607  }else if(iDaught==2){
608  if(isKaon<0) okpiKK=kFALSE;
609  if(isPion<0) okKKpi=kFALSE;
610  }
611  }
612  }
613  if(fPidOption==kBayesianWeights) return retCode;
614 
615  if(nKaons>2)return 0;
616  if(nNotKaons>1) return 0;
617 
618  if(!okKKpi) retCode-=1;
619  if(!okpiKK) retCode-=2;
620 
621  return retCode;
622 }
623 
624 //---------------------------------------------------------------------------
626  // PID selection
627  // return values: 0->NOT OK, 1->OK as KKpi, 2->OK as piKK, 3->OK as both
628  Int_t retCode=3;
629  if(!fUsePID) return retCode;
630  if(rd) {
631  Double_t Pt = rd->Pt();
632  TObjArray aodtracks(3);
633  for(Int_t iDaught=0; iDaught<3; iDaught++) {
634  aodtracks.AddAt(rd->GetDaughter(iDaught),iDaught);
635  }
636  retCode = IsSelectedPID(Pt,aodtracks);
637  }
638 
639  return retCode;
640 }
641 
642 //---------------------------------------------------------------------------
644  // PID selection
645  // return values: 0->NOT OK, 1->OK as KKpi, 2->OK as piKK, 3->OK as both
646 
647  Int_t retCode=3;
648  Bool_t okKKpi=kTRUE;
649  Bool_t okpiKK=kTRUE;
650 
651  AliAODTrack *track[3];
652  for(Int_t iDaught=0; iDaught<3; iDaught++){
653  track[iDaught]=(AliAODTrack*)aodtracks.At(iDaught);
654  }
655 
656  if(!fUsePID || !track[0] || !track[1] || !track[2]) return retCode;
657 
658  Int_t sign = track[0]->Charge();
659  if(!fPidHF){
660  AliWarning("AliAODPidHF not created!");
661  return retCode;
662  }
664  // call method for Bayesian probability
665  return IsSelectedPIDBayes(Pt,aodtracks);
666  }
667 
668  Double_t origCompatTOF=fPidHF->GetPCompatTOF();
669  Double_t origThreshTPC=fPidHF->GetPtThresholdTPC();
670  if(fPidOption==kStrong){
671  fPidHF->SetPCompatTOF(999999.);
672  fPidHF->SetPtThresholdTPC(999999.);
673  }
674 
675  Int_t nKaons=0;
676  Int_t nNotKaons=0;
677  for(Int_t iDaught=0; iDaught<3; iDaught++){
678 
679  Int_t isPion=fPidHF->MakeRawPid(track[iDaught],AliPID::kPion);
680  Int_t isKaon=fPidHF->MakeRawPid(track[iDaught],AliPID::kKaon);
681  Int_t isProton=fPidHF->MakeRawPid(track[iDaught],AliPID::kProton);
682 
683  if(isProton>0 && isKaon<0 && isPion<0){
684  fPidHF->SetPCompatTOF(origCompatTOF);
685  fPidHF->SetPtThresholdTPC(origThreshTPC);
686  return 0;
687  }
688  if(sign!=track[iDaught]->Charge()){// must be kaon
689  if(isKaon<0){
690  fPidHF->SetPCompatTOF(origCompatTOF);
691  fPidHF->SetPtThresholdTPC(origThreshTPC);
692  return 0;
693  }
694  if(fPidOption==kStrong && Pt<fMaxPtStrongPid && isKaon<=0){
695  fPidHF->SetPCompatTOF(origCompatTOF);
696  fPidHF->SetPtThresholdTPC(origThreshTPC);
697  return 0;
698  }
700  if(isKaon<=0 && track[iDaught]->P()<fMaxPStrongPidK) return 0;
701  }
702  }
703 
704  if(isKaon>0 && isPion<0) nKaons++;
705  if(isKaon<0) nNotKaons++;
706  if(iDaught==0){
707  if(isKaon<0) okKKpi=kFALSE;
708  if(isPion<0) okpiKK=kFALSE;
710  if(isKaon<=0) okKKpi=kFALSE;
711  if(isPion<=0) okpiKK=kFALSE;
712  }
714  if(isKaon<=0 && track[iDaught]->P()<fMaxPStrongPidK) okKKpi=kFALSE;
715  if(isPion<=0 && track[iDaught]->P()<fMaxPStrongPidpi) okpiKK=kFALSE;
716  }
717  }
718  else if(iDaught==2){
719  if(isKaon<0) okpiKK=kFALSE;
720  if(isPion<0) okKKpi=kFALSE;
722  if(isKaon<=0) okpiKK=kFALSE;
723  if(isPion<=0) okKKpi=kFALSE;
724  }
726  if(isKaon<=0 && track[iDaught]->P()<fMaxPStrongPidK) okpiKK=kFALSE;
727  if(isPion<=0 && track[iDaught]->P()<fMaxPStrongPidpi) okKKpi=kFALSE;
728  }
729  }
730  }
731 
732  fPidHF->SetPCompatTOF(origCompatTOF);
733  fPidHF->SetPtThresholdTPC(origThreshTPC);
734 
735  if(nKaons>2)return 0;
736  if(nNotKaons>1) return 0;
737 
738  if(!okKKpi) retCode-=1;
739  if(!okpiKK) retCode-=2;
740 
741  return retCode;
742 }
743 
744 //---------------------------------------------------------------------------
746  //
747  // Apply selection
748  //
749 
750  if(!fCutsRD){
751  cout<<"Cut matrix not inizialized. Exit..."<<endl;
752  return 0;
753  }
754  //PrintAll();
756 
757  if(!d){
758  cout<<"AliAODRecoDecayHF3Prong null"<<endl;
759  return 0;
760  }
761 
762  if(fKeepSignalMC) if(IsSignalMC(d,aod,431)) return 3;
763 
764  Double_t ptD=d->Pt();
765  if(ptD<fMinPtCand) return 0;
766  if(ptD>fMaxPtCand) return 0;
767 
769 
770 
771  // selection on daughter tracks
772  if(selectionLevel==AliRDHFCuts::kAll ||
773  selectionLevel==AliRDHFCuts::kTracks) {
774  if(!AreDaughtersSelected(d,aod)) return 0;
775  }
776 
777 
778 
779 
780  // selection on candidate
781  if(selectionLevel==AliRDHFCuts::kAll ||
782  selectionLevel==AliRDHFCuts::kCandidate) {
783  //recalculate vertex w/o daughters
784  AliAODVertex *origownvtx=0x0;
786  if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
787  if(!RecalcOwnPrimaryVtx(d,aod)) {
788  CleanOwnPrimaryVtx(d,aod,origownvtx);
789  return 0;
790  }
791  }
792 
793  Int_t okDsKKpi=1;
794  Int_t okDspiKK=1;
795  Int_t okMassPhiKKpi=0;
796  Int_t okMassPhipiKK=0;
797  Int_t okMassK0starKKpi=0;
798  Int_t okMassK0starpiKK=0;
799  Int_t okDsPhiKKpi=0;
800  Int_t okDsPhipiKK=0;
801  Int_t okDsK0starKKpi=0;
802  Int_t okDsK0starpiKK=0;
803 
804  Double_t pt=d->Pt();
805  Int_t ptbin=PtBin(pt);
806  if (ptbin==-1) {
807  CleanOwnPrimaryVtx(d,aod,origownvtx);
808  return 0;
809  }
810 
811  Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
812  Double_t mDsKKpi=d->InvMassDsKKpi();
813  Double_t mDspiKK=d->InvMassDspiKK();
814  if(TMath::Abs(mDsKKpi-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDsKKpi = 0;
815  if(TMath::Abs(mDspiKK-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDspiKK = 0;
816  if(!okDsKKpi && !okDspiKK){
817  CleanOwnPrimaryVtx(d,aod,origownvtx);
818  return 0;
819  }
820 
821 
822 
823  // cuts on resonant decays (via Phi or K0*)
824  if(fCutOnResonances){
825  Double_t mPhiPDG = TDatabasePDG::Instance()->GetParticle(333)->Mass();
826  Double_t mK0starPDG = TDatabasePDG::Instance()->GetParticle(313)->Mass();
827  Double_t mPhiRef = mPhiPDG;
828  if(fUseRefPhiMass) mPhiRef = fPhiMassRef;
829  if(okDsKKpi){
830  Double_t mass01phi=d->InvMass2Prongs(0,1,321,321);
831  if(TMath::Abs(mass01phi-mPhiRef)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhiKKpi=1;
832  if(fCheckK0star){
833  Double_t mass12K0s=d->InvMass2Prongs(1,2,321,211);
834  if(TMath::Abs(mass12K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0starKKpi = 1;
835  }
836  if(!okMassPhiKKpi && !okMassK0starKKpi) okDsKKpi=0;
837  if(okMassPhiKKpi) okDsPhiKKpi=1;
838  if(okMassK0starKKpi) okDsK0starKKpi=1;
839  }
840  if(okDspiKK){
841  if(fCheckK0star){
842  Double_t mass01K0s=d->InvMass2Prongs(0,1,211,321);
843  if(TMath::Abs(mass01K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0starpiKK = 1;
844  }
845  Double_t mass12phi=d->InvMass2Prongs(1,2,321,321);
846  if(TMath::Abs(mass12phi-mPhiRef)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhipiKK=1;
847  if(!okMassPhipiKK && !okMassK0starpiKK) okDspiKK=0;
848  if(okMassPhipiKK) okDsPhipiKK=1;
849  if(okMassK0starpiKK) okDsK0starpiKK=1;
850  }
851  if(!okDsKKpi && !okDspiKK){
852  CleanOwnPrimaryVtx(d,aod,origownvtx);
853  return 0;
854  }
855  }
856 
857  // Cuts on track pairs
858  for(Int_t i=0;i<3;i++){
859  if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]){
860  CleanOwnPrimaryVtx(d,aod,origownvtx);
861  return 0;
862  }
863  }
864  if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)] ||
865  d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]){
866  CleanOwnPrimaryVtx(d,aod,origownvtx);
867  return 0;
868  }
869 
870 
871 
872  //single track
873  if(TMath::Abs(d->Pt2Prong(1)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
874  TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]){
875  CleanOwnPrimaryVtx(d,aod,origownvtx);
876  return 0;
877  }
878 
879  if(okDsKKpi){
880  if(TMath::Abs(d->Pt2Prong(0)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
881  TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDsKKpi=0;
882  if(TMath::Abs(d->Pt2Prong(2)) < fCutsRD[GetGlobalIndex(2,ptbin)]*fCutsRD[GetGlobalIndex(2,ptbin)] ||
883  TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDsKKpi=0;
884  }
885  if(okDspiKK){
886  if(TMath::Abs(d->Pt2Prong(0)) < fCutsRD[GetGlobalIndex(2,ptbin)]*fCutsRD[GetGlobalIndex(2,ptbin)] ||
887  TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDspiKK=0;
888  if(TMath::Abs(d->Pt2Prong(2)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
889  TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDspiKK=0;
890  }
891  if(!okDsKKpi && !okDspiKK){
892  CleanOwnPrimaryVtx(d,aod,origownvtx);
893  return 0;
894  }
895 
896  // Cuts on candidate triplet
897 
898 
899  if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)]){
900  CleanOwnPrimaryVtx(d,aod,origownvtx);
901  return 0;
902  }
903 
904  if(d->Pt2Prong(0)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)] &&
905  d->Pt2Prong(1)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)] &&
906  d->Pt2Prong(2)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)]) {
907  CleanOwnPrimaryVtx(d,aod,origownvtx);
908  return 0;
909  }
910 
911  if(d->DecayLength2()<fCutsRD[GetGlobalIndex(7,ptbin)]*fCutsRD[GetGlobalIndex(7,ptbin)]){
912  CleanOwnPrimaryVtx(d,aod,origownvtx);
913  return 0;
914  }
915 
916 
917  Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
918  if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)]){
919  CleanOwnPrimaryVtx(d,aod,origownvtx);
920  return 0;
921  }
922 
923 
924  //sec vert
925  Double_t sigmavert=d->GetSigmaVert(aod);
926  if(sigmavert>fCutsRD[GetGlobalIndex(6,ptbin)]){
927  CleanOwnPrimaryVtx(d,aod,origownvtx);
928  return 0;
929  }
930 
931  // decay length XY
932  if(d->DecayLengthXY()<fCutsRD[GetGlobalIndex(16,ptbin)]){
933  CleanOwnPrimaryVtx(d,aod,origownvtx);
934  return 0;
935  }
936 
937  //norm decay length
938  if(d->NormalizedDecayLength()<fCutsRD[GetGlobalIndex(17,ptbin)]){
939  CleanOwnPrimaryVtx(d,aod,origownvtx);
940  return 0;
941  }
942 
943  //norm decay length XY
944  if(d->NormalizedDecayLengthXY()<fCutsRD[GetGlobalIndex(18,ptbin)]){
945  CleanOwnPrimaryVtx(d,aod,origownvtx);
946  return 0;
947  }
948 
949  //cos pointing XY
950  if(d->CosPointingAngleXY()<fCutsRD[GetGlobalIndex(19,ptbin)]){
951  CleanOwnPrimaryVtx(d,aod,origownvtx);
952  return 0;
953  }
954 
955 
956  if(okDsKKpi){
957  Double_t cosPiKPhiRFKKpi=d->CosPiKPhiRFrameKKpi();
958  Double_t kincutPiKPhiKKpi=TMath::Abs(cosPiKPhiRFKKpi*cosPiKPhiRFKKpi*cosPiKPhiRFKKpi);
959  if(kincutPiKPhiKKpi<fCutsRD[GetGlobalIndex(14,ptbin)]) okDsKKpi=0;
960  }
961  if(okDspiKK){
962  Double_t cosPiKPhiRFpiKK=d->CosPiKPhiRFramepiKK();
963  Double_t kincutPiKPhipiKK=TMath::Abs(cosPiKPhiRFpiKK*cosPiKPhiRFpiKK*cosPiKPhiRFpiKK);
964  if(kincutPiKPhipiKK<fCutsRD[GetGlobalIndex(14,ptbin)]) okDspiKK=0;
965  }
966  if(!okDsKKpi && !okDspiKK){
967  CleanOwnPrimaryVtx(d,aod,origownvtx);
968  return 0;
969  }
970 
971 
972 
973  if(okDsKKpi){
974  Double_t cosPiDsLabFrameKKpi=d->CosPiDsLabFrameKKpi();
975  if(cosPiDsLabFrameKKpi>fCutsRD[GetGlobalIndex(15,ptbin)]) okDsKKpi=0;
976  }
977  if(okDspiKK){
978  Double_t cosPiDsLabFramepiKK=d->CosPiDsLabFramepiKK();
979  if(cosPiDsLabFramepiKK>fCutsRD[GetGlobalIndex(15,ptbin)]) okDspiKK=0;
980  }
981  if(!okDsKKpi && !okDspiKK){
982  CleanOwnPrimaryVtx(d,aod,origownvtx);
983  return 0;
984  }
985 
986  // d0meas-exp
988  Double_t dd0max=0;
989  for(Int_t ipr=0; ipr<3; ipr++) {
990  Double_t diffIP, errdiffIP;
991  d->Getd0MeasMinusExpProng(ipr,aod->GetMagneticField(),diffIP,errdiffIP);
992  Double_t normdd0=0.;
993  if(errdiffIP>0) normdd0=diffIP/errdiffIP;
994  if(ipr==0) dd0max=normdd0;
995  else if(TMath::Abs(normdd0)>TMath::Abs(dd0max)) dd0max=normdd0;
996  }
997  if(TMath::Abs(dd0max)>fMaxd0MeasMinusExp[ptbin]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
998  }
999 
1000  // d0
1001  if(fUsed0Cut){
1002  Double_t d0=d->ImpParXY()*10000.;
1003  if(TMath::Abs(d0)>fMaxd0[ptbin]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
1004  }
1005 
1006 
1007  // unset recalculated primary vertex when not needed any more
1008  CleanOwnPrimaryVtx(d,aod,origownvtx);
1009 
1010 
1011 
1012  if(!okDsKKpi){
1013  okDsPhiKKpi=0;
1014  okDsK0starKKpi=0;
1015  }
1016  if(!okDspiKK){
1017  okDsPhipiKK=0;
1018  okDsK0starpiKK=0;
1019  }
1020 
1021  // PID selection
1022  Int_t returnvaluePID=3;
1023  if(selectionLevel==AliRDHFCuts::kAll ||
1024  selectionLevel==AliRDHFCuts::kCandidate ||
1025  selectionLevel==AliRDHFCuts::kPID) {
1026  returnvaluePID = IsSelectedPID(d);
1027  fIsSelectedPID=returnvaluePID;
1028  }
1029  if(returnvaluePID==0)return 0;
1030 
1031  Bool_t okPidDsKKpi=returnvaluePID&1;
1032  Bool_t okPidDspiKK=returnvaluePID&2;
1033  if(!okPidDsKKpi){
1034  okDsPhiKKpi=0;
1035  okDsK0starKKpi=0;
1036  }
1037  if(!okPidDspiKK){
1038  okDsPhipiKK=0;
1039  okDsK0starpiKK=0;
1040  }
1041 
1042  if((okPidDsKKpi && okDsKKpi)||(okPidDspiKK && okDspiKK)){
1043  Int_t returnvalue=0;
1044  if(okDsKKpi) returnvalue+=1;
1045  if(okDspiKK) returnvalue+=2;
1046  if(okDsPhiKKpi) returnvalue+=4;
1047  if(okDsPhipiKK) returnvalue+=8;
1048  if(okDsK0starKKpi) returnvalue+=16;
1049  if(okDsK0starpiKK) returnvalue+=32;
1050  return returnvalue;
1051  }else{
1052  return 0;
1053  }
1054  }
1055  return 15;
1056 
1057 }
1058 
1059 //--------------------------------------------------------------------------
1060 
1062 
1063  UInt_t bitmap=0;
1064 
1065  Double_t sigmaTPCPionHyp=-999.;
1066  Double_t sigmaTPCKaonHyp=-999.;
1067  Double_t sigmaTPCProtonHyp=-999.;
1068  Double_t sigmaTOFPionHyp=-999.;
1069  Double_t sigmaTOFKaonHyp=-999.;
1070  Double_t sigmaTOFProtonHyp=-999.;
1071 
1072  Int_t oksigmaTPCPionHyp=fPidHF->GetnSigmaTPC(track,2,sigmaTPCPionHyp);
1073  Int_t oksigmaTPCKaonHyp=fPidHF->GetnSigmaTPC(track,3,sigmaTPCKaonHyp);
1074  Int_t oksigmaTPCProtonHyp=fPidHF->GetnSigmaTPC(track,4,sigmaTPCProtonHyp);
1075  Int_t oksigmaTOFPionHyp=fPidHF->GetnSigmaTOF(track,2,sigmaTOFPionHyp);
1076  Int_t oksigmaTOFKaonHyp=fPidHF->GetnSigmaTOF(track,3,sigmaTOFKaonHyp);
1077  Int_t oksigmaTOFProtonHyp=fPidHF->GetnSigmaTOF(track,4,sigmaTOFProtonHyp);
1078 
1079  sigmaTPCPionHyp=TMath::Abs(sigmaTPCPionHyp);
1080  sigmaTPCKaonHyp=TMath::Abs(sigmaTPCKaonHyp);
1081  sigmaTPCProtonHyp=TMath::Abs(sigmaTPCProtonHyp);
1082  sigmaTOFPionHyp=TMath::Abs(sigmaTOFPionHyp);
1083  sigmaTOFKaonHyp=TMath::Abs(sigmaTOFKaonHyp);
1084  sigmaTOFProtonHyp=TMath::Abs(sigmaTOFProtonHyp);
1085 
1086  if (oksigmaTPCPionHyp && sigmaTPCPionHyp>0.){
1087  if (sigmaTPCPionHyp<1.) bitmap+=1<<kTPCPionLess1;
1088  else{
1089  if (sigmaTPCPionHyp<2.) bitmap+=1<<kTPCPionMore1Less2;
1090  else {
1091  if (sigmaTPCPionHyp<3.) bitmap+=1<<kTPCPionMore2Less3;
1092  else bitmap+=1<<kTPCPionMore3;
1093  }
1094  }
1095  }
1096 
1097  if (oksigmaTPCKaonHyp && sigmaTPCKaonHyp>0.){
1098  if (sigmaTPCKaonHyp<1.) bitmap+=1<<kTPCKaonLess1;
1099  else{
1100  if (sigmaTPCKaonHyp<2.) bitmap+=1<<kTPCKaonMore1Less2;
1101  else {
1102  if (sigmaTPCKaonHyp<3.) bitmap+=1<<kTPCKaonMore2Less3;
1103  else bitmap+=1<<kTPCKaonMore3;
1104  }
1105  }
1106  }
1107 
1108  if (oksigmaTPCProtonHyp && sigmaTPCProtonHyp>0.){
1109  if (sigmaTPCProtonHyp<1.) bitmap+=1<<kTPCProtonLess1;
1110  else{
1111  if (sigmaTPCProtonHyp<2.) bitmap+=1<<kTPCProtonMore1Less2;
1112  else {
1113  if (sigmaTPCProtonHyp<3.) bitmap+=1<<kTPCProtonMore2Less3;
1114  else bitmap+=1<<kTPCProtonMore3;
1115  }
1116  }
1117  }
1118 
1119  if (oksigmaTOFPionHyp && sigmaTOFPionHyp>0.){
1120  if (sigmaTOFPionHyp<1.) bitmap+=1<<kTOFPionLess1;
1121  else{
1122  if (sigmaTOFPionHyp<2.) bitmap+=1<<kTOFPionMore1Less2;
1123  else {
1124  if (sigmaTOFPionHyp<3.) bitmap+=1<<kTOFPionMore2Less3;
1125  else bitmap+=1<<kTOFPionMore3;
1126  }
1127  }
1128  }
1129 
1130  if (oksigmaTOFKaonHyp && sigmaTOFKaonHyp>0.){
1131  if (sigmaTOFKaonHyp<1.) bitmap+=1<<kTOFKaonLess1;
1132  else{
1133  if (sigmaTOFKaonHyp<2.) bitmap+=1<<kTOFKaonMore1Less2;
1134  else {
1135  if (sigmaTOFKaonHyp<3.) bitmap+=1<<kTOFKaonMore2Less3;
1136  else bitmap+=1<<kTOFKaonMore3;
1137  }
1138  }
1139  }
1140 
1141  if (oksigmaTOFProtonHyp && sigmaTOFProtonHyp>0.){
1142  if (sigmaTOFProtonHyp<1.) bitmap+=1<<kTOFProtonLess1;
1143  else{
1144  if (sigmaTOFProtonHyp<2.) bitmap+=1<<kTOFProtonMore1Less2;
1145  else {
1146  if (sigmaTOFProtonHyp<3.) bitmap+=1<<kTOFProtonMore2Less3;
1147  else bitmap+=1<<kTOFProtonMore3;
1148  }
1149  }
1150  }
1151 
1152 
1153 
1154  return bitmap;
1155 
1156 }
1157 
1158 
1159 //---------------------------------------------------------------------------
1160 
1162  //
1163  //STANDARD CUTS USED FOR 2010 pp analysis
1164  //
1165 
1166  SetName("DstoKKpiCutsStandard");
1167  SetTitle("Standard Cuts for D+s analysis");
1168 
1169  // PILE UP REJECTION
1171 
1172  // EVENT CUTS
1173  SetMinVtxContr(1);
1174 
1175  AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
1176  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1177  //default
1178  esdTrackCuts->SetRequireTPCRefit(kTRUE);
1179  esdTrackCuts->SetRequireITSRefit(kTRUE);
1180  //esdTrackCuts->SetMinNClustersITS(4); // default is 5
1181  esdTrackCuts->SetMinNClustersTPC(70);
1182  esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1183  AliESDtrackCuts::kAny);
1184  // default is kBoth, otherwise kAny
1185  esdTrackCuts->SetMinDCAToVertexXY(0.);
1186  esdTrackCuts->SetPtRange(0.3,1.e10);
1187 
1188  AddTrackCuts(esdTrackCuts);
1189  delete esdTrackCuts;
1190  esdTrackCuts=NULL;
1191 
1192 
1193  const Int_t nptbins=4;
1194  Float_t ptbins[nptbins+1];
1195  ptbins[0]=2.;
1196  ptbins[1]=4.;
1197  ptbins[2]=6.;
1198  ptbins[3]=8.;
1199  ptbins[4]=12.;
1200 
1201  const Int_t nvars=20;
1202 
1203  Float_t** anacutsval;
1204  anacutsval=new Float_t*[nvars];
1205 
1206  for(Int_t ic=0;ic<nvars;ic++){anacutsval[ic]=new Float_t[nptbins];}
1207  for(Int_t ipt=0;ipt<nptbins;ipt++){
1208 
1209  anacutsval[0][ipt]=0.35;
1210  anacutsval[1][ipt]=0.3;
1211  anacutsval[2][ipt]=0.3;
1212  anacutsval[3][ipt]=0.;
1213  anacutsval[4][ipt]=0.;
1214  anacutsval[5][ipt]=0.005;
1215  anacutsval[8][ipt]=0.;
1216  anacutsval[10][ipt]=0.;
1217  anacutsval[11][ipt]=1000.0;
1218  anacutsval[13][ipt]=0.1;
1219  anacutsval[16][ipt]=0.;
1220  anacutsval[17][ipt]=0.;
1221  anacutsval[18][ipt]=0.;
1222  anacutsval[19][ipt]=-1.;
1223 
1224 
1225  }
1226 
1227  //sigmavertex
1228 
1229  anacutsval[6][0]=0.020;
1230  anacutsval[6][1]=0.030;
1231  anacutsval[6][2]=0.030;
1232  anacutsval[6][3]=0.060;
1233 
1234  //Decay length
1235 
1236  anacutsval[7][0]=0.035;
1237  anacutsval[7][1]=0.035;
1238  anacutsval[7][2]=0.040;
1239  anacutsval[7][3]=0.040;
1240 
1241  //cosThetaPoint
1242 
1243  anacutsval[9][0]=0.94;
1244  anacutsval[9][1]=0.94;
1245  anacutsval[9][2]=0.94;
1246  anacutsval[9][3]=0.94;
1247 
1248  //phi DeltaMass
1249 
1250  anacutsval[12][0]=0.0080;
1251  anacutsval[12][1]=0.0050;
1252  anacutsval[12][2]=0.0045;
1253  anacutsval[12][3]=0.0090;
1254 
1255  //Kin1
1256 
1257  anacutsval[14][0]=0.10;
1258  anacutsval[14][1]=0.05;
1259  anacutsval[14][2]=0.0;
1260  anacutsval[14][3]=0.05;
1261 
1262  //Kin2
1263 
1264  anacutsval[15][0]=0.95;
1265  anacutsval[15][1]=0.95;
1266  anacutsval[15][2]=1.;
1267  anacutsval[15][3]=0.95;
1268 
1269  fPidHF->SetOldPid(kTRUE);
1270  SetUsePID(kTRUE);
1271  SetPidOption(1);
1272  SetMaxPtStrongPid(9999.);
1273  SetGlobalIndex(nvars,nptbins);
1274  SetPtBins(nptbins+1,ptbins);
1275  SetCuts(nvars,nptbins,anacutsval);
1277 
1278  // PrintAll();
1279 
1280  for(Int_t iic=0;iic<nvars;iic++){delete [] anacutsval[iic];}
1281  delete [] anacutsval;
1282  anacutsval=NULL;
1283 
1284  return;
1285 }
1286 
1287 Double_t AliRDHFCutsDstoKKpi::ComputeInvMass2(AliAODTrack* track1, AliAODTrack* track2, Int_t pdg1, Int_t pdg2) {
1288 
1289  Double_t mass1 = TDatabasePDG::Instance()->GetParticle(pdg1)->Mass();
1290  Double_t mass2 = TDatabasePDG::Instance()->GetParticle(pdg2)->Mass();
1291 
1292  Double_t px1 = track1->Px();
1293  Double_t py1 = track1->Py();
1294  Double_t pz1 = track1->Pz();
1295  Double_t px2 = track2->Px();
1296  Double_t py2 = track2->Py();
1297  Double_t pz2 = track2->Pz();
1298 
1299  Double_t E12 = TMath::Sqrt(mass1*mass1+px1*px1+py1*py1+pz1*pz1)+TMath::Sqrt(mass2*mass2+px2*px2+py2*py2+pz2*pz2);
1300 
1301  return E12*E12-((px1+px2)*(px1+px2)+(py1+py2)*(py1+py2)+(pz1+pz2)*(pz1+pz2));
1302 }
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