AliPhysics  a0db429 (a0db429)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
AliRDHFCutsLctoeleLambdafromAODtracks.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->e+Lambda
21 //
22 // Modified by Y.S Watanabe - wyosuke@cns.s.u-tokyo.ac.jp
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"
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 "AliAODcascade.h"
42 #include "AliESDv0.h"
43 
44 using std::cout;
45 using std::endl;
46 
50 
51 //--------------------------------------------------------------------------
53 AliRDHFCuts(name),
54  fPIDStrategy(kNSigmaCuts),
55  fCombinedPIDThreshold(0.),
56  fUseLambdaPID(kFALSE),
57  fPidObjProton(0),
58  fPidObjPion(0),
59  fUseOnTheFlyV0(kFALSE),
60  fProdTrackTPCNclsPIDMin(0),
61  fProdTrackTPCNclsRatioMin(0.0),
62  fProdUseAODFilterBit(kTRUE),
63  fProdV0MassTolLambda(0.01),
64  fProdV0MassTolLambdaRough(0.01),
65  fProdV0PtMin(0.5),
66  fProdV0PtMax(9999.),
67  fProdV0CosPointingAngleToPrimVtxMin(0.99),
68  fProdV0DcaDaughtersMax(1.5),
69  fProdV0DaughterEtaRange(0.8),
70  fProdV0DaughterPtMin(0.0),
71  fProdV0DaughterTPCClusterMin(70),
72  fProdV0DaughterTPCCrossRatioMin(0.0),
73  fProdRfidMinV0(0.6),
74  fProdRfidMaxV0(100.0),
75  fProdDcaV0ToPrimVertexMin(0.),
76  fProdDcaV0PrToPrimVertexMin(0.),
77  fProdDcaV0PiToPrimVertexMin(0.),
78  fProdV0ProperDecayLengthMax(99999.),
79  fProdMassRejK0s(0.),
80  fProdV0EtaMin(-9999.),
81  fProdV0EtaMax(9999.),
82  fProdV0RapMin(-9999.),
83  fProdV0RapMax(9999.),
84  fProdRoughMassTol(0.25),
85  fProdRoughPtMin(0.0),
86  fExcludePionTPC(kFALSE),
87  fExcludeProtonTPC(kFALSE),
88  fExcludeKaonTPC(kFALSE),
89  fExcludenSigmaPionTPC(3.),
90  fExcludenSigmaProtonTPC(3.),
91  fExcludenSigmaKaonTPC(3.),
92  fSigmaElectronTPCMin(-9999.),
93  fSigmaElectronTPCPtDepPar0(-9999.),
94  fSigmaElectronTPCPtDepPar1(-9999.),
95  fSigmaElectronTPCPtDepPar2(0.),
96  fSigmaElectronTPCMax(9999.),
97  fSigmaElectronTOFMin(-9999.),
98  fSigmaElectronTOFMax(9999.),
99  fConversionMassMax(-1.)
100 {
101  //
102  // Default Constructor
103  //
104 
105  const Int_t nvars=2;
106  SetNVars(nvars);
107  TString varNames[nvars]={
108  "InvMass [GeV/c2]", //0
109  "cos(Opening angle) [cos(rad)]" //1
110  };
111 
112  Bool_t isUpperCut[nvars]={
113  kTRUE, //0
114  kFALSE //1
115  };
116  SetVarNames(nvars,varNames,isUpperCut);
117  Bool_t forOpt[nvars]={
118  kTRUE, //0
119  kTRUE //1
120  };
121  SetVarsForOpt(nvars,forOpt);
122 
123  Float_t limits[2]={0,999999999.};
124  SetPtBins(2,limits);
125 }
126 //--------------------------------------------------------------------------
128  AliRDHFCuts(source),
129  fPIDStrategy(source.fPIDStrategy),
130  fCombinedPIDThreshold(source.fCombinedPIDThreshold),
131  fUseLambdaPID(source.fUseLambdaPID),
132  fPidObjProton(source.fPidObjProton),
133  fPidObjPion(source.fPidObjPion),
134  fUseOnTheFlyV0(source.fUseOnTheFlyV0),
135  fProdTrackTPCNclsPIDMin(source.fProdTrackTPCNclsPIDMin),
136  fProdTrackTPCNclsRatioMin(source.fProdTrackTPCNclsRatioMin),
137  fProdUseAODFilterBit(source.fProdUseAODFilterBit),
138  fProdV0MassTolLambda(source.fProdV0MassTolLambda),
139  fProdV0MassTolLambdaRough(source.fProdV0MassTolLambdaRough),
140  fProdV0PtMin(source.fProdV0PtMin),
141  fProdV0PtMax(source.fProdV0PtMax),
142  fProdV0CosPointingAngleToPrimVtxMin(source.fProdV0CosPointingAngleToPrimVtxMin),
143  fProdV0DcaDaughtersMax(source.fProdV0DcaDaughtersMax),
144  fProdV0DaughterEtaRange(source.fProdV0DaughterEtaRange),
145  fProdV0DaughterPtMin(source.fProdV0DaughterPtMin),
146  fProdV0DaughterTPCClusterMin(source.fProdV0DaughterTPCClusterMin),
147  fProdV0DaughterTPCCrossRatioMin(source.fProdV0DaughterTPCCrossRatioMin),
148  fProdRfidMinV0(source.fProdRfidMinV0),
149  fProdRfidMaxV0(source.fProdRfidMaxV0),
150  fProdDcaV0ToPrimVertexMin(source.fProdDcaV0ToPrimVertexMin),
151  fProdDcaV0PrToPrimVertexMin(source.fProdDcaV0PrToPrimVertexMin),
152  fProdDcaV0PiToPrimVertexMin(source.fProdDcaV0PiToPrimVertexMin),
153  fProdV0ProperDecayLengthMax(source.fProdV0ProperDecayLengthMax),
154  fProdMassRejK0s(source.fProdMassRejK0s),
155  fProdV0EtaMin(source.fProdV0EtaMin),
156  fProdV0EtaMax(source.fProdV0EtaMax),
157  fProdV0RapMin(source.fProdV0RapMin),
158  fProdV0RapMax(source.fProdV0RapMax),
159  fProdRoughMassTol(source.fProdRoughMassTol),
160  fProdRoughPtMin(source.fProdRoughPtMin),
161  fExcludePionTPC(source.fExcludePionTPC),
162  fExcludeProtonTPC(source.fExcludeProtonTPC),
163  fExcludeKaonTPC(source.fExcludeKaonTPC),
164  fExcludenSigmaPionTPC(source.fExcludenSigmaPionTPC),
165  fExcludenSigmaProtonTPC(source.fExcludenSigmaProtonTPC),
166  fExcludenSigmaKaonTPC(source.fExcludenSigmaKaonTPC),
167  fSigmaElectronTPCMin(source.fSigmaElectronTPCMin),
168  fSigmaElectronTPCPtDepPar0(source.fSigmaElectronTPCPtDepPar0),
169  fSigmaElectronTPCPtDepPar1(source.fSigmaElectronTPCPtDepPar1),
170  fSigmaElectronTPCPtDepPar2(source.fSigmaElectronTPCPtDepPar2),
171  fSigmaElectronTPCMax(source.fSigmaElectronTPCMax),
172  fSigmaElectronTOFMin(source.fSigmaElectronTOFMin),
173  fSigmaElectronTOFMax(source.fSigmaElectronTOFMax),
174  fConversionMassMax(source.fConversionMassMax)
175 {
176  //
177  // Copy constructor
178  //
179 }
180 //--------------------------------------------------------------------------
182 {
183  //
184  // assignment operator
185  //
186 
187  if (this != &source) {
188  AliRDHFCuts::operator=(source);
189  }
190 
191  fPIDStrategy = source.fPIDStrategy;
193  fUseLambdaPID = source.fUseLambdaPID;
194  fPidObjProton = source.fPidObjProton;
195  fPidObjPion = source.fPidObjPion;
202  fProdV0PtMin = source.fProdV0PtMin;
203  fProdV0PtMax = source.fProdV0PtMax;
217  fProdV0EtaMin = source.fProdV0EtaMin;
218  fProdV0EtaMax = source.fProdV0EtaMax;
219  fProdV0RapMin = source.fProdV0RapMin;
220  fProdV0RapMax = source.fProdV0RapMax;
237 
238 
239  return *this;
240 }
241 
242 //---------------------------------------------------------------------------
244  //
245  // Default Destructor
246  //
247 
248 }
249 
250 //---------------------------------------------------------------------------
251 void AliRDHFCutsLctoeleLambdafromAODtracks::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
252  //
253  // Fills in vars the values of the variables
254  //
255 
256  if (pdgdaughters[0]==-9999) return; // dummy
257 
259  if(!dd){
260  AliError("No AliAODRecoCascadeHF object found\n");
261  return;
262  }
263 
264  if (nvars!=fnVarsForOpt) {
265  AliError("Cut object seems to have the wrong number of variables\n");
266  return;
267  }
268 
269  //Double_t ptD=d->Pt();
270  //Int_t ptbin=PtBin(ptD);
271  Int_t iter=-1;
272 
273 
274  if(fVarsForOpt[0]){
275  iter++;
276  UInt_t pdgdg[2]={11,3122};
277  vars[iter]= dd->InvMass(2,pdgdg);
278  }
279  if(fVarsForOpt[1]){
280  iter++;
281  Double_t v0px = dd->PxProng(1);
282  Double_t v0py = dd->PyProng(1);
283  Double_t v0pz = dd->PzProng(1);
284  Double_t epx = dd->PxProng(0);
285  Double_t epy = dd->PyProng(0);
286  Double_t epz = dd->PzProng(0);
287  vars[iter]= (v0px*epx+v0py*epy+v0pz*epz)/sqrt(v0px*v0px+v0py*v0py+v0pz*v0pz)/sqrt(epx*epx+epy*epy+epz*epz);
288  }
289 
290  return;
291 }
292 
293 //---------------------------------------------------------------------------
294 Int_t AliRDHFCutsLctoeleLambdafromAODtracks::IsSelected(TObject* obj, Int_t selectionLevel) {
295  //
296  // Apply selection
297  //
298 
299  if (!fCutsRD) {
300  AliFatal("Cut matrix not inizialized. Exit...");
301  return 0;
302  }
303 
305  if(!d){
306  AliDebug(2,"AliAODRecoCascadeHF null");
307  return 0;
308  }
309 
310  Double_t ptD=d->Pt();
311  if(ptD<fMinPtCand) return 0;
312  if(ptD>fMaxPtCand) return 0;
313 
314  if (selectionLevel==AliRDHFCuts::kAll ||
315  selectionLevel==AliRDHFCuts::kTracks) {
316  //Performed in production stage
317  }
318 
319  Int_t returnvalueCuts=1;
320  // selection on candidate
321  if (selectionLevel==AliRDHFCuts::kAll ||
322  selectionLevel==AliRDHFCuts::kCandidate) {
323 
324  Double_t pt=d->Pt();
325  Int_t ptbin=PtBin(pt);
326  if (ptbin==-1) {
327  return 0;
328  }
329  Bool_t okcand=kTRUE;
330 
331  Double_t mlamPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
332  UInt_t pdgdg[2]={11,3122};
333  Double_t InvMassEleLambda = d->InvMass(2,pdgdg);
334 
335  Double_t v0px = d->PxProng(1);
336  Double_t v0py = d->PyProng(1);
337  Double_t v0pz = d->PzProng(1);
338  Double_t epx = d->PxProng(0);
339  Double_t epy = d->PyProng(0);
340  Double_t epz = d->PzProng(0);
341  Double_t cosoa = (v0px*epx+v0py*epy+v0pz*epz)/sqrt(v0px*v0px+v0py*v0py+v0pz*v0pz)/sqrt(epx*epx+epy*epy+epz*epz);
342 
343  if(InvMassEleLambda > fCutsRD[GetGlobalIndex(0,ptbin)])
344  {
345  okcand = kFALSE;
346  }
347  if(cosoa < fCutsRD[GetGlobalIndex(1,ptbin)])
348  {
349  okcand = kFALSE;
350  }
351 
352  if(!okcand) return 0;
353  returnvalueCuts = 1;
354  }
355 
356  Int_t returnvaluePID=1;
357  if(selectionLevel==AliRDHFCuts::kAll ||
358  selectionLevel==AliRDHFCuts::kCandidate||
359  selectionLevel==AliRDHFCuts::kPID) {
360  //Not used
361  }
362 
363  Int_t returnvalue = 0;
364  if(returnvalueCuts==1 && returnvaluePID==1) returnvalue=1;
365 
366  return returnvalue;
367 }
368 
369 //---------------------------------------------------------------------------
371 {
372  //
373  // IsSelectedPID (not used)
374  //
375 
376  if(!fUsePID || !obj) return 1;
377 
379  AliAODTrack *part = dd->GetBachelor();
380 
381  Int_t returnvalue=1;
382 
383  if(fPidHF->GetPidResponse()==0x0){
384  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
385  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
386  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
387  fPidHF->SetPidResponse(pidResp);
388  }
389 
390  Int_t isElectron=fPidHF->MakeRawPid(part,0);
391  if(isElectron<1) returnvalue = 0;
392 
393  return returnvalue;
394 }
395 
396 //---------------------------------------------------------------------------
398  //
399  // IsSelectedCombinedPID (not used)
400  //
401 
402  if(!fUsePID || !obj) {return 1;}
403 
405  AliAODTrack *part = dd->GetBachelor();
406  if(!part) return 0;
407 
408  Int_t returnvalue=1;
409 
410  return returnvalue;
411 }
412 
413 //________________________________________________________________________
414 Bool_t AliRDHFCutsLctoeleLambdafromAODtracks::SingleTrkCuts(AliAODTrack *trk, AliAODVertex *primVert)
415 {
416  //
417  // Single Track Cut to be applied before object creation
418  //
419 
420  if(trk->GetStatus()&AliESDtrack::kITSpureSA) return kFALSE;
421  if(!(trk->GetStatus()&AliESDtrack::kITSin)) return kFALSE;
422  if(fProdUseAODFilterBit && !trk->TestFilterMask(BIT(4))) return kFALSE;
423  Double_t pos[3]; primVert->GetXYZ(pos);
424  Double_t cov[6]; primVert->GetCovarianceMatrix(cov);
425  const AliESDVertex vESD(pos,cov,100.,100);
426  if(fTrackCuts&&!IsDaughterSelected(trk,&vESD,fTrackCuts)) return kFALSE;
427 
428  if(trk->GetTPCsignalN()<fProdTrackTPCNclsPIDMin) return kFALSE;
429  if(trk->GetTPCNclsF()>0){
430  Float_t tpcratio = (Float_t)trk->GetTPCncls()/(Float_t)trk->GetTPCNclsF();
431  if(tpcratio<fProdTrackTPCNclsRatioMin) return kFALSE;
432  }
433 
434 
435  if(fUsePID)
436  {
437  if(fPidHF->GetPidResponse()==0x0){
438  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
439  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
440  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
441  fPidHF->SetPidResponse(pidResp);
442  }
443 
444  switch(fPIDStrategy){
445  case kNSigmaCuts:
446  return IsSelectedeID(trk);
447  break;
449  return IsSelectedCustomizedeID(trk);
450  break;
452  return IsSelectedCustomizedPtDepeID(trk);
453  break;
454  case kCombinedCuts:
455  return IsSelectedCombinedeID(trk);
456  break;
457  }
458 
459  }
460 
461  return kTRUE;
462 }
463 //________________________________________________________________________
464 Bool_t AliRDHFCutsLctoeleLambdafromAODtracks::SingleTrkCutsNoPID(AliAODTrack *trk, AliAODVertex *primVert)
465 {
466  //
467  // Single Track Cut to be applied before object creation
468  //
469 
470  if(trk->GetStatus()&AliESDtrack::kITSpureSA) return kFALSE;
471  if(!(trk->GetStatus()&AliESDtrack::kITSin)) return kFALSE;
472  if(fProdUseAODFilterBit && !trk->TestFilterMask(BIT(4))) return kFALSE;
473  Double_t pos[3]; primVert->GetXYZ(pos);
474  Double_t cov[6]; primVert->GetCovarianceMatrix(cov);
475  const AliESDVertex vESD(pos,cov,100.,100);
476  if(fTrackCuts&&!IsDaughterSelected(trk,&vESD,fTrackCuts)) return kFALSE;
477 
478  if(trk->GetTPCsignalN()<fProdTrackTPCNclsPIDMin) return kFALSE;
479  if(trk->GetTPCNclsF()>0){
480  Float_t tpcratio = (Float_t)trk->GetTPCncls()/(Float_t)trk->GetTPCNclsF();
481  if(tpcratio<fProdTrackTPCNclsRatioMin) return kFALSE;
482  }
483 
484  return kTRUE;
485 }
486 //________________________________________________________________________
488 {
489  //
490  // electron ID first shot
491  //
492 
493  Double_t nSigmaPion = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kPion);
494  if(fExcludePionTPC){
495  if(TMath::Abs(nSigmaPion)<fExcludenSigmaPionTPC){
496  return kFALSE;
497  }
498  }
499 
500  Double_t nSigmaProton = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kProton);
501  if(fExcludeProtonTPC){
502  if(TMath::Abs(nSigmaProton)<fExcludenSigmaProtonTPC){
503  return kFALSE;
504  }
505  }
506 
507  Double_t nSigmaKaon = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kKaon);
508  if(fExcludeKaonTPC){
509  if(TMath::Abs(nSigmaKaon)<fExcludenSigmaKaonTPC){
510  return kFALSE;
511  }
512  }
513 
514  Int_t isElectron=fPidHF->MakeRawPid(trk,0);
515  if(isElectron<1) return kFALSE;
516 
517  return kTRUE;
518 }
519 //________________________________________________________________________
521 {
522  //
523  // electron ID first shot
524  //
525 
526  Double_t nSigmaPion = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kPion);
527  if(fExcludePionTPC){
528  if(TMath::Abs(nSigmaPion)<fExcludenSigmaPionTPC){
529  return kFALSE;
530  }
531  }
532 
533  Double_t nSigmaProton = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kProton);
534  if(fExcludeProtonTPC){
535  if(TMath::Abs(nSigmaProton)<fExcludenSigmaProtonTPC){
536  return kFALSE;
537  }
538  }
539 
540  Double_t nSigmaKaon = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kKaon);
541  if(fExcludeKaonTPC){
542  if(TMath::Abs(nSigmaKaon)<fExcludenSigmaKaonTPC){
543  return kFALSE;
544  }
545  }
546 
547  Double_t nSigmaTPCele = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kElectron);
548  Double_t nSigmaTOFele = fPidHF->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kElectron);
549 
550  if(nSigmaTPCele<fSigmaElectronTPCMin) return kFALSE;
551  if(nSigmaTPCele>fSigmaElectronTPCMax) return kFALSE;
552  if(nSigmaTOFele<fSigmaElectronTOFMin) return kFALSE;
553  if(nSigmaTOFele>fSigmaElectronTOFMax) return kFALSE;
554 
555  return kTRUE;
556 }
557 //________________________________________________________________________
559 {
560  //
561  // electron ID first shot
562  //
563 
564  Double_t nSigmaTPCele = fPidHF->GetPidResponse()->NumberOfSigmasTPC(trk,AliPID::kElectron);
565  Double_t nSigmaTOFele = fPidHF->GetPidResponse()->NumberOfSigmasTOF(trk,AliPID::kElectron);
566 
567  if(nSigmaTOFele<fSigmaElectronTOFMin) return kFALSE;
568  if(nSigmaTOFele>fSigmaElectronTOFMax) return kFALSE;
569 
570  Double_t pte = trk->Pt();
573  if(nSigmaTPCele<nsigmamin) return kFALSE;
574  if(nSigmaTPCele>fSigmaElectronTPCMax) return kFALSE;
575 
576  return kTRUE;
577 }
578 //________________________________________________________________________
580 {
581  //
582  // electron ID Basyian not implemented
583  //
584 
585  return kTRUE;
586 }
587 
588 //________________________________________________________________________
589 Bool_t AliRDHFCutsLctoeleLambdafromAODtracks::SingleV0Cuts(AliAODv0 *v0, AliAODVertex *primVert)
590 {
591  //
592  // Single V0 Cut to be applied before object creation
593  //
594 
595  Bool_t onFlyV0 = v0->GetOnFlyStatus(); // on-the-flight V0s
596  if ( onFlyV0 && !fUseOnTheFlyV0 ) return kFALSE;
597  if(!v0) return kFALSE;
598  if(!(v0->GetSecondaryVtx())) return kFALSE;
599 
600  AliAODTrack *cptrack = (AliAODTrack*)(v0->GetDaughter(0));
601  AliAODTrack *cntrack = (AliAODTrack*)(v0->GetDaughter(1));
602  if(!cptrack || !cntrack) return kFALSE;
603  if(cptrack->Charge()<0 && cntrack->Charge()>0){
604  //In case sign is wrong
605  cptrack = (AliAODTrack*)(v0->GetDaughter(1));
606  cntrack = (AliAODTrack*)(v0->GetDaughter(0));
607  }
608 
609  if ( cptrack->Charge() == cntrack->Charge() ) return kFALSE;
610  if(!(cptrack->GetStatus() & AliESDtrack::kTPCrefit) ||
611  !(cntrack->GetStatus() & AliESDtrack::kTPCrefit)) return kFALSE;
612  AliAODVertex *maybeKinkPos = (AliAODVertex*)cptrack->GetProdVertex();
613  AliAODVertex *maybeKinkNeg = (AliAODVertex*)cntrack->GetProdVertex();
614  if (maybeKinkPos->GetType()==AliAODVertex::kKink || maybeKinkNeg->GetType()==AliAODVertex::kKink)
615  return kFALSE;
616 
617  if ( ( ( cptrack->GetTPCClusterInfo(2,1) ) < (Float_t)fProdV0DaughterTPCClusterMin ) ||
618  ( ( cntrack->GetTPCClusterInfo(2,1) ) < (Float_t)fProdV0DaughterTPCClusterMin) ) return kFALSE;
619 
620 
621  if((cptrack->GetTPCNclsF()>0)&&(cptrack->GetTPCClusterInfo(2,1)/cptrack->GetTPCNclsF()<fProdV0DaughterTPCCrossRatioMin)) return kFALSE;
622  if((cntrack->GetTPCNclsF()>0)&&(cntrack->GetTPCClusterInfo(2,1)/cntrack->GetTPCNclsF()<fProdV0DaughterTPCCrossRatioMin)) return kFALSE;
623 
624  Double_t massLambda = v0->MassLambda();
625  Double_t massAntiLambda = v0->MassAntiLambda();
626  Double_t mlamPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
627  Double_t mk0sPDG = TDatabasePDG::Instance()->GetParticle(310)->Mass();
628  if(!(fabs(massAntiLambda-mlamPDG)<fProdV0MassTolLambdaRough) && !(fabs(massLambda-mlamPDG)<fProdV0MassTolLambdaRough)) return kFALSE;
629 
630  Double_t massK0s = v0->MassK0Short();
631  if(TMath::Abs(massK0s-mk0sPDG)<fProdMassRejK0s)
632  return kFALSE;
633 
634  Bool_t isparticle = kTRUE;
635  if(TMath::Abs(massAntiLambda-mlamPDG)<fProdV0MassTolLambdaRough) isparticle = kFALSE;
636 
637 
638  if(TMath::Abs(v0->DcaV0Daughters())>fProdV0DcaDaughtersMax) return kFALSE;
639  Double_t posVtx[3] = {0.,0.,0.};
640  primVert->GetXYZ(posVtx);
641  Double_t cospav0 = v0->CosPointingAngle(posVtx);
642  if(cospav0<fProdV0CosPointingAngleToPrimVtxMin) return kFALSE;
643  if(v0->Pt()<fProdV0PtMin) return kFALSE;
644  if(v0->Pt()>fProdV0PtMax) return kFALSE;
645  if(fabs(cptrack->Eta())>fProdV0DaughterEtaRange) return kFALSE;
646  if(fabs(cntrack->Eta())>fProdV0DaughterEtaRange) return kFALSE;
647  if(cptrack->Pt()<fProdV0DaughterPtMin) return kFALSE;
648  if(cntrack->Pt()<fProdV0DaughterPtMin) return kFALSE;
649 
650  Double_t lDcaV0ToPrimVertex = v0->DcaV0ToPrimVertex();
651  Double_t lDcaPosToPrimVertex = v0->DcaPosToPrimVertex();
652  Double_t lDcaNegToPrimVertex = v0->DcaNegToPrimVertex();
653  if(lDcaV0ToPrimVertex < fProdDcaV0ToPrimVertexMin) return kFALSE;
654  if(isparticle){
655  if(lDcaPosToPrimVertex < fProdDcaV0PrToPrimVertexMin) return kFALSE;
656  if(lDcaNegToPrimVertex < fProdDcaV0PiToPrimVertexMin) return kFALSE;
657  }else{
658  if(lDcaPosToPrimVertex < fProdDcaV0PiToPrimVertexMin) return kFALSE;
659  if(lDcaNegToPrimVertex < fProdDcaV0PrToPrimVertexMin) return kFALSE;
660  }
661  Double_t lPosV0[3];
662  lPosV0[0] = v0->DecayVertexV0X();
663  lPosV0[1] = v0->DecayVertexV0Y();
664  lPosV0[2] = v0->DecayVertexV0Z();
665  Double_t decayvertV0 = TMath::Sqrt(lPosV0[0]*lPosV0[0]+lPosV0[1]*lPosV0[1]);
666 
667  if(decayvertV0<fProdRfidMinV0 || decayvertV0>fProdRfidMaxV0) return kFALSE;
668 
669  Double_t ptotlam = TMath::Sqrt(pow(v0->Px(),2)+pow(v0->Py(),2)+pow(v0->Pz(),2));
670  Double_t properdl = v0->DecayLengthV0(posVtx)*mlamPDG/ptotlam;
671  if(properdl>fProdV0ProperDecayLengthMax) return kFALSE;
672 
673 
674  if(fUseLambdaPID)
675  {
676  if(fPidObjProton->GetPidResponse()==0x0){
677  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
678  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
679  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
680  fPidObjProton->SetPidResponse(pidResp);
681  }
682  if(fPidObjPion->GetPidResponse()==0x0){
683  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
684  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
685  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
686  fPidObjPion->SetPidResponse(pidResp);
687  }
688 
689  Int_t isProton= -9999;
690  Int_t isPion= -9999;
691  Double_t nsigmatpc_proton = fPidObjProton->GetSigma(0);
692  Double_t nsigmatpc_pion = fPidObjPion->GetSigma(0);
693  if(isparticle){
694  Double_t nSigmaTPCpr = fPidObjProton->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kProton);
695  Double_t nSigmaTPCpi = fPidObjPion->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kPion);
696  if(fabs(nSigmaTPCpr)<nsigmatpc_proton) isProton = 1;
697  if(fabs(nSigmaTPCpi)<nsigmatpc_pion) isPion = 1;
698  }else{
699  Double_t nSigmaTPCpr = fPidObjProton->GetPidResponse()->NumberOfSigmasTPC(cntrack,AliPID::kProton);
700  Double_t nSigmaTPCpi = fPidObjPion->GetPidResponse()->NumberOfSigmasTPC(cptrack,AliPID::kPion);
701  if(fabs(nSigmaTPCpr)<nsigmatpc_proton) isProton = 1;
702  if(fabs(nSigmaTPCpi)<nsigmatpc_pion) isPion = 1;
703  }
704  if(isProton<1) return kFALSE;
705  if(isPion<1) return kFALSE;
706  }
707 
708  Double_t RapLambda = v0->RapLambda();
709  if(RapLambda<fProdV0RapMin || RapLambda>fProdV0RapMax) return kFALSE;
710 
711  Double_t EtaLambda = v0->PseudoRapV0();
712  if(EtaLambda<fProdV0EtaMin || EtaLambda>fProdV0EtaMax) return kFALSE;
713 
714  return kTRUE;
715 }
716 
717 //________________________________________________________________________
718 Bool_t AliRDHFCutsLctoeleLambdafromAODtracks::SelectWithRoughCuts(AliAODv0 *v0, AliAODTrack *part)
719 {
720  //
721  // Mass and pT Cut to be applied before object creation
722  // Not used now
723  //
724  if(!v0) return kFALSE;
725  if(!part) return kFALSE;
726 
727  return kTRUE;
728 
729 }
730 
731 //________________________________________________________________________
733 {
734  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
735  Double_t massL = v0->MassLambda();
736  if(TMath::Abs(massL-mLPDG)>fProdV0MassTolLambdaRough)
737  massL = v0->MassAntiLambda();
738 
739  if(TMath::Abs(massL-mLPDG)<fProdV0MassTolLambda)
740  return kTRUE;
741  return kFALSE;
742 }
743 
744 //________________________________________________________________________
746 {
747  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
748  Double_t massL = v0->M();
749  if(TMath::Abs(massL-mLPDG)<fProdV0MassTolLambda)
750  return kTRUE;
751  return kFALSE;
752 }
753 
754 //________________________________________________________________________
756 {
757  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
758  Double_t massL = v0->MassLambda();
759  if(TMath::Abs(massL-mLPDG)>fProdV0MassTolLambdaRough)
760  massL = v0->MassAntiLambda();
761 
762  Bool_t issideband = kFALSE;
763  if((massL-mLPDG)>fProdV0MassTolLambdaRough-fProdV0MassTolLambda) issideband = kTRUE;
764  if((massL-mLPDG)<-fProdV0MassTolLambdaRough+fProdV0MassTolLambda) issideband = kTRUE;
765  return issideband;
766 }
767 
768 //________________________________________________________________________
770 {
771  Double_t mLPDG = TDatabasePDG::Instance()->GetParticle(3122)->Mass();
772  Double_t massL = v0->M();
773  Bool_t issideband = kFALSE;
774  if((massL-mLPDG)>fProdV0MassTolLambdaRough-fProdV0MassTolLambda) issideband = kTRUE;
775  if((massL-mLPDG)<-fProdV0MassTolLambdaRough+fProdV0MassTolLambda) issideband = kTRUE;
776  return issideband;
777 }
778 
779 //________________________________________________________________________
780 Bool_t AliRDHFCutsLctoeleLambdafromAODtracks::TagConversions(AliAODTrack *etrk, AliAODEvent *evt, Int_t ntrk, Double_t &minmass)
781 {
782  //
783  // Tag conversion electron tracks
784  //
785  if(fConversionMassMax<0.) return kFALSE;
786 
787  Bool_t isconv = kFALSE;
788  minmass = 9999.;
789 
790  Int_t trkid = etrk->GetID();
791  Double_t px1 = etrk->Px();
792  Double_t py1 = etrk->Py();
793  Double_t pz1 = etrk->Pz();
794  Double_t E1 = sqrt(px1*px1+py1*py1+pz1*pz1+0.000511*0.000511);
795 
796  for(Int_t it=0;it<ntrk;it++){
797  AliAODTrack *trk2 = (AliAODTrack*) evt->GetTrack(it);
798  if(!trk2) continue;
799  Int_t trkid2 = trk2->GetID();
800  if(trkid==trkid2) continue;
801  if(etrk->Charge()*trk2->Charge()>0) continue;
802  if(!etrk->TestFilterMask(BIT(4))) continue;
803 
804  Double_t px2 = trk2->Px();
805  Double_t py2 = trk2->Py();
806  Double_t pz2 = trk2->Pz();
807  Double_t E2 = sqrt(px2*px2+py2*py2+pz2*pz2+0.000511*0.000511);
808 
809  Double_t mass = sqrt(pow(E1+E2,2)-pow(px1+px2,2)-pow(py1+py2,2)-pow(pz1+pz2,2));
810  if(mass<minmass) minmass = mass;
811  }
812 
813  if(minmass<fConversionMassMax) isconv = kTRUE;
814 
815  return isconv;
816 }
817 //________________________________________________________________________
818 Bool_t AliRDHFCutsLctoeleLambdafromAODtracks::TagConversionsSameSign(AliAODTrack *etrk, AliAODEvent *evt, Int_t ntrk, Double_t &minmass)
819 {
820  //
821  // Tag conversion electron tracks
822  //
823  if(fConversionMassMax<0.) return kFALSE;
824 
825  Bool_t isconv = kFALSE;
826  minmass = 9999.;
827 
828  Int_t trkid = etrk->GetID();
829  Double_t px1 = etrk->Px();
830  Double_t py1 = etrk->Py();
831  Double_t pz1 = etrk->Pz();
832  Double_t E1 = sqrt(px1*px1+py1*py1+pz1*pz1+0.000511*0.000511);
833 
834  for(Int_t it=0;it<ntrk;it++){
835  AliAODTrack *trk2 = (AliAODTrack*) evt->GetTrack(it);
836  if(!trk2) continue;
837  Int_t trkid2 = trk2->GetID();
838  if(trkid==trkid2) continue;
839  if(etrk->Charge()*trk2->Charge()<0) continue;
840  if(!etrk->TestFilterMask(BIT(4))) continue;
841 
842  Double_t px2 = trk2->Px();
843  Double_t py2 = trk2->Py();
844  Double_t pz2 = trk2->Pz();
845  Double_t E2 = sqrt(px2*px2+py2*py2+pz2*pz2+0.000511*0.000511);
846 
847  Double_t mass = sqrt(pow(E1+E2,2)-pow(px1+px2,2)-pow(py1+py2,2)-pow(pz1+pz2,2));
848  if(mass<minmass) minmass = mass;
849  }
850 
851  if(minmass<fConversionMassMax) isconv = kTRUE;
852 
853  return isconv;
854 }
Bool_t SingleV0Cuts(AliAODv0 *v0, AliAODVertex *vert)
Double_t fProdV0DaughterTPCCrossRatioMin
V0 daughter Minimum TPC cluster pT used before object creation.
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Bool_t TagConversions(AliAODTrack *etrk, AliAODEvent *evt, Int_t ntrk, Double_t &minmass)
Double_t fProdV0ProperDecayLengthMax
Min Dca between v0-pion and PV.
Double_t fSigmaElectronTPCMin
nSigma to exclude for Kaon band
AliAODPidHF * fPidObjProton
Use PID for proton from Lc.
Double_t fProdRoughMassTol
Maximum rapidity of cascade.
AliRDHFCutsLctoeleLambdafromAODtracks & operator=(const AliRDHFCutsLctoeleLambdafromAODtracks &source)
Double_t GetSigma(Int_t idet) const
Definition: AliAODPidHF.h:134
Double_t fProdV0CosPointingAngleToPrimVtxMin
Max Lambda pT used before object creation.
Double_t fProdV0PtMin
Lambda mass selection used before object creation.
Double_t mass
Double_t fProdV0PtMax
Minimum Lambda pT used before object creation.
Double_t fExcludenSigmaKaonTPC
nSigma to exclude for proton band
void SetNVars(Int_t nVars)
Definition: AliRDHFCuts.h:362
AliRDHFCuts & operator=(const AliRDHFCuts &source)
Bool_t fExcludePionTPC
pT cut for Lc used before object creation
Double_t fProdTrackTPCNclsRatioMin
Min. Number of TPC PID cluster.
Bool_t fUsePID
Definition: AliRDHFCuts.h:389
Double_t fSigmaElectronTPCPtDepPar1
nSigma electron lower limit (par0)
Double_t fSigmaElectronTPCPtDepPar0
nSigma to exclude for Kaon band
Double_t fExcludenSigmaProtonTPC
nSigma to exclude for pion band
Double_t fProdDcaV0PrToPrimVertexMin
Min Dca between v0 and PV.
virtual void GetCutVarsForOpt(AliAODRecoDecayHF *d, Float_t *vars, Int_t nvars, Int_t *pdgdaughters)
Double_t fProdV0DaughterEtaRange
Max DCA between V0 daughters used before object creation.
Int_t fnVarsForOpt
Definition: AliRDHFCuts.h:384
Bool_t fUseLambdaPID
Threshold used in IsSelectedCombinedPID.
Double_t fMaxPtCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:411
Double_t fSigmaElectronTOFMin
nSigma to exclude for Kaon band
AliESDtrackCuts * fTrackCuts
quality cuts on the daughter tracks
Definition: AliRDHFCuts.h:377
Bool_t fExcludeKaonTPC
Flag wheter to exlude proton band.
Double_t fProdRoughPtMin
Mass cut for Lc used before object creation.
Double_t fProdDcaV0PiToPrimVertexMin
Min Dca between v0-proton and PV.
Bool_t IsDaughterSelected(AliAODTrack *track, const AliESDVertex *primary, AliESDtrackCuts *cuts) const
Double_t fSigmaElectronTOFMax
nSigma to exclude for Kaon band
Int_t fProdTrackTPCNclsPIDMin
Flag to check if we use on-the-fly v0.
AliAODTrack * GetBachelor() const
Bool_t fUseOnTheFlyV0
PID object for proton from Lc.
Double_t fSigmaElectronTPCPtDepPar2
nSigma electron lower limit (par1)
Bool_t SelectWithRoughCuts(AliAODv0 *v0, AliAODTrack *trk1)
Int_t MakeRawPid(AliAODTrack *track, Int_t specie)
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
Double_t fProdV0MassTolLambda
Flag for AOD filter Bit used before object creation.
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:387
Double_t fProdV0EtaMin
Rejection range of Omega mass from PDG value.
void SetVarsForOpt(Int_t nVars, Bool_t *forOpt)
Double_t fProdV0DaughterTPCClusterMin
V0 Daughter pT min used before object creation.
Double_t fExcludenSigmaPionTPC
Flag wheter to exlude proton band.
void SetVarNames(Int_t nVars, TString *varNames, Bool_t *isUpperCut)
Bool_t fExcludeProtonTPC
Flag wheter to exlude pion band.
Bool_t * fVarsForOpt
number of cut vars to be optimized for candidates
Definition: AliRDHFCuts.h:385
Double_t fConversionMassMax
nSigma to exclude for Kaon band
Double_t fProdV0MassTolLambdaRough
Lambda mass selection used before object creation.
Bool_t TagConversionsSameSign(AliAODTrack *etrk, AliAODEvent *evt, Int_t ntrk, Double_t &minmass)
Bool_t fProdUseAODFilterBit
Min. Number of TPC PID cluster.
void SetPtBins(Int_t nPtBinLimits, Float_t *ptBinLimits)
Bool_t SingleTrkCutsNoPID(AliAODTrack *trk, AliAODVertex *vert)
Double_t fSigmaElectronTPCMax
nSigma electron lower limit (par2)
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
Double_t fProdRfidMinV0
V0 daughter Minimum TPC cluster pT used before object creation.
Double_t fProdV0DcaDaughtersMax
V0 pointing angle used before object creation.
AliRDHFCutsLctoeleLambdafromAODtracks(const char *name="CutsLctoeleLambda")
AliAODPidHF * fPidHF
enable AOD049 centrality cleanup
Definition: AliRDHFCuts.h:391
Int_t PtBin(Double_t pt) const
Int_t GetGlobalIndex(Int_t iVar, Int_t iPtBin) const
Double_t fMinPtCand
outcome of PID selection
Definition: AliRDHFCuts.h:410
AliAODPidHF * fPidObjPion
PID object for proton from Lc.
Double_t fProdV0DaughterPtMin
V0Daughter eta range used before object creation.
void SetPidResponse(AliPIDResponse *pidResp)
Definition: AliAODPidHF.h:111
Bool_t SingleTrkCuts(AliAODTrack *trk, AliAODVertex *vert)