AliPhysics  781d0c7 (781d0c7)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 "AliRDHFCuts.h"
43 #include "AliAnalysisManager.h"
44 #include "AliAODHandler.h"
45 #include "AliInputEventHandler.h"
46 #include "AliPIDResponse.h"
47 #include "AliAnalysisUtils.h"
48 #include "AliMultSelection.h"
49 #include "TRandom.h"
50 #include <TF1.h>
51 #include <TFile.h>
52 #include <TKey.h>
53 
54 using std::cout;
55 using std::endl;
56 
60 
61 
62 //--------------------------------------------------------------------------
64 AliAnalysisCuts(name,title),
65 fMinVtxType(3),
66 fMinVtxContr(1),
67 fMaxVtxRedChi2(1e6),
68 fMaxVtxZ(10.),
69 fMinSPDMultiplicity(0),
70 fTriggerMask(AliVEvent::kAnyINT),
71 fUseOnlyOneTrigger(kFALSE),
72 fTrackCuts(0),
73 fnPtBins(1),
74 fnPtBinLimits(1),
75 fPtBinLimits(0),
76 fnVars(1),
77 fVarNames(0),
78 fnVarsForOpt(0),
79 fVarsForOpt(0),
80 fGlobalIndex(1),
81 fCutsRD(0),
82 fIsUpperCut(0),
83 fUsePID(kFALSE),
84 fUseAOD049(kFALSE),
85 fPidHF(0),
86 fWhyRejection(0),
87 fEvRejectionBits(0),
88 fRemoveDaughtersFromPrimary(kFALSE),
89 fUseMCVertex(kFALSE),
90 fUsePhysicsSelection(kTRUE),
91 fOptPileup(0),
92 fMinContrPileup(3),
93 fMinDzPileup(0.6),
94 fUseCentrality(0),
95 fMinCentrality(0.),
96 fMaxCentrality(100.),
97 fFixRefs(kFALSE),
98 fIsSelectedCuts(0),
99 fIsSelectedPID(0),
100 fMinPtCand(-1.),
101 fMaxPtCand(100000.),
102 fMaxRapidityCand(-999.),
103 fKeepSignalMC(kFALSE),
104 fIsCandTrackSPDFirst(kFALSE),
105 fMaxPtCandTrackSPDFirst(0.),
106 fApplySPDDeadPbPb2011(kFALSE),
107 fApplySPDMisalignedPP2012(kFALSE),
108 fMaxDiffTRKV0Centr(-1.),
109 fRemoveTrackletOutliers(kFALSE),
110 fCutOnzVertexSPD(0),
111 fKinkReject(kFALSE),
112 fUseTrackSelectionWithFilterBits(kTRUE),
113 fUseCentrFlatteningInMC(kFALSE),
114 fHistCentrDistr(0x0),
115 fCutRatioClsOverCrossRowsTPC(0),
116 fCutRatioSignalNOverCrossRowsTPC(0),
117 fCutMinCrossedRowsTPCPtDep(""),
118 f1CutMinNCrossedRowsTPCPtDep(0x0),
119 fUseCutGeoNcrNcl(kFALSE),
120 fDeadZoneWidth(3.),
121 fCutGeoNcrNclLength(130.),
122 fCutGeoNcrNclGeom1Pt(1.5),
123 fCutGeoNcrNclFractionNcr(0.85),
124 fCutGeoNcrNclFractionNcl(0.7)
125 {
126  //
127  // Default Constructor
128  //
129  fTriggerClass[0]="CINT1"; fTriggerClass[1]="";
130 }
131 //--------------------------------------------------------------------------
133  AliAnalysisCuts(source),
134  fMinVtxType(source.fMinVtxType),
135  fMinVtxContr(source.fMinVtxContr),
136  fMaxVtxRedChi2(source.fMaxVtxRedChi2),
137  fMaxVtxZ(source.fMaxVtxZ),
138  fMinSPDMultiplicity(source.fMinSPDMultiplicity),
139  fTriggerMask(source.fTriggerMask),
140  fUseOnlyOneTrigger(source.fUseOnlyOneTrigger),
141  fTriggerClass(),
142  fTrackCuts(0),
143  fnPtBins(source.fnPtBins),
144  fnPtBinLimits(source.fnPtBinLimits),
145  fPtBinLimits(0),
146  fnVars(source.fnVars),
147  fVarNames(0),
148  fnVarsForOpt(source.fnVarsForOpt),
149  fVarsForOpt(0),
150  fGlobalIndex(source.fGlobalIndex),
151  fCutsRD(0),
152  fIsUpperCut(0),
153  fUsePID(source.fUsePID),
154  fUseAOD049(source.fUseAOD049),
155  fPidHF(0),
156  fWhyRejection(source.fWhyRejection),
157  fEvRejectionBits(source.fEvRejectionBits),
158  fRemoveDaughtersFromPrimary(source.fRemoveDaughtersFromPrimary),
159  fUseMCVertex(source.fUseMCVertex),
160  fUsePhysicsSelection(source.fUsePhysicsSelection),
161  fOptPileup(source.fOptPileup),
162  fMinContrPileup(source.fMinContrPileup),
163  fMinDzPileup(source.fMinDzPileup),
164  fUseCentrality(source.fUseCentrality),
165  fMinCentrality(source.fMinCentrality),
166  fMaxCentrality(source.fMaxCentrality),
167  fFixRefs(source.fFixRefs),
168  fIsSelectedCuts(source.fIsSelectedCuts),
169  fIsSelectedPID(source.fIsSelectedPID),
170  fMinPtCand(source.fMinPtCand),
171  fMaxPtCand(source.fMaxPtCand),
172  fMaxRapidityCand(source.fMaxRapidityCand),
173  fKeepSignalMC(source.fKeepSignalMC),
174  fIsCandTrackSPDFirst(source.fIsCandTrackSPDFirst),
175  fMaxPtCandTrackSPDFirst(source.fMaxPtCandTrackSPDFirst),
176  fApplySPDDeadPbPb2011(source.fApplySPDDeadPbPb2011),
177  fApplySPDMisalignedPP2012(source.fApplySPDMisalignedPP2012),
178  fMaxDiffTRKV0Centr(source.fMaxDiffTRKV0Centr),
179  fRemoveTrackletOutliers(source.fRemoveTrackletOutliers),
180  fCutOnzVertexSPD(source.fCutOnzVertexSPD),
181  fKinkReject(source.fKinkReject),
182  fUseTrackSelectionWithFilterBits(source.fUseTrackSelectionWithFilterBits),
183  fUseCentrFlatteningInMC(source.fUseCentrFlatteningInMC),
184  fHistCentrDistr(0x0),
185  fCutRatioClsOverCrossRowsTPC(source.fCutRatioClsOverCrossRowsTPC),
186  fCutRatioSignalNOverCrossRowsTPC(source.fCutRatioSignalNOverCrossRowsTPC),
187  fCutMinCrossedRowsTPCPtDep(""),
188  f1CutMinNCrossedRowsTPCPtDep(0x0),
189  fUseCutGeoNcrNcl(source.fUseCutGeoNcrNcl),
190  fDeadZoneWidth(source.fDeadZoneWidth),
191  fCutGeoNcrNclLength(source.fCutGeoNcrNclLength),
192  fCutGeoNcrNclGeom1Pt(source.fCutGeoNcrNclGeom1Pt),
193  fCutGeoNcrNclFractionNcr(source.fCutGeoNcrNclFractionNcr),
194  fCutGeoNcrNclFractionNcl(source.fCutGeoNcrNclFractionNcl)
195 {
196  //
197  // Copy constructor
198  //
199  cout<<"Copy constructor"<<endl;
200  fTriggerClass[0] = source.fTriggerClass[0];
201  fTriggerClass[1] = source.fTriggerClass[1];
202  if(source.GetTrackCuts()) AddTrackCuts(source.GetTrackCuts());
203  if(source.fPtBinLimits) SetPtBins(source.fnPtBinLimits,source.fPtBinLimits);
204  if(source.fVarNames) SetVarNames(source.fnVars,source.fVarNames,source.fIsUpperCut);
205  if(source.fCutsRD) SetCuts(source.fGlobalIndex,source.fCutsRD);
206  if(source.fVarsForOpt) SetVarsForOpt(source.fnVarsForOpt,source.fVarsForOpt);
207  if(source.fPidHF) SetPidHF(source.fPidHF);
208  if(source.fHistCentrDistr) fHistCentrDistr=(TH1F*)(source.fHistCentrDistr->Clone());
211  PrintAll();
212 
213 }
214 //--------------------------------------------------------------------------
216 {
217  //
218  // assignment operator
219  //
220  if(&source == this) return *this;
221 
222  AliAnalysisCuts::operator=(source);
223 
224  fMinVtxType=source.fMinVtxType;
225  fMinVtxContr=source.fMinVtxContr;
227  fMaxVtxZ=source.fMaxVtxZ;
229  fTriggerMask=source.fTriggerMask;
231  fTriggerClass[0]=source.fTriggerClass[0];
232  fTriggerClass[1]=source.fTriggerClass[1];
233  fnPtBins=source.fnPtBins;
235  fnVars=source.fnVars;
236  fGlobalIndex=source.fGlobalIndex;
237  fnVarsForOpt=source.fnVarsForOpt;
238  fUsePID=source.fUsePID;
239  fUseAOD049=source.fUseAOD049;
240  if(fPidHF) delete fPidHF;
241  fPidHF=new AliAODPidHF(*(source.GetPidHF()));
245  fUseMCVertex=source.fUseMCVertex;
247  fOptPileup=source.fOptPileup;
249  fMinDzPileup=source.fMinDzPileup;
253  fFixRefs=source.fFixRefs;
256  fMinPtCand=source.fMinPtCand;
257  fMaxPtCand=source.fMaxPtCand;
267  fKinkReject=source.fKinkReject;
269  if(fHistCentrDistr) delete fHistCentrDistr;
271  if(source.fHistCentrDistr)fHistCentrDistr=(TH1F*)(source.fHistCentrDistr->Clone());
272 
273  if(source.GetTrackCuts()) {delete fTrackCuts; fTrackCuts=new AliESDtrackCuts(*(source.GetTrackCuts()));}
274  if(source.fPtBinLimits) SetPtBins(source.fnPtBinLimits,source.fPtBinLimits);
275  if(source.fVarNames) SetVarNames(source.fnVars,source.fVarNames,source.fIsUpperCut);
276  if(source.fCutsRD) SetCuts(source.fGlobalIndex,source.fCutsRD);
277  if(source.fVarsForOpt) SetVarsForOpt(source.fnVarsForOpt,source.fVarsForOpt);
278 
284 
291 
292  PrintAll();
293 
294  return *this;
295 }
296 //--------------------------------------------------------------------------
298  //
299  // Default Destructor
300  //
301  if(fTrackCuts) { delete fTrackCuts; fTrackCuts=0; }
302  if(fPtBinLimits) {delete [] fPtBinLimits; fPtBinLimits=0;}
303  if(fVarNames) {delete [] fVarNames; fVarNames=0;}
304  if(fVarsForOpt) {delete [] fVarsForOpt; fVarsForOpt=0;}
305  if(fCutsRD) {
306  delete [] fCutsRD;
307  fCutsRD=0;
308  }
309  if(fIsUpperCut) {delete [] fIsUpperCut; fIsUpperCut=0;}
310  if(fPidHF){
311  delete fPidHF;
312  fPidHF=0;
313  }
315 
319  }
320 
321 }
322 //---------------------------------------------------------------------------
324  //
325  // Centrality selection
326  //
327  if(fUseCentrality<kCentOff||fUseCentrality>=kCentInvalid){
328  AliWarning("Centrality estimator not valid");
329  return 3;
330  }else{
331  Float_t centvalue=GetCentrality((AliAODEvent*)event);
332  if (centvalue<-998.){//-999 if no centralityP
333  return 0;
334  }else{
335  if (centvalue<fMinCentrality || centvalue>fMaxCentrality){
336  return 2;
337  }
338  // selection to flatten the centrality distribution
339  if(fHistCentrDistr){
340  if(!IsEventSelectedForCentrFlattening(centvalue))return 4;
341  }
342  }
343  }
344  return 0;
345 }
346 
347 
348 //-------------------------------------------------
349 void AliRDHFCuts::SetHistoForCentralityFlattening(TH1F *h,Double_t minCentr,Double_t maxCentr,Double_t centrRef,Int_t switchTRand){
350  // set the histo for centrality flattening
351  // the centrality is flatten in the range minCentr,maxCentr
352  // if centrRef is zero, the minimum in h within (minCentr,maxCentr) defines the reference
353  // positive, the value of h(centrRef) defines the reference (-> the centrality distribution might be not flat in the whole desired range)
354  // 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)
355  // 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
356 
357  if(maxCentr<minCentr){
358  AliWarning("AliRDHFCuts::Wrong centralities values while setting the histogram for centrality flattening");
359  }
360 
362  fHistCentrDistr=(TH1F*)h->Clone("hCentralityFlat");
363  fHistCentrDistr->SetTitle("Reference histo for centrality flattening");
364  Int_t minbin=fHistCentrDistr->FindBin(minCentr*1.00001); // fast if fix bin width
365  Int_t maxbin=fHistCentrDistr->FindBin(maxCentr*0.9999);
366  fHistCentrDistr->GetXaxis()->SetRange(minbin,maxbin);
367  Double_t ref=0.,bincont=0.,binrefwidth=1.;
368  Int_t binref=0;
369  if(TMath::Abs(centrRef)<0.0001){
370  binref=fHistCentrDistr->GetMinimumBin();
371  binrefwidth=fHistCentrDistr->GetBinWidth(binref);
372  ref=fHistCentrDistr->GetBinContent(binref)/binrefwidth;
373  }
374  else if(centrRef>0.){
375  binref=h->FindBin(centrRef);
376  if(binref<1||binref>h->GetNbinsX()){
377  AliWarning("AliRDHFCuts::Wrong centrality reference value while setting the histogram for centrality flattening");
378  }
379  binrefwidth=fHistCentrDistr->GetBinWidth(binref);
380  ref=fHistCentrDistr->GetBinContent(binref)/binrefwidth;
381  }
382  else{
383  if(centrRef<-1) AliWarning("AliRDHFCuts: with this centrality reference no flattening will be applied");
384  binref=fHistCentrDistr->GetMaximumBin();
385  binrefwidth=fHistCentrDistr->GetBinWidth(binref);
386  ref=fHistCentrDistr->GetMaximum()*TMath::Abs(centrRef)/binrefwidth;
387  }
388 
389  for(Int_t j=1;j<=h->GetNbinsX();j++){// Now set the "probabilities"
390  if(h->GetBinLowEdge(j)*1.0001>=minCentr&&h->GetBinLowEdge(j+1)*0.9999<=maxCentr){
391  bincont=h->GetBinContent(j);
392  fHistCentrDistr->SetBinContent(j,ref/bincont*h->GetBinWidth(j));
393  fHistCentrDistr->SetBinError(j,h->GetBinError(j)*ref/bincont);
394  }
395  else{
396  h->SetBinContent(j,1.1);// prob > 1 to assure that events will not be rejected
397  }
398  }
399 
400  fHistCentrDistr->SetBinContent(0,switchTRand);
401  return;
402 
403 }
404 
405 //-------------------------------------------------
407  //
408  // Random event selection, based on fHistCentrDistr, to flatten the centrality distribution
409  // Can be faster if it was required that fHistCentrDistr covers
410  // exactly the desired centrality range (e.g. part of the lines below should be done during the
411  // setting of the histo) and TH1::SetMinimum called
412  //
413 
414  if(!fHistCentrDistr) return kTRUE;
415  // Int_t maxbin=fHistCentrDistr->FindBin(fMaxCentrality*0.9999);
416  // if(maxbin>fHistCentrDistr->GetNbinsX()){
417  // AliWarning("AliRDHFCuts: The maximum centrality exceeds the x-axis limit of the histogram for centrality flattening");
418  // }
419 
420  Int_t bin=fHistCentrDistr->FindBin(centvalue); // Fast if the histo has a fix bin
421  Double_t bincont=fHistCentrDistr->GetBinContent(bin);
422  Double_t centDigits=centvalue-(Int_t)(centvalue*100.)/100.;// this is to extract a random number between 0 and 0.01
423 
424  if(fHistCentrDistr->GetBinContent(0)<-0.9999){
425  if(gRandom->Uniform(1.)<bincont)return kTRUE;
426  return kFALSE;
427  }
428 
429  if(centDigits*100.<bincont)return kTRUE;
430  return kFALSE;
431 
432 }
433 //---------------------------------------------------------------------------
434 void AliRDHFCuts::SetupPID(AliVEvent *event) {
435  // Set the PID response object in the AliAODPidHF
436  // in case of old PID sets the TPC dE/dx BB parameterization
437 
438  if(fPidHF){
439  if(fPidHF->GetPidResponse()==0x0){
440  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
441  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
442  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
443  fPidHF->SetPidResponse(pidResp);
444  }
446  if(fPidHF->GetOldPid()) {
447 
448  Bool_t isMC=kFALSE;
449  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)event)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
450  if(mcArray) {isMC=kTRUE;fUseAOD049=kFALSE;}
451 
452  // pp, from LHC10d onwards
453  if((event->GetRunNumber()>121693 && event->GetRunNumber()<136851) ||
454  event->GetRunNumber()>139517) fPidHF->SetOnePad(kTRUE);
455  // pp, 2011 low energy run
456  if((event->GetRunNumber()>=146686 && event->GetRunNumber()<=146860)){
457  fPidHF->SetppLowEn2011(kTRUE);
458  fPidHF->SetOnePad(kFALSE);
459  }
460  // PbPb LHC10h
461  if(event->GetRunNumber()>=136851 && event->GetRunNumber()<=139517) fPidHF->SetPbPb(kTRUE);
462  // MC
463  if(isMC) fPidHF->SetMC(kTRUE);
464  if(isMC && (event->GetRunNumber()>=146686 && event->GetRunNumber()<=146860))
465  fPidHF->SetMClowenpp2011(kTRUE);
467  }else{
468  // check that AliPIDResponse object was properly set in case of using OADB
469  if(fPidHF->GetPidResponse()==0x0) AliFatal("AliPIDResponse object not set");
470  }
471  }
472 }
473 //---------------------------------------------------------------------------
475  //
476  // Event selection
477  //
478  //if(fTriggerMask && event->GetTriggerMask()!=fTriggerMask) return kFALSE;
479 
480 
481 
482  fWhyRejection=0;
484  Bool_t accept=kTRUE;
485 
486 
487  // check if it's MC
488  Bool_t isMC=kFALSE;
489  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)event)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
490  if(mcArray) {isMC=kTRUE;fUseAOD049=kFALSE;}
491 
492 
493  SetupPID(event);
494 
495  // trigger class
496  TString firedTriggerClasses=((AliAODEvent*)event)->GetFiredTriggerClasses();
497  // don't do for MC and for PbPb 2010 data
498  if(!isMC && (event->GetRunNumber()<136851 || event->GetRunNumber()>139517)) {
499  if(!firedTriggerClasses.Contains(fTriggerClass[0].Data()) &&
500  (fTriggerClass[1].CompareTo("")==0 || !firedTriggerClasses.Contains(fTriggerClass[1].Data())) ) {
501  fWhyRejection=5;
503  accept=kFALSE;
504  }
505  }
506 
507  // TEMPORARY FIX FOR GetEvent
508  Int_t nTracks=((AliAODEvent*)event)->GetNumberOfTracks();
509  for(Int_t itr=0; itr<nTracks; itr++){
510  AliAODTrack* tr=(AliAODTrack*)((AliAODEvent*)event)->GetTrack(itr);
511  tr->SetAODEvent((AliAODEvent*)event);
512  }
513 
514  // TEMPORARY FIX FOR REFERENCES
515  // Fix references to daughter tracks
516  // if(fFixRefs) {
517  // AliAnalysisVertexingHF *fixer = new AliAnalysisVertexingHF();
518  // fixer->FixReferences((AliAODEvent*)event);
519  // delete fixer;
520  // }
521  //
522 
523 
524  // physics selection requirements
526  Bool_t isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerMask);
527  if(!isSelected) {
528  if(accept) fWhyRejection=7;
530  accept=kFALSE;
531  }else{
532  if(fUseOnlyOneTrigger){
533  if(((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected()!=fTriggerMask){
534  if(accept) fWhyRejection=7;
536  accept=kFALSE;
537  }
538  }
539  }
540  }
541 
542  // vertex requirements
543 
544  const AliVVertex *vertex = event->GetPrimaryVertex();
545 
546  if(!vertex){
547  accept=kFALSE;
549  }else{
550  TString title=vertex->GetTitle();
551  if(title.Contains("Z") && fMinVtxType>1){
552  accept=kFALSE;
554  }
555  else if(title.Contains("3D") && fMinVtxType>2){
556  accept=kFALSE;
558  }
559  if(vertex->GetNContributors()<fMinVtxContr){
560  accept=kFALSE;
562  }
563  if(TMath::Abs(vertex->GetZ())>fMaxVtxZ) {
565  if(accept) fWhyRejection=6;
566  accept=kFALSE;
567  }
568  }
569 
570  if(fCutOnzVertexSPD>0){
571  const AliVVertex *vSPD = ((AliAODEvent*)event)->GetPrimaryVertexSPD();
572  if(!vSPD || (vSPD && vSPD->GetNContributors()<fMinVtxContr)){
573  accept=kFALSE;
575  }else{
576  if(fCutOnzVertexSPD==1 && TMath::Abs(vSPD->GetZ())>12.) {
578  if(accept) fWhyRejection=6;
579  accept=kFALSE;
580  }
581  if(fCutOnzVertexSPD==2 && vertex){
582  if(TMath::Abs(vSPD->GetZ()-vertex->GetZ())>0.5) {
584  if(accept) fWhyRejection=6;
585  accept=kFALSE;
586  }
587  }
588  }
589  }
590 
591  // pile-up rejection
595  if(event->IsPileupFromSPD(cutc,cutz,3.,2.,10.)) {
596  if(accept) fWhyRejection=1;
598  accept=kFALSE;
599  }
600  }
602  AliAnalysisUtils utils;
603  Bool_t isPUMV = utils.IsPileUpMV(event);
604  if(isPUMV) {
605  if(accept) fWhyRejection=1;
607  accept=kFALSE;
608  }
609  }
610 
611  // centrality selection
612  if (fUseCentrality!=kCentOff) {
613  Int_t rejection=IsEventSelectedInCentrality(event);
614  Bool_t okCent=kFALSE;
615  if(rejection==0) okCent=kTRUE;
616  if(isMC && rejection==4 && !fUseCentrFlatteningInMC) okCent=kTRUE;
617  if(!okCent){
618  if(accept) fWhyRejection=rejection;
621  accept=kFALSE;
622  }
623 
624  }
625 
626  // PbPb2011 outliers in tracklets vs. VZERO and centTRK vs. centV0
627  if(event->GetRunNumber()>=167693 && event->GetRunNumber()<=170593){
629  Double_t v0cent=GetCentrality((AliAODEvent*)event,kCentV0M);
630  Double_t ntracklets=((AliAODEvent*)event)->GetTracklets()->GetNumberOfTracklets();
631  Double_t cutval=60.-0.08*ntracklets+1./50000.*ntracklets*ntracklets;
632  if(ntracklets<1000. && v0cent<cutval){
633  if(accept) fWhyRejection=2;
635  accept=kFALSE;
636  }
637  }
638  if(fMaxDiffTRKV0Centr>0.){
639  Double_t v0cent=GetCentrality((AliAODEvent*)event,kCentV0M);
640  Double_t trkcent=GetCentrality((AliAODEvent*)event,kCentTRK);
641  if(TMath::Abs(trkcent-v0cent)>fMaxDiffTRKV0Centr){
642  if(accept) fWhyRejection=1;
644  accept=kFALSE;
645  }
646  }
647  }
648 
649  // Correcting PP2012 flag to remoce tracks crossing SPD misaligned staves for periods 12def
650  if(fApplySPDMisalignedPP2012 && !(event->GetRunNumber()>=195681 && event->GetRunNumber()<=197388)) fApplySPDMisalignedPP2012=false;
651 
652  return accept;
653 }
654 //---------------------------------------------------------------------------
656  //
657  // Daughter tracks selection
658  //
659  if(!fTrackCuts) return kTRUE;
660 
661  Int_t ndaughters = d->GetNDaughters();
662  AliAODVertex *vAOD = d->GetPrimaryVtx();
663  Double_t pos[3],cov[6];
664  vAOD->GetXYZ(pos);
665  vAOD->GetCovarianceMatrix(cov);
666  const AliESDVertex vESD(pos,cov,100.,100);
667 
668  Bool_t retval=kTRUE;
669 
670  for(Int_t idg=0; idg<ndaughters; idg++) {
671  AliAODTrack *dgTrack = (AliAODTrack*)d->GetDaughter(idg);
672  if(!dgTrack) {retval = kFALSE; continue;}
673  //printf("charge %d\n",dgTrack->Charge());
674  if(dgTrack->Charge()==0) continue; // it's not a track, but a V0
675 
677  { if(!dgTrack->HasPointOnITSLayer(0)) { retval = kFALSE; continue; } }
678 
679  if(!IsDaughterSelected(dgTrack,&vESD,fTrackCuts,aod)) retval = kFALSE;
680  }
681 
682  return retval;
683 }
684 //---------------------------------------------------------------------------
686  //
687  // Check if AOD and deltaAOD files are composed of the same events:
688  // mismatches were observed in the merged AODs of LHC15o
689  //
690  // When AOD+deltaAOD are produced from ESD, mismatches can be found looking at:
691  // - the AOD trees in AliAOD.root and AliAOD.VertexingHF.root have different number of entries
692  // - the titles of the TProcessID objects do not match
693  // When deltaAOD are produced from AOD, mismatches can be found looking at:
694  // - the AOD trees in AliAOD.root and AliAOD.VertexingHF.root have different number of entries
695  //
696  // Return values:
697  // -1: AOD and deltaAOD trees have different number of entries
698  // 0: AOD and deltaAOD trees have same number of entries + the titles of the TProcessID objects do not match
699  // 1: AOD and deltaAOD trees have same number of entries + the titles of the TProcessID objects match
700  Bool_t okTProcessNames = kTRUE;
701  AliAODHandler* aodHandler = (AliAODHandler*)((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
702  TTree *treeAOD = aodHandler->GetTree();
703  TTree *treeDeltaAOD = treeAOD->GetFriend("aodTree");
704  if(treeDeltaAOD && treeAOD){
705  if(treeAOD->GetEntries()!=treeDeltaAOD->GetEntries()){
706  printf("AliRDHFCuts::CheckMatchingAODdeltaAODevents: Difference in number of entries in main and friend tree, skipping event\n");
707  return -1;
708  }
709  TFile *mfile = treeAOD->GetCurrentFile();
710  TFile *dfile = treeDeltaAOD->GetCurrentFile();
711  TList* lm=mfile->GetListOfKeys();
712  TList* ld=dfile->GetListOfKeys();
713  Int_t nentm=lm->GetEntries();
714  Int_t nentd=ld->GetEntries();
715  for(Int_t jm=0; jm<nentm; jm++){
716  TKey* o=(TKey*)lm->At(jm);
717  TString clnam=o->GetClassName();
718  if(clnam=="TProcessID"){
719  TString pname=o->GetName();
720  TString ptit=o->GetTitle();
721  if(pname.Contains("ProcessID")){
722  TObject* od=(TObject*)ld->FindObject(pname.Data());
723  if(od){
724  TString ptit2=od->GetTitle();
725  if(ptit2!=ptit){
726  printf("AliRDHFCuts::CheckMatchingAODdeltaAODevents: mismatch in %s: AOD: %s -- deltaAOD: %s\n",pname.Data(),ptit.Data(),ptit2.Data());
727  okTProcessNames = kFALSE;
728  }
729  }
730  }
731  }
732  }
733  }
734 
735  if (okTProcessNames) return 1;
736  else return 0;
737 }
738 //---------------------------------------------------------------------------
740  //
741  // Check the correctness of the string syntax
742  //
743  Bool_t retval=kTRUE;
744 
745  if(!rows.Contains("pt")) {
746  if(print) AliError("string must contain \"pt\"");
747  retval= kFALSE;
748  }
749  return retval;
750 }
751 //---------------------------------------------------------------------------
753  //
754  //Create the TFormula from TString for TPC crossed rows pT dependent cut
755  //
756 
757 
758  // setting data member that describes the TPC crossed rows pT dependent cut
760 
761  // creating TFormula from TString
764  // resetting TFormula
766  }
767  if(!CheckPtDepCrossedRows(rows,kTRUE))return;
768 
769  TString tmp(rows);
770  tmp.ReplaceAll("pt","x");
771  f1CutMinNCrossedRowsTPCPtDep = new TFormula("f1CutMinNCrossedRowsTPCPtDep",tmp.Data());
772 
773 
774 }
775 //---------------------------------------------------------------------------
776 Bool_t AliRDHFCuts::IsDaughterSelected(AliAODTrack *track,const AliESDVertex *primary,AliESDtrackCuts *cuts, const AliAODEvent* aod) const{
777  //
778  // Convert to ESDtrack, relate to vertex and check cuts
779  //
780  if(!cuts) return kTRUE;
781 
782  if(cuts->GetFlagCutTOFdistance()) cuts->SetFlagCutTOFdistance(kFALSE);
783 
784 
785  // convert to ESD track here
786  AliESDtrack esdTrack(track);
787  // set the TPC cluster info
788  esdTrack.SetTPCClusterMap(track->GetTPCClusterMap());
789  esdTrack.SetTPCSharedMap(track->GetTPCSharedMap());
790  esdTrack.SetTPCPointsF(track->GetTPCNclsF());
791  // needed to calculate the impact parameters
792  esdTrack.RelateToVertex(primary,0.,3.);
793 
794  //applying ESDtrackCut
795  if(!cuts->IsSelected(&esdTrack)) return kFALSE;
796 
797  //appliyng kink rejection
798  if(fKinkReject){
799  AliAODVertex *maybeKink=track->GetProdVertex();
800  if(maybeKink->GetType()==AliAODVertex::kKink) return kFALSE;
801  }
802 
803  //appliyng TPC crossed rows pT dependent cut
805  Float_t nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
806  if(nCrossedRowsTPC<f1CutMinNCrossedRowsTPCPtDep->Eval(esdTrack.Pt())) return kFALSE;
807  }
808 
809  //appliyng NTPCcls/NTPCcrossedRows cut
811  Float_t nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
812  Float_t nClustersTPC = esdTrack.GetTPCNcls();
813  if(nCrossedRowsTPC!=0){
814  Float_t ratio = nClustersTPC/nCrossedRowsTPC;
815  if(ratio<fCutRatioClsOverCrossRowsTPC) return kFALSE;
816  }
817  else return kFALSE;
818  }
819 
820  //appliyng TPCsignalN/NTPCcrossedRows cut
822  Float_t nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
823  Float_t nTPCsignal = esdTrack.GetTPCsignalN();
824  if(nCrossedRowsTPC!=0){
825  Float_t ratio = nTPCsignal/nCrossedRowsTPC;
826  if(ratio<fCutRatioSignalNOverCrossRowsTPC) return kFALSE;
827  }
828  else return kFALSE;
829  }
830 
831  // geometrical cut (note uses track at vertex instead of at TPC inner wall)
832  if(fUseCutGeoNcrNcl && aod){
833  Float_t nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
834  Float_t lengthInActiveZoneTPC=esdTrack.GetLengthInActiveZone(0,fDeadZoneWidth,220.,aod->GetMagneticField());
835  Double_t cutGeoNcrNclLength=fCutGeoNcrNclLength-TMath::Power(TMath::Abs(esdTrack.GetSigned1Pt()),fCutGeoNcrNclGeom1Pt);
836  Bool_t isOK=kTRUE;
837  if (lengthInActiveZoneTPC<cutGeoNcrNclLength) isOK=kFALSE;
838  if (nCrossedRowsTPC<fCutGeoNcrNclFractionNcr*cutGeoNcrNclLength) isOK=kFALSE;
839  if (esdTrack.GetTPCncls()<fCutGeoNcrNclFractionNcl*cutGeoNcrNclLength) isOK=kFALSE;
840  if(!isOK) return kFALSE;
841  }
842 
843 
845  // to be implemented
846  // we need either to have here the AOD Event,
847  // or to have the pileup vertex object
848  }
849 
851  Bool_t deadSPDLay1PbPb2011[20][4]={
852  {kTRUE,kTRUE,kTRUE,kTRUE},
853  {kTRUE,kTRUE,kTRUE,kTRUE},
854  {kTRUE,kTRUE,kTRUE,kTRUE},
855  {kTRUE,kTRUE,kTRUE,kTRUE},
856  {kTRUE,kTRUE,kTRUE,kTRUE},
857  {kFALSE,kFALSE,kTRUE,kTRUE},
858  {kTRUE,kTRUE,kFALSE,kFALSE},
859  {kTRUE,kTRUE,kTRUE,kTRUE},
860  {kFALSE,kFALSE,kTRUE,kTRUE},
861  {kTRUE,kTRUE,kTRUE,kTRUE},
862  {kTRUE,kTRUE,kFALSE,kFALSE},
863  {kTRUE,kTRUE,kTRUE,kTRUE},
864  {kFALSE,kFALSE,kFALSE,kFALSE},
865  {kFALSE,kFALSE,kTRUE,kTRUE},
866  {kFALSE,kFALSE,kFALSE,kFALSE},
867  {kFALSE,kFALSE,kFALSE,kFALSE},
868  {kTRUE,kTRUE,kTRUE,kTRUE},
869  {kTRUE,kTRUE,kFALSE,kFALSE},
870  {kFALSE,kFALSE,kFALSE,kFALSE},
871  {kFALSE,kFALSE,kFALSE,kFALSE}
872  };
873  Bool_t deadSPDLay2PbPb2011[40][4]={
874  {kTRUE,kTRUE,kTRUE,kTRUE},
875  {kTRUE,kTRUE,kTRUE,kTRUE},
876  {kTRUE,kTRUE,kTRUE,kTRUE},
877  {kTRUE,kTRUE,kTRUE,kTRUE},
878  {kTRUE,kTRUE,kTRUE,kTRUE},
879  {kTRUE,kTRUE,kTRUE,kTRUE},
880  {kTRUE,kTRUE,kTRUE,kTRUE},
881  {kTRUE,kTRUE,kTRUE,kTRUE},
882  {kTRUE,kTRUE,kTRUE,kTRUE},
883  {kTRUE,kTRUE,kTRUE,kTRUE},
884  {kTRUE,kTRUE,kTRUE,kTRUE},
885  {kTRUE,kTRUE,kTRUE,kTRUE},
886  {kFALSE,kFALSE,kFALSE,kFALSE},
887  {kFALSE,kFALSE,kTRUE,kTRUE},
888  {kTRUE,kTRUE,kTRUE,kTRUE},
889  {kTRUE,kTRUE,kTRUE,kTRUE},
890  {kTRUE,kTRUE,kFALSE,kFALSE},
891  {kTRUE,kTRUE,kTRUE,kTRUE},
892  {kTRUE,kTRUE,kTRUE,kTRUE},
893  {kTRUE,kTRUE,kTRUE,kTRUE},
894  {kFALSE,kFALSE,kFALSE,kFALSE},
895  {kFALSE,kFALSE,kFALSE,kFALSE},
896  {kTRUE,kTRUE,kTRUE,kTRUE},
897  {kTRUE,kTRUE,kTRUE,kTRUE},
898  {kFALSE,kFALSE,kFALSE,kFALSE},
899  {kFALSE,kFALSE,kFALSE,kFALSE},
900  {kTRUE,kTRUE,kTRUE,kTRUE},
901  {kTRUE,kTRUE,kTRUE,kTRUE},
902  {kFALSE,kFALSE,kFALSE,kFALSE},
903  {kFALSE,kFALSE,kFALSE,kFALSE},
904  {kFALSE,kFALSE,kFALSE,kFALSE},
905  {kFALSE,kFALSE,kFALSE,kFALSE},
906  {kTRUE,kTRUE,kTRUE,kTRUE},
907  {kTRUE,kTRUE,kTRUE,kTRUE},
908  {kTRUE,kTRUE,kFALSE,kFALSE},
909  {kTRUE,kTRUE,kTRUE,kTRUE},
910  {kFALSE,kFALSE,kFALSE,kFALSE},
911  {kFALSE,kFALSE,kFALSE,kFALSE},
912  {kFALSE,kFALSE,kFALSE,kFALSE},
913  {kFALSE,kFALSE,kFALSE,kFALSE}
914  };
915  Double_t xyz1[3],xyz2[3];
916  esdTrack.GetXYZAt(3.9,0.,xyz1);
917  esdTrack.GetXYZAt(7.6,0.,xyz2);
918  Double_t phi1=TMath::ATan2(xyz1[1],xyz1[0]);
919  if(phi1<0) phi1+=2*TMath::Pi();
920  Int_t lad1=(Int_t)(phi1/(2.*TMath::Pi()/20.));
921  Double_t phi2=TMath::ATan2(xyz2[1],xyz2[0]);
922  if(phi2<0) phi2+=2*TMath::Pi();
923  Int_t lad2=(Int_t)(phi2/(2.*TMath::Pi()/40.));
924  Int_t mod1=(Int_t)((xyz1[2]+14)/7.);
925  Int_t mod2=(Int_t)((xyz2[2]+14)/7.);
926  Bool_t lay1ok=kFALSE;
927  if(mod1>=0 && mod1<4 && lad1<20){
928  lay1ok=deadSPDLay1PbPb2011[lad1][mod1];
929  }
930  Bool_t lay2ok=kFALSE;
931  if(mod2>=0 && mod2<4 && lad2<40){
932  lay2ok=deadSPDLay2PbPb2011[lad2][mod2];
933  }
934  if(!lay1ok && !lay2ok) return kFALSE;
935  }
936 
938  // Cut tracks crossing the SPD at 5.6<phi<2pi
939  Double_t xyz1[3],xyz2[3];
940  esdTrack.GetXYZAt(3.9,0.,xyz1);
941  esdTrack.GetXYZAt(7.6,0.,xyz2);
942  Double_t phi1=TMath::ATan2(xyz1[1],xyz1[0]);
943  if(phi1<0) phi1+=2*TMath::Pi();
944  Double_t phi2=TMath::ATan2(xyz2[1],xyz2[0]);
945  if(phi2<0) phi2+=2*TMath::Pi();
946  Bool_t lay1ok=kTRUE;
947  if(phi1>5.6 && phi1<2.*TMath::Pi()) lay1ok=kFALSE;
948  Bool_t lay2ok=kTRUE;
949  if(phi2>5.6 && phi2<2.*TMath::Pi()) lay2ok=kFALSE;
950  if(!lay1ok || !lay2ok) return kFALSE;
951  }
952 
953  return kTRUE;
954 }
955 //---------------------------------------------------------------------------
956 void AliRDHFCuts::SetPtBins(Int_t nPtBinLimits,Float_t *ptBinLimits) {
957  // Set the pt bins
958 
959  if(fPtBinLimits) {
960  delete [] fPtBinLimits;
961  fPtBinLimits = NULL;
962  printf("Changing the pt bins\n");
963  }
964 
965  if(nPtBinLimits != fnPtBins+1){
966  cout<<"Warning: ptBinLimits dimention "<<nPtBinLimits<<" != nPtBins+1 ("<<fnPtBins+1<<")\nSetting nPtBins to "<<nPtBinLimits-1<<endl;
967  SetNPtBins(nPtBinLimits-1);
968  }
969 
970  fnPtBinLimits = nPtBinLimits;
971  SetGlobalIndex();
972  //cout<<"Changing also Global Index -> "<<fGlobalIndex<<endl;
974  for(Int_t ib=0; ib<nPtBinLimits; ib++) fPtBinLimits[ib]=ptBinLimits[ib];
975 
976  return;
977 }
978 //---------------------------------------------------------------------------
979 void AliRDHFCuts::SetVarNames(Int_t nVars,TString *varNames,Bool_t *isUpperCut){
980  // Set the variable names
981 
982  if(fVarNames) {
983  delete [] fVarNames;
984  fVarNames = NULL;
985  //printf("Changing the variable names\n");
986  }
987  if(nVars!=fnVars){
988  printf("Wrong number of variables: it has to be %d\n",fnVars);
989  return;
990  }
991  //fnVars=nVars;
992  fVarNames = new TString[nVars];
993  fIsUpperCut = new Bool_t[nVars];
994  for(Int_t iv=0; iv<nVars; iv++) {
995  fVarNames[iv] = varNames[iv];
996  fIsUpperCut[iv] = isUpperCut[iv];
997  }
998 
999  return;
1000 }
1001 //---------------------------------------------------------------------------
1003  // Set the variables to be used for cuts optimization
1004 
1005  if(fVarsForOpt) {
1006  delete [] fVarsForOpt;
1007  fVarsForOpt = NULL;
1008  //printf("Changing the variables for cut optimization\n");
1009  }
1010 
1011  if(nVars==0){
1012  printf("%d not accepted as number of variables: it has to be %d\n",nVars,fnVars);
1013  return;
1014  }
1015 
1016  fnVarsForOpt = 0;
1017  fVarsForOpt = new Bool_t[fnVars];
1018  for(Int_t iv=0; iv<fnVars; iv++) {
1019  fVarsForOpt[iv]=forOpt[iv];
1020  if(fVarsForOpt[iv]) fnVarsForOpt++;
1021  }
1022 
1023  return;
1024 }
1025 
1026 //---------------------------------------------------------------------------
1028  //
1029  // set centrality estimator
1030  //
1031  fUseCentrality=flag;
1032  if(fUseCentrality<kCentOff||fUseCentrality>=kCentInvalid) AliWarning("Centrality estimator not valid");
1033 
1034  return;
1035 }
1036 
1037 
1038 //---------------------------------------------------------------------------
1040  //
1041  // store the cuts
1042  //
1043  if(nVars!=fnVars) {
1044  printf("Wrong number of variables: it has to be %d\n",fnVars);
1045  AliFatal("exiting");
1046  }
1047  if(nPtBins!=fnPtBins) {
1048  printf("Wrong number of pt bins: it has to be %d\n",fnPtBins);
1049  AliFatal("exiting");
1050  }
1051 
1052  if(!fCutsRD) fCutsRD = new Float_t[fGlobalIndex];
1053 
1054 
1055  for(Int_t iv=0; iv<fnVars; iv++) {
1056 
1057  for(Int_t ib=0; ib<fnPtBins; ib++) {
1058 
1059  //check
1060  if(GetGlobalIndex(iv,ib)>=fGlobalIndex) {
1061  cout<<"Overflow, exit..."<<endl;
1062  return;
1063  }
1064 
1065  fCutsRD[GetGlobalIndex(iv,ib)] = cutsRD[iv][ib];
1066 
1067  }
1068  }
1069  return;
1070 }
1071 //---------------------------------------------------------------------------
1072 void AliRDHFCuts::SetCuts(Int_t glIndex,Float_t* cutsRDGlob){
1073  //
1074  // store the cuts
1075  //
1076  if(glIndex != fGlobalIndex){
1077  cout<<"Wrong array size: it has to be "<<fGlobalIndex<<endl;
1078  AliFatal("exiting");
1079  }
1080  if(!fCutsRD) fCutsRD = new Float_t[fGlobalIndex];
1081 
1082  for(Int_t iGl=0;iGl<fGlobalIndex;iGl++){
1083  fCutsRD[iGl] = cutsRDGlob[iGl];
1084  }
1085  return;
1086 }
1087 //---------------------------------------------------------------------------
1089  //
1090  // print all cuts values
1091  //
1092 
1093  printf("Minimum vtx type %d\n",fMinVtxType);
1094  printf("Minimum vtx contr %d\n",fMinVtxContr);
1095  printf("Max vtx red chi2 %f\n",fMaxVtxRedChi2);
1096  printf("Min SPD mult %d\n",fMinSPDMultiplicity);
1097  printf("Use PID %d OldPid=%d\n",(Int_t)fUsePID,fPidHF ? fPidHF->GetOldPid() : -1);
1098  printf("Remove daughters from vtx %d\n",(Int_t)fRemoveDaughtersFromPrimary);
1099  printf("Physics selection: %s\n",fUsePhysicsSelection ? "Yes" : "No");
1100  printf("Pileup rejection: %s\n",(fOptPileup > 0) ? "Yes" : "No");
1101  if(fOptPileup==1) printf(" -- Reject pileup event");
1102  if(fOptPileup==2) printf(" -- Reject tracks from pileup vtx");
1103  if(fUseCentrality>0) {
1104  TString estimator="";
1105  if(fUseCentrality==1) estimator = "V0";
1106  if(fUseCentrality==2) estimator = "Tracks";
1107  if(fUseCentrality==3) estimator = "Tracklets";
1108  if(fUseCentrality==4) estimator = "SPD clusters outer";
1109  if(fUseCentrality==5) estimator = "ZNA";
1110  if(fUseCentrality==6) estimator = "ZPA";
1111  if(fUseCentrality==7) estimator = "V0A";
1112  printf("Centrality class considered: %.1f-%.1f, estimated with %s\n",fMinCentrality,fMaxCentrality,estimator.Data());
1113  }
1114  if(fIsCandTrackSPDFirst) printf("Check for candidates with pt < %2.2f, that daughters fullfill kFirst criteria\n",fMaxPtCandTrackSPDFirst);
1115 
1116  if(fCutRatioClsOverCrossRowsTPC) printf("N TPC Clusters > %f N TPC Crossed Rows\n", fCutRatioClsOverCrossRowsTPC);
1117  if(fCutRatioSignalNOverCrossRowsTPC) printf("N TPC Points for dE/dx > %f N TPC Crossed Rows\n", fCutRatioSignalNOverCrossRowsTPC);
1118  if(f1CutMinNCrossedRowsTPCPtDep) printf("N TPC Crossed Rows pT-dependent cut: %s\n", fCutMinCrossedRowsTPCPtDep.Data());
1119 
1120  if(fVarNames){
1121  cout<<"Array of variables"<<endl;
1122  for(Int_t iv=0;iv<fnVars;iv++){
1123  cout<<fVarNames[iv]<<"\t";
1124  }
1125  cout<<endl;
1126  }
1127  if(fVarsForOpt){
1128  cout<<"Array of optimization"<<endl;
1129  for(Int_t iv=0;iv<fnVars;iv++){
1130  cout<<fVarsForOpt[iv]<<"\t";
1131  }
1132  cout<<endl;
1133  }
1134  if(fIsUpperCut){
1135  cout<<"Array of upper/lower cut"<<endl;
1136  for(Int_t iv=0;iv<fnVars;iv++){
1137  cout<<fIsUpperCut[iv]<<"\t";
1138  }
1139  cout<<endl;
1140  }
1141  if(fPtBinLimits){
1142  cout<<"Array of ptbin limits"<<endl;
1143  for(Int_t ib=0;ib<fnPtBinLimits;ib++){
1144  cout<<fPtBinLimits[ib]<<"\t";
1145  }
1146  cout<<endl;
1147  }
1148  if(fCutsRD){
1149  cout<<"Matrix of cuts"<<endl;
1150  for(Int_t iv=0;iv<fnVars;iv++){
1151  for(Int_t ib=0;ib<fnPtBins;ib++){
1152  cout<<"fCutsRD["<<iv<<"]["<<ib<<"] = "<<fCutsRD[GetGlobalIndex(iv,ib)]<<"\t";
1153  }
1154  cout<<endl;
1155  }
1156  cout<<endl;
1157  }
1158  if(fPidHF) fPidHF->PrintAll();
1159  return;
1160 }
1161 
1162 //--------------------------------------------------------------------------
1164  // print the trigger selection
1165 
1166  printf("Selected trigger classes: %s %s\n",fTriggerClass[0].Data(),fTriggerClass[1].Data());
1167 
1168  cout<<" Trigger selection pattern: ";
1169  if( fTriggerMask & AliVEvent::kAny ) cout<<" kAny ";
1170  if( fTriggerMask & AliVEvent::kAnyINT ) cout<<" kAnyINT ";
1171  if( fTriggerMask & AliVEvent::kINT7 ) cout<<" kINT7 ";
1172  if( fTriggerMask & AliVEvent::kMB ) cout<<" kMB ";
1173  if( fTriggerMask & AliVEvent::kCINT5 ) cout<<" kCINT5 ";
1174  if( fTriggerMask & AliVEvent::kCentral ) cout<<" kCentral ";
1175  if( fTriggerMask & AliVEvent::kSemiCentral ) cout<<" kSemiCentral ";
1176  if( fTriggerMask & AliVEvent::kEMCEGA ) cout<<" kEMCEGA ";
1177  if( fTriggerMask & AliVEvent::kHighMult ) cout<<" kHighMult ";
1178  if( fTriggerMask & AliVEvent::kFastOnly ) cout<<" kFastOnly ";
1179  cout << endl<< endl;
1180 
1181 }
1182 
1183 //---------------------------------------------------------------------------
1184 void AliRDHFCuts::GetCuts(Float_t**& cutsRD) const{
1185  //
1186  // get the cuts
1187  //
1188 
1189  //cout<<"Give back a "<<fnVars<<"x"<<fnPtBins<<" matrix."<<endl;
1190 
1191 
1192  Int_t iv,ib;
1193  if(!cutsRD) {
1194  //cout<<"Initialization..."<<endl;
1195  cutsRD=new Float_t*[fnVars];
1196  for(iv=0; iv<fnVars; iv++) {
1197  cutsRD[iv] = new Float_t[fnPtBins];
1198  }
1199  }
1200 
1201  for(Int_t iGlobal=0; iGlobal<fGlobalIndex; iGlobal++) {
1202  GetVarPtIndex(iGlobal,iv,ib);
1203  cutsRD[iv][ib] = fCutsRD[iGlobal];
1204  }
1205 
1206  return;
1207 }
1208 
1209 //---------------------------------------------------------------------------
1211  //
1212  // give the global index from variable and pt bin
1213  //
1214  return iPtBin*fnVars+iVar;
1215 }
1216 
1217 //---------------------------------------------------------------------------
1218 void AliRDHFCuts::GetVarPtIndex(Int_t iGlob, Int_t& iVar, Int_t& iPtBin) const {
1219  //
1220  //give the index of the variable and of the pt bin from the global index
1221  //
1222  iPtBin=(Int_t)iGlob/fnVars;
1223  iVar=iGlob%fnVars;
1224 
1225  return;
1226 }
1227 
1228 //---------------------------------------------------------------------------
1230  //
1231  //give the pt bin where the pt lies.
1232  //
1233  Int_t ptbin=-1;
1234  if(pt<fPtBinLimits[0])return ptbin;
1235  for (Int_t i=0;i<fnPtBins;i++){
1236  if(pt<fPtBinLimits[i+1]) {
1237  ptbin=i;
1238  break;
1239  }
1240  }
1241  return ptbin;
1242 }
1243 //-------------------------------------------------------------------
1245  //
1246  // Give the value of cut set for the variable iVar and the pt bin iPtBin
1247  //
1248  if(!fCutsRD){
1249  cout<<"Cuts not iniziaisez yet"<<endl;
1250  return 0;
1251  }
1252  return fCutsRD[GetGlobalIndex(iVar,iPtBin)];
1253 }
1254 
1255 //-------------------------------------------------------------------
1257 
1258  if(aodEvent->GetRunNumber()<244824)return GetCentralityOldFramework(aodEvent,estimator);
1259  Double_t cent=-999;
1260  AliMultSelection *multSelection = (AliMultSelection * ) aodEvent->FindListObject("MultSelection");
1261  if(!multSelection){
1262  AliWarning("AliMultSelection could not be found in the aod event list of objects");
1263  return cent;
1264  }
1265  if(estimator==kCentV0M){
1266  cent=multSelection->GetMultiplicityPercentile("V0M");
1267  Int_t qual = multSelection->GetEvSelCode();
1268  if(qual == 199 ) cent=-999;
1269  return cent;
1270  }
1271  else {
1272  AliWarning(Form("CENTRALITY ESTIMATE WITH ESTIMATEOR %d NOT YET IMPLEMENTED FOR NEW FRAMEWORK",(Int_t)estimator));
1273  return cent;
1274  }
1275 
1276 }
1277 //-------------------------------------------------------------------
1279  //
1280  // Get centrality percentile
1281  //
1282 
1283  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)aodEvent)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
1284  if(mcArray) {fUseAOD049=kFALSE;}
1285 
1286  AliAODHeader *header=dynamic_cast<AliAODHeader*>(aodEvent->GetHeader());
1287  if(!header) AliFatal("Not a standard AOD");
1288  AliCentrality *centrality=header->GetCentralityP();
1289  Float_t cent=-999.;
1290  Bool_t isSelRun=kFALSE;
1291  Int_t selRun[5]={138364, 138826, 138828, 138836, 138871};
1292  if(!centrality) return cent;
1293  else{
1294  if (estimator==kCentV0M){
1295  cent=(Float_t)(centrality->GetCentralityPercentile("V0M"));
1296  if(cent<0){
1297  Int_t quality = centrality->GetQuality();
1298  if(quality<=1){ // fQuality==1 means rejected by zVertex cut that we apply a part and we want to keep separate (Giacomo)
1299  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0M");
1300  }else{
1301  Int_t runnum=aodEvent->GetRunNumber();
1302  for(Int_t ir=0;ir<5;ir++){
1303  if(runnum==selRun[ir]){
1304  isSelRun=kTRUE;
1305  break;
1306  }
1307  }
1308  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0M");
1309  }
1310  }
1311 
1312  //temporary fix for AOD049 outliers
1313  if(fUseAOD049&&cent>=0){
1314  Float_t v0=0;
1315  AliAODVZERO* aodV0 = aodEvent->GetVZEROData();
1316  v0+=aodV0->GetMTotV0A();
1317  v0+=aodV0->GetMTotV0C();
1318  if(cent==0&&v0<19500)return -1;//filtering issue
1319  Float_t tkl = (Float_t)(aodEvent->GetTracklets()->GetNumberOfTracklets());
1320  Float_t val= 1.30552 + 0.147931 * v0;
1321  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};
1322  if ( TMath::Abs(tkl-val) > 6.*tklSigma[(Int_t)cent] )return -1;//outlier
1323  }
1324  }
1325  else {
1326  if (estimator==kCentTRK) {
1327  cent=(Float_t)(centrality->GetCentralityPercentile("TRK"));
1328  if(cent<0){
1329  Int_t quality = centrality->GetQuality();
1330  if(quality<=1){
1331  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TRK");
1332  }else{
1333  Int_t runnum=aodEvent->GetRunNumber();
1334  for(Int_t ir=0;ir<5;ir++){
1335  if(runnum==selRun[ir]){
1336  isSelRun=kTRUE;
1337  break;
1338  }
1339  }
1340  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TRK");
1341  }
1342  }
1343  }
1344  else{
1345  if (estimator==kCentTKL){
1346  cent=(Float_t)(centrality->GetCentralityPercentile("TKL"));
1347  if(cent<0){
1348  Int_t quality = centrality->GetQuality();
1349  if(quality<=1){
1350  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TKL");
1351  }else{
1352  Int_t runnum=aodEvent->GetRunNumber();
1353  for(Int_t ir=0;ir<5;ir++){
1354  if(runnum==selRun[ir]){
1355  isSelRun=kTRUE;
1356  break;
1357  }
1358  }
1359  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TKL");
1360  }
1361  }
1362  }
1363  else{
1364  if (estimator==kCentCL1){
1365  cent=(Float_t)(centrality->GetCentralityPercentile("CL1"));
1366  if(cent<0){
1367  Int_t quality = centrality->GetQuality();
1368  if(quality<=1){
1369  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("CL1");
1370  }else{
1371  Int_t runnum=aodEvent->GetRunNumber();
1372  for(Int_t ir=0;ir<5;ir++){
1373  if(runnum==selRun[ir]){
1374  isSelRun=kTRUE;
1375  break;
1376  }
1377  }
1378  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("CL1");
1379  }
1380  }
1381  }
1382  else{
1383  if (estimator==kCentZNA){
1384  cent=(Float_t)(centrality->GetCentralityPercentile("ZNA"));
1385  if(cent<0){
1386  Int_t quality = centrality->GetQuality();
1387  if(quality<=1){
1388  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("ZNA");
1389  }else{
1390  Int_t runnum=aodEvent->GetRunNumber();
1391  for(Int_t ir=0;ir<5;ir++){
1392  if(runnum==selRun[ir]){
1393  isSelRun=kTRUE;
1394  break;
1395  }
1396  }
1397  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("ZNA");
1398  }
1399  }
1400  }
1401  else{
1402  if (estimator==kCentZPA){
1403  cent=(Float_t)(centrality->GetCentralityPercentile("ZPA"));
1404  if(cent<0){
1405  Int_t quality = centrality->GetQuality();
1406  if(quality<=1){
1407  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("ZPA");
1408  }else{
1409  Int_t runnum=aodEvent->GetRunNumber();
1410  for(Int_t ir=0;ir<5;ir++){
1411  if(runnum==selRun[ir]){
1412  isSelRun=kTRUE;
1413  break;
1414  }
1415  }
1416  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("ZPA");
1417  }
1418  }
1419  }
1420  else{
1421  if (estimator==kCentV0A){
1422  cent=(Float_t)(centrality->GetCentralityPercentile("V0A"));
1423  if(cent<0){
1424  Int_t quality = centrality->GetQuality();
1425  if(quality<=1){
1426  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0A");
1427  }else{
1428  Int_t runnum=aodEvent->GetRunNumber();
1429  for(Int_t ir=0;ir<5;ir++){
1430  if(runnum==selRun[ir]){
1431  isSelRun=kTRUE;
1432  break;
1433  }
1434  }
1435  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0A");
1436  }
1437  }
1438  }
1439  else {
1440  AliWarning("Centrality estimator not valid");
1441 
1442  }
1443  }
1444  }
1445  }
1446  }
1447  }
1448  }
1449  }
1450  return cent;
1451 }
1452 //-------------------------------------------------------------------
1454  //
1455  // Compare two cuts objects
1456  //
1457 
1458  Bool_t areEqual=kTRUE;
1459 
1460  if(fMinVtxType!=obj->fMinVtxType) { printf("Minimum vtx type %d %d\n",fMinVtxType,obj->fMinVtxType); areEqual=kFALSE;}
1461 
1462  if(fMinVtxContr!=obj->fMinVtxContr) { printf("Minimum vtx contr %d %d\n",fMinVtxContr,obj->fMinVtxContr); areEqual=kFALSE;}
1463 
1464  if(TMath::Abs(fMaxVtxRedChi2-obj->fMaxVtxRedChi2)>1.e-10) { printf("Max vtx red chi2 %f %f\n",fMaxVtxRedChi2,obj->fMaxVtxRedChi2);areEqual=kFALSE;}
1465 
1466  if(fMinSPDMultiplicity!=obj->fMinSPDMultiplicity) { printf("Min SPD mult %d\n %d",fMinSPDMultiplicity,obj->fMinSPDMultiplicity);areEqual=kFALSE;}
1467 
1468  if(fUsePID!=obj->fUsePID) { printf("Use PID %d %d\n",(Int_t)fUsePID,(Int_t)obj->fUsePID); areEqual=kFALSE;}
1469 
1470  if(fRemoveDaughtersFromPrimary!=obj->fRemoveDaughtersFromPrimary) {printf("Remove daughters from vtx %d %d\n",(Int_t)fRemoveDaughtersFromPrimary,(Int_t)obj->fRemoveDaughtersFromPrimary); areEqual=kFALSE;}
1471  if(fTrackCuts){
1472  if(fTrackCuts->GetMinNClusterTPC()!=obj->fTrackCuts->GetMinNClusterTPC()) {printf("MinNClsTPC %d %d\n",fTrackCuts->GetMinNClusterTPC(),obj->fTrackCuts->GetMinNClusterTPC()); areEqual=kFALSE;}
1473 
1474  if(fTrackCuts->GetMinNClustersITS()!=obj->fTrackCuts->GetMinNClustersITS()) {printf("MinNClsITS %d %d\n",fTrackCuts->GetMinNClustersITS(),obj->fTrackCuts->GetMinNClustersITS()); areEqual=kFALSE;}
1475 
1476  if(TMath::Abs(fTrackCuts->GetMaxChi2PerClusterTPC()-obj->fTrackCuts->GetMaxChi2PerClusterTPC())>1.e-10) {printf("MaxChi2ClsTPC %f %f\n",fTrackCuts->GetMaxChi2PerClusterTPC(),obj->fTrackCuts->GetMaxChi2PerClusterTPC()); areEqual=kFALSE;}
1477 
1478  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;}
1479  }
1480 
1481  if(fCutsRD) {
1482  for(Int_t iv=0;iv<fnVars;iv++) {
1483  for(Int_t ib=0;ib<fnPtBins;ib++) {
1484  if(TMath::Abs(fCutsRD[GetGlobalIndex(iv,ib)]-obj->fCutsRD[GetGlobalIndex(iv,ib)])>1.e-10) {
1485  cout<<"fCutsRD["<<iv<<"]["<<ib<<"] = "<<fCutsRD[GetGlobalIndex(iv,ib)]<<" "<<obj->fCutsRD[GetGlobalIndex(iv,ib)]<<"\n";
1486  areEqual=kFALSE;
1487  }
1488  }
1489  }
1490  }
1491 
1492  return areEqual;
1493 }
1494 //---------------------------------------------------------------------------
1496  //
1497  // print cuts values in table format
1498  //
1499 
1500  TString ptString = "pT range";
1501  if(fVarNames && fPtBinLimits && fCutsRD){
1502  TString firstLine(Form("* %-15s",ptString.Data()));
1503  for (Int_t ivar=0; ivar<fnVars; ivar++){
1504  firstLine+=Form("* %-15s ",fVarNames[ivar].Data());
1505  if (ivar == fnVars){
1506  firstLine+="*\n";
1507  }
1508  }
1509  Printf("%s",firstLine.Data());
1510 
1511  for (Int_t ipt=0; ipt<fnPtBins; ipt++){
1512  TString line;
1513  if (ipt==fnPtBins-1){
1514  line=Form("* %5.1f < pt < inf ",fPtBinLimits[ipt]);
1515  }
1516  else{
1517  line=Form("* %5.1f < pt < %4.1f ",fPtBinLimits[ipt],fPtBinLimits[ipt+1]);
1518  }
1519  for (Int_t ivar=0; ivar<fnVars; ivar++){
1520  line+=Form("* %-15f ",fCutsRD[GetGlobalIndex(ivar,ipt)]);
1521  }
1522  Printf("%s",line.Data());
1523  }
1524 
1525  }
1526 
1527 
1528  return;
1529 }
1530 //--------------------------------------------------------------------------
1532  AliAODEvent *aod) const
1533 {
1534  //
1535  // Recalculate primary vertex without daughters
1536  //
1537 
1538  if(!aod) {
1539  AliError("Can not remove daughters from vertex without AOD event");
1540  return 0;
1541  }
1542 
1543  AliAODVertex *recvtx=d->RemoveDaughtersFromPrimaryVtx(aod);
1544  if(!recvtx){
1545  AliDebug(2,"Removal of daughter tracks failed");
1546  return kFALSE;
1547  }
1548 
1549 
1550  //set recalculed primary vertex
1551  d->SetOwnPrimaryVtx(recvtx);
1552  delete recvtx;
1553 
1554  return kTRUE;
1555 }
1556 //--------------------------------------------------------------------------
1558 {
1559  //
1560  // Recalculate primary vertex without daughters
1561  //
1562 
1563  if(!aod) {
1564  AliError("Can not get MC vertex without AOD event");
1565  return kFALSE;
1566  }
1567 
1568  // load MC header
1569  AliAODMCHeader *mcHeader =
1570  (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1571  if(!mcHeader) {
1572  AliError("Can not get MC vertex without AODMCHeader event");
1573  return kFALSE;
1574  }
1575  Double_t pos[3];
1576  Double_t covmatrix[6]={0.,0.,0.,0.,0.,0.};
1577  mcHeader->GetVertex(pos);
1578  AliAODVertex *recvtx=new AliAODVertex(pos,covmatrix);
1579 
1580  if(!recvtx){
1581  AliDebug(2,"Removal of daughter tracks failed");
1582  return kFALSE;
1583  }
1584 
1585  //set recalculed primary vertex
1586  d->SetOwnPrimaryVtx(recvtx);
1587 
1588  d->RecalculateImpPars(recvtx,aod);
1589 
1590  delete recvtx;
1591 
1592  return kTRUE;
1593 }
1594 //--------------------------------------------------------------------------
1596  AliAODEvent *aod,
1597  AliAODVertex *origownvtx) const
1598 {
1599  //
1600  // Clean-up own primary vertex if needed
1601  //
1602 
1604  d->UnsetOwnPrimaryVtx();
1605  if(origownvtx) {
1606  d->SetOwnPrimaryVtx(origownvtx);
1607  delete origownvtx; origownvtx=NULL;
1608  }
1609  d->RecalculateImpPars(d->GetPrimaryVtx(),aod);
1610  } else {
1611  if(origownvtx) {
1612  delete origownvtx; origownvtx=NULL;
1613  }
1614  }
1615  return;
1616 }
1617 //--------------------------------------------------------------------------
1618 Bool_t AliRDHFCuts::IsSignalMC(AliAODRecoDecay *d,AliAODEvent *aod,Int_t pdg) const
1619 {
1620  //
1621  // Checks if this candidate is matched to MC signal
1622  //
1623 
1624  if(!aod) return kFALSE;
1625 
1626  // get the MC array
1627  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)aod)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
1628 
1629  if(!mcArray) return kFALSE;
1630 
1631  // try to match
1632  Int_t label = d->MatchToMC(pdg,mcArray);
1633 
1634  if(label>=0) {
1635  //printf("MATCH!\n");
1636  return kTRUE;
1637  }
1638 
1639  return kFALSE;
1640 }
1641 
1642 
1643 //--------------------------------------------------------------------------
1645  // recompute event primary vertex from AOD tracks
1646 
1647  AliVertexerTracks *vertexer = new AliVertexerTracks(event->GetMagneticField());
1648  vertexer->SetITSMode();
1649  vertexer->SetMinClusters(3);
1650 
1651  AliAODVertex* pvtx=event->GetPrimaryVertex();
1652  if(strstr(pvtx->GetTitle(),"VertexerTracksWithConstraint")) {
1653  Float_t diamondcovxy[3];
1654  event->GetDiamondCovXY(diamondcovxy);
1655  Double_t pos[3]={event->GetDiamondX(),event->GetDiamondY(),0.};
1656  Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.};
1657  AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
1658  vertexer->SetVtxStart(diamond);
1659  delete diamond; diamond=NULL;
1660  }
1661 
1662  AliESDVertex* vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(event);
1663  if(!vertexESD) return kFALSE;
1664  if(vertexESD->GetNContributors()<=0) {
1665  //AliDebug(2,"vertexing failed");
1666  delete vertexESD; vertexESD=NULL;
1667  return kFALSE;
1668  }
1669  delete vertexer; vertexer=NULL;
1670 
1671  // convert to AliAODVertex
1672  Double_t pos[3],cov[6],chi2perNDF;
1673  vertexESD->GetXYZ(pos); // position
1674  vertexESD->GetCovMatrix(cov); //covariance matrix
1675  chi2perNDF = vertexESD->GetChi2toNDF();
1676  delete vertexESD; vertexESD=NULL;
1677 
1678  pvtx->SetPosition(pos[0],pos[1],pos[2]);
1679  pvtx->SetChi2perNDF(chi2perNDF);
1680  pvtx->SetCovMatrix(cov);
1681 
1682  return kTRUE;
1683 }
void SetNPtBins(Int_t nptBins)
Definition: AliRDHFCuts.h:369
Int_t fIsSelectedCuts
fix the daughter track references
Definition: AliRDHFCuts.h:416
Int_t pdg
Bool_t IsEventSelectedForCentrFlattening(Float_t centvalue)
Float_t fMinDzPileup
min. n. of tracklets in pileup vertex
Definition: AliRDHFCuts.h:407
Double_t fMaxPtCandTrackSPDFirst
flag to select the track kFirst criteria for pt < ptlimit
Definition: AliRDHFCuts.h:423
Int_t fWhyRejection
PID for heavy flavours manager.
Definition: AliRDHFCuts.h:400
double Double_t
Definition: External.C:58
Int_t fCutOnzVertexSPD
flag to apply cut on tracklets vs. centrality for 2011 data
Definition: AliRDHFCuts.h:428
void SetupPID(AliVEvent *event)
Bool_t IsSignalMC(AliAODRecoDecay *d, AliAODEvent *aod, Int_t pdg) const
const char * title
Definition: MakeQAPdf.C:26
Double_t fCutGeoNcrNclFractionNcr
3rd parameter of GeoNcrNcl cut
Definition: AliRDHFCuts.h:441
Bool_t fUseMCVertex
flag to switch on the removal of duaghters from the primary vertex computation
Definition: AliRDHFCuts.h:403
Bool_t fUseOnlyOneTrigger
trigger mask
Definition: AliRDHFCuts.h:382
Int_t IsEventSelectedInCentrality(AliVEvent *event)
Bool_t * fIsUpperCut
Definition: AliRDHFCuts.h:396
Bool_t SetMCPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod) const
Bool_t fRemoveDaughtersFromPrimary
Definition: AliRDHFCuts.h:402
void SetHistoForCentralityFlattening(TH1F *h, Double_t minCentr, Double_t maxCentr, Double_t centrRef=0., Int_t switchTRand=0)
Bool_t GetUseCombined()
Definition: AliAODPidHF.h:165
void SetUseCentrality(Int_t flag=1)
Float_t * fPtBinLimits
"number of limits", that is fnPtBins+1
Definition: AliRDHFCuts.h:389
Int_t fMinVtxContr
0: not cut; 1: SPDZ; 2: SPD3D; 3: Tracks
Definition: AliRDHFCuts.h:377
centrality
char Char_t
Definition: External.C:18
static Int_t CheckMatchingAODdeltaAODevents()
Float_t fMaxVtxRedChi2
minimum vertex contributors
Definition: AliRDHFCuts.h:378
void SetMClowenpp2011(Bool_t mc)
Definition: AliAODPidHF.h:102
const Float_t * GetCuts() const
Definition: AliRDHFCuts.h:238
void SetMinCrossedRowsTPCPtDep(const char *rows="")
Float_t fCutRatioClsOverCrossRowsTPC
histogram with reference centrality distribution for centrality distribution flattening ...
Definition: AliRDHFCuts.h:433
Double_t fDeadZoneWidth
flag for enabling/disabling geometrical cut on TPC track
Definition: AliRDHFCuts.h:438
Int_t fMinVtxType
cuts on the event
Definition: AliRDHFCuts.h:376
void SetppLowEn2011(Bool_t opt)
Definition: AliAODPidHF.h:104
Double_t fMaxRapidityCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:420
Double_t fCutGeoNcrNclFractionNcl
4th parameter of GeoNcrNcl cut
Definition: AliRDHFCuts.h:442
void SetGlobalIndex()
Definition: AliRDHFCuts.h:196
AliRDHFCuts & operator=(const AliRDHFCuts &source)
Float_t GetCutValue(Int_t iVar, Int_t iPtBin) const
Int_t fUseCentrality
min deltaz between main and pileup vertices
Definition: AliRDHFCuts.h:408
Bool_t fUsePID
Definition: AliRDHFCuts.h:397
TRandom * gRandom
void PrintAll() const
void SetPidHF(AliAODPidHF *pidObj)
see enum below
Definition: AliRDHFCuts.h:210
Bool_t GetOldPid()
Definition: AliAODPidHF.h:157
TList * GetList(const TDirectory *d, const char *what)
Definition: ExtractData.C:172
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:231
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:427
AliRDHFCuts(const Char_t *name="RDHFCuts", const Char_t *title="")
Definition: AliRDHFCuts.cxx:63
ULong64_t fTriggerMask
SPD multiplicity.
Definition: AliRDHFCuts.h:381
Bool_t fUseCutGeoNcrNcl
pT-dep cut in TPC minimum n crossed rows
Definition: AliRDHFCuts.h:437
int Int_t
Definition: External.C:63
Bool_t fUseTrackSelectionWithFilterBits
flag to reject kink daughters
Definition: AliRDHFCuts.h:430
void SetCuts(Int_t nVars, Int_t nPtBins, Float_t **cutsRD)
Int_t fnVarsForOpt
Definition: AliRDHFCuts.h:392
Double_t fCutGeoNcrNclLength
1st parameter of GeoNcrNcl cut
Definition: AliRDHFCuts.h:439
float Float_t
Definition: External.C:68
virtual ~AliRDHFCuts()
void SetPbPb(Bool_t pbpb)
Definition: AliAODPidHF.h:105
TString * fVarNames
number of cut vars for candidates
Definition: AliRDHFCuts.h:391
Double_t fMaxPtCand
minimum pt of the candidate
Definition: AliRDHFCuts.h:419
AliESDtrackCuts * fTrackCuts
quality cuts on the daughter tracks
Definition: AliRDHFCuts.h:385
void MakeTable() const
Bool_t fFixRefs
maximum centrality for selected events
Definition: AliRDHFCuts.h:415
Bool_t fKeepSignalMC
max rapidity of candidate (if !=-999 overrides IsInFiducialAcceptance)
Definition: AliRDHFCuts.h:421
Int_t fOptPileup
use Physics selection criteria
Definition: AliRDHFCuts.h:405
AliESDtrackCuts * GetTrackCuts() const
Definition: AliRDHFCuts.h:246
void PrintTrigger() const
Float_t fMaxVtxZ
maximum chi2/ndf
Definition: AliRDHFCuts.h:379
Float_t GetCentrality(AliAODEvent *aodEvent)
Definition: AliRDHFCuts.h:242
Int_t fIsSelectedPID
outcome of cuts selection
Definition: AliRDHFCuts.h:417
Float_t fMinCentrality
Definition: AliRDHFCuts.h:413
AliAODVertex * RemoveDaughtersFromPrimaryVtx(AliAODEvent *aod)
void SetUpCombinedPID()
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
UInt_t fEvRejectionBits
used to code the step at which candidate was rejected
Definition: AliRDHFCuts.h:401
Double_t fMaxDiffTRKV0Centr
flag to apply cut on tracks crossing SPD misaligned modules for PP2012 data
Definition: AliRDHFCuts.h:426
Float_t GetCentralityOldFramework(AliAODEvent *aodEvent, AliRDHFCuts::ECentrality estimator)
Int_t fnPtBinLimits
number of pt bins for cuts
Definition: AliRDHFCuts.h:388
Float_t * fCutsRD
fnVars*fnPtBins
Definition: AliRDHFCuts.h:395
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)
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
Bool_t fUseCentrFlatteningInMC
flag to enable/disable the check on filter bits
Definition: AliRDHFCuts.h:431
void SetVarsForOpt(Int_t nVars, Bool_t *forOpt)
void SetVarNames(Int_t nVars, TString *varNames, Bool_t *isUpperCut)
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:393
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:425
Bool_t IsEventSelected(AliVEvent *event)
Int_t fMinSPDMultiplicity
maximum |z| of primary vertex
Definition: AliRDHFCuts.h:380
void SetMC(Bool_t mc)
Definition: AliAODPidHF.h:101
virtual void PrintAll() const
Bool_t fUseAOD049
enable PID usage (off by default)
Definition: AliRDHFCuts.h:398
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Bool_t fApplySPDDeadPbPb2011
maximum pt of the candidate for which to check if the daughters fulfill kFirst criteria ...
Definition: AliRDHFCuts.h:424
void CleanOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod, AliAODVertex *origownvtx) const
Bool_t fIsCandTrackSPDFirst
IsSelected returns always kTRUE for MC signal.
Definition: AliRDHFCuts.h:422
TH1F * fHistCentrDistr
flag for enabling/diabling centrality flattening in MC
Definition: AliRDHFCuts.h:432
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:429
Int_t fMinContrPileup
option for pielup selection
Definition: AliRDHFCuts.h:406
Bool_t fUsePhysicsSelection
use MC primary vertex
Definition: AliRDHFCuts.h:404
TFormula * f1CutMinNCrossedRowsTPCPtDep
pT-dep cut in TPC minimum n crossed rows
Definition: AliRDHFCuts.h:436
AliAODVertex * GetPrimaryVtx() const
void AddTrackCuts(const AliESDtrackCuts *cuts)
Definition: AliRDHFCuts.h:202
TString fTriggerClass[2]
flag to select one trigger only
Definition: AliRDHFCuts.h:383
bool Bool_t
Definition: External.C:53
Int_t fnPtBins
cuts on the candidate
Definition: AliRDHFCuts.h:387
Double_t fCutGeoNcrNclGeom1Pt
2nd parameter of GeoNcrNcl cut
Definition: AliRDHFCuts.h:440
AliAODPidHF * fPidHF
enable AOD049 centrality cleanup
Definition: AliRDHFCuts.h:399
Float_t fCutRatioSignalNOverCrossRowsTPC
min. value ratio NTPCClusters/NTPCCrossedRows, cut if !=0
Definition: AliRDHFCuts.h:434
Int_t fGlobalIndex
Definition: AliRDHFCuts.h:394
Bool_t RecalcOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod) const
Int_t PtBin(Double_t pt) const
Int_t GetGlobalIndex(Int_t iVar, Int_t iPtBin) const
TString fCutMinCrossedRowsTPCPtDep
min. value ratio TPCPointsUsedForPID/NTPCCrossedRows, cut if !=0
Definition: AliRDHFCuts.h:435
const Int_t nPtBins
Double_t fMinPtCand
outcome of PID selection
Definition: AliRDHFCuts.h:418
Bool_t IsDaughterSelected(AliAODTrack *track, const AliESDVertex *primary, AliESDtrackCuts *cuts, const AliAODEvent *aod=0x0) const
void SetOnePad(Bool_t onepad)
Definition: AliAODPidHF.h:103
Float_t fMaxCentrality
minimum centrality for selected events
Definition: AliRDHFCuts.h:414
void SetPidResponse(AliPIDResponse *pidResp)
Definition: AliAODPidHF.h:111
Bool_t RecomputePrimaryVertex(AliAODEvent *event) const
Int_t fnVars
Definition: AliRDHFCuts.h:390