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