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