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