AliPhysics  master (3d17d9d)
AliRDHFCuts.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 // Base class for cuts on AOD reconstructed heavy-flavour decay
21 //
22 // Author: A.Dainese, andrea.dainese@pd.infn.it
24 #include <Riostream.h>
25 
26 #include "AliVEvent.h"
27 #include "AliESDEvent.h"
28 #include "AliAODEvent.h"
29 #include "AliVVertex.h"
30 #include "AliESDVertex.h"
31 #include "AliLog.h"
32 #include "AliAODVertex.h"
33 #include "AliESDtrack.h"
34 #include "AliAODTrack.h"
35 #include "AliESDtrackCuts.h"
36 #include "AliCentrality.h"
37 #include "AliAODRecoDecayHF.h"
38 #include "AliAnalysisVertexingHF.h"
39 #include "AliAODMCHeader.h"
40 #include "AliAODMCParticle.h"
41 #include "AliVertexerTracks.h"
42 #include "AliTimeRangeMasking.h"
43 #include "AliEventCuts.h"
44 #include "AliRDHFCuts.h"
45 #include "AliAnalysisManager.h"
46 #include "AliAODHandler.h"
47 #include "AliInputEventHandler.h"
48 #include "AliPIDResponse.h"
49 #include "AliAnalysisUtils.h"
50 #include "AliMultSelection.h"
51 #include "AliAODVZERO.h"
52 #include "TRandom.h"
53 #include <TF1.h>
54 #include <TFile.h>
55 #include <TKey.h>
56 
57 using std::cout;
58 using std::endl;
59 
61 ClassImp(AliRDHFCuts);
63 
64 
65 //--------------------------------------------------------------------------
67 AliAnalysisCuts(name,title),
68 fMinVtxType(3),
69 fMinVtxContr(1),
70 fMaxVtxRedChi2(1e6),
71 fMaxVtxZ(10.),
72 fMinSPDMultiplicity(0),
73 fMinContrPileupMV(5),
74 fMaxVtxChi2PileupMV(5.),
75 fMinWDzPileupMV(15.),
76 fRejectPlpFromDiffBCMV(kFALSE),
77 fTriggerMask(AliVEvent::kAnyINT),
78 fUseOnlyOneTrigger(kFALSE),
79 fTrackCuts(0),
80 fnPtBins(1),
81 fnPtBinLimits(1),
82 fPtBinLimits(0),
83 fnVars(1),
84 fVarNames(0),
85 fnVarsForOpt(0),
86 fVarsForOpt(0),
87 fGlobalIndex(1),
88 fCutsRD(0),
89 fIsUpperCut(0),
90 fUsePID(kFALSE),
91 fUseAOD049(kFALSE),
92 fPidHF(0),
93 fWhyRejection(0),
94 fEvRejectionBits(0),
95 fRemoveDaughtersFromPrimary(kFALSE),
96 fUseMCVertex(kFALSE),
97 fUsePhysicsSelection(kTRUE),
98 fOptPileup(0),
99 fMinContrPileup(3),
100 fMinDzPileup(0.6),
101 fUseMultDepPileupCut(kFALSE),
102 fUseCentrality(0),
103 fMinCentrality(0.),
104 fMaxCentrality(100.),
105 fMultSelectionObjectName("MultSelection"),
106 fFixRefs(kFALSE),
107 fIsSelectedCuts(0),
108 fIsSelectedPID(0),
109 fMinPtCand(-1.),
110 fMaxPtCand(100000.),
111 fMaxRapidityCand(-999.),
112 fKeepSignalMC(kFALSE),
113 fIsCandTrackSPDFirst(kFALSE),
114 fMaxPtCandTrackSPDFirst(0.),
115 fApplySPDDeadPbPb2011(kFALSE),
116 fApplySPDMisalignedPP2012(kFALSE),
117 fApplySPDUniformAccPbPbRun2(kFALSE),
118 fMaxDiffTRKV0Centr(-1.),
119 fRemoveTrackletOutliers(kFALSE),
120 fCutOnzVertexSPD(3),
121 fKinkReject(kFALSE),
122 fUseTrackSelectionWithFilterBits(kTRUE),
123 fUseCentrFlatteningInMC(kFALSE),
124 fHistCentrDistr(0x0),
125 fCutRatioClsOverCrossRowsTPC(0),
126 fCutRatioSignalNOverCrossRowsTPC(0),
127 fCutTPCSignalN(0),
128 fCutMinCrossedRowsTPCPtDep(""),
129 f1CutMinNCrossedRowsTPCPtDep(0x0),
130 fUseCutGeoNcrNcl(kFALSE),
131 fDeadZoneWidth(3.),
132 fCutGeoNcrNclLength(130.),
133 fCutGeoNcrNclGeom1Pt(1.5),
134 fCutGeoNcrNclFractionNcr(0.85),
135 fCutGeoNcrNclFractionNcl(0.7),
136 fUseV0ANDSelectionOffline(kFALSE),
137 fUseTPCtrackCutsOnThisDaughter(kTRUE),
138 fApplyZcutOnSPDvtx(kFALSE),
139 fUsePreselect(0),
140 fAliEventCuts(0x0),
141 fApplyCentralityCorrCuts(kFALSE),
142 fApplyPbPbOutOfBunchPileupCuts(0),
143 fUseAliEventCuts(kFALSE),
144 fUseTimeRangeCutForPbPb2018(kTRUE),
145 fTimeRangeCut(),
146 fCurrentRun(-1),
147 fEnableNsigmaTPCDataCorr(kFALSE),
148 fSystemForNsigmaTPCDataCorr(AliAODPidHF::kNone)
149 {
150  //
151  // Default Constructor
152  //
153  fAliEventCuts = new AliEventCuts();
154  fAliEventCuts->SetManualMode();
155  fTriggerClass[0]="CINT1"; fTriggerClass[1]="";
156 }
157 //--------------------------------------------------------------------------
159  AliAnalysisCuts(source),
160  fMinVtxType(source.fMinVtxType),
161  fMinVtxContr(source.fMinVtxContr),
163  fMaxVtxZ(source.fMaxVtxZ),
169  fTriggerMask(source.fTriggerMask),
171  fTriggerClass(),
172  fTrackCuts(0),
173  fnPtBins(source.fnPtBins),
175  fPtBinLimits(0),
176  fnVars(source.fnVars),
177  fVarNames(0),
178  fnVarsForOpt(source.fnVarsForOpt),
179  fVarsForOpt(0),
180  fGlobalIndex(source.fGlobalIndex),
181  fCutsRD(0),
182  fIsUpperCut(0),
183  fUsePID(source.fUsePID),
184  fUseAOD049(source.fUseAOD049),
185  fPidHF(0),
189  fUseMCVertex(source.fUseMCVertex),
191  fOptPileup(source.fOptPileup),
193  fMinDzPileup(source.fMinDzPileup),
199  fFixRefs(source.fFixRefs),
202  fMinPtCand(source.fMinPtCand),
203  fMaxPtCand(source.fMaxPtCand),
214  fKinkReject(source.fKinkReject),
217  fHistCentrDistr(0x0),
238  fTimeRangeCut(),
239  fCurrentRun(source.fCurrentRun),
242 {
243  //
244  // Copy constructor
245  //
246  cout<<"Copy constructor"<<endl;
247  fTriggerClass[0] = source.fTriggerClass[0];
248  fTriggerClass[1] = source.fTriggerClass[1];
249  if(source.GetTrackCuts()) AddTrackCuts(source.GetTrackCuts());
250  if(source.fPtBinLimits) SetPtBins(source.fnPtBinLimits,source.fPtBinLimits);
251  if(source.fVarNames) SetVarNames(source.fnVars,source.fVarNames,source.fIsUpperCut);
252  if(source.fCutsRD) SetCuts(source.fGlobalIndex,source.fCutsRD);
253  if(source.fVarsForOpt) SetVarsForOpt(source.fnVarsForOpt,source.fVarsForOpt);
254  if(source.fPidHF) SetPidHF(source.fPidHF);
255  if(source.fHistCentrDistr) fHistCentrDistr=(TH1F*)(source.fHistCentrDistr->Clone());
258  PrintAll();
259 
260 }
261 //--------------------------------------------------------------------------
263 {
264  //
265  // assignment operator
266  //
267  if(&source == this) return *this;
268 
269  AliAnalysisCuts::operator=(source);
270 
271  fMinVtxType=source.fMinVtxType;
272  fMinVtxContr=source.fMinVtxContr;
274  fMaxVtxZ=source.fMaxVtxZ;
280  fTriggerMask=source.fTriggerMask;
282  fTriggerClass[0]=source.fTriggerClass[0];
283  fTriggerClass[1]=source.fTriggerClass[1];
284  fnPtBins=source.fnPtBins;
286  fnVars=source.fnVars;
287  fGlobalIndex=source.fGlobalIndex;
288  fnVarsForOpt=source.fnVarsForOpt;
289  fUsePID=source.fUsePID;
290  fUseAOD049=source.fUseAOD049;
291  if(fPidHF) delete fPidHF;
292  fPidHF=new AliAODPidHF(*(source.GetPidHF()));
296  fUseMCVertex=source.fUseMCVertex;
298  fOptPileup=source.fOptPileup;
300  fMinDzPileup=source.fMinDzPileup;
306  fFixRefs=source.fFixRefs;
309  fMinPtCand=source.fMinPtCand;
310  fMaxPtCand=source.fMaxPtCand;
321  fKinkReject=source.fKinkReject;
323  if(fHistCentrDistr) delete fHistCentrDistr;
325  if(source.fHistCentrDistr)fHistCentrDistr=(TH1F*)(source.fHistCentrDistr->Clone());
326 
327  if(source.GetTrackCuts()) {delete fTrackCuts; fTrackCuts=new AliESDtrackCuts(*(source.GetTrackCuts()));}
328  if(source.fPtBinLimits) SetPtBins(source.fnPtBinLimits,source.fPtBinLimits);
329  if(source.fVarNames) SetVarNames(source.fnVars,source.fVarNames,source.fIsUpperCut);
330  if(source.fCutsRD) SetCuts(source.fGlobalIndex,source.fCutsRD);
331  if(source.fVarsForOpt) SetVarsForOpt(source.fnVarsForOpt,source.fVarsForOpt);
332 
353  fCurrentRun=source.fCurrentRun;
356 
357  PrintAll();
358 
359  return *this;
360 }
361 //--------------------------------------------------------------------------
363  //
364  // Default Destructor
365  //
366  if(fTrackCuts) { delete fTrackCuts; fTrackCuts=0; }
367  if(fPtBinLimits) {delete [] fPtBinLimits; fPtBinLimits=0;}
368  if(fVarNames) {delete [] fVarNames; fVarNames=0;}
369  if(fVarsForOpt) {delete [] fVarsForOpt; fVarsForOpt=0;}
370  if(fCutsRD) {
371  delete [] fCutsRD;
372  fCutsRD=0;
373  }
374  if(fIsUpperCut) {delete [] fIsUpperCut; fIsUpperCut=0;}
375  if(fPidHF){
376  delete fPidHF;
377  fPidHF=0;
378  }
380 
384  }
385  delete fAliEventCuts;
386 }
387 //---------------------------------------------------------------------------
389  //
390  // Centrality selection
391  //
392  if(fUseCentrality<kCentOff||fUseCentrality>=kCentInvalid){
393  AliWarning("Centrality estimator not valid");
394  return 3;
395  }else{
396  Float_t centvalue=GetCentrality((AliAODEvent*)event);
397  if (centvalue<-998.){//-999 if no centralityP
398  return 3;
400  return 3;
401  }else{
402  if (centvalue<fMinCentrality || centvalue>fMaxCentrality){
403  return 2;
404  }
405  // selection to flatten the centrality distribution
406  if(fHistCentrDistr){
407  if(!IsEventSelectedForCentrFlattening(centvalue))return 4;
408  }
409  }
410  }
411  return 0;
412 }
413 
414 
415 //-------------------------------------------------
416 void AliRDHFCuts::SetHistoForCentralityFlattening(TH1F *h,Double_t minCentr,Double_t maxCentr,Double_t centrRef,Int_t switchTRand){
417  // set the histo for centrality flattening
418  // the centrality is flatten in the range minCentr,maxCentr
419  // if centrRef is zero, the minimum in h within (minCentr,maxCentr) defines the reference
420  // positive, the value of h(centrRef) defines the reference (-> the centrality distribution might be not flat in the whole desired range)
421  // negative, h(bin with max in range)*centrRef is used to define the reference (-> defines the maximum loss of events, also in this case the distribution might be not flat)
422  // switchTRand is used to set the unerflow bin of the histo: if it is < -1 in the analysis the random event selection will be done on using TRandom
423 
424  if(maxCentr<minCentr){
425  AliWarning("AliRDHFCuts::Wrong centralities values while setting the histogram for centrality flattening");
426  }
427 
429  fHistCentrDistr=(TH1F*)h->Clone("hCentralityFlat");
430  fHistCentrDistr->SetTitle("Reference histo for centrality flattening");
431  Int_t minbin=fHistCentrDistr->FindBin(minCentr*1.00001); // fast if fix bin width
432  Int_t maxbin=fHistCentrDistr->FindBin(maxCentr*0.9999);
433  fHistCentrDistr->GetXaxis()->SetRange(minbin,maxbin);
434  Double_t ref=0.,bincont=0.,binrefwidth=1.;
435  Int_t binref=0;
436  if(TMath::Abs(centrRef)<0.0001){
437  binref=fHistCentrDistr->GetMinimumBin();
438  binrefwidth=fHistCentrDistr->GetBinWidth(binref);
439  ref=fHistCentrDistr->GetBinContent(binref)/binrefwidth;
440  }
441  else if(centrRef>0.){
442  binref=h->FindBin(centrRef);
443  if(binref<1||binref>h->GetNbinsX()){
444  AliWarning("AliRDHFCuts::Wrong centrality reference value while setting the histogram for centrality flattening");
445  }
446  binrefwidth=fHistCentrDistr->GetBinWidth(binref);
447  ref=fHistCentrDistr->GetBinContent(binref)/binrefwidth;
448  }
449  else{
450  if(centrRef<-1) AliWarning("AliRDHFCuts: with this centrality reference no flattening will be applied");
451  binref=fHistCentrDistr->GetMaximumBin();
452  binrefwidth=fHistCentrDistr->GetBinWidth(binref);
453  ref=fHistCentrDistr->GetMaximum()*TMath::Abs(centrRef)/binrefwidth;
454  }
455 
456  for(Int_t j=1;j<=h->GetNbinsX();j++){// Now set the "probabilities"
457  if(h->GetBinLowEdge(j)*1.0001>=minCentr&&h->GetBinLowEdge(j+1)*0.9999<=maxCentr){
458  bincont=h->GetBinContent(j);
459  fHistCentrDistr->SetBinContent(j,ref/bincont*h->GetBinWidth(j));
460  fHistCentrDistr->SetBinError(j,h->GetBinError(j)*ref/bincont);
461  }
462  else{
463  h->SetBinContent(j,1.1);// prob > 1 to assure that events will not be rejected
464  }
465  }
466 
467  fHistCentrDistr->SetBinContent(0,switchTRand);
468  return;
469 
470 }
471 
472 //-------------------------------------------------
474  //
475  // Random event selection, based on fHistCentrDistr, to flatten the centrality distribution
476  // Can be faster if it was required that fHistCentrDistr covers
477  // exactly the desired centrality range (e.g. part of the lines below should be done during the
478  // setting of the histo) and TH1::SetMinimum called
479  //
480 
481  if(!fHistCentrDistr) return kTRUE;
482  // Int_t maxbin=fHistCentrDistr->FindBin(fMaxCentrality*0.9999);
483  // if(maxbin>fHistCentrDistr->GetNbinsX()){
484  // AliWarning("AliRDHFCuts: The maximum centrality exceeds the x-axis limit of the histogram for centrality flattening");
485  // }
486 
487  Int_t bin=fHistCentrDistr->FindBin(centvalue); // Fast if the histo has a fix bin
488  Double_t bincont=fHistCentrDistr->GetBinContent(bin);
489  Double_t centDigits=centvalue-(Int_t)(centvalue*100.)/100.;// this is to extract a random number between 0 and 0.01
490 
491  if(fHistCentrDistr->GetBinContent(0)<-0.9999){
492  if(gRandom->Uniform(1.)<bincont)return kTRUE;
493  return kFALSE;
494  }
495 
496  if(centDigits*100.<bincont)return kTRUE;
497  return kFALSE;
498 
499 }
500 //---------------------------------------------------------------------------
501 void AliRDHFCuts::SetupPID(AliVEvent *event) {
502  // Set the PID response object in the AliAODPidHF
503  // in case of old PID sets the TPC dE/dx BB parameterization
504 
505  if(fPidHF){
506  if(fPidHF->GetPidResponse()==0x0){
507  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
508  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
509  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
510  fPidHF->SetPidResponse(pidResp);
511  }
513  if(fPidHF->GetOldPid()) {
514 
515  Bool_t isMC=kFALSE;
516  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)event)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
517  if(mcArray) {isMC=kTRUE;fUseAOD049=kFALSE;}
518 
519  // pp, from LHC10d onwards
520  if((event->GetRunNumber()>121693 && event->GetRunNumber()<136851) ||
521  event->GetRunNumber()>139517) fPidHF->SetOnePad(kTRUE);
522  // pp, 2011 low energy run
523  if((event->GetRunNumber()>=146686 && event->GetRunNumber()<=146860)){
524  fPidHF->SetppLowEn2011(kTRUE);
525  fPidHF->SetOnePad(kFALSE);
526  }
527  // PbPb LHC10h
528  if(event->GetRunNumber()>=136851 && event->GetRunNumber()<=139517) fPidHF->SetPbPb(kTRUE);
529  // MC
530  if(isMC) fPidHF->SetMC(kTRUE);
531  if(isMC && (event->GetRunNumber()>=146686 && event->GetRunNumber()<=146860))
532  fPidHF->SetMClowenpp2011(kTRUE);
534  }else{
535  // check that AliPIDResponse object was properly set in case of using OADB
536  if(fPidHF->GetPidResponse()==0x0) AliFatal("AliPIDResponse object not set");
537  }
538 
541  }
542  }
543 }
544 //---------------------------------------------------------------------------
546  //
547  // Event selection
548  //
549  //if(fTriggerMask && event->GetTriggerMask()!=fTriggerMask) return kFALSE;
550 
551  // commented for the time being
553 
554  fWhyRejection=0;
556  Bool_t accept=kTRUE;
557 
558 
559  // check if it's MC
560  Bool_t isMC=kFALSE;
561  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)event)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
562  if(mcArray) {isMC=kTRUE;fUseAOD049=kFALSE;}
563 
564 
565  SetupPID(event);
566 
567  // trigger class
568  TString firedTriggerClasses=((AliAODEvent*)event)->GetFiredTriggerClasses();
569  // don't do for MC and for PbPb 2010 data
570  if(!isMC && (event->GetRunNumber()<136851 || event->GetRunNumber()>139517)) {
571  if(!firedTriggerClasses.Contains(fTriggerClass[0].Data()) &&
572  (fTriggerClass[1].CompareTo("")==0 || !firedTriggerClasses.Contains(fTriggerClass[1].Data())) ) {
573  fWhyRejection=5;
575  accept=kFALSE;
576  }
577  }
578 
579 
580  // TEMPORARY FIX FOR GetEvent
581  Int_t nTracks=((AliAODEvent*)event)->GetNumberOfTracks();
582  for(Int_t itr=0; itr<nTracks; itr++){
583  AliAODTrack* tr=(AliAODTrack*)((AliAODEvent*)event)->GetTrack(itr);
584  tr->SetAODEvent((AliAODEvent*)event);
585  }
586 
587  // TEMPORARY FIX FOR REFERENCES
588  // Fix references to daughter tracks
589  // if(fFixRefs) {
590  // AliAnalysisVertexingHF *fixer = new AliAnalysisVertexingHF();
591  // fixer->FixReferences((AliAODEvent*)event);
592  // delete fixer;
593  // }
594  //
595 
596  // cuts used for run 2 Pb-Pb from AliEventCuts
597  Bool_t doAliEvCuts=kFALSE;
599  doAliEvCuts=kTRUE;
600  Int_t runNumb=event->GetRunNumber();
601  if(runNumb >= 244917 && runNumb <= 246994) fAliEventCuts->SetupRun2PbPb();
602  else if(runNumb >= 295369 && runNumb <= 297624) fAliEventCuts->SetupPbPb2018();
603  else doAliEvCuts=kFALSE;
604  }
605 
606  if(doAliEvCuts) fAliEventCuts->AcceptEvent(event);
607 
608  // physics selection requirements
610  Bool_t isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerMask);
611  if(!isSelected) {
612  if(accept) fWhyRejection=7;
614  accept=kFALSE;
615  }else{
616  if(fUseOnlyOneTrigger){
617  if(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()!=fTriggerMask){
618  if(accept) fWhyRejection=7;
620  accept=kFALSE;
621  }
622  }
624  AliAODVZERO* v0data=(AliAODVZERO*)((AliAODEvent*)event)->GetVZEROData();
625  Int_t tv0a=v0data->GetV0ADecision();
626  Int_t tv0c=v0data->GetV0CDecision();
627  if(!(tv0a==1 && tv0c==1)){
628  if(accept) fWhyRejection=7;
630  accept=kFALSE;
631  }
632  }
633  }
634  }
635 
637  Int_t nrun=event->GetRunNumber();
638  if(nrun!=fCurrentRun){
639  fCurrentRun=nrun;
640  fTimeRangeCut.InitFromRunNumber(fCurrentRun);
641  }
642  if(fTimeRangeCut.CutEvent((AliAODEvent*)event)){
643  // use same fWhyRejection as for physics selection, to have proper counting of events for norm
644  if(accept) fWhyRejection=7;
646  accept=kFALSE;
647  }
648  }
649 
650  // centrality selection
651  if (fUseCentrality!=kCentOff) {
652  Int_t rejection=IsEventSelectedInCentrality(event);
653  Bool_t okCent=kFALSE;
654  if(rejection==0) okCent=kTRUE;
655  if(isMC && rejection==4 && !fUseCentrFlatteningInMC) okCent=kTRUE;
656  if(!okCent){
657  if(accept) fWhyRejection=rejection;
660  accept=kFALSE;
661  }
662 
663  }
664 
665  // PbPb2011 outliers in tracklets vs. VZERO and centTRK vs. centV0
666  if(event->GetRunNumber()>=167693 && event->GetRunNumber()<=170593){
668  Double_t v0cent=GetCentrality((AliAODEvent*)event,kCentV0M);
669  Double_t ntracklets=((AliAODEvent*)event)->GetTracklets()->GetNumberOfTracklets();
670  Double_t cutval=60.-0.08*ntracklets+1./50000.*ntracklets*ntracklets;
671  if(ntracklets<1000. && v0cent<cutval){
672  if(accept) fWhyRejection=2;
674  accept=kFALSE;
675  }
676  }
677  if(fMaxDiffTRKV0Centr>0.){
678  Double_t v0cent=GetCentrality((AliAODEvent*)event,kCentV0M);
679  Double_t trkcent=GetCentrality((AliAODEvent*)event,kCentTRK);
680  if(TMath::Abs(trkcent-v0cent)>fMaxDiffTRKV0Centr){
681  if(accept) fWhyRejection=1;
683  accept=kFALSE;
684  }
685  }
686  }
687 
688  // cuts on correlations between centrality estimators in Pb-Pb 2015 and Pb-Pb 2018
689  if(fApplyCentralityCorrCuts && doAliEvCuts){
690  if(!fAliEventCuts->PassedCut(AliEventCuts::kMultiplicity)){
691  if(accept) fWhyRejection=1; // for fWhyRejection they are classified as pileup
693  accept=kFALSE;
694  }
695  }
696 
697  // vertex requirements
698 
699  const AliVVertex *vertex = event->GetPrimaryVertex();
700 
701  if(!vertex){
702  accept=kFALSE;
704  }else{
705  TString title=vertex->GetTitle();
706  if(title.Contains("Z") && fMinVtxType>1){
707  accept=kFALSE;
709  }
710  else if(title.Contains("3D") && fMinVtxType>2){
711  accept=kFALSE;
713  }
714  if(vertex->GetNContributors()<fMinVtxContr){
715  accept=kFALSE;
717  }
718  }
719 
720  const AliVVertex *vSPD = ((AliAODEvent*)event)->GetPrimaryVertexSPD();
721  if(fCutOnzVertexSPD>0){
722  if(!vSPD || (vSPD && vSPD->GetNContributors()<fMinVtxContr)){
723  accept=kFALSE;
725  }else{
726  if(fCutOnzVertexSPD==1 && TMath::Abs(vSPD->GetZ())>12.) {
727  // protection for events with bad reconstructed track vertex (introduced for 2011 Pb-Pb)
729  if(accept) fWhyRejection=6;
730  accept=kFALSE;
731  }
732  if(fCutOnzVertexSPD>=2 && vertex){
733  Double_t dz = vSPD->GetZ()-vertex->GetZ();
734  // cut on absolute distance between track and SPD vertex (introduced for 2011 Pb-Pb)
735  if(TMath::Abs(dz)>0.5) {
737  if(accept) fWhyRejection=0;
738  accept=kFALSE;
739  }
740  if(accept && fCutOnzVertexSPD==3){
741  // cut on nsigma distance between track and SPD vertex (for 2015 Pb-Pb)
742  double covTrc[6],covSPD[6];
743  vertex->GetCovarianceMatrix(covTrc);
744  vSPD->GetCovarianceMatrix(covSPD);
745  double errTot = TMath::Sqrt(covTrc[5]+covSPD[5]);
746  double errTrc = TMath::Sqrt(covTrc[5]);
747  double nsigTot = TMath::Abs(dz)/errTot, nsigTrc = TMath::Abs(dz)/errTrc;
748  if (TMath::Abs(dz)>0.2 || nsigTot>10 || nsigTrc>20){
749  // reject, bad reconstructed track vertex
751  if(accept) fWhyRejection=0;
752  accept=kFALSE;
753  }
754  }
755  }
756  }
757  }
758 
759  Double_t zvert = -999;
760  if(!fApplyZcutOnSPDvtx && vertex) zvert=vertex->GetZ();
761  else if(fApplyZcutOnSPDvtx) {
762  if(!vSPD || (vSPD && vSPD->GetNContributors()<1)){
763  accept=kFALSE;
765  }
766  else zvert = vSPD->GetZ();
767  }
768 
769  if(TMath::Abs(zvert)>fMaxVtxZ) {
771  if(accept) fWhyRejection=6;
772  accept=kFALSE;
773  }
774 
775  // pile-up rejection
777  Bool_t isPileup=kFALSE;
779  isPileup=event->IsPileupFromSPDInMultBins();
780  }else{
783  isPileup=event->IsPileupFromSPD(cutc,cutz,3.,2.,10.);
784  }
785  if(isPileup){
786  if(accept) fWhyRejection=1;
788  accept=kFALSE;
789  }
790  }
792  AliAnalysisUtils utils;
793  utils.SetMinPlpContribMV(fMinContrPileupMV); // min. multiplicity of the pile-up vertex to consider
794  utils.SetMaxPlpChi2MV(fMaxVtxChi2PileupMV); // max chi2 per contributor of the pile-up vertex to consider.
795  utils.SetMinWDistMV(fMinWDzPileupMV); // minimum weighted distance in Z between 2 vertices (i.e. (zv1-zv2)/sqrt(sigZv1^2+sigZv2^2) )
796  utils.SetCheckPlpFromDifferentBCMV(fRejectPlpFromDiffBCMV); // vertex with |BCID|>2 will trigger pile-up (based on TOF)
797  Bool_t isPUMV = utils.IsPileUpMV(event);
798  if(isPUMV) {
799  if(accept) fWhyRejection=1;
801  accept=kFALSE;
802  }
803  }
804 
805  // cut on correlations for out of bunch pileup in PbPb run2
806  if(fApplyPbPbOutOfBunchPileupCuts==1 && doAliEvCuts){
807  if(!fAliEventCuts->PassedCut(AliEventCuts::kCorrelations)){
808  if(accept) fWhyRejection=1; // for fWhyRejection they are classified as pileup
810  accept=kFALSE;
811  }
812  }else if(fApplyPbPbOutOfBunchPileupCuts==2 && event->GetRunNumber() >= 295369 && event->GetRunNumber() <= 297624){
813  // Ionut cut on V0multiplicity vs. n TPC clusters (Pb-Pb 2018)
814  AliAODVZERO* v0data=(AliAODVZERO*)((AliAODEvent*)event)->GetVZEROData();
815  Float_t mTotV0=v0data->GetMTotV0A()+v0data->GetMTotV0C();
816  Int_t nTPCcls=((AliAODEvent*)event)->GetNumberOfTPCClusters();
817  Float_t mV0TPCclsCut=-2000.+(0.013*nTPCcls)+(1.25e-9*nTPCcls*nTPCcls);
818  if(mTotV0<mV0TPCclsCut){
819  if(accept) fWhyRejection=1;
821  accept=kFALSE;
822  }
823  }
824 
825  // Correcting PP2012 flag to remove tracks crossing SPD misaligned staves for periods 12def
826  if(fApplySPDMisalignedPP2012 && !(event->GetRunNumber()>=195681 && event->GetRunNumber()<=197388)) fApplySPDMisalignedPP2012=false;
827 
828  return accept;
829 }
830 //---------------------------------------------------------------------------
832  //
833  // Event selection with AliEventCuts
834  //
835 
836  fWhyRejection=0;
838  Bool_t accept=kTRUE;
839 
840  // check if it's MC
841  Bool_t isMC=kFALSE;
842  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)event)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
843  if(mcArray) {isMC=kTRUE;fUseAOD049=kFALSE;}
844 
845 
846  SetupPID(event);
847 
848  // TEMPORARY FIX FOR GetEvent
849  Int_t nTracks=((AliAODEvent*)event)->GetNumberOfTracks();
850  for(Int_t itr=0; itr<nTracks; itr++){
851  AliAODTrack* tr=(AliAODTrack*)((AliAODEvent*)event)->GetTrack(itr);
852  tr->SetAODEvent((AliAODEvent*)event);
853  }
854 
855  Int_t runNumb=event->GetRunNumber();
856  if(runNumb >= 244917 && runNumb <= 246994) fAliEventCuts->SetupRun2PbPb();
857  else if(runNumb >= 295369 && runNumb <= 297624) fAliEventCuts->SetupPbPb2018();
858  else fAliEventCuts->SetManualMode(kFALSE);
859 
860  if(fUseTimeRangeCutForPbPb2018) fAliEventCuts->UseTimeRangeCut();
861 
862  // setup cuts
863  TString selTrigClassClass="";
864  if(!isMC && (event->GetRunNumber()<136851 || event->GetRunNumber()>139517)) {
865  // don't do for MC and for PbPb 2010 data
866  if(fTriggerClass[0].Length()>0){
867  selTrigClassClass=fTriggerClass[0].Data();
868  if(fTriggerClass[1].Length()>0) selTrigClassClass.Append(Form(",%s",fTriggerClass[1].Data()));
869  }
870  }
871  fAliEventCuts->OverrideAutomaticTriggerSelection(fTriggerMask);
872  if(fUseOnlyOneTrigger) fAliEventCuts->fRequireExactTriggerMask=kTRUE;
873  fAliEventCuts->OverridePileUpCuts(fMinContrPileup,fMinDzPileup,3.,2.,5.);
874  fAliEventCuts->fTrackletBGcut=kFALSE;
876  fAliEventCuts->fPileUpCutMV=kFALSE;
877  fAliEventCuts->fUseSPDpileUpCut=kTRUE;
878  if(fUseMultDepPileupCut) fAliEventCuts->fUseMultiplicityDependentPileUpCuts=kTRUE;
879  }
881  fAliEventCuts->fPileUpCutMV=kTRUE;
882  fAliEventCuts->fUseSPDpileUpCut=kFALSE;
883  fAliEventCuts->fUtils.SetMinPlpContribMV(fMinContrPileupMV);
884  fAliEventCuts->fUtils.SetMaxPlpChi2MV(fMaxVtxChi2PileupMV);
885  fAliEventCuts->fUtils.SetMinWDistMV(fMinWDzPileupMV);
886  fAliEventCuts->fUtils.SetCheckPlpFromDifferentBCMV(fRejectPlpFromDiffBCMV);
887  }
888  fAliEventCuts->SetMaxVertexZposition(fMaxVtxZ);
889 
890  fAliEventCuts->AcceptEvent(event);
891 
892  // trigger class
893  if(selTrigClassClass.Length()>0 && !fAliEventCuts->PassedCut(AliEventCuts::kTriggerClasses)){
894  fWhyRejection=5;
896  accept=kFALSE;
897  }
898 
899  // physics selection requirements
901  if(!fAliEventCuts->PassedCut(AliEventCuts::kTrigger)){
902  if(accept) fWhyRejection=7;
904  accept=kFALSE;
905  }else{
907  AliAODVZERO* v0data=(AliAODVZERO*)((AliAODEvent*)event)->GetVZEROData();
908  Int_t tv0a=v0data->GetV0ADecision();
909  Int_t tv0c=v0data->GetV0CDecision();
910  if(!(tv0a==1 && tv0c==1)){
911  if(accept) fWhyRejection=7;
913  accept=kFALSE;
914  }
915  }
916  }
917  }
919  if(!fAliEventCuts->PassedCut(AliEventCuts::kTimeRangeCut)){
920  // use same fWhyRejection as for physics selection, to have proper counting of events for norm
921  if(accept) fWhyRejection=7;
923  accept=kFALSE;
924  }
925  }
926 
927  // centrality selection
928  if (fUseCentrality!=kCentOff) {
929  Int_t rejection=IsEventSelectedInCentrality(event);
930  Bool_t okCent=kFALSE;
931  if(rejection==0) okCent=kTRUE;
932  if(isMC && rejection==4 && !fUseCentrFlatteningInMC) okCent=kTRUE;
933  if(!okCent){
934  if(accept) fWhyRejection=rejection;
937  accept=kFALSE;
938  }
939  }
940 
941  // PbPb2011 outliers in tracklets vs. VZERO and centTRK vs. centV0
942  if(event->GetRunNumber()>=167693 && event->GetRunNumber()<=170593){
944  Double_t v0cent=GetCentrality((AliAODEvent*)event,kCentV0M);
945  Double_t ntracklets=((AliAODEvent*)event)->GetTracklets()->GetNumberOfTracklets();
946  Double_t cutval=60.-0.08*ntracklets+1./50000.*ntracklets*ntracklets;
947  if(ntracklets<1000. && v0cent<cutval){
948  if(accept) fWhyRejection=2;
950  accept=kFALSE;
951  }
952  }
953  if(fMaxDiffTRKV0Centr>0.){
954  Double_t v0cent=GetCentrality((AliAODEvent*)event,kCentV0M);
955  Double_t trkcent=GetCentrality((AliAODEvent*)event,kCentTRK);
956  if(TMath::Abs(trkcent-v0cent)>fMaxDiffTRKV0Centr){
957  if(accept) fWhyRejection=1;
959  accept=kFALSE;
960  }
961  }
962  }
963 
964  // cuts on correlations between centrality estimators in Pb-Pb 2015 and Pb-Pb 2018
966  if(!fAliEventCuts->PassedCut(AliEventCuts::kMultiplicity)){
967  if(accept) fWhyRejection=1; // for fWhyRejection they are classified as pileup
969  accept=kFALSE;
970  }
971  }
972 
973  // vertex requirements
974 
975  if(fMinVtxType>2 && !fAliEventCuts->PassedCut(AliEventCuts::kVertexTracks)){
976  accept=kFALSE;
978  }
979  if(fMinVtxType<=2 && !fAliEventCuts->PassedCut(AliEventCuts::kVertexSPD)){
980  accept=kFALSE;
982  }
983 
984  if(fCutOnzVertexSPD>0){
985  if(!fAliEventCuts->PassedCut(AliEventCuts::kVertexSPD)){
986  accept=kFALSE;
988  }else{
989  if(fCutOnzVertexSPD==1 && !fAliEventCuts->PassedCut(AliEventCuts::kVertexPositionSPD)){
990  // protection for events with bad reconstructed track vertex (introduced for 2011 Pb-Pb)
992  if(accept) fWhyRejection=6;
993  accept=kFALSE;
994  }
995  if(fCutOnzVertexSPD>=2 && !fAliEventCuts->PassedCut(AliEventCuts::kVertexQuality)){
997  if(accept) fWhyRejection=0;
998  accept=kFALSE;
999  }
1000  }
1001  }
1002 
1003  if(!fAliEventCuts->PassedCut(AliEventCuts::kVertexPosition)){
1005  if(accept) fWhyRejection=6;
1006  accept=kFALSE;
1007  }
1008 
1009  // pile-up rejection
1011  if(!fAliEventCuts->PassedCut(AliEventCuts::kPileUp)){
1012  if(accept) fWhyRejection=1;
1014  accept=kFALSE;
1015  }
1016  }
1017  // cut on correlations for out of bunch pileup in PbPb run2
1019  if(!fAliEventCuts->PassedCut(AliEventCuts::kCorrelations)){
1020  if(accept) fWhyRejection=1; // for fWhyRejection they are classified as pileup
1022  accept=kFALSE;
1023  }
1024  }else if(fApplyPbPbOutOfBunchPileupCuts==2 && event->GetRunNumber() >= 295369 && event->GetRunNumber() <= 297624){
1025  // Ionut cut on V0multiplicity vs. n TPC clusters (Pb-Pb 2018)
1026  AliAODVZERO* v0data=(AliAODVZERO*)((AliAODEvent*)event)->GetVZEROData();
1027  Float_t mTotV0=v0data->GetMTotV0A()+v0data->GetMTotV0C();
1028  Int_t nTPCcls=((AliAODEvent*)event)->GetNumberOfTPCClusters();
1029  Float_t mV0TPCclsCut=-2000.+(0.013*nTPCcls)+(1.25e-9*nTPCcls*nTPCcls);
1030  if(mTotV0<mV0TPCclsCut){
1031  if(accept) fWhyRejection=1;
1033  accept=kFALSE;
1034  }
1035  }
1036 
1037  // Correcting PP2012 flag to remove tracks crossing SPD misaligned staves for periods 12def
1038  if(fApplySPDMisalignedPP2012 && !(event->GetRunNumber()>=195681 && event->GetRunNumber()<=197388)) fApplySPDMisalignedPP2012=false;
1039 
1040  return accept;
1041 }
1042 //---------------------------------------------------------------------------
1044  //
1045  // Daughter tracks selection
1046  //
1047  if(!fTrackCuts) return kTRUE;
1048 
1049  Int_t ndaughters = d->GetNDaughters();
1050  AliAODVertex *vAOD = d->GetPrimaryVtx();
1051  Double_t pos[3],cov[6];
1052  vAOD->GetXYZ(pos);
1053  vAOD->GetCovarianceMatrix(cov);
1054  const AliESDVertex vESD(pos,cov,100.,100);
1055 
1056  Bool_t retval=kTRUE;
1057 
1058  for(Int_t idg=0; idg<ndaughters; idg++) {
1059  AliAODTrack *dgTrack = (AliAODTrack*)d->GetDaughter(idg);
1060  if(!dgTrack) {retval = kFALSE; continue;}
1061  //printf("charge %d\n",dgTrack->Charge());
1062  if(dgTrack->Charge()==0) continue; // it's not a track, but a V0
1063 
1065  { if(!dgTrack->HasPointOnITSLayer(0)) { retval = kFALSE; continue; } }
1066 
1067  if(!IsDaughterSelected(dgTrack,&vESD,fTrackCuts,aod)) retval = kFALSE;
1068  }
1069 
1070  return retval;
1071 }
1072 //---------------------------------------------------------------------------
1074  //
1075  // Check if AOD and deltaAOD files are composed of the same events:
1076  // mismatches were observed in the merged AODs of LHC15o
1077  //
1078  // When AOD+deltaAOD are produced from ESD, mismatches can be found looking at:
1079  // - the AOD trees in AliAOD.root and AliAOD.VertexingHF.root have different number of entries
1080  // - the titles of the TProcessID objects do not match
1081  // When deltaAOD are produced from AOD, mismatches can be found looking at:
1082  // - the AOD trees in AliAOD.root and AliAOD.VertexingHF.root have different number of entries
1083  //
1084  // Return values:
1085  // -1: AOD and deltaAOD trees have different number of entries
1086  // 0: AOD and deltaAOD trees have same number of entries + the titles of the TProcessID objects do not match
1087  // 1: AOD and deltaAOD trees have same number of entries + the titles of the TProcessID objects match
1088  Bool_t okTProcessNames = kTRUE;
1089  AliAODHandler* aodHandler = (AliAODHandler*)((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
1090  TTree *treeAOD = aodHandler->GetTree();
1091  TTree *treeDeltaAOD = treeAOD->GetFriend("aodTree");
1092  if(!treeDeltaAOD || !treeAOD) return -1;
1093  if(treeDeltaAOD && treeAOD){
1094  if(treeAOD->GetEntries()!=treeDeltaAOD->GetEntries()){
1095  printf("AliRDHFCuts::CheckMatchingAODdeltaAODevents: Difference in number of entries in main and friend tree, skipping event\n");
1096  return -1;
1097  }
1098  TFile *mfile = treeAOD->GetCurrentFile();
1099  TFile *dfile = treeDeltaAOD->GetCurrentFile();
1100  TList* lm=mfile->GetListOfKeys();
1101  TList* ld=dfile->GetListOfKeys();
1102  Int_t nentm=lm->GetEntries();
1103  for(Int_t jm=0; jm<nentm; jm++){
1104  TKey* o=(TKey*)lm->At(jm);
1105  TString clnam=o->GetClassName();
1106  if(clnam=="TProcessID"){
1107  TString pname=o->GetName();
1108  TString ptit=o->GetTitle();
1109  if(pname.Contains("ProcessID")){
1110  TObject* od=(TObject*)ld->FindObject(pname.Data());
1111  if(od){
1112  TString ptit2=od->GetTitle();
1113  if(ptit2!=ptit){
1114  printf("AliRDHFCuts::CheckMatchingAODdeltaAODevents: mismatch in %s: AOD: %s -- deltaAOD: %s\n",pname.Data(),ptit.Data(),ptit2.Data());
1115  okTProcessNames = kFALSE;
1116  }
1117  }
1118  }
1119  }
1120  }
1121  }
1122 
1123  if (okTProcessNames) return 1;
1124  else return 0;
1125 }
1126 //---------------------------------------------------------------------------
1128  //
1129  // Check the correctness of the string syntax
1130  //
1131  Bool_t retval=kTRUE;
1132 
1133  if(!rows.Contains("pt")) {
1134  if(print) AliError("string must contain \"pt\"");
1135  retval= kFALSE;
1136  }
1137  return retval;
1138 }
1139 //---------------------------------------------------------------------------
1141  //
1142  //Create the TFormula from TString for TPC crossed rows pT dependent cut
1143  //
1144 
1145 
1146  // setting data member that describes the TPC crossed rows pT dependent cut
1148 
1149  // creating TFormula from TString
1152  // resetting TFormula
1154  }
1155  if(!CheckPtDepCrossedRows(rows,kTRUE))return;
1156 
1157  TString tmp(rows);
1158  tmp.ReplaceAll("pt","x");
1159  f1CutMinNCrossedRowsTPCPtDep = new TFormula("f1CutMinNCrossedRowsTPCPtDep",tmp.Data());
1160 
1161 
1162 }
1163 //---------------------------------------------------------------------------
1164 Bool_t AliRDHFCuts::IsDaughterSelected(AliAODTrack *track,const AliESDVertex *primary,AliESDtrackCuts *cuts, const AliAODEvent* aod) const{
1165  //
1166  // Convert to ESDtrack, relate to vertex and check cuts
1167  //
1168  if(!cuts) return kTRUE;
1169 
1170  if(cuts->GetFlagCutTOFdistance()) cuts->SetFlagCutTOFdistance(kFALSE);
1171 
1172 
1173  // convert to ESD track here
1174  AliESDtrack esdTrack(track);
1175  // set the TPC cluster info
1176  esdTrack.SetTPCClusterMap(track->GetTPCClusterMap());
1177  esdTrack.SetTPCSharedMap(track->GetTPCSharedMap());
1178  esdTrack.SetTPCPointsF(track->GetTPCNclsF());
1179  // needed to calculate the impact parameters
1180  esdTrack.RelateToVertex(primary,0.,3.);
1181 
1182  //applying ESDtrackCut
1183  if(!cuts->IsSelected(&esdTrack)) return kFALSE;
1184 
1185  //appliyng kink rejection
1186  if(fKinkReject){
1187  AliAODVertex *maybeKink=track->GetProdVertex();
1188  if(maybeKink->GetType()==AliAODVertex::kKink) return kFALSE;
1189  }
1190 
1191  //appliyng TPC crossed rows pT dependent cut
1193  Float_t nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
1194  if(nCrossedRowsTPC<f1CutMinNCrossedRowsTPCPtDep->Eval(esdTrack.Pt())) return kFALSE;
1195  }
1196 
1197  //appliyng NTPCcls/NTPCcrossedRows cut
1199  Float_t nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
1200  Float_t nClustersTPC = esdTrack.GetTPCNcls();
1201  if(nCrossedRowsTPC!=0){
1202  Float_t ratio = nClustersTPC/nCrossedRowsTPC;
1203  if(ratio<fCutRatioClsOverCrossRowsTPC) return kFALSE;
1204  }
1205  else return kFALSE;
1206  }
1207 
1208  //appliyng TPCsignalN/NTPCcrossedRows cut
1210  Float_t nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
1211  Float_t nTPCsignal = esdTrack.GetTPCsignalN();
1212  if(nCrossedRowsTPC!=0){
1213  Float_t ratio = nTPCsignal/nCrossedRowsTPC;
1214  if(ratio<fCutRatioSignalNOverCrossRowsTPC) return kFALSE;
1215  }
1216  else return kFALSE;
1217  }
1218 
1219  // cut on the number of TPC clusters for PID
1221  Float_t nTPCsignal = esdTrack.GetTPCsignalN();
1222  if(nTPCsignal<fCutTPCSignalN) return kFALSE;
1223  }
1224 
1225  // geometrical cut (note uses track at vertex instead of at TPC inner wall)
1227  Float_t nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
1228  Float_t lengthInActiveZoneTPC=esdTrack.GetLengthInActiveZone(0,fDeadZoneWidth,220.,aod->GetMagneticField());
1229  Double_t cutGeoNcrNclLength=fCutGeoNcrNclLength-TMath::Power(TMath::Abs(esdTrack.GetSigned1Pt()),fCutGeoNcrNclGeom1Pt);
1230  Bool_t isOK=kTRUE;
1231  if (lengthInActiveZoneTPC<cutGeoNcrNclLength) isOK=kFALSE;
1232  if (nCrossedRowsTPC<fCutGeoNcrNclFractionNcr*cutGeoNcrNclLength) isOK=kFALSE;
1233  if (esdTrack.GetTPCncls()<fCutGeoNcrNclFractionNcl*cutGeoNcrNclLength) isOK=kFALSE;
1234  if(!isOK) return kFALSE;
1235  }
1236 
1237 
1239  // to be implemented
1240  // we need either to have here the AOD Event,
1241  // or to have the pileup vertex object
1242  }
1243 
1245  Bool_t deadSPDLay1PbPb2011[20][4]={
1246  {kTRUE,kTRUE,kTRUE,kTRUE},
1247  {kTRUE,kTRUE,kTRUE,kTRUE},
1248  {kTRUE,kTRUE,kTRUE,kTRUE},
1249  {kTRUE,kTRUE,kTRUE,kTRUE},
1250  {kTRUE,kTRUE,kTRUE,kTRUE},
1251  {kFALSE,kFALSE,kTRUE,kTRUE},
1252  {kTRUE,kTRUE,kFALSE,kFALSE},
1253  {kTRUE,kTRUE,kTRUE,kTRUE},
1254  {kFALSE,kFALSE,kTRUE,kTRUE},
1255  {kTRUE,kTRUE,kTRUE,kTRUE},
1256  {kTRUE,kTRUE,kFALSE,kFALSE},
1257  {kTRUE,kTRUE,kTRUE,kTRUE},
1258  {kFALSE,kFALSE,kFALSE,kFALSE},
1259  {kFALSE,kFALSE,kTRUE,kTRUE},
1260  {kFALSE,kFALSE,kFALSE,kFALSE},
1261  {kFALSE,kFALSE,kFALSE,kFALSE},
1262  {kTRUE,kTRUE,kTRUE,kTRUE},
1263  {kTRUE,kTRUE,kFALSE,kFALSE},
1264  {kFALSE,kFALSE,kFALSE,kFALSE},
1265  {kFALSE,kFALSE,kFALSE,kFALSE}
1266  };
1267  Bool_t deadSPDLay2PbPb2011[40][4]={
1268  {kTRUE,kTRUE,kTRUE,kTRUE},
1269  {kTRUE,kTRUE,kTRUE,kTRUE},
1270  {kTRUE,kTRUE,kTRUE,kTRUE},
1271  {kTRUE,kTRUE,kTRUE,kTRUE},
1272  {kTRUE,kTRUE,kTRUE,kTRUE},
1273  {kTRUE,kTRUE,kTRUE,kTRUE},
1274  {kTRUE,kTRUE,kTRUE,kTRUE},
1275  {kTRUE,kTRUE,kTRUE,kTRUE},
1276  {kTRUE,kTRUE,kTRUE,kTRUE},
1277  {kTRUE,kTRUE,kTRUE,kTRUE},
1278  {kTRUE,kTRUE,kTRUE,kTRUE},
1279  {kTRUE,kTRUE,kTRUE,kTRUE},
1280  {kFALSE,kFALSE,kFALSE,kFALSE},
1281  {kFALSE,kFALSE,kTRUE,kTRUE},
1282  {kTRUE,kTRUE,kTRUE,kTRUE},
1283  {kTRUE,kTRUE,kTRUE,kTRUE},
1284  {kTRUE,kTRUE,kFALSE,kFALSE},
1285  {kTRUE,kTRUE,kTRUE,kTRUE},
1286  {kTRUE,kTRUE,kTRUE,kTRUE},
1287  {kTRUE,kTRUE,kTRUE,kTRUE},
1288  {kFALSE,kFALSE,kFALSE,kFALSE},
1289  {kFALSE,kFALSE,kFALSE,kFALSE},
1290  {kTRUE,kTRUE,kTRUE,kTRUE},
1291  {kTRUE,kTRUE,kTRUE,kTRUE},
1292  {kFALSE,kFALSE,kFALSE,kFALSE},
1293  {kFALSE,kFALSE,kFALSE,kFALSE},
1294  {kTRUE,kTRUE,kTRUE,kTRUE},
1295  {kTRUE,kTRUE,kTRUE,kTRUE},
1296  {kFALSE,kFALSE,kFALSE,kFALSE},
1297  {kFALSE,kFALSE,kFALSE,kFALSE},
1298  {kFALSE,kFALSE,kFALSE,kFALSE},
1299  {kFALSE,kFALSE,kFALSE,kFALSE},
1300  {kTRUE,kTRUE,kTRUE,kTRUE},
1301  {kTRUE,kTRUE,kTRUE,kTRUE},
1302  {kTRUE,kTRUE,kFALSE,kFALSE},
1303  {kTRUE,kTRUE,kTRUE,kTRUE},
1304  {kFALSE,kFALSE,kFALSE,kFALSE},
1305  {kFALSE,kFALSE,kFALSE,kFALSE},
1306  {kFALSE,kFALSE,kFALSE,kFALSE},
1307  {kFALSE,kFALSE,kFALSE,kFALSE}
1308  };
1309  Double_t xyz1[3],xyz2[3];
1310  esdTrack.GetXYZAt(3.9,0.,xyz1);
1311  esdTrack.GetXYZAt(7.6,0.,xyz2);
1312  Double_t phi1=TMath::ATan2(xyz1[1],xyz1[0]);
1313  if(phi1<0) phi1+=2*TMath::Pi();
1314  Int_t lad1=(Int_t)(phi1/(2.*TMath::Pi()/20.));
1315  Double_t phi2=TMath::ATan2(xyz2[1],xyz2[0]);
1316  if(phi2<0) phi2+=2*TMath::Pi();
1317  Int_t lad2=(Int_t)(phi2/(2.*TMath::Pi()/40.));
1318  Int_t mod1=TMath::Floor((xyz1[2]+14)/7.);
1319  Int_t mod2=TMath::Floor((xyz2[2]+14)/7.);
1320  Bool_t lay1ok=kFALSE;
1321  if(mod1>=0 && mod1<4 && lad1<20){
1322  lay1ok=deadSPDLay1PbPb2011[lad1][mod1];
1323  }
1324  Bool_t lay2ok=kFALSE;
1325  if(mod2>=0 && mod2<4 && lad2<40){
1326  lay2ok=deadSPDLay2PbPb2011[lad2][mod2];
1327  }
1328  if(!lay1ok && !lay2ok) return kFALSE;
1329  }
1330 
1332  // Cut tracks crossing the SPD at 5.6<phi<2pi
1333  Double_t xyz1[3],xyz2[3];
1334  esdTrack.GetXYZAt(3.9,0.,xyz1);
1335  esdTrack.GetXYZAt(7.6,0.,xyz2);
1336  Double_t phi1=TMath::ATan2(xyz1[1],xyz1[0]);
1337  if(phi1<0) phi1+=2*TMath::Pi();
1338  Double_t phi2=TMath::ATan2(xyz2[1],xyz2[0]);
1339  if(phi2<0) phi2+=2*TMath::Pi();
1340  Bool_t lay1ok=kTRUE;
1341  if(phi1>5.6 && phi1<2.*TMath::Pi()) lay1ok=kFALSE;
1342  Bool_t lay2ok=kTRUE;
1343  if(phi2>5.6 && phi2<2.*TMath::Pi()) lay2ok=kFALSE;
1344  if(!lay1ok || !lay2ok) return kFALSE;
1345  }
1346 
1348  // Cut tracks crossing the regions at
1349  // --> 0.94<phi<1.34 and 0<z<14cm (corresponding to the region of SPD HS 1A0)
1350  // --> 3.49<phi<3.9 and -14<z<0 cm (corresponding to the region of SPD HS 5C0)
1351  // Reason: HS 1A0 and 5C0 were excluded from 2018 Pb-Pb data taking, while were present in 2015 Pb-Pb data taking
1352  // Goal: this patch should allow to use the same SPD regions between the two periods
1353  Double_t xyz1[3];
1354  esdTrack.GetXYZAt(3.9,0.,xyz1);
1355  Double_t phi1=TMath::ATan2(xyz1[1],xyz1[0]);
1356  if((phi1<1.34 && phi1>0.94) && (xyz1[2]>0 && xyz1[2]<14)) return kFALSE; // exclude region of 1A0
1357  if((phi1<3.9 && phi1>3.49) && (xyz1[2]>-14 && xyz1[2]<0)) return kFALSE; //exclude region of 5C0
1358  }
1359 
1360  return kTRUE;
1361 }
1362 //---------------------------------------------------------------------------
1363 void AliRDHFCuts::SetPtBins(Int_t nPtBinLimits,Float_t *ptBinLimits) {
1364  // Set the pt bins
1365 
1366  if(fPtBinLimits) {
1367  delete [] fPtBinLimits;
1368  fPtBinLimits = NULL;
1369  printf("Changing the pt bins\n");
1370  }
1371 
1372  if(nPtBinLimits != fnPtBins+1){
1373  cout<<"Warning: ptBinLimits dimention "<<nPtBinLimits<<" != nPtBins+1 ("<<fnPtBins+1<<")\nSetting nPtBins to "<<nPtBinLimits-1<<endl;
1374  SetNPtBins(nPtBinLimits-1);
1375  }
1376 
1377  fnPtBinLimits = nPtBinLimits;
1378  SetGlobalIndex();
1379  //cout<<"Changing also Global Index -> "<<fGlobalIndex<<endl;
1381  for(Int_t ib=0; ib<nPtBinLimits; ib++) fPtBinLimits[ib]=ptBinLimits[ib];
1382 
1383  return;
1384 }
1385 //---------------------------------------------------------------------------
1386 void AliRDHFCuts::SetVarNames(Int_t nVars,TString *varNames,Bool_t *isUpperCut){
1387  // Set the variable names
1388 
1389  if(fVarNames) {
1390  delete [] fVarNames;
1391  fVarNames = NULL;
1392  //printf("Changing the variable names\n");
1393  }
1394  if(nVars!=fnVars){
1395  printf("Wrong number of variables: it has to be %d\n",fnVars);
1396  return;
1397  }
1398  //fnVars=nVars;
1399  fVarNames = new TString[nVars];
1400  fIsUpperCut = new Bool_t[nVars];
1401  for(Int_t iv=0; iv<nVars; iv++) {
1402  fVarNames[iv] = varNames[iv];
1403  fIsUpperCut[iv] = isUpperCut[iv];
1404  }
1405 
1406  return;
1407 }
1408 //---------------------------------------------------------------------------
1410  // Set the variables to be used for cuts optimization
1411 
1412  if(fVarsForOpt) {
1413  delete [] fVarsForOpt;
1414  fVarsForOpt = NULL;
1415  //printf("Changing the variables for cut optimization\n");
1416  }
1417 
1418  if(nVars==0){
1419  printf("%d not accepted as number of variables: it has to be %d\n",nVars,fnVars);
1420  return;
1421  }
1422 
1423  fnVarsForOpt = 0;
1424  fVarsForOpt = new Bool_t[fnVars];
1425  for(Int_t iv=0; iv<fnVars; iv++) {
1426  fVarsForOpt[iv]=forOpt[iv];
1427  if(fVarsForOpt[iv]) fnVarsForOpt++;
1428  }
1429 
1430  return;
1431 }
1432 
1433 //---------------------------------------------------------------------------
1435  //
1436  // set centrality estimator
1437  //
1438  fUseCentrality=flag;
1439  if(fUseCentrality<kCentOff||fUseCentrality>=kCentInvalid) AliWarning("Centrality estimator not valid");
1440 
1441  return;
1442 }
1443 
1444 
1445 //---------------------------------------------------------------------------
1447  //
1448  // store the cuts
1449  //
1450  if(nVars!=fnVars) {
1451  printf("Wrong number of variables: it has to be %d\n",fnVars);
1452  AliFatal("exiting");
1453  }
1454  if(nPtBins!=fnPtBins) {
1455  printf("Wrong number of pt bins: it has to be %d\n",fnPtBins);
1456  AliFatal("exiting");
1457  }
1458 
1459  if(!fCutsRD) fCutsRD = new Float_t[fGlobalIndex];
1460 
1461 
1462  for(Int_t iv=0; iv<fnVars; iv++) {
1463 
1464  for(Int_t ib=0; ib<fnPtBins; ib++) {
1465 
1466  //check
1467  if(GetGlobalIndex(iv,ib)>=fGlobalIndex) {
1468  cout<<"Overflow, exit..."<<endl;
1469  return;
1470  }
1471 
1472  fCutsRD[GetGlobalIndex(iv,ib)] = cutsRD[iv][ib];
1473 
1474  }
1475  }
1476  return;
1477 }
1478 //---------------------------------------------------------------------------
1479 void AliRDHFCuts::SetCuts(Int_t glIndex,Float_t* cutsRDGlob){
1480  //
1481  // store the cuts
1482  //
1483  if(glIndex != fGlobalIndex){
1484  cout<<"Wrong array size: it has to be "<<fGlobalIndex<<endl;
1485  AliFatal("exiting");
1486  }
1487  if(!fCutsRD) fCutsRD = new Float_t[fGlobalIndex];
1488 
1489  for(Int_t iGl=0;iGl<fGlobalIndex;iGl++){
1490  fCutsRD[iGl] = cutsRDGlob[iGl];
1491  }
1492  return;
1493 }
1494 //---------------------------------------------------------------------------
1496  //
1497  // print all cuts values
1498  //
1499 
1500  printf("Minimum vtx type %d\n",fMinVtxType);
1501  printf("Minimum vtx contr %d\n",fMinVtxContr);
1502  printf("Max vtx red chi2 %f\n",fMaxVtxRedChi2);
1503  printf("Min SPD mult %d\n",fMinSPDMultiplicity);
1504  printf("Use PID %d OldPid=%d\n",(Int_t)fUsePID,fPidHF ? fPidHF->GetOldPid() : -1);
1505  printf("Remove daughters from vtx %d\n",(Int_t)fRemoveDaughtersFromPrimary);
1506  printf("Physics selection: %s\n",fUsePhysicsSelection ? "Yes" : "No");
1507  printf("Pileup rejection: %s\n",(fOptPileup > 0) ? "Yes" : "No");
1508  if(fOptPileup==1) printf(" -- Reject pileup event");
1509  if(fOptPileup==2) printf(" -- Reject tracks from pileup vtx");
1510  if(fUseCentrality>0) {
1511  TString estimator="";
1512  if(fUseCentrality==kCentV0M) estimator = "V0";
1513  if(fUseCentrality==kCentTRK) estimator = "Tracks";
1514  if(fUseCentrality==kCentTKL) estimator = "Tracklets";
1515  if(fUseCentrality==kCentCL1) estimator = "SPD clusters outer";
1516  if(fUseCentrality==kCentZNA) estimator = "ZNA";
1517  if(fUseCentrality==kCentZPA) estimator = "ZPA";
1518  if(fUseCentrality==kCentV0A) estimator = "V0A";
1519  if(fUseCentrality==kCentCL0) estimator = "SPD clusters inner";
1520  printf("Centrality class considered: %.1f-%.1f, estimated with %s\n",fMinCentrality,fMaxCentrality,estimator.Data());
1521  }
1522  if(fIsCandTrackSPDFirst) printf("Check for candidates with pt < %2.2f, that daughters fullfill kFirst criteria\n",fMaxPtCandTrackSPDFirst);
1523 
1524  if(fCutRatioClsOverCrossRowsTPC) printf("N TPC Clusters > %f N TPC Crossed Rows\n", fCutRatioClsOverCrossRowsTPC);
1525  if(fCutRatioSignalNOverCrossRowsTPC) printf("N TPC Points for dE/dx > %f N TPC Crossed Rows\n", fCutRatioSignalNOverCrossRowsTPC);
1526  if(fCutTPCSignalN>0) printf("N TPC Clusters for PID for track sel > %d\n", fCutTPCSignalN);
1527  if(f1CutMinNCrossedRowsTPCPtDep) printf("N TPC Crossed Rows pT-dependent cut: %s\n", fCutMinCrossedRowsTPCPtDep.Data());
1528 
1529  if(fVarNames){
1530  cout<<"Array of variables"<<endl;
1531  for(Int_t iv=0;iv<fnVars;iv++){
1532  cout<<fVarNames[iv]<<"\t";
1533  }
1534  cout<<endl;
1535  }
1536  if(fVarsForOpt){
1537  cout<<"Array of optimization"<<endl;
1538  for(Int_t iv=0;iv<fnVars;iv++){
1539  cout<<fVarsForOpt[iv]<<"\t";
1540  }
1541  cout<<endl;
1542  }
1543  if(fIsUpperCut){
1544  cout<<"Array of upper/lower cut"<<endl;
1545  for(Int_t iv=0;iv<fnVars;iv++){
1546  cout<<fIsUpperCut[iv]<<"\t";
1547  }
1548  cout<<endl;
1549  }
1550  if(fPtBinLimits){
1551  cout<<"Array of ptbin limits"<<endl;
1552  for(Int_t ib=0;ib<fnPtBinLimits;ib++){
1553  cout<<fPtBinLimits[ib]<<"\t";
1554  }
1555  cout<<endl;
1556  }
1557  if(fCutsRD){
1558  cout<<"Matrix of cuts"<<endl;
1559  for(Int_t iv=0;iv<fnVars;iv++){
1560  for(Int_t ib=0;ib<fnPtBins;ib++){
1561  cout<<"fCutsRD["<<iv<<"]["<<ib<<"] = "<<fCutsRD[GetGlobalIndex(iv,ib)]<<"\t";
1562  }
1563  cout<<endl;
1564  }
1565  cout<<endl;
1566  }
1567  printf("fUsePreselect=%d \n",fUsePreselect);
1568  if(fPidHF) fPidHF->PrintAll();
1569  Printf("EnableNSigmaTPCDataCorr = %d, %d", fEnableNsigmaTPCDataCorr, fSystemForNsigmaTPCDataCorr);
1570 
1571  return;
1572 }
1573 
1574 //--------------------------------------------------------------------------
1576  // print the trigger selection
1577 
1578  printf("Selected trigger classes: %s %s\n",fTriggerClass[0].Data(),fTriggerClass[1].Data());
1579 
1580  cout<<" Trigger selection pattern: ";
1581  if( fTriggerMask & AliVEvent::kAny ) cout<<" kAny ";
1582  if( fTriggerMask & AliVEvent::kAnyINT ) cout<<" kAnyINT ";
1583  if( fTriggerMask & AliVEvent::kINT7 ) cout<<" kINT7 ";
1584  if( fTriggerMask & AliVEvent::kMB ) cout<<" kMB ";
1585  if( fTriggerMask & AliVEvent::kCINT5 ) cout<<" kCINT5 ";
1586  if( fTriggerMask & AliVEvent::kCentral ) cout<<" kCentral ";
1587  if( fTriggerMask & AliVEvent::kSemiCentral ) cout<<" kSemiCentral ";
1588  if( fTriggerMask & AliVEvent::kEMCEGA ) cout<<" kEMCEGA ";
1589  if( fTriggerMask & AliVEvent::kHighMult ) cout<<" kHighMult ";
1590  if( fTriggerMask & AliVEvent::kFastOnly ) cout<<" kFastOnly ";
1591  cout << endl<< endl;
1592 
1593 }
1594 
1595 //---------------------------------------------------------------------------
1596 void AliRDHFCuts::GetCuts(Float_t**& cutsRD) const{
1597  //
1598  // get the cuts
1599  //
1600 
1601  //cout<<"Give back a "<<fnVars<<"x"<<fnPtBins<<" matrix."<<endl;
1602 
1603 
1604  Int_t iv,ib;
1605  if(!cutsRD) {
1606  //cout<<"Initialization..."<<endl;
1607  cutsRD=new Float_t*[fnVars];
1608  for(iv=0; iv<fnVars; iv++) {
1609  cutsRD[iv] = new Float_t[fnPtBins];
1610  }
1611  }
1612 
1613  for(Int_t iGlobal=0; iGlobal<fGlobalIndex; iGlobal++) {
1614  GetVarPtIndex(iGlobal,iv,ib);
1615  cutsRD[iv][ib] = fCutsRD[iGlobal];
1616  }
1617 
1618  return;
1619 }
1620 
1621 //---------------------------------------------------------------------------
1623  //
1624  // give the global index from variable and pt bin
1625  //
1626  return iPtBin*fnVars+iVar;
1627 }
1628 
1629 //---------------------------------------------------------------------------
1630 void AliRDHFCuts::GetVarPtIndex(Int_t iGlob, Int_t& iVar, Int_t& iPtBin) const {
1631  //
1632  //give the index of the variable and of the pt bin from the global index
1633  //
1634  iPtBin=(Int_t)iGlob/fnVars;
1635  iVar=iGlob%fnVars;
1636 
1637  return;
1638 }
1639 
1640 //-------------------------------------------------------------------
1642  //
1643  // Give the value of cut set for the variable iVar and the pt bin iPtBin
1644  //
1645  if(!fCutsRD){
1646  cout<<"Cuts not iniziaisez yet"<<endl;
1647  return 0;
1648  }
1649  return fCutsRD[GetGlobalIndex(iVar,iPtBin)];
1650 }
1651 
1652 //-------------------------------------------------------------------
1654 
1655  if(aodEvent->GetRunNumber()<244824)return GetCentralityOldFramework(aodEvent,estimator);
1656  Double_t cent=-999;
1657 
1658  if(estimator==kCentOff) return -999;
1659 
1660  AliMultSelection *multSelection = (AliMultSelection*)aodEvent->FindListObject(fMultSelectionObjectName);
1661  if(!multSelection){
1662  AliWarning("AliMultSelection could not be found in the aod event list of objects");
1663  return cent;
1664  }
1665 
1666  // Compare centrality with the centrality at AOD filtering and on-the-fly
1667  if( fMultSelectionObjectName.CompareTo("MultSelection")!=0 ){
1668  AliMultSelection *defaultmultSelection = (AliMultSelection*)aodEvent->FindListObject("MultSelection");
1669  if(!defaultmultSelection){
1670  AliWarning("AliMultSelection default method could not be found in the aod event list of objects");
1671  return cent;
1672  }
1673  Float_t defaultCent = defaultmultSelection->GetMultiplicityPercentile("V0M");
1674  Float_t newCent = multSelection->GetMultiplicityPercentile("V0M");
1675  if( defaultCent<20. && newCent>20.) fEvRejectionBits+=1<<kMismatchOldNewCentrality;
1676  else if (defaultCent>20. && newCent<20.) fEvRejectionBits+=1<<kMismatchOldNewCentrality;
1677  }
1678 
1679  if(estimator==kCentV0M){
1680  cent=multSelection->GetMultiplicityPercentile("V0M");
1681  }else if(estimator==kCentV0A){
1682  cent=multSelection->GetMultiplicityPercentile("V0A");
1683  }else if(estimator==kCentZNA){
1684  cent=multSelection->GetMultiplicityPercentile("ZNA");
1685  }else if(estimator==kCentCL1){
1686  cent=multSelection->GetMultiplicityPercentile("CL1");
1687  }else if(estimator==kCentCL0){
1688  cent=multSelection->GetMultiplicityPercentile("CL0");
1689  }else {
1690  AliWarning(Form("CENTRALITY ESTIMATE WITH ESTIMATOR %d NOT YET IMPLEMENTED FOR NEW FRAMEWORK",(Int_t)estimator));
1691  return cent;
1692  }
1693  Int_t qual = multSelection->GetEvSelCode();
1694  if(qual == 199 ) cent=-999;
1695  return cent;
1696 }
1697 //-------------------------------------------------------------------
1699  //
1700  // Get centrality percentile
1701  //
1702 
1703  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)aodEvent)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
1704  if(mcArray) {fUseAOD049=kFALSE;}
1705 
1706  AliAODHeader *header=dynamic_cast<AliAODHeader*>(aodEvent->GetHeader());
1707  if(!header) AliFatal("Not a standard AOD");
1708  AliCentrality *centrality=header->GetCentralityP();
1709  Float_t cent=-999.;
1710  Bool_t isSelRun=kFALSE;
1711  Int_t selRun[5]={138364, 138826, 138828, 138836, 138871};
1712  if(!centrality) return cent;
1713  else{
1714  if (estimator==kCentV0M){
1715  cent=(Float_t)(centrality->GetCentralityPercentile("V0M"));
1716  if(cent<0){
1717  Int_t quality = centrality->GetQuality();
1718  if(quality<=1){ // fQuality==1 means rejected by zVertex cut that we apply a part and we want to keep separate (Giacomo)
1719  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0M");
1720  }else{
1721  Int_t runnum=aodEvent->GetRunNumber();
1722  for(Int_t ir=0;ir<5;ir++){
1723  if(runnum==selRun[ir]){
1724  isSelRun=kTRUE;
1725  break;
1726  }
1727  }
1728  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0M");
1729  }
1730  }
1731 
1732  //temporary fix for AOD049 outliers
1733  if(fUseAOD049&&cent>=0){
1734  Float_t v0=0;
1735  AliAODVZERO* aodV0 = aodEvent->GetVZEROData();
1736  v0+=aodV0->GetMTotV0A();
1737  v0+=aodV0->GetMTotV0C();
1738  if(cent==0&&v0<19500)return -1;//filtering issue
1739  Float_t tkl = (Float_t)(aodEvent->GetTracklets()->GetNumberOfTracklets());
1740  Float_t val= 1.30552 + 0.147931 * v0;
1741  Float_t tklSigma[101]={176.644, 156.401, 153.789, 153.015, 142.476, 137.951, 136.127, 129.852, 127.436, 124.86, 120.788, 115.611, 113.172, 110.496, 109.127, 104.421, 102.479, 99.9766, 97.5152, 94.0654, 92.4602, 89.3364, 87.1342, 83.3497, 82.6216, 81.1084, 78.0793, 76.1234, 72.9434, 72.1334, 68.0056, 68.2755, 66.0376, 62.9666, 62.4274, 59.65, 58.3776, 56.6361, 54.5184, 53.4224, 51.932, 50.8922, 48.2848, 47.912, 46.5717, 43.4114, 43.2083, 41.3065, 40.1863, 38.5255, 37.2851, 37.5396, 34.4949, 33.8366, 31.8043, 31.7412, 30.8392, 30.0274, 28.8793, 27.6398, 26.6488, 25.0183, 25.1489, 24.4185, 22.9107, 21.2002, 21.6977, 20.1242, 20.4963, 19.0235, 19.298, 17.4103, 16.868, 15.2939, 15.2939, 16.0295, 14.186, 14.186, 15.2173, 12.9504, 12.9504, 12.9504, 15.264, 12.3674, 12.3674, 12.3674, 12.3674, 12.3674, 18.3811, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544, 13.7544};
1742  if ( TMath::Abs(tkl-val) > 6.*tklSigma[(Int_t)cent] )return -1;//outlier
1743  }
1744  }
1745  else {
1746  if (estimator==kCentTRK) {
1747  cent=(Float_t)(centrality->GetCentralityPercentile("TRK"));
1748  if(cent<0){
1749  Int_t quality = centrality->GetQuality();
1750  if(quality<=1){
1751  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TRK");
1752  }else{
1753  Int_t runnum=aodEvent->GetRunNumber();
1754  for(Int_t ir=0;ir<5;ir++){
1755  if(runnum==selRun[ir]){
1756  isSelRun=kTRUE;
1757  break;
1758  }
1759  }
1760  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TRK");
1761  }
1762  }
1763  }
1764  else{
1765  if (estimator==kCentTKL){
1766  cent=(Float_t)(centrality->GetCentralityPercentile("TKL"));
1767  if(cent<0){
1768  Int_t quality = centrality->GetQuality();
1769  if(quality<=1){
1770  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TKL");
1771  }else{
1772  Int_t runnum=aodEvent->GetRunNumber();
1773  for(Int_t ir=0;ir<5;ir++){
1774  if(runnum==selRun[ir]){
1775  isSelRun=kTRUE;
1776  break;
1777  }
1778  }
1779  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TKL");
1780  }
1781  }
1782  }
1783  else{
1784  if (estimator==kCentCL1){
1785  cent=(Float_t)(centrality->GetCentralityPercentile("CL1"));
1786  if(cent<0){
1787  Int_t quality = centrality->GetQuality();
1788  if(quality<=1){
1789  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("CL1");
1790  }else{
1791  Int_t runnum=aodEvent->GetRunNumber();
1792  for(Int_t ir=0;ir<5;ir++){
1793  if(runnum==selRun[ir]){
1794  isSelRun=kTRUE;
1795  break;
1796  }
1797  }
1798  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("CL1");
1799  }
1800  }
1801  }
1802  else{
1803  if (estimator==kCentZNA){
1804  cent=(Float_t)(centrality->GetCentralityPercentile("ZNA"));
1805  if(cent<0){
1806  Int_t quality = centrality->GetQuality();
1807  if(quality<=1){
1808  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("ZNA");
1809  }else{
1810  Int_t runnum=aodEvent->GetRunNumber();
1811  for(Int_t ir=0;ir<5;ir++){
1812  if(runnum==selRun[ir]){
1813  isSelRun=kTRUE;
1814  break;
1815  }
1816  }
1817  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("ZNA");
1818  }
1819  }
1820  }
1821  else{
1822  if (estimator==kCentZPA){
1823  cent=(Float_t)(centrality->GetCentralityPercentile("ZPA"));
1824  if(cent<0){
1825  Int_t quality = centrality->GetQuality();
1826  if(quality<=1){
1827  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("ZPA");
1828  }else{
1829  Int_t runnum=aodEvent->GetRunNumber();
1830  for(Int_t ir=0;ir<5;ir++){
1831  if(runnum==selRun[ir]){
1832  isSelRun=kTRUE;
1833  break;
1834  }
1835  }
1836  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("ZPA");
1837  }
1838  }
1839  }
1840  else{
1841  if (estimator==kCentV0A){
1842  cent=(Float_t)(centrality->GetCentralityPercentile("V0A"));
1843  if(cent<0){
1844  Int_t quality = centrality->GetQuality();
1845  if(quality<=1){
1846  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0A");
1847  }else{
1848  Int_t runnum=aodEvent->GetRunNumber();
1849  for(Int_t ir=0;ir<5;ir++){
1850  if(runnum==selRun[ir]){
1851  isSelRun=kTRUE;
1852  break;
1853  }
1854  }
1855  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0A");
1856  }
1857  }
1858  }
1859  else {
1860  AliWarning("Centrality estimator not valid");
1861 
1862  }
1863  }
1864  }
1865  }
1866  }
1867  }
1868  }
1869  }
1870  return cent;
1871 }
1872 //-------------------------------------------------------------------
1874  //
1875  // Compare two cuts objects
1876  //
1877 
1878  Bool_t areEqual=kTRUE;
1879 
1880  if(fMinVtxType!=obj->fMinVtxType) { printf("Minimum vtx type %d %d\n",fMinVtxType,obj->fMinVtxType); areEqual=kFALSE;}
1881 
1882  if(fMinVtxContr!=obj->fMinVtxContr) { printf("Minimum vtx contr %d %d\n",fMinVtxContr,obj->fMinVtxContr); areEqual=kFALSE;}
1883 
1884  if(TMath::Abs(fMaxVtxRedChi2-obj->fMaxVtxRedChi2)>1.e-10) { printf("Max vtx red chi2 %f %f\n",fMaxVtxRedChi2,obj->fMaxVtxRedChi2);areEqual=kFALSE;}
1885 
1886  if(fMinSPDMultiplicity!=obj->fMinSPDMultiplicity) { printf("Min SPD mult %d\n %d",fMinSPDMultiplicity,obj->fMinSPDMultiplicity);areEqual=kFALSE;}
1887 
1888  if(fUsePID!=obj->fUsePID) { printf("Use PID %d %d\n",(Int_t)fUsePID,(Int_t)obj->fUsePID); areEqual=kFALSE;}
1889 
1890  if(fRemoveDaughtersFromPrimary!=obj->fRemoveDaughtersFromPrimary) {printf("Remove daughters from vtx %d %d\n",(Int_t)fRemoveDaughtersFromPrimary,(Int_t)obj->fRemoveDaughtersFromPrimary); areEqual=kFALSE;}
1891  if(fTrackCuts){
1892  if(fTrackCuts->GetMinNClusterTPC()!=obj->fTrackCuts->GetMinNClusterTPC()) {printf("MinNClsTPC %d %d\n",fTrackCuts->GetMinNClusterTPC(),obj->fTrackCuts->GetMinNClusterTPC()); areEqual=kFALSE;}
1893 
1894  if(fTrackCuts->GetMinNClustersITS()!=obj->fTrackCuts->GetMinNClustersITS()) {printf("MinNClsITS %d %d\n",fTrackCuts->GetMinNClustersITS(),obj->fTrackCuts->GetMinNClustersITS()); areEqual=kFALSE;}
1895 
1896  if(TMath::Abs(fTrackCuts->GetMaxChi2PerClusterTPC()-obj->fTrackCuts->GetMaxChi2PerClusterTPC())>1.e-10) {printf("MaxChi2ClsTPC %f %f\n",fTrackCuts->GetMaxChi2PerClusterTPC(),obj->fTrackCuts->GetMaxChi2PerClusterTPC()); areEqual=kFALSE;}
1897 
1898  if(fTrackCuts->GetClusterRequirementITS(AliESDtrackCuts::kSPD)!=obj->fTrackCuts->GetClusterRequirementITS(AliESDtrackCuts::kSPD)) {printf("ClusterReq SPD %d %d\n",fTrackCuts->GetClusterRequirementITS(AliESDtrackCuts::kSPD),obj->fTrackCuts->GetClusterRequirementITS(AliESDtrackCuts::kSPD)); areEqual=kFALSE;}
1899  }
1900 
1901  if(fUsePreselect!=obj->fUsePreselect){printf("fUsePreselect: %d %d\n",fUsePreselect,obj->fUsePreselect);areEqual=kFALSE;}
1902 
1903  if(fCutsRD) {
1904  for(Int_t iv=0;iv<fnVars;iv++) {
1905  for(Int_t ib=0;ib<fnPtBins;ib++) {
1906  if(TMath::Abs(fCutsRD[GetGlobalIndex(iv,ib)]-obj->fCutsRD[GetGlobalIndex(iv,ib)])>1.e-10) {
1907  cout<<"fCutsRD["<<iv<<"]["<<ib<<"] = "<<fCutsRD[GetGlobalIndex(iv,ib)]<<" "<<obj->fCutsRD[GetGlobalIndex(iv,ib)]<<"\n";
1908  areEqual=kFALSE;
1909  }
1910  }
1911  }
1912  }
1913 
1914  return areEqual;
1915 }
1916 //---------------------------------------------------------------------------
1918  //
1919  // print cuts values in table format
1920  //
1921 
1922  TString ptString = "pT range";
1923  if(fVarNames && fPtBinLimits && fCutsRD){
1924  TString firstLine(Form("* %-15s",ptString.Data()));
1925  for (Int_t ivar=0; ivar<fnVars; ivar++){
1926  firstLine+=Form("* %-15s ",fVarNames[ivar].Data());
1927  if (ivar == fnVars){
1928  firstLine+="*\n";
1929  }
1930  }
1931  Printf("%s",firstLine.Data());
1932 
1933  for (Int_t ipt=0; ipt<fnPtBins; ipt++){
1934  TString line;
1935  if (ipt==fnPtBins-1){
1936  line=Form("* %5.1f < pt < inf ",fPtBinLimits[ipt]);
1937  }
1938  else{
1939  line=Form("* %5.1f < pt < %4.1f ",fPtBinLimits[ipt],fPtBinLimits[ipt+1]);
1940  }
1941  for (Int_t ivar=0; ivar<fnVars; ivar++){
1942  line+=Form("* %-15f ",fCutsRD[GetGlobalIndex(ivar,ipt)]);
1943  }
1944  Printf("%s",line.Data());
1945  }
1946 
1947  }
1948 
1949 
1950  return;
1951 }
1952 //--------------------------------------------------------------------------
1954  AliAODEvent *aod) const
1955 {
1956  //
1957  // Recalculate primary vertex without daughters
1958  //
1959 
1960  if(!aod) {
1961  AliError("Can not remove daughters from vertex without AOD event");
1962  return 0;
1963  }
1964 
1965  AliAODVertex *recvtx=d->RemoveDaughtersFromPrimaryVtx(aod);
1966  if(!recvtx){
1967  AliDebug(2,"Removal of daughter tracks failed");
1968  return kFALSE;
1969  }
1970 
1971 
1972  //set recalculed primary vertex
1973  d->SetOwnPrimaryVtx(recvtx);
1974  delete recvtx;
1975 
1976  return kTRUE;
1977 }
1978 //--------------------------------------------------------------------------
1980 {
1981  //
1982  // Recalculate primary vertex without daughters
1983  //
1984 
1985  if(!aod) {
1986  AliError("Can not get MC vertex without AOD event");
1987  return kFALSE;
1988  }
1989 
1990  // load MC header
1991  AliAODMCHeader *mcHeader =
1992  (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1993  if(!mcHeader) {
1994  AliError("Can not get MC vertex without AODMCHeader event");
1995  return kFALSE;
1996  }
1997  Double_t pos[3];
1998  Double_t covmatrix[6]={0.,0.,0.,0.,0.,0.};
1999  mcHeader->GetVertex(pos);
2000  AliAODVertex *recvtx=new AliAODVertex(pos,covmatrix);
2001 
2002  if(!recvtx){
2003  AliDebug(2,"Removal of daughter tracks failed");
2004  return kFALSE;
2005  }
2006 
2007  //set recalculed primary vertex
2008  d->SetOwnPrimaryVtx(recvtx);
2009 
2010  d->RecalculateImpPars(recvtx,aod);
2011 
2012  delete recvtx;
2013 
2014  return kTRUE;
2015 }
2016 //--------------------------------------------------------------------------
2018  AliAODEvent *aod,
2019  AliAODVertex *origownvtx) const
2020 {
2021  //
2022  // Clean-up own primary vertex if needed
2023  //
2024 
2026  d->UnsetOwnPrimaryVtx();
2027  if(origownvtx) {
2028  d->SetOwnPrimaryVtx(origownvtx);
2029  delete origownvtx; origownvtx=NULL;
2030  }
2031  d->RecalculateImpPars(d->GetPrimaryVtx(),aod);
2032  } else {
2033  if(origownvtx) {
2034  delete origownvtx; origownvtx=NULL;
2035  }
2036  }
2037  return;
2038 }
2039 //--------------------------------------------------------------------------
2040 Bool_t AliRDHFCuts::IsSignalMC(AliAODRecoDecay *d,AliAODEvent *aod,Int_t pdg) const
2041 {
2042  //
2043  // Checks if this candidate is matched to MC signal
2044  //
2045 
2046  if(!aod) return kFALSE;
2047 
2048  // get the MC array
2049  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)aod)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
2050 
2051  if(!mcArray) return kFALSE;
2052 
2053  // try to match
2054  Int_t label = d->MatchToMC(pdg,mcArray);
2055 
2056  if(label>=0) {
2057  //printf("MATCH!\n");
2058  return kTRUE;
2059  }
2060 
2061  return kFALSE;
2062 }
2063 
2064 
2065 //--------------------------------------------------------------------------
2067  // recompute event primary vertex from AOD tracks
2068 
2069  AliVertexerTracks *vertexer = new AliVertexerTracks(event->GetMagneticField());
2070  vertexer->SetITSMode();
2071  vertexer->SetMinClusters(3);
2072 
2073  AliAODVertex* pvtx=event->GetPrimaryVertex();
2074  if(strstr(pvtx->GetTitle(),"VertexerTracksWithConstraint")) {
2075  Float_t diamondcovxy[3];
2076  event->GetDiamondCovXY(diamondcovxy);
2077  Double_t pos[3]={event->GetDiamondX(),event->GetDiamondY(),0.};
2078  Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.};
2079  AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
2080  vertexer->SetVtxStart(diamond);
2081  delete diamond; diamond=NULL;
2082  }
2083 
2084  AliESDVertex* vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(event);
2085  if(!vertexESD) return kFALSE;
2086  if(vertexESD->GetNContributors()<=0) {
2087  //AliDebug(2,"vertexing failed");
2088  delete vertexESD; vertexESD=NULL;
2089  return kFALSE;
2090  }
2091  delete vertexer; vertexer=NULL;
2092 
2093  // convert to AliAODVertex
2094  Double_t pos[3],cov[6],chi2perNDF;
2095  vertexESD->GetXYZ(pos); // position
2096  vertexESD->GetCovMatrix(cov); //covariance matrix
2097  chi2perNDF = vertexESD->GetChi2toNDF();
2098  delete vertexESD; vertexESD=NULL;
2099 
2100  pvtx->SetPosition(pos[0],pos[1],pos[2]);
2101  pvtx->SetChi2perNDF(chi2perNDF);
2102  pvtx->SetCovMatrix(cov);
2103 
2104  return kTRUE;
2105 }
void SetNPtBins(Int_t nptBins)
Definition: AliRDHFCuts.h:444
Int_t fIsSelectedCuts
fix the daughter track references
Definition: AliRDHFCuts.h:497
Int_t pdg
Bool_t IsEventSelectedForCentrFlattening(Float_t centvalue)
Float_t fMinDzPileup
min. n. of tracklets in pileup vertex
Definition: AliRDHFCuts.h:486
Double_t fMaxPtCandTrackSPDFirst
flag to select the track kFirst criteria for pt < ptlimit
Definition: AliRDHFCuts.h:504
AliEventCuts * fAliEventCuts
flag that defines whether the PreSelect method has to be used: note that it is up to the task user to...
Definition: AliRDHFCuts.h:530
Int_t fWhyRejection
PID for heavy flavours manager.
Definition: AliRDHFCuts.h:479
double Double_t
Definition: External.C:58
Int_t fCutOnzVertexSPD
flag to apply cut on tracklets vs. centrality for 2011 data
Definition: AliRDHFCuts.h:510
void SetupPID(AliVEvent *event)
Bool_t IsSignalMC(AliAODRecoDecay *d, AliAODEvent *aod, Int_t pdg) const
const char * title
Definition: MakeQAPdf.C:27
Double_t fCutGeoNcrNclFractionNcr
3rd parameter of GeoNcrNcl cut
Definition: AliRDHFCuts.h:524
Bool_t fUseMCVertex
flag to switch on the removal of duaghters from the primary vertex computation
Definition: AliRDHFCuts.h:482
Bool_t fUseOnlyOneTrigger
trigger mask
Definition: AliRDHFCuts.h:461
Int_t IsEventSelectedInCentrality(AliVEvent *event)
Bool_t * fIsUpperCut
Definition: AliRDHFCuts.h:475
Bool_t SetMCPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod) const
Bool_t fRemoveDaughtersFromPrimary
Definition: AliRDHFCuts.h:481
void SetHistoForCentralityFlattening(TH1F *h, Double_t minCentr, Double_t maxCentr, Double_t centrRef=0., Int_t switchTRand=0)
Bool_t GetUseCombined()
Definition: AliAODPidHF.h:178
Bool_t fUseMultDepPileupCut
min deltaz between main and pileup vertices
Definition: AliRDHFCuts.h:487
void SetUseCentrality(Int_t flag=1)
Float_t * fPtBinLimits
"number of limits", that is fnPtBins+1
Definition: AliRDHFCuts.h:468
Int_t fMinVtxContr
0: not cut; 1: SPDZ; 2: SPD3D; 3: Tracks
Definition: AliRDHFCuts.h:452
centrality
char Char_t
Definition: External.C:18
static Int_t CheckMatchingAODdeltaAODevents()
Float_t fMaxVtxRedChi2
minimum vertex contributors
Definition: AliRDHFCuts.h:453
void SetMClowenpp2011(Bool_t mc)
Definition: AliAODPidHF.h:115
const Float_t * GetCuts() const
Definition: AliRDHFCuts.h:271
void SetMinCrossedRowsTPCPtDep(const char *rows="")
Float_t fCutRatioClsOverCrossRowsTPC
histogram with reference centrality distribution for centrality distribution flattening ...
Definition: AliRDHFCuts.h:515
Bool_t IsEventSelectedWithAliEventCuts(AliVEvent *event)
Double_t fDeadZoneWidth
flag for enabling/disabling geometrical cut on TPC track
Definition: AliRDHFCuts.h:521
Int_t fMinVtxType
cuts on the event
Definition: AliRDHFCuts.h:451
void SetppLowEn2011(Bool_t opt)
Definition: AliAODPidHF.h:117
Double_t fMaxRapidityCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:501
Double_t fCutGeoNcrNclFractionNcl
4th parameter of GeoNcrNcl cut
Definition: AliRDHFCuts.h:525
void SetGlobalIndex()
Definition: AliRDHFCuts.h:213
AliRDHFCuts & operator=(const AliRDHFCuts &source)
Float_t GetCutValue(Int_t iVar, Int_t iPtBin) const
Int_t fUseCentrality
flag to use a multiplicity dependent pileup selection
Definition: AliRDHFCuts.h:488
Bool_t fUsePID
Definition: AliRDHFCuts.h:476
TRandom * gRandom
Bool_t fRejectPlpFromDiffBCMV
minimum weighted distance in Z between 2 vertices (multi-vertexer)
Definition: AliRDHFCuts.h:459
void PrintAll() const
void SetPidHF(AliAODPidHF *pidObj)
see enum below
Definition: AliRDHFCuts.h:227
Bool_t GetOldPid()
Definition: AliAODPidHF.h:170
TList * GetList(const TDirectory *d, const char *what)
Definition: ExtractData.C:172
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:264
void RecalculateImpPars(AliAODVertex *vtxAODNew, AliAODEvent *aod)
Bool_t fRemoveTrackletOutliers
Max. difference between TRK and V0 centrality (remove TPC pileup for PbPb 2011)
Definition: AliRDHFCuts.h:509
Bool_t fUseV0ANDSelectionOffline
5th parameter of GeoNcrNcl cut
Definition: AliRDHFCuts.h:526
AliRDHFCuts(const Char_t *name="RDHFCuts", const Char_t *title="")
Definition: AliRDHFCuts.cxx:66
ULong64_t fTriggerMask
flag to reject pileup from different BC (multi-vertexer)
Definition: AliRDHFCuts.h:460
Int_t fSystemForNsigmaTPCDataCorr
flag to enable data-driven NsigmaTPC correction
Definition: AliRDHFCuts.h:540
Bool_t fUseCutGeoNcrNcl
pT-dep cut in TPC minimum n crossed rows
Definition: AliRDHFCuts.h:520
int Int_t
Definition: External.C:63
Bool_t fUseTrackSelectionWithFilterBits
flag to reject kink daughters
Definition: AliRDHFCuts.h:512
void SetCuts(Int_t nVars, Int_t nPtBins, Float_t **cutsRD)
Int_t fnVarsForOpt
Definition: AliRDHFCuts.h:471
Float_t fMinWDzPileupMV
max chi2 per contributor of the pile-up vertex to consider (multi-vertexer).
Definition: AliRDHFCuts.h:458
Double_t fCutGeoNcrNclLength
1st parameter of GeoNcrNcl cut
Definition: AliRDHFCuts.h:522
float Float_t
Definition: External.C:68
virtual ~AliRDHFCuts()
void SetPbPb(Bool_t pbpb)
Definition: AliAODPidHF.h:118
TString * fVarNames
number of cut vars for candidates
Definition: AliRDHFCuts.h:470
Double_t fMaxPtCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:500
AliESDtrackCuts * fTrackCuts
quality cuts on the daughter tracks
Definition: AliRDHFCuts.h:464
Bool_t fApplySPDUniformAccPbPbRun2
flag to apply cut on tracks crossing SPD misaligned modules for PP2012 data
Definition: AliRDHFCuts.h:507
void MakeTable() const
Bool_t fFixRefs
name of the AliMultSelection object to be considered
Definition: AliRDHFCuts.h:496
Bool_t fKeepSignalMC
max rapidity of candidate (if !=-999 overrides IsInFiducialAcceptance)
Definition: AliRDHFCuts.h:502
Int_t fOptPileup
use Physics selection criteria
Definition: AliRDHFCuts.h:484
AliESDtrackCuts * GetTrackCuts() const
Definition: AliRDHFCuts.h:279
void PrintTrigger() const
Float_t fMaxVtxZ
maximum chi2/ndf
Definition: AliRDHFCuts.h:454
Float_t GetCentrality(AliAODEvent *aodEvent)
Definition: AliRDHFCuts.h:275
Int_t fIsSelectedPID
outcome of cuts selection
Definition: AliRDHFCuts.h:498
Bool_t fUseTimeRangeCutForPbPb2018
flag for using AliEventCuts
Definition: AliRDHFCuts.h:534
Float_t fMinCentrality
Definition: AliRDHFCuts.h:493
AliAODVertex * RemoveDaughtersFromPrimaryVtx(AliAODEvent *aod)
void SetUpCombinedPID()
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:173
UInt_t fEvRejectionBits
used to code the step at which candidate was rejected
Definition: AliRDHFCuts.h:480
Int_t fMinContrPileupMV
SPD multiplicity.
Definition: AliRDHFCuts.h:456
Double_t fMaxDiffTRKV0Centr
flag to apply the same SPD acceptance between Pb-Pb 2015 and Pb-Pb 2018 (PbPb Run2 periods) ...
Definition: AliRDHFCuts.h:508
Float_t GetCentralityOldFramework(AliAODEvent *aodEvent, AliRDHFCuts::ECentrality estimator)
Int_t fnPtBinLimits
number of pt bins for cuts
Definition: AliRDHFCuts.h:467
Int_t fCutTPCSignalN
min. value ratio TPCPointsUsedForPID/NTPCCrossedRows, cut if !=0
Definition: AliRDHFCuts.h:517
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:474
Bool_t CheckPtDepCrossedRows(TString rows, Bool_t print=kFALSE) const
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Int_t fCurrentRun
object to manage time range cut
Definition: AliRDHFCuts.h:536
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
Int_t fUsePreselect
Definition: AliRDHFCuts.h:529
Bool_t fUseCentrFlatteningInMC
flag to enable/disable the check on filter bits
Definition: AliRDHFCuts.h:513
void SetVarsForOpt(Int_t nVars, Bool_t *forOpt)
void SetVarNames(Int_t nVars, TString *varNames, Bool_t *isUpperCut)
Int_t fApplyPbPbOutOfBunchPileupCuts
swicth to enable/disable cuts on centrality correlations
Definition: AliRDHFCuts.h:532
void GetVarPtIndex(Int_t iGlob, Int_t &iVar, Int_t &iPtBin) const
void SetBetheBloch()
Bool_t * fVarsForOpt
number of cut vars to be optimized for candidates
Definition: AliRDHFCuts.h:472
Bool_t isMC
Bool_t CompareCuts(const AliRDHFCuts *obj) const
Bool_t AreDaughtersSelected(AliAODRecoDecayHF *rd, const AliAODEvent *aod=0x0) const
Bool_t fApplySPDMisalignedPP2012
flag to apply SPD dead module map of PbPb2011
Definition: AliRDHFCuts.h:506
Bool_t IsEventSelected(AliVEvent *event)
Int_t fMinSPDMultiplicity
maximum |z| of primary vertex
Definition: AliRDHFCuts.h:455
Bool_t fApplyCentralityCorrCuts
AliEventCuts object used in Pb-Pb for cuts on correlations and out-of-bunch pileup.
Definition: AliRDHFCuts.h:531
void SetMC(Bool_t mc)
Definition: AliAODPidHF.h:114
virtual void PrintAll() const
Bool_t fUseAOD049
enable PID usage (off by default)
Definition: AliRDHFCuts.h:477
Bool_t fApplySPDDeadPbPb2011
maximum pt of the candidate for which to check if the daughters fulfill kFirst criteria ...
Definition: AliRDHFCuts.h:505
void CleanOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod, AliAODVertex *origownvtx) const
Float_t fMaxVtxChi2PileupMV
min. n. of tracklets in pileup vertex (multi-vertexer)
Definition: AliRDHFCuts.h:457
Bool_t fIsCandTrackSPDFirst
IsSelected returns always kTRUE for MC signal.
Definition: AliRDHFCuts.h:503
TH1F * fHistCentrDistr
flag for enabling/diabling centrality flattening in MC
Definition: AliRDHFCuts.h:514
void SetPtBins(Int_t nPtBinLimits, Float_t *ptBinLimits)
Bool_t fKinkReject
cut on zSPD vertex to remove outliers in centrality vs. tracklets (0=no cut, 1= cut at 12 cm...
Definition: AliRDHFCuts.h:511
Bool_t fUseAliEventCuts
switch for additional correlation cuts for out-of-bunch pileup (0=no cut, 1=AliEVentCuts, 2=Ionut cut vs. nTPC cls)
Definition: AliRDHFCuts.h:533
TString fMultSelectionObjectName
maximum centrality for selected events
Definition: AliRDHFCuts.h:495
Bool_t fEnableNsigmaTPCDataCorr
needed to use the time range cut
Definition: AliRDHFCuts.h:539
void EnableNsigmaTPCDataCorr(Int_t run, Int_t system)
Set Nsigma data-driven correction.
Int_t fMinContrPileup
option for pielup selection
Definition: AliRDHFCuts.h:485
Bool_t fUseTPCtrackCutsOnThisDaughter
flag to apply V0AND selection offline
Definition: AliRDHFCuts.h:527
Bool_t fUsePhysicsSelection
use MC primary vertex
Definition: AliRDHFCuts.h:483
TFormula * f1CutMinNCrossedRowsTPCPtDep
pT-dep cut in TPC minimum n crossed rows
Definition: AliRDHFCuts.h:519
AliAODVertex * GetPrimaryVtx() const
void AddTrackCuts(const AliESDtrackCuts *cuts)
Definition: AliRDHFCuts.h:219
TString fTriggerClass[2]
flag to select one trigger only
Definition: AliRDHFCuts.h:462
bool Bool_t
Definition: External.C:53
Int_t fnPtBins
cuts on the candidate
Definition: AliRDHFCuts.h:466
Double_t fCutGeoNcrNclGeom1Pt
2nd parameter of GeoNcrNcl cut
Definition: AliRDHFCuts.h:523
AliTimeRangeCut fTimeRangeCut
flag to enable the timestamp based selection of good events in the 7 runs of LHC18r with problems in ...
Definition: AliRDHFCuts.h:535
Bool_t fApplyZcutOnSPDvtx
flag to apply TPC track quality cuts on specific D-meson daughter (used for different strategies for ...
Definition: AliRDHFCuts.h:528
AliAODPidHF * fPidHF
enable AOD049 centrality cleanup
Definition: AliRDHFCuts.h:478
Float_t fCutRatioSignalNOverCrossRowsTPC
min. value ratio NTPCClusters/NTPCCrossedRows, cut if !=0
Definition: AliRDHFCuts.h:516
Int_t fGlobalIndex
Definition: AliRDHFCuts.h:473
Bool_t RecalcOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod) const
Int_t GetGlobalIndex(Int_t iVar, Int_t iPtBin) const
TString fCutMinCrossedRowsTPCPtDep
min. value of number of TPC clusters for PID, cut if !=0
Definition: AliRDHFCuts.h:518
Double_t fMinPtCand
outcome of PID selection
Definition: AliRDHFCuts.h:499
Bool_t IsDaughterSelected(AliAODTrack *track, const AliESDVertex *primary, AliESDtrackCuts *cuts, const AliAODEvent *aod=0x0) const
void SetOnePad(Bool_t onepad)
Definition: AliAODPidHF.h:116
Float_t fMaxCentrality
minimum centrality for selected events
Definition: AliRDHFCuts.h:494
void SetPidResponse(AliPIDResponse *pidResp)
Definition: AliAODPidHF.h:124
Bool_t RecomputePrimaryVertex(AliAODEvent *event) const
Int_t fnVars
Definition: AliRDHFCuts.h:469