AliPhysics  32b88a8 (32b88a8)
 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  // an event is rejected if
690  // - the AOD trees in AliAOD.root and AliAOD.VertexingHF.root have different number of entries
691  // - the titles of the TProcessID objects do not match
692  AliAODHandler* aodHandler = (AliAODHandler*)((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
693  TTree *treeAOD = aodHandler->GetTree();
694  TTree *treeDeltaAOD = treeAOD->GetFriend("aodTree");
695  if(treeDeltaAOD && treeAOD){
696  if(treeAOD->GetEntries()!=treeDeltaAOD->GetEntries()){
697  printf("AliRDHFCuts::CheckMatchingAODdeltaAODevents: Difference in number of entries in main and friend tree, skipping event\n");
698  return kFALSE;
699  }
700  TFile *mfile = treeAOD->GetCurrentFile();
701  TFile *dfile = treeDeltaAOD->GetCurrentFile();
702  TList* lm=mfile->GetListOfKeys();
703  TList* ld=dfile->GetListOfKeys();
704  Int_t nentm=lm->GetEntries();
705  Int_t nentd=ld->GetEntries();
706  for(Int_t jm=0; jm<nentm; jm++){
707  TKey* o=(TKey*)lm->At(jm);
708  TString clnam=o->GetClassName();
709  if(clnam=="TProcessID"){
710  TString pname=o->GetName();
711  TString ptit=o->GetTitle();
712  if(pname.Contains("ProcessID")){
713  TObject* od=(TObject*)ld->FindObject(pname.Data());
714  if(od){
715  TString ptit2=od->GetTitle();
716  if(ptit2!=ptit){
717  printf("AliRDHFCuts::CheckMatchingAODdeltaAODevents: mismatch in %s: AOD: %s -- deltaAOD: %s\n",pname.Data(),ptit.Data(),ptit2.Data());
718  return kFALSE;
719  }
720  }
721  }
722  }
723  }
724  }
725  return kTRUE;
726 }
727 //---------------------------------------------------------------------------
729  //
730  // Check the correctness of the string syntax
731  //
732  Bool_t retval=kTRUE;
733 
734  if(!rows.Contains("pt")) {
735  if(print) AliError("string must contain \"pt\"");
736  retval= kFALSE;
737  }
738  return retval;
739 }
740 //---------------------------------------------------------------------------
742  //
743  //Create the TFormula from TString for TPC crossed rows pT dependent cut
744  //
745 
746 
747  // setting data member that describes the TPC crossed rows pT dependent cut
749 
750  // creating TFormula from TString
753  // resetting TFormula
755  }
756  if(!CheckPtDepCrossedRows(rows,kTRUE))return;
757 
758  TString tmp(rows);
759  tmp.ReplaceAll("pt","x");
760  f1CutMinNCrossedRowsTPCPtDep = new TFormula("f1CutMinNCrossedRowsTPCPtDep",tmp.Data());
761 
762 
763 }
764 //---------------------------------------------------------------------------
765 Bool_t AliRDHFCuts::IsDaughterSelected(AliAODTrack *track,const AliESDVertex *primary,AliESDtrackCuts *cuts, const AliAODEvent* aod) const{
766  //
767  // Convert to ESDtrack, relate to vertex and check cuts
768  //
769  if(!cuts) return kTRUE;
770 
771  if(cuts->GetFlagCutTOFdistance()) cuts->SetFlagCutTOFdistance(kFALSE);
772 
773 
774  // convert to ESD track here
775  AliESDtrack esdTrack(track);
776  // set the TPC cluster info
777  esdTrack.SetTPCClusterMap(track->GetTPCClusterMap());
778  esdTrack.SetTPCSharedMap(track->GetTPCSharedMap());
779  esdTrack.SetTPCPointsF(track->GetTPCNclsF());
780  // needed to calculate the impact parameters
781  esdTrack.RelateToVertex(primary,0.,3.);
782 
783  //applying ESDtrackCut
784  if(!cuts->IsSelected(&esdTrack)) return kFALSE;
785 
786  //appliyng kink rejection
787  if(fKinkReject){
788  AliAODVertex *maybeKink=track->GetProdVertex();
789  if(maybeKink->GetType()==AliAODVertex::kKink) return kFALSE;
790  }
791 
792  //appliyng TPC crossed rows pT dependent cut
794  Float_t nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
795  if(nCrossedRowsTPC<f1CutMinNCrossedRowsTPCPtDep->Eval(esdTrack.Pt())) return kFALSE;
796  }
797 
798  //appliyng NTPCcls/NTPCcrossedRows cut
800  Float_t nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
801  Float_t nClustersTPC = esdTrack.GetTPCNcls();
802  if(nCrossedRowsTPC!=0){
803  Float_t ratio = nClustersTPC/nCrossedRowsTPC;
804  if(ratio<fCutRatioClsOverCrossRowsTPC) return kFALSE;
805  }
806  else return kFALSE;
807  }
808 
809  //appliyng TPCsignalN/NTPCcrossedRows cut
811  Float_t nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
812  Float_t nTPCsignal = esdTrack.GetTPCsignalN();
813  if(nCrossedRowsTPC!=0){
814  Float_t ratio = nTPCsignal/nCrossedRowsTPC;
815  if(ratio<fCutRatioSignalNOverCrossRowsTPC) return kFALSE;
816  }
817  else return kFALSE;
818  }
819 
820  // geometrical cut (note uses track at vertex instead of at TPC inner wall)
821  if(fUseCutGeoNcrNcl && aod){
822  Float_t nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
823  Float_t lengthInActiveZoneTPC=esdTrack.GetLengthInActiveZone(0,fDeadZoneWidth,220.,aod->GetMagneticField());
824  Double_t cutGeoNcrNclLength=fCutGeoNcrNclLength-TMath::Power(TMath::Abs(esdTrack.GetSigned1Pt()),fCutGeoNcrNclGeom1Pt);
825  Bool_t isOK=kTRUE;
826  if (lengthInActiveZoneTPC<cutGeoNcrNclLength) isOK=kFALSE;
827  if (nCrossedRowsTPC<fCutGeoNcrNclFractionNcr*cutGeoNcrNclLength) isOK=kFALSE;
828  if (esdTrack.GetTPCncls()<fCutGeoNcrNclFractionNcl*cutGeoNcrNclLength) isOK=kFALSE;
829  if(!isOK) return kFALSE;
830  }
831 
832 
834  // to be implemented
835  // we need either to have here the AOD Event,
836  // or to have the pileup vertex object
837  }
838 
840  Bool_t deadSPDLay1PbPb2011[20][4]={
841  {kTRUE,kTRUE,kTRUE,kTRUE},
842  {kTRUE,kTRUE,kTRUE,kTRUE},
843  {kTRUE,kTRUE,kTRUE,kTRUE},
844  {kTRUE,kTRUE,kTRUE,kTRUE},
845  {kTRUE,kTRUE,kTRUE,kTRUE},
846  {kFALSE,kFALSE,kTRUE,kTRUE},
847  {kTRUE,kTRUE,kFALSE,kFALSE},
848  {kTRUE,kTRUE,kTRUE,kTRUE},
849  {kFALSE,kFALSE,kTRUE,kTRUE},
850  {kTRUE,kTRUE,kTRUE,kTRUE},
851  {kTRUE,kTRUE,kFALSE,kFALSE},
852  {kTRUE,kTRUE,kTRUE,kTRUE},
853  {kFALSE,kFALSE,kFALSE,kFALSE},
854  {kFALSE,kFALSE,kTRUE,kTRUE},
855  {kFALSE,kFALSE,kFALSE,kFALSE},
856  {kFALSE,kFALSE,kFALSE,kFALSE},
857  {kTRUE,kTRUE,kTRUE,kTRUE},
858  {kTRUE,kTRUE,kFALSE,kFALSE},
859  {kFALSE,kFALSE,kFALSE,kFALSE},
860  {kFALSE,kFALSE,kFALSE,kFALSE}
861  };
862  Bool_t deadSPDLay2PbPb2011[40][4]={
863  {kTRUE,kTRUE,kTRUE,kTRUE},
864  {kTRUE,kTRUE,kTRUE,kTRUE},
865  {kTRUE,kTRUE,kTRUE,kTRUE},
866  {kTRUE,kTRUE,kTRUE,kTRUE},
867  {kTRUE,kTRUE,kTRUE,kTRUE},
868  {kTRUE,kTRUE,kTRUE,kTRUE},
869  {kTRUE,kTRUE,kTRUE,kTRUE},
870  {kTRUE,kTRUE,kTRUE,kTRUE},
871  {kTRUE,kTRUE,kTRUE,kTRUE},
872  {kTRUE,kTRUE,kTRUE,kTRUE},
873  {kTRUE,kTRUE,kTRUE,kTRUE},
874  {kTRUE,kTRUE,kTRUE,kTRUE},
875  {kFALSE,kFALSE,kFALSE,kFALSE},
876  {kFALSE,kFALSE,kTRUE,kTRUE},
877  {kTRUE,kTRUE,kTRUE,kTRUE},
878  {kTRUE,kTRUE,kTRUE,kTRUE},
879  {kTRUE,kTRUE,kFALSE,kFALSE},
880  {kTRUE,kTRUE,kTRUE,kTRUE},
881  {kTRUE,kTRUE,kTRUE,kTRUE},
882  {kTRUE,kTRUE,kTRUE,kTRUE},
883  {kFALSE,kFALSE,kFALSE,kFALSE},
884  {kFALSE,kFALSE,kFALSE,kFALSE},
885  {kTRUE,kTRUE,kTRUE,kTRUE},
886  {kTRUE,kTRUE,kTRUE,kTRUE},
887  {kFALSE,kFALSE,kFALSE,kFALSE},
888  {kFALSE,kFALSE,kFALSE,kFALSE},
889  {kTRUE,kTRUE,kTRUE,kTRUE},
890  {kTRUE,kTRUE,kTRUE,kTRUE},
891  {kFALSE,kFALSE,kFALSE,kFALSE},
892  {kFALSE,kFALSE,kFALSE,kFALSE},
893  {kFALSE,kFALSE,kFALSE,kFALSE},
894  {kFALSE,kFALSE,kFALSE,kFALSE},
895  {kTRUE,kTRUE,kTRUE,kTRUE},
896  {kTRUE,kTRUE,kTRUE,kTRUE},
897  {kTRUE,kTRUE,kFALSE,kFALSE},
898  {kTRUE,kTRUE,kTRUE,kTRUE},
899  {kFALSE,kFALSE,kFALSE,kFALSE},
900  {kFALSE,kFALSE,kFALSE,kFALSE},
901  {kFALSE,kFALSE,kFALSE,kFALSE},
902  {kFALSE,kFALSE,kFALSE,kFALSE}
903  };
904  Double_t xyz1[3],xyz2[3];
905  esdTrack.GetXYZAt(3.9,0.,xyz1);
906  esdTrack.GetXYZAt(7.6,0.,xyz2);
907  Double_t phi1=TMath::ATan2(xyz1[1],xyz1[0]);
908  if(phi1<0) phi1+=2*TMath::Pi();
909  Int_t lad1=(Int_t)(phi1/(2.*TMath::Pi()/20.));
910  Double_t phi2=TMath::ATan2(xyz2[1],xyz2[0]);
911  if(phi2<0) phi2+=2*TMath::Pi();
912  Int_t lad2=(Int_t)(phi2/(2.*TMath::Pi()/40.));
913  Int_t mod1=(Int_t)((xyz1[2]+14)/7.);
914  Int_t mod2=(Int_t)((xyz2[2]+14)/7.);
915  Bool_t lay1ok=kFALSE;
916  if(mod1>=0 && mod1<4 && lad1<20){
917  lay1ok=deadSPDLay1PbPb2011[lad1][mod1];
918  }
919  Bool_t lay2ok=kFALSE;
920  if(mod2>=0 && mod2<4 && lad2<40){
921  lay2ok=deadSPDLay2PbPb2011[lad2][mod2];
922  }
923  if(!lay1ok && !lay2ok) return kFALSE;
924  }
925 
927  // Cut tracks crossing the SPD at 5.6<phi<2pi
928  Double_t xyz1[3],xyz2[3];
929  esdTrack.GetXYZAt(3.9,0.,xyz1);
930  esdTrack.GetXYZAt(7.6,0.,xyz2);
931  Double_t phi1=TMath::ATan2(xyz1[1],xyz1[0]);
932  if(phi1<0) phi1+=2*TMath::Pi();
933  Double_t phi2=TMath::ATan2(xyz2[1],xyz2[0]);
934  if(phi2<0) phi2+=2*TMath::Pi();
935  Bool_t lay1ok=kTRUE;
936  if(phi1>5.6 && phi1<2.*TMath::Pi()) lay1ok=kFALSE;
937  Bool_t lay2ok=kTRUE;
938  if(phi2>5.6 && phi2<2.*TMath::Pi()) lay2ok=kFALSE;
939  if(!lay1ok || !lay2ok) return kFALSE;
940  }
941 
942  return kTRUE;
943 }
944 //---------------------------------------------------------------------------
945 void AliRDHFCuts::SetPtBins(Int_t nPtBinLimits,Float_t *ptBinLimits) {
946  // Set the pt bins
947 
948  if(fPtBinLimits) {
949  delete [] fPtBinLimits;
950  fPtBinLimits = NULL;
951  printf("Changing the pt bins\n");
952  }
953 
954  if(nPtBinLimits != fnPtBins+1){
955  cout<<"Warning: ptBinLimits dimention "<<nPtBinLimits<<" != nPtBins+1 ("<<fnPtBins+1<<")\nSetting nPtBins to "<<nPtBinLimits-1<<endl;
956  SetNPtBins(nPtBinLimits-1);
957  }
958 
959  fnPtBinLimits = nPtBinLimits;
960  SetGlobalIndex();
961  //cout<<"Changing also Global Index -> "<<fGlobalIndex<<endl;
963  for(Int_t ib=0; ib<nPtBinLimits; ib++) fPtBinLimits[ib]=ptBinLimits[ib];
964 
965  return;
966 }
967 //---------------------------------------------------------------------------
968 void AliRDHFCuts::SetVarNames(Int_t nVars,TString *varNames,Bool_t *isUpperCut){
969  // Set the variable names
970 
971  if(fVarNames) {
972  delete [] fVarNames;
973  fVarNames = NULL;
974  //printf("Changing the variable names\n");
975  }
976  if(nVars!=fnVars){
977  printf("Wrong number of variables: it has to be %d\n",fnVars);
978  return;
979  }
980  //fnVars=nVars;
981  fVarNames = new TString[nVars];
982  fIsUpperCut = new Bool_t[nVars];
983  for(Int_t iv=0; iv<nVars; iv++) {
984  fVarNames[iv] = varNames[iv];
985  fIsUpperCut[iv] = isUpperCut[iv];
986  }
987 
988  return;
989 }
990 //---------------------------------------------------------------------------
992  // Set the variables to be used for cuts optimization
993 
994  if(fVarsForOpt) {
995  delete [] fVarsForOpt;
996  fVarsForOpt = NULL;
997  //printf("Changing the variables for cut optimization\n");
998  }
999 
1000  if(nVars==0){
1001  printf("%d not accepted as number of variables: it has to be %d\n",nVars,fnVars);
1002  return;
1003  }
1004 
1005  fnVarsForOpt = 0;
1006  fVarsForOpt = new Bool_t[fnVars];
1007  for(Int_t iv=0; iv<fnVars; iv++) {
1008  fVarsForOpt[iv]=forOpt[iv];
1009  if(fVarsForOpt[iv]) fnVarsForOpt++;
1010  }
1011 
1012  return;
1013 }
1014 
1015 //---------------------------------------------------------------------------
1017  //
1018  // set centrality estimator
1019  //
1020  fUseCentrality=flag;
1021  if(fUseCentrality<kCentOff||fUseCentrality>=kCentInvalid) AliWarning("Centrality estimator not valid");
1022 
1023  return;
1024 }
1025 
1026 
1027 //---------------------------------------------------------------------------
1029  //
1030  // store the cuts
1031  //
1032  if(nVars!=fnVars) {
1033  printf("Wrong number of variables: it has to be %d\n",fnVars);
1034  AliFatal("exiting");
1035  }
1036  if(nPtBins!=fnPtBins) {
1037  printf("Wrong number of pt bins: it has to be %d\n",fnPtBins);
1038  AliFatal("exiting");
1039  }
1040 
1041  if(!fCutsRD) fCutsRD = new Float_t[fGlobalIndex];
1042 
1043 
1044  for(Int_t iv=0; iv<fnVars; iv++) {
1045 
1046  for(Int_t ib=0; ib<fnPtBins; ib++) {
1047 
1048  //check
1049  if(GetGlobalIndex(iv,ib)>=fGlobalIndex) {
1050  cout<<"Overflow, exit..."<<endl;
1051  return;
1052  }
1053 
1054  fCutsRD[GetGlobalIndex(iv,ib)] = cutsRD[iv][ib];
1055 
1056  }
1057  }
1058  return;
1059 }
1060 //---------------------------------------------------------------------------
1061 void AliRDHFCuts::SetCuts(Int_t glIndex,Float_t* cutsRDGlob){
1062  //
1063  // store the cuts
1064  //
1065  if(glIndex != fGlobalIndex){
1066  cout<<"Wrong array size: it has to be "<<fGlobalIndex<<endl;
1067  AliFatal("exiting");
1068  }
1069  if(!fCutsRD) fCutsRD = new Float_t[fGlobalIndex];
1070 
1071  for(Int_t iGl=0;iGl<fGlobalIndex;iGl++){
1072  fCutsRD[iGl] = cutsRDGlob[iGl];
1073  }
1074  return;
1075 }
1076 //---------------------------------------------------------------------------
1078  //
1079  // print all cuts values
1080  //
1081 
1082  printf("Minimum vtx type %d\n",fMinVtxType);
1083  printf("Minimum vtx contr %d\n",fMinVtxContr);
1084  printf("Max vtx red chi2 %f\n",fMaxVtxRedChi2);
1085  printf("Min SPD mult %d\n",fMinSPDMultiplicity);
1086  printf("Use PID %d OldPid=%d\n",(Int_t)fUsePID,fPidHF ? fPidHF->GetOldPid() : -1);
1087  printf("Remove daughters from vtx %d\n",(Int_t)fRemoveDaughtersFromPrimary);
1088  printf("Physics selection: %s\n",fUsePhysicsSelection ? "Yes" : "No");
1089  printf("Pileup rejection: %s\n",(fOptPileup > 0) ? "Yes" : "No");
1090  if(fOptPileup==1) printf(" -- Reject pileup event");
1091  if(fOptPileup==2) printf(" -- Reject tracks from pileup vtx");
1092  if(fUseCentrality>0) {
1093  TString estimator="";
1094  if(fUseCentrality==1) estimator = "V0";
1095  if(fUseCentrality==2) estimator = "Tracks";
1096  if(fUseCentrality==3) estimator = "Tracklets";
1097  if(fUseCentrality==4) estimator = "SPD clusters outer";
1098  if(fUseCentrality==5) estimator = "ZNA";
1099  if(fUseCentrality==6) estimator = "ZPA";
1100  if(fUseCentrality==7) estimator = "V0A";
1101  printf("Centrality class considered: %.1f-%.1f, estimated with %s\n",fMinCentrality,fMaxCentrality,estimator.Data());
1102  }
1103  if(fIsCandTrackSPDFirst) printf("Check for candidates with pt < %2.2f, that daughters fullfill kFirst criteria\n",fMaxPtCandTrackSPDFirst);
1104 
1105  if(fCutRatioClsOverCrossRowsTPC) printf("N TPC Clusters > %f N TPC Crossed Rows\n", fCutRatioClsOverCrossRowsTPC);
1106  if(fCutRatioSignalNOverCrossRowsTPC) printf("N TPC Points for dE/dx > %f N TPC Crossed Rows\n", fCutRatioSignalNOverCrossRowsTPC);
1107  if(f1CutMinNCrossedRowsTPCPtDep) printf("N TPC Crossed Rows pT-dependent cut: %s\n", fCutMinCrossedRowsTPCPtDep.Data());
1108 
1109  if(fVarNames){
1110  cout<<"Array of variables"<<endl;
1111  for(Int_t iv=0;iv<fnVars;iv++){
1112  cout<<fVarNames[iv]<<"\t";
1113  }
1114  cout<<endl;
1115  }
1116  if(fVarsForOpt){
1117  cout<<"Array of optimization"<<endl;
1118  for(Int_t iv=0;iv<fnVars;iv++){
1119  cout<<fVarsForOpt[iv]<<"\t";
1120  }
1121  cout<<endl;
1122  }
1123  if(fIsUpperCut){
1124  cout<<"Array of upper/lower cut"<<endl;
1125  for(Int_t iv=0;iv<fnVars;iv++){
1126  cout<<fIsUpperCut[iv]<<"\t";
1127  }
1128  cout<<endl;
1129  }
1130  if(fPtBinLimits){
1131  cout<<"Array of ptbin limits"<<endl;
1132  for(Int_t ib=0;ib<fnPtBinLimits;ib++){
1133  cout<<fPtBinLimits[ib]<<"\t";
1134  }
1135  cout<<endl;
1136  }
1137  if(fCutsRD){
1138  cout<<"Matrix of cuts"<<endl;
1139  for(Int_t iv=0;iv<fnVars;iv++){
1140  for(Int_t ib=0;ib<fnPtBins;ib++){
1141  cout<<"fCutsRD["<<iv<<"]["<<ib<<"] = "<<fCutsRD[GetGlobalIndex(iv,ib)]<<"\t";
1142  }
1143  cout<<endl;
1144  }
1145  cout<<endl;
1146  }
1147  if(fPidHF) fPidHF->PrintAll();
1148  return;
1149 }
1150 
1151 //--------------------------------------------------------------------------
1153  // print the trigger selection
1154 
1155  printf("Selected trigger classes: %s %s\n",fTriggerClass[0].Data(),fTriggerClass[1].Data());
1156 
1157  cout<<" Trigger selection pattern: ";
1158  if( fTriggerMask & AliVEvent::kAny ) cout<<" kAny ";
1159  if( fTriggerMask & AliVEvent::kAnyINT ) cout<<" kAnyINT ";
1160  if( fTriggerMask & AliVEvent::kINT7 ) cout<<" kINT7 ";
1161  if( fTriggerMask & AliVEvent::kMB ) cout<<" kMB ";
1162  if( fTriggerMask & AliVEvent::kCINT5 ) cout<<" kCINT5 ";
1163  if( fTriggerMask & AliVEvent::kCentral ) cout<<" kCentral ";
1164  if( fTriggerMask & AliVEvent::kSemiCentral ) cout<<" kSemiCentral ";
1165  if( fTriggerMask & AliVEvent::kEMCEGA ) cout<<" kEMCEGA ";
1166  if( fTriggerMask & AliVEvent::kHighMult ) cout<<" kHighMult ";
1167  if( fTriggerMask & AliVEvent::kFastOnly ) cout<<" kFastOnly ";
1168  cout << endl<< endl;
1169 
1170 }
1171 
1172 //---------------------------------------------------------------------------
1173 void AliRDHFCuts::GetCuts(Float_t**& cutsRD) const{
1174  //
1175  // get the cuts
1176  //
1177 
1178  //cout<<"Give back a "<<fnVars<<"x"<<fnPtBins<<" matrix."<<endl;
1179 
1180 
1181  Int_t iv,ib;
1182  if(!cutsRD) {
1183  //cout<<"Initialization..."<<endl;
1184  cutsRD=new Float_t*[fnVars];
1185  for(iv=0; iv<fnVars; iv++) {
1186  cutsRD[iv] = new Float_t[fnPtBins];
1187  }
1188  }
1189 
1190  for(Int_t iGlobal=0; iGlobal<fGlobalIndex; iGlobal++) {
1191  GetVarPtIndex(iGlobal,iv,ib);
1192  cutsRD[iv][ib] = fCutsRD[iGlobal];
1193  }
1194 
1195  return;
1196 }
1197 
1198 //---------------------------------------------------------------------------
1200  //
1201  // give the global index from variable and pt bin
1202  //
1203  return iPtBin*fnVars+iVar;
1204 }
1205 
1206 //---------------------------------------------------------------------------
1207 void AliRDHFCuts::GetVarPtIndex(Int_t iGlob, Int_t& iVar, Int_t& iPtBin) const {
1208  //
1209  //give the index of the variable and of the pt bin from the global index
1210  //
1211  iPtBin=(Int_t)iGlob/fnVars;
1212  iVar=iGlob%fnVars;
1213 
1214  return;
1215 }
1216 
1217 //---------------------------------------------------------------------------
1219  //
1220  //give the pt bin where the pt lies.
1221  //
1222  Int_t ptbin=-1;
1223  if(pt<fPtBinLimits[0])return ptbin;
1224  for (Int_t i=0;i<fnPtBins;i++){
1225  if(pt<fPtBinLimits[i+1]) {
1226  ptbin=i;
1227  break;
1228  }
1229  }
1230  return ptbin;
1231 }
1232 //-------------------------------------------------------------------
1234  //
1235  // Give the value of cut set for the variable iVar and the pt bin iPtBin
1236  //
1237  if(!fCutsRD){
1238  cout<<"Cuts not iniziaisez yet"<<endl;
1239  return 0;
1240  }
1241  return fCutsRD[GetGlobalIndex(iVar,iPtBin)];
1242 }
1243 
1244 //-------------------------------------------------------------------
1246 
1247  if(aodEvent->GetRunNumber()<244824)return GetCentralityOldFramework(aodEvent,estimator);
1248  Double_t cent=-999;
1249  AliMultSelection *multSelection = (AliMultSelection * ) aodEvent->FindListObject("MultSelection");
1250  if(!multSelection){
1251  AliWarning("AliMultSelection could not be found in the aod event list of objects");
1252  return cent;
1253  }
1254  if(estimator==kCentV0M){
1255  cent=multSelection->GetMultiplicityPercentile("V0M");
1256  Int_t qual = multSelection->GetEvSelCode();
1257  if(qual == 199 ) cent=-999;
1258  return cent;
1259  }
1260  else {
1261  AliWarning(Form("CENTRALITY ESTIMATE WITH ESTIMATEOR %d NOT YET IMPLEMENTED FOR NEW FRAMEWORK",(Int_t)estimator));
1262  return cent;
1263  }
1264 
1265 }
1266 //-------------------------------------------------------------------
1268  //
1269  // Get centrality percentile
1270  //
1271 
1272  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)aodEvent)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
1273  if(mcArray) {fUseAOD049=kFALSE;}
1274 
1275  AliAODHeader *header=dynamic_cast<AliAODHeader*>(aodEvent->GetHeader());
1276  if(!header) AliFatal("Not a standard AOD");
1277  AliCentrality *centrality=header->GetCentralityP();
1278  Float_t cent=-999.;
1279  Bool_t isSelRun=kFALSE;
1280  Int_t selRun[5]={138364, 138826, 138828, 138836, 138871};
1281  if(!centrality) return cent;
1282  else{
1283  if (estimator==kCentV0M){
1284  cent=(Float_t)(centrality->GetCentralityPercentile("V0M"));
1285  if(cent<0){
1286  Int_t quality = centrality->GetQuality();
1287  if(quality<=1){ // fQuality==1 means rejected by zVertex cut that we apply a part and we want to keep separate (Giacomo)
1288  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0M");
1289  }else{
1290  Int_t runnum=aodEvent->GetRunNumber();
1291  for(Int_t ir=0;ir<5;ir++){
1292  if(runnum==selRun[ir]){
1293  isSelRun=kTRUE;
1294  break;
1295  }
1296  }
1297  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0M");
1298  }
1299  }
1300 
1301  //temporary fix for AOD049 outliers
1302  if(fUseAOD049&&cent>=0){
1303  Float_t v0=0;
1304  AliAODVZERO* aodV0 = aodEvent->GetVZEROData();
1305  v0+=aodV0->GetMTotV0A();
1306  v0+=aodV0->GetMTotV0C();
1307  if(cent==0&&v0<19500)return -1;//filtering issue
1308  Float_t tkl = (Float_t)(aodEvent->GetTracklets()->GetNumberOfTracklets());
1309  Float_t val= 1.30552 + 0.147931 * v0;
1310  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};
1311  if ( TMath::Abs(tkl-val) > 6.*tklSigma[(Int_t)cent] )return -1;//outlier
1312  }
1313  }
1314  else {
1315  if (estimator==kCentTRK) {
1316  cent=(Float_t)(centrality->GetCentralityPercentile("TRK"));
1317  if(cent<0){
1318  Int_t quality = centrality->GetQuality();
1319  if(quality<=1){
1320  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TRK");
1321  }else{
1322  Int_t runnum=aodEvent->GetRunNumber();
1323  for(Int_t ir=0;ir<5;ir++){
1324  if(runnum==selRun[ir]){
1325  isSelRun=kTRUE;
1326  break;
1327  }
1328  }
1329  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TRK");
1330  }
1331  }
1332  }
1333  else{
1334  if (estimator==kCentTKL){
1335  cent=(Float_t)(centrality->GetCentralityPercentile("TKL"));
1336  if(cent<0){
1337  Int_t quality = centrality->GetQuality();
1338  if(quality<=1){
1339  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TKL");
1340  }else{
1341  Int_t runnum=aodEvent->GetRunNumber();
1342  for(Int_t ir=0;ir<5;ir++){
1343  if(runnum==selRun[ir]){
1344  isSelRun=kTRUE;
1345  break;
1346  }
1347  }
1348  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("TKL");
1349  }
1350  }
1351  }
1352  else{
1353  if (estimator==kCentCL1){
1354  cent=(Float_t)(centrality->GetCentralityPercentile("CL1"));
1355  if(cent<0){
1356  Int_t quality = centrality->GetQuality();
1357  if(quality<=1){
1358  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("CL1");
1359  }else{
1360  Int_t runnum=aodEvent->GetRunNumber();
1361  for(Int_t ir=0;ir<5;ir++){
1362  if(runnum==selRun[ir]){
1363  isSelRun=kTRUE;
1364  break;
1365  }
1366  }
1367  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("CL1");
1368  }
1369  }
1370  }
1371  else{
1372  if (estimator==kCentZNA){
1373  cent=(Float_t)(centrality->GetCentralityPercentile("ZNA"));
1374  if(cent<0){
1375  Int_t quality = centrality->GetQuality();
1376  if(quality<=1){
1377  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("ZNA");
1378  }else{
1379  Int_t runnum=aodEvent->GetRunNumber();
1380  for(Int_t ir=0;ir<5;ir++){
1381  if(runnum==selRun[ir]){
1382  isSelRun=kTRUE;
1383  break;
1384  }
1385  }
1386  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("ZNA");
1387  }
1388  }
1389  }
1390  else{
1391  if (estimator==kCentZPA){
1392  cent=(Float_t)(centrality->GetCentralityPercentile("ZPA"));
1393  if(cent<0){
1394  Int_t quality = centrality->GetQuality();
1395  if(quality<=1){
1396  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("ZPA");
1397  }else{
1398  Int_t runnum=aodEvent->GetRunNumber();
1399  for(Int_t ir=0;ir<5;ir++){
1400  if(runnum==selRun[ir]){
1401  isSelRun=kTRUE;
1402  break;
1403  }
1404  }
1405  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("ZPA");
1406  }
1407  }
1408  }
1409  else{
1410  if (estimator==kCentV0A){
1411  cent=(Float_t)(centrality->GetCentralityPercentile("V0A"));
1412  if(cent<0){
1413  Int_t quality = centrality->GetQuality();
1414  if(quality<=1){
1415  cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0A");
1416  }else{
1417  Int_t runnum=aodEvent->GetRunNumber();
1418  for(Int_t ir=0;ir<5;ir++){
1419  if(runnum==selRun[ir]){
1420  isSelRun=kTRUE;
1421  break;
1422  }
1423  }
1424  if((quality==8||quality==9)&&isSelRun)cent=(Float_t)centrality->GetCentralityPercentileUnchecked("V0A");
1425  }
1426  }
1427  }
1428  else {
1429  AliWarning("Centrality estimator not valid");
1430 
1431  }
1432  }
1433  }
1434  }
1435  }
1436  }
1437  }
1438  }
1439  return cent;
1440 }
1441 //-------------------------------------------------------------------
1443  //
1444  // Compare two cuts objects
1445  //
1446 
1447  Bool_t areEqual=kTRUE;
1448 
1449  if(fMinVtxType!=obj->fMinVtxType) { printf("Minimum vtx type %d %d\n",fMinVtxType,obj->fMinVtxType); areEqual=kFALSE;}
1450 
1451  if(fMinVtxContr!=obj->fMinVtxContr) { printf("Minimum vtx contr %d %d\n",fMinVtxContr,obj->fMinVtxContr); areEqual=kFALSE;}
1452 
1453  if(TMath::Abs(fMaxVtxRedChi2-obj->fMaxVtxRedChi2)>1.e-10) { printf("Max vtx red chi2 %f %f\n",fMaxVtxRedChi2,obj->fMaxVtxRedChi2);areEqual=kFALSE;}
1454 
1455  if(fMinSPDMultiplicity!=obj->fMinSPDMultiplicity) { printf("Min SPD mult %d\n %d",fMinSPDMultiplicity,obj->fMinSPDMultiplicity);areEqual=kFALSE;}
1456 
1457  if(fUsePID!=obj->fUsePID) { printf("Use PID %d %d\n",(Int_t)fUsePID,(Int_t)obj->fUsePID); areEqual=kFALSE;}
1458 
1459  if(fRemoveDaughtersFromPrimary!=obj->fRemoveDaughtersFromPrimary) {printf("Remove daughters from vtx %d %d\n",(Int_t)fRemoveDaughtersFromPrimary,(Int_t)obj->fRemoveDaughtersFromPrimary); areEqual=kFALSE;}
1460  if(fTrackCuts){
1461  if(fTrackCuts->GetMinNClusterTPC()!=obj->fTrackCuts->GetMinNClusterTPC()) {printf("MinNClsTPC %d %d\n",fTrackCuts->GetMinNClusterTPC(),obj->fTrackCuts->GetMinNClusterTPC()); areEqual=kFALSE;}
1462 
1463  if(fTrackCuts->GetMinNClustersITS()!=obj->fTrackCuts->GetMinNClustersITS()) {printf("MinNClsITS %d %d\n",fTrackCuts->GetMinNClustersITS(),obj->fTrackCuts->GetMinNClustersITS()); areEqual=kFALSE;}
1464 
1465  if(TMath::Abs(fTrackCuts->GetMaxChi2PerClusterTPC()-obj->fTrackCuts->GetMaxChi2PerClusterTPC())>1.e-10) {printf("MaxChi2ClsTPC %f %f\n",fTrackCuts->GetMaxChi2PerClusterTPC(),obj->fTrackCuts->GetMaxChi2PerClusterTPC()); areEqual=kFALSE;}
1466 
1467  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;}
1468  }
1469 
1470  if(fCutsRD) {
1471  for(Int_t iv=0;iv<fnVars;iv++) {
1472  for(Int_t ib=0;ib<fnPtBins;ib++) {
1473  if(TMath::Abs(fCutsRD[GetGlobalIndex(iv,ib)]-obj->fCutsRD[GetGlobalIndex(iv,ib)])>1.e-10) {
1474  cout<<"fCutsRD["<<iv<<"]["<<ib<<"] = "<<fCutsRD[GetGlobalIndex(iv,ib)]<<" "<<obj->fCutsRD[GetGlobalIndex(iv,ib)]<<"\n";
1475  areEqual=kFALSE;
1476  }
1477  }
1478  }
1479  }
1480 
1481  return areEqual;
1482 }
1483 //---------------------------------------------------------------------------
1485  //
1486  // print cuts values in table format
1487  //
1488 
1489  TString ptString = "pT range";
1490  if(fVarNames && fPtBinLimits && fCutsRD){
1491  TString firstLine(Form("* %-15s",ptString.Data()));
1492  for (Int_t ivar=0; ivar<fnVars; ivar++){
1493  firstLine+=Form("* %-15s ",fVarNames[ivar].Data());
1494  if (ivar == fnVars){
1495  firstLine+="*\n";
1496  }
1497  }
1498  Printf("%s",firstLine.Data());
1499 
1500  for (Int_t ipt=0; ipt<fnPtBins; ipt++){
1501  TString line;
1502  if (ipt==fnPtBins-1){
1503  line=Form("* %5.1f < pt < inf ",fPtBinLimits[ipt]);
1504  }
1505  else{
1506  line=Form("* %5.1f < pt < %4.1f ",fPtBinLimits[ipt],fPtBinLimits[ipt+1]);
1507  }
1508  for (Int_t ivar=0; ivar<fnVars; ivar++){
1509  line+=Form("* %-15f ",fCutsRD[GetGlobalIndex(ivar,ipt)]);
1510  }
1511  Printf("%s",line.Data());
1512  }
1513 
1514  }
1515 
1516 
1517  return;
1518 }
1519 //--------------------------------------------------------------------------
1521  AliAODEvent *aod) const
1522 {
1523  //
1524  // Recalculate primary vertex without daughters
1525  //
1526 
1527  if(!aod) {
1528  AliError("Can not remove daughters from vertex without AOD event");
1529  return 0;
1530  }
1531 
1532  AliAODVertex *recvtx=d->RemoveDaughtersFromPrimaryVtx(aod);
1533  if(!recvtx){
1534  AliDebug(2,"Removal of daughter tracks failed");
1535  return kFALSE;
1536  }
1537 
1538 
1539  //set recalculed primary vertex
1540  d->SetOwnPrimaryVtx(recvtx);
1541  delete recvtx;
1542 
1543  return kTRUE;
1544 }
1545 //--------------------------------------------------------------------------
1547 {
1548  //
1549  // Recalculate primary vertex without daughters
1550  //
1551 
1552  if(!aod) {
1553  AliError("Can not get MC vertex without AOD event");
1554  return kFALSE;
1555  }
1556 
1557  // load MC header
1558  AliAODMCHeader *mcHeader =
1559  (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1560  if(!mcHeader) {
1561  AliError("Can not get MC vertex without AODMCHeader event");
1562  return kFALSE;
1563  }
1564  Double_t pos[3];
1565  Double_t covmatrix[6]={0.,0.,0.,0.,0.,0.};
1566  mcHeader->GetVertex(pos);
1567  AliAODVertex *recvtx=new AliAODVertex(pos,covmatrix);
1568 
1569  if(!recvtx){
1570  AliDebug(2,"Removal of daughter tracks failed");
1571  return kFALSE;
1572  }
1573 
1574  //set recalculed primary vertex
1575  d->SetOwnPrimaryVtx(recvtx);
1576 
1577  d->RecalculateImpPars(recvtx,aod);
1578 
1579  delete recvtx;
1580 
1581  return kTRUE;
1582 }
1583 //--------------------------------------------------------------------------
1585  AliAODEvent *aod,
1586  AliAODVertex *origownvtx) const
1587 {
1588  //
1589  // Clean-up own primary vertex if needed
1590  //
1591 
1593  d->UnsetOwnPrimaryVtx();
1594  if(origownvtx) {
1595  d->SetOwnPrimaryVtx(origownvtx);
1596  delete origownvtx; origownvtx=NULL;
1597  }
1598  d->RecalculateImpPars(d->GetPrimaryVtx(),aod);
1599  } else {
1600  if(origownvtx) {
1601  delete origownvtx; origownvtx=NULL;
1602  }
1603  }
1604  return;
1605 }
1606 //--------------------------------------------------------------------------
1607 Bool_t AliRDHFCuts::IsSignalMC(AliAODRecoDecay *d,AliAODEvent *aod,Int_t pdg) const
1608 {
1609  //
1610  // Checks if this candidate is matched to MC signal
1611  //
1612 
1613  if(!aod) return kFALSE;
1614 
1615  // get the MC array
1616  TClonesArray *mcArray = (TClonesArray*)((AliAODEvent*)aod)->GetList()->FindObject(AliAODMCParticle::StdBranchName());
1617 
1618  if(!mcArray) return kFALSE;
1619 
1620  // try to match
1621  Int_t label = d->MatchToMC(pdg,mcArray);
1622 
1623  if(label>=0) {
1624  //printf("MATCH!\n");
1625  return kTRUE;
1626  }
1627 
1628  return kFALSE;
1629 }
1630 
1631 
1632 //--------------------------------------------------------------------------
1634  // recompute event primary vertex from AOD tracks
1635 
1636  AliVertexerTracks *vertexer = new AliVertexerTracks(event->GetMagneticField());
1637  vertexer->SetITSMode();
1638  vertexer->SetMinClusters(3);
1639 
1640  AliAODVertex* pvtx=event->GetPrimaryVertex();
1641  if(strstr(pvtx->GetTitle(),"VertexerTracksWithConstraint")) {
1642  Float_t diamondcovxy[3];
1643  event->GetDiamondCovXY(diamondcovxy);
1644  Double_t pos[3]={event->GetDiamondX(),event->GetDiamondY(),0.};
1645  Double_t cov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,10.*10.};
1646  AliESDVertex *diamond = new AliESDVertex(pos,cov,1.,1);
1647  vertexer->SetVtxStart(diamond);
1648  delete diamond; diamond=NULL;
1649  }
1650 
1651  AliESDVertex* vertexESD = (AliESDVertex*)vertexer->FindPrimaryVertex(event);
1652  if(!vertexESD) return kFALSE;
1653  if(vertexESD->GetNContributors()<=0) {
1654  //AliDebug(2,"vertexing failed");
1655  delete vertexESD; vertexESD=NULL;
1656  return kFALSE;
1657  }
1658  delete vertexer; vertexer=NULL;
1659 
1660  // convert to AliAODVertex
1661  Double_t pos[3],cov[6],chi2perNDF;
1662  vertexESD->GetXYZ(pos); // position
1663  vertexESD->GetCovMatrix(cov); //covariance matrix
1664  chi2perNDF = vertexESD->GetChi2toNDF();
1665  delete vertexESD; vertexESD=NULL;
1666 
1667  pvtx->SetPosition(pos[0],pos[1],pos[2]);
1668  pvtx->SetChi2perNDF(chi2perNDF);
1669  pvtx->SetCovMatrix(cov);
1670 
1671  return kTRUE;
1672 }
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
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()
static Bool_t CheckMatchingAODdeltaAODevents()
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