AliPhysics  ced2227 (ced2227)
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 //---------------------------------------------------------------------------
727 Bool_t AliRDHFCutsLctoV0::PreSelect(TObject* obj, AliAODv0 *v0, AliVTrack *bachelorTrack){
728  //
729  // Apply pre-selections, used in the AOD filtering
730  //
731 
732  if (!fCutsRD) {
733  AliFatal("Cut matrix not inizialized. Exit...");
734  return 0;
735  }
736 
738  if (!d) {
739  AliDebug(2,"AliAODRecoCascadeHF null");
740  return 0;
741  }
742 
743  Double_t pt = d->Pt();
744  Int_t ptbin = PtBin(pt);
745 
746  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
747  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
748 
749  // cut on V0 pT min
750  if (v0->Pt() < fCutsRD[GetGlobalIndex(15,ptbin)]) return 0;
751 
752  // cuts on the minimum pt of the bachelor
753  if (TMath::Abs(bachelorTrack->Pt()) < fCutsRD[GetGlobalIndex(4,ptbin)]) return 0;
754 
755  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
756  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
757  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
758 
759  // K0S + p
760  Double_t mk0s = v0->MassK0Short();
761  Double_t mLck0sp = d->InvMassLctoK0sP();
762 
763  // Lambda + pi
764  Double_t mlambda = v0->MassLambda();
765  Double_t malambda = v0->MassAntiLambda();
766  Double_t mLcLpi = d->InvMassLctoLambdaPi();
767 
768  Bool_t okLck0sp=kTRUE, okLcLpi=kTRUE, okLcLBarpi=kTRUE;
769  Bool_t okK0spipi=kTRUE, okLppi=kTRUE, okLBarpip=kTRUE;
770  Bool_t isNotK0S = kTRUE, isNotLambda = kTRUE, isNotLambdaBar = kTRUE, isNotGamma = kTRUE;
771 
772  // cut on Lc mass with K0S+p hypothesis
773  if (TMath::Abs(mLck0sp-mLcPDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okLck0sp = kFALSE;
774  // cuts on the V0 mass: K0S case
775  if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(2,ptbin)]) okK0spipi = kFALSE;
776  // cut on Lc mass with Lambda+pi hypothesis
777  if (TMath::Abs(mLcLpi-mLcPDG) > fCutsRD[GetGlobalIndex(1,ptbin)]) {
778  okLcLpi = kFALSE;
779  okLcLBarpi = kFALSE;
780  }
781 
782  // cuts on the V0 mass: Lambda/LambdaBar case
783  if ( TMath::Abs(mlambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)]) okLppi = kFALSE;
784  if ( TMath::Abs(malambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)]) okLBarpip = kFALSE;
785 
786  // cut on K0S invariant mass veto
787  if (TMath::Abs(v0->MassK0Short()-mk0sPDG) < fCutsRD[GetGlobalIndex(12,ptbin)]) isNotK0S=kFALSE;
788  // cut on Lambda/LambdaBar invariant mass veto
789  if (TMath::Abs(v0->MassLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)]) isNotLambda=kFALSE;
790  if (TMath::Abs(v0->MassAntiLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)]) isNotLambdaBar=kFALSE;
791 
792  // cut on gamma invariant mass veto
793  if (v0->InvMass2Prongs(0,1,11,11) < fCutsRD[GetGlobalIndex(14,ptbin)]) isNotGamma=kFALSE;
794 
795  okLck0sp = okLck0sp && okK0spipi && isNotLambda && isNotLambdaBar && isNotGamma;
796  okLcLpi = okLcLpi && okLppi && isNotK0S && isNotLambdaBar && isNotGamma;
797  okLcLBarpi = okLcLBarpi && okLBarpip && isNotK0S && isNotLambda && isNotGamma;
798 
799  if (!okLck0sp && !okLcLpi && !okLcLBarpi) return 0;
800 
801 
802  // cut on V0 dca (prong-to-prong)
803  if ( TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
804 
805 
806  return kTRUE;
807 
808 }
809 //---------------------------------------------------------------------------
811 
812  // fPidHF -> PID object for bachelor
813 
814  if (!fUsePID || !obj) {
815  AliDebug(2,"PID selection inactive. Candidate accepted.");
816  return 7; // all hypothesis are valid
817  }
818 
820 
821  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(objD->Getv0());
822  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
823  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
824 
825  AliAODTrack *bachelor = (AliAODTrack*)objD->GetBachelor();
826  AliAODTrack *v0Pos = (AliAODTrack*)objD->Getv0PositiveTrack();
827  AliAODTrack *v0Neg = (AliAODTrack*)objD->Getv0NegativeTrack();
828 
829  if (!bachelor || !v0Pos || !v0Neg) return 0;
830 
831  Bool_t okLcK0Sp = kTRUE; // K0S case
832  Bool_t okLcLambdaBarPi = kTRUE; // LambdaBar case
833  Bool_t okLcLambdaPi = kTRUE; // Lambda case
834 
835  CheckPID(bachelor,v0Neg,v0Pos,okLcK0Sp,okLcLambdaBarPi,okLcLambdaPi);
836 
837  Int_t returnvalue = okLcK0Sp+2*okLcLambdaBarPi+4*okLcLambdaPi;
838 
839  return returnvalue;
840 }
841 //-----------------------
842 void AliRDHFCutsLctoV0::CheckPID(AliAODTrack *bachelor,
843  AliAODTrack * /*v0Neg*/, AliAODTrack * /*v0Pos*/,
844  Bool_t &isBachelorID1, Bool_t &isBachelorID2, Bool_t &isBachelorID4) {
845  // identification strategy
846 
847  Int_t idxIDbyTOF = -1;
848  Int_t idxIDbyTPC = -1;
849 
850  Int_t tpcID = -1;
851  Int_t tofID = -1;
852  Double_t nTPCsigmas = -999;
853  Double_t nTOFsigmas = -999;
854 
855  Bool_t trackIDByTOF = -1;
856  Bool_t trackIDByTPC = -1;
857 
858  Bool_t dummy = kFALSE;
859 
860  switch (fPidSelectionFlag) {
861 
862  case 0:
863 
864  // identify bachelor
865  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,4);
866  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,4);
867  isBachelorID1 = (idxIDbyTOF==4) && (idxIDbyTPC==4); // K0S case
868 
869  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,2);
870  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,2);
871  isBachelorID2 = (idxIDbyTOF==2) && (idxIDbyTPC==2); // LambdaBar case
872 
873  isBachelorID4 = isBachelorID2; // Lambda case
874 
875  break;
876 
877  case 1:
878 
879  // identify bachelor
880  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,4);
881  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,4);
882  dummy = ( !(fPidHF->CheckTOFPIDStatus(bachelor)) && (idxIDbyTPC==4) &&
883  fPidHF->IsExcluded(bachelor,2,2.,"TPC") && fPidHF->IsExcluded(bachelor,3,2.,"TPC") ); // K0S case
884  isBachelorID1 = ( (idxIDbyTOF==4) || dummy );
885 
886  idxIDbyTOF = fPidHF->ApplyPidTOFRaw(bachelor,2);
887  idxIDbyTPC = fPidHF->ApplyPidTPCRaw(bachelor,2);
888  dummy = ( !(fPidHF->CheckTOFPIDStatus(bachelor)) && (idxIDbyTPC==2) &&
889  fPidHF->IsExcluded(bachelor,3,2.,"TPC") && fPidHF->IsExcluded(bachelor,4,2.,"TPC") ); // LambdaBar case
890  isBachelorID2 = ( (idxIDbyTOF==2) || dummy );
891 
892  isBachelorID4 = isBachelorID2; // Lambda case
893 
894  break;
895 
896  case 2:
897 
898  // identify bachelor
899  nTOFsigmas = -999;
900  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
901  nTPCsigmas = -999;
902  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
903  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
904  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
905  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
906  (bachelor->P()>=fLowPtCut && TMath::Abs(nTPCsigmas)<3) ) );
907  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // K0S case
908 
909  nTOFsigmas = -999;
910  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
911  nTPCsigmas = -999;
912  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
913  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
914  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
915  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
916  (bachelor->P()>=fLowPtCut && TMath::Abs(nTPCsigmas)<3) ) );
917  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // LambdaBar case
918 
919  isBachelorID4 = isBachelorID2; // Lambda case
920 
921  break;
922 
923  case 3:
924 
925  // identify bachelor
926  nTOFsigmas = -999;
927  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
928  nTPCsigmas = -999;
929  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
930  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
931  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
932  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
933  (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTPCsigmas)<3) ||
934  (bachelor->P()>=fHighPtCut && nTPCsigmas>-3 && nTPCsigmas<2) ) );
935  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // K0S case
936 
937  nTOFsigmas = -999;
938  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
939  nTPCsigmas = -999;
940  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
941  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
942  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
943  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) ||
944  (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTPCsigmas)<3) ||
945  (bachelor->P()>=fHighPtCut && nTPCsigmas>-3 && nTPCsigmas<2) ) );
946  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTPC && trackIDByTOF); // LambdaBar case
947 
948  isBachelorID4 = isBachelorID2; // Lambda case
949 
950  break;
951 
952  case 4:
953 
954  // identify bachelor
955  nTOFsigmas = -999;
956  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
957  nTPCsigmas = -999;
958  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
959  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
960  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
961  trackIDByTPC = ( (tpcID==1) && (TMath::Abs(nTPCsigmas)<2) );
962  isBachelorID1 = ( (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTOF) ); // K0S case
963 
964  nTOFsigmas = -999;
965  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
966  nTPCsigmas = -999;
967  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
968  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
969  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
970  trackIDByTPC = ( (tpcID==1) && (TMath::Abs(nTPCsigmas)<2) );
971  isBachelorID2 = ( (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && trackIDByTOF) ); // LambdaBar case
972 
973  isBachelorID4 = isBachelorID2; // Lambda case
974 
975  break;
976 
977  case 5:
978 
979  // identify bachelor
980  nTOFsigmas = -999;
981  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
982  nTPCsigmas = -999;
983  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
984  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
985  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
986  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
987  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // K0S case
988 
989  nTOFsigmas = -999;
990  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
991  nTPCsigmas = -999;
992  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
993  trackIDByTOF = ( (tofID==1) && ( (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && TMath::Abs(nTOFsigmas)<3) ||
994  (bachelor->P()>=fHighPtCut && nTOFsigmas>-2 && nTOFsigmas<3) ) );
995  trackIDByTPC = ( (tpcID==1) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
996  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
997 
998  isBachelorID4 = isBachelorID2; // Lambda case
999 
1000  break;
1001 
1002  case 6:
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) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
1012  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // 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) && ( (bachelor->P()<fLowPtCut && TMath::Abs(nTPCsigmas)<2) || (bachelor->P()>=fHighPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
1021  isBachelorID2 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && bachelor->P()<fHighPtCut && trackIDByTOF) || (bachelor->P()>=fHighPtCut && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
1022 
1023  isBachelorID4 = isBachelorID2; // Lambda case
1024 
1025  break;
1026 
1027  case 7:
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()>=fLowPtCut && tofID!=1 && TMath::Abs(nTPCsigmas)<3) ) );
1037  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (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 && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
1047 
1048  isBachelorID4 = isBachelorID2; // Lambda case
1049 
1050  break;
1051 
1052  case 8:
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()>=fLowPtCut && tofID!=1 && nTPCsigmas>-3 && nTPCsigmas<2) ) );
1062  isBachelorID1 = (bachelor->P()<fLowPtCut && trackIDByTPC) || (bachelor->P()>=fLowPtCut && (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 && (trackIDByTOF || trackIDByTPC) ); // LambdaBar case
1072 
1073  isBachelorID4 = isBachelorID2; // Lambda case
1074 
1075  break;
1076 
1077  case 9:
1078  {
1079  // identify bachelor
1080  fPidHF->GetPidCombined()->SetDefaultTPCPriors();
1081  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
1082  Double_t probTPCTOF[AliPID::kSPECIES]={-1.};
1083  UInt_t detUsed = fPidHF->GetPidCombined()->ComputeProbabilities(bachelor, fPidHF->GetPidResponse(), probTPCTOF);
1084  Double_t probProton = -1.;
1085  Double_t probPion = -1.;
1086  if (detUsed == (UInt_t)fPidHF->GetPidCombined()->GetDetectorMask() ) {
1087  probProton = probTPCTOF[AliPID::kProton];
1088  probPion = probTPCTOF[AliPID::kPion];
1089  }
1090  else { // if you don't have both TOF and TPC, try only TPC
1091  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
1092  detUsed = fPidHF->GetPidCombined()->ComputeProbabilities(bachelor, fPidHF->GetPidResponse(), probTPCTOF);
1093  if (detUsed == (UInt_t)fPidHF->GetPidCombined()->GetDetectorMask()) {
1094  probProton = probTPCTOF[AliPID::kProton];
1095  probPion = probTPCTOF[AliPID::kPion];
1096  }
1097  fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC+AliPIDResponse::kDetTOF);
1098  }
1099 
1100  Double_t pBachelor = bachelor->P();
1101  Int_t bachelorPBin = GetBachelorPBin(pBachelor);
1102  if (bachelorPBin==-1) {
1103  nTPCsigmas = -999;
1104  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
1105  isBachelorID1=TMath::Abs(nTPCsigmas)<fNTPCSigmaCutForPreselection; // K0S case
1106  nTPCsigmas = -999;
1107  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
1108  isBachelorID2=TMath::Abs(nTPCsigmas)<fNTPCSigmaCutForPreselection; // LambdaBar case
1109  } else {
1110  nTPCsigmas = -999;
1111  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
1112  isBachelorID1=(TMath::Abs(nTPCsigmas)<fNTPCSigmaCutForPreselection && probProton>fMinCombProb[bachelorPBin]); // K0S case
1113  nTPCsigmas = -999;
1114  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
1115  isBachelorID2=(TMath::Abs(nTPCsigmas)<fNTPCSigmaCutForPreselection && probPion>fMinCombProb[bachelorPBin]); // LambdaBar case
1116  }
1117  isBachelorID4 = isBachelorID2; // Lambda case
1118  }
1119  break;
1120 
1121  case 10:
1122 
1123  // identify bachelor
1124  nTOFsigmas = -999;
1125  tofID = fPidHF->GetnSigmaTOF(bachelor,4,nTOFsigmas);
1126  nTPCsigmas = -999;
1127  tpcID = fPidHF->GetnSigmaTPC(bachelor,4,nTPCsigmas);
1128 
1129  isBachelorID1 = kFALSE;
1130  if((tpcID==1)&&(tofID==1)&&(TMath::Abs(nTPCsigmas)<3.)&&(TMath::Abs(nTOFsigmas)<3.)){
1131  isBachelorID1 = !(bachelor->Pt()>fLowPtCut&& nTOFsigmas<-2.) && !(bachelor->Pt()>fLowPtCut&& nTPCsigmas>2.);
1132  }
1133 
1134  nTOFsigmas = -999;
1135  tofID = fPidHF->GetnSigmaTOF(bachelor,2,nTOFsigmas);
1136  nTPCsigmas = -999;
1137  tpcID = fPidHF->GetnSigmaTPC(bachelor,2,nTPCsigmas);
1138 
1139  isBachelorID2 = TMath::Abs(nTPCsigmas)<3. && TMath::Abs(nTOFsigmas)<3. && (tpcID==1)&&(tofID==1);
1140  isBachelorID4 = isBachelorID2;
1141 
1142  break;
1143 
1144  }
1145 
1146 }
1147 //----------------
1148 Int_t AliRDHFCutsLctoV0::CombineCuts(Int_t returnvalueTrack, Int_t returnvalue, Int_t returnvaluePID) const {
1149  //
1150  // combine track selection, topological cuts and PID
1151  //
1152 
1153  Int_t returnvalueTot=returnvalueTrack&returnvalue;
1154  returnvalueTot=returnvalueTot&returnvaluePID;
1155 
1156  return returnvalueTot;
1157 }
1158 
1159 //----------------------------------
1161  //
1162  // Apply selection on single cut
1163  //
1164 
1165  if (!fCutsRD) {
1166  AliDebug(2,"Cut matrice not inizialized. Exit...");
1167  return 0;
1168  }
1169 
1171  if (!d) {
1172  AliDebug(2,"AliAODRecoCascadeHF null");
1173  return 0;
1174  }
1175 
1176  if (!d->GetSecondaryVtx()) {
1177  AliDebug(2,"No secondary vertex for cascade");
1178  return 0;
1179  }
1180 
1181  if (d->GetNDaughters()!=2) {
1182  AliDebug(2,Form("No 2 daughters for current cascade (nDaughters=%d)",d->GetNDaughters()));
1183  return 0;
1184  }
1185 
1186  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
1187  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
1188  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return 0;
1189 
1190  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
1191  if (!v0 || !bachelorTrack) {
1192  AliDebug(2,"No V0 or no bachelor for current cascade");
1193  return 0;
1194  }
1195 
1196  if (bachelorTrack->GetID()<0) {
1197  AliDebug(2,Form("Bachelor has negative ID %d",bachelorTrack->GetID()));
1198  return 0;
1199  }
1200 
1201  if (!v0->GetSecondaryVtx()) {
1202  AliDebug(2,"No secondary vertex for V0 by cascade");
1203  return 0;
1204  }
1205 
1206  if (v0->GetNDaughters()!=2) {
1207  AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0->GetOnFlyStatus(),v0->GetNDaughters()));
1208  return 0;
1209  }
1210 
1211 
1212  // Get the V0 daughter tracks
1213  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
1214  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
1215  if (!v0positiveTrack || !v0negativeTrack ) {
1216  AliDebug(2,"No V0 daughters' objects");
1217  return 0;
1218  }
1219 
1220  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
1221  AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",v0positiveTrack->GetID(),v0negativeTrack->GetID()));
1222  return 0;
1223  }
1224 
1225  //if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
1226  if ( fUseTrackSelectionWithFilterBits && !(bachelorTrack->TestFilterMask(BIT(4))) ) {
1227  AliDebug(2,"Check on the bachelor FilterBit: no BIT(4). Candidate rejected.");
1228  return 0;
1229  }
1230 
1231 
1232  // selection on daughter tracks
1233  if (selectionLevel==AliRDHFCuts::kAll ||
1234  selectionLevel==AliRDHFCuts::kTracks) {
1235 
1236  if (!AreLctoV0DaughtersSelected(d,aod)) return 0;
1237 
1238  }
1239 
1240  Bool_t okLck0sp=kFALSE, okLcLpi=kFALSE, okLcLBarpi=kFALSE;
1241 
1242  // selection on candidate
1243  if (selectionLevel==AliRDHFCuts::kAll ||
1244  selectionLevel==AliRDHFCuts::kCandidate) {
1245 
1246  Double_t pt = d->Pt();
1247  Int_t ptbin = PtBin(pt);
1248 
1249  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
1250  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
1251  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
1252 
1253  // K0S + p
1254  Double_t mk0s = v0->MassK0Short();
1255  Double_t mLck0sp = d->InvMassLctoK0sP();
1256 
1257  // Lambda + pi
1258  Double_t mlambda = v0->MassLambda();
1259  Double_t malambda = v0->MassAntiLambda();
1260  Double_t mLcLpi = d->InvMassLctoLambdaPi();
1261 
1262  switch (cutIndex) {
1263  case 0:
1264  // cut on Lc mass with K0S+p hypothesis
1265  okLck0sp = TMath::Abs(mLck0sp-mLcPDG)<=fCutsRD[GetGlobalIndex(0,ptbin)];
1266  okLcLpi = kFALSE;
1267  okLcLBarpi = kFALSE;
1268  break;
1269  case 1:
1270  // cut on Lc mass with Lambda+pi hypothesis
1271  okLck0sp = kFALSE;
1272  okLcLpi = TMath::Abs(mLcLpi-mLcPDG)<=fCutsRD[GetGlobalIndex(1,ptbin)];
1273  okLcLBarpi = okLcLpi;
1274  break;
1275  case 2:
1276  // cuts on the V0 mass: K0S case
1277  okLck0sp = TMath::Abs(mk0s-mk0sPDG)<=fCutsRD[GetGlobalIndex(2,ptbin)];
1278  okLcLpi = kFALSE;
1279  okLcLBarpi = kFALSE;
1280  break;
1281  case 3:
1282  // cuts on the V0 mass: Lambda/LambdaBar case
1283  okLck0sp = kFALSE;
1284  okLcLpi = TMath::Abs(mlambda-mLPDG)<=fCutsRD[GetGlobalIndex(3,ptbin)];
1285  //okLcLpi = okLcLpi && (bachelorTrack->Charge()==+1);
1286  okLcLBarpi = TMath::Abs(malambda-mLPDG)<=fCutsRD[GetGlobalIndex(3,ptbin)];
1287  //okLcLBarpi = okLcLBarpi && (bachelorTrack->Charge()==-1);
1288  break;
1289  case 4:
1290  // cuts on the minimum pt of bachelor
1291  okLck0sp = TMath::Abs(bachelorTrack->Pt())>=fCutsRD[GetGlobalIndex(4,ptbin)];
1292  okLcLpi = okLck0sp;
1293  okLcLBarpi = okLck0sp;
1294  break;
1295  case 5:
1296  // cuts on the minimum pt of positive V0daughter
1297  okLck0sp = TMath::Abs(v0positiveTrack->Pt())>=fCutsRD[GetGlobalIndex(5,ptbin)];
1298  okLcLpi = okLck0sp;
1299  okLcLBarpi = okLck0sp;
1300  break;
1301  case 6:
1302  // cuts on the minimum pt of negative V0daughter
1303  okLck0sp = TMath::Abs(v0negativeTrack->Pt())>=fCutsRD[GetGlobalIndex(6,ptbin)];
1304  okLcLpi = okLck0sp;
1305  okLcLBarpi = okLck0sp;
1306  break;
1307  case 7:
1308  // cut on cascade dca
1309  okLck0sp = TMath::Abs(d->GetDCA())<=fCutsRD[GetGlobalIndex(7,ptbin)];
1310  okLcLpi = okLck0sp;
1311  okLcLBarpi = okLck0sp;
1312  break;
1313  case 8:
1314  // cut on V0 dca
1315  okLck0sp = TMath::Abs(v0->GetDCA())<=fCutsRD[GetGlobalIndex(8,ptbin)];
1316  okLcLpi = okLck0sp;
1317  okLcLBarpi = okLck0sp;
1318  break;
1319  case 9:
1320  // cut on V0 cosine of pointing angle wrt PV
1321  okLck0sp = d->CosV0PointingAngle()>=fCutsRD[GetGlobalIndex(9,ptbin)];
1322  okLcLpi = okLck0sp;
1323  okLcLBarpi = okLck0sp;
1324  break;
1325  case 10:
1326  // cut on bachelor transverse impact parameter wrt PV
1327  okLck0sp = TMath::Abs(d->Getd0Prong(0))<=fCutsRD[GetGlobalIndex(10,ptbin)];
1328  okLcLpi = okLck0sp;
1329  okLcLBarpi = okLck0sp;
1330  break;
1331  case 11:
1332  // cut on V0 transverse impact parameter wrt PV
1333  okLck0sp = TMath::Abs(d->Getd0Prong(1))<=fCutsRD[GetGlobalIndex(11,ptbin)];
1334  okLcLpi = okLck0sp;
1335  okLcLBarpi = okLck0sp;
1336  break;
1337  case 12:
1338  // cut on K0S invariant mass veto
1339  okLcLpi = TMath::Abs(mk0s-mk0sPDG)>=fCutsRD[GetGlobalIndex(12,ptbin)];
1340  okLcLBarpi = TMath::Abs(mk0s-mk0sPDG)>=fCutsRD[GetGlobalIndex(12,ptbin)];
1341  break;
1342  case 13:
1343  // cut on Lambda/LambdaBar invariant mass veto
1344  okLck0sp = (TMath::Abs(mlambda-mLPDG)>=fCutsRD[GetGlobalIndex(13,ptbin)] &&
1345  TMath::Abs(malambda-mLPDG)>=fCutsRD[GetGlobalIndex(13,ptbin)]);
1346  break;
1347  case 14:
1348  // cut on gamma invariant mass veto
1349  okLck0sp = v0->InvMass2Prongs(0,1,11,11)>=fCutsRD[GetGlobalIndex(14,ptbin)];
1350  okLcLpi = okLck0sp;
1351  okLcLBarpi = okLck0sp;
1352  break;
1353  case 15:
1354  // cut on V0 pT min
1355  okLck0sp = v0->Pt()>=fCutsRD[GetGlobalIndex(15,ptbin)];
1356  okLcLpi = okLck0sp;
1357  okLcLBarpi = okLck0sp;
1358  break;
1359  case 16:
1360  okLck0sp = (TMath::Abs(fCutsRD[GetGlobalIndex(16,ptbin)])<1.1)&&(GetProtonEmissionAngleCMS(d)<= fCutsRD[GetGlobalIndex(16,ptbin)]);
1361  okLcLpi = okLck0sp;
1362  okLcLBarpi = okLck0sp;
1363  break;
1364  case 17:
1365  okLck0sp = (TMath::Abs(fCutsRD[GetGlobalIndex(17,ptbin)])<1.1)&&(GetProtonEmissionAngleCMS(d)>= fCutsRD[GetGlobalIndex(17,ptbin)]);
1366  okLcLpi = okLck0sp;
1367  okLcLBarpi = okLck0sp;
1368  break;
1369  case 18:
1370  okLck0sp = (TMath::Abs(fCutsRD[GetGlobalIndex(18,ptbin)])<0.2)&&(GetReSignedd0(d)>= fCutsRD[GetGlobalIndex(18,ptbin)]);
1371  okLcLpi = okLck0sp;
1372  okLcLBarpi = okLck0sp;
1373  break;
1374  case 19:
1375  okLck0sp = (TMath::Abs(fCutsRD[GetGlobalIndex(19,ptbin)])<0.3)&&(v0->PtArmV0()/TMath::Abs(v0->AlphaV0()) >= fCutsRD[GetGlobalIndex(19,ptbin)]);
1376  okLcLpi = okLck0sp;
1377  okLcLBarpi = okLck0sp;
1378  break;
1379  }
1380  }
1381 
1382  Int_t returnvalue = okLck0sp+2*okLcLBarpi+4*okLcLpi;
1383  /*
1384  retvalue case
1385  1 Lc->K0S + p
1386  2 Lc->LambdaBar + pi
1387  3 Lc->K0S + p AND Lc->LambdaBar + pi
1388  4 Lc->Lambda + pi
1389  5 Lc->K0S + p AND Lc->Lambda + pi
1390  6 Lc->LambdaBar + pi AND Lc->Lambda + pi
1391  7 Lc->K0S + p AND Lc->LambdaBar + pi AND Lc->Lambda + pi
1392  */
1393 
1394 
1395  /*
1396  Int_t returnvaluePID = 7;
1397 
1398  // selection on PID
1399  if (selectionLevel==AliRDHFCuts::kAll ||
1400  selectionLevel==AliRDHFCuts::kCandidate ||
1401  selectionLevel==AliRDHFCuts::kPID )
1402  returnvaluePID = IsSelectedPID(d);
1403  */
1404 
1405  Int_t returnvalueTot = 0;
1406  //if ( fUsePID )
1407  //returnvalueTot = CombineCuts(returnvalue,returnvaluePID);
1408  //else
1409  returnvalueTot = returnvalue;
1410 
1411  return returnvalueTot;
1412 
1413 }
1414 //----------------------------------
1416 
1417  SetName("LctoV0ProductionCuts");
1418  SetTitle("Production cuts for Lc->V0+bachelor analysis");
1419 
1420  AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
1421  esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1422  //default
1423  esdTrackCuts->SetRequireTPCRefit(kTRUE);
1424  esdTrackCuts->SetRequireITSRefit(kTRUE);
1425  esdTrackCuts->SetMinNClustersITS(0);//(4); // default is 5
1426  esdTrackCuts->SetMinNClustersTPC(70);
1427  //esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1428  // AliESDtrackCuts::kAny);
1429  // default is kBoth, otherwise kAny
1430  esdTrackCuts->SetMinDCAToVertexXY(0.);
1431  esdTrackCuts->SetPtRange(0.3,1.e10);
1432  //esdTrackCuts->SetEtaRange(-0.8,+0.8);
1433  esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
1434  AddTrackCuts(esdTrackCuts);
1435  delete esdTrackCuts;
1436  esdTrackCuts=NULL;
1437 
1438 
1439  AliESDtrackCuts* esdTrackCutsV0daughters=new AliESDtrackCuts();
1440  esdTrackCutsV0daughters->SetRequireSigmaToVertex(kFALSE);
1441  //default
1442  esdTrackCutsV0daughters->SetRequireTPCRefit(kTRUE);
1443  esdTrackCutsV0daughters->SetRequireITSRefit(kFALSE);//(kTRUE);
1444  esdTrackCutsV0daughters->SetMinNClustersITS(0);//(4); // default is 5
1445  esdTrackCutsV0daughters->SetMinNClustersTPC(70);
1446  //esdTrackCutsV0daughters->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1447  // AliESDtrackCuts::kAny);
1448  // default is kBoth, otherwise kAny
1449  esdTrackCutsV0daughters->SetMinDCAToVertexXY(0.);
1450  esdTrackCutsV0daughters->SetPtRange(0.,1.e10);
1451  esdTrackCutsV0daughters->SetAcceptKinkDaughters(kFALSE);
1452  AddTrackCutsV0daughters(esdTrackCutsV0daughters);
1453  delete esdTrackCutsV0daughters;
1454  esdTrackCutsV0daughters=NULL;
1455 
1456  const Int_t nptbins=1;
1457  Float_t* ptbins;
1458  ptbins=new Float_t[nptbins+1];
1459  ptbins[0]=0.;
1460  ptbins[1]=99999999.;
1461 
1462  SetPtBins(nptbins+1,ptbins);
1463  SetPtBins(nptbins+1,ptbins);
1464 
1465  const Int_t nvars=21;
1466 
1467  Float_t** prodcutsval;
1468  prodcutsval=new Float_t*[nvars];
1469  for(Int_t ic=0;ic<nvars;ic++){prodcutsval[ic]=new Float_t[nptbins];}
1470  for(Int_t ipt2=0;ipt2<nptbins;ipt2++){
1471  prodcutsval[0][ipt2]=1.; // inv. mass if K0S [GeV/c2]
1472  prodcutsval[1][ipt2]=1.; // inv. mass if Lambda [GeV/c2]
1473  prodcutsval[2][ipt2]=0.05; // inv. mass V0 if K0S [GeV/c2]
1474  prodcutsval[3][ipt2]=0.05; // inv. mass V0 if Lambda [GeV/c2]
1475  prodcutsval[4][ipt2]=0.3; // pT min bachelor track [GeV/c] // AOD by construction
1476  prodcutsval[5][ipt2]=0.; // pT min V0-positive track [GeV/c]
1477  prodcutsval[6][ipt2]=0.; // pT min V0-negative track [GeV/c]
1478  prodcutsval[7][ipt2]=1000.; // dca cascade cut [cm]
1479  prodcutsval[8][ipt2]=1.5; // dca V0 cut [nSigma] // it's 1.5 x offline V0s
1480  prodcutsval[9][ipt2]=-1.; // cosPA V0 cut // it's 0.90 x offline V0s at reconstruction level, 0.99 at filtering level
1481  prodcutsval[10][ipt2]=3.; // d0 max bachelor wrt PV [cm]
1482  prodcutsval[11][ipt2]=1000.;// d0 max V0 wrt PV [cm]
1483  prodcutsval[12][ipt2]=0.; // mass K0S veto [GeV/c2]
1484  prodcutsval[13][ipt2]=0.; // mass Lambda/LambdaBar veto [GeV/c2]
1485  prodcutsval[14][ipt2]=0.; // mass Gamma veto [GeV/c2]
1486  prodcutsval[15][ipt2]=0.; // pT min V0 track [GeV/c]
1487  prodcutsval[16][ipt2]=9999.;// max cos (Proton emission angle) cut
1488  prodcutsval[17][ipt2]=-9999.;// min cos (Proton emission angle) cut
1489  prodcutsval[18][ipt2]=-9999.;// Re-signed d0 [cm]
1490  prodcutsval[19][ipt2]=-9999.;// V0 armenteros qT/|alpha|
1491  prodcutsval[20][ipt2]=0.; // V0 type cut
1492  }
1493  SetCuts(nvars,nptbins,prodcutsval);
1494 
1495  SetGlobalIndex(nvars,nptbins);
1496  SetPtBins(nptbins+1,ptbins);
1497 
1498 
1499  //pid settings
1500  //1. bachelor: default one
1501  AliAODPidHF* pidObjBachelor = new AliAODPidHF();
1502  Double_t sigmasBac[5]={3.,1.,1.,3.,3.}; // 0, 1(A), 2(A) -> TPC; 3 -> TOF; 4 -> ITS
1503  pidObjBachelor->SetSigma(sigmasBac);
1504  pidObjBachelor->SetAsym(kFALSE);
1505  pidObjBachelor->SetMatch(1);
1506  pidObjBachelor->SetTPC(kTRUE);
1507  pidObjBachelor->SetTOF(kTRUE);
1508  pidObjBachelor->SetTOFdecide(kFALSE);
1509  SetPidHF(pidObjBachelor);
1510 
1511  SetUsePID(kFALSE);//(kTRUE);
1512 
1513  //PrintAll();
1514 
1515  for(Int_t iiv=0;iiv<nvars;iiv++){
1516  delete [] prodcutsval[iiv];
1517  }
1518  delete [] prodcutsval;
1519  prodcutsval=NULL;
1520  delete [] ptbins;
1521  ptbins=NULL;
1522 
1523 
1524  delete pidObjBachelor;
1525  pidObjBachelor=NULL;
1526 
1527  return;
1528 }
1529 //------------------
1531 
1532  SetName("LctoV0ProductionCuts");
1533  SetTitle("Production cuts for Lc->V0+bachelor analysis");
1534 
1536 
1537  return;
1538 }
1539 //------------------
1541 
1542  // Default 2010 PbPb cut object
1544 
1545  //
1546  // Enable all 2011 PbPb run triggers
1547  //
1548  SetTriggerClass("");
1552 
1553 }
1554 //-----------------------
1556 
1557  const Int_t nvars = this->GetNVars() ;
1558  //Float_t *vArray =GetCuts();
1559  //fV0Type = vArray[nvars-1];
1560  fV0Type = (this->GetCuts())[nvars-1];
1561  //this->GetCuts(vArray);
1562  TString *sVarNames=GetVarNames();
1563 
1564  if(sVarNames[nvars-1].Contains("V0 type")) return (Int_t)fV0Type;
1565  else {AliInfo("AliRDHFCutsLctoV0 Last variable is not the V0 type!!!"); return -999;}
1566 }
1567 
1568 //---------------------------------------------------------------------------
1570  //
1571  // print all cuts values
1572  //
1573 
1574  printf("Minimum vtx type %d\n",fMinVtxType);
1575  printf("Minimum vtx contr %d\n",fMinVtxContr);
1576  printf("Max vtx red chi2 %f\n",fMaxVtxRedChi2);
1577  printf("Min SPD mult %d\n",fMinSPDMultiplicity);
1578  printf("Use PID %d (PID selection flag = %d) OldPid=%d\n",(Int_t)fUsePID,(Int_t)fPidSelectionFlag,fPidHF ? fPidHF->GetOldPid() : -1);
1579  printf("High value for pT %f\n",fHighPtCut);
1580  printf("Low and high values for pT cuts: %f %f\n",fLowPtCut,fHighPtCut);
1581  printf("Remove daughters from vtx %d\n",(Int_t)fRemoveDaughtersFromPrimary);
1582  printf("Physics selection: %s\n",fUsePhysicsSelection ? "Yes" : "No");
1583  printf("Pileup rejection: %s\n",(fOptPileup > 0) ? "Yes" : "No");
1584  printf("UseTrackSelectionWithFilterBits: %s\n",fUseTrackSelectionWithFilterBits ? "Yes" : "No");
1585  printf("Reject kink: %s\n",fKinkReject ? "Yes" : "No");
1586  if(fOptPileup==1) printf(" -- Reject pileup event");
1587  if(fOptPileup==2) printf(" -- Reject tracks from pileup vtx");
1588  if(fUseCentrality>0) {
1589  TString estimator="";
1590  if(fUseCentrality==1) estimator = "V0";
1591  if(fUseCentrality==2) estimator = "Tracks";
1592  if(fUseCentrality==3) estimator = "Tracklets";
1593  if(fUseCentrality==4) estimator = "SPD clusters outer";
1594  printf("Centrality class considered: %.1f-%.1f, estimated with %s",fMinCentrality,fMaxCentrality,estimator.Data());
1595  }
1596  if(fIsCandTrackSPDFirst) printf("Check for candidates with pt < %2.2f, that daughters fullfill kFirst criteria\n",fMaxPtCandTrackSPDFirst);
1597 
1598  if(fVarNames){
1599  cout<<"Array of variables"<<endl;
1600  for(Int_t iv=0;iv<fnVars;iv++){
1601  cout<<fVarNames[iv]<<"\t";
1602  }
1603  cout<<endl;
1604  }
1605  if(fVarsForOpt){
1606  cout<<"Array of optimization"<<endl;
1607  for(Int_t iv=0;iv<fnVars;iv++){
1608  cout<<fVarsForOpt[iv]<<"\t";
1609  }
1610  cout<<endl;
1611  }
1612  if(fIsUpperCut){
1613  cout<<"Array of upper/lower cut"<<endl;
1614  for(Int_t iv=0;iv<fnVars;iv++){
1615  cout<<fIsUpperCut[iv]<<"\t";
1616  }
1617  cout<<endl;
1618  }
1619  if(fPtBinLimits){
1620  cout<<"Array of ptbin limits"<<endl;
1621  for(Int_t ib=0;ib<fnPtBinLimits;ib++){
1622  cout<<fPtBinLimits[ib]<<"\t";
1623  }
1624  cout<<endl;
1625  }
1626  if(fCutsRD){
1627  cout<<"Matrix of cuts"<<endl;
1628  for(Int_t iv=0;iv<fnVars;iv++){
1629  for(Int_t ib=0;ib<fnPtBins;ib++){
1630  cout<<"fCutsRD["<<iv<<"]["<<ib<<"] = "<<fCutsRD[GetGlobalIndex(iv,ib)]<<"\t";
1631  }
1632  cout<<endl;
1633  }
1634  cout<<endl;
1635  }
1636 
1637  if (fPidSelectionFlag==9) {
1638 
1639  cout << " fNBachelorPBins = " << fNBachelorPBins << endl;
1640 
1641  for(Int_t ib=0;ib<fNBachelorPBins-1;ib++){
1642  cout<<"fMinCombProb["<<ib<<"] = "<<fMinCombProb[ib]<<"\t"
1643  <<"(" << fBachelorPLimitsForPID[ib] << "<= p < "<< fBachelorPLimitsForPID[ib+1]<< ")\n";
1644  }
1645  cout<<"fMinCombProb["<<fNBachelorPBins-1<<"] = "<<fMinCombProb[fNBachelorPBins-1]<<"\t"
1646  <<"(p>= " << fBachelorPLimitsForPID[fNBachelorPBins-1] << ")\n";
1647  cout<<endl;
1648  cout << " GetCombDetectors() = " << GetPidHF()->GetCombDetectors() << endl;
1649  }
1650 
1651  cout << " fNTPCSigmaCutForPreselection = " << fNTPCSigmaCutForPreselection << endl;
1652 
1653  if (fTrackCuts) {
1654  Float_t eta1=0, eta2=0; fTrackCuts->GetEtaRange(eta1,eta2);
1655  cout << " etaRange for Bachelor: [" << eta1 << "," << eta2 << "]\n";
1656  }
1657  if (fV0daughtersCuts) {
1658  Float_t eta3=0, eta4=0; fV0daughtersCuts->GetEtaRange(eta3,eta4);
1659  cout << " etaRange for V0daughters: [" << eta3 << "," << eta4 << "]\n";
1660  }
1661  return;
1662 
1663 }
1664 
1665 //-------------------------
1667 {
1668  //
1669  //
1670  // Checking if Lc is in fiducial acceptance region
1671  //
1672  //
1673 
1674  if(fMaxRapidityCand>-998.){
1675  if(TMath::Abs(y) > fMaxRapidityCand) return kFALSE;
1676  else return kTRUE;
1677  }
1678 
1679  if(pt > 5.) {
1680  // applying cut for pt > 5 GeV
1681  AliDebug(2,Form("pt of Lambda_c = %f (> 5), cutting at |y| < 0.8",pt));
1682  if (TMath::Abs(y) > 0.8) return kFALSE;
1683 
1684  } else {
1685  // appliying smooth cut for pt < 5 GeV
1686  Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
1687  Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
1688  AliDebug(2,Form("pt of Lambda_c = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
1689  if (y < minFiducialY || y > maxFiducialY) return kFALSE;
1690  }
1691  //
1692  return kTRUE;
1693 }
1694 //---------------------------------------------------------------------------
1696  //
1697  // Daughter tracks selection
1698  //
1699 
1701  if (!d) {
1702  AliDebug(2,"AliAODRecoCascadeHF null");
1703  return kFALSE;
1704  }
1705 
1706  if (!fTrackCuts) {
1707  AliFatal("Cut object is not defined for bachelor. Candidate accepted.");
1708  return kFALSE;
1709  }
1710 
1711  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
1712  if (!bachelorTrack) return kFALSE;
1713 
1715  if(!bachelorTrack->HasPointOnITSLayer(0)) return kFALSE;
1716  }
1717 
1718  if (fKinkReject != (!(fTrackCuts->GetAcceptKinkDaughters())) ) {
1719  AliError(Form("Not compatible setting: fKinkReject=%1d - fTrackCuts->GetAcceptKinkDaughters()=%1d",fKinkReject, fTrackCuts->GetAcceptKinkDaughters()));
1720  return kFALSE;
1721  }
1722 
1723  AliAODVertex *vAOD = d->GetPrimaryVtx();
1724  Double_t pos[3]; vAOD->GetXYZ(pos);
1725  Double_t cov[6]; vAOD->GetCovarianceMatrix(cov);
1726  const AliESDVertex vESD(pos,cov,100.,100);
1727 
1728  if (!IsDaughterSelected(bachelorTrack,&vESD,fTrackCuts,aod)) return kFALSE;
1729 
1730  if (!fV0daughtersCuts) {
1731  AliFatal("Cut object is not defined for V0daughters. Candidate accepted.");
1732  return kFALSE;
1733  }
1734 
1735  AliAODv0 * v0 = dynamic_cast<AliAODv0*>(d->Getv0());
1736  if (!v0) return kFALSE;
1737  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(d->Getv0PositiveTrack());
1738  if (!v0positiveTrack) return kFALSE;
1739  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(d->Getv0NegativeTrack());
1740  if (!v0negativeTrack) return kFALSE;
1741 
1742 
1743  Float_t etaMin=0, etaMax=0; fV0daughtersCuts->GetEtaRange(etaMin,etaMax);
1744  if ( (v0positiveTrack->Eta()<=etaMin || v0positiveTrack->Eta()>=etaMax) ||
1745  (v0negativeTrack->Eta()<=etaMin || v0negativeTrack->Eta()>=etaMax) ) return kFALSE;
1746  Float_t ptMin=0, ptMax=0; fV0daughtersCuts->GetPtRange(ptMin,ptMax);
1747  if ( (v0positiveTrack->Pt()<=ptMin || v0positiveTrack->Pt()>=ptMax) ||
1748  (v0negativeTrack->Pt()<=ptMin || v0negativeTrack->Pt()>=ptMax) ) return kFALSE;
1749 
1750  // Condition on nTPCclusters
1751  if (fV0daughtersCuts->GetMinNClusterTPC()>0) {
1752  if ( ( ( v0positiveTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ||
1753  ( ( v0negativeTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ) return kFALSE;
1754  }
1755 
1756  if (fV0daughtersCuts->GetMinRatioCrossedRowsOverFindableClustersTPC()>0.5) {
1757  Float_t ratioCrossedRowsOverFindableClustersTPCPos = 1.0;
1758  Float_t ratioCrossedRowsOverFindableClustersTPCNeg = 1.0;
1759  if (v0positiveTrack->GetTPCNclsF()>0) {
1760  ratioCrossedRowsOverFindableClustersTPCPos = v0positiveTrack->GetTPCClusterInfo(2,1) / v0positiveTrack->GetTPCNclsF();
1761  }
1762  if (v0negativeTrack->GetTPCNclsF()>0) {
1763  ratioCrossedRowsOverFindableClustersTPCNeg = v0negativeTrack->GetTPCClusterInfo(2,1) / v0negativeTrack->GetTPCNclsF();
1764  }
1765  if ( ( ( ratioCrossedRowsOverFindableClustersTPCPos ) < fV0daughtersCuts->GetMinRatioCrossedRowsOverFindableClustersTPC() ) ||
1766  ( ( ratioCrossedRowsOverFindableClustersTPCNeg ) < fV0daughtersCuts->GetMinRatioCrossedRowsOverFindableClustersTPC() ) ) return kFALSE;
1767  }
1768 
1769  // kTPCrefit status
1770  if (v0->GetOnFlyStatus()==kFALSE) { // only for offline V0s
1771  if (fV0daughtersCuts->GetRequireTPCRefit()) {
1772  if( !(v0positiveTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
1773  if( !(v0negativeTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
1774  }
1775  }
1776  // kink condition
1777  if (!fV0daughtersCuts->GetAcceptKinkDaughters()) {
1778  AliAODVertex *maybeKinkPos = (AliAODVertex*)v0positiveTrack->GetProdVertex();
1779  AliAODVertex *maybeKinkNeg = (AliAODVertex*)v0negativeTrack->GetProdVertex();
1780  if (maybeKinkPos->GetType()==AliAODVertex::kKink ||
1781  maybeKinkNeg->GetType()==AliAODVertex::kKink) return kFALSE;
1782  }
1783  // Findable clusters > 0 condition - from V0 analysis
1784  //if( v0positiveTrack->GetTPCNclsF()<=0 || v0negativeTrack->GetTPCNclsF()<=0 ) return kFALSE;
1785  /*
1786  Float_t lPosTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
1787  Float_t lNegTrackCrossedRows = v0positiveTrack->GetTPCClusterInfo(2,1);
1788  fTreeVariableLeastNbrCrossedRows = (Int_t) lPosTrackCrossedRows;
1789  if( lNegTrackCrossedRows < fTreeVariableLeastNbrCrossedRows )
1790  fTreeVariableLeastNbrCrossedRows = (Int_t) lNegTrackCrossedRows;
1791  //Compute ratio Crossed Rows / Findable clusters
1792  //Note: above test avoids division by zero!
1793  Float_t lPosTrackCrossedRowsOverFindable = lPosTrackCrossedRows / ((double)(pTrack->GetTPCNclsF()));
1794  Float_t lNegTrackCrossedRowsOverFindable = lNegTrackCrossedRows / ((double)(nTrack->GetTPCNclsF()));
1795  fTreeVariableLeastRatioCrossedRowsOverFindable = lPosTrackCrossedRowsOverFindable;
1796  if( lNegTrackCrossedRowsOverFindable < fTreeVariableLeastRatioCrossedRowsOverFindable )
1797  fTreeVariableLeastRatioCrossedRowsOverFindable = lNegTrackCrossedRowsOverFindable;
1798  //Lowest Cut Level for Ratio Crossed Rows / Findable = 0.8, set here
1799  if ( fTreeVariableLeastRatioCrossedRowsOverFindable < 0.8 ) return kFALSE;
1800  */
1801 
1802  return kTRUE;
1803 
1804 }
1805 
1806 //---------------------------------------------------------------------------
1808  //
1809  // store the combined probability cuts
1810  //
1811 
1812  //if (fNBachelorPBins<=0)
1813  fNBachelorPBins=nPBins;
1814 
1815  if (fMinCombProb) delete [] fMinCombProb;
1817 
1818  for(Int_t ib=0; ib<fNBachelorPBins; ib++) {
1819  fMinCombProb[ib] = minProb[ib];
1820  }
1821  return;
1822 }
1823 
1824 //---------------------------------------------------------------------------
1826  //
1827  // store the bachelor p bin limits for combined probability cuts
1828  //
1829 
1830  //if (fNBachelorPBins<=0)
1831  fNBachelorPBins=nPBins;
1832 
1835 
1836  for(Int_t ib=0; ib<fNBachelorPBins; ib++) {
1837  fBachelorPLimitsForPID[ib] = pLimits[ib];
1838  }
1839  return;
1840 }
1841 
1842 //---------------------------------------------------------------------------
1844  //
1845  // Proton emission angle in p+K0s pair rest frame
1846  // This function is different from CosThetaStar function in AliAODRecoDecay,
1847  // which assumes the mass of Lc even for the pairs with the invariant mass
1848  // far from Lc mass
1849  //
1851  if (!d) {
1852  AliDebug(2,"AliAODRecoCascadeHF null");
1853  return -9999;
1854  }
1855  Double_t mprPDG = TDatabasePDG::Instance()->GetParticle(2212)->Mass();
1856  Double_t mlcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
1857  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
1858 
1859  TLorentzVector vpr, vk0s,vlc;
1860  vpr.SetXYZM(d->PxProng(0),d->PyProng(0),d->PzProng(0),mprPDG);
1861  vk0s.SetXYZM(d->PxProng(1),d->PyProng(1),d->PzProng(1),mk0sPDG);
1862  vlc = vpr + vk0s;
1863  TVector3 vboost = vlc.BoostVector();
1864  vpr.Boost(-vboost);
1865  Double_t bachcosthe = cos(vpr.Angle(vlc.Vect()));
1866 
1867  return bachcosthe;
1868 }
1869 
1870 //---------------------------------------------------------------------------
1872  //
1873  // Sign of d0 different from regular d0.
1874  // Sign defined using the position of crossing point with Lc vector
1875  // with respect to the primary vertex
1876  //
1878  if (!d) {
1879  AliDebug(2,"AliAODRecoCascadeHF null");
1880  return -9999;
1881  }
1882 
1883  AliAODTrack * bachelorTrack = dynamic_cast<AliAODTrack*>(d->GetBachelor());
1884  AliAODVertex *primvert = dynamic_cast<AliAODVertex*>(d->GetPrimaryVtx());
1885 
1886  Double_t d0z0bach[2],covd0z0bach[3];
1887  bachelorTrack->PropagateToDCA(primvert,fBzkG,kVeryBig,d0z0bach,covd0z0bach);
1888  Double_t tx[3];
1889  bachelorTrack->GetXYZ(tx);
1890  tx[0] -= primvert->GetX();
1891  tx[1] -= primvert->GetY();
1892  tx[2] -= primvert->GetZ();
1893  Double_t innerpro = tx[0]*d->Px()+tx[1]*d->Py();
1894  Double_t signd0 = 1.;
1895  if(innerpro<0.) signd0 = -1.;
1896 
1897  return signd0*TMath::Abs(d0z0bach[0]);
1898 }
1899 
1900 //---------------------------------------------------------------------------
1902  //
1903  // V0 selection
1904  //
1905 
1906  if(!v0){
1907  AliFatal("V0 object is NULL");
1908  return kFALSE;
1909  }
1910 
1911  if (!fV0daughtersCuts) {
1912  AliFatal("Cut object is not defined for V0daughters. Candidate accepted.");
1913  return kFALSE;
1914  }
1915 
1916  if ( v0 && ((v0->GetOnFlyStatus() == kTRUE && GetV0Type() == AliRDHFCuts::kOnlyOfflineV0s) ||
1917  (v0->GetOnFlyStatus() == kFALSE && GetV0Type() == AliRDHFCuts::kOnlyOnTheFlyV0s)) ) return kFALSE;
1918 
1919  if (!v0->GetSecondaryVtx()) {
1920  AliDebug(2,"No secondary vertex for V0 by cascade");
1921  return kFALSE;
1922  }
1923  if (v0->GetNDaughters()!=2) {
1924  AliDebug(2,Form("No 2 daughters for V0 of current cascade (onTheFly=%d, nDaughters=%d)",v0->GetOnFlyStatus(),v0->GetNDaughters()));
1925  return kFALSE;
1926  }
1927 
1928  // cuts on the V0 mass: K0S case
1929  Double_t mk0s = v0->MassK0Short();
1930  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
1931  Double_t maxcut_m = -9999;
1932  for(Int_t ip=0;ip<fnPtBins;ip++){
1933  if(fCutsRD[GetGlobalIndex(2,ip)]>maxcut_m) maxcut_m = fCutsRD[GetGlobalIndex(2,ip)];
1934  }
1935  if (TMath::Abs(mk0s-mk0sPDG) > maxcut_m) {
1936  return kFALSE;
1937  }
1938 
1939  // cut on V0 pT min
1940  Double_t mincut_p = 9999;
1941  for(Int_t ip=0;ip<fnPtBins;ip++){
1942  if(fCutsRD[GetGlobalIndex(15,ip)]<mincut_p) mincut_p = fCutsRD[GetGlobalIndex(15,ip)];
1943  }
1944  if (v0->Pt() < mincut_p) { // V0 pT min
1945  return kFALSE;
1946  }
1947 
1948  AliAODTrack *v0positiveTrack = dynamic_cast<AliAODTrack*>(v0->GetDaughter(0));
1949  if (!v0positiveTrack) return kFALSE;
1950  AliAODTrack *v0negativeTrack = dynamic_cast<AliAODTrack*>(v0->GetDaughter(1));
1951  if (!v0negativeTrack) return kFALSE;
1952 
1953 
1954  Float_t etaMin=0, etaMax=0; fV0daughtersCuts->GetEtaRange(etaMin,etaMax);
1955  if ( (v0positiveTrack->Eta()<=etaMin || v0positiveTrack->Eta()>=etaMax) ||
1956  (v0negativeTrack->Eta()<=etaMin || v0negativeTrack->Eta()>=etaMax) ) return kFALSE;
1957  Float_t ptMin=0, ptMax=0; fV0daughtersCuts->GetPtRange(ptMin,ptMax);
1958  if ( (v0positiveTrack->Pt()<=ptMin || v0positiveTrack->Pt()>=ptMax) ||
1959  (v0negativeTrack->Pt()<=ptMin || v0negativeTrack->Pt()>=ptMax) ) return kFALSE;
1960 
1961  // Condition on nTPCclusters
1962  if (fV0daughtersCuts->GetMinNClusterTPC()>0) {
1963  if ( ( ( v0positiveTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ||
1964  ( ( v0negativeTrack->GetTPCClusterInfo(2,1) ) < fV0daughtersCuts->GetMinNClusterTPC() ) ) return kFALSE;
1965  }
1966 
1967  if (fV0daughtersCuts->GetMinRatioCrossedRowsOverFindableClustersTPC()>0.5) {
1968  Float_t ratioCrossedRowsOverFindableClustersTPCPos = 1.0;
1969  Float_t ratioCrossedRowsOverFindableClustersTPCNeg = 1.0;
1970  if (v0positiveTrack->GetTPCNclsF()>0) {
1971  ratioCrossedRowsOverFindableClustersTPCPos = v0positiveTrack->GetTPCClusterInfo(2,1) / v0positiveTrack->GetTPCNclsF();
1972  }
1973  if (v0negativeTrack->GetTPCNclsF()>0) {
1974  ratioCrossedRowsOverFindableClustersTPCNeg = v0negativeTrack->GetTPCClusterInfo(2,1) / v0negativeTrack->GetTPCNclsF();
1975  }
1976  if ( ( ( ratioCrossedRowsOverFindableClustersTPCPos ) < fV0daughtersCuts->GetMinRatioCrossedRowsOverFindableClustersTPC() ) ||
1977  ( ( ratioCrossedRowsOverFindableClustersTPCNeg ) < fV0daughtersCuts->GetMinRatioCrossedRowsOverFindableClustersTPC() ) ) return kFALSE;
1978  }
1979 
1980  // kTPCrefit status
1981  if (v0->GetOnFlyStatus()==kFALSE) { // only for offline V0s
1982  if (fV0daughtersCuts->GetRequireTPCRefit()) {
1983  if( !(v0positiveTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
1984  if( !(v0negativeTrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
1985  }
1986  }
1987  // kink condition
1988  if (!fV0daughtersCuts->GetAcceptKinkDaughters()) {
1989  AliAODVertex *maybeKinkPos = (AliAODVertex*)v0positiveTrack->GetProdVertex();
1990  AliAODVertex *maybeKinkNeg = (AliAODVertex*)v0negativeTrack->GetProdVertex();
1991  if (maybeKinkPos->GetType()==AliAODVertex::kKink ||
1992  maybeKinkNeg->GetType()==AliAODVertex::kKink) return kFALSE;
1993  }
1994 
1995  return kTRUE;
1996 
1997 }
1998 
1999 //---------------------------------------------------------------------------
2001  //
2002  // Daughter tracks selection
2003  //
2004 
2005  if (!fTrackCuts) {
2006  AliFatal("Cut object is not defined for bachelor. Candidate accepted.");
2007  return kFALSE;
2008  }
2009 
2010  if (!bachelorTrack) {
2011  AliFatal("Track object is NULL.");
2012  return kFALSE;
2013  }
2014 
2015  if ( fUseTrackSelectionWithFilterBits && !(bachelorTrack->TestFilterMask(BIT(4))) ) {
2016  AliDebug(2,"Check on the bachelor FilterBit: no BIT(4). Candidate rejected.");
2017  return kFALSE;
2018  }
2019 
2020  Float_t ptmin, ptmax;
2021  fTrackCuts->GetPtRange(ptmin,ptmax);
2022  if(bachelorTrack->Pt()<ptmin) return kFALSE;
2023  if(bachelorTrack->Pt()>ptmax) return kFALSE;
2024 
2025  // cut on bachelor pT min
2026  Double_t mincut_p = 9999;
2027  for(Int_t ip=0;ip<fnPtBins;ip++){
2028  if(fCutsRD[GetGlobalIndex(4,ip)]<mincut_p) mincut_p = fCutsRD[GetGlobalIndex(4,ip)];
2029  }
2030  if (bachelorTrack->Pt() < mincut_p) {
2031  return kFALSE;
2032  }
2033 
2034  if (fKinkReject != (!(fTrackCuts->GetAcceptKinkDaughters())) ) {
2035  AliError(Form("Not compatible setting: fKinkReject=%1d - fTrackCuts->GetAcceptKinkDaughters()=%1d",fKinkReject, fTrackCuts->GetAcceptKinkDaughters()));
2036  return kFALSE;
2037  }
2038 
2039 
2040  AliAODVertex *vAOD = (AliAODVertex*)aod->GetPrimaryVertex();
2041  Double_t pos[3]; vAOD->GetXYZ(pos);
2042  Double_t cov[6]; vAOD->GetCovarianceMatrix(cov);
2043  const AliESDVertex vESD(pos,cov,100.,100);
2044 
2045  if (!IsDaughterSelected(bachelorTrack,&vESD,fTrackCuts,aod)) return kFALSE;
2046 
2047  Bool_t okLcK0Sp = kTRUE; // K0S case
2048  Bool_t dummy1 = kTRUE;
2049  Bool_t dummy2 = kTRUE;
2050  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
2051 
2052  return okLcK0Sp;
2053 }
2054 
2055 //---------------------------------------------------------------------------
2057  //
2058  // Apply selection
2059  //
2060 
2061  if (!fCutsRD) {
2062  AliFatal("Cut matrice not inizialized. Exit...");
2063  return kFALSE;
2064  }
2065 
2066 
2068  if (!d) {
2069  AliDebug(2,"AliAODRecoCascadeHF null");
2070  return kFALSE;
2071  }
2072 
2073  Double_t pt=d->Pt();
2074  if(pt<fMinPtCand) return kFALSE;
2075  if(pt>fMaxPtCand) return kFALSE;
2076  Int_t ptbin = PtBin(pt);
2077 
2078  AliVTrack *bachelorTrack = (AliVTrack*)d->GetBachelor();
2079  AliAODv0 *v0 = (AliAODv0*)d->Getv0();
2080 
2082  if(!spdfirstflag) return kFALSE;
2083  }
2084 
2085  // Get the V0 daughter tracks
2086  AliAODTrack *v0positiveTrack = (AliAODTrack*)v0->GetDaughter(0);
2087  AliAODTrack *v0negativeTrack = (AliAODTrack*)v0->GetDaughter(1);
2088  if (!v0positiveTrack || !v0negativeTrack ) {
2089  AliDebug(2,"No V0 daughters' objects");
2090  return kFALSE;
2091  }
2092 
2093  if (v0positiveTrack->GetID()<0 || v0negativeTrack->GetID()<0) {
2094  AliDebug(2,Form("At least one of V0 daughters has negative ID %d %d",v0positiveTrack->GetID(),v0negativeTrack->GetID()));
2095  return kFALSE;
2096  }
2097 
2098  AliAODVertex *vAOD = (AliAODVertex*)aod->GetPrimaryVertex();
2099  Double_t posVtx[3]; vAOD->GetXYZ(posVtx);
2100 
2101  Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
2102  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
2103  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
2104 
2105  // K0S + p
2106  Double_t mk0s = v0->MassK0Short();
2107  Double_t mLck0sp = d->InvMassLctoK0sP();
2108 
2109  // Lambda + pi
2110  Double_t mlambda = v0->MassLambda();
2111  Double_t malambda = v0->MassAntiLambda();
2112  Double_t mLcLpi = d->InvMassLctoLambdaPi();
2113 
2114  Bool_t okK0spipi=kTRUE, okLppi=kTRUE, okLBarpip=kTRUE;
2115  Bool_t isNotK0S = kTRUE, isNotLambda = kTRUE, isNotLambdaBar = kTRUE, isNotGamma = kTRUE;
2116 
2117  Bool_t okLck0sp=kTRUE, okLcLpi=kTRUE, okLcLBarpi=kTRUE;
2118 
2119  // cut on Lc mass with K0S+p hypothesis
2120  if (TMath::Abs(mLck0sp-mLcPDG) > fCutsRD[GetGlobalIndex(0,ptbin)] && fExcludedCut!=0) {
2121  okLck0sp = kFALSE;
2122  AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to Lambda_c into K0S+p cut",mLck0sp));
2123  }
2124 
2125  // cuts on the V0 mass: K0S case
2126  if (TMath::Abs(mk0s-mk0sPDG) > fCutsRD[GetGlobalIndex(2,ptbin)] && fExcludedCut!=2) {
2127  okK0spipi = kFALSE;
2128  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to K0S cut",mk0s));
2129  }
2130 
2131  // cut on Lc mass with Lambda+pi hypothesis
2132  if (TMath::Abs(mLcLpi-mLcPDG) > fCutsRD[GetGlobalIndex(1,ptbin)] && fExcludedCut!=1) {
2133  okLcLpi = kFALSE;
2134  okLcLBarpi = kFALSE;
2135  AliDebug(4,Form(" cascade mass is %2.2e and does not correspond to Lambda_c into Lambda+pi cut",mLcLpi));
2136  }
2137 
2138  // cuts on the V0 mass: Lambda/LambdaBar case
2139  if ( TMath::Abs(mlambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)] && fExcludedCut!=3) {
2140  okLppi = kFALSE;
2141  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to LambdaBar cut",mlambda));
2142  }
2143 
2144  if ( TMath::Abs(malambda-mLPDG) > fCutsRD[GetGlobalIndex(3,ptbin)] && fExcludedCut!=3) {
2145  okLBarpip = kFALSE;
2146  AliDebug(4,Form(" V0 mass is %2.2e and does not correspond to LambdaBar cut",malambda));
2147  }
2148 
2149  // cut on K0S invariant mass veto
2150  if (TMath::Abs(v0->MassK0Short()-mk0sPDG) < fCutsRD[GetGlobalIndex(12,ptbin)] && fExcludedCut!=12) { // K0S invariant mass veto
2151  AliDebug(4,Form(" veto on K0S invariant mass doesn't pass the cut"));
2152  isNotK0S=kFALSE;
2153  }
2154 
2155  // cut on Lambda/LambdaBar invariant mass veto
2156  if (TMath::Abs(v0->MassLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) { // Lambda invariant mass veto
2157  AliDebug(4,Form(" veto on Lambda invariant mass doesn't pass the cut"));
2158  isNotLambda=kFALSE;
2159  }
2160  if (TMath::Abs(v0->MassAntiLambda()-mLPDG) < fCutsRD[GetGlobalIndex(13,ptbin)] && fExcludedCut!=13) { // LambdaBar invariant mass veto
2161  AliDebug(4,Form(" veto on LambdaBar invariant mass doesn't pass the cut"));
2162  isNotLambdaBar=kFALSE;
2163  }
2164 
2165  // cut on gamma invariant mass veto
2166  if (v0->InvMass2Prongs(0,1,11,11) < fCutsRD[GetGlobalIndex(14,ptbin)] && fExcludedCut!=14) { // K0S invariant mass veto
2167  AliDebug(4,Form(" veto on gamma invariant mass doesn't pass the cut"));
2168  isNotGamma=kFALSE;
2169  }
2170 
2171  okLck0sp = okLck0sp && okK0spipi && isNotLambda && isNotLambdaBar && isNotGamma;
2172  okLcLpi = okLcLpi && okLppi && isNotK0S && isNotLambdaBar && isNotGamma;
2173  okLcLBarpi = okLcLBarpi && okLBarpip && isNotK0S && isNotLambda && isNotGamma;
2174 
2175  if (!okLck0sp) return kFALSE;
2176 
2177  // cuts on the minimum pt of the tracks
2178  if (TMath::Abs(bachelorTrack->Pt()) < fCutsRD[GetGlobalIndex(4,ptbin)] && fExcludedCut!=4) {
2179  AliDebug(4,Form(" bachelor track Pt=%2.2e > %2.2e",bachelorTrack->Pt(),fCutsRD[GetGlobalIndex(4,ptbin)]));
2180  return kFALSE;
2181  }
2182  if (TMath::Abs(v0positiveTrack->Pt()) < fCutsRD[GetGlobalIndex(5,ptbin)] && fExcludedCut!=5) {
2183  AliDebug(4,Form(" V0-positive track Pt=%2.2e > %2.2e",v0positiveTrack->Pt(),fCutsRD[GetGlobalIndex(5,ptbin)]));
2184  return kFALSE;
2185  }
2186  if (TMath::Abs(v0negativeTrack->Pt()) < fCutsRD[GetGlobalIndex(6,ptbin)] && fExcludedCut!=6) {
2187  AliDebug(4,Form(" V0-negative track Pt=%2.2e > %2.2e",v0negativeTrack->Pt(),fCutsRD[GetGlobalIndex(6,ptbin)]));
2188  return kFALSE;
2189  }
2190  // cut on cascade dca (prong-to-prong)
2191  if ( TMath::Abs(d->GetDCA()) > fCutsRD[GetGlobalIndex(7,ptbin)] && fExcludedCut!=7) { // prong-to-prong cascade DCA
2192  AliDebug(4,Form(" cascade tracks DCA don't pass the cut"));
2193  return kFALSE;
2194  }
2195 
2196  // cut on V0 dca (prong-to-prong)
2197  if ( TMath::Abs(v0->GetDCA()) > fCutsRD[GetGlobalIndex(8,ptbin)] && fExcludedCut!=8) { // prong-to-prong V0 DCA
2198  AliDebug(4,Form(" V0 DCA don't pass the cut"));
2199  return kFALSE;
2200  }
2201 
2202  // cut on V0 cosine of pointing angle wrt PV
2203  if (v0->CosPointingAngle(posVtx) < fCutsRD[GetGlobalIndex(9,ptbin)] && fExcludedCut!=9) { // cosine of V0 pointing angle wrt primary vertex
2204  AliDebug(4,Form(" V0 cosine of pointing angle doesn't pass the cut"));
2205  return kFALSE;
2206  }
2207 
2208  // cut on bachelor transverse impact parameter wrt PV
2209  if (TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(10,ptbin)] && fExcludedCut!=10) { // bachelor transverse impact parameter wrt PV
2210  AliDebug(4,Form(" bachelor transverse impact parameter doesn't pass the cut"));
2211  return kFALSE;
2212  }
2213 
2214  // cut on V0 transverse impact parameter wrt PV
2215  if (TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(11,ptbin)] && fExcludedCut!=11) { // V0 transverse impact parameter wrt PV
2216  AliDebug(4,Form(" V0 transverse impact parameter doesn't pass the cut"));
2217  return kFALSE;
2218  }
2219 
2220  // cut on V0 pT min
2221  if (v0->Pt() < fCutsRD[GetGlobalIndex(15,ptbin)] && fExcludedCut!=15) { // V0 pT min
2222  AliDebug(4,Form(" V0 track Pt=%2.2e > %2.2e",v0->Pt(),fCutsRD[GetGlobalIndex(15,ptbin)]));
2223  return kFALSE;
2224  }
2225 
2226  // cut on Proton emission angle
2227  if(TMath::Abs(fCutsRD[GetGlobalIndex(16,ptbin)])<1.1 || TMath::Abs(fCutsRD[GetGlobalIndex(17,ptbin)])<1.1){
2228  Double_t cutvar = GetProtonEmissionAngleCMS(d);
2229  if (cutvar > fCutsRD[GetGlobalIndex(16,ptbin)] && fExcludedCut!=16 && fExcludedCut!=17) { // Proton emission angle
2230  AliDebug(4,Form(" Cos proton emission=%2.2e < %2.2e",cutvar,fCutsRD[GetGlobalIndex(16,ptbin)]));
2231  return kFALSE;
2232  }
2233  if (cutvar < fCutsRD[GetGlobalIndex(17,ptbin)] && fExcludedCut!=16 && fExcludedCut!=17) { // Proton emission angle
2234  AliDebug(4,Form(" Cos proton emission=%2.2e > %2.2e",cutvar,fCutsRD[GetGlobalIndex(17,ptbin)]));
2235  return kFALSE;
2236  }
2237  }
2238 
2239  // cut on proton re-signed d0
2240  if(TMath::Abs(fCutsRD[GetGlobalIndex(18,ptbin)])<0.2){
2241  Double_t cutvar = GetReSignedd0(d) ;
2242  if (cutvar< fCutsRD[GetGlobalIndex(18,ptbin)] && fExcludedCut!=18) { // proton d0
2243  AliDebug(4,Form(" Proton d0 (re-signed)=%2.2e > %2.2e",cutvar,fCutsRD[GetGlobalIndex(18,ptbin)]));
2244  return kFALSE;
2245  }
2246  }
2247 
2248  // cut on Armenteros qT/|alpha|
2249  if(TMath::Abs(fCutsRD[GetGlobalIndex(19,ptbin)])<0.3){
2250  Double_t cutvar = v0->PtArmV0()/TMath::Abs(v0->AlphaV0());
2251  if (cutvar < fCutsRD[GetGlobalIndex(19,ptbin)] && fExcludedCut!=19) { // v0 armenteros variable
2252  AliDebug(4,Form(" qT/|alpha|=%2.2e > %2.2e",cutvar,fCutsRD[GetGlobalIndex(19,ptbin)]));
2253  return kFALSE;
2254  }
2255  }
2256 
2257  return kTRUE;
2258 }
2259 //---------------------------------------------------------------------------
2261  //
2262  //give the bachelor p bin.
2263  //
2264  Int_t pBin=-1;
2265  for (Int_t i=0;i<fNBachelorPBins+1;i++){
2266  if(bachelorP<fBachelorPLimitsForPID[i+1]) {
2267  pBin=i;
2268  break;
2269  }
2270  }
2271  return pBin;
2272 }
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:450
Int_t GetNVars() const
Definition: AliRDHFCuts.h:249
void SetAsym(Bool_t asym)
Definition: AliAODPidHF.h:88
void SetBachelorPLimitsForPID(Int_t nPBins, Float_t *pMin)
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:421
virtual void SetStandardCutsPP2010()
Bool_t fRemoveDaughtersFromPrimary
Definition: AliRDHFCuts.h:427
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:414
ECombDetectors GetCombDetectors() const
Definition: AliAODPidHF.h:162
AliAODv0 * Getv0() const
virtual void SetStandardCutsPbPb2011()
Int_t fMinVtxContr
0: not cut; 1: SPDZ; 2: SPD3D; 3: Tracks
Definition: AliRDHFCuts.h:399
Double_t InvMassLctoLambdaPi() const
Bool_t AreLctoV0DaughtersSelected(AliAODRecoDecayHF *rd, AliAODEvent *aod=0x0) const
Float_t fMaxVtxRedChi2
minimum vertex contributors
Definition: AliRDHFCuts.h:400
Int_t CombineCuts(Int_t returnvalueTrack, Int_t returnvalue, Int_t returnvaluePID) const
const Float_t * GetCuts() const
Definition: AliRDHFCuts.h:253
Float_t fV0Type
cuts for v0 daughters (AOD converted to ESD on the flight!)
void SetNVars(Int_t nVars)
Definition: AliRDHFCuts.h:392
Float_t fNTPCSigmaCutForPreselection
Int_t fMinVtxType
cuts on the event
Definition: AliRDHFCuts.h:398
Double_t fMaxRapidityCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:447
void EnableSemiCentralTrigger()
Definition: AliRDHFCuts.h:97
AliRDHFCutsLctoV0 & operator=(const AliRDHFCutsLctoV0 &source)
TString * GetVarNames() const
Definition: AliRDHFCuts.h:250
Double_t ptMin
Int_t ApplyPidTPCRaw(AliAODTrack *track, Int_t specie) const
void SetGlobalIndex()
Definition: AliRDHFCuts.h:201
AliRDHFCuts & operator=(const AliRDHFCuts &source)
Int_t fUseCentrality
flag to use a multiplicity dependent pileup selection
Definition: AliRDHFCuts.h:434
Bool_t fUsePID
Definition: AliRDHFCuts.h:422
void SetPidHF(AliAODPidHF *pidObj)
see enum below
Definition: AliRDHFCuts.h:215
Double_t InvMassLctoK0sP() const
Bool_t GetOldPid()
Definition: AliAODPidHF.h:157
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:246
void SetTOF(Bool_t tof)
Definition: AliAODPidHF.h:95
AliAODTrack * Getv0PositiveTrack() const
virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d, Float_t *vars, Int_t nvars, Int_t *pdgdaughters)
Double_t GetReSignedd0(AliAODRecoDecayHF *d)
int Int_t
Definition: External.C:63
Bool_t fUseTrackSelectionWithFilterBits
flag to reject kink daughters
Definition: AliRDHFCuts.h:457
void SetCuts(Int_t nVars, Int_t nPtBins, Float_t **cutsRD)
Int_t fnVarsForOpt
Definition: AliRDHFCuts.h:417
void ResetMaskAndEnableMBTrigger()
Definition: AliRDHFCuts.h:77
unsigned int UInt_t
Definition: External.C:33
AliPIDCombined * GetPidCombined() const
Definition: AliAODPidHF.h:161
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:416
Double_t fMaxPtCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:446
AliESDtrackCuts * fTrackCuts
quality cuts on the daughter tracks
Definition: AliRDHFCuts.h:410
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:430
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:439
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
Int_t fnPtBinLimits
number of pt bins for cuts
Definition: AliRDHFCuts.h:413
void SetSigma(Double_t *sigma)
Definition: AliAODPidHF.h:39
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:420
Double_t CosV0PointingAngle() const
short Short_t
Definition: External.C:23
Int_t ApplyPidTOFRaw(AliAODTrack *track, Int_t specie) const
void SetVarsForOpt(Int_t nVars, Bool_t *forOpt)
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:418
Bool_t PreSelect(TObject *obj, AliAODv0 *v0, AliVTrack *bachelorTrack)
void EnableCentralTrigger()
Definition: AliRDHFCuts.h:85
Int_t fMinSPDMultiplicity
maximum |z| of primary vertex
Definition: AliRDHFCuts.h:402
void SetUsePID(Bool_t flag=kTRUE)
Definition: AliRDHFCuts.h:209
Int_t fExcludedCut
low pT cut separation for proton identification
Bool_t fIsCandTrackSPDFirst
IsSelected returns always kTRUE for MC signal.
Definition: AliRDHFCuts.h:449
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:456
Bool_t fUsePhysicsSelection
use MC primary vertex
Definition: AliRDHFCuts.h:429
void SetTOFdecide(Bool_t tOFdecide)
Definition: AliAODPidHF.h:107
void SetMatch(Int_t match)
Definition: AliAODPidHF.h:98
AliAODVertex * GetPrimaryVtx() const
void AddTrackCuts(const AliESDtrackCuts *cuts)
Definition: AliRDHFCuts.h:207
void SetTPC(Bool_t tpc)
Definition: AliAODPidHF.h:94
bool Bool_t
Definition: External.C:53
Int_t fnPtBins
cuts on the candidate
Definition: AliRDHFCuts.h:412
Float_t fHighPtCut
V0 type – should be defined as in AliRDHFCuts.h.
Double_t ptMax
void SetTriggerClass(TString trclass0, TString trclass1="")
Definition: AliRDHFCuts.h:197
AliAODPidHF * fPidHF
enable AOD049 centrality cleanup
Definition: AliRDHFCuts.h:424
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
Int_t PtBin(Double_t pt) 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:445
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:440
virtual Int_t IsSelectedPID(AliAODRecoDecayHF *obj)
Int_t fnVars
Definition: AliRDHFCuts.h:415