AliPhysics  fde8a9f (fde8a9f)
 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 //---------------------------------------------------------------------------
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 //---------------------------------------------------------------------------
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  Double_t pt=d->Pt();
368  if(pt<fMinPtCand) return 0;
369  if(pt>fMaxPtCand) return 0;
370 
371  if (!d->GetSecondaryVtx()) {
372  AliDebug(2,"No secondary vertex for cascade");
373  return 0;
374  }
375 
376  if (d->GetNDaughters()!=2) {
377  AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",d->GetNDaughters()));
378  return 0;
379  }
380 
381  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
382 
383  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
384  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
385 
386  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
387  if (!v0 || !bachelorTrack) {
388  AliDebug(2,"No V0 or no bachelor for current cascade");
389  return 0;
390  }
391 
392  if (bachelorTrack->GetID()<0) {
393  AliDebug(2,Form("Bachelor has negative ID %d",bachelorTrack->GetID()));
394  return 0;
395  }
396 
397  if (!v0->GetSecondaryVtx()) {
398  AliDebug(2,"No secondary vertex for V0 by cascade");
399  return 0;
400  }
401 
402  if (v0->GetNDaughters()!=2) {
403  AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0->GetOnFlyStatus(),v0->GetNDaughters()));
404  return 0;
405  }
406 
407 
408  // Get the V0 daughter tracks
409  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
410  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
411  if (!v0positiveTrack || !v0negativeTrack ) {
412  AliDebug(2,"No V0 daughters' objects");
413  return 0;
414  }
415 
416  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
417  AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",v0positiveTrack->GetID(),v0negativeTrack->GetID()));
418  return 0;
419  }
420 
421  //if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
422  if ( fUseTrackSelectionWithFilterBits && !(bachelorTrack->TestFilterMask(BIT(4))) ) {
423  AliDebug(2,"Check on the bachelor FilterBit: no BIT(4). Candidate rejected.");
424  return 0;
425  }
426 
427  Int_t returnvalueTrack = 7;
428 
429  // selection on daughter tracks
430  if (selectionLevel==AliRDHFCuts::kAll ||
431  selectionLevel==AliRDHFCuts::kTracks) {
432 
433  if (!AreLctoV0DaughtersSelected(d,aod)) return 0;
434 
435  }
436 
437  Bool_t okLck0sp=kTRUE, okLcLpi=kTRUE, okLcLBarpi=kTRUE;
438 
439  // selection on candidate
440  if (selectionLevel==AliRDHFCuts::kAll ||
441  selectionLevel==AliRDHFCuts::kCandidate) {
442 
443  Double_t pt = d->Pt();
444  Int_t ptbin = PtBin(pt);
445 
446  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
447  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
448  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
449 
450  // K0S + p
451  Double_t mk0s = v0->MassK0Short();
452  Double_t mLck0sp = d->InvMassLctoK0sP();
453 
454  // Lambda + pi
455  Double_t mlambda = v0->MassLambda();
456  Double_t malambda = v0->MassAntiLambda();
457  Double_t mLcLpi = d->InvMassLctoLambdaPi();
458 
459  Bool_t okK0spipi=kTRUE, okLppi=kTRUE, okLBarpip=kTRUE;
460  Bool_t isNotK0S = kTRUE, isNotLambda = kTRUE, isNotLambdaBar = kTRUE, isNotGamma = kTRUE;
461 
462  // cut on Lc mass with K0S+p hypothesis
463  if (TMath::Abs(mLck0sp-mLcPDG) > fCutsRD[GetGlobalIndex(0,ptbin)] && fExcludedCut!=0) {
464  okLck0sp = kFALSE;
465  AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to Lambda_c into K0S+p cut",mLck0sp));
466  }
467 
468  // cuts on the V0 mass: K0S case
469  if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(2,ptbin)] && fExcludedCut!=2) {
470  okK0spipi = kFALSE;
471  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to K0S cut",mk0s));
472  }
473 
474  // cut on Lc mass with Lambda+pi hypothesis
475  if (TMath::Abs(mLcLpi-mLcPDG) > fCutsRD[GetGlobalIndex(1,ptbin)] && fExcludedCut!=1) {
476  okLcLpi = kFALSE;
477  okLcLBarpi = kFALSE;
478  AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to Lambda_c into Lambda+pi cut",mLcLpi));
479  }
480 
481  // cuts on the V0 mass: Lambda/LambdaBar case
482  //if ( !(bachelorTrack->Charge()==+1 && TMath::Abs(mlambda-mLPDG) <= fCutsRD[GetGlobalIndex(3,ptbin)] ) ) {
483  if ( TMath::Abs(mlambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)] && fExcludedCut!=3) {
484  okLppi = kFALSE;
485  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to LambdaBar cut",mlambda));
486  }
487 
488  //if ( !(bachelorTrack->Charge()==-1 && TMath::Abs(malambda-mLPDG) <= fCutsRD[GetGlobalIndex(3,ptbin)] ) ) {
489  if ( TMath::Abs(malambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)] && fExcludedCut!=3) {
490  okLBarpip = kFALSE;
491  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to LambdaBar cut",malambda));
492  }
493 
494  // cut on K0S invariant mass veto
495  if (TMath::Abs(v0->MassK0Short()-mk0sPDG) < fCutsRD[GetGlobalIndex(12,ptbin)] && fExcludedCut!=12) { // K0S invariant mass veto
496  AliDebug(4,Form(" veto on K0S invariant mass doesn't pass the cut"));
497  //return 0;
498  isNotK0S=kFALSE;
499  }
500 
501  // cut on Lambda/LambdaBar invariant mass veto
502  if (TMath::Abs(v0->MassLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) { // Lambda invariant mass veto
503  AliDebug(4,Form(" veto on Lambda invariant mass doesn't pass the cut"));
504  isNotLambda=kFALSE;
505  //return 0;
506  }
507  if (TMath::Abs(v0->MassAntiLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) { // LambdaBar invariant mass veto
508  AliDebug(4,Form(" veto on LambdaBar invariant mass doesn't pass the cut"));
509  isNotLambdaBar=kFALSE;
510  //return 0;
511  }
512 
513  // cut on gamma invariant mass veto
514  if (v0->InvMass2Prongs(0,1,11,11) < fCutsRD[GetGlobalIndex(14,ptbin)] && fExcludedCut!=14) { // K0S invariant mass veto
515  AliDebug(4,Form(" veto on gamma invariant mass doesn't pass the cut"));
516  isNotGamma=kFALSE;
517  //return 0;
518  }
519 
520  okLck0sp = okLck0sp && okK0spipi && isNotLambda && isNotLambdaBar && isNotGamma;
521  okLcLpi = okLcLpi && okLppi && isNotK0S && isNotLambdaBar && isNotGamma;
522  okLcLBarpi = okLcLBarpi && okLBarpip && isNotK0S && isNotLambda && isNotGamma;
523 
524  if (!okLck0sp && !okLcLpi && !okLcLBarpi) return 0;
525 
526  // cuts on the minimum pt of the tracks
527  if (TMath::Abs(bachelorTrack->Pt()) < fCutsRD[GetGlobalIndex(4,ptbin)] && fExcludedCut!=4) {
528  AliDebug(4,Form(" bachelor track Pt=%2.2e > %2.2e",bachelorTrack->Pt(),fCutsRD[GetGlobalIndex(4,ptbin)]));
529  return 0;
530  }
531  if (TMath::Abs(v0positiveTrack->Pt()) < fCutsRD[GetGlobalIndex(5,ptbin)] && fExcludedCut!=5) {
532  AliDebug(4,Form(" V0-positive track Pt=%2.2e > %2.2e",v0positiveTrack->Pt(),fCutsRD[GetGlobalIndex(5,ptbin)]));
533  return 0;
534  }
535  if (TMath::Abs(v0negativeTrack->Pt()) < fCutsRD[GetGlobalIndex(6,ptbin)] && fExcludedCut!=6) {
536  AliDebug(4,Form(" V0-negative track Pt=%2.2e > %2.2e",v0negativeTrack->Pt(),fCutsRD[GetGlobalIndex(6,ptbin)]));
537  return 0;
538  }
539 
540  // cut on cascade dca (prong-to-prong)
541  if ( TMath::Abs(d->GetDCA()) > fCutsRD[GetGlobalIndex(7,ptbin)] && fExcludedCut!=7) { // prong-to-prong cascade DCA
542  AliDebug(4,Form(" cascade tracks DCA don't pass the cut"));
543  return 0;
544  }
545 
546  // cut on V0 dca (prong-to-prong)
547  if ( TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(8,ptbin)] && fExcludedCut!=8) { // prong-to-prong V0 DCA
548  AliDebug(4,Form(" V0 DCA don't pass the cut"));
549  return 0;
550  }
551 
552  // cut on V0 cosine of pointing angle wrt PV
553  if (d->CosV0PointingAngle() < fCutsRD[GetGlobalIndex(9,ptbin)] && fExcludedCut!=9) { // cosine of V0 pointing angle wrt primary vertex
554  AliDebug(4,Form(" V0 cosine of pointing angle doesn't pass the cut"));
555  return 0;
556  }
557 
558  // cut on bachelor transverse impact parameter wrt PV
559  if (TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(10,ptbin)] && fExcludedCut!=10) { // bachelor transverse impact parameter wrt PV
560  AliDebug(4,Form(" bachelor transverse impact parameter doesn't pass the cut"));
561  return 0;
562  }
563 
564  // cut on V0 transverse impact parameter wrt PV
565  if (TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(11,ptbin)] && fExcludedCut!=11) { // V0 transverse impact parameter wrt PV
566  AliDebug(4,Form(" V0 transverse impact parameter doesn't pass the cut"));
567  return 0;
568  }
569 
570  // cut on V0 pT min
571  if (v0->Pt() < fCutsRD[GetGlobalIndex(15,ptbin)] && fExcludedCut!=15) { // V0 pT min
572  AliDebug(4,Form(" V0 track Pt=%2.2e > %2.2e",v0->Pt(),fCutsRD[GetGlobalIndex(15,ptbin)]));
573  return 0;
574  }
575 
576  }
577 
578  Int_t returnvalue = okLck0sp+2*okLcLBarpi+4*okLcLpi;
579  /*
580  retvalue case
581  1 Lc->K0S + p
582  2 Lc->LambdaBar + pi
583  3 Lc->K0S + p AND Lc->LambdaBar + pi
584  4 Lc->Lambda + pi
585  5 Lc->K0S + p AND Lc->Lambda + pi
586  6 Lc->LambdaBar + pi AND Lc->Lambda + pi
587  7 Lc->K0S + p AND Lc->LambdaBar + pi AND Lc->Lambda + pi
588  */
589 
590  Int_t returnvaluePID = 7;
591 
592  // selection on candidate
593  if (selectionLevel==AliRDHFCuts::kAll ||
594  selectionLevel==AliRDHFCuts::kCandidate ||
595  selectionLevel==AliRDHFCuts::kPID )
596  returnvaluePID = IsSelectedPID(d);
597 
598  //if (fUsePID && returnvaluePID==0) return 0;
599 
600  Int_t returnvalueTot = 0;
601  if ( fUsePID )
602  returnvalueTot = CombineCuts(returnvalueTrack,returnvalue,returnvaluePID);
603  else
604  returnvalueTot = CombineCuts(returnvalueTrack,returnvalue,7);
605 
606  return returnvalueTot;
607 
608 }
609 //---------------------------------------------------------------------------
610 Bool_t AliRDHFCutsLctoV0::PreSelect(TObject* obj, AliAODv0 *v0, AliVTrack *bachelorTrack){
611  //
612  // Apply pre-selections, used in the AOD filtering
613  //
614 
615  if (!fCutsRD) {
616  AliFatal("Cut matrix not inizialized. Exit...");
617  return 0;
618  }
619 
621  if (!d) {
622  AliDebug(2,"AliAODRecoCascadeHF null");
623  return 0;
624  }
625 
626  Double_t pt = d->Pt();
627  Int_t ptbin = PtBin(pt);
628 
629  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
630  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
631 
632  // cut on V0 pT min
633  if (v0->Pt() < fCutsRD[GetGlobalIndex(15,ptbin)]) return 0;
634 
635  // cuts on the minimum pt of the bachelor
636  if (TMath::Abs(bachelorTrack->Pt()) < fCutsRD[GetGlobalIndex(4,ptbin)]) return 0;
637 
638  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
639  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
640  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
641 
642  // K0S + p
643  Double_t mk0s = v0->MassK0Short();
644  Double_t mLck0sp = d->InvMassLctoK0sP();
645 
646  // Lambda + pi
647  Double_t mlambda = v0->MassLambda();
648  Double_t malambda = v0->MassAntiLambda();
649  Double_t mLcLpi = d->InvMassLctoLambdaPi();
650 
651  Bool_t okLck0sp=kTRUE, okLcLpi=kTRUE, okLcLBarpi=kTRUE;
652  Bool_t okK0spipi=kTRUE, okLppi=kTRUE, okLBarpip=kTRUE;
653  Bool_t isNotK0S = kTRUE, isNotLambda = kTRUE, isNotLambdaBar = kTRUE, isNotGamma = kTRUE;
654 
655  // cut on Lc mass with K0S+p hypothesis
656  if (TMath::Abs(mLck0sp-mLcPDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okLck0sp = kFALSE;
657  // cuts on the V0 mass: K0S case
658  if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(2,ptbin)]) okK0spipi = kFALSE;
659  // cut on Lc mass with Lambda+pi hypothesis
660  if (TMath::Abs(mLcLpi-mLcPDG) > fCutsRD[GetGlobalIndex(1,ptbin)]) {
661  okLcLpi = kFALSE;
662  okLcLBarpi = kFALSE;
663  }
664 
665  // cuts on the V0 mass: Lambda/LambdaBar case
666  if ( TMath::Abs(mlambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)]) okLppi = kFALSE;
667  if ( TMath::Abs(malambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)]) okLBarpip = kFALSE;
668 
669  // cut on K0S invariant mass veto
670  if (TMath::Abs(v0->MassK0Short()-mk0sPDG) < fCutsRD[GetGlobalIndex(12,ptbin)]) isNotK0S=kFALSE;
671  // cut on Lambda/LambdaBar invariant mass veto
672  if (TMath::Abs(v0->MassLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)]) isNotLambda=kFALSE;
673  if (TMath::Abs(v0->MassAntiLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)]) isNotLambdaBar=kFALSE;
674 
675  // cut on gamma invariant mass veto
676  if (v0->InvMass2Prongs(0,1,11,11) < fCutsRD[GetGlobalIndex(14,ptbin)]) isNotGamma=kFALSE;
677 
678  okLck0sp = okLck0sp && okK0spipi && isNotLambda && isNotLambdaBar && isNotGamma;
679  okLcLpi = okLcLpi && okLppi && isNotK0S && isNotLambdaBar && isNotGamma;
680  okLcLBarpi = okLcLBarpi && okLBarpip && isNotK0S && isNotLambda && isNotGamma;
681 
682  if (!okLck0sp && !okLcLpi && !okLcLBarpi) return 0;
683 
684 
685  // cut on V0 dca (prong-to-prong)
686  if ( TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
687 
688 
689  return kTRUE;
690 
691 }
692 //---------------------------------------------------------------------------
694 
695  // fPidHF -> PID object for bachelor
696 
697  if (!fUsePID || !obj) {
698  AliDebug(2,"PID selection inactive. Candidate accepted.");
699  return 7; // all hypothesis are valid
700  }
701 
703 
704  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(objD->Getv0());
705  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
706  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
707 
708  AliAODTrack *bachelor = (AliAODTrack*)objD->GetBachelor();
709  AliAODTrack *v0Pos = (AliAODTrack*)objD->Getv0PositiveTrack();
710  AliAODTrack *v0Neg = (AliAODTrack*)objD->Getv0NegativeTrack();
711 
712  if (!bachelor || !v0Pos || !v0Neg) return 0;
713 
714  Bool_t okLcK0Sp = kTRUE; // K0S case
715  Bool_t okLcLambdaBarPi = kTRUE; // LambdaBar case
716  Bool_t okLcLambdaPi = kTRUE; // Lambda case
717 
718  Double_t ptCand = objD->Pt();
719  Int_t candPtBin = PtBin(ptCand);
720  CheckPID(candPtBin,bachelor,v0Neg,v0Pos,okLcK0Sp,okLcLambdaBarPi,okLcLambdaPi);
721 
722  Int_t returnvalue = okLcK0Sp+2*okLcLambdaBarPi+4*okLcLambdaPi;
723 
724  return returnvalue;
725 }
726 //-----------------------
727 void AliRDHFCutsLctoV0::CheckPID(Int_t candPtBin, AliAODTrack *bachelor,
728  AliAODTrack * /*v0Neg*/, AliAODTrack * /*v0Pos*/,
729  Bool_t &isBachelorID1, Bool_t &isBachelorID2, Bool_t &isBachelorID4) {
730  // identification strategy
731 
732  Int_t idxIDbyTOF = -1;
733  Int_t idxIDbyTPC = -1;
734 
735  Int_t tpcID = -1;
736  Int_t tofID = -1;
737  Double_t nTPCsigmas = -999;
738  Double_t nTOFsigmas = -999;
739 
740  Bool_t trackIDByTOF = -1;
741  Bool_t trackIDByTPC = -1;
742 
743  Bool_t dummy = kFALSE;
744 
745  switch (fPidSelectionFlag) {
746 
747  case 0:
748 
749  // identify bachelor
750  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,4);
751  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,4);
752  isBachelorID1 = (idxIDbyTOF==4) && (idxIDbyTPC==4); // K0S case
753 
754  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,2);
755  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,2);
756  isBachelorID2 = (idxIDbyTOF==2) && (idxIDbyTPC==2); // LambdaBar case
757 
758  isBachelorID4 = isBachelorID2; // Lambda case
759 
760  break;
761 
762  case 1:
763 
764  // identify bachelor
765  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,4);
766  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,4);
767  dummy = ( !(fPidHF->CheckTOFPIDStatus(bachelor)) && (idxIDbyTPC==4) &&
768  fPidHF->IsExcluded(bachelor,2,2.,"TPC") && fPidHF->IsExcluded(bachelor,3,2.,"TPC") ); // K0S case
769  isBachelorID1 = ( (idxIDbyTOF==4) || dummy );
770 
771  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,2);
772  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,2);
773  dummy = ( !(fPidHF->CheckTOFPIDStatus(bachelor)) && (idxIDbyTPC==2) &&
774  fPidHF->IsExcluded(bachelor,3,2.,"TPC") && fPidHF->IsExcluded(bachelor,4,2.,"TPC") ); // LambdaBar case
775  isBachelorID2 = ( (idxIDbyTOF==2) || dummy );
776 
777  isBachelorID4 = isBachelorID2; // Lambda case
778 
779  break;
780 
781  case 2:
782 
783  // identify bachelor
784  nTOFsigmas = -999;
785  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
786  nTPCsigmas = -999;
787  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
788  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
789  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
790  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
791  (bachelor->P()>=fLowPtCut && TMath::Abs(nTPCsigmas)<3) ) );
792  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // K0S case
793 
794  nTOFsigmas = -999;
795  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
796  nTPCsigmas = -999;
797  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
798  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
799  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
800  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
801  (bachelor->P()>=fLowPtCut && TMath::Abs(nTPCsigmas)<3) ) );
802  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // LambdaBar case
803 
804  isBachelorID4 = isBachelorID2; // Lambda case
805 
806  break;
807 
808  case 3:
809 
810  // identify bachelor
811  nTOFsigmas = -999;
812  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
813  nTPCsigmas = -999;
814  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
815  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
816  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
817  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
818  (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTPCsigmas)<3) ||
819  (bachelor->P()>=fHighPtCut && nTPCsigmas>-3 && nTPCsigmas<2) ) );
820  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // K0S case
821 
822  nTOFsigmas = -999;
823  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
824  nTPCsigmas = -999;
825  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
826  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
827  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
828  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
829  (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTPCsigmas)<3) ||
830  (bachelor->P()>=fHighPtCut && nTPCsigmas>-3 && nTPCsigmas<2) ) );
831  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // LambdaBar case
832 
833  isBachelorID4 = isBachelorID2; // Lambda case
834 
835  break;
836 
837  case 4:
838 
839  // identify bachelor
840  nTOFsigmas = -999;
841  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
842  nTPCsigmas = -999;
843  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
844  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
845  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
846  trackIDByTPC = ( (tpcID==1) && (TMath::Abs(nTPCsigmas)<2) );
847  isBachelorID1 = ( (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTOF) ); // K0S case
848 
849  nTOFsigmas = -999;
850  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
851  nTPCsigmas = -999;
852  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
853  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
854  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
855  trackIDByTPC = ( (tpcID==1) && (TMath::Abs(nTPCsigmas)<2) );
856  isBachelorID2 = ( (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTOF) ); // LambdaBar case
857 
858  isBachelorID4 = isBachelorID2; // Lambda case
859 
860  break;
861 
862  case 5:
863 
864  // identify bachelor
865  nTOFsigmas = -999;
866  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
867  nTPCsigmas = -999;
868  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
869  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
870  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
871  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
872  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
873 
874  nTOFsigmas = -999;
875  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
876  nTPCsigmas = -999;
877  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
878  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
879  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
880  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
881  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
882 
883  isBachelorID4 = isBachelorID2; // Lambda case
884 
885  break;
886 
887  case 6:
888 
889  // identify bachelor
890  nTOFsigmas = -999;
891  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
892  nTPCsigmas = -999;
893  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
894  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
895  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
896  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
897  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
898 
899  nTOFsigmas = -999;
900  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
901  nTPCsigmas = -999;
902  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
903  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
904  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
905  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
906  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
907 
908  isBachelorID4 = isBachelorID2; // Lambda case
909 
910  break;
911 
912  case 7:
913 
914  // identify bachelor
915  nTOFsigmas = -999;
916  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
917  nTPCsigmas = -999;
918  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
919  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
920  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
921  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fLowPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
922  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
923 
924  nTOFsigmas = -999;
925  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
926  nTPCsigmas = -999;
927  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
928  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
929  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
930  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
931  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
932 
933  isBachelorID4 = isBachelorID2; // Lambda case
934 
935  break;
936 
937  case 8:
938 
939  // identify bachelor
940  nTOFsigmas = -999;
941  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
942  nTPCsigmas = -999;
943  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
944  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
945  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
946  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fLowPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
947  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
948 
949  nTOFsigmas = -999;
950  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
951  nTPCsigmas = -999;
952  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
953  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
954  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
955  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
956  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
957 
958  isBachelorID4 = isBachelorID2; // Lambda case
959 
960  break;
961 
962  case 9:
963  {
964  // identify bachelor
965  fPidHF->GetPidCombined()->SetDefaultTPCPriors();
966  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
967  Double_t probTPCTOF[AliPID::kSPECIES]={-1.};
968  UInt_t detUsed = fPidHF->GetPidCombined()->ComputeProbabilities(bachelor, fPidHF->GetPidResponse(), probTPCTOF);
969  Double_t probProton = -1.;
970  Double_t probPion = -1.;
971  if (detUsed == (UInt_t)fPidHF->GetPidCombined()->GetDetectorMask() ) {
972  probProton = probTPCTOF[AliPID::kProton];
973  probPion = probTPCTOF[AliPID::kPion];
974  }
975  else { // if you don't have both TOF and TPC, try only TPC
976  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
977  detUsed = fPidHF->GetPidCombined()->ComputeProbabilities(bachelor, fPidHF->GetPidResponse(), probTPCTOF);
978  if (detUsed == (UInt_t)fPidHF->GetPidCombined()->GetDetectorMask()) {
979  probProton = probTPCTOF[AliPID::kProton];
980  probPion = probTPCTOF[AliPID::kPion];
981  }
982  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
983  }
984 
985  isBachelorID1=(probProton>fMinCombinedProbability[candPtBin]); // K0S case
986 
987  isBachelorID2=(probPion>fMinCombinedProbability[candPtBin]); // LambdaBar case
988 
989  isBachelorID4 = isBachelorID2; // Lambda case
990  }
991  break;
992 
993  }
994 
995 }
996 //----------------
997 Int_t AliRDHFCutsLctoV0::CombineCuts(Int_t returnvalueTrack, Int_t returnvalue, Int_t returnvaluePID) const {
998  //
999  // combine track selection, topological cuts and PID
1000  //
1001 
1002  Int_t returnvalueTot=returnvalueTrack&returnvalue;
1003  returnvalueTot=returnvalueTot&returnvaluePID;
1004 
1005  return returnvalueTot;
1006 }
1007 
1008 //----------------------------------
1010  //
1011  // Apply selection on single cut
1012  //
1013 
1014  if (!fCutsRD) {
1015  AliDebug(2,"Cut matrice not inizialized. Exit...");
1016  return 0;
1017  }
1018 
1020  if (!d) {
1021  AliDebug(2,"AliAODRecoCascadeHF null");
1022  return 0;
1023  }
1024 
1025  if (!d->GetSecondaryVtx()) {
1026  AliDebug(2,"No secondary vertex for cascade");
1027  return 0;
1028  }
1029 
1030  if (d->GetNDaughters()!=2) {
1031  AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",d->GetNDaughters()));
1032  return 0;
1033  }
1034 
1035  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
1036  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
1037  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
1038 
1039  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
1040  if (!v0 || !bachelorTrack) {
1041  AliDebug(2,"No V0 or no bachelor for current cascade");
1042  return 0;
1043  }
1044 
1045  if (bachelorTrack->GetID()<0) {
1046  AliDebug(2,Form("Bachelor has negative ID %d",bachelorTrack->GetID()));
1047  return 0;
1048  }
1049 
1050  if (!v0->GetSecondaryVtx()) {
1051  AliDebug(2,"No secondary vertex for V0 by cascade");
1052  return 0;
1053  }
1054 
1055  if (v0->GetNDaughters()!=2) {
1056  AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0->GetOnFlyStatus(),v0->GetNDaughters()));
1057  return 0;
1058  }
1059 
1060 
1061  // Get the V0 daughter tracks
1062  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
1063  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
1064  if (!v0positiveTrack || !v0negativeTrack ) {
1065  AliDebug(2,"No V0 daughters' objects");
1066  return 0;
1067  }
1068 
1069  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
1070  AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",v0positiveTrack->GetID(),v0negativeTrack->GetID()));
1071  return 0;
1072  }
1073 
1074  //if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
1075  if ( fUseTrackSelectionWithFilterBits && !(bachelorTrack->TestFilterMask(BIT(4))) ) {
1076  AliDebug(2,"Check on the bachelor FilterBit: no BIT(4). Candidate rejected.");
1077  return 0;
1078  }
1079 
1080 
1081  // selection on daughter tracks
1082  if (selectionLevel==AliRDHFCuts::kAll ||
1083  selectionLevel==AliRDHFCuts::kTracks) {
1084 
1085  if (!AreLctoV0DaughtersSelected(d,aod)) return 0;
1086 
1087  }
1088 
1089  Bool_t okLck0sp=kFALSE, okLcLpi=kFALSE, okLcLBarpi=kFALSE;
1090 
1091  // selection on candidate
1092  if (selectionLevel==AliRDHFCuts::kAll ||
1093  selectionLevel==AliRDHFCuts::kCandidate) {
1094 
1095  Double_t pt = d->Pt();
1096  Int_t ptbin = PtBin(pt);
1097 
1098  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
1099  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
1100  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
1101 
1102  // K0S + p
1103  Double_t mk0s = v0->MassK0Short();
1104  Double_t mLck0sp = d->InvMassLctoK0sP();
1105 
1106  // Lambda + pi
1107  Double_t mlambda = v0->MassLambda();
1108  Double_t malambda = v0->MassAntiLambda();
1109  Double_t mLcLpi = d->InvMassLctoLambdaPi();
1110 
1111  switch (cutIndex) {
1112  case 0:
1113  // cut on Lc mass with K0S+p hypothesis
1114  okLck0sp = TMath::Abs(mLck0sp-mLcPDG)<=fCutsRD[GetGlobalIndex(0,ptbin)];
1115  okLcLpi = kFALSE;
1116  okLcLBarpi = kFALSE;
1117  break;
1118  case 1:
1119  // cut on Lc mass with Lambda+pi hypothesis
1120  okLck0sp = kFALSE;
1121  okLcLpi = TMath::Abs(mLcLpi-mLcPDG)<=fCutsRD[GetGlobalIndex(1,ptbin)];
1122  okLcLBarpi = okLcLpi;
1123  break;
1124  case 2:
1125  // cuts on the V0 mass: K0S case
1126  okLck0sp = TMath::Abs(mk0s-mk0sPDG)<=fCutsRD[GetGlobalIndex(2,ptbin)];
1127  okLcLpi = kFALSE;
1128  okLcLBarpi = kFALSE;
1129  break;
1130  case 3:
1131  // cuts on the V0 mass: Lambda/LambdaBar case
1132  okLck0sp = kFALSE;
1133  okLcLpi = TMath::Abs(mlambda-mLPDG)<=fCutsRD[GetGlobalIndex(3,ptbin)];
1134  //okLcLpi = okLcLpi && (bachelorTrack->Charge()==+1);
1135  okLcLBarpi = TMath::Abs(malambda-mLPDG)<=fCutsRD[GetGlobalIndex(3,ptbin)];
1136  //okLcLBarpi = okLcLBarpi && (bachelorTrack->Charge()==-1);
1137  break;
1138  case 4:
1139  // cuts on the minimum pt of bachelor
1140  okLck0sp = TMath::Abs(bachelorTrack->Pt())>=fCutsRD[GetGlobalIndex(4,ptbin)];
1141  okLcLpi = okLck0sp;
1142  okLcLBarpi = okLck0sp;
1143  break;
1144  case 5:
1145  // cuts on the minimum pt of positive V0daughter
1146  okLck0sp = TMath::Abs(v0positiveTrack->Pt())>=fCutsRD[GetGlobalIndex(5,ptbin)];
1147  okLcLpi = okLck0sp;
1148  okLcLBarpi = okLck0sp;
1149  break;
1150  case 6:
1151  // cuts on the minimum pt of negative V0daughter
1152  okLck0sp = TMath::Abs(v0negativeTrack->Pt())>=fCutsRD[GetGlobalIndex(6,ptbin)];
1153  okLcLpi = okLck0sp;
1154  okLcLBarpi = okLck0sp;
1155  break;
1156  case 7:
1157  // cut on cascade dca
1158  okLck0sp = TMath::Abs(d->GetDCA())<=fCutsRD[GetGlobalIndex(7,ptbin)];
1159  okLcLpi = okLck0sp;
1160  okLcLBarpi = okLck0sp;
1161  break;
1162  case 8:
1163  // cut on V0 dca
1164  okLck0sp = TMath::Abs(v0->GetDCA())<=fCutsRD[GetGlobalIndex(8,ptbin)];
1165  okLcLpi = okLck0sp;
1166  okLcLBarpi = okLck0sp;
1167  break;
1168  case 9:
1169  // cut on V0 cosine of pointing angle wrt PV
1170  okLck0sp = d->CosV0PointingAngle()>=fCutsRD[GetGlobalIndex(9,ptbin)];
1171  okLcLpi = okLck0sp;
1172  okLcLBarpi = okLck0sp;
1173  break;
1174  case 10:
1175  // cut on bachelor transverse impact parameter wrt PV
1176  okLck0sp = TMath::Abs(d->Getd0Prong(0))<=fCutsRD[GetGlobalIndex(10,ptbin)];
1177  okLcLpi = okLck0sp;
1178  okLcLBarpi = okLck0sp;
1179  break;
1180  case 11:
1181  // cut on V0 transverse impact parameter wrt PV
1182  okLck0sp = TMath::Abs(d->Getd0Prong(1))<=fCutsRD[GetGlobalIndex(11,ptbin)];
1183  okLcLpi = okLck0sp;
1184  okLcLBarpi = okLck0sp;
1185  break;
1186  case 12:
1187  // cut on K0S invariant mass veto
1188  okLcLpi = TMath::Abs(mk0s-mk0sPDG)>=fCutsRD[GetGlobalIndex(12,ptbin)];
1189  okLcLBarpi = TMath::Abs(mk0s-mk0sPDG)>=fCutsRD[GetGlobalIndex(12,ptbin)];
1190  break;
1191  case 13:
1192  // cut on Lambda/LambdaBar invariant mass veto
1193  okLck0sp = (TMath::Abs(mlambda-mLPDG)>=fCutsRD[GetGlobalIndex(13,ptbin)] &&
1194  TMath::Abs(malambda-mLPDG)>=fCutsRD[GetGlobalIndex(13,ptbin)]);
1195  break;
1196  case 14:
1197  // cut on gamma invariant mass veto
1198  okLck0sp = v0->InvMass2Prongs(0,1,11,11)>=fCutsRD[GetGlobalIndex(14,ptbin)];
1199  okLcLpi = okLck0sp;
1200  okLcLBarpi = okLck0sp;
1201  break;
1202  case 15:
1203  // cut on V0 pT min
1204  okLck0sp = v0->Pt()>=fCutsRD[GetGlobalIndex(15,ptbin)];
1205  okLcLpi = okLck0sp;
1206  okLcLBarpi = okLck0sp;
1207  break;
1208  }
1209  }
1210 
1211  Int_t returnvalue = okLck0sp+2*okLcLBarpi+4*okLcLpi;
1212  /*
1213  retvalue case
1214  1 Lc->K0S + p
1215  2 Lc->LambdaBar + pi
1216  3 Lc->K0S + p AND Lc->LambdaBar + pi
1217  4 Lc->Lambda + pi
1218  5 Lc->K0S + p AND Lc->Lambda + pi
1219  6 Lc->LambdaBar + pi AND Lc->Lambda + pi
1220  7 Lc->K0S + p AND Lc->LambdaBar + pi AND Lc->Lambda + pi
1221  */
1222 
1223 
1224  /*
1225  Int_t returnvaluePID = 7;
1226 
1227  // selection on PID
1228  if (selectionLevel==AliRDHFCuts::kAll ||
1229  selectionLevel==AliRDHFCuts::kCandidate ||
1230  selectionLevel==AliRDHFCuts::kPID )
1231  returnvaluePID = IsSelectedPID(d);
1232  */
1233 
1234  Int_t returnvalueTot = 0;
1235  //if ( fUsePID )
1236  //returnvalueTot = CombineCuts(returnvalue,returnvaluePID);
1237  //else
1238  returnvalueTot = returnvalue;
1239 
1240  return returnvalueTot;
1241 
1242 }
1243 //----------------------------------
1245 
1246  SetName("LctoV0ProductionCuts");
1247  SetTitle("Production cuts for Lc->V0+bachelor analysis");
1248 
1249  AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
1250  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1251  //default
1252  esdTrackCuts->SetRequireTPCRefit(kTRUE);
1253  esdTrackCuts->SetRequireITSRefit(kTRUE);
1254  esdTrackCuts->SetMinNClustersITS(0);//(4); // default is 5
1255  esdTrackCuts->SetMinNClustersTPC(70);
1256  //esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1257  // AliESDtrackCuts::kAny);
1258  // default is kBoth, otherwise kAny
1259  esdTrackCuts->SetMinDCAToVertexXY(0.);
1260  esdTrackCuts->SetPtRange(0.3,1.e10);
1261  //esdTrackCuts->SetEtaRange(-0.8,+0.8);
1262  esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
1263  AddTrackCuts(esdTrackCuts);
1264  delete esdTrackCuts;
1265  esdTrackCuts=NULL;
1266 
1267 
1268  AliESDtrackCuts* esdTrackCutsV0daughters=new AliESDtrackCuts();
1269  esdTrackCutsV0daughters->SetRequireSigmaToVertex(kFALSE);
1270  //default
1271  esdTrackCutsV0daughters->SetRequireTPCRefit(kTRUE);
1272  esdTrackCutsV0daughters->SetRequireITSRefit(kFALSE);//(kTRUE);
1273  esdTrackCutsV0daughters->SetMinNClustersITS(0);//(4); // default is 5
1274  esdTrackCutsV0daughters->SetMinNClustersTPC(70);
1275  //esdTrackCutsV0daughters->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1276  // AliESDtrackCuts::kAny);
1277  // default is kBoth, otherwise kAny
1278  esdTrackCutsV0daughters->SetMinDCAToVertexXY(0.);
1279  esdTrackCutsV0daughters->SetPtRange(0.,1.e10);
1280  esdTrackCutsV0daughters->SetAcceptKinkDaughters(kFALSE);
1281  AddTrackCutsV0daughters(esdTrackCutsV0daughters);
1282  delete esdTrackCutsV0daughters;
1283  esdTrackCutsV0daughters=NULL;
1284 
1285  const Int_t nptbins=1;
1286  Float_t* ptbins;
1287  ptbins=new Float_t[nptbins+1];
1288  ptbins[0]=0.;
1289  ptbins[1]=99999999.;
1290 
1291  SetPtBins(nptbins+1,ptbins);
1292  SetPtBins(nptbins+1,ptbins);
1293 
1294  const Int_t nvars=17;
1295 
1296  Float_t** prodcutsval;
1297  prodcutsval=new Float_t*[nvars];
1298  for(Int_t ic=0;ic<nvars;ic++){prodcutsval[ic]=new Float_t[nptbins];}
1299  for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
1300  prodcutsval[0][ipt2]=1.; // inv. mass if K0S [GeV/c2]
1301  prodcutsval[1][ipt2]=1.; // inv. mass if Lambda [GeV/c2]
1302  prodcutsval[2][ipt2]=0.05; // inv. mass V0 if K0S [GeV/c2]
1303  prodcutsval[3][ipt2]=0.05; // inv. mass V0 if Lambda [GeV/c2]
1304  prodcutsval[4][ipt2]=0.3; // pT min bachelor track [GeV/c] // AOD by construction
1305  prodcutsval[5][ipt2]=0.; // pT min V0-positive track [GeV/c]
1306  prodcutsval[6][ipt2]=0.; // pT min V0-negative track [GeV/c]
1307  prodcutsval[7][ipt2]=1000.; // dca cascade cut [cm]
1308  prodcutsval[8][ipt2]=1.5; // dca V0 cut [nSigma] // it's 1.5 x offline V0s
1309  prodcutsval[9][ipt2]=-1.; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
1310  prodcutsval[10][ipt2]=3.; // d0 max bachelor wrt PV [cm]
1311  prodcutsval[11][ipt2]=1000.;// d0 max V0 wrt PV [cm]
1312  prodcutsval[12][ipt2]=0.; // mass K0S veto [GeV/c2]
1313  prodcutsval[13][ipt2]=0.; // mass Lambda/LambdaBar veto [GeV/c2]
1314  prodcutsval[14][ipt2]=0.; // mass Gamma veto [GeV/c2]
1315  prodcutsval[15][ipt2]=0.; // pT min V0 track [GeV/c]
1316  prodcutsval[16][ipt2]=0.; // V0 type cut
1317  }
1318  SetCuts(nvars,nptbins,prodcutsval);
1319 
1320  SetGlobalIndex(nvars,nptbins);
1321  SetPtBins(nptbins+1,ptbins);
1322 
1323 
1324  //pid settings
1325  //1. bachelor: default one
1326  AliAODPidHF* pidObjBachelor = new AliAODPidHF();
1327  Double_t sigmasBac[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
1328  pidObjBachelor->SetSigma(sigmasBac);
1329  pidObjBachelor->SetAsym(kFALSE);
1330  pidObjBachelor->SetMatch(1);
1331  pidObjBachelor->SetTPC(kTRUE);
1332  pidObjBachelor->SetTOF(kTRUE);
1333  pidObjBachelor->SetTOFdecide(kFALSE);
1334  SetPidHF(pidObjBachelor);
1335 
1336  SetUsePID(kFALSE);//(kTRUE);
1337 
1338  //PrintAll();
1339 
1340  for(Int_t iiv=0;iiv<nvars;iiv++){
1341  delete [] prodcutsval[iiv];
1342  }
1343  delete [] prodcutsval;
1344  prodcutsval=NULL;
1345  delete [] ptbins;
1346  ptbins=NULL;
1347 
1348 
1349  delete pidObjBachelor;
1350  pidObjBachelor=NULL;
1351 
1352  return;
1353 }
1354 //------------------
1356 
1357  SetName("LctoV0ProductionCuts");
1358  SetTitle("Production cuts for Lc->V0+bachelor analysis");
1359 
1361 
1362  return;
1363 }
1364 //------------------
1366 
1367  // Default 2010 PbPb cut object
1369 
1370  //
1371  // Enable all 2011 PbPb run triggers
1372  //
1373  SetTriggerClass("");
1377 
1378 }
1379 //-----------------------
1381 
1382  const Int_t nvars = this->GetNVars() ;
1383  //Float_t *vArray =GetCuts();
1384  //fV0Type = vArray[nvars-1];
1385  fV0Type = (this->GetCuts())[nvars-1];
1386  //this->GetCuts(vArray);
1387  TString *sVarNames=GetVarNames();
1388 
1389  if(sVarNames[nvars-1].Contains("V0 type")) return (Int_t)fV0Type;
1390  else {AliInfo("AliRDHFCutsLctoV0 Last variable is not the V0 type!!!"); return -999;}
1391 }
1392 
1393 //---------------------------------------------------------------------------
1395  //
1396  // print all cuts values
1397  //
1398 
1399  printf("Minimum vtx type %d\n",fMinVtxType);
1400  printf("Minimum vtx contr %d\n",fMinVtxContr);
1401  printf("Max vtx red chi2 %f\n",fMaxVtxRedChi2);
1402  printf("Min SPD mult %d\n",fMinSPDMultiplicity);
1403  printf("Use PID %d (PID selection flag = %d) OldPid=%d\n",(Int_t)fUsePID,(Int_t)fPidSelectionFlag,fPidHF ? fPidHF->GetOldPid() : -1);
1404  printf("High value for pT %f\n",fHighPtCut);
1405  printf("Low and high values for pT cuts: %f %f\n",fLowPtCut,fHighPtCut);
1406  printf("Remove daughters from vtx %d\n",(Int_t)fRemoveDaughtersFromPrimary);
1407  printf("Physics selection: %s\n",fUsePhysicsSelection ? "Yes" : "No");
1408  printf("Pileup rejection: %s\n",(fOptPileup > 0) ? "Yes" : "No");
1409  printf("UseTrackSelectionWithFilterBits: %s\n",fUseTrackSelectionWithFilterBits ? "Yes" : "No");
1410  printf("Reject kink: %s\n",fKinkReject ? "Yes" : "No");
1411  if(fOptPileup==1) printf(" -- Reject pileup event");
1412  if(fOptPileup==2) printf(" -- Reject tracks from pileup vtx");
1413  if(fUseCentrality>0) {
1414  TString estimator="";
1415  if(fUseCentrality==1) estimator = "V0";
1416  if(fUseCentrality==2) estimator = "Tracks";
1417  if(fUseCentrality==3) estimator = "Tracklets";
1418  if(fUseCentrality==4) estimator = "SPD clusters outer";
1419  printf("Centrality class considered: %.1f-%.1f, estimated with %s",fMinCentrality,fMaxCentrality,estimator.Data());
1420  }
1421  if(fIsCandTrackSPDFirst) printf("Check for candidates with pt < %2.2f, that daughters fullfill kFirst criteria\n",fMaxPtCandTrackSPDFirst);
1422 
1423  if(fVarNames){
1424  cout<<"Array of variables"<<endl;
1425  for(Int_t iv=0;iv<fnVars;iv++){
1426  cout<<fVarNames[iv]<<"\t";
1427  }
1428  cout<<endl;
1429  }
1430  if(fVarsForOpt){
1431  cout<<"Array of optimization"<<endl;
1432  for(Int_t iv=0;iv<fnVars;iv++){
1433  cout<<fVarsForOpt[iv]<<"\t";
1434  }
1435  cout<<endl;
1436  }
1437  if(fIsUpperCut){
1438  cout<<"Array of upper/lower cut"<<endl;
1439  for(Int_t iv=0;iv<fnVars;iv++){
1440  cout<<fIsUpperCut[iv]<<"\t";
1441  }
1442  cout<<endl;
1443  }
1444  if(fPtBinLimits){
1445  cout<<"Array of ptbin limits"<<endl;
1446  for(Int_t ib=0;ib<fnPtBinLimits;ib++){
1447  cout<<fPtBinLimits[ib]<<"\t";
1448  }
1449  cout<<endl;
1450  }
1451  if(fCutsRD){
1452  cout<<"Matrix of cuts"<<endl;
1453  for(Int_t iv=0;iv<fnVars;iv++){
1454  for(Int_t ib=0;ib<fnPtBins;ib++){
1455  cout<<"fCutsRD["<<iv<<"]["<<ib<<"] = "<<fCutsRD[GetGlobalIndex(iv,ib)]<<"\t";
1456  }
1457  cout<<endl;
1458  }
1459  cout<<endl;
1460  }
1461 
1462  if (fPidSelectionFlag==9) {
1463  for(Int_t ib=0;ib<fnPtBins;ib++){
1464  cout<<"fMinCombinedProbability["<<ib<<"] = "<<fMinCombinedProbability[ib]<<"\t";
1465  }
1466  cout<<endl;
1467  cout << " GetCombDetectors() = " << GetPidHF()->GetCombDetectors() << endl;
1468  }
1469 
1470  if (fTrackCuts) {
1471  Float_t eta1=0, eta2=0; fTrackCuts->GetEtaRange(eta1,eta2);
1472  cout << " etaRange for Bachelor: [" << eta1 << "," << eta2 << "]\n";
1473  }
1474  if (fV0daughtersCuts) {
1475  Float_t eta3=0, eta4=0; fV0daughtersCuts->GetEtaRange(eta3,eta4);
1476  cout << " etaRange for V0daughters: [" << eta3 << "," << eta4 << "]\n";
1477  }
1478  return;
1479 
1480 }
1481 
1482 //-------------------------
1484 {
1485  //
1486  //
1487  // Checking if Lc is in fiducial acceptance region
1488  //
1489  //
1490 
1491  if(fMaxRapidityCand>-998.){
1492  if(TMath::Abs(y) > fMaxRapidityCand) return kFALSE;
1493  else return kTRUE;
1494  }
1495 
1496  if(pt > 5.) {
1497  // applying cut for pt > 5 GeV
1498  AliDebug(2,Form("pt of Lambda_c = %f (> 5), cutting at |y| < 0.8",pt));
1499  if (TMath::Abs(y) > 0.8) return kFALSE;
1500 
1501  } else {
1502  // appliying smooth cut for pt < 5 GeV
1503  Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
1504  Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
1505  AliDebug(2,Form("pt of Lambda_c = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
1506  if (y < minFiducialY || y > maxFiducialY) return kFALSE;
1507  }
1508  //
1509  return kTRUE;
1510 }
1511 //---------------------------------------------------------------------------
1513  //
1514  // Daughter tracks selection
1515  //
1516 
1518  if (!d) {
1519  AliDebug(2,"AliAODRecoCascadeHF null");
1520  return kFALSE;
1521  }
1522 
1523  if (!fTrackCuts) {
1524  AliFatal("Cut object is not defined for bachelor. Candidate accepted.");
1525  return kFALSE;
1526  }
1527 
1528  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
1529  if (!bachelorTrack) return kFALSE;
1530 
1532  if(!bachelorTrack->HasPointOnITSLayer(0)) return kFALSE;
1533  }
1534 
1535  if (fKinkReject != (!(fTrackCuts->GetAcceptKinkDaughters())) ) {
1536  AliError(Form("Not compatible setting: fKinkReject=%1d - fTrackCuts->GetAcceptKinkDaughters()=%1d",fKinkReject, fTrackCuts->GetAcceptKinkDaughters()));
1537  return kFALSE;
1538  }
1539 
1540  AliAODVertex *vAOD = d->GetPrimaryVtx();
1541  Double_t pos[3]; vAOD->GetXYZ(pos);
1542  Double_t cov[6]; vAOD->GetCovarianceMatrix(cov);
1543  const AliESDVertex vESD(pos,cov,100.,100);
1544 
1545  if (!IsDaughterSelected(bachelorTrack,&vESD,fTrackCuts,aod)) return kFALSE;
1546 
1547  if (!fV0daughtersCuts) {
1548  AliFatal("Cut object is not defined for V0daughters. Candidate accepted.");
1549  return kFALSE;
1550  }
1551 
1552  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
1553  if (!v0) return kFALSE;
1554  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
1555  if (!v0positiveTrack) return kFALSE;
1556  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
1557  if (!v0negativeTrack) return kFALSE;
1558 
1559 
1560  Float_t etaMin=0, etaMax=0; fV0daughtersCuts->GetEtaRange(etaMin,etaMax);
1561  if ( (v0positiveTrack->Eta()<=etaMin || v0positiveTrack->Eta()>=etaMax) ||
1562  (v0negativeTrack->Eta()<=etaMin || v0negativeTrack->Eta()>=etaMax) ) return kFALSE;
1563  Float_t ptMin=0, ptMax=0; fV0daughtersCuts->GetPtRange(ptMin,ptMax);
1564  if ( (v0positiveTrack->Pt()<=ptMin || v0positiveTrack->Pt()>=ptMax) ||
1565  (v0negativeTrack->Pt()<=ptMin || v0negativeTrack->Pt()>=ptMax) ) return kFALSE;
1566 
1567  // Condition on nTPCclusters
1568  if (fV0daughtersCuts->GetMinNClusterTPC()>0) {
1569  if ( ( ( v0positiveTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ||
1570  ( ( v0negativeTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ) return kFALSE;
1571  }
1572 
1573  // kTPCrefit status
1574  if (v0->GetOnFlyStatus()==kFALSE) { // only for offline V0s
1575  if (fV0daughtersCuts->GetRequireTPCRefit()) {
1576  if( !(v0positiveTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
1577  if( !(v0negativeTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
1578  }
1579  }
1580  // kink condition
1581  if (!fV0daughtersCuts->GetAcceptKinkDaughters()) {
1582  AliAODVertex *maybeKinkPos = (AliAODVertex*)v0positiveTrack->GetProdVertex();
1583  AliAODVertex *maybeKinkNeg = (AliAODVertex*)v0negativeTrack->GetProdVertex();
1584  if (maybeKinkPos->GetType()==AliAODVertex::kKink ||
1585  maybeKinkNeg->GetType()==AliAODVertex::kKink) return kFALSE;
1586  }
1587  // Findable clusters > 0 condition - from V0 analysis
1588  //if( v0positiveTrack->GetTPCNclsF()<=0 || v0negativeTrack->GetTPCNclsF()<=0 ) return kFALSE;
1589  /*
1590  Float_t lPosTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
1591  Float_t lNegTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
1592  fTreeVariableLeastNbrCrossedRows = (Int_t) lPosTrackCrossedRows;
1593  if( lNegTrackCrossedRows < fTreeVariableLeastNbrCrossedRows )
1594  fTreeVariableLeastNbrCrossedRows = (Int_t) lNegTrackCrossedRows;
1595  //Compute ratio Crossed Rows / Findable clusters
1596  //Note: above test avoids division by zero!
1597  Float_t lPosTrackCrossedRowsOverFindable = lPosTrackCrossedRows / ((double)(pTrack->GetTPCNclsF()));
1598  Float_t lNegTrackCrossedRowsOverFindable = lNegTrackCrossedRows / ((double)(nTrack->GetTPCNclsF()));
1599  fTreeVariableLeastRatioCrossedRowsOverFindable = lPosTrackCrossedRowsOverFindable;
1600  if( lNegTrackCrossedRowsOverFindable < fTreeVariableLeastRatioCrossedRowsOverFindable )
1601  fTreeVariableLeastRatioCrossedRowsOverFindable = lNegTrackCrossedRowsOverFindable;
1602  //Lowest Cut Level for Ratio Crossed Rows / Findable = 0.8, set here
1603  if ( fTreeVariableLeastRatioCrossedRowsOverFindable < 0.8 ) return kFALSE;
1604  */
1605 
1606  return kTRUE;
1607 
1608 }
1609 
1610 //---------------------------------------------------------------------------
1612  //
1613  // store the combined probability cuts
1614  //
1615  if(nPtBins!=fnPtBins) {
1616  printf("Wrong number of pt bins: it has to be %d\n",fnPtBins);
1617  AliFatal("exiting");
1618  }
1619 
1621 
1622  for(Int_t ib=0; ib<fnPtBins; ib++) {
1623  fMinCombinedProbability[ib] = minProb[ib];
1624  }
1625  return;
1626 }
AliESDtrackCuts * fV0daughtersCuts
virtual void SetStandardCutsPbPb2010()
Double_t fMaxPtCandTrackSPDFirst
flag to select the track kFirst criteria for pt < ptlimit
Definition: AliRDHFCuts.h:430
Int_t GetNVars() const
Definition: AliRDHFCuts.h:236
void SetAsym(Bool_t asym)
Definition: AliAODPidHF.h:88
double Double_t
Definition: External.C:58
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:402
virtual void SetStandardCutsPP2010()
Bool_t fRemoveDaughtersFromPrimary
Definition: AliRDHFCuts.h:408
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:395
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:383
Double_t InvMassLctoLambdaPi() const
Bool_t AreLctoV0DaughtersSelected(AliAODRecoDecayHF *rd, AliAODEvent *aod=0x0) const
Float_t fMaxVtxRedChi2
minimum vertex contributors
Definition: AliRDHFCuts.h:384
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:240
Float_t fV0Type
cuts for v0 daughters (AOD converted to ESD on the flight!)
void SetNVars(Int_t nVars)
Definition: AliRDHFCuts.h:376
Int_t fMinVtxType
cuts on the event
Definition: AliRDHFCuts.h:382
Double_t fMaxRapidityCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:427
void EnableSemiCentralTrigger()
Definition: AliRDHFCuts.h:94
AliRDHFCutsLctoV0 & operator=(const AliRDHFCutsLctoV0 &source)
TString * GetVarNames() const
Definition: AliRDHFCuts.h:237
Double_t ptMin
Int_t ApplyPidTPCRaw(AliAODTrack *track, Int_t specie) const
void SetGlobalIndex()
Definition: AliRDHFCuts.h:198
AliRDHFCuts & operator=(const AliRDHFCuts &source)
Int_t fUseCentrality
min deltaz between main and pileup vertices
Definition: AliRDHFCuts.h:414
Bool_t fUsePID
Definition: AliRDHFCuts.h:403
void SetPidHF(AliAODPidHF *pidObj)
see enum below
Definition: AliRDHFCuts.h:212
Double_t InvMassLctoK0sP() const
Bool_t GetOldPid()
Definition: AliAODPidHF.h:157
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:233
void SetTOF(Bool_t tof)
Definition: AliAODPidHF.h:95
AliAODTrack * Getv0PositiveTrack() const
const Int_t nPtBins
virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d, Float_t *vars, Int_t nvars, Int_t *pdgdaughters)
int Int_t
Definition: External.C:63
Bool_t fUseTrackSelectionWithFilterBits
flag to reject kink daughters
Definition: AliRDHFCuts.h:437
void SetCuts(Int_t nVars, Int_t nPtBins, Float_t **cutsRD)
Int_t fnVarsForOpt
Definition: AliRDHFCuts.h:398
void ResetMaskAndEnableMBTrigger()
Definition: AliRDHFCuts.h:74
unsigned int UInt_t
Definition: External.C:33
AliPIDCombined * GetPidCombined() const
Definition: AliAODPidHF.h:161
float Float_t
Definition: External.C:68
TString * fVarNames
number of cut vars for candidates
Definition: AliRDHFCuts.h:397
Double_t fMaxPtCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:426
AliESDtrackCuts * fTrackCuts
quality cuts on the daughter tracks
Definition: AliRDHFCuts.h:391
void AddTrackCutsV0daughters(AliESDtrackCuts *v0daug)
Float_t fLowPtCut
high pT cut separation for proton identification
AliAODTrack * GetBachelor() const
Int_t fOptPileup
use Physics selection criteria
Definition: AliRDHFCuts.h:411
Bool_t IsExcluded(AliAODTrack *track, Int_t labelTrack, Double_t nsigmaCut, TString detector)
virtual void PrintAll() const
Float_t fMinCentrality
Definition: AliRDHFCuts.h:419
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
Int_t fnPtBinLimits
number of pt bins for cuts
Definition: AliRDHFCuts.h:394
void SetSigma(Double_t *sigma)
Definition: AliAODPidHF.h:39
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:401
Double_t CosV0PointingAngle() const
short Short_t
Definition: External.C:23
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:399
void SetMinCombinedProbability(Int_t ptBins, Float_t *ptMin)
Bool_t PreSelect(TObject *obj, AliAODv0 *v0, AliVTrack *bachelorTrack)
void EnableCentralTrigger()
Definition: AliRDHFCuts.h:82
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:386
void SetUsePID(Bool_t flag=kTRUE)
Definition: AliRDHFCuts.h:206
Int_t fExcludedCut
low pT cut separation for proton identification
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Bool_t fIsCandTrackSPDFirst
IsSelected returns always kTRUE for MC signal.
Definition: AliRDHFCuts.h:429
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:436
Bool_t fUsePhysicsSelection
use MC primary vertex
Definition: AliRDHFCuts.h:410
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:204
void SetTPC(Bool_t tpc)
Definition: AliAODPidHF.h:94
bool Bool_t
Definition: External.C:53
Int_t fnPtBins
cuts on the candidate
Definition: AliRDHFCuts.h:393
Float_t fHighPtCut
V0 type – should be defined as in AliRDHFCuts.h.
Double_t ptMax
void SetTriggerClass(TString trclass0, TString trclass1="")
Definition: AliRDHFCuts.h:194
AliAODPidHF * fPidHF
enable AOD049 centrality cleanup
Definition: AliRDHFCuts.h:405
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
Int_t IsSelectedSingleCut(TObject *obj, Int_t selectionLevel, Int_t cutIndex, AliAODEvent *aod=0x0)
Int_t nptbins
Double_t fMinPtCand
outcome of PID selection
Definition: AliRDHFCuts.h:425
Bool_t IsDaughterSelected(AliAODTrack *track, const AliESDVertex *primary, AliESDtrackCuts *cuts, const AliAODEvent *aod=0x0) const
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
Float_t fMaxCentrality
minimum centrality for selected events
Definition: AliRDHFCuts.h:420
virtual Int_t IsSelectedPID(AliAODRecoDecayHF *obj)
Int_t fnVars
Definition: AliRDHFCuts.h:396