AliPhysics  4c9ecbb (4c9ecbb)
AliRDHFCutsDstoK0sK.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->K0S+K
21 //
22 // Author: J.Hamon, julien.hamon@cern.ch (IPHC)
23 //
25 
26 #include <Riostream.h>
27 #include <TDatabasePDG.h>
28 #include <TMath.h>
29 
30 #include "AliAnalysisManager.h"
31 #include "AliInputEventHandler.h"
32 #include "AliAODPidHF.h"
33 #include "AliRDHFCutsDstoK0sK.h"
34 #include "AliAODRecoCascadeHF.h"
35 #include "AliAODTrack.h"
36 #include "AliAODv0.h"
37 #include "AliAODVertex.h"
38 #include "AliESDtrack.h"
39 #include "AliESDv0.h"
40 #include "AliESDVertex.h"
41 
42 
44 ClassImp(AliRDHFCutsDstoK0sK);
46 
47 
48 
49 
50 //--------------------------------------------------------------------------
52 AliRDHFCuts(name)
53  , fExcludedCut(-1)
54  , fV0Type(0)
55  , fV0daughtersCuts(0)
56  , fPidOption(1)
57  , fMaxPtStrongPid(0)
58 {
59  //
61  //
62 
63  const Int_t nvars = 16;
64  SetNVars(nvars);
65  TString varNames[nvars] = { "Inv. Mass Ds -> K0s+K [GeV/c2]", // 0
66  "Inv. Mass K0s [GeV/c2]", // 1 -------- K0S reconstruction --------
67  "K0s reco: min pT V0-daughters [GeV/c]", // 2
68  "K0s reco: max DCA V0 (prong-to-prong) [sigma]", // 3
69  "K0s reco: min d0(xy) V0-daughters [cm]", // 4
70  "K0s reco: min cosPointing (3D) V0", // 5
71  "K0s reco: min fiducial radius (xy) [cm]", // 6
72  "min pT bachelor track [GeV/c]", // 7 ------ Cascade reconstruction ------
73  "min pT V0 track [GeV/c]", // 8
74  "max d0(xy) bachelor wrt PV [cm]", // 9
75  "max d0(xy) V0 wrt PV [cm]", // 10
76  "max cosThetaStar Ds daughters", // 11
77  "min cosPointing (3D) cascade daughters", // 12
78  "min |cosPointing| (xy) cascade daughters", // 13
79  "min decay length (xy) cascade [cm]", // 14
80  "V0 type" // 15
81  };
82 
83 
84  Bool_t isUpperCut[nvars] = { kTRUE, // 0
85  kTRUE, // 1 -------- K0S reconstruction --------
86  kFALSE, // 2
87  kTRUE, // 3
88  kFALSE, // 4
89  kFALSE, // 5
90  kFALSE, // 6
91  kFALSE, // 7 ------ Cascade reconstruction ------
92  kFALSE, // 8
93  kTRUE, // 9
94  kTRUE, // 10
95  kTRUE, // 11
96  kFALSE, // 12
97  kFALSE, // 13
98  kFALSE, // 14
99  kFALSE // 15
100  };
101  SetVarNames(nvars, varNames, isUpperCut);
102 
103 
104  Float_t limits[2] = {0, 999999999.};
105  SetPtBins(2, limits);
106 
107 
108  // PID settings
109  Double_t nsigma[5] = {2., 1., 2., 3., 0.}; // 0-2 for TPC, 3 for TOF, 4 for ITS
110  Double_t plim[2] = {0.6, 0.8};
111 
112  if (fPidHF) delete fPidHF;
113  fPidHF = new AliAODPidHF();
114 
115  fPidHF -> SetPLimit(plim, 2);
116  fPidHF -> SetMatch(1); // switch to combine the info from more detectors: 1 = || , 2 = &, 3 = p region
117  fPidHF -> SetAsym(kTRUE); // asimmetric PID required (different sigmas for different p bins)
118  fPidHF -> SetSigma(nsigma); // sigma for the raw signal PID: 0-2 for TPC, 3 for TOF, 4 for ITS
119  fPidHF -> SetCompat(kTRUE); // compatibility region : useful only if fMatch=1
120  fPidHF -> SetTPC(1);
121  fPidHF -> SetTOF(1);
122  fPidHF -> SetITS(0);
123  fPidHF -> SetTRD(0);
124 }
125 
126 
127 
128 
129 //--------------------------------------------------------------------------
131 AliRDHFCuts(source)
132  , fExcludedCut(source.fExcludedCut)
133  , fV0Type(source.fV0Type)
134  , fV0daughtersCuts(0)
135  , fPidOption(source.fPidOption)
137 {
138  //
140  //
141 
143  else fV0daughtersCuts = new AliESDtrackCuts();
144 }
145 
146 
147 
148 
149 //--------------------------------------------------------------------------
151 {
152  //
154  //
155 
156  if (this != &source) {
157 
158  AliRDHFCuts::operator = (source);
159  fV0Type = source.fV0Type;
160  fExcludedCut = source.fExcludedCut;
161 
162  delete fV0daughtersCuts;
163  fV0daughtersCuts = new AliESDtrackCuts(*(source.fV0daughtersCuts));
164 
165  }
166 
167  return *this;
168 }
169 
170 
171 
172 
173 //--------------------------------------------------------------------------
175 {
176  //
178  //
179 
181 }
182 
183 
184 
185 
186 //---------------------------------------------------------------------------
188 {
189  //
191  //
192 
193  if(nvars!=fnVarsForOpt) {
194  AliDebug(2, "wrong number of variables");
195  return;
196  }
197 
198 
199  Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
200  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
201 
202 
204  if (!d) {
205  AliDebug(2, "AliAODRecoCascadeHF null");
206  return;
207  }
208 
209  // Get the v0 and all daughter tracks
210  AliAODTrack *bachelorTrack = (AliAODTrack*) d->GetBachelor();
211  AliAODv0 *v0 = (AliAODv0*) d->Getv0();
212  if (!v0 || !bachelorTrack) {
213  AliDebug(2, "Missing V0 or missing bachelor for the current cascade");
214  return;
215  }
216 
217  AliAODTrack *v0positiveTrack = (AliAODTrack*) d->Getv0PositiveTrack();
218  AliAODTrack *v0negativeTrack = (AliAODTrack*) d->Getv0NegativeTrack();
219  if (!v0positiveTrack || !v0negativeTrack) {
220  AliDebug(2, "No V0 daughters' objects");
221  return;
222  }
223 
224 
225  //recalculate vertex w/o daughters
226  Bool_t cleanvtx = kFALSE;
227  AliAODVertex *origownvtx = 0x0;
229  if (d->GetOwnPrimaryVtx()) origownvtx = new AliAODVertex(*d->GetOwnPrimaryVtx());
230  cleanvtx = kTRUE;
231  if (!RecalcOwnPrimaryVtx(d, aod)) {
232  CleanOwnPrimaryVtx(d, aod, origownvtx);
233  cleanvtx = kFALSE;
234  }
235  }
236 
237 
238  Int_t iter=-1;
239 
240  if (fVarsForOpt[0]) {
241  iter++;
242  if (TMath::Abs(pdgdaughters[0]==431)) vars[iter] = TMath::Abs(d->InvMassDstoK0sK()-mDsPDG);
243  }
244 
245 
246  //___ K0s reconstruction _________________________
247  //_________________________________________________
248 
249  // - Cut on the K0s invariant mass
250  if (fVarsForOpt[1]) {
251  iter++;
252  vars[iter] = TMath::Abs(v0->MassK0Short()-mk0sPDG);
253  }
254 
255  // - Cut on V0-daughters pT
256  if (fVarsForOpt[2]) {
257  iter++;
258  vars[iter] = v0positiveTrack->Pt();
259  }
260 
261  // - Cut on V0-daughters DCA (prong-to-prong)
262  if (fVarsForOpt[3]) {
263  iter++;
264  vars[iter] = TMath::Abs(v0->GetDCA());
265  }
266 
267  // - Cut on V0-daughters transverse impact parameter d0(xy)
268  if (fVarsForOpt[4]) {
269  iter++;
270  vars[iter] = TMath::Abs(v0->DcaPosToPrimVertex());
271  }
272 
273  // - Cut on V0 cosine of pointing angle (3D) wrt PV
274  if (fVarsForOpt[5]) {
275  iter++;
276  vars[iter] = d->CosV0PointingAngle();
277  }
278 
279  // - Cut on V0 fiducial transverse radius
280  if (fVarsForOpt[6]) {
281  iter++;
282  vars[iter] = TMath::Abs(d->DecayLengthXYV0());
283  }
284 
285 
286  //___ Cascade reconstruction _____________________
287  //_________________________________________________
288 
289  // - Cut on bachelor pT
290  if (fVarsForOpt[7]) {
291  iter++;
292  vars[iter] = bachelorTrack->Pt();
293  }
294 
295  // - Cut on V0 pT
296  if (fVarsForOpt[8]) {
297  iter++;
298  vars[iter] = v0->Pt();
299  }
300 
301  // - Cut on bachelor transverse impact parameter d0(xy)
302  if (fVarsForOpt[9]) {
303  iter++;
304  vars[iter] = TMath::Abs(d->Getd0Prong(0));
305  }
306 
307  // - Cut on V0 transverse impact parameter d0(xy)
308  if (fVarsForOpt[10]) {
309  iter++;
310  vars[iter] = TMath::Abs(d->Getd0Prong(1));
311  }
312 
313  // - Cut on cascade-daughters cosThetaStar
314  if (fVarsForOpt[11]) {
315  iter++;
316  vars[iter] = TMath::Abs(d->CosThetaStar(0, 431, 321, 310));
317  }
318 
319  // - Cut on cascade cosPointingAngle (3D) wrt PV
320  if (fVarsForOpt[12]) {
321  iter++;
322  vars[iter] = d->CosPointingAngle();
323  }
324 
325  // - Cut on cascade cosPointingAngle (xy) wrt PV
326  if (fVarsForOpt[13]) {
327  iter++;
328  vars[iter] = TMath::Abs(d->CosPointingAngleXY());
329  }
330 
331  // - Cut on cascade decay length (xy)
332  if (fVarsForOpt[14]) {
333  iter++;
334  vars[iter] = TMath::Abs(d->DecayLengthXY());
335  }
336 
337 
338  if (cleanvtx) CleanOwnPrimaryVtx(d, aod, origownvtx);
339 
340  return;
341 }
342 
343 
344 
345 
346 //--------------------------------------------------------------------------
348 {
349  //
353  //
354 
355  if (!fCutsRD) {
356  AliFatal("Cut matrice not inizialized. Exit...");
357  return 0;
358  }
359 
360 
362  if (!d) {
363  AliDebug(2, "AliAODRecoCascadeHF null");
364  return 0;
365  }
366 
367  Double_t pt = d->Pt();
368  if (pt < fMinPtCand) return 0;
369  if (pt > fMaxPtCand) return 0;
370 
371  if (!d->GetSecondaryVtx()) {
372  AliDebug(2, "No secondary vertex for cascade");
373  return 0;
374  }
375 
376  if (d->GetNDaughters() != 2) {
377  AliDebug(2, Form("No 2 daughters for current cascade (nDaughters=%d)", d->GetNDaughters()));
378  return 0;
379  }
380 
381 
382 
383  //___ 1./ Check daughter tracks __________________
384  //_________________________________________________
385  AliAODv0 *v0 = (AliAODv0*) d->Getv0();
386  AliAODTrack *bachelorTrack = (AliAODTrack*) d->GetBachelor();
387 
388 
389  if (!v0 || !bachelorTrack) {
390  AliDebug(2, "Missing V0 or missing bachelor for the current cascade");
391  return 0;
392  }
393 
394  if ((v0->GetOnFlyStatus()==kTRUE && GetV0Type()==AliRDHFCuts::kOnlyOfflineV0s) ||
395  (v0->GetOnFlyStatus()==kFALSE && GetV0Type()==AliRDHFCuts::kOnlyOnTheFlyV0s)) {
396  AliDebug(2, "Wrong V0 status (offline or on-the-fly)");
397  return 0;
398  }
399 
400  if (bachelorTrack->GetID()<0) {
401  AliDebug(2, Form("Bachelor has negative ID %d", bachelorTrack->GetID()));
402  return 0;
403  }
404 
405  if (!v0->GetSecondaryVtx()) {
406  AliDebug(2, "No secondary vertex for V0 by cascade");
407  return 0;
408  }
409 
410  if (v0->GetNDaughters()!=2) {
411  AliDebug(2, Form("More than 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)", v0->GetOnFlyStatus(), v0->GetNDaughters()));
412  return 0;
413  }
414 
415 
416  // - Get the V0 daughter tracks
417  AliAODTrack *v0positiveTrack = (AliAODTrack*) d->Getv0PositiveTrack();
418  AliAODTrack *v0negativeTrack = (AliAODTrack*) d->Getv0NegativeTrack();
419 
420  if (!v0positiveTrack || !v0negativeTrack) {
421  AliDebug(2, "No V0 daughters' objects");
422  return 0;
423  }
424 
425  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
426  AliDebug(2, Form("At least one of V0 daughters has negative ID %d %d", v0positiveTrack->GetID(), v0negativeTrack->GetID()));
427  return 0;
428  }
429 
431  AliDebug(2, "Check on the bachelor FilterBit: no BIT(4). Candidate rejected.");
432  return 0;
433  }
434 
435 
436  // - Selection on daughter tracks
437  if ( selectionLevel == AliRDHFCuts::kAll ||
438  selectionLevel == AliRDHFCuts::kTracks )
439  { if (!AreDtoK0sDaughtersSelected(d)) return 0; }
440 
441 
442 
443 
444  //___ 2./ Check for cascade Ds ___________________
445  //_________________________________________________
446 
447  // - Selection on candidate
448  if (selectionLevel == AliRDHFCuts::kAll ||
449  selectionLevel == AliRDHFCuts::kCandidate) {
450 
451 
452  Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
453  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
454 
455  Double_t mDs = d->InvMassDstoK0sK();
456  Double_t mk0s = v0->MassK0Short();
457 
458 
459  Int_t ptbin = PtBin(pt);
460  if (ptbin==-1) {
461  return 0;
462  }
463 
464 
465  // Recalculate vertex w/o daughters
466  AliAODVertex *origownvtx = 0x0;
468  if (d->GetOwnPrimaryVtx()) origownvtx = new AliAODVertex(*d->GetOwnPrimaryVtx());
469  if (!RecalcOwnPrimaryVtx(d, aod)) {
470  CleanOwnPrimaryVtx(d, aod, origownvtx);
471  return 0;
472  }
473  }
474 
475 
476  if (fUseMCVertex) {
477  if (d->GetOwnPrimaryVtx()) origownvtx = new AliAODVertex(*d->GetOwnPrimaryVtx());
478  if (!SetMCPrimaryVtx(d, aod)) {
479  CleanOwnPrimaryVtx(d, aod, origownvtx);
480  return 0;
481  }
482  }
483 
484 
485 
486  //___ Invariant mass compatibility _______________
487  //_________________________________________________
488 
489  // - Check invariant mass of cascade Ds
490  if (TMath::Abs(mDs - mDsPDG) > fCutsRD[GetGlobalIndex(0,ptbin)] && fExcludedCut!=0) {
491  AliDebug(4, "cascade not compatible with Ds invariant mass");
492  return 0;
493  }
494 
495 
496 
497  //___ K0s reconstruction _________________________
498  //_________________________________________________
499 
500  // - Cut on the K0s invariant mass
501  if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(1,ptbin)] && fExcludedCut!=1) {
502  AliDebug(4, Form(" V0 mass is %2.2e and does not correspond to K0S cut", mk0s));
503  CleanOwnPrimaryVtx(d, aod, origownvtx);
504  return 0;
505  }
506 
507 
508  // - Cut on V0-daughters pT
509  if (v0positiveTrack->Pt() < fCutsRD[GetGlobalIndex(2,ptbin)] && fExcludedCut!=2) {
510  AliDebug(4, Form(" v0 positive track Pt=%2.2e < %2.2e", v0positiveTrack->Pt(), fCutsRD[GetGlobalIndex(2,ptbin)]));
511  CleanOwnPrimaryVtx(d, aod, origownvtx);
512  return 0;
513  }
514  if (v0negativeTrack->Pt() < fCutsRD[GetGlobalIndex(2,ptbin)] && fExcludedCut!=2) {
515  AliDebug(4, Form(" v0 positive track Pt=%2.2e < %2.2e", v0negativeTrack->Pt(), fCutsRD[GetGlobalIndex(2,ptbin)]));
516  CleanOwnPrimaryVtx(d, aod, origownvtx);
517  return 0;
518  }
519 
520 
521  // - Cut on V0-daughters DCA (prong-to-prong)
522  if (TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(3,ptbin)] && fExcludedCut!=3) {
523  AliDebug(4, " V0-daugters DCA doesn't pass the cut");
524  CleanOwnPrimaryVtx(d, aod, origownvtx);
525  return 0;
526  }
527 
528 
529  // - Cut on V0-daughters transverse impact parameter d0(xy)
530  if (TMath::Abs(v0->DcaPosToPrimVertex()) < fCutsRD[GetGlobalIndex(4,ptbin)] && fExcludedCut!=4) {
531  AliDebug(4, " V0-daugters impact parameter (xy) don't pass the cut");
532  CleanOwnPrimaryVtx(d, aod, origownvtx);
533  return 0;
534  }
535  if (TMath::Abs(v0->DcaNegToPrimVertex()) < fCutsRD[GetGlobalIndex(4,ptbin)] && fExcludedCut!=4) {
536  AliDebug(4, " V0-daugters impact parameter (xy) don't pass the cut");
537  CleanOwnPrimaryVtx(d, aod, origownvtx);
538  return 0;
539  }
540 
541 
542  // - Cut on V0 cosine of pointing angle (3D) wrt PV
543  if (d->CosV0PointingAngle() < fCutsRD[GetGlobalIndex(5,ptbin)] && fExcludedCut!=5) {
544  AliDebug(4, " V0 cosine of pointing angle (3D) doesn't pass the cut");
545  CleanOwnPrimaryVtx(d, aod, origownvtx);
546  return 0;
547  }
548 
549 
550  // - Cut on V0 fiducial transverse radius
551  if (TMath::Abs(d->DecayLengthXYV0()) < fCutsRD[GetGlobalIndex(6,ptbin)] && fExcludedCut!=6) {
552  AliDebug(4, " V0 fiducial transverse radius min doesn't pass the cut");
553  CleanOwnPrimaryVtx(d, aod, origownvtx);
554  return 0;
555  }
556 
557 
558 
559  //___ Cascade reconstruction _____________________
560  //_________________________________________________
561 
562  // - Cut on bachelor pT
563  if (TMath::Abs(bachelorTrack->Pt()) < fCutsRD[GetGlobalIndex(7,ptbin)] && fExcludedCut!=7) {
564  AliDebug(4, Form(" bachelor track Pt=%2.2e < %2.2e", bachelorTrack->Pt(), fCutsRD[GetGlobalIndex(7,ptbin)]));
565  CleanOwnPrimaryVtx(d, aod, origownvtx);
566  return 0;
567  }
568 
569 
570  // - Cut on V0 pT
571  if (TMath::Abs(v0->Pt()) < fCutsRD[GetGlobalIndex(8,ptbin)] && fExcludedCut!=8) {
572  AliDebug(4, Form(" V0 track Pt=%2.2e < %2.2e", v0->Pt(), fCutsRD[GetGlobalIndex(8,ptbin)]));
573  CleanOwnPrimaryVtx(d, aod, origownvtx);
574  return 0;
575  }
576 
577 
578  // - Cut on bachelor transverse impact parameter d0(xy)
579  if (TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(9,ptbin)] && fExcludedCut!=9) {
580  AliDebug(4, " bachelor transverse impact parameter doesn't pass the cut");
581  CleanOwnPrimaryVtx(d, aod, origownvtx);
582  return 0;
583  }
584 
585 
586  // - Cut on V0 transverse impact parameter d0(xy)
587  if (TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(10,ptbin)] && fExcludedCut!=10) {
588  AliDebug(4, " V0 transverse impact parameter doesn't pass the cut");
589  CleanOwnPrimaryVtx(d, aod, origownvtx);
590  return 0;
591  }
592 
593 
594  // - Cut on Ds-daughters cosThetaStar
595  if (TMath::Abs(d->CosThetaStar(0, 431, 321, 310)) > fCutsRD[GetGlobalIndex(11,ptbin)] && fExcludedCut!=11) {
596  AliDebug(4, " Ds daughter cosThetaStar doesn't pass the cut");
597  CleanOwnPrimaryVtx(d, aod, origownvtx);
598  return 0;
599  }
600 
601 
602  // - Cut on cascade cosPointingAngle (3D) wrt PV
603  if (d->CosPointingAngle() < fCutsRD[GetGlobalIndex(12,ptbin)] && fExcludedCut!=12) {
604  AliDebug(4, " Cascade cosPointingAngle (3D) doesn't pass the cut");
605  CleanOwnPrimaryVtx(d, aod, origownvtx);
606  return 0;
607  }
608 
609  // - Cut on cascade cosPointingAngle (xy) wrt PV
610  if (TMath::Abs(d->CosPointingAngleXY()) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) {
611  AliDebug(4, " Cascade cosPointingAngle (xy) doesn't pass the cut");
612  CleanOwnPrimaryVtx(d, aod, origownvtx);
613  return 0;
614  }
615 
616 
617  // - Cut on cascade decay length (xy)
618  if (TMath::Abs(d->DecayLengthXY()) < fCutsRD[GetGlobalIndex(14,ptbin)] && fExcludedCut!=14) {
619  AliDebug(4, " Ds normalised decay length (XY) doesn't pass the cut");
620  CleanOwnPrimaryVtx(d, aod, origownvtx);
621  return 0;
622  }
623 
624 
625  // Unset recalculated primary vertex when not needed any more
626  CleanOwnPrimaryVtx(d, aod, origownvtx);
627 
628  } // end if (kAll || kCandidate)
629 
630 
631 
632 
633  //___ 3./ PID selection __________________________
634  //_________________________________________________
635  Int_t returnvalueTopo = 1;
636  Int_t returnvaluePID = 1;
637 
638  if (selectionLevel == AliRDHFCuts::kAll ||
639  selectionLevel == AliRDHFCuts::kCandidate ||
640  selectionLevel == AliRDHFCuts::kPID)
641  { returnvaluePID = IsSelectedPID(d); }
642 
643 
644  Int_t returnvalueTot = returnvalueTopo & returnvaluePID;
645 
646  return returnvalueTot;
647 }
648 
649 
650 
651 
652 //---------------------------------------------------------------------------
654 {
655  //
659  //
660 
661  if (!fUsePID) {
662  AliDebug(2, "PID selection inactive. Candidate accepted.");
663  return 1;
664  }
665 
666  if (!fPidHF) {
667  AliDebug(2, "PID not configured. Candidate accepted.");
668  return 1;
669  }
670 
672  if (!d) {
673  AliDebug(2, "AliAODRecoCascadeHF null");
674  return 0;
675  }
676 
677  AliAODTrack *bachelorTrack = (AliAODTrack*) d->GetBachelor();
678  if (!bachelorTrack) {
679  AliDebug(2, "Missing bachelor for the current cascade");
680  return 0;
681  }
682 
683 
684  // - Combined TPC/TOF PID
685  Double_t origCompatTOF = fPidHF -> GetPCompatTOF();
686  Double_t origThreshTPC = fPidHF -> GetPtThresholdTPC();
687  if (fPidOption == kStrong) {
688  fPidHF -> SetPCompatTOF(999999.);
689  fPidHF -> SetPtThresholdTPC(999999.);
690  }
691 
692 
693  Int_t isKaon = fPidHF -> MakeRawPid(bachelorTrack, AliPID::kKaon);
694 
695  if (isKaon < 0) {
696  fPidHF -> SetPCompatTOF(origCompatTOF);
697  fPidHF -> SetPtThresholdTPC(origThreshTPC);
698  return 0;
699  }
700 
701  if (fPidOption == kStrong && d->Pt() < fMaxPtStrongPid && isKaon <= 0) {
702  fPidHF -> SetPCompatTOF(origCompatTOF);
703  fPidHF -> SetPtThresholdTPC(origThreshTPC);
704  return 0;
705  }
706 
707 
708  fPidHF -> SetPCompatTOF(origCompatTOF);
709  fPidHF -> SetPtThresholdTPC(origThreshTPC);
710 
711  return 1;
712 }
713 
714 
715 
716 
717 //---------------------------------------------------------------------------
719 {
720  //
722  //
723 
724  if (fMaxRapidityCand > -998.) {
725  if (TMath::Abs(y) > fMaxRapidityCand) return kFALSE;
726  else return kTRUE;
727  }
728 
729  if (pt > 5.) {
730  // applying cut for pt > 5 GeV
731  AliDebug(2,Form("pt of cascade = %f (> 5), cutting at |y| < 0.8", pt));
732  if (TMath::Abs(y) > 0.8) return kFALSE;
733  } else {
734  // appliying smooth cut for pt < 5 GeV
735  Double_t maxFiducialY = -0.2/15*pt*pt + 1.9/15*pt + 0.5;
736  Double_t minFiducialY = 0.2/15*pt*pt - 1.9/15*pt - 0.5;
737  AliDebug(2,Form("pt of cascade = %f (< 5), cutting according to the fiducial zone [%f, %f]\n", pt, minFiducialY, maxFiducialY));
738  if (y < minFiducialY || y > maxFiducialY) return kFALSE;
739  }
740 
741  return kTRUE;
742 }
743 
744 
745 
746 
747 //---------------------------------------------------------------------------
749 {
750  //
752  //
753 
755  if (!d) {
756  AliDebug(2, "AliAODRecoCascadeHF null");
757  return kFALSE;
758  }
759 
760  if (!fTrackCuts) {
761  AliFatal("Cut object is not defined for bachelor. Candidate accepted.");
762  return kTRUE;
763  }
764 
765 
766  //___ 1./ Check bachelor tracks __________________
767  //_________________________________________________
768  AliAODTrack *bachelorTrack = (AliAODTrack*) d->GetBachelor();
769  if (!bachelorTrack) return kFALSE;
770 
771 
773  if(!bachelorTrack->HasPointOnITSLayer(0)) return kFALSE;
774  }
775 
776 
777  if (fKinkReject != (!(fTrackCuts->GetAcceptKinkDaughters())) ) {
778  AliError(Form("Not compatible setting: fKinkReject=%1d - fTrackCuts->GetAcceptKinkDaughters()=%1d",fKinkReject, fTrackCuts->GetAcceptKinkDaughters()));
779  return kFALSE;
780  }
781 
782 
783  AliAODVertex *vAOD = (AliAODVertex*) d->GetPrimaryVtx();
784  Double_t pos[3]; vAOD->GetXYZ(pos);
785  Double_t cov[6]; vAOD->GetCovarianceMatrix(cov);
786  const AliESDVertex vESD(pos,cov,100.,100);
787 
788  if (!IsDaughterSelected(bachelorTrack, &vESD, fTrackCuts)) return kFALSE;
789 
790  if (!fV0daughtersCuts) {
791  AliFatal("Cut object is not defined for V0daughters. Candidate accepted.");
792  return kTRUE;
793  }
794 
795 
796 
797  //___ 2./ Check V0 _______________________________
798  //_________________________________________________
799  AliAODv0 *v0 = (AliAODv0*) d->Getv0();
800  if (!v0) return kFALSE;
801 
802  AliAODTrack *v0positiveTrack = (AliAODTrack*) d->Getv0PositiveTrack();
803  AliAODTrack *v0negativeTrack = (AliAODTrack*) d->Getv0NegativeTrack();
804  if (!v0positiveTrack || !v0negativeTrack) return kFALSE;
805 
806 
807  Float_t etaMin=0, etaMax=0; fV0daughtersCuts->GetEtaRange(etaMin,etaMax);
808  if ( (v0positiveTrack->Eta()<=etaMin || v0positiveTrack->Eta()>=etaMax) ||
809  (v0negativeTrack->Eta()<=etaMin || v0negativeTrack->Eta()>=etaMax) ) return kFALSE;
810  Float_t ptMin=0, ptMax=0; fV0daughtersCuts->GetPtRange(ptMin,ptMax);
811  if ( (v0positiveTrack->Pt()<=ptMin || v0positiveTrack->Pt()>=ptMax) ||
812  (v0negativeTrack->Pt()<=ptMin || v0negativeTrack->Pt()>=ptMax) ) return kFALSE;
813 
814 
815  // Condition on nTPCclusters
816  if (fV0daughtersCuts->GetMinNClusterTPC()>0) {
817  if ( ((v0positiveTrack->GetTPCClusterInfo(2,1)) < fV0daughtersCuts->GetMinNClusterTPC()) ||
818  ((v0negativeTrack->GetTPCClusterInfo(2,1)) < fV0daughtersCuts->GetMinNClusterTPC()) ) return kFALSE;
819  }
820 
821 
822  // kTPCrefit status
823  if (v0->GetOnFlyStatus()==kFALSE) { // only for offline V0s
824  if (fV0daughtersCuts->GetRequireTPCRefit()) {
825  if( !(v0positiveTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
826  if( !(v0negativeTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
827  }
828  }
829 
830 
831  // kink condition
832  if (!fV0daughtersCuts->GetAcceptKinkDaughters()) {
833  AliAODVertex *maybeKinkPos = (AliAODVertex*)v0positiveTrack->GetProdVertex();
834  AliAODVertex *maybeKinkNeg = (AliAODVertex*)v0negativeTrack->GetProdVertex();
835  if (maybeKinkPos->GetType()==AliAODVertex::kKink ||
836  maybeKinkNeg->GetType()==AliAODVertex::kKink) return kFALSE;
837  }
838 
839 
840  // Findable clusters > 0 condition - from V0 analysis
841  // if( v0positiveTrack->GetTPCNclsF()<=0 || v0negativeTrack->GetTPCNclsF()<=0 ) return kFALSE;
842  /*
843  Float_t lPosTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
844  Float_t lNegTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
845  fTreeVariableLeastNbrCrossedRows = (Int_t) lPosTrackCrossedRows;
846  if( lNegTrackCrossedRows < fTreeVariableLeastNbrCrossedRows )
847  fTreeVariableLeastNbrCrossedRows = (Int_t) lNegTrackCrossedRows;
848  //Compute ratio Crossed Rows / Findable clusters
849  //Note: above test avoids division by zero!
850  Float_t lPosTrackCrossedRowsOverFindable = lPosTrackCrossedRows / ((double)(pTrack->GetTPCNclsF()));
851  Float_t lNegTrackCrossedRowsOverFindable = lNegTrackCrossedRows / ((double)(nTrack->GetTPCNclsF()));
852  fTreeVariableLeastRatioCrossedRowsOverFindable = lPosTrackCrossedRowsOverFindable;
853  if( lNegTrackCrossedRowsOverFindable < fTreeVariableLeastRatioCrossedRowsOverFindable )
854  fTreeVariableLeastRatioCrossedRowsOverFindable = lNegTrackCrossedRowsOverFindable;
855  //Lowest Cut Level for Ratio Crossed Rows / Findable = 0.8, set here
856  if ( fTreeVariableLeastRatioCrossedRowsOverFindable < 0.8 ) return kFALSE;
857  */
858 
859  return kTRUE;
860 }
861 
862 
863 
864 
865 //---------------------------------------------------------------------------
867 {
868  //
870  //
871 
872  const Int_t nvars = this->GetNVars() ;
873  fV0Type = (this->GetCuts())[nvars-1];
874  TString *sVarNames = GetVarNames();
875 
876  if (sVarNames[nvars-1].Contains("V0 type")) {
877  return (Int_t)fV0Type;
878  } else {
879  AliInfo("AliRDHFCutsDstoK0sK Last variable is not the V0 type!!!");
880  return -999;
881  }
882 }
Double_t fMaxPtCandTrackSPDFirst
flag to select the track kFirst criteria for pt < ptlimit
Definition: AliRDHFCuts.h:450
Int_t GetNVars() const
Definition: AliRDHFCuts.h:249
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
double Double_t
Definition: External.C:58
Double_t InvMassDstoK0sK() const
Bool_t fUseMCVertex
flag to switch on the removal of duaghters from the primary vertex computation
Definition: AliRDHFCuts.h:428
Bool_t SetMCPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod) const
Bool_t fRemoveDaughtersFromPrimary
Definition: AliRDHFCuts.h:427
void AddTrackCutsV0daughters(AliESDtrackCuts *v0daug)
AliAODTrack * Getv0NegativeTrack() const
AliAODv0 * Getv0() const
Bool_t AreDtoK0sDaughtersSelected(AliAODRecoDecayHF *rd) const
const Float_t * GetCuts() const
Definition: AliRDHFCuts.h:253
void SetNVars(Int_t nVars)
Definition: AliRDHFCuts.h:392
Double_t CosPointingAngleXY() const
virtual Int_t IsSelectedPID(AliAODRecoDecayHF *obj)
Double_t fMaxRapidityCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:447
TString * GetVarNames() const
Definition: AliRDHFCuts.h:250
Double_t ptMin
AliRDHFCuts & operator=(const AliRDHFCuts &source)
Double_t DecayLengthXYV0() const
Bool_t fUsePID
Definition: AliRDHFCuts.h:422
Float_t fMaxPtStrongPid
PID option.
Bool_t HasBadDaughters() const
AliAODTrack * Getv0PositiveTrack() const
AliRDHFCutsDstoK0sK(const char *name="CutsDstoK0sK")
int Int_t
Definition: External.C:63
Bool_t fUseTrackSelectionWithFilterBits
flag to reject kink daughters
Definition: AliRDHFCuts.h:457
Int_t fnVarsForOpt
Definition: AliRDHFCuts.h:417
float Float_t
Definition: External.C:68
Class for cuts on AOD reconstructed Ds->K0S+K.
Double_t fMaxPtCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:446
AliESDtrackCuts * fTrackCuts
quality cuts on the daughter tracks
Definition: AliRDHFCuts.h:410
AliAODTrack * GetBachelor() const
AliAODVertex * GetOwnPrimaryVtx() const
Double_t nsigma
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:420
Double_t CosV0PointingAngle() const
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:418
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
AliRDHFCutsDstoK0sK & operator=(const AliRDHFCutsDstoK0sK &source)
AliESDtrackCuts * fV0daughtersCuts
V0 type – should be defined as in AliRDHFCuts.h.
void CleanOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod, AliAODVertex *origownvtx) const
Bool_t fIsCandTrackSPDFirst
IsSelected returns always kTRUE for MC signal.
Definition: AliRDHFCuts.h:449
void SetPtBins(Int_t nPtBinLimits, Float_t *ptBinLimits)
Bool_t fKinkReject
cut on zSPD vertex to remove outliers in centrality vs. tracklets (0=no cut, 1= cut at 12 cm...
Definition: AliRDHFCuts.h:456
AliAODVertex * GetPrimaryVtx() const
bool Bool_t
Definition: External.C:53
Float_t fV0Type
cut to be excluded (-1=none)
Double_t CosPointingAngle() const
Int_t fPidOption
cuts for v0 daughters (AOD converted to ESD on the fly!)
Double_t ptMax
AliAODPidHF * fPidHF
enable AOD049 centrality cleanup
Definition: AliRDHFCuts.h:424
Bool_t RecalcOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod) const
Int_t PtBin(Double_t pt) const
virtual void GetCutVarsForOpt(AliAODRecoDecayHF *obj, Float_t *vars, Int_t nvars, Int_t *pdgdaughters)
Int_t GetGlobalIndex(Int_t iVar, Int_t iPtBin) const
Double_t fMinPtCand
outcome of PID selection
Definition: AliRDHFCuts.h:445
Bool_t IsDaughterSelected(AliAODTrack *track, const AliESDVertex *primary, AliESDtrackCuts *cuts, const AliAODEvent *aod=0x0) const