AliPhysics  master (3d17d9d)
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 Bool_t AliRDHFCutsDstoK0sK::PreSelect(TObject* obj, AliAODv0 *v0, AliVTrack *bachelorTrack){
346  //
347  // Apply pre-selections, used in the AOD filtering
348  //
349 
350  if (!fCutsRD) {
351  AliFatal("Cut matrix not inizialized. Exit...");
352  return 0;
353  }
354 
356  if (!d) {
357  AliDebug(2,"AliAODRecoCascadeHF null");
358  return 0;
359  }
360 
361  Double_t pt = d->Pt();
362  Int_t ptbin = PtBin(pt);
363  if (ptbin<0) return 0;
364 
365  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
366  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
367 
368  // cut on V0 pT min
369  if (v0->Pt() < fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
370 
371  // cut on the minimum pt of the bachelor
372  if (bachelorTrack->Pt() < fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
373 
374  // Cut on the K0s invariant mass
375  Double_t mk0s = v0->MassK0Short();
376  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
377  if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(1,ptbin)]) return 0;
378 
379  // cut on the D+ invariant mass
380  Double_t mDs = d->InvMassDstoK0sK();
381  Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
382  if (TMath::Abs(mDs - mDsPDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) return 0;
383 
384  // - Cut on V0-daughters DCA (prong-to-prong)
385  if (TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(3,ptbin)]) return 0;
386 
387  return kTRUE;
388 }
389 
390 //--------------------------------------------------------------------------
392 {
393  //
397  //
398 
399  if (!fCutsRD) {
400  AliFatal("Cut matrice not inizialized. Exit...");
401  return 0;
402  }
403 
404 
406  if (!d) {
407  AliDebug(2, "AliAODRecoCascadeHF null");
408  return 0;
409  }
410 
411  Double_t pt = d->Pt();
412  if (pt < fMinPtCand) return 0;
413  if (pt > fMaxPtCand) return 0;
414 
415  if (!d->GetSecondaryVtx()) {
416  AliDebug(2, "No secondary vertex for cascade");
417  return 0;
418  }
419 
420  if (d->GetNDaughters() != 2) {
421  AliDebug(2, Form("No 2 daughters for current cascade (nDaughters=%d)", d->GetNDaughters()));
422  return 0;
423  }
424 
425 
426 
427  //___ 1./ Check daughter tracks __________________
428  //_________________________________________________
429  AliAODv0 *v0 = (AliAODv0*) d->Getv0();
430  AliAODTrack *bachelorTrack = (AliAODTrack*) d->GetBachelor();
431 
432 
433  if (!v0 || !bachelorTrack) {
434  AliDebug(2, "Missing V0 or missing bachelor for the current cascade");
435  return 0;
436  }
437 
438  if ((v0->GetOnFlyStatus()==kTRUE && GetV0Type()==AliRDHFCuts::kOnlyOfflineV0s) ||
439  (v0->GetOnFlyStatus()==kFALSE && GetV0Type()==AliRDHFCuts::kOnlyOnTheFlyV0s)) {
440  AliDebug(2, "Wrong V0 status (offline or on-the-fly)");
441  return 0;
442  }
443 
444  if (bachelorTrack->GetID()<0) {
445  AliDebug(2, Form("Bachelor has negative ID %d", bachelorTrack->GetID()));
446  return 0;
447  }
448 
449  if (!v0->GetSecondaryVtx()) {
450  AliDebug(2, "No secondary vertex for V0 by cascade");
451  return 0;
452  }
453 
454  if (v0->GetNDaughters()!=2) {
455  AliDebug(2, Form("More than 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)", v0->GetOnFlyStatus(), v0->GetNDaughters()));
456  return 0;
457  }
458 
459 
460  // - Get the V0 daughter tracks
461  AliAODTrack *v0positiveTrack = (AliAODTrack*) d->Getv0PositiveTrack();
462  AliAODTrack *v0negativeTrack = (AliAODTrack*) d->Getv0NegativeTrack();
463 
464  if (!v0positiveTrack || !v0negativeTrack) {
465  AliDebug(2, "No V0 daughters' objects");
466  return 0;
467  }
468 
469  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
470  AliDebug(2, Form("At least one of V0 daughters has negative ID %d %d", v0positiveTrack->GetID(), v0negativeTrack->GetID()));
471  return 0;
472  }
473 
475  AliDebug(2, "Check on the bachelor FilterBit: no BIT(4). Candidate rejected.");
476  return 0;
477  }
478 
479 
480  // - Selection on daughter tracks
481  if ( selectionLevel == AliRDHFCuts::kAll ||
482  selectionLevel == AliRDHFCuts::kTracks )
483  { if (!AreDtoK0sDaughtersSelected(d)) return 0; }
484 
485 
486 
487 
488  //___ 2./ Check for cascade Ds ___________________
489  //_________________________________________________
490 
491  // - Selection on candidate
492  if (selectionLevel == AliRDHFCuts::kAll ||
493  selectionLevel == AliRDHFCuts::kCandidate) {
494 
495 
496  Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
497  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
498 
499  Double_t mDs = d->InvMassDstoK0sK();
500  Double_t mk0s = v0->MassK0Short();
501 
502 
503  Int_t ptbin = PtBin(pt);
504  if (ptbin==-1) {
505  return 0;
506  }
507 
508 
509  // Recalculate vertex w/o daughters
510  AliAODVertex *origownvtx = 0x0;
512  if (d->GetOwnPrimaryVtx()) origownvtx = new AliAODVertex(*d->GetOwnPrimaryVtx());
513  if (!RecalcOwnPrimaryVtx(d, aod)) {
514  CleanOwnPrimaryVtx(d, aod, origownvtx);
515  return 0;
516  }
517  }
518 
519 
520  if (fUseMCVertex) {
521  if (d->GetOwnPrimaryVtx()) origownvtx = new AliAODVertex(*d->GetOwnPrimaryVtx());
522  if (!SetMCPrimaryVtx(d, aod)) {
523  CleanOwnPrimaryVtx(d, aod, origownvtx);
524  return 0;
525  }
526  }
527 
528 
529 
530  //___ Invariant mass compatibility _______________
531  //_________________________________________________
532 
533  // - Check invariant mass of cascade Ds
534  if (TMath::Abs(mDs - mDsPDG) > fCutsRD[GetGlobalIndex(0,ptbin)] && fExcludedCut!=0) {
535  AliDebug(4, "cascade not compatible with Ds invariant mass");
536  return 0;
537  }
538 
539 
540 
541  //___ K0s reconstruction _________________________
542  //_________________________________________________
543 
544  // - Cut on the K0s invariant mass
545  if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(1,ptbin)] && fExcludedCut!=1) {
546  AliDebug(4, Form(" V0 mass is %2.2e and does not correspond to K0S cut", mk0s));
547  CleanOwnPrimaryVtx(d, aod, origownvtx);
548  return 0;
549  }
550 
551 
552  // - Cut on V0-daughters pT
553  if (v0positiveTrack->Pt() < fCutsRD[GetGlobalIndex(2,ptbin)] && fExcludedCut!=2) {
554  AliDebug(4, Form(" v0 positive track Pt=%2.2e < %2.2e", v0positiveTrack->Pt(), fCutsRD[GetGlobalIndex(2,ptbin)]));
555  CleanOwnPrimaryVtx(d, aod, origownvtx);
556  return 0;
557  }
558  if (v0negativeTrack->Pt() < fCutsRD[GetGlobalIndex(2,ptbin)] && fExcludedCut!=2) {
559  AliDebug(4, Form(" v0 positive track Pt=%2.2e < %2.2e", v0negativeTrack->Pt(), fCutsRD[GetGlobalIndex(2,ptbin)]));
560  CleanOwnPrimaryVtx(d, aod, origownvtx);
561  return 0;
562  }
563 
564 
565  // - Cut on V0-daughters DCA (prong-to-prong)
566  if (TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(3,ptbin)] && fExcludedCut!=3) {
567  AliDebug(4, " V0-daugters DCA doesn't pass the cut");
568  CleanOwnPrimaryVtx(d, aod, origownvtx);
569  return 0;
570  }
571 
572 
573  // - Cut on V0-daughters transverse impact parameter d0(xy)
574  if (TMath::Abs(v0->DcaPosToPrimVertex()) < fCutsRD[GetGlobalIndex(4,ptbin)] && fExcludedCut!=4) {
575  AliDebug(4, " V0-daugters impact parameter (xy) don't pass the cut");
576  CleanOwnPrimaryVtx(d, aod, origownvtx);
577  return 0;
578  }
579  if (TMath::Abs(v0->DcaNegToPrimVertex()) < fCutsRD[GetGlobalIndex(4,ptbin)] && fExcludedCut!=4) {
580  AliDebug(4, " V0-daugters impact parameter (xy) don't pass the cut");
581  CleanOwnPrimaryVtx(d, aod, origownvtx);
582  return 0;
583  }
584 
585 
586  // - Cut on V0 cosine of pointing angle (3D) wrt PV
587  if (d->CosV0PointingAngle() < fCutsRD[GetGlobalIndex(5,ptbin)] && fExcludedCut!=5) {
588  AliDebug(4, " V0 cosine of pointing angle (3D) doesn't pass the cut");
589  CleanOwnPrimaryVtx(d, aod, origownvtx);
590  return 0;
591  }
592 
593 
594  // - Cut on V0 fiducial transverse radius
595  if (TMath::Abs(d->DecayLengthXYV0()) < fCutsRD[GetGlobalIndex(6,ptbin)] && fExcludedCut!=6) {
596  AliDebug(4, " V0 fiducial transverse radius min doesn't pass the cut");
597  CleanOwnPrimaryVtx(d, aod, origownvtx);
598  return 0;
599  }
600 
601 
602 
603  //___ Cascade reconstruction _____________________
604  //_________________________________________________
605 
606  // - Cut on bachelor pT
607  if (bachelorTrack->Pt() < fCutsRD[GetGlobalIndex(7,ptbin)] && fExcludedCut!=7) {
608  AliDebug(4, Form(" bachelor track Pt=%2.2e < %2.2e", bachelorTrack->Pt(), fCutsRD[GetGlobalIndex(7,ptbin)]));
609  CleanOwnPrimaryVtx(d, aod, origownvtx);
610  return 0;
611  }
612 
613 
614  // - Cut on V0 pT
615  if (v0->Pt() < fCutsRD[GetGlobalIndex(8,ptbin)] && fExcludedCut!=8) {
616  AliDebug(4, Form(" V0 track Pt=%2.2e < %2.2e", v0->Pt(), fCutsRD[GetGlobalIndex(8,ptbin)]));
617  CleanOwnPrimaryVtx(d, aod, origownvtx);
618  return 0;
619  }
620 
621 
622  // - Cut on bachelor transverse impact parameter d0(xy)
623  if (TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(9,ptbin)] && fExcludedCut!=9) {
624  AliDebug(4, " bachelor transverse impact parameter doesn't pass the cut");
625  CleanOwnPrimaryVtx(d, aod, origownvtx);
626  return 0;
627  }
628 
629 
630  // - Cut on V0 transverse impact parameter d0(xy)
631  if (TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(10,ptbin)] && fExcludedCut!=10) {
632  AliDebug(4, " V0 transverse impact parameter doesn't pass the cut");
633  CleanOwnPrimaryVtx(d, aod, origownvtx);
634  return 0;
635  }
636 
637 
638  // - Cut on Ds-daughters cosThetaStar
639  if (TMath::Abs(d->CosThetaStar(0, 431, 321, 310)) > fCutsRD[GetGlobalIndex(11,ptbin)] && fExcludedCut!=11) {
640  AliDebug(4, " Ds daughter cosThetaStar doesn't pass the cut");
641  CleanOwnPrimaryVtx(d, aod, origownvtx);
642  return 0;
643  }
644 
645 
646  // - Cut on cascade cosPointingAngle (3D) wrt PV
647  if (d->CosPointingAngle() < fCutsRD[GetGlobalIndex(12,ptbin)] && fExcludedCut!=12) {
648  AliDebug(4, " Cascade cosPointingAngle (3D) doesn't pass the cut");
649  CleanOwnPrimaryVtx(d, aod, origownvtx);
650  return 0;
651  }
652 
653  // - Cut on cascade cosPointingAngle (xy) wrt PV
654  if (TMath::Abs(d->CosPointingAngleXY()) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) {
655  AliDebug(4, " Cascade cosPointingAngle (xy) doesn't pass the cut");
656  CleanOwnPrimaryVtx(d, aod, origownvtx);
657  return 0;
658  }
659 
660 
661  // - Cut on cascade decay length (xy)
662  if (TMath::Abs(d->DecayLengthXY()) < fCutsRD[GetGlobalIndex(14,ptbin)] && fExcludedCut!=14) {
663  AliDebug(4, " Ds normalised decay length (XY) doesn't pass the cut");
664  CleanOwnPrimaryVtx(d, aod, origownvtx);
665  return 0;
666  }
667 
668 
669  // Unset recalculated primary vertex when not needed any more
670  CleanOwnPrimaryVtx(d, aod, origownvtx);
671 
672  } // end if (kAll || kCandidate)
673 
674 
675 
676 
677  //___ 3./ PID selection __________________________
678  //_________________________________________________
679  Int_t returnvalueTopo = 1;
680  Int_t returnvaluePID = 1;
681 
682  if (selectionLevel == AliRDHFCuts::kAll ||
683  selectionLevel == AliRDHFCuts::kCandidate ||
684  selectionLevel == AliRDHFCuts::kPID)
685  { returnvaluePID = IsSelectedPID(d); }
686 
687 
688  Int_t returnvalueTot = returnvalueTopo & returnvaluePID;
689 
690  return returnvalueTot;
691 }
692 
693 
694 
695 
696 //---------------------------------------------------------------------------
698 {
699  //
703  //
704 
705  if (!fUsePID) {
706  AliDebug(2, "PID selection inactive. Candidate accepted.");
707  return 1;
708  }
709 
710  if (!fPidHF) {
711  AliDebug(2, "PID not configured. Candidate accepted.");
712  return 1;
713  }
714 
716  if (!d) {
717  AliDebug(2, "AliAODRecoCascadeHF null");
718  return 0;
719  }
720 
721  AliAODTrack *bachelorTrack = (AliAODTrack*) d->GetBachelor();
722  if (!bachelorTrack) {
723  AliDebug(2, "Missing bachelor for the current cascade");
724  return 0;
725  }
726 
727 
728  // - Combined TPC/TOF PID
729  Double_t origCompatTOF = fPidHF -> GetPCompatTOF();
730  Double_t origThreshTPC = fPidHF -> GetPtThresholdTPC();
731  if (fPidOption == kStrong) {
732  fPidHF -> SetPCompatTOF(999999.);
733  fPidHF -> SetPtThresholdTPC(999999.);
734  }
735 
736 
737  Int_t isKaon = fPidHF -> MakeRawPid(bachelorTrack, AliPID::kKaon);
738 
739  if (isKaon < 0) {
740  fPidHF -> SetPCompatTOF(origCompatTOF);
741  fPidHF -> SetPtThresholdTPC(origThreshTPC);
742  return 0;
743  }
744 
745  if (fPidOption == kStrong && d->Pt() < fMaxPtStrongPid && isKaon <= 0) {
746  fPidHF -> SetPCompatTOF(origCompatTOF);
747  fPidHF -> SetPtThresholdTPC(origThreshTPC);
748  return 0;
749  }
750 
751 
752  fPidHF -> SetPCompatTOF(origCompatTOF);
753  fPidHF -> SetPtThresholdTPC(origThreshTPC);
754 
755  return 1;
756 }
757 
758 
759 
760 
761 //---------------------------------------------------------------------------
763 {
764  //
766  //
767 
768  if (fMaxRapidityCand > -998.) {
769  if (TMath::Abs(y) > fMaxRapidityCand) return kFALSE;
770  else return kTRUE;
771  }
772 
773  if (pt > 5.) {
774  // applying cut for pt > 5 GeV
775  AliDebug(2,Form("pt of cascade = %f (> 5), cutting at |y| < 0.8", pt));
776  if (TMath::Abs(y) > 0.8) return kFALSE;
777  } else {
778  // appliying smooth cut for pt < 5 GeV
779  Double_t maxFiducialY = -0.2/15*pt*pt + 1.9/15*pt + 0.5;
780  Double_t minFiducialY = 0.2/15*pt*pt - 1.9/15*pt - 0.5;
781  AliDebug(2,Form("pt of cascade = %f (< 5), cutting according to the fiducial zone [%f, %f]\n", pt, minFiducialY, maxFiducialY));
782  if (y < minFiducialY || y > maxFiducialY) return kFALSE;
783  }
784 
785  return kTRUE;
786 }
787 
788 
789 
790 
791 //---------------------------------------------------------------------------
793 {
794  //
796  //
797 
799  if (!d) {
800  AliDebug(2, "AliAODRecoCascadeHF null");
801  return kFALSE;
802  }
803 
804  if (!fTrackCuts) {
805  AliFatal("Cut object is not defined for bachelor. Candidate accepted.");
806  return kTRUE;
807  }
808 
809 
810  //___ 1./ Check bachelor tracks __________________
811  //_________________________________________________
812  AliAODTrack *bachelorTrack = (AliAODTrack*) d->GetBachelor();
813  if (!bachelorTrack) return kFALSE;
814 
815 
817  if(!bachelorTrack->HasPointOnITSLayer(0)) return kFALSE;
818  }
819 
820 
821  if (fKinkReject != (!(fTrackCuts->GetAcceptKinkDaughters())) ) {
822  AliError(Form("Not compatible setting: fKinkReject=%1d - fTrackCuts->GetAcceptKinkDaughters()=%1d",fKinkReject, fTrackCuts->GetAcceptKinkDaughters()));
823  return kFALSE;
824  }
825 
826 
827  AliAODVertex *vAOD = (AliAODVertex*) d->GetPrimaryVtx();
828  Double_t pos[3]; vAOD->GetXYZ(pos);
829  Double_t cov[6]; vAOD->GetCovarianceMatrix(cov);
830  const AliESDVertex vESD(pos,cov,100.,100);
831 
832  if (!IsDaughterSelected(bachelorTrack, &vESD, fTrackCuts)) return kFALSE;
833 
834  if (!fV0daughtersCuts) {
835  AliFatal("Cut object is not defined for V0daughters. Candidate accepted.");
836  return kTRUE;
837  }
838 
839 
840 
841  //___ 2./ Check V0 _______________________________
842  //_________________________________________________
843  AliAODv0 *v0 = (AliAODv0*) d->Getv0();
844  if (!v0) return kFALSE;
845 
846  AliAODTrack *v0positiveTrack = (AliAODTrack*) d->Getv0PositiveTrack();
847  AliAODTrack *v0negativeTrack = (AliAODTrack*) d->Getv0NegativeTrack();
848  if (!v0positiveTrack || !v0negativeTrack) return kFALSE;
849 
850 
851  Float_t etaMin=0, etaMax=0; fV0daughtersCuts->GetEtaRange(etaMin,etaMax);
852  if ( (v0positiveTrack->Eta()<=etaMin || v0positiveTrack->Eta()>=etaMax) ||
853  (v0negativeTrack->Eta()<=etaMin || v0negativeTrack->Eta()>=etaMax) ) return kFALSE;
854  Float_t ptMin=0, ptMax=0; fV0daughtersCuts->GetPtRange(ptMin,ptMax);
855  if ( (v0positiveTrack->Pt()<=ptMin || v0positiveTrack->Pt()>=ptMax) ||
856  (v0negativeTrack->Pt()<=ptMin || v0negativeTrack->Pt()>=ptMax) ) return kFALSE;
857 
858 
859  // Condition on nTPCclusters
860  if (fV0daughtersCuts->GetMinNClusterTPC()>0) {
861  if ( ((v0positiveTrack->GetTPCClusterInfo(2,1)) < fV0daughtersCuts->GetMinNClusterTPC()) ||
862  ((v0negativeTrack->GetTPCClusterInfo(2,1)) < fV0daughtersCuts->GetMinNClusterTPC()) ) return kFALSE;
863  }
864 
865 
866  // kTPCrefit status
867  if (v0->GetOnFlyStatus()==kFALSE) { // only for offline V0s
868  if (fV0daughtersCuts->GetRequireTPCRefit()) {
869  if( !(v0positiveTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
870  if( !(v0negativeTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
871  }
872  }
873 
874 
875  // kink condition
876  if (!fV0daughtersCuts->GetAcceptKinkDaughters()) {
877  AliAODVertex *maybeKinkPos = (AliAODVertex*)v0positiveTrack->GetProdVertex();
878  AliAODVertex *maybeKinkNeg = (AliAODVertex*)v0negativeTrack->GetProdVertex();
879  if (maybeKinkPos->GetType()==AliAODVertex::kKink ||
880  maybeKinkNeg->GetType()==AliAODVertex::kKink) return kFALSE;
881  }
882 
883 
884  // Findable clusters > 0 condition - from V0 analysis
885  // if( v0positiveTrack->GetTPCNclsF()<=0 || v0negativeTrack->GetTPCNclsF()<=0 ) return kFALSE;
886  /*
887  Float_t lPosTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
888  Float_t lNegTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
889  fTreeVariableLeastNbrCrossedRows = (Int_t) lPosTrackCrossedRows;
890  if( lNegTrackCrossedRows < fTreeVariableLeastNbrCrossedRows )
891  fTreeVariableLeastNbrCrossedRows = (Int_t) lNegTrackCrossedRows;
892  //Compute ratio Crossed Rows / Findable clusters
893  //Note: above test avoids division by zero!
894  Float_t lPosTrackCrossedRowsOverFindable = lPosTrackCrossedRows / ((double)(pTrack->GetTPCNclsF()));
895  Float_t lNegTrackCrossedRowsOverFindable = lNegTrackCrossedRows / ((double)(nTrack->GetTPCNclsF()));
896  fTreeVariableLeastRatioCrossedRowsOverFindable = lPosTrackCrossedRowsOverFindable;
897  if( lNegTrackCrossedRowsOverFindable < fTreeVariableLeastRatioCrossedRowsOverFindable )
898  fTreeVariableLeastRatioCrossedRowsOverFindable = lNegTrackCrossedRowsOverFindable;
899  //Lowest Cut Level for Ratio Crossed Rows / Findable = 0.8, set here
900  if ( fTreeVariableLeastRatioCrossedRowsOverFindable < 0.8 ) return kFALSE;
901  */
902 
903  return kTRUE;
904 }
905 
906 
907 
908 
909 //---------------------------------------------------------------------------
911 {
912  //
914  //
915 
916  const Int_t nvars = this->GetNVars() ;
917  fV0Type = (this->GetCuts())[nvars-1];
918  TString *sVarNames = GetVarNames();
919 
920  if (sVarNames[nvars-1].Contains("V0 type")) {
921  return (Int_t)fV0Type;
922  } else {
923  AliInfo("AliRDHFCutsDstoK0sK Last variable is not the V0 type!!!");
924  return -999;
925  }
926 }
Double_t fMaxPtCandTrackSPDFirst
flag to select the track kFirst criteria for pt < ptlimit
Definition: AliRDHFCuts.h:504
Int_t GetNVars() const
Definition: AliRDHFCuts.h:267
Int_t PtBin(Float_t pt) const
Definition: AliRDHFCuts.h:330
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:482
Bool_t SetMCPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod) const
Bool_t fRemoveDaughtersFromPrimary
Definition: AliRDHFCuts.h:481
void AddTrackCutsV0daughters(AliESDtrackCuts *v0daug)
AliAODTrack * Getv0NegativeTrack() const
AliAODv0 * Getv0() const
Bool_t PreSelect(TObject *obj, AliAODv0 *v0, AliVTrack *bachelorTrack)
Bool_t AreDtoK0sDaughtersSelected(AliAODRecoDecayHF *rd) const
const Float_t * GetCuts() const
Definition: AliRDHFCuts.h:271
void SetNVars(Int_t nVars)
Definition: AliRDHFCuts.h:445
Double_t CosPointingAngleXY() const
virtual Int_t IsSelectedPID(AliAODRecoDecayHF *obj)
Double_t fMaxRapidityCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:501
TString * GetVarNames() const
Definition: AliRDHFCuts.h:268
Double_t ptMin
AliRDHFCuts & operator=(const AliRDHFCuts &source)
Double_t DecayLengthXYV0() const
Bool_t fUsePID
Definition: AliRDHFCuts.h:476
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:512
Int_t fnVarsForOpt
Definition: AliRDHFCuts.h:471
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:500
AliESDtrackCuts * fTrackCuts
quality cuts on the daughter tracks
Definition: AliRDHFCuts.h:464
AliAODTrack * GetBachelor() const
AliAODVertex * GetOwnPrimaryVtx() const
Double_t nsigma
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:474
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:472
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:503
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:511
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:478
Bool_t RecalcOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod) 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:499
Bool_t IsDaughterSelected(AliAODTrack *track, const AliESDVertex *primary, AliESDtrackCuts *cuts, const AliAODEvent *aod=0x0) const