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