AliPhysics  master (3d17d9d)
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 
47 ClassImp(AliRDHFCutsLctoV0);
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 fMinCombProbVsLcPt(0x0),
61 fBzkG(0),
62 fNBachelorPBins(1),
63 fMinCombProb(0x0),
64 fBachelorPLimitsForPID(0x0),
65 fNTPCSigmaCutForPreselection(999.)
66 {
67  //
68  // Default Constructor
69  //
70 
71  const Int_t nvars=21;
72  SetNVars(nvars);
73  TString varNames[nvars]={"Lc inv. mass if K0S [GeV/c2]", // 0
74  "Lc inv. mass if Lambda [GeV/c2]", // 1
75  "K0S inv. mass [GeV/c2]", // 2
76  "Lambda/LambdaBar inv. mass[GeV/c2]", // 3
77  "pT min bachelor track [GeV/c]", // 4
78  "pT min V0-positive track [GeV/c]", // 5
79  "pT min V0-negative track [GeV/c]", // 6
80  "dca cascade (prong-to-prong) cut [cm]", // 7
81  "dca V0 (prong-to-prong) cut [number of sigmas]", // 8
82  "V0 cosPA min wrt PV", // 9
83  "d0 max bachelor wrt PV [cm]", // 10
84  "d0 max V0 wrt PV [cm]", // 11
85  "mass K0S veto [GeV/c2]", // 12
86  "mass Lambda/LambdaBar veto [GeV/c2]", // 13
87  "mass Gamma veto [GeV/c2]", // 14
88  "pT min V0 track [GeV/c]", // 15
89  "Max Proton emission angle in Lc CMS", // 16
90  "Min Proton emission angle in Lc CMS", // 17
91  "Resigned d0", // 18
92  "V0 qT/|alpha|", // 19
93  "V0 type" // 20
94  };
95 
96  Bool_t isUpperCut[nvars]={kTRUE, // 0
97  kTRUE, // 1
98  kTRUE, // 2
99  kTRUE, // 3
100  kFALSE, // 4
101  kFALSE, // 5
102  kFALSE, // 6
103  kTRUE, // 7
104  kTRUE, // 8
105  kFALSE, // 9
106  kTRUE, // 10
107  kTRUE, // 11
108  kFALSE, // 12
109  kFALSE, // 13
110  kFALSE, // 14
111  kFALSE, // 15
112  kTRUE, // 16
113  kFALSE, // 17
114  kFALSE, // 18
115  kFALSE, // 19
116  kFALSE // 20
117  };
118  SetVarNames(nvars,varNames,isUpperCut);
119  Bool_t forOpt[nvars]={kFALSE, // 0
120  kFALSE, // 1
121  kTRUE, // 2
122  kTRUE, // 3
123  kTRUE, // 4
124  kTRUE, // 5
125  kTRUE, // 6
126  kTRUE, // 7
127  kTRUE, // 8
128  kTRUE, // 9
129  kTRUE, // 10
130  kTRUE, // 11
131  kTRUE, // 12
132  kTRUE, // 13
133  kTRUE, // 14
134  kTRUE, // 15
135  kTRUE, // 16
136  kTRUE, // 17
137  kTRUE, // 18
138  kTRUE, // 19
139  kFALSE // 20
140  };
141  SetVarsForOpt(nvars,forOpt);
142 
143  Float_t limits[2]={0,999999999.};
144  SetPtBins(2,limits);
145 
146  Float_t minProb[1]={0.};
147  SetMinCombinedProbability(1,minProb);
148 
149  Float_t bachelorPlimits[1]={0};
150  SetBachelorPLimitsForPID(1,bachelorPlimits);
151 
152  /*
153  switch (v0channel) {
154  case 0:
155  fV0channel = 0x0001;
156  break;
157  case 1:
158  fV0channel = 0x0002;
159  break;
160  case 2:
161  fV0channel = 0x0004;
162  break;
163  }
164  */
165 
166 }
167 //--------------------------------------------------------------------------
169  AliRDHFCuts(source),
171  fV0daughtersCuts(0),
172  fV0Type(source.fV0Type),
173  fHighPtCut(source.fHighPtCut),
174  fLowPtCut(source.fLowPtCut),
175  fExcludedCut(source.fExcludedCut),
176  fBzkG(source.fBzkG),
179 {
180  //
181  // Copy constructor
182  //
183 
185  else fV0daughtersCuts = new AliESDtrackCuts();
186 
187  if (fnPtBins>0) {
189  }
190  if(fNBachelorPBins > 0){
195  //memcpy(fMinCombProb,source.fMinCombProb,source.fNBachelorPBins*sizeof(Float_t));
196  //memcpy(fBachelorPLimitsForPID,source.fBachelorPLimitsForPID,(source.fNBachelorPBins)*sizeof(Float_t));
197  }
198 
199 }
200 //--------------------------------------------------------------------------
202 {
203  //
204  // assignment operator
205  //
206 
207  if(&source == this) return *this;
208 
209  AliRDHFCuts::operator=(source);
211 
212  delete fV0daughtersCuts;
213  fV0daughtersCuts = new AliESDtrackCuts(*(source.fV0daughtersCuts));
214 
215  fV0Type = source.fV0Type;
216 
217  fHighPtCut = source.fHighPtCut;
218  fLowPtCut = source.fLowPtCut;
219 
220  delete [] fMinCombProbVsLcPt;
222  //for (Int_t ii=0; ii<fnPtBins; ii++)
223  //fMinCombProbVsLcPt[ii]=source.fMinCombProbVsLcPt[ii];
224 
225  fBzkG = source.fBzkG;
226 
228 
229  delete [] fMinCombProb;
230  delete [] fBachelorPLimitsForPID;
231 
233  //for (Int_t ii=0; ii<fNBachelorPBins; ii++)
234  //fMinCombProb[ii]=source.fMinCombProb[ii];
235 
237  //for (Int_t ii=0; ii<fNBachelorPBins; ii++)
238  //fBachelorPLimitsForPID=source.fBachelorPLimitsForPID[ii];
239 
242  //memcpy(fMinCombProb,source.fMinCombProb,source.fNBachelorPBins*sizeof(Float_t));
243  //memcpy(fBachelorPLimitsForPID,source.fBachelorPLimitsForPID,source.fNBachelorPBins*sizeof(Float_t));
244 
246 
247  return *this;
248 }
249 
250 
251 //---------------------------------------------------------------------------
253  //
254  // Default Destructor
255  //
256 
257  if (fV0daughtersCuts) {
258  delete fV0daughtersCuts;
260  }
261 
262  if (fMinCombProbVsLcPt)
263  delete [] fMinCombProbVsLcPt;
264 
265  if (fMinCombProb)
266  delete [] fMinCombProb;
267 
269  delete [] fBachelorPLimitsForPID;
270 
271 }
272 
273 //---------------------------------------------------------------------------
275  //
276  // Fills in vars the values of the variables
277  //
278 
279  if (pdgdaughters[0]==-9999) return; // dummy
280 
281  if (nvars!=fnVarsForOpt) {
282  printf("AliRDHFCutsLctoV0::GetCutVarsForOpt: wrong number of variables\n");
283  return;
284  }
285 
286  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
287  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
288  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
289 
291 
292  // Get the v0 and all daughter tracks
293  AliAODTrack *bachelorTrack = (AliAODTrack*)dd->GetBachelor();
294  AliAODv0 *v0 = (AliAODv0*)dd->Getv0();
295  AliAODTrack *v0positiveTrack = (AliAODTrack*)dd->Getv0PositiveTrack();
296  AliAODTrack *v0negativeTrack = (AliAODTrack*)dd->Getv0NegativeTrack();
297 
298  Int_t iter=-1;
299  // cut on cascade mass, if K0S + p
300  if (fVarsForOpt[0]) {
301  iter++;
302  vars[iter]=TMath::Abs(dd->InvMassLctoK0sP()-mLcPDG);
303  }
304  // cut on cascade mass, if Lambda/LambdaBar + pi
305  if (fVarsForOpt[1]) {
306  iter++;
307  vars[iter]=TMath::Abs(dd->InvMassLctoLambdaPi()-mLcPDG);
308  }
309 
310  // cut on V0 mass if K0S
311  if (fVarsForOpt[2]) {
312  iter++;
313  vars[iter]=TMath::Abs(v0->MassK0Short()-mk0sPDG);
314  }
315 
316  // cut on V0 mass if Lambda/LambdaBar
317  if (fVarsForOpt[3]) {
318 
319  if (bachelorTrack->Charge()==1) {
320  iter++;
321  vars[iter]=TMath::Abs(v0->MassLambda()-mLPDG);
322  } else if (bachelorTrack->Charge()==-1) {
323  iter++;
324  vars[iter]=TMath::Abs(v0->MassAntiLambda()-mLPDG);
325  }
326 
327  }
328 
329  // cut bachelor min pt
330  if (fVarsForOpt[4]) {
331  iter++;
332  vars[iter]=bachelorTrack->Pt();
333  }
334 
335  // cut on V0-positive min pt
336  if (fVarsForOpt[5]) {
337  iter++;
338  vars[iter]=v0positiveTrack->Pt();
339  }
340 
341  // cut on V0-negative min pt
342  if (fVarsForOpt[6]) {
343  iter++;
344  vars[iter]=v0negativeTrack->Pt();
345  }
346 
347  // cut on cascade dca (prong-to-prong)
348  if (fVarsForOpt[7]) {
349  iter++;
350  vars[iter]=dd->GetDCA(); // prong-to-prong cascade DCA
351  }
352 
353  // cut on V0 dca (prong-to-prong)
354  if (fVarsForOpt[8]) {
355  iter++;
356  vars[iter]=v0->GetDCA(); // prong-to-prong V0 DCA
357  }
358 
359  // cut on V0 cosPA wrt PV
360  if (fVarsForOpt[9]) {
361  iter++;
362  vars[iter]=dd->CosV0PointingAngle(); // cosine of V0 pointing angle wrt primary vertex
363  }
364 
365  // cut on bachelor transverse impact parameter wrt PV
366  if (fVarsForOpt[10]) {
367  iter++;
368  vars[iter]=dd->Getd0Prong(0); // bachelor transverse impact parameter wrt primary vertex
369  }
370 
371  // cut on V0 transverse impact parameter wrt PV
372  if (fVarsForOpt[11]) {
373  iter++;
374  vars[iter]=dd->Getd0Prong(1); // V0 transverse impact parameter wrt primary vertex
375  }
376 
377  // cut on K0S invariant mass veto
378  if (fVarsForOpt[12]) {
379  iter++;
380  vars[iter]=TMath::Abs(v0->MassK0Short()-mk0sPDG); // K0S invariant mass veto
381  }
382 
383  // cut on Lambda/LambdaBar invariant mass veto
384  if (fVarsForOpt[13]) {
385 
386  if (bachelorTrack->Charge()==1) {
387  iter++;
388  vars[iter]=TMath::Abs(v0->MassLambda()-mLPDG);
389  } else if (bachelorTrack->Charge()==-1) {
390  iter++;
391  vars[iter]=TMath::Abs(v0->MassAntiLambda()-mLPDG);
392  }
393 
394  }
395 
396  // cut on gamma invariant mass veto
397  if (fVarsForOpt[14]) {
398  iter++;
399  vars[iter]= v0->InvMass2Prongs(0,1,11,11); // gamma invariant mass veto
400  }
401 
402 
403  // cut on V0 pT min
404  if (fVarsForOpt[15]) {
405  iter++;
406  vars[iter]= v0->Pt(); // V0 pT min
407  }
408 
409  // cut on proton emission angle
410  if (fVarsForOpt[16]) {
411  iter++;
412  vars[iter]= GetProtonEmissionAngleCMS(d); //CosPrThetaCMS
413  }
414 
415  // cut on proton emission angle
416  if (fVarsForOpt[17]) {
417  iter++;
418  vars[iter]= GetProtonEmissionAngleCMS(d); //CosPrThetaCMS
419  }
420 
421  // cut on re-signed d0
422  if (fVarsForOpt[18]) {
423  iter++;
424  vars[iter]= -9999;
425  }
426 
427  // cut on Armenteros qT/|alpha|
428  if (fVarsForOpt[19]) {
429  iter++;
430  vars[iter]= v0->PtArmV0()/TMath::Abs(v0->AlphaV0());
431  }
432 
433 
434  return;
435 }
436 //---------------------------------------------------------------------------
438  //
439  // Apply selection
440  //
441 
442  if (!fCutsRD) {
443  AliFatal("Cut matrice not inizialized. Exit...");
444  return 0;
445  }
446 
448  if (!d) {
449  AliDebug(2,"AliAODRecoCascadeHF null");
450  return 0;
451  }
452 
453  Double_t pt=d->Pt();
454  if(pt<fMinPtCand) return 0;
455  if(pt>fMaxPtCand) return 0;
456 
457  if (!d->GetSecondaryVtx()) {
458  AliDebug(2,"No secondary vertex for cascade");
459  return 0;
460  }
461 
462  if (d->GetNDaughters()!=2) {
463  AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",d->GetNDaughters()));
464  return 0;
465  }
466 
467  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
468 
469  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
470  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
471 
472  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
473  if (!v0 || !bachelorTrack) {
474  AliDebug(2,"No V0 or no bachelor for current cascade");
475  return 0;
476  }
477 
478  if (bachelorTrack->GetID()<0) {
479  AliDebug(2,Form("Bachelor has negative ID %d",bachelorTrack->GetID()));
480  return 0;
481  }
482 
483  if (!v0->GetSecondaryVtx()) {
484  AliDebug(2,"No secondary vertex for V0 by cascade");
485  return 0;
486  }
487 
488  if (v0->GetNDaughters()!=2) {
489  AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0->GetOnFlyStatus(),v0->GetNDaughters()));
490  return 0;
491  }
492 
493 
494  // Get the V0 daughter tracks
495  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
496  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
497  if (!v0positiveTrack || !v0negativeTrack ) {
498  AliDebug(2,"No V0 daughters' objects");
499  return 0;
500  }
501 
502  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
503  AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",v0positiveTrack->GetID(),v0negativeTrack->GetID()));
504  return 0;
505  }
506 
507  //if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
508  if ( fUseTrackSelectionWithFilterBits && !(bachelorTrack->TestFilterMask(BIT(4))) ) {
509  AliDebug(2,"Check on the bachelor FilterBit: no BIT(4). Candidate rejected.");
510  return 0;
511  }
512 
513  Int_t returnvalueTrack = 7;
514 
515  // selection on daughter tracks
516  if (selectionLevel==AliRDHFCuts::kAll ||
517  selectionLevel==AliRDHFCuts::kTracks) {
518 
519  if (!AreLctoV0DaughtersSelected(d,aod)) return 0;
520 
521  }
522 
523  Bool_t okLck0sp=kTRUE, okLcLpi=kTRUE, okLcLBarpi=kTRUE;
524 
525  // selection on candidate
526  if (selectionLevel==AliRDHFCuts::kAll ||
527  selectionLevel==AliRDHFCuts::kCandidate) {
528 
529  Double_t pt = d->Pt();
530  Int_t ptbin = PtBin(pt);
531 
532  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
533  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
534  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
535 
536  // K0S + p
537  Double_t mk0s = v0->MassK0Short();
538  Double_t mLck0sp = d->InvMassLctoK0sP();
539 
540  // Lambda + pi
541  Double_t mlambda = v0->MassLambda();
542  Double_t malambda = v0->MassAntiLambda();
543  Double_t mLcLpi = d->InvMassLctoLambdaPi();
544 
545  Bool_t okK0spipi=kTRUE, okLppi=kTRUE, okLBarpip=kTRUE;
546  Bool_t isNotK0S = kTRUE, isNotLambda = kTRUE, isNotLambdaBar = kTRUE, isNotGamma = kTRUE;
547 
548  // cut on Lc mass with K0S+p hypothesis
549  if (TMath::Abs(mLck0sp-mLcPDG) > fCutsRD[GetGlobalIndex(0,ptbin)] && fExcludedCut!=0) {
550  okLck0sp = kFALSE;
551  AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to Lambda_c into K0S+p cut",mLck0sp));
552  }
553 
554  // cuts on the V0 mass: K0S case
555  if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(2,ptbin)] && fExcludedCut!=2) {
556  okK0spipi = kFALSE;
557  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to K0S cut",mk0s));
558  }
559 
560  // cut on Lc mass with Lambda+pi hypothesis
561  if (TMath::Abs(mLcLpi-mLcPDG) > fCutsRD[GetGlobalIndex(1,ptbin)] && fExcludedCut!=1) {
562  okLcLpi = kFALSE;
563  okLcLBarpi = kFALSE;
564  AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to Lambda_c into Lambda+pi cut",mLcLpi));
565  }
566 
567  // cuts on the V0 mass: Lambda/LambdaBar case
568  //if ( !(bachelorTrack->Charge()==+1 && TMath::Abs(mlambda-mLPDG) <= fCutsRD[GetGlobalIndex(3,ptbin)] ) ) {
569  if ( TMath::Abs(mlambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)] && fExcludedCut!=3) {
570  okLppi = kFALSE;
571  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to LambdaBar cut",mlambda));
572  }
573 
574  //if ( !(bachelorTrack->Charge()==-1 && TMath::Abs(malambda-mLPDG) <= fCutsRD[GetGlobalIndex(3,ptbin)] ) ) {
575  if ( TMath::Abs(malambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)] && fExcludedCut!=3) {
576  okLBarpip = kFALSE;
577  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to LambdaBar cut",malambda));
578  }
579 
580  // cut on K0S invariant mass veto
581  if (TMath::Abs(v0->MassK0Short()-mk0sPDG) < fCutsRD[GetGlobalIndex(12,ptbin)] && fExcludedCut!=12) { // K0S invariant mass veto
582  AliDebug(4,Form(" veto on K0S invariant mass doesn't pass the cut"));
583  //return 0;
584  isNotK0S=kFALSE;
585  }
586 
587  // cut on Lambda/LambdaBar invariant mass veto
588  if (TMath::Abs(v0->MassLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) { // Lambda invariant mass veto
589  AliDebug(4,Form(" veto on Lambda invariant mass doesn't pass the cut"));
590  isNotLambda=kFALSE;
591  //return 0;
592  }
593  if (TMath::Abs(v0->MassAntiLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) { // LambdaBar invariant mass veto
594  AliDebug(4,Form(" veto on LambdaBar invariant mass doesn't pass the cut"));
595  isNotLambdaBar=kFALSE;
596  //return 0;
597  }
598 
599  // cut on gamma invariant mass veto
600  if (v0->InvMass2Prongs(0,1,11,11) < fCutsRD[GetGlobalIndex(14,ptbin)] && fExcludedCut!=14) { // K0S invariant mass veto
601  AliDebug(4,Form(" veto on gamma invariant mass doesn't pass the cut"));
602  isNotGamma=kFALSE;
603  //return 0;
604  }
605 
606  okLck0sp = okLck0sp && okK0spipi && isNotLambda && isNotLambdaBar && isNotGamma;
607  okLcLpi = okLcLpi && okLppi && isNotK0S && isNotLambdaBar && isNotGamma;
608  okLcLBarpi = okLcLBarpi && okLBarpip && isNotK0S && isNotLambda && isNotGamma;
609 
610  if (!okLck0sp && !okLcLpi && !okLcLBarpi) return 0;
611 
612  // cuts on the minimum pt of the tracks
613  if (TMath::Abs(bachelorTrack->Pt()) < fCutsRD[GetGlobalIndex(4,ptbin)] && fExcludedCut!=4) {
614  AliDebug(4,Form(" bachelor track Pt=%2.2e > %2.2e",bachelorTrack->Pt(),fCutsRD[GetGlobalIndex(4,ptbin)]));
615  return 0;
616  }
617  if (TMath::Abs(v0positiveTrack->Pt()) < fCutsRD[GetGlobalIndex(5,ptbin)] && fExcludedCut!=5) {
618  AliDebug(4,Form(" V0-positive track Pt=%2.2e > %2.2e",v0positiveTrack->Pt(),fCutsRD[GetGlobalIndex(5,ptbin)]));
619  return 0;
620  }
621  if (TMath::Abs(v0negativeTrack->Pt()) < fCutsRD[GetGlobalIndex(6,ptbin)] && fExcludedCut!=6) {
622  AliDebug(4,Form(" V0-negative track Pt=%2.2e > %2.2e",v0negativeTrack->Pt(),fCutsRD[GetGlobalIndex(6,ptbin)]));
623  return 0;
624  }
625 
626  // cut on cascade dca (prong-to-prong)
627  if ( TMath::Abs(d->GetDCA()) > fCutsRD[GetGlobalIndex(7,ptbin)] && fExcludedCut!=7) { // prong-to-prong cascade DCA
628  AliDebug(4,Form(" cascade tracks DCA don't pass the cut"));
629  return 0;
630  }
631 
632  // cut on V0 dca (prong-to-prong)
633  if ( TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(8,ptbin)] && fExcludedCut!=8) { // prong-to-prong V0 DCA
634  AliDebug(4,Form(" V0 DCA don't pass the cut"));
635  return 0;
636  }
637 
638  // cut on V0 cosine of pointing angle wrt PV
639  if (d->CosV0PointingAngle() < fCutsRD[GetGlobalIndex(9,ptbin)] && fExcludedCut!=9) { // cosine of V0 pointing angle wrt primary vertex
640  AliDebug(4,Form(" V0 cosine of pointing angle doesn't pass the cut"));
641  return 0;
642  }
643 
644  // cut on bachelor transverse impact parameter wrt PV
645  if (TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(10,ptbin)] && fExcludedCut!=10) { // bachelor transverse impact parameter wrt PV
646  AliDebug(4,Form(" bachelor transverse impact parameter doesn't pass the cut"));
647  return 0;
648  }
649 
650  // cut on V0 transverse impact parameter wrt PV
651  if (TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(11,ptbin)] && fExcludedCut!=11) { // V0 transverse impact parameter wrt PV
652  AliDebug(4,Form(" V0 transverse impact parameter doesn't pass the cut"));
653  return 0;
654  }
655 
656  // cut on V0 pT min
657  if (v0->Pt() < fCutsRD[GetGlobalIndex(15,ptbin)] && fExcludedCut!=15) { // V0 pT min
658  AliDebug(4,Form(" V0 track Pt=%2.2e > %2.2e",v0->Pt(),fCutsRD[GetGlobalIndex(15,ptbin)]));
659  return 0;
660  }
661 
662  // cut on Proton emission angle
663  if(TMath::Abs(fCutsRD[GetGlobalIndex(16,ptbin)])<1.1 || TMath::Abs(fCutsRD[GetGlobalIndex(17,ptbin)])<1.1){
665  if (cutvar > fCutsRD[GetGlobalIndex(16,ptbin)] && fExcludedCut!=16 && fExcludedCut!=17) { // Proton emission angle
666  AliDebug(4,Form(" Cos proton emission=%2.2e < %2.2e",cutvar,fCutsRD[GetGlobalIndex(16,ptbin)]));
667  return 0;
668  }
669  if (cutvar < fCutsRD[GetGlobalIndex(17,ptbin)] && fExcludedCut!=16 && fExcludedCut!=17) { // Proton emission angle
670  AliDebug(4,Form(" Cos proton emission=%2.2e > %2.2e",cutvar,fCutsRD[GetGlobalIndex(17,ptbin)]));
671  return 0;
672  }
673  }
674 
675  // cut on proton re-signed d0
676  if(TMath::Abs(fCutsRD[GetGlobalIndex(18,ptbin)])<0.2){
677  Double_t cutvar = GetReSignedd0(d) ;
678  if (cutvar< fCutsRD[GetGlobalIndex(18,ptbin)] && fExcludedCut!=18) { // proton d0
679  AliDebug(4,Form(" Proton d0 (re-signed)=%2.2e > %2.2e",cutvar,fCutsRD[GetGlobalIndex(18,ptbin)]));
680  return 0;
681  }
682  }
683 
684  // cut on Armenteros qT/|alpha|
685  if(TMath::Abs(fCutsRD[GetGlobalIndex(19,ptbin)])<0.3){
686  Double_t cutvar = v0->PtArmV0()/TMath::Abs(v0->AlphaV0());
687  if (cutvar < fCutsRD[GetGlobalIndex(19,ptbin)] && fExcludedCut!=19) { // v0 armenteros variable
688  AliDebug(4,Form(" qT/|alpha|=%2.2e > %2.2e",cutvar,fCutsRD[GetGlobalIndex(19,ptbin)]));
689  return 0;
690  }
691  }
692 
693  }
694 
695  Int_t returnvalue = okLck0sp+2*okLcLBarpi+4*okLcLpi;
696  /*
697  retvalue case
698  1 Lc->K0S + p
699  2 Lc->LambdaBar + pi
700  3 Lc->K0S + p AND Lc->LambdaBar + pi
701  4 Lc->Lambda + pi
702  5 Lc->K0S + p AND Lc->Lambda + pi
703  6 Lc->LambdaBar + pi AND Lc->Lambda + pi
704  7 Lc->K0S + p AND Lc->LambdaBar + pi AND Lc->Lambda + pi
705  */
706 
707  Int_t returnvaluePID = 7;
708 
709  // selection on candidate
710  if (selectionLevel==AliRDHFCuts::kAll ||
711  selectionLevel==AliRDHFCuts::kCandidate ||
712  selectionLevel==AliRDHFCuts::kPID )
713  returnvaluePID = IsSelectedPID(d);
714 
715  //if (fUsePID && returnvaluePID==0) return 0;
716 
717  Int_t returnvalueTot = 0;
718  if ( fUsePID )
719  returnvalueTot = CombineCuts(returnvalueTrack,returnvalue,returnvaluePID);
720  else
721  returnvalueTot = CombineCuts(returnvalueTrack,returnvalue,7);
722 
723  return returnvalueTot;
724 
725 }
726 //---------------------------------------------------------------------------
728  //
729  // Apply pT and PID pre-selections, used before refilling candidate
730  // Note, PID checks only Lc -> pK0s case
731  //
732 
733  if(!fUsePreselect) return 3;
734 
735  Int_t retVal=3;
736 
737  AliAODTrack *track0 = (AliAODTrack*)aodTracks.At(0);
738  AliAODTrack *track1 = (AliAODTrack*)aodTracks.At(1);
739 
740  // calculate pt
741  Double_t px0=track0->Px();
742  Double_t px1=track1->Px();
743 
744  Double_t py0=track0->Py();
745  Double_t py1=track1->Py();
746 
747  Double_t ptD=TMath::Sqrt((px0+px1)*(px0+px1)+(py0+py1)*(py0+py1));
748 
749  if(ptD<fMinPtCand) return 0;
750  if(ptD>fMaxPtCand) return 0;
751 
752  Int_t ptbin=PtBin(ptD);
753  if (ptbin==-1) return 0;
754 
755  // V0 pT min
756  if (track1->Pt() < fCutsRD[GetGlobalIndex(15,ptbin)]) return 0;
757 
758  // bachelor pT min
759  if (track0->Pt() < fCutsRD[GetGlobalIndex(4,ptbin)]) return 0;
760 
761  if(fUsePID){
762  Bool_t okLcK0Sp = kTRUE; // K0S case
763  Bool_t okLcLambdaBarPi = kTRUE; // LambdaBar case
764  Bool_t okLcLambdaPi = kTRUE; // Lambda case
765 
766  CheckPID(track0,0x0,0x0,okLcK0Sp,okLcLambdaBarPi,okLcLambdaPi);
767 
768  retVal = okLcK0Sp;
769  }
770 
771  return retVal;
772 }
773 //---------------------------------------------------------------------------
774 Bool_t AliRDHFCutsLctoV0::PreSelect(TObject* obj, AliAODv0 *v0, AliVTrack *bachelorTrack){
775  //
776  // Apply pre-selections, used in the AOD filtering
777  //
778 
779  if (!fCutsRD) {
780  AliFatal("Cut matrix not inizialized. Exit...");
781  return 0;
782  }
783 
785  if (!d) {
786  AliDebug(2,"AliAODRecoCascadeHF null");
787  return 0;
788  }
789 
790  Double_t pt = d->Pt();
791  Int_t ptbin = PtBin(pt);
792 
793  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
794  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
795 
796  // cut on V0 pT min
797  if (v0->Pt() < fCutsRD[GetGlobalIndex(15,ptbin)]) return 0;
798 
799  // cuts on the minimum pt of the bachelor
800  if (bachelorTrack->Pt() < fCutsRD[GetGlobalIndex(4,ptbin)]) return 0;
801 
802  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
803  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
804  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
805 
806  // K0S + p
807  Double_t mk0s = v0->MassK0Short();
808  Double_t mLck0sp = d->InvMassLctoK0sP();
809 
810  // Lambda + pi
811  Double_t mlambda = v0->MassLambda();
812  Double_t malambda = v0->MassAntiLambda();
813  Double_t mLcLpi = d->InvMassLctoLambdaPi();
814 
815  Bool_t okLck0sp=kTRUE, okLcLpi=kTRUE, okLcLBarpi=kTRUE;
816  Bool_t okK0spipi=kTRUE, okLppi=kTRUE, okLBarpip=kTRUE;
817  Bool_t isNotK0S = kTRUE, isNotLambda = kTRUE, isNotLambdaBar = kTRUE, isNotGamma = kTRUE;
818 
819  // cut on Lc mass with K0S+p hypothesis
820  if (TMath::Abs(mLck0sp-mLcPDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okLck0sp = kFALSE;
821  // cuts on the V0 mass: K0S case
822  if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(2,ptbin)]) okK0spipi = kFALSE;
823  // cut on Lc mass with Lambda+pi hypothesis
824  if (TMath::Abs(mLcLpi-mLcPDG) > fCutsRD[GetGlobalIndex(1,ptbin)]) {
825  okLcLpi = kFALSE;
826  okLcLBarpi = kFALSE;
827  }
828 
829  // cuts on the V0 mass: Lambda/LambdaBar case
830  if ( TMath::Abs(mlambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)]) okLppi = kFALSE;
831  if ( TMath::Abs(malambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)]) okLBarpip = kFALSE;
832 
833  // cut on K0S invariant mass veto
834  if (TMath::Abs(v0->MassK0Short()-mk0sPDG) < fCutsRD[GetGlobalIndex(12,ptbin)]) isNotK0S=kFALSE;
835  // cut on Lambda/LambdaBar invariant mass veto
836  if (TMath::Abs(v0->MassLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)]) isNotLambda=kFALSE;
837  if (TMath::Abs(v0->MassAntiLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)]) isNotLambdaBar=kFALSE;
838 
839  // cut on gamma invariant mass veto
840  if (v0->InvMass2Prongs(0,1,11,11) < fCutsRD[GetGlobalIndex(14,ptbin)]) isNotGamma=kFALSE;
841 
842  okLck0sp = okLck0sp && okK0spipi && isNotLambda && isNotLambdaBar && isNotGamma;
843  okLcLpi = okLcLpi && okLppi && isNotK0S && isNotLambdaBar && isNotGamma;
844  okLcLBarpi = okLcLBarpi && okLBarpip && isNotK0S && isNotLambda && isNotGamma;
845 
846  if (!okLck0sp && !okLcLpi && !okLcLBarpi) return 0;
847 
848 
849  // cut on V0 dca (prong-to-prong)
850  if ( TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
851 
852 
853  return kTRUE;
854 
855 }
856 //---------------------------------------------------------------------------
858 
859  // fPidHF -> PID object for bachelor
860 
861  if (!fUsePID || !obj) {
862  AliDebug(2,"PID selection inactive. Candidate accepted.");
863  return 7; // all hypothesis are valid
864  }
865 
867 
868  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(objD->Getv0());
869  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
870  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
871 
872  AliAODTrack *bachelor = (AliAODTrack*)objD->GetBachelor();
873  AliAODTrack *v0Pos = (AliAODTrack*)objD->Getv0PositiveTrack();
874  AliAODTrack *v0Neg = (AliAODTrack*)objD->Getv0NegativeTrack();
875 
876  if (!bachelor || !v0Pos || !v0Neg) return 0;
877 
878  Bool_t okLcK0Sp = kTRUE; // K0S case
879  Bool_t okLcLambdaBarPi = kTRUE; // LambdaBar case
880  Bool_t okLcLambdaPi = kTRUE; // Lambda case
881 
882  CheckPID(bachelor,v0Neg,v0Pos,okLcK0Sp,okLcLambdaBarPi,okLcLambdaPi);
883 
884  Int_t returnvalue = okLcK0Sp+2*okLcLambdaBarPi+4*okLcLambdaPi;
885 
886  return returnvalue;
887 }
888 //-----------------------
889 void AliRDHFCutsLctoV0::CheckPID(AliAODTrack *bachelor,
890  AliAODTrack * /*v0Neg*/, AliAODTrack * /*v0Pos*/,
891  Bool_t &isBachelorID1, Bool_t &isBachelorID2, Bool_t &isBachelorID4) {
892  // identification strategy
893 
894  Int_t idxIDbyTOF = -1;
895  Int_t idxIDbyTPC = -1;
896 
897  Int_t tpcID = -1;
898  Int_t tofID = -1;
899  Double_t nTPCsigmas = -999;
900  Double_t nTOFsigmas = -999;
901 
902  Bool_t trackIDByTOF = -1;
903  Bool_t trackIDByTPC = -1;
904 
905  Bool_t dummy = kFALSE;
906 
907  Int_t isProton = -1;
908  Int_t isPion = -1;
909 
910  switch (fPidSelectionFlag) {
911 
912  case 0:
913 
914  // identify bachelor
915  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,4);
916  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,4);
917  isBachelorID1 = (idxIDbyTOF==4) && (idxIDbyTPC==4); // K0S case
918 
919  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,2);
920  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,2);
921  isBachelorID2 = (idxIDbyTOF==2) && (idxIDbyTPC==2); // LambdaBar case
922 
923  isBachelorID4 = isBachelorID2; // Lambda case
924 
925  break;
926 
927  case 1:
928 
929  // identify bachelor
930  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,4);
931  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,4);
932  dummy = ( !(fPidHF->CheckTOFPIDStatus(bachelor)) && (idxIDbyTPC==4) &&
933  fPidHF->IsExcluded(bachelor,2,2.,"TPC") && fPidHF->IsExcluded(bachelor,3,2.,"TPC") ); // K0S case
934  isBachelorID1 = ( (idxIDbyTOF==4) || dummy );
935 
936  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,2);
937  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,2);
938  dummy = ( !(fPidHF->CheckTOFPIDStatus(bachelor)) && (idxIDbyTPC==2) &&
939  fPidHF->IsExcluded(bachelor,3,2.,"TPC") && fPidHF->IsExcluded(bachelor,4,2.,"TPC") ); // LambdaBar case
940  isBachelorID2 = ( (idxIDbyTOF==2) || dummy );
941 
942  isBachelorID4 = isBachelorID2; // Lambda case
943 
944  break;
945 
946  case 2:
947 
948  // identify bachelor
949  nTOFsigmas = -999;
950  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
951  nTPCsigmas = -999;
952  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,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) ||
956  (bachelor->P()>=fLowPtCut && TMath::Abs(nTPCsigmas)<3) ) );
957  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // K0S case
958 
959  nTOFsigmas = -999;
960  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
961  nTPCsigmas = -999;
962  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
963  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
964  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
965  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
966  (bachelor->P()>=fLowPtCut && TMath::Abs(nTPCsigmas)<3) ) );
967  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // LambdaBar case
968 
969  isBachelorID4 = isBachelorID2; // Lambda case
970 
971  break;
972 
973  case 3:
974 
975  // identify bachelor
976  nTOFsigmas = -999;
977  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
978  nTPCsigmas = -999;
979  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
980  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
981  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
982  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
983  (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTPCsigmas)<3) ||
984  (bachelor->P()>=fHighPtCut && nTPCsigmas>-3 && nTPCsigmas<2) ) );
985  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // K0S case
986 
987  nTOFsigmas = -999;
988  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
989  nTPCsigmas = -999;
990  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
991  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
992  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
993  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
994  (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTPCsigmas)<3) ||
995  (bachelor->P()>=fHighPtCut && nTPCsigmas>-3 && nTPCsigmas<2) ) );
996  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // LambdaBar case
997 
998  isBachelorID4 = isBachelorID2; // Lambda case
999 
1000  break;
1001 
1002  case 4:
1003 
1004  // identify bachelor
1005  nTOFsigmas = -999;
1006  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
1007  nTPCsigmas = -999;
1008  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
1009  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
1010  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
1011  trackIDByTPC = ( (tpcID==1) && (TMath::Abs(nTPCsigmas)<2) );
1012  isBachelorID1 = ( (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTOF) ); // K0S case
1013 
1014  nTOFsigmas = -999;
1015  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
1016  nTPCsigmas = -999;
1017  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
1018  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
1019  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
1020  trackIDByTPC = ( (tpcID==1) && (TMath::Abs(nTPCsigmas)<2) );
1021  isBachelorID2 = ( (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTOF) ); // LambdaBar case
1022 
1023  isBachelorID4 = isBachelorID2; // Lambda case
1024 
1025  break;
1026 
1027  case 5:
1028 
1029  // identify bachelor
1030  nTOFsigmas = -999;
1031  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
1032  nTPCsigmas = -999;
1033  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
1034  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
1035  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
1036  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
1037  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
1038 
1039  nTOFsigmas = -999;
1040  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
1041  nTPCsigmas = -999;
1042  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
1043  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
1044  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
1045  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
1046  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
1047 
1048  isBachelorID4 = isBachelorID2; // Lambda case
1049 
1050  break;
1051 
1052  case 6:
1053 
1054  // identify bachelor
1055  nTOFsigmas = -999;
1056  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
1057  nTPCsigmas = -999;
1058  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
1059  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
1060  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
1061  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
1062  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
1063 
1064  nTOFsigmas = -999;
1065  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
1066  nTPCsigmas = -999;
1067  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
1068  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
1069  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
1070  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
1071  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
1072 
1073  isBachelorID4 = isBachelorID2; // Lambda case
1074 
1075  break;
1076 
1077  case 7:
1078 
1079  // identify bachelor
1080  nTOFsigmas = -999;
1081  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
1082  nTPCsigmas = -999;
1083  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
1084  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
1085  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
1086  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fLowPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
1087  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
1088 
1089  nTOFsigmas = -999;
1090  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
1091  nTPCsigmas = -999;
1092  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
1093  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
1094  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
1095  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
1096  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
1097 
1098  isBachelorID4 = isBachelorID2; // Lambda case
1099 
1100  break;
1101 
1102  case 8:
1103 
1104  // identify bachelor
1105  nTOFsigmas = -999;
1106  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
1107  nTPCsigmas = -999;
1108  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
1109  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
1110  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
1111  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fLowPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
1112  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
1113 
1114  nTOFsigmas = -999;
1115  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
1116  nTPCsigmas = -999;
1117  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
1118  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
1119  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
1120  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
1121  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
1122 
1123  isBachelorID4 = isBachelorID2; // Lambda case
1124 
1125  break;
1126 
1127  case 9:
1128  {
1129  // identify bachelor
1130  fPidHF->GetPidCombined()->SetDefaultTPCPriors();
1131  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
1132  Double_t probTPCTOF[AliPID::kSPECIES]={-1.};
1133  UInt_t detUsed = fPidHF->GetPidCombined()->ComputeProbabilities(bachelor, fPidHF->GetPidResponse(), probTPCTOF);
1134  Double_t probProton = -1.;
1135  Double_t probPion = -1.;
1136  if (detUsed == (UInt_t)fPidHF->GetPidCombined()->GetDetectorMask() ) {
1137  probProton = probTPCTOF[AliPID::kProton];
1138  probPion = probTPCTOF[AliPID::kPion];
1139  }
1140  else { // if you don't have both TOF and TPC, try only TPC
1141  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
1142  detUsed = fPidHF->GetPidCombined()->ComputeProbabilities(bachelor, fPidHF->GetPidResponse(), probTPCTOF);
1143  if (detUsed == (UInt_t)fPidHF->GetPidCombined()->GetDetectorMask()) {
1144  probProton = probTPCTOF[AliPID::kProton];
1145  probPion = probTPCTOF[AliPID::kPion];
1146  }
1147  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
1148  }
1149 
1150  Double_t pBachelor = bachelor->P();
1151  Int_t bachelorPBin = GetBachelorPBin(pBachelor);
1152  if (bachelorPBin==-1) {
1153  nTPCsigmas = -999;
1154  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
1155  isBachelorID1=TMath::Abs(nTPCsigmas)<fNTPCSigmaCutForPreselection; // K0S case
1156  nTPCsigmas = -999;
1157  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
1158  isBachelorID2=TMath::Abs(nTPCsigmas)<fNTPCSigmaCutForPreselection; // LambdaBar case
1159  } else {
1160  nTPCsigmas = -999;
1161  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
1162  isBachelorID1=(TMath::Abs(nTPCsigmas)<fNTPCSigmaCutForPreselection && probProton>fMinCombProb[bachelorPBin]); // K0S case
1163  nTPCsigmas = -999;
1164  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
1165  isBachelorID2=(TMath::Abs(nTPCsigmas)<fNTPCSigmaCutForPreselection && probPion>fMinCombProb[bachelorPBin]); // LambdaBar case
1166  }
1167  isBachelorID4 = isBachelorID2; // Lambda case
1168  }
1169  break;
1170 
1171  case 10:
1172 
1173  // identify bachelor
1174  nTOFsigmas = -999;
1175  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
1176  nTPCsigmas = -999;
1177  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
1178 
1179  isBachelorID1 = kFALSE;
1180  if((tpcID==1)&&(tofID==1)&&(TMath::Abs(nTPCsigmas)<3.)&&(TMath::Abs(nTOFsigmas)<3.)){
1181  isBachelorID1 = !(bachelor->Pt()>fLowPtCut&& nTOFsigmas<-2.) && !(bachelor->Pt()>fLowPtCut&& nTPCsigmas>2.);
1182  }
1183 
1184  nTOFsigmas = -999;
1185  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
1186  nTPCsigmas = -999;
1187  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
1188 
1189  isBachelorID2 = TMath::Abs(nTPCsigmas)<3. && TMath::Abs(nTOFsigmas)<3. && (tpcID==1)&&(tofID==1);
1190  isBachelorID4 = isBachelorID2;
1191 
1192  break;
1193 
1194  case 11:
1195  isProton = fPidHF->MakeRawPid(bachelor, AliPID::kProton);
1196  isPion = fPidHF->MakeRawPid(bachelor, AliPID::kPion);
1197  if (isProton<0) isBachelorID1 = kFALSE;
1198  else isBachelorID1 = kTRUE;
1199  if (isPion<0) isBachelorID2 = kFALSE;
1200  else isBachelorID2 = kTRUE;
1201  isBachelorID4 = isBachelorID2;
1202  break;
1203 
1204  case 12:
1205 
1206  // identify bachelor with an N-sigma cut - TOF required
1207  nTOFsigmas = -999;
1208  tofID = fPidHF->GetnSigmaTOF(bachelor, 4, nTOFsigmas);
1209  nTPCsigmas = -999;
1210  tpcID = fPidHF->GetnSigmaTPC(bachelor, 4, nTPCsigmas);
1211 
1212  isBachelorID1 = TMath::Abs(nTPCsigmas) < 3. && TMath::Abs(nTOFsigmas) < 3. && (tpcID == 1) && (tofID == 1);
1213 
1214  nTOFsigmas = -999;
1215  tofID = fPidHF->GetnSigmaTOF(bachelor, 2, nTOFsigmas);
1216  nTPCsigmas = -999;
1217  tpcID = fPidHF->GetnSigmaTPC(bachelor, 2, nTPCsigmas);
1218 
1219  isBachelorID2 = TMath::Abs(nTPCsigmas) < 3. && TMath::Abs(nTOFsigmas) < 3. && (tpcID == 1) && (tofID == 1);
1220  isBachelorID4 = isBachelorID2;
1221 
1222  break;
1223 
1224  case 13:
1225 
1226  // identify bachelor with an N-sigma cut - TOF required when available
1227  nTOFsigmas = -999;
1228  tofID = fPidHF->GetnSigmaTOF(bachelor, 4, nTOFsigmas);
1229  nTPCsigmas = -999;
1230  tpcID = fPidHF->GetnSigmaTPC(bachelor, 4, nTPCsigmas);
1231 
1232  isBachelorID1 = (tpcID == 1) && (TMath::Abs(nTPCsigmas) < 3.) && ((tofID == 1 && TMath::Abs(nTOFsigmas) < 3.) || tofID == -1);
1233 
1234  nTOFsigmas = -999;
1235  tofID = fPidHF->GetnSigmaTOF(bachelor, 2, nTOFsigmas);
1236  nTPCsigmas = -999;
1237  tpcID = fPidHF->GetnSigmaTPC(bachelor, 2, nTPCsigmas);
1238 
1239  isBachelorID2 = (tpcID == 1) && (TMath::Abs(nTPCsigmas) < 3.) && ((tofID == 1 && TMath::Abs(nTOFsigmas) < 3.) || tofID == -1);
1240  isBachelorID4 = isBachelorID2;
1241 
1242  break;
1243 
1244  }
1245 
1246 }
1247 //----------------
1248 Int_t AliRDHFCutsLctoV0::CombineCuts(Int_t returnvalueTrack, Int_t returnvalue, Int_t returnvaluePID) const {
1249  //
1250  // combine track selection, topological cuts and PID
1251  //
1252 
1253  Int_t returnvalueTot=returnvalueTrack&returnvalue;
1254  returnvalueTot=returnvalueTot&returnvaluePID;
1255 
1256  return returnvalueTot;
1257 }
1258 
1259 //----------------------------------
1261  //
1262  // Apply selection on single cut
1263  //
1264 
1265  if (!fCutsRD) {
1266  AliDebug(2,"Cut matrice not inizialized. Exit...");
1267  return 0;
1268  }
1269 
1271  if (!d) {
1272  AliDebug(2,"AliAODRecoCascadeHF null");
1273  return 0;
1274  }
1275 
1276  if (!d->GetSecondaryVtx()) {
1277  AliDebug(2,"No secondary vertex for cascade");
1278  return 0;
1279  }
1280 
1281  if (d->GetNDaughters()!=2) {
1282  AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",d->GetNDaughters()));
1283  return 0;
1284  }
1285 
1286  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
1287  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
1288  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
1289 
1290  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
1291  if (!v0 || !bachelorTrack) {
1292  AliDebug(2,"No V0 or no bachelor for current cascade");
1293  return 0;
1294  }
1295 
1296  if (bachelorTrack->GetID()<0) {
1297  AliDebug(2,Form("Bachelor has negative ID %d",bachelorTrack->GetID()));
1298  return 0;
1299  }
1300 
1301  if (!v0->GetSecondaryVtx()) {
1302  AliDebug(2,"No secondary vertex for V0 by cascade");
1303  return 0;
1304  }
1305 
1306  if (v0->GetNDaughters()!=2) {
1307  AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0->GetOnFlyStatus(),v0->GetNDaughters()));
1308  return 0;
1309  }
1310 
1311 
1312  // Get the V0 daughter tracks
1313  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
1314  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
1315  if (!v0positiveTrack || !v0negativeTrack ) {
1316  AliDebug(2,"No V0 daughters' objects");
1317  return 0;
1318  }
1319 
1320  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
1321  AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",v0positiveTrack->GetID(),v0negativeTrack->GetID()));
1322  return 0;
1323  }
1324 
1325  //if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
1326  if ( fUseTrackSelectionWithFilterBits && !(bachelorTrack->TestFilterMask(BIT(4))) ) {
1327  AliDebug(2,"Check on the bachelor FilterBit: no BIT(4). Candidate rejected.");
1328  return 0;
1329  }
1330 
1331 
1332  // selection on daughter tracks
1333  if (selectionLevel==AliRDHFCuts::kAll ||
1334  selectionLevel==AliRDHFCuts::kTracks) {
1335 
1336  if (!AreLctoV0DaughtersSelected(d,aod)) return 0;
1337 
1338  }
1339 
1340  Bool_t okLck0sp=kFALSE, okLcLpi=kFALSE, okLcLBarpi=kFALSE;
1341 
1342  // selection on candidate
1343  if (selectionLevel==AliRDHFCuts::kAll ||
1344  selectionLevel==AliRDHFCuts::kCandidate) {
1345 
1346  Double_t pt = d->Pt();
1347  Int_t ptbin = PtBin(pt);
1348 
1349  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
1350  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
1351  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
1352 
1353  // K0S + p
1354  Double_t mk0s = v0->MassK0Short();
1355  Double_t mLck0sp = d->InvMassLctoK0sP();
1356 
1357  // Lambda + pi
1358  Double_t mlambda = v0->MassLambda();
1359  Double_t malambda = v0->MassAntiLambda();
1360  Double_t mLcLpi = d->InvMassLctoLambdaPi();
1361 
1362  switch (cutIndex) {
1363  case 0:
1364  // cut on Lc mass with K0S+p hypothesis
1365  okLck0sp = TMath::Abs(mLck0sp-mLcPDG)<=fCutsRD[GetGlobalIndex(0,ptbin)];
1366  okLcLpi = kFALSE;
1367  okLcLBarpi = kFALSE;
1368  break;
1369  case 1:
1370  // cut on Lc mass with Lambda+pi hypothesis
1371  okLck0sp = kFALSE;
1372  okLcLpi = TMath::Abs(mLcLpi-mLcPDG)<=fCutsRD[GetGlobalIndex(1,ptbin)];
1373  okLcLBarpi = okLcLpi;
1374  break;
1375  case 2:
1376  // cuts on the V0 mass: K0S case
1377  okLck0sp = TMath::Abs(mk0s-mk0sPDG)<=fCutsRD[GetGlobalIndex(2,ptbin)];
1378  okLcLpi = kFALSE;
1379  okLcLBarpi = kFALSE;
1380  break;
1381  case 3:
1382  // cuts on the V0 mass: Lambda/LambdaBar case
1383  okLck0sp = kFALSE;
1384  okLcLpi = TMath::Abs(mlambda-mLPDG)<=fCutsRD[GetGlobalIndex(3,ptbin)];
1385  //okLcLpi = okLcLpi && (bachelorTrack->Charge()==+1);
1386  okLcLBarpi = TMath::Abs(malambda-mLPDG)<=fCutsRD[GetGlobalIndex(3,ptbin)];
1387  //okLcLBarpi = okLcLBarpi && (bachelorTrack->Charge()==-1);
1388  break;
1389  case 4:
1390  // cuts on the minimum pt of bachelor
1391  okLck0sp = TMath::Abs(bachelorTrack->Pt())>=fCutsRD[GetGlobalIndex(4,ptbin)];
1392  okLcLpi = okLck0sp;
1393  okLcLBarpi = okLck0sp;
1394  break;
1395  case 5:
1396  // cuts on the minimum pt of positive V0daughter
1397  okLck0sp = TMath::Abs(v0positiveTrack->Pt())>=fCutsRD[GetGlobalIndex(5,ptbin)];
1398  okLcLpi = okLck0sp;
1399  okLcLBarpi = okLck0sp;
1400  break;
1401  case 6:
1402  // cuts on the minimum pt of negative V0daughter
1403  okLck0sp = TMath::Abs(v0negativeTrack->Pt())>=fCutsRD[GetGlobalIndex(6,ptbin)];
1404  okLcLpi = okLck0sp;
1405  okLcLBarpi = okLck0sp;
1406  break;
1407  case 7:
1408  // cut on cascade dca
1409  okLck0sp = TMath::Abs(d->GetDCA())<=fCutsRD[GetGlobalIndex(7,ptbin)];
1410  okLcLpi = okLck0sp;
1411  okLcLBarpi = okLck0sp;
1412  break;
1413  case 8:
1414  // cut on V0 dca
1415  okLck0sp = TMath::Abs(v0->GetDCA())<=fCutsRD[GetGlobalIndex(8,ptbin)];
1416  okLcLpi = okLck0sp;
1417  okLcLBarpi = okLck0sp;
1418  break;
1419  case 9:
1420  // cut on V0 cosine of pointing angle wrt PV
1421  okLck0sp = d->CosV0PointingAngle()>=fCutsRD[GetGlobalIndex(9,ptbin)];
1422  okLcLpi = okLck0sp;
1423  okLcLBarpi = okLck0sp;
1424  break;
1425  case 10:
1426  // cut on bachelor transverse impact parameter wrt PV
1427  okLck0sp = TMath::Abs(d->Getd0Prong(0))<=fCutsRD[GetGlobalIndex(10,ptbin)];
1428  okLcLpi = okLck0sp;
1429  okLcLBarpi = okLck0sp;
1430  break;
1431  case 11:
1432  // cut on V0 transverse impact parameter wrt PV
1433  okLck0sp = TMath::Abs(d->Getd0Prong(1))<=fCutsRD[GetGlobalIndex(11,ptbin)];
1434  okLcLpi = okLck0sp;
1435  okLcLBarpi = okLck0sp;
1436  break;
1437  case 12:
1438  // cut on K0S invariant mass veto
1439  okLcLpi = TMath::Abs(mk0s-mk0sPDG)>=fCutsRD[GetGlobalIndex(12,ptbin)];
1440  okLcLBarpi = TMath::Abs(mk0s-mk0sPDG)>=fCutsRD[GetGlobalIndex(12,ptbin)];
1441  break;
1442  case 13:
1443  // cut on Lambda/LambdaBar invariant mass veto
1444  okLck0sp = (TMath::Abs(mlambda-mLPDG)>=fCutsRD[GetGlobalIndex(13,ptbin)] &&
1445  TMath::Abs(malambda-mLPDG)>=fCutsRD[GetGlobalIndex(13,ptbin)]);
1446  break;
1447  case 14:
1448  // cut on gamma invariant mass veto
1449  okLck0sp = v0->InvMass2Prongs(0,1,11,11)>=fCutsRD[GetGlobalIndex(14,ptbin)];
1450  okLcLpi = okLck0sp;
1451  okLcLBarpi = okLck0sp;
1452  break;
1453  case 15:
1454  // cut on V0 pT min
1455  okLck0sp = v0->Pt()>=fCutsRD[GetGlobalIndex(15,ptbin)];
1456  okLcLpi = okLck0sp;
1457  okLcLBarpi = okLck0sp;
1458  break;
1459  case 16:
1460  okLck0sp = (TMath::Abs(fCutsRD[GetGlobalIndex(16,ptbin)])<1.1)&&(GetProtonEmissionAngleCMS(d)<= fCutsRD[GetGlobalIndex(16,ptbin)]);
1461  okLcLpi = okLck0sp;
1462  okLcLBarpi = okLck0sp;
1463  break;
1464  case 17:
1465  okLck0sp = (TMath::Abs(fCutsRD[GetGlobalIndex(17,ptbin)])<1.1)&&(GetProtonEmissionAngleCMS(d)>= fCutsRD[GetGlobalIndex(17,ptbin)]);
1466  okLcLpi = okLck0sp;
1467  okLcLBarpi = okLck0sp;
1468  break;
1469  case 18:
1470  okLck0sp = (TMath::Abs(fCutsRD[GetGlobalIndex(18,ptbin)])<0.2)&&(GetReSignedd0(d)>= fCutsRD[GetGlobalIndex(18,ptbin)]);
1471  okLcLpi = okLck0sp;
1472  okLcLBarpi = okLck0sp;
1473  break;
1474  case 19:
1475  okLck0sp = (TMath::Abs(fCutsRD[GetGlobalIndex(19,ptbin)])<0.3)&&(v0->PtArmV0()/TMath::Abs(v0->AlphaV0()) >= fCutsRD[GetGlobalIndex(19,ptbin)]);
1476  okLcLpi = okLck0sp;
1477  okLcLBarpi = okLck0sp;
1478  break;
1479  }
1480  }
1481 
1482  Int_t returnvalue = okLck0sp+2*okLcLBarpi+4*okLcLpi;
1483  /*
1484  retvalue case
1485  1 Lc->K0S + p
1486  2 Lc->LambdaBar + pi
1487  3 Lc->K0S + p AND Lc->LambdaBar + pi
1488  4 Lc->Lambda + pi
1489  5 Lc->K0S + p AND Lc->Lambda + pi
1490  6 Lc->LambdaBar + pi AND Lc->Lambda + pi
1491  7 Lc->K0S + p AND Lc->LambdaBar + pi AND Lc->Lambda + pi
1492  */
1493 
1494 
1495  /*
1496  Int_t returnvaluePID = 7;
1497 
1498  // selection on PID
1499  if (selectionLevel==AliRDHFCuts::kAll ||
1500  selectionLevel==AliRDHFCuts::kCandidate ||
1501  selectionLevel==AliRDHFCuts::kPID )
1502  returnvaluePID = IsSelectedPID(d);
1503  */
1504 
1505  Int_t returnvalueTot = 0;
1506  //if ( fUsePID )
1507  //returnvalueTot = CombineCuts(returnvalue,returnvaluePID);
1508  //else
1509  returnvalueTot = returnvalue;
1510 
1511  return returnvalueTot;
1512 
1513 }
1514 //----------------------------------
1516 
1517  SetName("LctoV0ProductionCuts");
1518  SetTitle("Production cuts for Lc->V0+bachelor analysis");
1519 
1520  AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
1521  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1522  //default
1523  esdTrackCuts->SetRequireTPCRefit(kTRUE);
1524  esdTrackCuts->SetRequireITSRefit(kTRUE);
1525  esdTrackCuts->SetMinNClustersITS(0);//(4); // default is 5
1526  esdTrackCuts->SetMinNClustersTPC(70);
1527  //esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1528  // AliESDtrackCuts::kAny);
1529  // default is kBoth, otherwise kAny
1530  esdTrackCuts->SetMinDCAToVertexXY(0.);
1531  esdTrackCuts->SetPtRange(0.3,1.e10);
1532  //esdTrackCuts->SetEtaRange(-0.8,+0.8);
1533  esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
1534  AddTrackCuts(esdTrackCuts);
1535  delete esdTrackCuts;
1536  esdTrackCuts=NULL;
1537 
1538 
1539  AliESDtrackCuts* esdTrackCutsV0daughters=new AliESDtrackCuts();
1540  esdTrackCutsV0daughters->SetRequireSigmaToVertex(kFALSE);
1541  //default
1542  esdTrackCutsV0daughters->SetRequireTPCRefit(kTRUE);
1543  esdTrackCutsV0daughters->SetRequireITSRefit(kFALSE);//(kTRUE);
1544  esdTrackCutsV0daughters->SetMinNClustersITS(0);//(4); // default is 5
1545  esdTrackCutsV0daughters->SetMinNClustersTPC(70);
1546  //esdTrackCutsV0daughters->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1547  // AliESDtrackCuts::kAny);
1548  // default is kBoth, otherwise kAny
1549  esdTrackCutsV0daughters->SetMinDCAToVertexXY(0.);
1550  esdTrackCutsV0daughters->SetPtRange(0.,1.e10);
1551  esdTrackCutsV0daughters->SetAcceptKinkDaughters(kFALSE);
1552  AddTrackCutsV0daughters(esdTrackCutsV0daughters);
1553  delete esdTrackCutsV0daughters;
1554  esdTrackCutsV0daughters=NULL;
1555 
1556  const Int_t nptbins=1;
1557  Float_t* ptbins;
1558  ptbins=new Float_t[nptbins+1];
1559  ptbins[0]=0.;
1560  ptbins[1]=99999999.;
1561 
1562  SetPtBins(nptbins+1,ptbins);
1563  SetPtBins(nptbins+1,ptbins);
1564 
1565  const Int_t nvars=21;
1566 
1567  Float_t** prodcutsval;
1568  prodcutsval=new Float_t*[nvars];
1569  for(Int_t ic=0;ic<nvars;ic++){prodcutsval[ic]=new Float_t[nptbins];}
1570  for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
1571  prodcutsval[0][ipt2]=1.; // inv. mass if K0S [GeV/c2]
1572  prodcutsval[1][ipt2]=1.; // inv. mass if Lambda [GeV/c2]
1573  prodcutsval[2][ipt2]=0.05; // inv. mass V0 if K0S [GeV/c2]
1574  prodcutsval[3][ipt2]=0.05; // inv. mass V0 if Lambda [GeV/c2]
1575  prodcutsval[4][ipt2]=0.3; // pT min bachelor track [GeV/c] // AOD by construction
1576  prodcutsval[5][ipt2]=0.; // pT min V0-positive track [GeV/c]
1577  prodcutsval[6][ipt2]=0.; // pT min V0-negative track [GeV/c]
1578  prodcutsval[7][ipt2]=1000.; // dca cascade cut [cm]
1579  prodcutsval[8][ipt2]=1.5; // dca V0 cut [nSigma] // it's 1.5 x offline V0s
1580  prodcutsval[9][ipt2]=-1.; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
1581  prodcutsval[10][ipt2]=3.; // d0 max bachelor wrt PV [cm]
1582  prodcutsval[11][ipt2]=1000.;// d0 max V0 wrt PV [cm]
1583  prodcutsval[12][ipt2]=0.; // mass K0S veto [GeV/c2]
1584  prodcutsval[13][ipt2]=0.; // mass Lambda/LambdaBar veto [GeV/c2]
1585  prodcutsval[14][ipt2]=0.; // mass Gamma veto [GeV/c2]
1586  prodcutsval[15][ipt2]=0.; // pT min V0 track [GeV/c]
1587  prodcutsval[16][ipt2]=9999.;// max cos (Proton emission angle) cut
1588  prodcutsval[17][ipt2]=-9999.;// min cos (Proton emission angle) cut
1589  prodcutsval[18][ipt2]=-9999.;// Re-signed d0 [cm]
1590  prodcutsval[19][ipt2]=-9999.;// V0 armenteros qT/|alpha|
1591  prodcutsval[20][ipt2]=0.; // V0 type cut
1592  }
1593  SetCuts(nvars,nptbins,prodcutsval);
1594 
1595  SetGlobalIndex(nvars,nptbins);
1596  SetPtBins(nptbins+1,ptbins);
1597 
1598 
1599  //pid settings
1600  //1. bachelor: default one
1601  AliAODPidHF* pidObjBachelor = new AliAODPidHF();
1602  Double_t sigmasBac[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
1603  pidObjBachelor->SetSigma(sigmasBac);
1604  pidObjBachelor->SetAsym(kFALSE);
1605  pidObjBachelor->SetMatch(1);
1606  pidObjBachelor->SetTPC(kTRUE);
1607  pidObjBachelor->SetTOF(kTRUE);
1608  pidObjBachelor->SetTOFdecide(kFALSE);
1609  SetPidHF(pidObjBachelor);
1610 
1611  SetUsePID(kFALSE);//(kTRUE);
1612 
1613  //PrintAll();
1614 
1615  for(Int_t iiv=0;iiv<nvars;iiv++){
1616  delete [] prodcutsval[iiv];
1617  }
1618  delete [] prodcutsval;
1619  prodcutsval=NULL;
1620  delete [] ptbins;
1621  ptbins=NULL;
1622 
1623 
1624  delete pidObjBachelor;
1625  pidObjBachelor=NULL;
1626 
1627  return;
1628 }
1629 //------------------
1631 
1632  SetName("LctoV0ProductionCuts");
1633  SetTitle("Production cuts for Lc->V0+bachelor analysis");
1634 
1636 
1637  return;
1638 }
1639 //------------------
1641 
1642  // Default 2010 PbPb cut object
1644 
1645  //
1646  // Enable all 2011 PbPb run triggers
1647  //
1648  SetTriggerClass("");
1652 
1653 }
1654 //-----------------------
1656 
1657  const Int_t nvars = this->GetNVars() ;
1658  //Float_t *vArray =GetCuts();
1659  //fV0Type = vArray[nvars-1];
1660  fV0Type = (this->GetCuts())[nvars-1];
1661  //this->GetCuts(vArray);
1662  TString *sVarNames=GetVarNames();
1663 
1664  if(sVarNames[nvars-1].Contains("V0 type")) return (Int_t)fV0Type;
1665  else {AliInfo("AliRDHFCutsLctoV0 Last variable is not the V0 type!!!"); return -999;}
1666 }
1667 
1668 //---------------------------------------------------------------------------
1670  //
1671  // print all cuts values
1672  //
1673 
1674  printf("Minimum vtx type %d\n",fMinVtxType);
1675  printf("Minimum vtx contr %d\n",fMinVtxContr);
1676  printf("Max vtx red chi2 %f\n",fMaxVtxRedChi2);
1677  printf("Min SPD mult %d\n",fMinSPDMultiplicity);
1678  printf("Use PID %d (PID selection flag = %d) OldPid=%d\n",(Int_t)fUsePID,(Int_t)fPidSelectionFlag,fPidHF ? fPidHF->GetOldPid() : -1);
1679  printf("High value for pT %f\n",fHighPtCut);
1680  printf("Low and high values for pT cuts: %f %f\n",fLowPtCut,fHighPtCut);
1681  printf("Remove daughters from vtx %d\n",(Int_t)fRemoveDaughtersFromPrimary);
1682  printf("Physics selection: %s\n",fUsePhysicsSelection ? "Yes" : "No");
1683  printf("Pileup rejection: %s\n",(fOptPileup > 0) ? "Yes" : "No");
1684  printf("UseTrackSelectionWithFilterBits: %s\n",fUseTrackSelectionWithFilterBits ? "Yes" : "No");
1685  printf("Reject kink: %s\n",fKinkReject ? "Yes" : "No");
1686  if(fOptPileup==1) printf(" -- Reject pileup event");
1687  if(fOptPileup==2) printf(" -- Reject tracks from pileup vtx");
1688  if(fUseCentrality>0) {
1689  TString estimator="";
1690  if(fUseCentrality==1) estimator = "V0";
1691  if(fUseCentrality==2) estimator = "Tracks";
1692  if(fUseCentrality==3) estimator = "Tracklets";
1693  if(fUseCentrality==4) estimator = "SPD clusters outer";
1694  printf("Centrality class considered: %.1f-%.1f, estimated with %s",fMinCentrality,fMaxCentrality,estimator.Data());
1695  }
1696  if(fIsCandTrackSPDFirst) printf("Check for candidates with pt < %2.2f, that daughters fullfill kFirst criteria\n",fMaxPtCandTrackSPDFirst);
1697 
1698  if(fVarNames){
1699  cout<<"Array of variables"<<endl;
1700  for(Int_t iv=0;iv<fnVars;iv++){
1701  cout<<fVarNames[iv]<<"\t";
1702  }
1703  cout<<endl;
1704  }
1705  if(fVarsForOpt){
1706  cout<<"Array of optimization"<<endl;
1707  for(Int_t iv=0;iv<fnVars;iv++){
1708  cout<<fVarsForOpt[iv]<<"\t";
1709  }
1710  cout<<endl;
1711  }
1712  if(fIsUpperCut){
1713  cout<<"Array of upper/lower cut"<<endl;
1714  for(Int_t iv=0;iv<fnVars;iv++){
1715  cout<<fIsUpperCut[iv]<<"\t";
1716  }
1717  cout<<endl;
1718  }
1719  if(fPtBinLimits){
1720  cout<<"Array of ptbin limits"<<endl;
1721  for(Int_t ib=0;ib<fnPtBinLimits;ib++){
1722  cout<<fPtBinLimits[ib]<<"\t";
1723  }
1724  cout<<endl;
1725  }
1726  if(fCutsRD){
1727  cout<<"Matrix of cuts"<<endl;
1728  for(Int_t iv=0;iv<fnVars;iv++){
1729  for(Int_t ib=0;ib<fnPtBins;ib++){
1730  cout<<"fCutsRD["<<iv<<"]["<<ib<<"] = "<<fCutsRD[GetGlobalIndex(iv,ib)]<<"\t";
1731  }
1732  cout<<endl;
1733  }
1734  cout<<endl;
1735  }
1736 
1737  if (fPidSelectionFlag==9) {
1738 
1739  cout << " fNBachelorPBins = " << fNBachelorPBins << endl;
1740 
1741  for(Int_t ib=0;ib<fNBachelorPBins-1;ib++){
1742  cout<<"fMinCombProb["<<ib<<"] = "<<fMinCombProb[ib]<<"\t"
1743  <<"(" << fBachelorPLimitsForPID[ib] << "<= p < "<< fBachelorPLimitsForPID[ib+1]<< ")\n";
1744  }
1745  cout<<"fMinCombProb["<<fNBachelorPBins-1<<"] = "<<fMinCombProb[fNBachelorPBins-1]<<"\t"
1746  <<"(p>= " << fBachelorPLimitsForPID[fNBachelorPBins-1] << ")\n";
1747  cout<<endl;
1748  cout << " GetCombDetectors() = " << GetPidHF()->GetCombDetectors() << endl;
1749  }
1750 
1751  cout << " fNTPCSigmaCutForPreselection = " << fNTPCSigmaCutForPreselection << endl;
1752 
1753  if (fTrackCuts) {
1754  Float_t eta1=0, eta2=0; fTrackCuts->GetEtaRange(eta1,eta2);
1755  cout << " etaRange for Bachelor: [" << eta1 << "," << eta2 << "]\n";
1756  }
1757  if (fV0daughtersCuts) {
1758  Float_t eta3=0, eta4=0; fV0daughtersCuts->GetEtaRange(eta3,eta4);
1759  cout << " etaRange for V0daughters: [" << eta3 << "," << eta4 << "]\n";
1760  }
1761  return;
1762 
1763 }
1764 
1765 //-------------------------
1767 {
1768  //
1769  //
1770  // Checking if Lc is in fiducial acceptance region
1771  //
1772  //
1773 
1774  if(fMaxRapidityCand>-998.){
1775  if(TMath::Abs(y) > fMaxRapidityCand) return kFALSE;
1776  else return kTRUE;
1777  }
1778 
1779  if(pt > 5.) {
1780  // applying cut for pt > 5 GeV
1781  AliDebug(2,Form("pt of Lambda_c = %f (> 5), cutting at |y| < 0.8",pt));
1782  if (TMath::Abs(y) > 0.8) return kFALSE;
1783 
1784  } else {
1785  // appliying smooth cut for pt < 5 GeV
1786  Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
1787  Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
1788  AliDebug(2,Form("pt of Lambda_c = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
1789  if (y < minFiducialY || y > maxFiducialY) return kFALSE;
1790  }
1791  //
1792  return kTRUE;
1793 }
1794 //---------------------------------------------------------------------------
1796  //
1797  // Daughter tracks selection
1798  //
1799 
1801  if (!d) {
1802  AliDebug(2,"AliAODRecoCascadeHF null");
1803  return kFALSE;
1804  }
1805 
1806  if (!fTrackCuts) {
1807  AliFatal("Cut object is not defined for bachelor. Candidate accepted.");
1808  return kFALSE;
1809  }
1810 
1811  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
1812  if (!bachelorTrack) return kFALSE;
1813 
1815  if(!bachelorTrack->HasPointOnITSLayer(0)) return kFALSE;
1816  }
1817 
1818  if (fKinkReject != (!(fTrackCuts->GetAcceptKinkDaughters())) ) {
1819  AliError(Form("Not compatible setting: fKinkReject=%1d - fTrackCuts->GetAcceptKinkDaughters()=%1d",fKinkReject, fTrackCuts->GetAcceptKinkDaughters()));
1820  return kFALSE;
1821  }
1822 
1823  AliAODVertex *vAOD = d->GetPrimaryVtx();
1824  Double_t pos[3]; vAOD->GetXYZ(pos);
1825  Double_t cov[6]; vAOD->GetCovarianceMatrix(cov);
1826  const AliESDVertex vESD(pos,cov,100.,100);
1827 
1828  if (!IsDaughterSelected(bachelorTrack,&vESD,fTrackCuts,aod)) return kFALSE;
1829 
1830  if (!fV0daughtersCuts) {
1831  AliFatal("Cut object is not defined for V0daughters. Candidate accepted.");
1832  return kFALSE;
1833  }
1834 
1835  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
1836  if (!v0) return kFALSE;
1837  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
1838  if (!v0positiveTrack) return kFALSE;
1839  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
1840  if (!v0negativeTrack) return kFALSE;
1841 
1842 
1843  Float_t etaMin=0, etaMax=0; fV0daughtersCuts->GetEtaRange(etaMin,etaMax);
1844  if ( (v0positiveTrack->Eta()<=etaMin || v0positiveTrack->Eta()>=etaMax) ||
1845  (v0negativeTrack->Eta()<=etaMin || v0negativeTrack->Eta()>=etaMax) ) return kFALSE;
1846  Float_t ptMin=0, ptMax=0; fV0daughtersCuts->GetPtRange(ptMin,ptMax);
1847  if ( (v0positiveTrack->Pt()<=ptMin || v0positiveTrack->Pt()>=ptMax) ||
1848  (v0negativeTrack->Pt()<=ptMin || v0negativeTrack->Pt()>=ptMax) ) return kFALSE;
1849 
1850  // Condition on nTPCclusters
1851  if (fV0daughtersCuts->GetMinNClusterTPC()>0) {
1852  if ( ( ( v0positiveTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ||
1853  ( ( v0negativeTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ) return kFALSE;
1854  }
1855 
1856  if (fV0daughtersCuts->GetMinRatioCrossedRowsOverFindableClustersTPC()>0.5) {
1857  Float_t ratioCrossedRowsOverFindableClustersTPCPos = 1.0;
1858  Float_t ratioCrossedRowsOverFindableClustersTPCNeg = 1.0;
1859  if (v0positiveTrack->GetTPCNclsF()>0) {
1860  ratioCrossedRowsOverFindableClustersTPCPos = v0positiveTrack->GetTPCClusterInfo(2,1) / v0positiveTrack->GetTPCNclsF();
1861  }
1862  if (v0negativeTrack->GetTPCNclsF()>0) {
1863  ratioCrossedRowsOverFindableClustersTPCNeg = v0negativeTrack->GetTPCClusterInfo(2,1) / v0negativeTrack->GetTPCNclsF();
1864  }
1865  if ( ( ( ratioCrossedRowsOverFindableClustersTPCPos ) < fV0daughtersCuts->GetMinRatioCrossedRowsOverFindableClustersTPC() ) ||
1866  ( ( ratioCrossedRowsOverFindableClustersTPCNeg ) < fV0daughtersCuts->GetMinRatioCrossedRowsOverFindableClustersTPC() ) ) return kFALSE;
1867  }
1868 
1869  // kTPCrefit status
1870  if (v0->GetOnFlyStatus()==kFALSE) { // only for offline V0s
1871  if (fV0daughtersCuts->GetRequireTPCRefit()) {
1872  if( !(v0positiveTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
1873  if( !(v0negativeTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
1874  }
1875  }
1876  // kink condition
1877  if (!fV0daughtersCuts->GetAcceptKinkDaughters()) {
1878  AliAODVertex *maybeKinkPos = (AliAODVertex*)v0positiveTrack->GetProdVertex();
1879  AliAODVertex *maybeKinkNeg = (AliAODVertex*)v0negativeTrack->GetProdVertex();
1880  if (maybeKinkPos->GetType()==AliAODVertex::kKink ||
1881  maybeKinkNeg->GetType()==AliAODVertex::kKink) return kFALSE;
1882  }
1883  // Findable clusters > 0 condition - from V0 analysis
1884  //if( v0positiveTrack->GetTPCNclsF()<=0 || v0negativeTrack->GetTPCNclsF()<=0 ) return kFALSE;
1885  /*
1886  Float_t lPosTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
1887  Float_t lNegTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
1888  fTreeVariableLeastNbrCrossedRows = (Int_t) lPosTrackCrossedRows;
1889  if( lNegTrackCrossedRows < fTreeVariableLeastNbrCrossedRows )
1890  fTreeVariableLeastNbrCrossedRows = (Int_t) lNegTrackCrossedRows;
1891  //Compute ratio Crossed Rows / Findable clusters
1892  //Note: above test avoids division by zero!
1893  Float_t lPosTrackCrossedRowsOverFindable = lPosTrackCrossedRows / ((double)(pTrack->GetTPCNclsF()));
1894  Float_t lNegTrackCrossedRowsOverFindable = lNegTrackCrossedRows / ((double)(nTrack->GetTPCNclsF()));
1895  fTreeVariableLeastRatioCrossedRowsOverFindable = lPosTrackCrossedRowsOverFindable;
1896  if( lNegTrackCrossedRowsOverFindable < fTreeVariableLeastRatioCrossedRowsOverFindable )
1897  fTreeVariableLeastRatioCrossedRowsOverFindable = lNegTrackCrossedRowsOverFindable;
1898  //Lowest Cut Level for Ratio Crossed Rows / Findable = 0.8, set here
1899  if ( fTreeVariableLeastRatioCrossedRowsOverFindable < 0.8 ) return kFALSE;
1900  */
1901 
1902  return kTRUE;
1903 
1904 }
1905 
1906 //---------------------------------------------------------------------------
1908  //
1909  // store the combined probability cuts
1910  //
1911 
1912  //if (fNBachelorPBins<=0)
1913  fNBachelorPBins=nPBins;
1914 
1915  if (fMinCombProb) delete [] fMinCombProb;
1917 
1918  for(Int_t ib=0; ib<fNBachelorPBins; ib++) {
1919  fMinCombProb[ib] = minProb[ib];
1920  }
1921  return;
1922 }
1923 
1924 //---------------------------------------------------------------------------
1926  //
1927  // store the bachelor p bin limits for combined probability cuts
1928  //
1929 
1930  //if (fNBachelorPBins<=0)
1931  fNBachelorPBins=nPBins;
1932 
1935 
1936  for(Int_t ib=0; ib<fNBachelorPBins; ib++) {
1937  fBachelorPLimitsForPID[ib] = pLimits[ib];
1938  }
1939  return;
1940 }
1941 
1942 //---------------------------------------------------------------------------
1944  //
1945  // Proton emission angle in p+K0s pair rest frame
1946  // This function is different from CosThetaStar function in AliAODRecoDecay,
1947  // which assumes the mass of Lc even for the pairs with the invariant mass
1948  // far from Lc mass
1949  //
1951  if (!d) {
1952  AliDebug(2,"AliAODRecoCascadeHF null");
1953  return -9999;
1954  }
1955  Double_t mprPDG = TDatabasePDG::Instance()->GetParticle(2212)->Mass();
1956  Double_t mlcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
1957  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
1958 
1959  TLorentzVector vpr, vk0s,vlc;
1960  vpr.SetXYZM(d->PxProng(0),d->PyProng(0),d->PzProng(0),mprPDG);
1961  vk0s.SetXYZM(d->PxProng(1),d->PyProng(1),d->PzProng(1),mk0sPDG);
1962  vlc = vpr + vk0s;
1963  TVector3 vboost = vlc.BoostVector();
1964  vpr.Boost(-vboost);
1965  Double_t bachcosthe = cos(vpr.Angle(vlc.Vect()));
1966 
1967  return bachcosthe;
1968 }
1969 
1970 //---------------------------------------------------------------------------
1972  //
1973  // Sign of d0 different from regular d0.
1974  // Sign defined using the position of crossing point with Lc vector
1975  // with respect to the primary vertex
1976  //
1978  if (!d) {
1979  AliDebug(2,"AliAODRecoCascadeHF null");
1980  return -9999;
1981  }
1982 
1983  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
1984  AliAODVertex *primvert = dynamic_cast<AliAODVertex*>(d->GetPrimaryVtx());
1985 
1986  Double_t d0z0bach[2],covd0z0bach[3];
1987  bachelorTrack->PropagateToDCA(primvert,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
1988  Double_t tx[3];
1989  bachelorTrack->GetXYZ(tx);
1990  tx[0] -= primvert->GetX();
1991  tx[1] -= primvert->GetY();
1992  tx[2] -= primvert->GetZ();
1993  Double_t innerpro = tx[0]*d->Px()+tx[1]*d->Py();
1994  Double_t signd0 = 1.;
1995  if(innerpro<0.) signd0 = -1.;
1996 
1997  return signd0*TMath::Abs(d0z0bach[0]);
1998 }
1999 
2000 //---------------------------------------------------------------------------
2002  //
2003  // V0 selection
2004  //
2005 
2006  if(!v0){
2007  AliFatal("V0 object is NULL");
2008  return kFALSE;
2009  }
2010 
2011  if (!fV0daughtersCuts) {
2012  AliFatal("Cut object is not defined for V0daughters. Candidate accepted.");
2013  return kFALSE;
2014  }
2015 
2016  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
2017  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return kFALSE;
2018 
2019  if (!v0->GetSecondaryVtx()) {
2020  AliDebug(2,"No secondary vertex for V0 by cascade");
2021  return kFALSE;
2022  }
2023  if (v0->GetNDaughters()!=2) {
2024  AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0->GetOnFlyStatus(),v0->GetNDaughters()));
2025  return kFALSE;
2026  }
2027 
2028  // cuts on the V0 mass: K0S case
2029  Double_t mk0s = v0->MassK0Short();
2030  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
2031  Double_t maxcut_m = -9999;
2032  for(Int_t ip=0;ip<fnPtBins;ip++){
2033  if(fCutsRD[GetGlobalIndex(2,ip)]>maxcut_m) maxcut_m = fCutsRD[GetGlobalIndex(2,ip)];
2034  }
2035  if (TMath::Abs(mk0s-mk0sPDG) > maxcut_m) {
2036  return kFALSE;
2037  }
2038 
2039  // cut on V0 pT min
2040  Double_t mincut_p = 9999;
2041  for(Int_t ip=0;ip<fnPtBins;ip++){
2042  if(fCutsRD[GetGlobalIndex(15,ip)]<mincut_p) mincut_p = fCutsRD[GetGlobalIndex(15,ip)];
2043  }
2044  if (v0->Pt() < mincut_p) { // V0 pT min
2045  return kFALSE;
2046  }
2047 
2048  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(v0->GetDaughter(0));
2049  if (!v0positiveTrack) return kFALSE;
2050  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(v0->GetDaughter(1));
2051  if (!v0negativeTrack) return kFALSE;
2052 
2053 
2054  Float_t etaMin=0, etaMax=0; fV0daughtersCuts->GetEtaRange(etaMin,etaMax);
2055  if ( (v0positiveTrack->Eta()<=etaMin || v0positiveTrack->Eta()>=etaMax) ||
2056  (v0negativeTrack->Eta()<=etaMin || v0negativeTrack->Eta()>=etaMax) ) return kFALSE;
2057  Float_t ptMin=0, ptMax=0; fV0daughtersCuts->GetPtRange(ptMin,ptMax);
2058  if ( (v0positiveTrack->Pt()<=ptMin || v0positiveTrack->Pt()>=ptMax) ||
2059  (v0negativeTrack->Pt()<=ptMin || v0negativeTrack->Pt()>=ptMax) ) return kFALSE;
2060 
2061  // Condition on nTPCclusters
2062  if (fV0daughtersCuts->GetMinNClusterTPC()>0) {
2063  if ( ( ( v0positiveTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ||
2064  ( ( v0negativeTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ) return kFALSE;
2065  }
2066 
2067  if (fV0daughtersCuts->GetMinRatioCrossedRowsOverFindableClustersTPC()>0.5) {
2068  Float_t ratioCrossedRowsOverFindableClustersTPCPos = 1.0;
2069  Float_t ratioCrossedRowsOverFindableClustersTPCNeg = 1.0;
2070  if (v0positiveTrack->GetTPCNclsF()>0) {
2071  ratioCrossedRowsOverFindableClustersTPCPos = v0positiveTrack->GetTPCClusterInfo(2,1) / v0positiveTrack->GetTPCNclsF();
2072  }
2073  if (v0negativeTrack->GetTPCNclsF()>0) {
2074  ratioCrossedRowsOverFindableClustersTPCNeg = v0negativeTrack->GetTPCClusterInfo(2,1) / v0negativeTrack->GetTPCNclsF();
2075  }
2076  if ( ( ( ratioCrossedRowsOverFindableClustersTPCPos ) < fV0daughtersCuts->GetMinRatioCrossedRowsOverFindableClustersTPC() ) ||
2077  ( ( ratioCrossedRowsOverFindableClustersTPCNeg ) < fV0daughtersCuts->GetMinRatioCrossedRowsOverFindableClustersTPC() ) ) return kFALSE;
2078  }
2079 
2080  // kTPCrefit status
2081  if (v0->GetOnFlyStatus()==kFALSE) { // only for offline V0s
2082  if (fV0daughtersCuts->GetRequireTPCRefit()) {
2083  if( !(v0positiveTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
2084  if( !(v0negativeTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
2085  }
2086  }
2087  // kink condition
2088  if (!fV0daughtersCuts->GetAcceptKinkDaughters()) {
2089  AliAODVertex *maybeKinkPos = (AliAODVertex*)v0positiveTrack->GetProdVertex();
2090  AliAODVertex *maybeKinkNeg = (AliAODVertex*)v0negativeTrack->GetProdVertex();
2091  if (maybeKinkPos->GetType()==AliAODVertex::kKink ||
2092  maybeKinkNeg->GetType()==AliAODVertex::kKink) return kFALSE;
2093  }
2094 
2095  return kTRUE;
2096 
2097 }
2098 
2099 //---------------------------------------------------------------------------
2101  //
2102  // Daughter tracks selection
2103  //
2104 
2105  if (!fTrackCuts) {
2106  AliFatal("Cut object is not defined for bachelor. Candidate accepted.");
2107  return kFALSE;
2108  }
2109 
2110  if (!bachelorTrack) {
2111  AliFatal("Track object is NULL.");
2112  return kFALSE;
2113  }
2114 
2115  if ( fUseTrackSelectionWithFilterBits && !(bachelorTrack->TestFilterMask(BIT(4))) ) {
2116  AliDebug(2,"Check on the bachelor FilterBit: no BIT(4). Candidate rejected.");
2117  return kFALSE;
2118  }
2119 
2120  Float_t ptmin, ptmax;
2121  fTrackCuts->GetPtRange(ptmin,ptmax);
2122  if(bachelorTrack->Pt()<ptmin) return kFALSE;
2123  if(bachelorTrack->Pt()>ptmax) return kFALSE;
2124 
2125  // cut on bachelor pT min
2126  Double_t mincut_p = 9999;
2127  for(Int_t ip=0;ip<fnPtBins;ip++){
2128  if(fCutsRD[GetGlobalIndex(4,ip)]<mincut_p) mincut_p = fCutsRD[GetGlobalIndex(4,ip)];
2129  }
2130  if (bachelorTrack->Pt() < mincut_p) {
2131  return kFALSE;
2132  }
2133 
2134  if (fKinkReject != (!(fTrackCuts->GetAcceptKinkDaughters())) ) {
2135  AliError(Form("Not compatible setting: fKinkReject=%1d - fTrackCuts->GetAcceptKinkDaughters()=%1d",fKinkReject, fTrackCuts->GetAcceptKinkDaughters()));
2136  return kFALSE;
2137  }
2138 
2139 
2140  AliAODVertex *vAOD = (AliAODVertex*)aod->GetPrimaryVertex();
2141  Double_t pos[3]; vAOD->GetXYZ(pos);
2142  Double_t cov[6]; vAOD->GetCovarianceMatrix(cov);
2143  const AliESDVertex vESD(pos,cov,100.,100);
2144 
2145  if (!IsDaughterSelected(bachelorTrack,&vESD,fTrackCuts,aod)) return kFALSE;
2146 
2147  Bool_t okLcK0Sp = kTRUE; // K0S case
2148  Bool_t dummy1 = kTRUE;
2149  Bool_t dummy2 = kTRUE;
2150  CheckPID(bachelorTrack,0,0,okLcK0Sp,dummy1,dummy2);//use the PID for the first bin. only option 9 is the candidate pT depedent, so probably OK, need to update if needed
2151 
2152  return okLcK0Sp;
2153 }
2154 
2155 //---------------------------------------------------------------------------
2157  //
2158  // Apply selection
2159  //
2160 
2161  if (!fCutsRD) {
2162  AliFatal("Cut matrice not inizialized. Exit...");
2163  return kFALSE;
2164  }
2165 
2166 
2168  if (!d) {
2169  AliDebug(2,"AliAODRecoCascadeHF null");
2170  return kFALSE;
2171  }
2172 
2173  Double_t pt=d->Pt();
2174  if(pt<fMinPtCand) return kFALSE;
2175  if(pt>fMaxPtCand) return kFALSE;
2176  Int_t ptbin = PtBin(pt);
2177 
2178  AliVTrack *bachelorTrack = (AliVTrack*)d->GetBachelor();
2179  AliAODv0 *v0 = (AliAODv0*)d->Getv0();
2180 
2182  if(!spdfirstflag) return kFALSE;
2183  }
2184 
2185  // Get the V0 daughter tracks
2186  AliAODTrack *v0positiveTrack = (AliAODTrack*)v0->GetDaughter(0);
2187  AliAODTrack *v0negativeTrack = (AliAODTrack*)v0->GetDaughter(1);
2188  if (!v0positiveTrack || !v0negativeTrack ) {
2189  AliDebug(2,"No V0 daughters' objects");
2190  return kFALSE;
2191  }
2192 
2193  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
2194  AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",v0positiveTrack->GetID(),v0negativeTrack->GetID()));
2195  return kFALSE;
2196  }
2197 
2198  AliAODVertex *vAOD = (AliAODVertex*)aod->GetPrimaryVertex();
2199  Double_t posVtx[3]; vAOD->GetXYZ(posVtx);
2200 
2201  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
2202  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
2203  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
2204 
2205  // K0S + p
2206  Double_t mk0s = v0->MassK0Short();
2207  Double_t mLck0sp = d->InvMassLctoK0sP();
2208 
2209  // Lambda + pi
2210  Double_t mlambda = v0->MassLambda();
2211  Double_t malambda = v0->MassAntiLambda();
2212  Double_t mLcLpi = d->InvMassLctoLambdaPi();
2213 
2214  Bool_t okK0spipi=kTRUE, okLppi=kTRUE, okLBarpip=kTRUE;
2215  Bool_t isNotK0S = kTRUE, isNotLambda = kTRUE, isNotLambdaBar = kTRUE, isNotGamma = kTRUE;
2216 
2217  Bool_t okLck0sp=kTRUE, okLcLpi=kTRUE, okLcLBarpi=kTRUE;
2218 
2219  // cut on Lc mass with K0S+p hypothesis
2220  if (TMath::Abs(mLck0sp-mLcPDG) > fCutsRD[GetGlobalIndex(0,ptbin)] && fExcludedCut!=0) {
2221  okLck0sp = kFALSE;
2222  AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to Lambda_c into K0S+p cut",mLck0sp));
2223  }
2224 
2225  // cuts on the V0 mass: K0S case
2226  if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(2,ptbin)] && fExcludedCut!=2) {
2227  okK0spipi = kFALSE;
2228  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to K0S cut",mk0s));
2229  }
2230 
2231  // cut on Lc mass with Lambda+pi hypothesis
2232  if (TMath::Abs(mLcLpi-mLcPDG) > fCutsRD[GetGlobalIndex(1,ptbin)] && fExcludedCut!=1) {
2233  okLcLpi = kFALSE;
2234  okLcLBarpi = kFALSE;
2235  AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to Lambda_c into Lambda+pi cut",mLcLpi));
2236  }
2237 
2238  // cuts on the V0 mass: Lambda/LambdaBar case
2239  if ( TMath::Abs(mlambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)] && fExcludedCut!=3) {
2240  okLppi = kFALSE;
2241  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to LambdaBar cut",mlambda));
2242  }
2243 
2244  if ( TMath::Abs(malambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)] && fExcludedCut!=3) {
2245  okLBarpip = kFALSE;
2246  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to LambdaBar cut",malambda));
2247  }
2248 
2249  // cut on K0S invariant mass veto
2250  if (TMath::Abs(v0->MassK0Short()-mk0sPDG) < fCutsRD[GetGlobalIndex(12,ptbin)] && fExcludedCut!=12) { // K0S invariant mass veto
2251  AliDebug(4,Form(" veto on K0S invariant mass doesn't pass the cut"));
2252  isNotK0S=kFALSE;
2253  }
2254 
2255  // cut on Lambda/LambdaBar invariant mass veto
2256  if (TMath::Abs(v0->MassLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) { // Lambda invariant mass veto
2257  AliDebug(4,Form(" veto on Lambda invariant mass doesn't pass the cut"));
2258  isNotLambda=kFALSE;
2259  }
2260  if (TMath::Abs(v0->MassAntiLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) { // LambdaBar invariant mass veto
2261  AliDebug(4,Form(" veto on LambdaBar invariant mass doesn't pass the cut"));
2262  isNotLambdaBar=kFALSE;
2263  }
2264 
2265  // cut on gamma invariant mass veto
2266  if (v0->InvMass2Prongs(0,1,11,11) < fCutsRD[GetGlobalIndex(14,ptbin)] && fExcludedCut!=14) { // K0S invariant mass veto
2267  AliDebug(4,Form(" veto on gamma invariant mass doesn't pass the cut"));
2268  isNotGamma=kFALSE;
2269  }
2270 
2271  okLck0sp = okLck0sp && okK0spipi && isNotLambda && isNotLambdaBar && isNotGamma;
2272  okLcLpi = okLcLpi && okLppi && isNotK0S && isNotLambdaBar && isNotGamma;
2273  okLcLBarpi = okLcLBarpi && okLBarpip && isNotK0S && isNotLambda && isNotGamma;
2274 
2275  if (!okLck0sp) return kFALSE;
2276 
2277  // cuts on the minimum pt of the tracks
2278  if (TMath::Abs(bachelorTrack->Pt()) < fCutsRD[GetGlobalIndex(4,ptbin)] && fExcludedCut!=4) {
2279  AliDebug(4,Form(" bachelor track Pt=%2.2e > %2.2e",bachelorTrack->Pt(),fCutsRD[GetGlobalIndex(4,ptbin)]));
2280  return kFALSE;
2281  }
2282  if (TMath::Abs(v0positiveTrack->Pt()) < fCutsRD[GetGlobalIndex(5,ptbin)] && fExcludedCut!=5) {
2283  AliDebug(4,Form(" V0-positive track Pt=%2.2e > %2.2e",v0positiveTrack->Pt(),fCutsRD[GetGlobalIndex(5,ptbin)]));
2284  return kFALSE;
2285  }
2286  if (TMath::Abs(v0negativeTrack->Pt()) < fCutsRD[GetGlobalIndex(6,ptbin)] && fExcludedCut!=6) {
2287  AliDebug(4,Form(" V0-negative track Pt=%2.2e > %2.2e",v0negativeTrack->Pt(),fCutsRD[GetGlobalIndex(6,ptbin)]));
2288  return kFALSE;
2289  }
2290  // cut on cascade dca (prong-to-prong)
2291  if ( TMath::Abs(d->GetDCA()) > fCutsRD[GetGlobalIndex(7,ptbin)] && fExcludedCut!=7) { // prong-to-prong cascade DCA
2292  AliDebug(4,Form(" cascade tracks DCA don't pass the cut"));
2293  return kFALSE;
2294  }
2295 
2296  // cut on V0 dca (prong-to-prong)
2297  if ( TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(8,ptbin)] && fExcludedCut!=8) { // prong-to-prong V0 DCA
2298  AliDebug(4,Form(" V0 DCA don't pass the cut"));
2299  return kFALSE;
2300  }
2301 
2302  // cut on V0 cosine of pointing angle wrt PV
2303  if (v0->CosPointingAngle(posVtx) < fCutsRD[GetGlobalIndex(9,ptbin)] && fExcludedCut!=9) { // cosine of V0 pointing angle wrt primary vertex
2304  AliDebug(4,Form(" V0 cosine of pointing angle doesn't pass the cut"));
2305  return kFALSE;
2306  }
2307 
2308  // cut on bachelor transverse impact parameter wrt PV
2309  if (TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(10,ptbin)] && fExcludedCut!=10) { // bachelor transverse impact parameter wrt PV
2310  AliDebug(4,Form(" bachelor transverse impact parameter doesn't pass the cut"));
2311  return kFALSE;
2312  }
2313 
2314  // cut on V0 transverse impact parameter wrt PV
2315  if (TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(11,ptbin)] && fExcludedCut!=11) { // V0 transverse impact parameter wrt PV
2316  AliDebug(4,Form(" V0 transverse impact parameter doesn't pass the cut"));
2317  return kFALSE;
2318  }
2319 
2320  // cut on V0 pT min
2321  if (v0->Pt() < fCutsRD[GetGlobalIndex(15,ptbin)] && fExcludedCut!=15) { // V0 pT min
2322  AliDebug(4,Form(" V0 track Pt=%2.2e > %2.2e",v0->Pt(),fCutsRD[GetGlobalIndex(15,ptbin)]));
2323  return kFALSE;
2324  }
2325 
2326  // cut on Proton emission angle
2327  if(TMath::Abs(fCutsRD[GetGlobalIndex(16,ptbin)])<1.1 || TMath::Abs(fCutsRD[GetGlobalIndex(17,ptbin)])<1.1){
2328  Double_t cutvar = GetProtonEmissionAngleCMS(d);
2329  if (cutvar > fCutsRD[GetGlobalIndex(16,ptbin)] && fExcludedCut!=16 && fExcludedCut!=17) { // Proton emission angle
2330  AliDebug(4,Form(" Cos proton emission=%2.2e < %2.2e",cutvar,fCutsRD[GetGlobalIndex(16,ptbin)]));
2331  return kFALSE;
2332  }
2333  if (cutvar < fCutsRD[GetGlobalIndex(17,ptbin)] && fExcludedCut!=16 && fExcludedCut!=17) { // Proton emission angle
2334  AliDebug(4,Form(" Cos proton emission=%2.2e > %2.2e",cutvar,fCutsRD[GetGlobalIndex(17,ptbin)]));
2335  return kFALSE;
2336  }
2337  }
2338 
2339  // cut on proton re-signed d0
2340  if(TMath::Abs(fCutsRD[GetGlobalIndex(18,ptbin)])<0.2){
2341  Double_t cutvar = GetReSignedd0(d) ;
2342  if (cutvar< fCutsRD[GetGlobalIndex(18,ptbin)] && fExcludedCut!=18) { // proton d0
2343  AliDebug(4,Form(" Proton d0 (re-signed)=%2.2e > %2.2e",cutvar,fCutsRD[GetGlobalIndex(18,ptbin)]));
2344  return kFALSE;
2345  }
2346  }
2347 
2348  // cut on Armenteros qT/|alpha|
2349  if(TMath::Abs(fCutsRD[GetGlobalIndex(19,ptbin)])<0.3){
2350  Double_t cutvar = v0->PtArmV0()/TMath::Abs(v0->AlphaV0());
2351  if (cutvar < fCutsRD[GetGlobalIndex(19,ptbin)] && fExcludedCut!=19) { // v0 armenteros variable
2352  AliDebug(4,Form(" qT/|alpha|=%2.2e > %2.2e",cutvar,fCutsRD[GetGlobalIndex(19,ptbin)]));
2353  return kFALSE;
2354  }
2355  }
2356 
2357  return kTRUE;
2358 }
2359 //---------------------------------------------------------------------------
2361  //
2362  //give the bachelor p bin.
2363  //
2364  Int_t pBin=-1;
2365  for (Int_t i=0;i<fNBachelorPBins+1;i++){
2366  if(bachelorP<fBachelorPLimitsForPID[i+1]) {
2367  pBin=i;
2368  break;
2369  }
2370  }
2371  return pBin;
2372 }
void SetMinCombinedProbability(Int_t nPBins, Float_t *minProb)
AliESDtrackCuts * fV0daughtersCuts
virtual void SetStandardCutsPbPb2010()
Int_t GetBachelorPBin(Double_t bachelorP) const
Double_t fMaxPtCandTrackSPDFirst
flag to select the track kFirst criteria for pt < ptlimit
Definition: AliRDHFCuts.h:504
Int_t GetNVars() const
Definition: AliRDHFCuts.h:267
void SetAsym(Bool_t asym)
Definition: AliAODPidHF.h:101
void SetBachelorPLimitsForPID(Int_t nPBins, Float_t *pMin)
Int_t PtBin(Float_t pt) const
Definition: AliRDHFCuts.h:330
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:475
virtual void SetStandardCutsPP2010()
Bool_t fRemoveDaughtersFromPrimary
Definition: AliRDHFCuts.h:481
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:468
ECombDetectors GetCombDetectors() const
Definition: AliAODPidHF.h:175
AliAODv0 * Getv0() const
virtual void SetStandardCutsPbPb2011()
Int_t fMinVtxContr
0: not cut; 1: SPDZ; 2: SPD3D; 3: Tracks
Definition: AliRDHFCuts.h:452
Double_t InvMassLctoLambdaPi() const
Bool_t AreLctoV0DaughtersSelected(AliAODRecoDecayHF *rd, AliAODEvent *aod=0x0) const
Float_t fMaxVtxRedChi2
minimum vertex contributors
Definition: AliRDHFCuts.h:453
Int_t CombineCuts(Int_t returnvalueTrack, Int_t returnvalue, Int_t returnvaluePID) const
const Float_t * GetCuts() const
Definition: AliRDHFCuts.h:271
Float_t fV0Type
cuts for v0 daughters (AOD converted to ESD on the flight!)
void SetNVars(Int_t nVars)
Definition: AliRDHFCuts.h:445
Float_t fNTPCSigmaCutForPreselection
virtual Int_t PreSelect(TObjArray aodtracks)
Int_t fMinVtxType
cuts on the event
Definition: AliRDHFCuts.h:451
Double_t fMaxRapidityCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:501
void EnableSemiCentralTrigger()
Definition: AliRDHFCuts.h:101
AliRDHFCutsLctoV0 & operator=(const AliRDHFCutsLctoV0 &source)
TString * GetVarNames() const
Definition: AliRDHFCuts.h:268
Double_t ptMin
Int_t ApplyPidTPCRaw(AliAODTrack *track, Int_t specie) const
void SetGlobalIndex()
Definition: AliRDHFCuts.h:213
AliRDHFCuts & operator=(const AliRDHFCuts &source)
Int_t fUseCentrality
flag to use a multiplicity dependent pileup selection
Definition: AliRDHFCuts.h:488
Bool_t fUsePID
Definition: AliRDHFCuts.h:476
void SetPidHF(AliAODPidHF *pidObj)
see enum below
Definition: AliRDHFCuts.h:227
Double_t InvMassLctoK0sP() const
Bool_t GetOldPid()
Definition: AliAODPidHF.h:170
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:264
void SetTOF(Bool_t tof)
Definition: AliAODPidHF.h:108
AliAODTrack * Getv0PositiveTrack() const
virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d, Float_t *vars, Int_t nvars, Int_t *pdgdaughters)
Double_t GetReSignedd0(AliAODRecoDecayHF *d)
int Int_t
Definition: External.C:63
Bool_t fUseTrackSelectionWithFilterBits
flag to reject kink daughters
Definition: AliRDHFCuts.h:512
void SetCuts(Int_t nVars, Int_t nPtBins, Float_t **cutsRD)
Int_t fnVarsForOpt
Definition: AliRDHFCuts.h:471
void ResetMaskAndEnableMBTrigger()
Definition: AliRDHFCuts.h:81
unsigned int UInt_t
Definition: External.C:33
AliPIDCombined * GetPidCombined() const
Definition: AliAODPidHF.h:174
Bool_t ApplySingleProtonCuts(AliAODTrack *trk, AliAODEvent *aod)
Int_t fNBachelorPBins
Magnetic field for propagation.
float Float_t
Definition: External.C:68
const Double_t ptmax
TString * fVarNames
number of cut vars for candidates
Definition: AliRDHFCuts.h:470
Double_t fMaxPtCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:500
AliESDtrackCuts * fTrackCuts
quality cuts on the daughter tracks
Definition: AliRDHFCuts.h:464
void AddTrackCutsV0daughters(AliESDtrackCuts *v0daug)
Float_t fLowPtCut
high pT cut separation for proton identification
AliAODTrack * GetBachelor() const
Float_t * fMinCombProbVsLcPt
cut to be excluded (-1=none)
Int_t fOptPileup
use Physics selection criteria
Definition: AliRDHFCuts.h:484
Bool_t IsExcluded(AliAODTrack *track, Int_t labelTrack, Double_t nsigmaCut, TString detector)
const Double_t ptmin
virtual void PrintAll() const
Float_t fMinCentrality
Definition: AliRDHFCuts.h:493
Int_t MakeRawPid(AliAODTrack *track, Int_t specie)
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:173
Int_t fnPtBinLimits
number of pt bins for cuts
Definition: AliRDHFCuts.h:467
void SetSigma(Double_t *sigma)
Definition: AliAODPidHF.h:52
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:474
Double_t CosV0PointingAngle() const
short Short_t
Definition: External.C:23
Int_t fUsePreselect
Definition: AliRDHFCuts.h:529
Int_t ApplyPidTOFRaw(AliAODTrack *track, Int_t specie) const
void SetVarsForOpt(Int_t nVars, Bool_t *forOpt)
Bool_t ApplyCandidateCuts(AliAODRecoDecayHF *rd, AliAODEvent *aod, Bool_t spdfirst)
Double_t GetProtonEmissionAngleCMS(AliAODRecoDecayHF *d)
void SetVarNames(Int_t nVars, TString *varNames, Bool_t *isUpperCut)
Bool_t * fVarsForOpt
number of cut vars to be optimized for candidates
Definition: AliRDHFCuts.h:472
void EnableCentralTrigger()
Definition: AliRDHFCuts.h:89
Int_t fMinSPDMultiplicity
maximum |z| of primary vertex
Definition: AliRDHFCuts.h:455
void SetUsePID(Bool_t flag=kTRUE)
Definition: AliRDHFCuts.h:221
Int_t fExcludedCut
low pT cut separation for proton identification
Bool_t fIsCandTrackSPDFirst
IsSelected returns always kTRUE for MC signal.
Definition: AliRDHFCuts.h:503
Bool_t ApplySingleK0Cuts(AliAODv0 *v0, AliAODEvent *aod)
void SetPtBins(Int_t nPtBinLimits, Float_t *ptBinLimits)
Bool_t fKinkReject
cut on zSPD vertex to remove outliers in centrality vs. tracklets (0=no cut, 1= cut at 12 cm...
Definition: AliRDHFCuts.h:511
Bool_t fUsePhysicsSelection
use MC primary vertex
Definition: AliRDHFCuts.h:483
void SetTOFdecide(Bool_t tOFdecide)
Definition: AliAODPidHF.h:120
void SetMatch(Int_t match)
Definition: AliAODPidHF.h:111
AliAODVertex * GetPrimaryVtx() const
void AddTrackCuts(const AliESDtrackCuts *cuts)
Definition: AliRDHFCuts.h:219
void SetTPC(Bool_t tpc)
Definition: AliAODPidHF.h:107
bool Bool_t
Definition: External.C:53
Int_t fnPtBins
cuts on the candidate
Definition: AliRDHFCuts.h:466
Float_t fHighPtCut
V0 type – should be defined as in AliRDHFCuts.h.
Double_t ptMax
void SetTriggerClass(TString trclass0, TString trclass1="")
Definition: AliRDHFCuts.h:208
AliAODPidHF * fPidHF
enable AOD049 centrality cleanup
Definition: AliRDHFCuts.h:478
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
void CheckPID(AliAODTrack *bachelor, AliAODTrack *, AliAODTrack *, Bool_t &isBachelorID1, Bool_t &isBachelorID2, Bool_t &isBachelorID4)
Int_t GetGlobalIndex(Int_t iVar, Int_t iPtBin) const
Float_t * fBachelorPLimitsForPID
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:499
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:494
virtual Int_t IsSelectedPID(AliAODRecoDecayHF *obj)
Int_t fnVars
Definition: AliRDHFCuts.h:469