AliPhysics  8bb951a (8bb951a)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliRDHFCutsLctoV0.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 Lc->V0+X
21 //
22 // Modified by A.De Caro - decaro@sa.infn.it
23 //
25 
26 #include <Riostream.h>
27 
28 #include <TDatabasePDG.h>
29 #include <TMath.h>
30 
31 #include "AliAnalysisManager.h"
32 #include "AliInputEventHandler.h"
33 #include "AliPIDResponse.h"
34 #include "AliRDHFCutsLctoV0.h"
35 #include "AliAODRecoCascadeHF.h"
36 #include "AliAODTrack.h"
37 #include "AliESDtrack.h"
38 #include "AliESDVertex.h"
39 #include "AliAODVertex.h"
40 #include "AliAODv0.h"
41 #include "AliESDv0.h"
42 
43 using std::cout;
44 using std::endl;
45 
49 
50 
51 //--------------------------------------------------------------------------
52 AliRDHFCutsLctoV0::AliRDHFCutsLctoV0(const char* name, Short_t /*v0channel*/) :
53 AliRDHFCuts(name),
54 fPidSelectionFlag(0),
55 fV0daughtersCuts(0),
56 fV0Type(0),
57 fHighPtCut(2.5),
58 fLowPtCut(1.0),
59 fExcludedCut(-1),
60 fMinCombinedProbability(0)
61 {
62  //
63  // Default Constructor
64  //
65 
66  const Int_t nvars=17;
67  SetNVars(nvars);
68  TString varNames[nvars]={"Lc inv. mass if K0S [GeV/c2]", // 0
69  "Lc inv. mass if Lambda [GeV/c2]", // 1
70  "K0S inv. mass [GeV/c2]", // 2
71  "Lambda/LambdaBar inv. mass[GeV/c2]", // 3
72  "pT min bachelor track [GeV/c]", // 4
73  "pT min V0-positive track [GeV/c]", // 5
74  "pT min V0-negative track [GeV/c]", // 6
75  "dca cascade (prong-to-prong) cut [cm]", // 7
76  "dca V0 (prong-to-prong) cut [number of sigmas]", // 8
77  "V0 cosPA min wrt PV", // 9
78  "d0 max bachelor wrt PV [cm]", // 10
79  "d0 max V0 wrt PV [cm]", // 11
80  "mass K0S veto [GeV/c2]", // 12
81  "mass Lambda/LambdaBar veto [GeV/c2]", // 13
82  "mass Gamma veto [GeV/c2]", // 14
83  "pT min V0 track [GeV/c]", // 15
84  "V0 type" // 16
85  };
86 
87  Bool_t isUpperCut[nvars]={kTRUE, // 0
88  kTRUE, // 1
89  kTRUE, // 2
90  kTRUE, // 3
91  kFALSE, // 4
92  kFALSE, // 5
93  kFALSE, // 6
94  kTRUE, // 7
95  kTRUE, // 8
96  kFALSE, // 9
97  kTRUE, // 10
98  kTRUE, // 11
99  kFALSE, // 12
100  kFALSE, // 13
101  kFALSE, // 14
102  kFALSE, // 15
103  kFALSE // 16
104  };
105  SetVarNames(nvars,varNames,isUpperCut);
106  Bool_t forOpt[nvars]={kFALSE, // 0
107  kFALSE, // 1
108  kTRUE, // 2
109  kTRUE, // 3
110  kTRUE, // 4
111  kTRUE, // 5
112  kTRUE, // 6
113  kTRUE, // 7
114  kTRUE, // 8
115  kTRUE, // 9
116  kTRUE, // 10
117  kTRUE, // 11
118  kTRUE, // 12
119  kTRUE, // 13
120  kTRUE, // 14
121  kTRUE, // 15
122  kFALSE // 16
123  };
124  SetVarsForOpt(nvars,forOpt);
125 
126  Float_t limits[2]={0,999999999.};
127  SetPtBins(2,limits);
128 
129  /*
130  switch (v0channel) {
131  case 0:
132  fV0channel = 0x0001;
133  break;
134  case 1:
135  fV0channel = 0x0002;
136  break;
137  case 2:
138  fV0channel = 0x0004;
139  break;
140  }
141  */
142 
143 }
144 //--------------------------------------------------------------------------
146  AliRDHFCuts(source),
147  fPidSelectionFlag(source.fPidSelectionFlag),
148  fV0daughtersCuts(0),
149  fV0Type(source.fV0Type),
150  fHighPtCut(source.fHighPtCut),
151  fLowPtCut(source.fLowPtCut),
152  fExcludedCut(source.fExcludedCut),
153  fMinCombinedProbability(0)
154 {
155  //
156  // Copy constructor
157  //
158 
160  else fV0daughtersCuts = new AliESDtrackCuts();
161 
163 
164 }
165 //--------------------------------------------------------------------------
167 {
168  //
169  // assignment operator
170  //
171 
172  if (this != &source) {
173 
174  AliRDHFCuts::operator=(source);
176 
177  delete fV0daughtersCuts;
178  fV0daughtersCuts = new AliESDtrackCuts(*(source.fV0daughtersCuts));
179 
180  fV0Type = source.fV0Type;
181 
182  fHighPtCut = source.fHighPtCut;
183  fLowPtCut = source.fLowPtCut;
184 
186 
187  }
188 
189  return *this;
190 }
191 
192 
193 //---------------------------------------------------------------------------
195  //
196  // Default Destructor
197  //
198 
199  if (fV0daughtersCuts) {
200  delete fV0daughtersCuts;
202  }
203 
205  delete [] fMinCombinedProbability;
207  }
208 
209 }
210 
211 //---------------------------------------------------------------------------
212 void AliRDHFCutsLctoV0::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
213  //
214  // Fills in vars the values of the variables
215  //
216 
217  if (pdgdaughters[0]==-9999) return; // dummy
218 
219  if (nvars!=fnVarsForOpt) {
220  printf("AliRDHFCutsLctoV0::GetCutVarsForOpt: wrong number of variables\n");
221  return;
222  }
223 
224  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
225  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
226  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
227 
229 
230  // Get the v0 and all daughter tracks
231  AliAODTrack *bachelorTrack = (AliAODTrack*)dd->GetBachelor();
232  AliAODv0 *v0 = (AliAODv0*)dd->Getv0();
233  AliAODTrack *v0positiveTrack = (AliAODTrack*)dd->Getv0PositiveTrack();
234  AliAODTrack *v0negativeTrack = (AliAODTrack*)dd->Getv0NegativeTrack();
235 
236  Int_t iter=-1;
237  // cut on cascade mass, if K0S + p
238  if (fVarsForOpt[0]) {
239  iter++;
240  vars[iter]=TMath::Abs(dd->InvMassLctoK0sP()-mLcPDG);
241  }
242  // cut on cascade mass, if Lambda/LambdaBar + pi
243  if (fVarsForOpt[1]) {
244  iter++;
245  vars[iter]=TMath::Abs(dd->InvMassLctoLambdaPi()-mLcPDG);
246  }
247 
248  // cut on V0 mass if K0S
249  if (fVarsForOpt[2]) {
250  iter++;
251  vars[iter]=TMath::Abs(v0->MassK0Short()-mk0sPDG);
252  }
253 
254  // cut on V0 mass if Lambda/LambdaBar
255  if (fVarsForOpt[3]) {
256 
257  if (bachelorTrack->Charge()==1) {
258  iter++;
259  vars[iter]=TMath::Abs(v0->MassLambda()-mLPDG);
260  } else if (bachelorTrack->Charge()==-1) {
261  iter++;
262  vars[iter]=TMath::Abs(v0->MassAntiLambda()-mLPDG);
263  }
264 
265  }
266 
267  // cut bachelor min pt
268  if (fVarsForOpt[4]) {
269  iter++;
270  vars[iter]=bachelorTrack->Pt();
271  }
272 
273  // cut on V0-positive min pt
274  if (fVarsForOpt[5]) {
275  iter++;
276  vars[iter]=v0positiveTrack->Pt();
277  }
278 
279  // cut on V0-negative min pt
280  if (fVarsForOpt[6]) {
281  iter++;
282  vars[iter]=v0negativeTrack->Pt();
283  }
284 
285  // cut on cascade dca (prong-to-prong)
286  if (fVarsForOpt[7]) {
287  iter++;
288  vars[iter]=dd->GetDCA(); // prong-to-prong cascade DCA
289  }
290 
291  // cut on V0 dca (prong-to-prong)
292  if (fVarsForOpt[8]) {
293  iter++;
294  vars[iter]=v0->GetDCA(); // prong-to-prong V0 DCA
295  }
296 
297  // cut on V0 cosPA wrt PV
298  if (fVarsForOpt[9]) {
299  iter++;
300  vars[iter]=dd->CosV0PointingAngle(); // cosine of V0 pointing angle wrt primary vertex
301  }
302 
303  // cut on bachelor transverse impact parameter wrt PV
304  if (fVarsForOpt[10]) {
305  iter++;
306  vars[iter]=dd->Getd0Prong(0); // bachelor transverse impact parameter wrt primary vertex
307  }
308 
309  // cut on V0 transverse impact parameter wrt PV
310  if (fVarsForOpt[11]) {
311  iter++;
312  vars[iter]=dd->Getd0Prong(1); // V0 transverse impact parameter wrt primary vertex
313  }
314 
315  // cut on K0S invariant mass veto
316  if (fVarsForOpt[12]) {
317  iter++;
318  vars[iter]=TMath::Abs(v0->MassK0Short()-mk0sPDG); // K0S invariant mass veto
319  }
320 
321  // cut on Lambda/LambdaBar invariant mass veto
322  if (fVarsForOpt[13]) {
323 
324  if (bachelorTrack->Charge()==1) {
325  iter++;
326  vars[iter]=TMath::Abs(v0->MassLambda()-mLPDG);
327  } else if (bachelorTrack->Charge()==-1) {
328  iter++;
329  vars[iter]=TMath::Abs(v0->MassAntiLambda()-mLPDG);
330  }
331 
332  }
333 
334  // cut on gamma invariant mass veto
335  if (fVarsForOpt[14]) {
336  iter++;
337  vars[iter]= v0->InvMass2Prongs(0,1,11,11); // gamma invariant mass veto
338  }
339 
340 
341  // cut on V0 pT min
342  if (fVarsForOpt[15]) {
343  iter++;
344  vars[iter]= v0->Pt(); // V0 pT min
345  }
346 
347 
348  return;
349 }
350 //---------------------------------------------------------------------------
351 Int_t AliRDHFCutsLctoV0::IsSelected(TObject* obj,Int_t selectionLevel) {
352  //
353  // Apply selection
354  //
355 
356  if (!fCutsRD) {
357  AliFatal("Cut matrice not inizialized. Exit...");
358  return 0;
359  }
360 
362  if (!d) {
363  AliDebug(2,"AliAODRecoCascadeHF null");
364  return 0;
365  }
366 
367  if (!d->GetSecondaryVtx()) {
368  AliDebug(2,"No secondary vertex for cascade");
369  return 0;
370  }
371 
372  if (d->GetNDaughters()!=2) {
373  AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",d->GetNDaughters()));
374  return 0;
375  }
376 
377  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
378 
379  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
380  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
381 
382  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
383  if (!v0 || !bachelorTrack) {
384  AliDebug(2,"No V0 or no bachelor for current cascade");
385  return 0;
386  }
387 
388  if (bachelorTrack->GetID()<0) {
389  AliDebug(2,Form("Bachelor has negative ID %d",bachelorTrack->GetID()));
390  return 0;
391  }
392 
393  if (!v0->GetSecondaryVtx()) {
394  AliDebug(2,"No secondary vertex for V0 by cascade");
395  return 0;
396  }
397 
398  if (v0->GetNDaughters()!=2) {
399  AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0->GetOnFlyStatus(),v0->GetNDaughters()));
400  return 0;
401  }
402 
403 
404  // Get the V0 daughter tracks
405  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
406  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
407  if (!v0positiveTrack || !v0negativeTrack ) {
408  AliDebug(2,"No V0 daughters' objects");
409  return 0;
410  }
411 
412  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
413  AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",v0positiveTrack->GetID(),v0negativeTrack->GetID()));
414  return 0;
415  }
416 
417  //if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
418  if ( fUseTrackSelectionWithFilterBits && !(bachelorTrack->TestFilterMask(BIT(4))) ) {
419  AliDebug(2,"Check on the bachelor FilterBit: no BIT(4). Candidate rejected.");
420  return 0;
421  }
422 
423  Int_t returnvalueTrack = 7;
424 
425  // selection on daughter tracks
426  if (selectionLevel==AliRDHFCuts::kAll ||
427  selectionLevel==AliRDHFCuts::kTracks) {
428 
429  if (!AreLctoV0DaughtersSelected(d)) return 0;
430 
431  }
432 
433  Bool_t okLck0sp=kTRUE, okLcLpi=kTRUE, okLcLBarpi=kTRUE;
434 
435  // selection on candidate
436  if (selectionLevel==AliRDHFCuts::kAll ||
437  selectionLevel==AliRDHFCuts::kCandidate) {
438 
439  Double_t pt = d->Pt();
440  Int_t ptbin = PtBin(pt);
441 
442  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
443  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
444  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
445 
446  // K0S + p
447  Double_t mk0s = v0->MassK0Short();
448  Double_t mLck0sp = d->InvMassLctoK0sP();
449 
450  // Lambda + pi
451  Double_t mlambda = v0->MassLambda();
452  Double_t malambda = v0->MassAntiLambda();
453  Double_t mLcLpi = d->InvMassLctoLambdaPi();
454 
455  Bool_t okK0spipi=kTRUE, okLppi=kTRUE, okLBarpip=kTRUE;
456  Bool_t isNotK0S = kTRUE, isNotLambda = kTRUE, isNotLambdaBar = kTRUE, isNotGamma = kTRUE;
457 
458  // cut on Lc mass with K0S+p hypothesis
459  if (TMath::Abs(mLck0sp-mLcPDG) > fCutsRD[GetGlobalIndex(0,ptbin)] && fExcludedCut!=0) {
460  okLck0sp = kFALSE;
461  AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to Lambda_c into K0S+p cut",mLck0sp));
462  }
463 
464  // cuts on the V0 mass: K0S case
465  if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(2,ptbin)] && fExcludedCut!=2) {
466  okK0spipi = kFALSE;
467  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to K0S cut",mk0s));
468  }
469 
470  // cut on Lc mass with Lambda+pi hypothesis
471  if (TMath::Abs(mLcLpi-mLcPDG) > fCutsRD[GetGlobalIndex(1,ptbin)] && fExcludedCut!=1) {
472  okLcLpi = kFALSE;
473  okLcLBarpi = kFALSE;
474  AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to Lambda_c into Lambda+pi cut",mLcLpi));
475  }
476 
477  // cuts on the V0 mass: Lambda/LambdaBar case
478  //if ( !(bachelorTrack->Charge()==+1 && TMath::Abs(mlambda-mLPDG) <= fCutsRD[GetGlobalIndex(3,ptbin)] ) ) {
479  if ( TMath::Abs(mlambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)] && fExcludedCut!=3) {
480  okLppi = kFALSE;
481  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to LambdaBar cut",mlambda));
482  }
483 
484  //if ( !(bachelorTrack->Charge()==-1 && TMath::Abs(malambda-mLPDG) <= fCutsRD[GetGlobalIndex(3,ptbin)] ) ) {
485  if ( TMath::Abs(malambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)] && fExcludedCut!=3) {
486  okLBarpip = kFALSE;
487  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to LambdaBar cut",malambda));
488  }
489 
490  // cut on K0S invariant mass veto
491  if (TMath::Abs(v0->MassK0Short()-mk0sPDG) < fCutsRD[GetGlobalIndex(12,ptbin)] && fExcludedCut!=12) { // K0S invariant mass veto
492  AliDebug(4,Form(" veto on K0S invariant mass doesn't pass the cut"));
493  //return 0;
494  isNotK0S=kFALSE;
495  }
496 
497  // cut on Lambda/LambdaBar invariant mass veto
498  if (TMath::Abs(v0->MassLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) { // Lambda invariant mass veto
499  AliDebug(4,Form(" veto on Lambda invariant mass doesn't pass the cut"));
500  isNotLambda=kFALSE;
501  //return 0;
502  }
503  if (TMath::Abs(v0->MassAntiLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) { // LambdaBar invariant mass veto
504  AliDebug(4,Form(" veto on LambdaBar invariant mass doesn't pass the cut"));
505  isNotLambdaBar=kFALSE;
506  //return 0;
507  }
508 
509  // cut on gamma invariant mass veto
510  if (v0->InvMass2Prongs(0,1,11,11) < fCutsRD[GetGlobalIndex(14,ptbin)] && fExcludedCut!=14) { // K0S invariant mass veto
511  AliDebug(4,Form(" veto on gamma invariant mass doesn't pass the cut"));
512  isNotGamma=kFALSE;
513  //return 0;
514  }
515 
516  okLck0sp = okLck0sp && okK0spipi && isNotLambda && isNotLambdaBar && isNotGamma;
517  okLcLpi = okLcLpi && okLppi && isNotK0S && isNotLambdaBar && isNotGamma;
518  okLcLBarpi = okLcLBarpi && okLBarpip && isNotK0S && isNotLambda && isNotGamma;
519 
520  if (!okLck0sp && !okLcLpi && !okLcLBarpi) return 0;
521 
522  // cuts on the minimum pt of the tracks
523  if (TMath::Abs(bachelorTrack->Pt()) < fCutsRD[GetGlobalIndex(4,ptbin)] && fExcludedCut!=4) {
524  AliDebug(4,Form(" bachelor track Pt=%2.2e > %2.2e",bachelorTrack->Pt(),fCutsRD[GetGlobalIndex(4,ptbin)]));
525  return 0;
526  }
527  if (TMath::Abs(v0positiveTrack->Pt()) < fCutsRD[GetGlobalIndex(5,ptbin)] && fExcludedCut!=5) {
528  AliDebug(4,Form(" V0-positive track Pt=%2.2e > %2.2e",v0positiveTrack->Pt(),fCutsRD[GetGlobalIndex(5,ptbin)]));
529  return 0;
530  }
531  if (TMath::Abs(v0negativeTrack->Pt()) < fCutsRD[GetGlobalIndex(6,ptbin)] && fExcludedCut!=6) {
532  AliDebug(4,Form(" V0-negative track Pt=%2.2e > %2.2e",v0negativeTrack->Pt(),fCutsRD[GetGlobalIndex(6,ptbin)]));
533  return 0;
534  }
535 
536  // cut on cascade dca (prong-to-prong)
537  if ( TMath::Abs(d->GetDCA()) > fCutsRD[GetGlobalIndex(7,ptbin)] && fExcludedCut!=7) { // prong-to-prong cascade DCA
538  AliDebug(4,Form(" cascade tracks DCA don't pass the cut"));
539  return 0;
540  }
541 
542  // cut on V0 dca (prong-to-prong)
543  if ( TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(8,ptbin)] && fExcludedCut!=8) { // prong-to-prong V0 DCA
544  AliDebug(4,Form(" V0 DCA don't pass the cut"));
545  return 0;
546  }
547 
548  // cut on V0 cosine of pointing angle wrt PV
549  if (d->CosV0PointingAngle() < fCutsRD[GetGlobalIndex(9,ptbin)] && fExcludedCut!=9) { // cosine of V0 pointing angle wrt primary vertex
550  AliDebug(4,Form(" V0 cosine of pointing angle doesn't pass the cut"));
551  return 0;
552  }
553 
554  // cut on bachelor transverse impact parameter wrt PV
555  if (TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(10,ptbin)] && fExcludedCut!=10) { // bachelor transverse impact parameter wrt PV
556  AliDebug(4,Form(" bachelor transverse impact parameter doesn't pass the cut"));
557  return 0;
558  }
559 
560  // cut on V0 transverse impact parameter wrt PV
561  if (TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(11,ptbin)] && fExcludedCut!=11) { // V0 transverse impact parameter wrt PV
562  AliDebug(4,Form(" V0 transverse impact parameter doesn't pass the cut"));
563  return 0;
564  }
565 
566  // cut on V0 pT min
567  if (v0->Pt() < fCutsRD[GetGlobalIndex(15,ptbin)] && fExcludedCut!=15) { // V0 pT min
568  AliDebug(4,Form(" V0 track Pt=%2.2e > %2.2e",v0->Pt(),fCutsRD[GetGlobalIndex(15,ptbin)]));
569  return 0;
570  }
571 
572  }
573 
574  Int_t returnvalue = okLck0sp+2*okLcLBarpi+4*okLcLpi;
575  /*
576  retvalue case
577  1 Lc->K0S + p
578  2 Lc->LambdaBar + pi
579  3 Lc->K0S + p AND Lc->LambdaBar + pi
580  4 Lc->Lambda + pi
581  5 Lc->K0S + p AND Lc->Lambda + pi
582  6 Lc->LambdaBar + pi AND Lc->Lambda + pi
583  7 Lc->K0S + p AND Lc->LambdaBar + pi AND Lc->Lambda + pi
584  */
585 
586  Int_t returnvaluePID = 7;
587 
588  // selection on candidate
589  if (selectionLevel==AliRDHFCuts::kAll ||
590  selectionLevel==AliRDHFCuts::kCandidate ||
591  selectionLevel==AliRDHFCuts::kPID )
592  returnvaluePID = IsSelectedPID(d);
593 
594  //if (fUsePID && returnvaluePID==0) return 0;
595 
596  Int_t returnvalueTot = 0;
597  if ( fUsePID )
598  returnvalueTot = CombineCuts(returnvalueTrack,returnvalue,returnvaluePID);
599  else
600  returnvalueTot = CombineCuts(returnvalueTrack,returnvalue,7);
601 
602  return returnvalueTot;
603 
604 }
605 //---------------------------------------------------------------------------
607 
608  // fPidHF -> PID object for bachelor
609 
610  if (!fUsePID || !obj) {
611  AliDebug(2,"PID selection inactive. Candidate accepted.");
612  return 7; // all hypothesis are valid
613  }
614 
616 
617  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(objD->Getv0());
618  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
619  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
620 
621  AliAODTrack *bachelor = (AliAODTrack*)objD->GetBachelor();
622  AliAODTrack *v0Pos = (AliAODTrack*)objD->Getv0PositiveTrack();
623  AliAODTrack *v0Neg = (AliAODTrack*)objD->Getv0NegativeTrack();
624 
625  if (!bachelor || !v0Pos || !v0Neg) return 0;
626 
627  Bool_t okLcK0Sp = kTRUE; // K0S case
628  Bool_t okLcLambdaBarPi = kTRUE; // LambdaBar case
629  Bool_t okLcLambdaPi = kTRUE; // Lambda case
630 
631  Double_t ptCand = objD->Pt();
632  Int_t candPtBin = PtBin(ptCand);
633  CheckPID(candPtBin,bachelor,v0Neg,v0Pos,okLcK0Sp,okLcLambdaBarPi,okLcLambdaPi);
634 
635  Int_t returnvalue = okLcK0Sp+2*okLcLambdaBarPi+4*okLcLambdaPi;
636 
637  return returnvalue;
638 }
639 //-----------------------
640 void AliRDHFCutsLctoV0::CheckPID(Int_t candPtBin, AliAODTrack *bachelor,
641  AliAODTrack * /*v0Neg*/, AliAODTrack * /*v0Pos*/,
642  Bool_t &isBachelorID1, Bool_t &isBachelorID2, Bool_t &isBachelorID4) {
643  // identification strategy
644 
645  Int_t idxIDbyTOF = -1;
646  Int_t idxIDbyTPC = -1;
647 
648  Int_t tpcID = -1;
649  Int_t tofID = -1;
650  Double_t nTPCsigmas = -999;
651  Double_t nTOFsigmas = -999;
652 
653  Bool_t trackIDByTOF = -1;
654  Bool_t trackIDByTPC = -1;
655 
656  Bool_t dummy = kFALSE;
657 
658  switch (fPidSelectionFlag) {
659 
660  case 0:
661 
662  // identify bachelor
663  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,4);
664  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,4);
665  isBachelorID1 = (idxIDbyTOF==4) && (idxIDbyTPC==4); // K0S case
666 
667  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,2);
668  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,2);
669  isBachelorID2 = (idxIDbyTOF==2) && (idxIDbyTPC==2); // LambdaBar case
670 
671  isBachelorID4 = isBachelorID2; // Lambda case
672 
673  break;
674 
675  case 1:
676 
677  // identify bachelor
678  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,4);
679  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,4);
680  dummy = ( !(fPidHF->CheckTOFPIDStatus(bachelor)) && (idxIDbyTPC==4) &&
681  fPidHF->IsExcluded(bachelor,2,2.,"TPC") && fPidHF->IsExcluded(bachelor,3,2.,"TPC") ); // K0S case
682  isBachelorID1 = ( (idxIDbyTOF==4) || dummy );
683 
684  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,2);
685  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,2);
686  dummy = ( !(fPidHF->CheckTOFPIDStatus(bachelor)) && (idxIDbyTPC==2) &&
687  fPidHF->IsExcluded(bachelor,3,2.,"TPC") && fPidHF->IsExcluded(bachelor,4,2.,"TPC") ); // LambdaBar case
688  isBachelorID2 = ( (idxIDbyTOF==2) || dummy );
689 
690  isBachelorID4 = isBachelorID2; // Lambda case
691 
692  break;
693 
694  case 2:
695 
696  // identify bachelor
697  nTOFsigmas = -999;
698  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
699  nTPCsigmas = -999;
700  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
701  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
702  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
703  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
704  (bachelor->P()>=fLowPtCut && TMath::Abs(nTPCsigmas)<3) ) );
705  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // K0S case
706 
707  nTOFsigmas = -999;
708  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
709  nTPCsigmas = -999;
710  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
711  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
712  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
713  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
714  (bachelor->P()>=fLowPtCut && TMath::Abs(nTPCsigmas)<3) ) );
715  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // LambdaBar case
716 
717  isBachelorID4 = isBachelorID2; // Lambda case
718 
719  break;
720 
721  case 3:
722 
723  // identify bachelor
724  nTOFsigmas = -999;
725  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
726  nTPCsigmas = -999;
727  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
728  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
729  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
730  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
731  (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTPCsigmas)<3) ||
732  (bachelor->P()>=fHighPtCut && nTPCsigmas>-3 && nTPCsigmas<2) ) );
733  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // K0S case
734 
735  nTOFsigmas = -999;
736  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
737  nTPCsigmas = -999;
738  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
739  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
740  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
741  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
742  (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTPCsigmas)<3) ||
743  (bachelor->P()>=fHighPtCut && nTPCsigmas>-3 && nTPCsigmas<2) ) );
744  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // LambdaBar case
745 
746  isBachelorID4 = isBachelorID2; // Lambda case
747 
748  break;
749 
750  case 4:
751 
752  // identify bachelor
753  nTOFsigmas = -999;
754  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
755  nTPCsigmas = -999;
756  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
757  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
758  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
759  trackIDByTPC = ( (tpcID==1) && (TMath::Abs(nTPCsigmas)<2) );
760  isBachelorID1 = ( (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTOF) ); // K0S case
761 
762  nTOFsigmas = -999;
763  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
764  nTPCsigmas = -999;
765  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
766  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
767  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
768  trackIDByTPC = ( (tpcID==1) && (TMath::Abs(nTPCsigmas)<2) );
769  isBachelorID2 = ( (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTOF) ); // LambdaBar case
770 
771  isBachelorID4 = isBachelorID2; // Lambda case
772 
773  break;
774 
775  case 5:
776 
777  // identify bachelor
778  nTOFsigmas = -999;
779  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
780  nTPCsigmas = -999;
781  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
782  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
783  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
784  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
785  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
786 
787  nTOFsigmas = -999;
788  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
789  nTPCsigmas = -999;
790  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
791  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
792  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
793  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
794  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
795 
796  isBachelorID4 = isBachelorID2; // Lambda case
797 
798  break;
799 
800  case 6:
801 
802  // identify bachelor
803  nTOFsigmas = -999;
804  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
805  nTPCsigmas = -999;
806  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
807  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
808  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
809  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
810  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
811 
812  nTOFsigmas = -999;
813  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
814  nTPCsigmas = -999;
815  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
816  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
817  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
818  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
819  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
820 
821  isBachelorID4 = isBachelorID2; // Lambda case
822 
823  break;
824 
825  case 7:
826 
827  // identify bachelor
828  nTOFsigmas = -999;
829  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
830  nTPCsigmas = -999;
831  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
832  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
833  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
834  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fLowPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
835  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
836 
837  nTOFsigmas = -999;
838  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
839  nTPCsigmas = -999;
840  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
841  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
842  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
843  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
844  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
845 
846  isBachelorID4 = isBachelorID2; // Lambda case
847 
848  break;
849 
850  case 8:
851 
852  // identify bachelor
853  nTOFsigmas = -999;
854  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
855  nTPCsigmas = -999;
856  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
857  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
858  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
859  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fLowPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
860  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
861 
862  nTOFsigmas = -999;
863  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
864  nTPCsigmas = -999;
865  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
866  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
867  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
868  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
869  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
870 
871  isBachelorID4 = isBachelorID2; // Lambda case
872 
873  break;
874 
875  case 9:
876  {
877  // identify bachelor
878  fPidHF->GetPidCombined()->SetDefaultTPCPriors();
879  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
880  Double_t probTPCTOF[AliPID::kSPECIES]={-1.};
881  UInt_t detUsed = fPidHF->GetPidCombined()->ComputeProbabilities(bachelor, fPidHF->GetPidResponse(), probTPCTOF);
882  Double_t probProton = -1.;
883  Double_t probPion = -1.;
884  if (detUsed == (UInt_t)fPidHF->GetPidCombined()->GetDetectorMask() ) {
885  probProton = probTPCTOF[AliPID::kProton];
886  probPion = probTPCTOF[AliPID::kPion];
887  }
888  else { // if you don't have both TOF and TPC, try only TPC
889  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
890  detUsed = fPidHF->GetPidCombined()->ComputeProbabilities(bachelor, fPidHF->GetPidResponse(), probTPCTOF);
891  if (detUsed == (UInt_t)fPidHF->GetPidCombined()->GetDetectorMask()) {
892  probProton = probTPCTOF[AliPID::kProton];
893  probPion = probTPCTOF[AliPID::kPion];
894  }
895  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
896  }
897 
898  isBachelorID1=(probProton>fMinCombinedProbability[candPtBin]); // K0S case
899 
900  isBachelorID2=(probPion>fMinCombinedProbability[candPtBin]); // LambdaBar case
901 
902  isBachelorID4 = isBachelorID2; // Lambda case
903  }
904  break;
905 
906  }
907 
908 }
909 //----------------
910 Int_t AliRDHFCutsLctoV0::CombineCuts(Int_t returnvalueTrack, Int_t returnvalue, Int_t returnvaluePID) const {
911  //
912  // combine track selection, topological cuts and PID
913  //
914 
915  Int_t returnvalueTot=returnvalueTrack&returnvalue;
916  returnvalueTot=returnvalueTot&returnvaluePID;
917 
918  return returnvalueTot;
919 }
920 
921 //----------------------------------
922 Int_t AliRDHFCutsLctoV0::IsSelectedSingleCut(TObject* obj, Int_t selectionLevel, Int_t cutIndex) {
923  //
924  // Apply selection on single cut
925  //
926 
927  if (!fCutsRD) {
928  AliDebug(2,"Cut matrice not inizialized. Exit...");
929  return 0;
930  }
931 
933  if (!d) {
934  AliDebug(2,"AliAODRecoCascadeHF null");
935  return 0;
936  }
937 
938  if (!d->GetSecondaryVtx()) {
939  AliDebug(2,"No secondary vertex for cascade");
940  return 0;
941  }
942 
943  if (d->GetNDaughters()!=2) {
944  AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",d->GetNDaughters()));
945  return 0;
946  }
947 
948  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
949  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
950  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
951 
952  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
953  if (!v0 || !bachelorTrack) {
954  AliDebug(2,"No V0 or no bachelor for current cascade");
955  return 0;
956  }
957 
958  if (bachelorTrack->GetID()<0) {
959  AliDebug(2,Form("Bachelor has negative ID %d",bachelorTrack->GetID()));
960  return 0;
961  }
962 
963  if (!v0->GetSecondaryVtx()) {
964  AliDebug(2,"No secondary vertex for V0 by cascade");
965  return 0;
966  }
967 
968  if (v0->GetNDaughters()!=2) {
969  AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0->GetOnFlyStatus(),v0->GetNDaughters()));
970  return 0;
971  }
972 
973 
974  // Get the V0 daughter tracks
975  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
976  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
977  if (!v0positiveTrack || !v0negativeTrack ) {
978  AliDebug(2,"No V0 daughters' objects");
979  return 0;
980  }
981 
982  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
983  AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",v0positiveTrack->GetID(),v0negativeTrack->GetID()));
984  return 0;
985  }
986 
987  //if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
988  if ( fUseTrackSelectionWithFilterBits && !(bachelorTrack->TestFilterMask(BIT(4))) ) {
989  AliDebug(2,"Check on the bachelor FilterBit: no BIT(4). Candidate rejected.");
990  return 0;
991  }
992 
993 
994  // selection on daughter tracks
995  if (selectionLevel==AliRDHFCuts::kAll ||
996  selectionLevel==AliRDHFCuts::kTracks) {
997 
998  if (!AreLctoV0DaughtersSelected(d)) return 0;
999 
1000  }
1001 
1002  Bool_t okLck0sp=kFALSE, okLcLpi=kFALSE, okLcLBarpi=kFALSE;
1003 
1004  // selection on candidate
1005  if (selectionLevel==AliRDHFCuts::kAll ||
1006  selectionLevel==AliRDHFCuts::kCandidate) {
1007 
1008  Double_t pt = d->Pt();
1009  Int_t ptbin = PtBin(pt);
1010 
1011  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
1012  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
1013  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
1014 
1015  // K0S + p
1016  Double_t mk0s = v0->MassK0Short();
1017  Double_t mLck0sp = d->InvMassLctoK0sP();
1018 
1019  // Lambda + pi
1020  Double_t mlambda = v0->MassLambda();
1021  Double_t malambda = v0->MassAntiLambda();
1022  Double_t mLcLpi = d->InvMassLctoLambdaPi();
1023 
1024  switch (cutIndex) {
1025  case 0:
1026  // cut on Lc mass with K0S+p hypothesis
1027  okLck0sp = TMath::Abs(mLck0sp-mLcPDG)<=fCutsRD[GetGlobalIndex(0,ptbin)];
1028  okLcLpi = kFALSE;
1029  okLcLBarpi = kFALSE;
1030  break;
1031  case 1:
1032  // cut on Lc mass with Lambda+pi hypothesis
1033  okLck0sp = kFALSE;
1034  okLcLpi = TMath::Abs(mLcLpi-mLcPDG)<=fCutsRD[GetGlobalIndex(1,ptbin)];
1035  okLcLBarpi = okLcLpi;
1036  break;
1037  case 2:
1038  // cuts on the V0 mass: K0S case
1039  okLck0sp = TMath::Abs(mk0s-mk0sPDG)<=fCutsRD[GetGlobalIndex(2,ptbin)];
1040  okLcLpi = kFALSE;
1041  okLcLBarpi = kFALSE;
1042  break;
1043  case 3:
1044  // cuts on the V0 mass: Lambda/LambdaBar case
1045  okLck0sp = kFALSE;
1046  okLcLpi = TMath::Abs(mlambda-mLPDG)<=fCutsRD[GetGlobalIndex(3,ptbin)];
1047  //okLcLpi = okLcLpi && (bachelorTrack->Charge()==+1);
1048  okLcLBarpi = TMath::Abs(malambda-mLPDG)<=fCutsRD[GetGlobalIndex(3,ptbin)];
1049  //okLcLBarpi = okLcLBarpi && (bachelorTrack->Charge()==-1);
1050  break;
1051  case 4:
1052  // cuts on the minimum pt of bachelor
1053  okLck0sp = TMath::Abs(bachelorTrack->Pt())>=fCutsRD[GetGlobalIndex(4,ptbin)];
1054  okLcLpi = okLck0sp;
1055  okLcLBarpi = okLck0sp;
1056  break;
1057  case 5:
1058  // cuts on the minimum pt of positive V0daughter
1059  okLck0sp = TMath::Abs(v0positiveTrack->Pt())>=fCutsRD[GetGlobalIndex(5,ptbin)];
1060  okLcLpi = okLck0sp;
1061  okLcLBarpi = okLck0sp;
1062  break;
1063  case 6:
1064  // cuts on the minimum pt of negative V0daughter
1065  okLck0sp = TMath::Abs(v0negativeTrack->Pt())>=fCutsRD[GetGlobalIndex(6,ptbin)];
1066  okLcLpi = okLck0sp;
1067  okLcLBarpi = okLck0sp;
1068  break;
1069  case 7:
1070  // cut on cascade dca
1071  okLck0sp = TMath::Abs(d->GetDCA())<=fCutsRD[GetGlobalIndex(7,ptbin)];
1072  okLcLpi = okLck0sp;
1073  okLcLBarpi = okLck0sp;
1074  break;
1075  case 8:
1076  // cut on V0 dca
1077  okLck0sp = TMath::Abs(v0->GetDCA())<=fCutsRD[GetGlobalIndex(8,ptbin)];
1078  okLcLpi = okLck0sp;
1079  okLcLBarpi = okLck0sp;
1080  break;
1081  case 9:
1082  // cut on V0 cosine of pointing angle wrt PV
1083  okLck0sp = d->CosV0PointingAngle()>=fCutsRD[GetGlobalIndex(9,ptbin)];
1084  okLcLpi = okLck0sp;
1085  okLcLBarpi = okLck0sp;
1086  break;
1087  case 10:
1088  // cut on bachelor transverse impact parameter wrt PV
1089  okLck0sp = TMath::Abs(d->Getd0Prong(0))<=fCutsRD[GetGlobalIndex(10,ptbin)];
1090  okLcLpi = okLck0sp;
1091  okLcLBarpi = okLck0sp;
1092  break;
1093  case 11:
1094  // cut on V0 transverse impact parameter wrt PV
1095  okLck0sp = TMath::Abs(d->Getd0Prong(1))<=fCutsRD[GetGlobalIndex(11,ptbin)];
1096  okLcLpi = okLck0sp;
1097  okLcLBarpi = okLck0sp;
1098  break;
1099  case 12:
1100  // cut on K0S invariant mass veto
1101  okLcLpi = TMath::Abs(mk0s-mk0sPDG)>=fCutsRD[GetGlobalIndex(12,ptbin)];
1102  okLcLBarpi = TMath::Abs(mk0s-mk0sPDG)>=fCutsRD[GetGlobalIndex(12,ptbin)];
1103  break;
1104  case 13:
1105  // cut on Lambda/LambdaBar invariant mass veto
1106  okLck0sp = (TMath::Abs(mlambda-mLPDG)>=fCutsRD[GetGlobalIndex(13,ptbin)] &&
1107  TMath::Abs(malambda-mLPDG)>=fCutsRD[GetGlobalIndex(13,ptbin)]);
1108  break;
1109  case 14:
1110  // cut on gamma invariant mass veto
1111  okLck0sp = v0->InvMass2Prongs(0,1,11,11)>=fCutsRD[GetGlobalIndex(14,ptbin)];
1112  okLcLpi = okLck0sp;
1113  okLcLBarpi = okLck0sp;
1114  break;
1115  case 15:
1116  // cut on V0 pT min
1117  okLck0sp = v0->Pt()>=fCutsRD[GetGlobalIndex(15,ptbin)];
1118  okLcLpi = okLck0sp;
1119  okLcLBarpi = okLck0sp;
1120  break;
1121  }
1122  }
1123 
1124  Int_t returnvalue = okLck0sp+2*okLcLBarpi+4*okLcLpi;
1125  /*
1126  retvalue case
1127  1 Lc->K0S + p
1128  2 Lc->LambdaBar + pi
1129  3 Lc->K0S + p AND Lc->LambdaBar + pi
1130  4 Lc->Lambda + pi
1131  5 Lc->K0S + p AND Lc->Lambda + pi
1132  6 Lc->LambdaBar + pi AND Lc->Lambda + pi
1133  7 Lc->K0S + p AND Lc->LambdaBar + pi AND Lc->Lambda + pi
1134  */
1135 
1136 
1137  /*
1138  Int_t returnvaluePID = 7;
1139 
1140  // selection on PID
1141  if (selectionLevel==AliRDHFCuts::kAll ||
1142  selectionLevel==AliRDHFCuts::kCandidate ||
1143  selectionLevel==AliRDHFCuts::kPID )
1144  returnvaluePID = IsSelectedPID(d);
1145  */
1146 
1147  Int_t returnvalueTot = 0;
1148  //if ( fUsePID )
1149  //returnvalueTot = CombineCuts(returnvalue,returnvaluePID);
1150  //else
1151  returnvalueTot = returnvalue;
1152 
1153  return returnvalueTot;
1154 
1155 }
1156 //----------------------------------
1158 
1159  SetName("LctoV0ProductionCuts");
1160  SetTitle("Production cuts for Lc->V0+bachelor analysis");
1161 
1162  AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
1163  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1164  //default
1165  esdTrackCuts->SetRequireTPCRefit(kTRUE);
1166  esdTrackCuts->SetRequireITSRefit(kTRUE);
1167  esdTrackCuts->SetMinNClustersITS(0);//(4); // default is 5
1168  esdTrackCuts->SetMinNClustersTPC(70);
1169  //esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1170  // AliESDtrackCuts::kAny);
1171  // default is kBoth, otherwise kAny
1172  esdTrackCuts->SetMinDCAToVertexXY(0.);
1173  esdTrackCuts->SetPtRange(0.3,1.e10);
1174  //esdTrackCuts->SetEtaRange(-0.8,+0.8);
1175  esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
1176  AddTrackCuts(esdTrackCuts);
1177  delete esdTrackCuts;
1178  esdTrackCuts=NULL;
1179 
1180 
1181  AliESDtrackCuts* esdTrackCutsV0daughters=new AliESDtrackCuts();
1182  esdTrackCutsV0daughters->SetRequireSigmaToVertex(kFALSE);
1183  //default
1184  esdTrackCutsV0daughters->SetRequireTPCRefit(kTRUE);
1185  esdTrackCutsV0daughters->SetRequireITSRefit(kFALSE);//(kTRUE);
1186  esdTrackCutsV0daughters->SetMinNClustersITS(0);//(4); // default is 5
1187  esdTrackCutsV0daughters->SetMinNClustersTPC(70);
1188  //esdTrackCutsV0daughters->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1189  // AliESDtrackCuts::kAny);
1190  // default is kBoth, otherwise kAny
1191  esdTrackCutsV0daughters->SetMinDCAToVertexXY(0.);
1192  esdTrackCutsV0daughters->SetPtRange(0.,1.e10);
1193  esdTrackCutsV0daughters->SetAcceptKinkDaughters(kFALSE);
1194  AddTrackCutsV0daughters(esdTrackCutsV0daughters);
1195  delete esdTrackCutsV0daughters;
1196  esdTrackCutsV0daughters=NULL;
1197 
1198  const Int_t nptbins=1;
1199  Float_t* ptbins;
1200  ptbins=new Float_t[nptbins+1];
1201  ptbins[0]=0.;
1202  ptbins[1]=99999999.;
1203 
1204  SetPtBins(nptbins+1,ptbins);
1205  SetPtBins(nptbins+1,ptbins);
1206 
1207  const Int_t nvars=17;
1208 
1209  Float_t** prodcutsval;
1210  prodcutsval=new Float_t*[nvars];
1211  for(Int_t ic=0;ic<nvars;ic++){prodcutsval[ic]=new Float_t[nptbins];}
1212  for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
1213  prodcutsval[0][ipt2]=1.; // inv. mass if K0S [GeV/c2]
1214  prodcutsval[1][ipt2]=1.; // inv. mass if Lambda [GeV/c2]
1215  prodcutsval[2][ipt2]=0.05; // inv. mass V0 if K0S [GeV/c2]
1216  prodcutsval[3][ipt2]=0.05; // inv. mass V0 if Lambda [GeV/c2]
1217  prodcutsval[4][ipt2]=0.3; // pT min bachelor track [GeV/c] // AOD by construction
1218  prodcutsval[5][ipt2]=0.; // pT min V0-positive track [GeV/c]
1219  prodcutsval[6][ipt2]=0.; // pT min V0-negative track [GeV/c]
1220  prodcutsval[7][ipt2]=1000.; // dca cascade cut [cm]
1221  prodcutsval[8][ipt2]=1.5; // dca V0 cut [nSigma] // it's 1.5 x offline V0s
1222  prodcutsval[9][ipt2]=-1.; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
1223  prodcutsval[10][ipt2]=3.; // d0 max bachelor wrt PV [cm]
1224  prodcutsval[11][ipt2]=1000.;// d0 max V0 wrt PV [cm]
1225  prodcutsval[12][ipt2]=0.; // mass K0S veto [GeV/c2]
1226  prodcutsval[13][ipt2]=0.; // mass Lambda/LambdaBar veto [GeV/c2]
1227  prodcutsval[14][ipt2]=0.; // mass Gamma veto [GeV/c2]
1228  prodcutsval[15][ipt2]=0.; // pT min V0 track [GeV/c]
1229  prodcutsval[16][ipt2]=0.; // V0 type cut
1230  }
1231  SetCuts(nvars,nptbins,prodcutsval);
1232 
1233  SetGlobalIndex(nvars,nptbins);
1234  SetPtBins(nptbins+1,ptbins);
1235 
1236 
1237  //pid settings
1238  //1. bachelor: default one
1239  AliAODPidHF* pidObjBachelor = new AliAODPidHF();
1240  Double_t sigmasBac[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
1241  pidObjBachelor->SetSigma(sigmasBac);
1242  pidObjBachelor->SetAsym(kFALSE);
1243  pidObjBachelor->SetMatch(1);
1244  pidObjBachelor->SetTPC(kTRUE);
1245  pidObjBachelor->SetTOF(kTRUE);
1246  pidObjBachelor->SetTOFdecide(kFALSE);
1247  SetPidHF(pidObjBachelor);
1248 
1249  SetUsePID(kFALSE);//(kTRUE);
1250 
1251  //PrintAll();
1252 
1253  for(Int_t iiv=0;iiv<nvars;iiv++){
1254  delete [] prodcutsval[iiv];
1255  }
1256  delete [] prodcutsval;
1257  prodcutsval=NULL;
1258  delete [] ptbins;
1259  ptbins=NULL;
1260 
1261 
1262  delete pidObjBachelor;
1263  pidObjBachelor=NULL;
1264 
1265  return;
1266 }
1267 //------------------
1269 
1270  SetName("LctoV0ProductionCuts");
1271  SetTitle("Production cuts for Lc->V0+bachelor analysis");
1272 
1274 
1275  return;
1276 }
1277 //------------------
1279 
1280  // Default 2010 PbPb cut object
1282 
1283  //
1284  // Enable all 2011 PbPb run triggers
1285  //
1286  SetTriggerClass("");
1290 
1291 }
1292 //-----------------------
1294 
1295  const Int_t nvars = this->GetNVars() ;
1296  //Float_t *vArray =GetCuts();
1297  //fV0Type = vArray[nvars-1];
1298  fV0Type = (this->GetCuts())[nvars-1];
1299  //this->GetCuts(vArray);
1300  TString *sVarNames=GetVarNames();
1301 
1302  if(sVarNames[nvars-1].Contains("V0 type")) return (Int_t)fV0Type;
1303  else {AliInfo("AliRDHFCutsLctoV0 Last variable is not the V0 type!!!"); return -999;}
1304 }
1305 
1306 //---------------------------------------------------------------------------
1308  //
1309  // print all cuts values
1310  //
1311 
1312  printf("Minimum vtx type %d\n",fMinVtxType);
1313  printf("Minimum vtx contr %d\n",fMinVtxContr);
1314  printf("Max vtx red chi2 %f\n",fMaxVtxRedChi2);
1315  printf("Min SPD mult %d\n",fMinSPDMultiplicity);
1316  printf("Use PID %d (PID selection flag = %d) OldPid=%d\n",(Int_t)fUsePID,(Int_t)fPidSelectionFlag,fPidHF ? fPidHF->GetOldPid() : -1);
1317  printf("High value for pT %f\n",fHighPtCut);
1318  printf("Low and high values for pT cuts: %f %f\n",fLowPtCut,fHighPtCut);
1319  printf("Remove daughters from vtx %d\n",(Int_t)fRemoveDaughtersFromPrimary);
1320  printf("Physics selection: %s\n",fUsePhysicsSelection ? "Yes" : "No");
1321  printf("Pileup rejection: %s\n",(fOptPileup > 0) ? "Yes" : "No");
1322  printf("UseTrackSelectionWithFilterBits: %s\n",fUseTrackSelectionWithFilterBits ? "Yes" : "No");
1323  printf("Reject kink: %s\n",fKinkReject ? "Yes" : "No");
1324  if(fOptPileup==1) printf(" -- Reject pileup event");
1325  if(fOptPileup==2) printf(" -- Reject tracks from pileup vtx");
1326  if(fUseCentrality>0) {
1327  TString estimator="";
1328  if(fUseCentrality==1) estimator = "V0";
1329  if(fUseCentrality==2) estimator = "Tracks";
1330  if(fUseCentrality==3) estimator = "Tracklets";
1331  if(fUseCentrality==4) estimator = "SPD clusters outer";
1332  printf("Centrality class considered: %.1f-%.1f, estimated with %s",fMinCentrality,fMaxCentrality,estimator.Data());
1333  }
1334  if(fIsCandTrackSPDFirst) printf("Check for candidates with pt < %2.2f, that daughters fullfill kFirst criteria\n",fMaxPtCandTrackSPDFirst);
1335 
1336  if(fVarNames){
1337  cout<<"Array of variables"<<endl;
1338  for(Int_t iv=0;iv<fnVars;iv++){
1339  cout<<fVarNames[iv]<<"\t";
1340  }
1341  cout<<endl;
1342  }
1343  if(fVarsForOpt){
1344  cout<<"Array of optimization"<<endl;
1345  for(Int_t iv=0;iv<fnVars;iv++){
1346  cout<<fVarsForOpt[iv]<<"\t";
1347  }
1348  cout<<endl;
1349  }
1350  if(fIsUpperCut){
1351  cout<<"Array of upper/lower cut"<<endl;
1352  for(Int_t iv=0;iv<fnVars;iv++){
1353  cout<<fIsUpperCut[iv]<<"\t";
1354  }
1355  cout<<endl;
1356  }
1357  if(fPtBinLimits){
1358  cout<<"Array of ptbin limits"<<endl;
1359  for(Int_t ib=0;ib<fnPtBinLimits;ib++){
1360  cout<<fPtBinLimits[ib]<<"\t";
1361  }
1362  cout<<endl;
1363  }
1364  if(fCutsRD){
1365  cout<<"Matrix of cuts"<<endl;
1366  for(Int_t iv=0;iv<fnVars;iv++){
1367  for(Int_t ib=0;ib<fnPtBins;ib++){
1368  cout<<"fCutsRD["<<iv<<"]["<<ib<<"] = "<<fCutsRD[GetGlobalIndex(iv,ib)]<<"\t";
1369  }
1370  cout<<endl;
1371  }
1372  cout<<endl;
1373  }
1374 
1375  if (fPidSelectionFlag==9) {
1376  for(Int_t ib=0;ib<fnPtBins;ib++){
1377  cout<<"fMinCombinedProbability["<<ib<<"] = "<<fMinCombinedProbability[ib]<<"\t";
1378  }
1379  cout<<endl;
1380  cout << " GetCombDetectors() = " << GetPidHF()->GetCombDetectors() << endl;
1381  }
1382 
1383  if (fTrackCuts) {
1384  Float_t eta1=0, eta2=0; fTrackCuts->GetEtaRange(eta1,eta2);
1385  cout << " etaRange for Bachelor: [" << eta1 << "," << eta2 << "]\n";
1386  }
1387  if (fV0daughtersCuts) {
1388  Float_t eta3=0, eta4=0; fV0daughtersCuts->GetEtaRange(eta3,eta4);
1389  cout << " etaRange for V0daughters: [" << eta3 << "," << eta4 << "]\n";
1390  }
1391  return;
1392 
1393 }
1394 
1395 //-------------------------
1396 Bool_t AliRDHFCutsLctoV0::IsInFiducialAcceptance(Double_t pt, Double_t y) const
1397 {
1398  //
1399  //
1400  // Checking if Lc is in fiducial acceptance region
1401  //
1402  //
1403 
1404  if(fMaxRapidityCand>-998.){
1405  if(TMath::Abs(y) > fMaxRapidityCand) return kFALSE;
1406  else return kTRUE;
1407  }
1408 
1409  if(pt > 5.) {
1410  // applying cut for pt > 5 GeV
1411  AliDebug(2,Form("pt of Lambda_c = %f (> 5), cutting at |y| < 0.8",pt));
1412  if (TMath::Abs(y) > 0.8) return kFALSE;
1413 
1414  } else {
1415  // appliying smooth cut for pt < 5 GeV
1416  Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
1417  Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
1418  AliDebug(2,Form("pt of Lambda_c = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
1419  if (y < minFiducialY || y > maxFiducialY) return kFALSE;
1420  }
1421  //
1422  return kTRUE;
1423 }
1424 //---------------------------------------------------------------------------
1426  //
1427  // Daughter tracks selection
1428  //
1429 
1431  if (!d) {
1432  AliDebug(2,"AliAODRecoCascadeHF null");
1433  return kFALSE;
1434  }
1435 
1436  if (!fTrackCuts) {
1437  AliFatal("Cut object is not defined for bachelor. Candidate accepted.");
1438  return kFALSE;
1439  }
1440 
1441  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
1442  if (!bachelorTrack) return kFALSE;
1443 
1445  if(!bachelorTrack->HasPointOnITSLayer(0)) return kFALSE;
1446  }
1447 
1448  if (fKinkReject != (!(fTrackCuts->GetAcceptKinkDaughters())) ) {
1449  AliError(Form("Not compatible setting: fKinkReject=%1d - fTrackCuts->GetAcceptKinkDaughters()=%1d",fKinkReject, fTrackCuts->GetAcceptKinkDaughters()));
1450  return kFALSE;
1451  }
1452 
1453  AliAODVertex *vAOD = d->GetPrimaryVtx();
1454  Double_t pos[3]; vAOD->GetXYZ(pos);
1455  Double_t cov[6]; vAOD->GetCovarianceMatrix(cov);
1456  const AliESDVertex vESD(pos,cov,100.,100);
1457 
1458  if (!IsDaughterSelected(bachelorTrack,&vESD,fTrackCuts)) return kFALSE;
1459 
1460  if (!fV0daughtersCuts) {
1461  AliFatal("Cut object is not defined for V0daughters. Candidate accepted.");
1462  return kFALSE;
1463  }
1464 
1465  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
1466  if (!v0) return kFALSE;
1467  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
1468  if (!v0positiveTrack) return kFALSE;
1469  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
1470  if (!v0negativeTrack) return kFALSE;
1471 
1472 
1473  Float_t etaMin=0, etaMax=0; fV0daughtersCuts->GetEtaRange(etaMin,etaMax);
1474  if ( (v0positiveTrack->Eta()<=etaMin || v0positiveTrack->Eta()>=etaMax) ||
1475  (v0negativeTrack->Eta()<=etaMin || v0negativeTrack->Eta()>=etaMax) ) return kFALSE;
1476  Float_t ptMin=0, ptMax=0; fV0daughtersCuts->GetPtRange(ptMin,ptMax);
1477  if ( (v0positiveTrack->Pt()<=ptMin || v0positiveTrack->Pt()>=ptMax) ||
1478  (v0negativeTrack->Pt()<=ptMin || v0negativeTrack->Pt()>=ptMax) ) return kFALSE;
1479 
1480  // Condition on nTPCclusters
1481  if (fV0daughtersCuts->GetMinNClusterTPC()>0) {
1482  if ( ( ( v0positiveTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ||
1483  ( ( v0negativeTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ) return kFALSE;
1484  }
1485 
1486  // kTPCrefit status
1487  if (v0->GetOnFlyStatus()==kFALSE) { // only for offline V0s
1488  if (fV0daughtersCuts->GetRequireTPCRefit()) {
1489  if( !(v0positiveTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
1490  if( !(v0negativeTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
1491  }
1492  }
1493  // kink condition
1494  if (!fV0daughtersCuts->GetAcceptKinkDaughters()) {
1495  AliAODVertex *maybeKinkPos = (AliAODVertex*)v0positiveTrack->GetProdVertex();
1496  AliAODVertex *maybeKinkNeg = (AliAODVertex*)v0negativeTrack->GetProdVertex();
1497  if (maybeKinkPos->GetType()==AliAODVertex::kKink ||
1498  maybeKinkNeg->GetType()==AliAODVertex::kKink) return kFALSE;
1499  }
1500  // Findable clusters > 0 condition - from V0 analysis
1501  //if( v0positiveTrack->GetTPCNclsF()<=0 || v0negativeTrack->GetTPCNclsF()<=0 ) return kFALSE;
1502  /*
1503  Float_t lPosTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
1504  Float_t lNegTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
1505  fTreeVariableLeastNbrCrossedRows = (Int_t) lPosTrackCrossedRows;
1506  if( lNegTrackCrossedRows < fTreeVariableLeastNbrCrossedRows )
1507  fTreeVariableLeastNbrCrossedRows = (Int_t) lNegTrackCrossedRows;
1508  //Compute ratio Crossed Rows / Findable clusters
1509  //Note: above test avoids division by zero!
1510  Float_t lPosTrackCrossedRowsOverFindable = lPosTrackCrossedRows / ((double)(pTrack->GetTPCNclsF()));
1511  Float_t lNegTrackCrossedRowsOverFindable = lNegTrackCrossedRows / ((double)(nTrack->GetTPCNclsF()));
1512  fTreeVariableLeastRatioCrossedRowsOverFindable = lPosTrackCrossedRowsOverFindable;
1513  if( lNegTrackCrossedRowsOverFindable < fTreeVariableLeastRatioCrossedRowsOverFindable )
1514  fTreeVariableLeastRatioCrossedRowsOverFindable = lNegTrackCrossedRowsOverFindable;
1515  //Lowest Cut Level for Ratio Crossed Rows / Findable = 0.8, set here
1516  if ( fTreeVariableLeastRatioCrossedRowsOverFindable < 0.8 ) return kFALSE;
1517  */
1518 
1519  return kTRUE;
1520 
1521 }
1522 
1523 //---------------------------------------------------------------------------
1525  //
1526  // store the combined probability cuts
1527  //
1528  if(nPtBins!=fnPtBins) {
1529  printf("Wrong number of pt bins: it has to be %d\n",fnPtBins);
1530  AliFatal("exiting");
1531  }
1532 
1534 
1535  for(Int_t ib=0; ib<fnPtBins; ib++) {
1536  fMinCombinedProbability[ib] = minProb[ib];
1537  }
1538  return;
1539 }
Int_t IsSelectedSingleCut(TObject *obj, Int_t selectionLevel, Int_t cutIndex)
AliESDtrackCuts * fV0daughtersCuts
virtual void SetStandardCutsPbPb2010()
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Double_t fMaxPtCandTrackSPDFirst
flag to select the track kFirst criteria for pt < ptlimit
Definition: AliRDHFCuts.h:415
Int_t GetNVars() const
Definition: AliRDHFCuts.h:234
void SetAsym(Bool_t asym)
Definition: AliAODPidHF.h:88
AliRDHFCutsLctoV0(const char *name="CutsLctoV0", Short_t v0channel=0)
Int_t GetnSigmaTOF(AliAODTrack *track, Int_t species, Double_t &sigma) const
Bool_t * fIsUpperCut
Definition: AliRDHFCuts.h:388
virtual void SetStandardCutsPP2010()
Bool_t fRemoveDaughtersFromPrimary
Definition: AliRDHFCuts.h:394
AliAODTrack * Getv0NegativeTrack() const
Int_t GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &sigma) const
Bool_t CheckTOFPIDStatus(AliAODTrack *track) const
Float_t * fPtBinLimits
"number of limits", that is fnPtBins+1
Definition: AliRDHFCuts.h:381
ECombDetectors GetCombDetectors() const
Definition: AliAODPidHF.h:162
AliAODv0 * Getv0() const
virtual void SetStandardCutsPbPb2011()
Int_t fMinVtxContr
0: not cut; 1: SPDZ; 2: SPD3D; 3: Tracks
Definition: AliRDHFCuts.h:369
Double_t InvMassLctoLambdaPi() const
Float_t fMaxVtxRedChi2
minimum vertex contributors
Definition: AliRDHFCuts.h:370
Int_t CombineCuts(Int_t returnvalueTrack, Int_t returnvalue, Int_t returnvaluePID) const
Float_t * fMinCombinedProbability
cut to be excluded (-1=none)
const Float_t * GetCuts() const
Definition: AliRDHFCuts.h:238
Float_t fV0Type
cuts for v0 daughters (AOD converted to ESD on the flight!)
void SetNVars(Int_t nVars)
Definition: AliRDHFCuts.h:362
Bool_t AreLctoV0DaughtersSelected(AliAODRecoDecayHF *rd) const
Int_t fMinVtxType
cuts on the event
Definition: AliRDHFCuts.h:368
Double_t fMaxRapidityCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:412
void EnableSemiCentralTrigger()
Definition: AliRDHFCuts.h:93
AliRDHFCutsLctoV0 & operator=(const AliRDHFCutsLctoV0 &source)
TString * GetVarNames() const
Definition: AliRDHFCuts.h:235
Double_t ptMin
Int_t ApplyPidTPCRaw(AliAODTrack *track, Int_t specie) const
void SetGlobalIndex()
Definition: AliRDHFCuts.h:196
AliRDHFCuts & operator=(const AliRDHFCuts &source)
Int_t fUseCentrality
min deltaz between main and pileup vertices
Definition: AliRDHFCuts.h:400
Bool_t fUsePID
Definition: AliRDHFCuts.h:389
void SetPidHF(AliAODPidHF *pidObj)
see enum below
Definition: AliRDHFCuts.h:210
Double_t InvMassLctoK0sP() const
Bool_t GetOldPid()
Definition: AliAODPidHF.h:157
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:231
void SetTOF(Bool_t tof)
Definition: AliAODPidHF.h:95
AliAODTrack * Getv0PositiveTrack() const
virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d, Float_t *vars, Int_t nvars, Int_t *pdgdaughters)
Bool_t fUseTrackSelectionWithFilterBits
flag to reject kink daughters
Definition: AliRDHFCuts.h:422
void SetCuts(Int_t nVars, Int_t nPtBins, Float_t **cutsRD)
Int_t fnVarsForOpt
Definition: AliRDHFCuts.h:384
void ResetMaskAndEnableMBTrigger()
Definition: AliRDHFCuts.h:73
AliPIDCombined * GetPidCombined() const
Definition: AliAODPidHF.h:161
TString * fVarNames
number of cut vars for candidates
Definition: AliRDHFCuts.h:383
AliESDtrackCuts * fTrackCuts
quality cuts on the daughter tracks
Definition: AliRDHFCuts.h:377
void AddTrackCutsV0daughters(AliESDtrackCuts *v0daug)
Float_t fLowPtCut
high pT cut separation for proton identification
Bool_t IsDaughterSelected(AliAODTrack *track, const AliESDVertex *primary, AliESDtrackCuts *cuts) const
AliAODTrack * GetBachelor() const
Int_t fOptPileup
use Physics selection criteria
Definition: AliRDHFCuts.h:397
Bool_t IsExcluded(AliAODTrack *track, Int_t labelTrack, Double_t nsigmaCut, TString detector)
virtual void PrintAll() const
Float_t fMinCentrality
Definition: AliRDHFCuts.h:405
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
Int_t fnPtBinLimits
number of pt bins for cuts
Definition: AliRDHFCuts.h:380
void SetSigma(Double_t *sigma)
Definition: AliAODPidHF.h:39
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:387
Double_t CosV0PointingAngle() const
Int_t ApplyPidTOFRaw(AliAODTrack *track, Int_t specie) const
void SetVarsForOpt(Int_t nVars, Bool_t *forOpt)
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:385
void SetMinCombinedProbability(Int_t ptBins, Float_t *ptMin)
void EnableCentralTrigger()
Definition: AliRDHFCuts.h:81
void CheckPID(Int_t candPtBin, AliAODTrack *bachelor, AliAODTrack *, AliAODTrack *, Bool_t &isBachelorID1, Bool_t &isBachelorID2, Bool_t &isBachelorID4)
Int_t fMinSPDMultiplicity
maximum |z| of primary vertex
Definition: AliRDHFCuts.h:372
void SetUsePID(Bool_t flag=kTRUE)
Definition: AliRDHFCuts.h:204
Int_t fExcludedCut
low pT cut separation for proton identification
Bool_t fIsCandTrackSPDFirst
IsSelected returns always kTRUE for MC signal.
Definition: AliRDHFCuts.h:414
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:421
Bool_t fUsePhysicsSelection
use MC primary vertex
Definition: AliRDHFCuts.h:396
void SetTOFdecide(Bool_t tOFdecide)
Definition: AliAODPidHF.h:107
void SetMatch(Int_t match)
Definition: AliAODPidHF.h:98
AliAODVertex * GetPrimaryVtx() const
void AddTrackCuts(const AliESDtrackCuts *cuts)
Definition: AliRDHFCuts.h:202
void SetTPC(Bool_t tpc)
Definition: AliAODPidHF.h:94
Int_t fnPtBins
cuts on the candidate
Definition: AliRDHFCuts.h:379
Float_t fHighPtCut
V0 type – should be defined as in AliRDHFCuts.h.
Double_t ptMax
void SetTriggerClass(TString trclass0, TString trclass1="")
Definition: AliRDHFCuts.h:192
AliAODPidHF * fPidHF
enable AOD049 centrality cleanup
Definition: AliRDHFCuts.h:391
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
Int_t PtBin(Double_t pt) const
Int_t GetGlobalIndex(Int_t iVar, Int_t iPtBin) const
const Int_t nPtBins
Int_t nptbins
Float_t fMaxCentrality
minimum centrality for selected events
Definition: AliRDHFCuts.h:406
virtual Int_t IsSelectedPID(AliAODRecoDecayHF *obj)
Int_t fnVars
Definition: AliRDHFCuts.h:382