AliPhysics  a0db429 (a0db429)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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  isBachelorID1=probProton>fMinCombinedProbability[candPtBin]; // K0S case
889 
890  isBachelorID2=probPion>fMinCombinedProbability[candPtBin]; // LambdaBar case
891 
892  isBachelorID4 = isBachelorID2; // Lambda case
893 
894  break;
895 
896  }
897 
898 }
899 //----------------
900 Int_t AliRDHFCutsLctoV0::CombineCuts(Int_t returnvalueTrack, Int_t returnvalue, Int_t returnvaluePID) const {
901  //
902  // combine track selection, topological cuts and PID
903  //
904 
905  Int_t returnvalueTot=returnvalueTrack&returnvalue;
906  returnvalueTot=returnvalueTot&returnvaluePID;
907 
908  return returnvalueTot;
909 }
910 
911 //----------------------------------
912 Int_t AliRDHFCutsLctoV0::IsSelectedSingleCut(TObject* obj, Int_t selectionLevel, Int_t cutIndex) {
913  //
914  // Apply selection on single cut
915  //
916 
917  if (!fCutsRD) {
918  AliDebug(2,"Cut matrice not inizialized. Exit...");
919  return 0;
920  }
921 
923  if (!d) {
924  AliDebug(2,"AliAODRecoCascadeHF null");
925  return 0;
926  }
927 
928  if (!d->GetSecondaryVtx()) {
929  AliDebug(2,"No secondary vertex for cascade");
930  return 0;
931  }
932 
933  if (d->GetNDaughters()!=2) {
934  AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",d->GetNDaughters()));
935  return 0;
936  }
937 
938  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
939  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
940  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
941 
942  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
943  if (!v0 || !bachelorTrack) {
944  AliDebug(2,"No V0 or no bachelor for current cascade");
945  return 0;
946  }
947 
948  if (bachelorTrack->GetID()<0) {
949  AliDebug(2,Form("Bachelor has negative ID %d",bachelorTrack->GetID()));
950  return 0;
951  }
952 
953  if (!v0->GetSecondaryVtx()) {
954  AliDebug(2,"No secondary vertex for V0 by cascade");
955  return 0;
956  }
957 
958  if (v0->GetNDaughters()!=2) {
959  AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0->GetOnFlyStatus(),v0->GetNDaughters()));
960  return 0;
961  }
962 
963 
964  // Get the V0 daughter tracks
965  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
966  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
967  if (!v0positiveTrack || !v0negativeTrack ) {
968  AliDebug(2,"No V0 daughters' objects");
969  return 0;
970  }
971 
972  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
973  AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",v0positiveTrack->GetID(),v0negativeTrack->GetID()));
974  return 0;
975  }
976 
977  //if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
978  if ( fUseTrackSelectionWithFilterBits && !(bachelorTrack->TestFilterMask(BIT(4))) ) {
979  AliDebug(2,"Check on the bachelor FilterBit: no BIT(4). Candidate rejected.");
980  return 0;
981  }
982 
983 
984  // selection on daughter tracks
985  if (selectionLevel==AliRDHFCuts::kAll ||
986  selectionLevel==AliRDHFCuts::kTracks) {
987 
988  if (!AreLctoV0DaughtersSelected(d)) return 0;
989 
990  }
991 
992  Bool_t okLck0sp=kFALSE, okLcLpi=kFALSE, okLcLBarpi=kFALSE;
993 
994  // selection on candidate
995  if (selectionLevel==AliRDHFCuts::kAll ||
996  selectionLevel==AliRDHFCuts::kCandidate) {
997 
998  Double_t pt = d->Pt();
999  Int_t ptbin = PtBin(pt);
1000 
1001  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
1002  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
1003  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
1004 
1005  // K0S + p
1006  Double_t mk0s = v0->MassK0Short();
1007  Double_t mLck0sp = d->InvMassLctoK0sP();
1008 
1009  // Lambda + pi
1010  Double_t mlambda = v0->MassLambda();
1011  Double_t malambda = v0->MassAntiLambda();
1012  Double_t mLcLpi = d->InvMassLctoLambdaPi();
1013 
1014  switch (cutIndex) {
1015  case 0:
1016  // cut on Lc mass with K0S+p hypothesis
1017  okLck0sp = TMath::Abs(mLck0sp-mLcPDG)<=fCutsRD[GetGlobalIndex(0,ptbin)];
1018  okLcLpi = kFALSE;
1019  okLcLBarpi = kFALSE;
1020  break;
1021  case 1:
1022  // cut on Lc mass with Lambda+pi hypothesis
1023  okLck0sp = kFALSE;
1024  okLcLpi = TMath::Abs(mLcLpi-mLcPDG)<=fCutsRD[GetGlobalIndex(1,ptbin)];
1025  okLcLBarpi = okLcLpi;
1026  break;
1027  case 2:
1028  // cuts on the V0 mass: K0S case
1029  okLck0sp = TMath::Abs(mk0s-mk0sPDG)<=fCutsRD[GetGlobalIndex(2,ptbin)];
1030  okLcLpi = kFALSE;
1031  okLcLBarpi = kFALSE;
1032  break;
1033  case 3:
1034  // cuts on the V0 mass: Lambda/LambdaBar case
1035  okLck0sp = kFALSE;
1036  okLcLpi = TMath::Abs(mlambda-mLPDG)<=fCutsRD[GetGlobalIndex(3,ptbin)];
1037  //okLcLpi = okLcLpi && (bachelorTrack->Charge()==+1);
1038  okLcLBarpi = TMath::Abs(malambda-mLPDG)<=fCutsRD[GetGlobalIndex(3,ptbin)];
1039  //okLcLBarpi = okLcLBarpi && (bachelorTrack->Charge()==-1);
1040  break;
1041  case 4:
1042  // cuts on the minimum pt of bachelor
1043  okLck0sp = TMath::Abs(bachelorTrack->Pt())>=fCutsRD[GetGlobalIndex(4,ptbin)];
1044  okLcLpi = okLck0sp;
1045  okLcLBarpi = okLck0sp;
1046  break;
1047  case 5:
1048  // cuts on the minimum pt of positive V0daughter
1049  okLck0sp = TMath::Abs(v0positiveTrack->Pt())>=fCutsRD[GetGlobalIndex(5,ptbin)];
1050  okLcLpi = okLck0sp;
1051  okLcLBarpi = okLck0sp;
1052  break;
1053  case 6:
1054  // cuts on the minimum pt of negative V0daughter
1055  okLck0sp = TMath::Abs(v0negativeTrack->Pt())>=fCutsRD[GetGlobalIndex(6,ptbin)];
1056  okLcLpi = okLck0sp;
1057  okLcLBarpi = okLck0sp;
1058  break;
1059  case 7:
1060  // cut on cascade dca
1061  okLck0sp = TMath::Abs(d->GetDCA())<=fCutsRD[GetGlobalIndex(7,ptbin)];
1062  okLcLpi = okLck0sp;
1063  okLcLBarpi = okLck0sp;
1064  break;
1065  case 8:
1066  // cut on V0 dca
1067  okLck0sp = TMath::Abs(v0->GetDCA())<=fCutsRD[GetGlobalIndex(8,ptbin)];
1068  okLcLpi = okLck0sp;
1069  okLcLBarpi = okLck0sp;
1070  break;
1071  case 9:
1072  // cut on V0 cosine of pointing angle wrt PV
1073  okLck0sp = d->CosV0PointingAngle()>=fCutsRD[GetGlobalIndex(9,ptbin)];
1074  okLcLpi = okLck0sp;
1075  okLcLBarpi = okLck0sp;
1076  break;
1077  case 10:
1078  // cut on bachelor transverse impact parameter wrt PV
1079  okLck0sp = TMath::Abs(d->Getd0Prong(0))<=fCutsRD[GetGlobalIndex(10,ptbin)];
1080  okLcLpi = okLck0sp;
1081  okLcLBarpi = okLck0sp;
1082  break;
1083  case 11:
1084  // cut on V0 transverse impact parameter wrt PV
1085  okLck0sp = TMath::Abs(d->Getd0Prong(1))<=fCutsRD[GetGlobalIndex(11,ptbin)];
1086  okLcLpi = okLck0sp;
1087  okLcLBarpi = okLck0sp;
1088  break;
1089  case 12:
1090  // cut on K0S invariant mass veto
1091  okLcLpi = TMath::Abs(mk0s-mk0sPDG)>=fCutsRD[GetGlobalIndex(12,ptbin)];
1092  okLcLBarpi = TMath::Abs(mk0s-mk0sPDG)>=fCutsRD[GetGlobalIndex(12,ptbin)];
1093  break;
1094  case 13:
1095  // cut on Lambda/LambdaBar invariant mass veto
1096  okLck0sp = (TMath::Abs(mlambda-mLPDG)>=fCutsRD[GetGlobalIndex(13,ptbin)] &&
1097  TMath::Abs(malambda-mLPDG)>=fCutsRD[GetGlobalIndex(13,ptbin)]);
1098  break;
1099  case 14:
1100  // cut on gamma invariant mass veto
1101  okLck0sp = v0->InvMass2Prongs(0,1,11,11)>=fCutsRD[GetGlobalIndex(14,ptbin)];
1102  okLcLpi = okLck0sp;
1103  okLcLBarpi = okLck0sp;
1104  break;
1105  case 15:
1106  // cut on V0 pT min
1107  okLck0sp = v0->Pt()>=fCutsRD[GetGlobalIndex(15,ptbin)];
1108  okLcLpi = okLck0sp;
1109  okLcLBarpi = okLck0sp;
1110  break;
1111  }
1112  }
1113 
1114  Int_t returnvalue = okLck0sp+2*okLcLBarpi+4*okLcLpi;
1115  /*
1116  retvalue case
1117  1 Lc->K0S + p
1118  2 Lc->LambdaBar + pi
1119  3 Lc->K0S + p AND Lc->LambdaBar + pi
1120  4 Lc->Lambda + pi
1121  5 Lc->K0S + p AND Lc->Lambda + pi
1122  6 Lc->LambdaBar + pi AND Lc->Lambda + pi
1123  7 Lc->K0S + p AND Lc->LambdaBar + pi AND Lc->Lambda + pi
1124  */
1125 
1126 
1127  /*
1128  Int_t returnvaluePID = 7;
1129 
1130  // selection on PID
1131  if (selectionLevel==AliRDHFCuts::kAll ||
1132  selectionLevel==AliRDHFCuts::kCandidate ||
1133  selectionLevel==AliRDHFCuts::kPID )
1134  returnvaluePID = IsSelectedPID(d);
1135  */
1136 
1137  Int_t returnvalueTot = 0;
1138  //if ( fUsePID )
1139  //returnvalueTot = CombineCuts(returnvalue,returnvaluePID);
1140  //else
1141  returnvalueTot = returnvalue;
1142 
1143  return returnvalueTot;
1144 
1145 }
1146 //----------------------------------
1148 
1149  SetName("LctoV0ProductionCuts");
1150  SetTitle("Production cuts for Lc->V0+bachelor analysis");
1151 
1152  AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
1153  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1154  //default
1155  esdTrackCuts->SetRequireTPCRefit(kTRUE);
1156  esdTrackCuts->SetRequireITSRefit(kTRUE);
1157  esdTrackCuts->SetMinNClustersITS(0);//(4); // default is 5
1158  esdTrackCuts->SetMinNClustersTPC(70);
1159  //esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1160  // AliESDtrackCuts::kAny);
1161  // default is kBoth, otherwise kAny
1162  esdTrackCuts->SetMinDCAToVertexXY(0.);
1163  esdTrackCuts->SetPtRange(0.3,1.e10);
1164  //esdTrackCuts->SetEtaRange(-0.8,+0.8);
1165  esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
1166  AddTrackCuts(esdTrackCuts);
1167  delete esdTrackCuts;
1168  esdTrackCuts=NULL;
1169 
1170 
1171  AliESDtrackCuts* esdTrackCutsV0daughters=new AliESDtrackCuts();
1172  esdTrackCutsV0daughters->SetRequireSigmaToVertex(kFALSE);
1173  //default
1174  esdTrackCutsV0daughters->SetRequireTPCRefit(kTRUE);
1175  esdTrackCutsV0daughters->SetRequireITSRefit(kFALSE);//(kTRUE);
1176  esdTrackCutsV0daughters->SetMinNClustersITS(0);//(4); // default is 5
1177  esdTrackCutsV0daughters->SetMinNClustersTPC(70);
1178  //esdTrackCutsV0daughters->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1179  // AliESDtrackCuts::kAny);
1180  // default is kBoth, otherwise kAny
1181  esdTrackCutsV0daughters->SetMinDCAToVertexXY(0.);
1182  esdTrackCutsV0daughters->SetPtRange(0.,1.e10);
1183  esdTrackCutsV0daughters->SetAcceptKinkDaughters(kFALSE);
1184  AddTrackCutsV0daughters(esdTrackCutsV0daughters);
1185  delete esdTrackCutsV0daughters;
1186  esdTrackCutsV0daughters=NULL;
1187 
1188  const Int_t nptbins=1;
1189  Float_t* ptbins;
1190  ptbins=new Float_t[nptbins+1];
1191  ptbins[0]=0.;
1192  ptbins[1]=99999999.;
1193 
1194  SetPtBins(nptbins+1,ptbins);
1195  SetPtBins(nptbins+1,ptbins);
1196 
1197  const Int_t nvars=17;
1198 
1199  Float_t** prodcutsval;
1200  prodcutsval=new Float_t*[nvars];
1201  for(Int_t ic=0;ic<nvars;ic++){prodcutsval[ic]=new Float_t[nptbins];}
1202  for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
1203  prodcutsval[0][ipt2]=1.; // inv. mass if K0S [GeV/c2]
1204  prodcutsval[1][ipt2]=1.; // inv. mass if Lambda [GeV/c2]
1205  prodcutsval[2][ipt2]=0.05; // inv. mass V0 if K0S [GeV/c2]
1206  prodcutsval[3][ipt2]=0.05; // inv. mass V0 if Lambda [GeV/c2]
1207  prodcutsval[4][ipt2]=0.3; // pT min bachelor track [GeV/c] // AOD by construction
1208  prodcutsval[5][ipt2]=0.; // pT min V0-positive track [GeV/c]
1209  prodcutsval[6][ipt2]=0.; // pT min V0-negative track [GeV/c]
1210  prodcutsval[7][ipt2]=1000.; // dca cascade cut [cm]
1211  prodcutsval[8][ipt2]=1.5; // dca V0 cut [nSigma] // it's 1.5 x offline V0s
1212  prodcutsval[9][ipt2]=-1.; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
1213  prodcutsval[10][ipt2]=3.; // d0 max bachelor wrt PV [cm]
1214  prodcutsval[11][ipt2]=1000.;// d0 max V0 wrt PV [cm]
1215  prodcutsval[12][ipt2]=0.; // mass K0S veto [GeV/c2]
1216  prodcutsval[13][ipt2]=0.; // mass Lambda/LambdaBar veto [GeV/c2]
1217  prodcutsval[14][ipt2]=0.; // mass Gamma veto [GeV/c2]
1218  prodcutsval[15][ipt2]=0.; // pT min V0 track [GeV/c]
1219  prodcutsval[16][ipt2]=0.; // V0 type cut
1220  }
1221  SetCuts(nvars,nptbins,prodcutsval);
1222 
1223  SetGlobalIndex(nvars,nptbins);
1224  SetPtBins(nptbins+1,ptbins);
1225 
1226 
1227  //pid settings
1228  //1. bachelor: default one
1229  AliAODPidHF* pidObjBachelor = new AliAODPidHF();
1230  Double_t sigmasBac[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
1231  pidObjBachelor->SetSigma(sigmasBac);
1232  pidObjBachelor->SetAsym(kFALSE);
1233  pidObjBachelor->SetMatch(1);
1234  pidObjBachelor->SetTPC(kTRUE);
1235  pidObjBachelor->SetTOF(kTRUE);
1236  pidObjBachelor->SetTOFdecide(kFALSE);
1237  SetPidHF(pidObjBachelor);
1238 
1239  SetUsePID(kFALSE);//(kTRUE);
1240 
1241  //PrintAll();
1242 
1243  for(Int_t iiv=0;iiv<nvars;iiv++){
1244  delete [] prodcutsval[iiv];
1245  }
1246  delete [] prodcutsval;
1247  prodcutsval=NULL;
1248  delete [] ptbins;
1249  ptbins=NULL;
1250 
1251 
1252  delete pidObjBachelor;
1253  pidObjBachelor=NULL;
1254 
1255  return;
1256 }
1257 //------------------
1259 
1260  SetName("LctoV0ProductionCuts");
1261  SetTitle("Production cuts for Lc->V0+bachelor analysis");
1262 
1264 
1265  return;
1266 }
1267 //------------------
1269 
1270  // Default 2010 PbPb cut object
1272 
1273  //
1274  // Enable all 2011 PbPb run triggers
1275  //
1276  SetTriggerClass("");
1280 
1281 }
1282 //-----------------------
1284 
1285  const Int_t nvars = this->GetNVars() ;
1286  //Float_t *vArray =GetCuts();
1287  //fV0Type = vArray[nvars-1];
1288  fV0Type = (this->GetCuts())[nvars-1];
1289  //this->GetCuts(vArray);
1290  TString *sVarNames=GetVarNames();
1291 
1292  if(sVarNames[nvars-1].Contains("V0 type")) return (Int_t)fV0Type;
1293  else {AliInfo("AliRDHFCutsLctoV0 Last variable is not the V0 type!!!"); return -999;}
1294 }
1295 
1296 //---------------------------------------------------------------------------
1298  //
1299  // print all cuts values
1300  //
1301 
1302  printf("Minimum vtx type %d\n",fMinVtxType);
1303  printf("Minimum vtx contr %d\n",fMinVtxContr);
1304  printf("Max vtx red chi2 %f\n",fMaxVtxRedChi2);
1305  printf("Min SPD mult %d\n",fMinSPDMultiplicity);
1306  printf("Use PID %d (PID selection flag = %d) OldPid=%d\n",(Int_t)fUsePID,(Int_t)fPidSelectionFlag,fPidHF ? fPidHF->GetOldPid() : -1);
1307  printf("High value for pT %f\n",fHighPtCut);
1308  printf("Low and high values for pT cuts: %f %f\n",fLowPtCut,fHighPtCut);
1309  printf("Remove daughters from vtx %d\n",(Int_t)fRemoveDaughtersFromPrimary);
1310  printf("Physics selection: %s\n",fUsePhysicsSelection ? "Yes" : "No");
1311  printf("Pileup rejection: %s\n",(fOptPileup > 0) ? "Yes" : "No");
1312  printf("UseTrackSelectionWithFilterBits: %s\n",fUseTrackSelectionWithFilterBits ? "Yes" : "No");
1313  printf("Reject kink: %s\n",fKinkReject ? "Yes" : "No");
1314  if(fOptPileup==1) printf(" -- Reject pileup event");
1315  if(fOptPileup==2) printf(" -- Reject tracks from pileup vtx");
1316  if(fUseCentrality>0) {
1317  TString estimator="";
1318  if(fUseCentrality==1) estimator = "V0";
1319  if(fUseCentrality==2) estimator = "Tracks";
1320  if(fUseCentrality==3) estimator = "Tracklets";
1321  if(fUseCentrality==4) estimator = "SPD clusters outer";
1322  printf("Centrality class considered: %.1f-%.1f, estimated with %s",fMinCentrality,fMaxCentrality,estimator.Data());
1323  }
1324  if(fIsCandTrackSPDFirst) printf("Check for candidates with pt < %2.2f, that daughters fullfill kFirst criteria\n",fMaxPtCandTrackSPDFirst);
1325 
1326  if(fVarNames){
1327  cout<<"Array of variables"<<endl;
1328  for(Int_t iv=0;iv<fnVars;iv++){
1329  cout<<fVarNames[iv]<<"\t";
1330  }
1331  cout<<endl;
1332  }
1333  if(fVarsForOpt){
1334  cout<<"Array of optimization"<<endl;
1335  for(Int_t iv=0;iv<fnVars;iv++){
1336  cout<<fVarsForOpt[iv]<<"\t";
1337  }
1338  cout<<endl;
1339  }
1340  if(fIsUpperCut){
1341  cout<<"Array of upper/lower cut"<<endl;
1342  for(Int_t iv=0;iv<fnVars;iv++){
1343  cout<<fIsUpperCut[iv]<<"\t";
1344  }
1345  cout<<endl;
1346  }
1347  if(fPtBinLimits){
1348  cout<<"Array of ptbin limits"<<endl;
1349  for(Int_t ib=0;ib<fnPtBinLimits;ib++){
1350  cout<<fPtBinLimits[ib]<<"\t";
1351  }
1352  cout<<endl;
1353  }
1354  if(fCutsRD){
1355  cout<<"Matrix of cuts"<<endl;
1356  for(Int_t iv=0;iv<fnVars;iv++){
1357  for(Int_t ib=0;ib<fnPtBins;ib++){
1358  cout<<"fCutsRD["<<iv<<"]["<<ib<<"] = "<<fCutsRD[GetGlobalIndex(iv,ib)]<<"\t";
1359  }
1360  cout<<endl;
1361  }
1362  cout<<endl;
1363  }
1364 
1365  if (fPidSelectionFlag==9) {
1366  for(Int_t ib=0;ib<fnPtBins;ib++){
1367  cout<<"fMinCombinedProbability["<<ib<<"] = "<<fMinCombinedProbability[ib]<<"\t";
1368  }
1369  cout<<endl;
1370  cout << " GetCombDetectors() = " << GetPidHF()->GetCombDetectors() << endl;
1371  }
1372 
1373  if (fTrackCuts) {
1374  Float_t eta1=0, eta2=0; fTrackCuts->GetEtaRange(eta1,eta2);
1375  cout << " etaRange for Bachelor: [" << eta1 << "," << eta2 << "]\n";
1376  }
1377  if (fV0daughtersCuts) {
1378  Float_t eta3=0, eta4=0; fV0daughtersCuts->GetEtaRange(eta3,eta4);
1379  cout << " etaRange for V0daughters: [" << eta3 << "," << eta4 << "]\n";
1380  }
1381  return;
1382 
1383 }
1384 
1385 //-------------------------
1386 Bool_t AliRDHFCutsLctoV0::IsInFiducialAcceptance(Double_t pt, Double_t y) const
1387 {
1388  //
1389  //
1390  // Checking if Lc is in fiducial acceptance region
1391  //
1392  //
1393 
1394  if(fMaxRapidityCand>-998.){
1395  if(TMath::Abs(y) > fMaxRapidityCand) return kFALSE;
1396  else return kTRUE;
1397  }
1398 
1399  if(pt > 5.) {
1400  // applying cut for pt > 5 GeV
1401  AliDebug(2,Form("pt of Lambda_c = %f (> 5), cutting at |y| < 0.8",pt));
1402  if (TMath::Abs(y) > 0.8) return kFALSE;
1403 
1404  } else {
1405  // appliying smooth cut for pt < 5 GeV
1406  Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
1407  Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
1408  AliDebug(2,Form("pt of Lambda_c = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
1409  if (y < minFiducialY || y > maxFiducialY) return kFALSE;
1410  }
1411  //
1412  return kTRUE;
1413 }
1414 //---------------------------------------------------------------------------
1416  //
1417  // Daughter tracks selection
1418  //
1419 
1421  if (!d) {
1422  AliDebug(2,"AliAODRecoCascadeHF null");
1423  return kFALSE;
1424  }
1425 
1426  if (!fTrackCuts) {
1427  AliFatal("Cut object is not defined for bachelor. Candidate accepted.");
1428  return kFALSE;
1429  }
1430 
1431  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
1432  if (!bachelorTrack) return kFALSE;
1433 
1435  if(!bachelorTrack->HasPointOnITSLayer(0)) return kFALSE;
1436  }
1437 
1438  if (fKinkReject != (!(fTrackCuts->GetAcceptKinkDaughters())) ) {
1439  AliError(Form("Not compatible setting: fKinkReject=%1d - fTrackCuts->GetAcceptKinkDaughters()=%1d",fKinkReject, fTrackCuts->GetAcceptKinkDaughters()));
1440  return kFALSE;
1441  }
1442 
1443  AliAODVertex *vAOD = d->GetPrimaryVtx();
1444  Double_t pos[3]; vAOD->GetXYZ(pos);
1445  Double_t cov[6]; vAOD->GetCovarianceMatrix(cov);
1446  const AliESDVertex vESD(pos,cov,100.,100);
1447 
1448  if (!IsDaughterSelected(bachelorTrack,&vESD,fTrackCuts)) return kFALSE;
1449 
1450  if (!fV0daughtersCuts) {
1451  AliFatal("Cut object is not defined for V0daughters. Candidate accepted.");
1452  return kFALSE;
1453  }
1454 
1455  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
1456  if (!v0) return kFALSE;
1457  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
1458  if (!v0positiveTrack) return kFALSE;
1459  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
1460  if (!v0negativeTrack) return kFALSE;
1461 
1462 
1463  Float_t etaMin=0, etaMax=0; fV0daughtersCuts->GetEtaRange(etaMin,etaMax);
1464  if ( (v0positiveTrack->Eta()<=etaMin || v0positiveTrack->Eta()>=etaMax) ||
1465  (v0negativeTrack->Eta()<=etaMin || v0negativeTrack->Eta()>=etaMax) ) return kFALSE;
1466  Float_t ptMin=0, ptMax=0; fV0daughtersCuts->GetPtRange(ptMin,ptMax);
1467  if ( (v0positiveTrack->Pt()<=ptMin || v0positiveTrack->Pt()>=ptMax) ||
1468  (v0negativeTrack->Pt()<=ptMin || v0negativeTrack->Pt()>=ptMax) ) return kFALSE;
1469 
1470  // Condition on nTPCclusters
1471  if (fV0daughtersCuts->GetMinNClusterTPC()>0) {
1472  if ( ( ( v0positiveTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ||
1473  ( ( v0negativeTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ) return kFALSE;
1474  }
1475 
1476  // kTPCrefit status
1477  if (v0->GetOnFlyStatus()==kFALSE) { // only for offline V0s
1478  if (fV0daughtersCuts->GetRequireTPCRefit()) {
1479  if( !(v0positiveTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
1480  if( !(v0negativeTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
1481  }
1482  }
1483  // kink condition
1484  if (!fV0daughtersCuts->GetAcceptKinkDaughters()) {
1485  AliAODVertex *maybeKinkPos = (AliAODVertex*)v0positiveTrack->GetProdVertex();
1486  AliAODVertex *maybeKinkNeg = (AliAODVertex*)v0negativeTrack->GetProdVertex();
1487  if (maybeKinkPos->GetType()==AliAODVertex::kKink ||
1488  maybeKinkNeg->GetType()==AliAODVertex::kKink) return kFALSE;
1489  }
1490  // Findable clusters > 0 condition - from V0 analysis
1491  //if( v0positiveTrack->GetTPCNclsF()<=0 || v0negativeTrack->GetTPCNclsF()<=0 ) return kFALSE;
1492  /*
1493  Float_t lPosTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
1494  Float_t lNegTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
1495  fTreeVariableLeastNbrCrossedRows = (Int_t) lPosTrackCrossedRows;
1496  if( lNegTrackCrossedRows < fTreeVariableLeastNbrCrossedRows )
1497  fTreeVariableLeastNbrCrossedRows = (Int_t) lNegTrackCrossedRows;
1498  //Compute ratio Crossed Rows / Findable clusters
1499  //Note: above test avoids division by zero!
1500  Float_t lPosTrackCrossedRowsOverFindable = lPosTrackCrossedRows / ((double)(pTrack->GetTPCNclsF()));
1501  Float_t lNegTrackCrossedRowsOverFindable = lNegTrackCrossedRows / ((double)(nTrack->GetTPCNclsF()));
1502  fTreeVariableLeastRatioCrossedRowsOverFindable = lPosTrackCrossedRowsOverFindable;
1503  if( lNegTrackCrossedRowsOverFindable < fTreeVariableLeastRatioCrossedRowsOverFindable )
1504  fTreeVariableLeastRatioCrossedRowsOverFindable = lNegTrackCrossedRowsOverFindable;
1505  //Lowest Cut Level for Ratio Crossed Rows / Findable = 0.8, set here
1506  if ( fTreeVariableLeastRatioCrossedRowsOverFindable < 0.8 ) return kFALSE;
1507  */
1508 
1509  return kTRUE;
1510 
1511 }
1512 
1513 //---------------------------------------------------------------------------
1515  //
1516  // store the combined probability cuts
1517  //
1518  if(nPtBins!=fnPtBins) {
1519  printf("Wrong number of pt bins: it has to be %d\n",fnPtBins);
1520  AliFatal("exiting");
1521  }
1522 
1524 
1525  for(Int_t ib=0; ib<fnPtBins; ib++) {
1526  fMinCombinedProbability[ib] = minProb[ib];
1527  }
1528  return;
1529 }
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