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