AliPhysics  master (3d17d9d)
AliAnalysisTaskCheckEvSel.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2018, 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 
18 //*************************************************************************
19 // Class AliAnalysisTaskCheckEvSel
20 // Task to check event selection with D2H code
21 // Author: Francesco Prino
22 //*************************************************************************
23 
24 
25 #include <TList.h>
26 #include <TH1F.h>
27 #include <TH2F.h>
28 #include <TH3F.h>
29 #include <THnSparse.h>
30 #include "AliAnalysisManager.h"
31 #include "AliInputEventHandler.h"
32 #include "AliPIDResponse.h"
33 #include "AliAODHandler.h"
34 #include "AliAODEvent.h"
35 #include "AliVVertex.h"
36 #include "AliMCEvent.h"
37 #include "AliAODTrack.h"
38 #include "AliVertexingHFUtils.h"
40 #include "AliRDHFCutsD0toKpi.h"
42 
44 
45 
46 //________________________________________________________________________
49  fOutput(0x0),
50  fReadMC(kFALSE),
51  fSystem(0),
52  fCutOnzVertexSPD(0),
53  fAODProtection(1),
54  fHistNEvents(0x0),
55  fHistNEventsVsCent(0x0),
56  fHistNEventsVsCL1(0x0),
57  fHistWhyRej(0x0),
58  fHistNEventsVsWhyRej(0x0),
59  fHistNEventsVsTime(0x0),
60  fHistNTrackletsBeforePileup(0x0),
61  fHistNTrackletsAfterPileup(0x0),
62  fHistNCL1BeforePileup(0x0),
63  fHistNCL1AfterPileup(0x0),
64  fHistCentrality(0x0),
65  fHistCL0vsV0MCentrality(0x0),
66  fHistNTracksTPCoutVsV0Cent(0x0),
67  fHistNTracksFB4VsV0Cent(0x0),
68  fHistNTracksFB4EtaPosVsV0Cent(0x0),
69  fHistNTracksFB4EtaNegVsV0Cent(0x0),
70  fHistNTracksBC0VsV0Cent(0x0),
71  fHistNTrackletsVsV0Cent(0x0),
72  fHistNTrackletsGoldenVsV0Cent(0x0),
73  fHistNTrackletsGoldenVsV0CentVsZvert(0x0),
74  fHistPhiTrackelts(0x0),
75  fHistNCL0VsV0Cent(0x0),
76  fHistNCL1VsV0Cent(0x0),
77  fHistT0AmplVsV0Ampl(0x0),
78  fHistT0AmplVsV0Cent(0x0),
79  fHistT0AmplVsNCL0(0x0),
80  fHistT0AmplVsCL0Cent(0x0),
81  fHistNTracksTPCoutVsNTracklets(0x0),
82  fHistNTracksFB4VsNTracklets(0x0),
83  fHistNTracksBC0VsNTracksFB4(0x0),
84  fHistZVertexSPDBeforeCuts(0x0),
85  fHistZVertexSPDBeforeSPDCut(0x0),
86  fHistZVertexSPDAfterCuts(0x0),
87  fHistZVertexSPDBadTrackVert(0x0),
88  fEventProp(0x0),
89  fNtupleEvProp(0x0),
90  fEnableEvPropNtuple(kFALSE),
91  fNtupleZvtxDistVsWhyRej(0x0),
92  fEnableVertexNtuple(kFALSE),
93  fUseAliEventCuts(kFALSE),
94  fCounter(0),
95  fAnalysisCuts(0x0)
96 {
97  // default constructor
98  fAnalysisCuts=new AliRDHFCutsD0toKpi("EvSelCuts");
99  fAnalysisCuts->SetTriggerMask(AliVEvent::kMB | AliVEvent::kINT7);
100  fAnalysisCuts->SetTriggerClass("");
101  fAnalysisCuts->SetOptPileup(AliRDHFCuts::kNoPileupSelection);
102 }
103 //________________________________________________________________________
105  AliAnalysisTaskSE("EvSelTask"),
106  fOutput(0x0),
107  fReadMC(readMC),
108  fSystem(system),
109  fCutOnzVertexSPD(0),
110  fAODProtection(1),
111  fHistNEvents(0x0),
112  fHistNEventsVsCent(0x0),
113  fHistNEventsVsCL1(0x0),
114  fHistWhyRej(0x0),
115  fHistNEventsVsWhyRej(0x0),
116  fHistNEventsVsTime(0x0),
117  fHistNTrackletsBeforePileup(0x0),
118  fHistNTrackletsAfterPileup(0x0),
119  fHistNCL1BeforePileup(0x0),
120  fHistNCL1AfterPileup(0x0),
121  fHistCentrality(0x0),
122  fHistCL0vsV0MCentrality(0x0),
123  fHistNTracksTPCoutVsV0Cent(0x0),
124  fHistNTracksFB4VsV0Cent(0x0),
125  fHistNTracksFB4EtaPosVsV0Cent(0x0),
126  fHistNTracksFB4EtaNegVsV0Cent(0x0),
127  fHistNTracksBC0VsV0Cent(0x0),
128  fHistNTrackletsVsV0Cent(0x0),
129  fHistNTrackletsGoldenVsV0Cent(0x0),
130  fHistNTrackletsGoldenVsV0CentVsZvert(0x0),
131  fHistPhiTrackelts(0x0),
132  fHistNCL0VsV0Cent(0x0),
133  fHistNCL1VsV0Cent(0x0),
134  fHistT0AmplVsV0Ampl(0x0),
135  fHistT0AmplVsV0Cent(0x0),
136  fHistT0AmplVsNCL0(0x0),
137  fHistT0AmplVsCL0Cent(0x0),
138  fHistNTracksTPCoutVsNTracklets(0x0),
139  fHistNTracksFB4VsNTracklets(0x0),
140  fHistNTracksBC0VsNTracksFB4(0x0),
141  fHistZVertexSPDBeforeCuts(0x0),
142  fHistZVertexSPDBeforeSPDCut(0x0),
143  fHistZVertexSPDAfterCuts(0x0),
144  fHistZVertexSPDBadTrackVert(0x0),
145  fEventProp(0x0),
146  fNtupleEvProp(0x0),
147  fEnableEvPropNtuple(kFALSE),
148  fNtupleZvtxDistVsWhyRej(0x0),
149  fEnableVertexNtuple(kFALSE),
150  fUseAliEventCuts(kFALSE),
151  fCounter(0),
152  fAnalysisCuts(cuts)
153 {
154  // default constructor
155 
156  DefineOutput(1,TList::Class()); //My private output
157  DefineOutput(2,AliNormalizationCounter::Class());
158  DefineOutput(3,TNtuple::Class());
159  DefineOutput(4,TNtuple::Class());
160 }
161 
162 //________________________________________________________________________
164 {
165  //
166  // Destructor
167  //
168  if(fOutput && !fOutput->IsOwner()){
169  delete fHistNEvents;
170  delete fHistNEventsVsCent;
171  delete fHistNEventsVsCL1;
172  delete fHistWhyRej;
173  delete fHistNEventsVsWhyRej;
174  delete fHistNEventsVsTime;
177  delete fHistNCL1BeforePileup;
178  delete fHistNCL1AfterPileup;
179  delete fHistCentrality;
189  delete fHistPhiTrackelts;
190  delete fHistNCL0VsV0Cent;
191  delete fHistNCL1VsV0Cent;
192  delete fHistT0AmplVsV0Ampl;
193  delete fHistT0AmplVsV0Cent;
194  delete fHistT0AmplVsNCL0;
195  delete fHistT0AmplVsCL0Cent;
201  delete fHistZVertexSPDAfterCuts;
203  delete fEventProp;
204  }
205  delete fOutput;
206  delete fCounter;
208  if(fNtupleEvProp) delete fNtupleEvProp;
209 
210 }
211 
212 //________________________________________________________________________
214 {
215  // Create the output container
216  //
217  if(fDebug > 1) printf("AnalysisTaskCheckEvSel::UserCreateOutputObjects() \n");
218 
219  Double_t maxMult=200.;
220  if(fSystem==1) maxMult=5000.;
221  else if(fSystem==2) maxMult=500.;
222 
223  fOutput = new TList();
224  fOutput->SetOwner();
225  fOutput->SetName("OutputHistos");
226 
227  fHistNEvents = new TH1F("hNEvents", "number of events ",21,-0.5,20.5);
228  ConfigureEvSelAxis(fHistNEvents->GetXaxis());
229  fHistNEvents->SetMinimum(0);
230  fOutput->Add(fHistNEvents);
231 
232  fHistNEventsVsCent = new TH2F("hNEventsVsCent", " ; ; Centrality ",21,-0.5,20.5,101,0.,101.);
235 
236  fHistNEventsVsCL1 = new TH2F("hNEventsVsCL1", " ; ; N_{CL1}",21,-0.5,20.5,200,-0.5,2*maxMult-0.5);
239 
240  fHistNEventsVsTime = new TH1F("hNEventsVsTime", " ; Timestamp",44640,1541462400,1544140800);
242 
243  fHistWhyRej = new TH1F("hWhyRej"," ; WhyRej",11,-0.5,10.5);
244  fOutput->Add(fHistWhyRej);
245  fHistNEventsVsWhyRej = new TH2F("hNEventsVsWhyRej", " ; ; WhyRej ",21,-0.5,20.5,11,-0.5,10.5);
248 
249  fHistNTrackletsBeforePileup = new TH1F("hNTrackletsBeforePileup"," ; N_{tracklets}",200,-0.5,maxMult-0.5);
250  fHistNTrackletsAfterPileup = new TH1F("hNTrackletsAfterPileup"," ; N_{tracklets}",200,-0.5,maxMult-0.5);
251  fHistNCL1BeforePileup = new TH1F("hNCL1BeforePileup"," ; N_{CL1}",200,-0.5,maxMult-0.5);
252  fHistNCL1AfterPileup = new TH1F("hNCL1AfterPileup"," ; N_{CL1}",200,-0.5,maxMult-0.5);
257 
258  fHistCentrality = new TH1F("hCentrality"," ; Centrality ; ",105,0.,105.);
259  fHistCL0vsV0MCentrality = new TH2F("hCL0vsV0MCentrality"," ; Centrality V0M ; Centrality CL0",105,0.,105.,105,0.,105.);
260  fOutput->Add(fHistCentrality);
262 
263  fHistNTracksTPCoutVsV0Cent = new TH2F("hNTracksTPCoutVsV0Cent"," ; Centrality ; N_{tracks, TPCout}",105,0.,105.,200,-0.5,2*maxMult-0.5);
264  fHistNTracksFB4VsV0Cent = new TH2F("hNTracksFB4VsV0Cent"," ; Centrality ; N_{tracks, FiltBit4}",105,0.,105.,200,-0.5,maxMult-0.5);
265  fHistNTracksFB4EtaPosVsV0Cent = new TH2F("hNTracksFB4EtaPosVsV0Cent"," ; Centrality ; N_{tracks, FiltBit4, |#eta|>0}",105,0.,105.,200,-0.5,maxMult-0.5);
266  fHistNTracksFB4EtaNegVsV0Cent = new TH2F("hNTracksFB4EtaNegVsV0Cent"," ; Centrality ; N_{tracks, FiltBit4, |#eta|<0}",105,0.,105.,200,-0.5,maxMult-0.5);
267  fHistNTracksBC0VsV0Cent = new TH2F("hNTracksBC0VsV0Cent"," ; Centrality ; N_{tracks, TOFBC=0}",105,0.,105.,200,-0.5,maxMult-0.5);
268  fHistNTrackletsVsV0Cent = new TH2F("hNTrackletsVsV0Cent"," ; Centrality ; N_{tracklets}",105,0.,105.,200,-0.5,maxMult-0.5);
269  fHistNTrackletsGoldenVsV0Cent = new TH2F("hNTrackletsGoldenVsV0Cent"," ; Centrality ; N_{tracklets}",105,0.,105.,200,-0.5,maxMult-0.5);
270  fHistNTrackletsGoldenVsV0CentVsZvert = new TH3F("hNTrackletsGoldenVsV0CentVsZvert"," ; Centrality ; N_{tracklets} ; z_{vertex} (cm)",105,0.,105.,200,-0.5,maxMult-0.5,30,-15.,15.);
271  fHistNTracksTPCoutVsNTracklets = new TH2F("hNTracksTPCoutVsNTracklets"," ; N_{tracklets} ; N_{tracks, TPCout}",200,-0.5,maxMult-0.5,200,-0.5,2*maxMult-0.5);
272  fHistNTracksFB4VsNTracklets = new TH2F("hNTracksFB4VsNTracklets"," ; N_{tracklets} ; N_{tracks, FiltBit4}",200,-0.5,maxMult-0.5,200,-0.5,maxMult-0.5);
273  fHistNTracksBC0VsNTracksFB4 = new TH2F("hNTracksBC0VsNTracksFB4"," ; N_{tracks, FiltBit4}; N_{tracks, TOFBC=0}",200,-0.5,maxMult-0.5,200,-0.5,maxMult-0.5);
285 
286  fHistPhiTrackelts = new TH1F("hPhiTrackelts"," ; #varphi (rad)",200,0.,2.*TMath::Pi());
288 
289  fHistNCL0VsV0Cent = new TH2F("hNCL0VsV0Cent"," ; Centrality ; N_{CL0}",105,0.,105.,200,-0.5,2*maxMult-0.5);
290  fHistNCL1VsV0Cent = new TH2F("hNCL1VsV0Cent"," ; Centrality ; N_{CL1}",105,0.,105.,200,-0.5,2*maxMult-0.5);
291  fHistT0AmplVsV0Ampl = new TH2F("hT0AmplVsV0Ampl"," ; V0 amplitude ; T0 amplitude",200,0.,60000,200,0.,2000.);
292  fHistT0AmplVsV0Cent = new TH2F("hT0AmplVsV0Cent"," ; Centrality ; T0 amplitude",105,0.,105.,200,0.,2000.);
293  fHistT0AmplVsNCL0 = new TH2F("hT0AmplVsNCL0"," ; N_{CL0} ; T0 amplitude",200,-0.5,2*maxMult-0.5,200,0.,2000.);
294  fHistT0AmplVsCL0Cent = new TH2F("hT0AmplVsCL0Cent"," ; Centrality CL0 ; T0 amplitude",105,0.,105.,200,0.,2000.);
301 
302  fHistZVertexSPDBeforeCuts = new TH2F("hZVertexSPDBeforeCuts"," ; z_{SPDvertex} ; z_{TRKvertex}",400,-20.,20.,400,-20.,20.);
304  fHistZVertexSPDBeforeSPDCut = new TH2F("hZVertexSPDBeforeSPDCut"," ; z_{SPDvertex} ; z_{TRKvertex}",400,-20.,20.,400,-20.,20.);
306  fHistZVertexSPDAfterCuts = new TH2F("hZVertexSPDAfterCuts"," ; z_{SPDvertex} ; z_{TRKvertex}",400,-20.,20.,400,-20.,20.);
308  fHistZVertexSPDBadTrackVert =new TH2F("hZVertexSPDBadTrackVert"," ; z_{SPDvertex} ; z_{TRKvertex}",400,-20.,20.,400,-20.,20.);
310 
311  const Int_t nVarForSp=8;
312  Int_t nBinsForSp[nVarForSp]={105,30,200,200,200,200,200,200};
313  Double_t minForSparse[nVarForSp]={0.,-15.,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5};
314  Double_t maxForSparse[nVarForSp]={105.,15.,maxMult-0.5,maxMult-0.5,maxMult-0.5,maxMult-0.5,maxMult-0.5,maxMult-0.5};
315 
316  fEventProp = new THnSparseF("hEventProps","",nVarForSp,nBinsForSp,minForSparse,maxForSparse);
317  fEventProp->GetAxis(0)->SetTitle("Centrality");
318  fEventProp->GetAxis(1)->SetTitle("zSPDvertex (cm)");
319  fEventProp->GetAxis(2)->SetTitle("nTracklets eta<1");
320  fEventProp->GetAxis(3)->SetTitle("nTracklets golden SPD eta<1.4");
321  fEventProp->GetAxis(4)->SetTitle("nTracklets golden SPD eta<1");
322  fEventProp->GetAxis(5)->SetTitle("nGener eta<1");
323  fEventProp->GetAxis(6)->SetTitle("nGener golden SPD eta<1.4");
324  fEventProp->GetAxis(7)->SetTitle("nGener golden SPD eta<1");
325  fOutput->Add(fEventProp);
326 
327  PostData(1,fOutput);
328 
329  TString normName="NormalizationCounter";
330  AliAnalysisDataContainer *cont = GetOutputSlot(2)->GetContainer();
331  if(cont)normName=(TString)cont->GetName();
332  fCounter = new AliNormalizationCounter(normName.Data());
333  fCounter->Init();
334  PostData(2,fCounter);
335 
336  fNtupleEvProp = new TNtuple("fNtupleEvProp","ntupleEvProp","zSPDvert:centrV0:centrCL0:V0ampl:T0ampl:nTracklets:nClSPD0:nClSPD1:nTracksFB4");
337  PostData(3,fNtupleEvProp);
338  fNtupleZvtxDistVsWhyRej = new TNtuple("ntupleZvtxDistVsWhyRej","fNtupleZvtxDistVsWhyRej","zSPDvertex:zTRKvertex:NcontributorszSPD:NcontributorszTRK:whyrejection:vtxtype");
339  PostData(4,fNtupleZvtxDistVsWhyRej);
340 
341 }
342 
343 //________________________________________________________________________
347  ax->SetBinLabel(1,"nEvents read");
348  ax->SetBinLabel(2,"Rejected due to mismatch in trees");
349  ax->SetBinLabel(3,"nEvents with good AOD");
350  ax->SetBinLabel(4,"Rejected due to trigger");
351  ax->SetBinLabel(5,"Rejected due to phys sel");
352  ax->SetBinLabel(6,"Rejected due time range cut");
353  ax->SetBinLabel(7,"Rejected due to bad centrality estimator");
354  ax->SetBinLabel(8,"Rejected due to centrality flattening");
355  ax->SetBinLabel(9,"Rejected due to centrality out of range");
356  ax->SetBinLabel(10,"Rejected due to not reco vertex");
357  ax->SetBinLabel(11,"Rejected for contr vertex");
358  ax->SetBinLabel(12,"Rejected for bad track vertex");
359  ax->SetBinLabel(13,"Rejected for vertex out of accept");
360  ax->SetBinLabel(14,"Rejected for pileup events");
361  ax->SetBinLabel(15,"Rejected due to centrality correlations");
362  ax->SetBinLabel(16,"Rejected due to mult vs. V0 cut");
363  ax->SetBinLabel(17,"Passing Phys sel + trigger");
364  ax->SetBinLabel(18,"Passing Phys sel + trigger + Pileup");
365  ax->SetBinLabel(19,"Passing Phys sel + trigger + Pileup + zVertex");
366  ax->SetBinLabel(20,"Passing Phys sel + trigger + Pileup + zVertex + Centrality");
367  ax->SetBinLabel(21,"Passing IsEventSelected");
368  ax->SetNdivisions(1,kFALSE);
369 }
370 //________________________________________________________________________
372  //Build the 3-track combinatorics (+-+ and -+-) for D+->Kpipi decays
373 
374  if(fDebug > 1) printf("AnalysisTaskCheckEvSel::UserExec() \n");
375  AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
376 
377  fHistNEvents->Fill(0); // count event
378 
379  if(fAODProtection>=0){
380  // Protection against different number of events in the AOD and deltaAOD
381  // In case of discrepancy the event is rejected.
382  Int_t matchingAODdeltaAODlevel = AliRDHFCuts::CheckMatchingAODdeltaAODevents();
383  if (matchingAODdeltaAODlevel<0 || (matchingAODdeltaAODlevel==0 && fAODProtection==1)) {
384  // AOD/deltaAOD trees have different number of entries || TProcessID do not match while it was required
385  fHistNEvents->Fill(1);
386  return;
387  }
388  }
389 
390  if(!aod && AODEvent() && IsStandardAOD()) {
391  // In case there is an AOD handler writing a standard AOD, use the AOD
392  // event in memory rather than the input (ESD) event.
393  aod = dynamic_cast<AliAODEvent*> (AODEvent());
394  }
395  if(!aod){
396  printf("AliAnalysisTaskCheckEvSel::UserExec: AOD not found!\n");
397  return;
398  }
399 
400  // fix for temporary bug in ESDfilter
401  // the AODs with null vertex pointer didn't pass the PhysSel
402  if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) return;
403 
404  Int_t nGener=0;
405  Int_t nGenerEta14=0;
406  Int_t nGenerEta1=0;
407  Int_t nGenerGoldenSPD=0;
408  Int_t nGenerGoldenSPDEta14=0;
409  Int_t nGenerGoldenSPDEta1=0;
410  if(fReadMC && fMCEvent){
411  for (int iMC = 0; iMC < fMCEvent->GetNumberOfTracks(); ++iMC) {
412  AliVParticle *part = (AliVParticle*)fMCEvent->GetTrack(iMC);
413  if(!part->IsPhysicalPrimary()) continue;
414  if(part->Charge()==0) continue;
415  nGener+=1;
416  Double_t eta=part->Eta();
417  Double_t phi=part->Phi();
418  if(TMath::Abs(eta)<1.4) nGenerEta14+=1.;
419  if(TMath::Abs(eta)<1) nGenerEta1+=1.;
420  if(phi>3.9){
421  nGenerGoldenSPD+=1.;
422  if(TMath::Abs(eta)<1.4) nGenerGoldenSPDEta14+=1.;
423  if(TMath::Abs(eta)<1) nGenerGoldenSPDEta1+=1.;
424  }
425  }
426  }
427 
428  // Post the data already here
429 
430  Bool_t isEvSel=fAnalysisCuts->IsEventSelected(aod);
434  if(fSystem==2) centr=fAnalysisCuts->GetCentrality(aod,AliRDHFCuts::kCentZNA);// p-Pb
436  const AliVVertex *vertex = aod->GetPrimaryVertex();
437  const AliVVertex *vertexSPD = aod->GetPrimaryVertexSPD();
439  Double_t nTrackletsGolden=0;
440  Double_t nTrackletsGoldenEta1=0;
441  Double_t nTrackletsGoldenEta14=0;
442  Double_t nTrackletsEta1=0;
443  Double_t nTrackletsEta14=0;
444  AliAODTracklets* tracklets=aod->GetTracklets();
445  Int_t nTr=tracklets->GetNumberOfTracklets();
446  for(Int_t iTr=0; iTr<nTr; iTr++){
447  Double_t theta=tracklets->GetTheta(iTr);
448  Double_t eta=-TMath::Log(TMath::Tan(theta/2.));
449  Double_t phi=tracklets->GetPhi(iTr);
450  fHistPhiTrackelts->Fill(phi);
451  if(TMath::Abs(eta)<1.4) nTrackletsEta14+=1.;
452  if(TMath::Abs(eta)<1) nTrackletsEta1+=1.;
453  if(phi>3.9){
454  nTrackletsGolden+=1.;
455  if(TMath::Abs(eta)<1.4) nTrackletsGoldenEta14+=1.;
456  if(TMath::Abs(eta)<1) nTrackletsGoldenEta1+=1.;
457  }
458  }
459 
460  Double_t ncl0 = aod->GetNumberOfITSClusters(0);
461  Double_t ncl1 = aod->GetNumberOfITSClusters(1);
462  Double_t zvSPD=vertexSPD->GetZ();
463  Double_t zvTRK=vertex->GetZ();
464  AliAODVZERO* vzer=(AliAODVZERO*)aod->GetVZEROData();
465  Float_t v0ampl=vzer->GetMTotV0A()+vzer->GetMTotV0C();
466  AliAODTZERO* tz=aod->GetTZEROData();
467  Double_t t0ampl=0;
468  for(Int_t j=0; j<24; j++) t0ampl+=tz->GetAmp(j);
469 
470  if(!isEvSel)fHistWhyRej->Fill(wrej);
471 
472  if(fEnableVertexNtuple) {
473  Float_t wrej4ntuple = (Float_t)wrej;
474  if(isEvSel) wrej4ntuple = -1;
475  Float_t vertextype=0;
476  if(vertex) {
477  TString vertextitle = vertex->GetTitle();
478  //Vtx tracks
479  if(vertextitle.Contains("VertexerTracks")) vertextype=3;
480  //vtx SPD
481  else if(vertextitle.Contains("Z")) vertextype=1;
482  else if(vertextitle.Contains("3D")) vertextype=2;
483  }
484 
485  Float_t vec4ntuple[6] = {(Float_t)zvSPD,(Float_t)zvTRK,(Float_t)vertexSPD->GetNContributors(),(Float_t)vertex->GetNContributors(),wrej4ntuple,vertextype};
486  fNtupleZvtxDistVsWhyRej->Fill(vec4ntuple);
487  PostData(4,fNtupleZvtxDistVsWhyRej);
488  }
501 
502  fHistZVertexSPDBeforeCuts->Fill(zvSPD,zvTRK);
503 
508  vertexSPD->GetNContributors()>=1){
509  fHistZVertexSPDBeforeSPDCut->Fill(zvSPD,zvTRK);
510  Double_t dz = vertexSPD->GetZ()-vertex->GetZ();
511  Bool_t okSpdTrk=kTRUE;
512  if(fCutOnzVertexSPD==2 && TMath::Abs(dz)>0.5) okSpdTrk=kFALSE;
513  if(okSpdTrk && fCutOnzVertexSPD==3){
514  double covTrc[6],covSPD[6];
515  vertex->GetCovarianceMatrix(covTrc);
516  vertexSPD->GetCovarianceMatrix(covSPD);
517  double errTot = TMath::Sqrt(covTrc[5]+covSPD[5]);
518  double errTrc = TMath::Sqrt(covTrc[5]);
519  double nsigTot = TMath::Abs(dz)/errTot, nsigTrc = TMath::Abs(dz)/errTrc;
520  if (TMath::Abs(dz)>0.2 || nsigTot>10 || nsigTrc>20) okSpdTrk=kFALSE;
521  }
522  if(!okSpdTrk) fHistZVertexSPDBadTrackVert->Fill(zvSPD,zvTRK);
523  }
524  if(isEvSel) fHistZVertexSPDAfterCuts->Fill(zvSPD,zvTRK);
525 
526  fHistNEvents->Fill(2);
527  fHistNEventsVsCent->Fill(2,centr);
528  fHistNEventsVsCL1->Fill(2,ncl1);
529 
530  Int_t binToFill=-1;
532  if(fAnalysisCuts->IsEventRejectedDueToTrigger()) binToFill=3;
535  }else{
537  if(wrej==3) binToFill=6;
538  else if(wrej==4) binToFill=7;
539  else binToFill=8;
540  }else{
545  }else{
547  else if(fAnalysisCuts->IsEventRejectedDueToPileup()) binToFill=13;
550  }
551  }
552  }
553  if(binToFill>0){
554  fHistNEvents->Fill(binToFill);
555  fHistNEventsVsCent->Fill(binToFill,centr);
556  fHistNEventsVsCL1->Fill(binToFill,ncl1);
557  }
559  fHistNEvents->Fill(16);
560  fHistNEventsVsCent->Fill(16,centr);
561  fHistNEventsVsCL1->Fill(16,ncl1);
562  fHistNEventsVsWhyRej->Fill(16,wrej);
564  fHistNEvents->Fill(17);
565  fHistNEventsVsCent->Fill(17,centr);
566  fHistNEventsVsCL1->Fill(17,ncl1);
567  fHistNEventsVsWhyRej->Fill(17,wrej);
569  fHistNEvents->Fill(18);
570  fHistNEventsVsCent->Fill(18,centr);
571  fHistNEventsVsCL1->Fill(18,ncl1);
572  fHistNEventsVsWhyRej->Fill(18,wrej);
574  fHistNEvents->Fill(19);
575  fHistNEventsVsCent->Fill(19,centr);
576  fHistNEventsVsCL1->Fill(19,ncl1);
577  fHistNEventsVsWhyRej->Fill(19,wrej);
578  }
579  }
580  }
581  }
582  if(isEvSel || (!isEvSel && wrej==1)){
583  fHistNTrackletsBeforePileup->Fill(ntrkl);
584  fHistNCL1BeforePileup->Fill(ncl1);
585  }
586  if(isEvSel){
587  fHistNEvents->Fill(20);
588  fHistNEventsVsCent->Fill(20,centr);
589  fHistNEventsVsCL1->Fill(20,ncl1);
590  fHistNEventsVsWhyRej->Fill(20,wrej);
591  fHistNTrackletsAfterPileup->Fill(ntrkl);
592  fHistNCL1AfterPileup->Fill(ncl1);
593  Int_t runNumb=aod->GetRunNumber();
594  if(fAnalysisCuts->GetUseTimeRangeCutForPbPb2018() && runNumb >= 295369 && runNumb <= 297624){
595  fHistNEventsVsTime->Fill(aod->GetTimeStamp());
596  }
597  }
598 
600  // events not passing the centrality selection can be removed immediately. For the others we must count the generated D mesons
602 
603  if(isEvSel){
604 
605  Int_t ntracksTPCout=0;
606  Int_t ntracksFB4=0;
607  Int_t ntracksFB4EtaPos=0;
608  Int_t ntracksFB4EtaNeg=0;
609  Int_t ntracksBC0=0;
610 
611  Double_t magField = aod->GetMagneticField();
612 
613  for(Int_t iTr=0; iTr<aod->GetNumberOfTracks(); iTr++){
614  AliAODTrack* track=dynamic_cast<AliAODTrack*>(aod->GetTrack(iTr));
615 
616  if(track->GetStatus() & AliESDtrack::kTPCout) ntracksTPCout++;
617  if(track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)){
618  ntracksFB4++;
619  Double_t etatrack=track->Eta();
620  if(etatrack>0) ntracksFB4EtaPos++;
621  else ntracksFB4EtaNeg++;
622  Int_t tofBC=track->GetTOFBunchCrossing(magField);
623  if(tofBC==0) ntracksBC0++;
624  }
625  }
626  fHistCentrality->Fill(centr);
627  fHistCL0vsV0MCentrality->Fill(centr,centrCL0);
628  fHistNTracksTPCoutVsV0Cent->Fill(centr,ntracksTPCout);
629  fHistNTracksFB4VsV0Cent->Fill(centr,ntracksFB4);
630  fHistNTracksFB4EtaPosVsV0Cent->Fill(centr,ntracksFB4EtaPos);
631  fHistNTracksFB4EtaNegVsV0Cent->Fill(centr,ntracksFB4EtaNeg);
632  fHistNTracksBC0VsV0Cent->Fill(centr,ntracksBC0);
633  fHistNTrackletsVsV0Cent->Fill(centr,ntrkl);
634  fHistNTrackletsGoldenVsV0Cent->Fill(centr,nTrackletsGolden);
635  fHistNTrackletsGoldenVsV0CentVsZvert->Fill(centr,nTrackletsGolden,zvSPD);
636  fHistNTracksTPCoutVsNTracklets->Fill(ntracksTPCout,ntrkl);
637  fHistNTracksFB4VsNTracklets->Fill(ntracksFB4,ntrkl);
638  fHistNTracksBC0VsNTracksFB4->Fill(ntracksBC0,ntracksFB4);
639  fHistNCL0VsV0Cent->Fill(centr,ncl0);
640  fHistNCL1VsV0Cent->Fill(centr,ncl1);
641  fHistT0AmplVsV0Cent->Fill(centr,t0ampl);
642  fHistT0AmplVsV0Ampl->Fill(v0ampl,t0ampl);
643  fHistT0AmplVsNCL0->Fill(ncl0,t0ampl);
644  fHistT0AmplVsCL0Cent->Fill(centrCL0,t0ampl);
645  Double_t vec4Sp[8];
646  vec4Sp[0]=centr;
647  vec4Sp[1]=zvSPD;
648  vec4Sp[2]=nTrackletsEta1;
649  vec4Sp[3]=nTrackletsGoldenEta14;
650  vec4Sp[4]=nTrackletsGoldenEta1;
651  vec4Sp[5]=nGenerEta1;
652  vec4Sp[6]=nGenerGoldenSPDEta14;
653  vec4Sp[7]=nGenerGoldenSPDEta1;
654  fEventProp->Fill(vec4Sp);
656  Float_t vec4ep[9]={(Float_t)zvSPD,(Float_t)centr,(Float_t)centrCL0,
657  (Float_t)v0ampl,(Float_t)t0ampl,
658  (Float_t)ntrkl,(Float_t)ncl0,(Float_t)ncl1,
659  (Float_t)ntracksFB4};
660  fNtupleEvProp->Fill(vec4ep);
661  PostData(3,fNtupleEvProp);
662  }
663  }
664 
665  PostData(1,fOutput);
666  PostData(2,fCounter);
667 
668  return;
669 }
670 
671 //_________________________________________________________________
673 {
674  // Terminate analysis
675  //
676  if(fDebug > 1) printf("AliAnalysisTaskCheckEvSel: Terminate() \n");
677  fOutput = dynamic_cast<TList*> (GetOutputData(1));
678  if (!fOutput) {
679  printf("ERROR: fOutput not available\n");
680  return;
681  }
682  fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("hNEvents"));
683  if(fHistNEvents){
684  printf("Number of analyzed events = %d\n",(Int_t)fHistNEvents->GetBinContent(2));
685  }else{
686  printf("ERROR: fHistNEvents not available\n");
687  return;
688  }
689  return;
690 }
691 
Bool_t IsEventRejectedDueToCentrality() const
Definition: AliRDHFCuts.h:361
TH1F * fHistPhiTrackelts
! Control plot
Bool_t IsEventRejectedDueToZVertexOutsideFiducialRegion() const
Definition: AliRDHFCuts.h:355
Bool_t IsEventRejectedDueToNotRecoVertex() const
Definition: AliRDHFCuts.h:346
double Double_t
Definition: External.C:58
Definition: External.C:260
TH2F * fHistT0AmplVsV0Cent
! pileup control plot
TH2F * fHistNTracksTPCoutVsV0Cent
! Centrality-multiplicity correl
Definition: External.C:236
TH1F * fHistCentrality
! hist. of centrality distribution
AliNormalizationCounter * fCounter
flag to use AliEventCuts for selection
TH2F * fHistNTracksFB4EtaPosVsV0Cent
! Centrality-multiplicity correl
TH2F * fHistNTracksFB4EtaNegVsV0Cent
! Centrality-multiplicity correl
Int_t IsEventSelectedInCentrality(AliVEvent *event)
THnSparseF * fEventProp
! event properties
TH2F * fHistT0AmplVsNCL0
! pileup control plot
TH2F * fHistNTracksBC0VsNTracksFB4
! Centrality-multiplicity correl
static Int_t CheckMatchingAODdeltaAODevents()
TNtuple * fNtupleEvProp
! ntuple of event props
Bool_t IsEventRejectedDueToVertexContributors() const
Definition: AliRDHFCuts.h:349
Bool_t IsEventSelectedWithAliEventCuts(AliVEvent *event)
Int_t GetWhyRejection() const
Definition: AliRDHFCuts.h:341
Bool_t IsEventRejectedDueToTRKV0CentralityCorrel() const
Definition: AliRDHFCuts.h:367
TH2F * fHistNTrackletsVsV0Cent
! Centrality-multiplicity correl
TH2F * fHistNEventsVsCent
! hist. for No. of events
TH1F * fHistNEventsVsTime
! hist. for No. of events
virtual void Terminate(Option_t *option)
TList * fOutput
! list send on output slot 0
Bool_t GetUseTimeRangeCutForPbPb2018() const
Definition: AliRDHFCuts.h:310
TH2F * fHistNTracksTPCoutVsNTracklets
! Centrality-multiplicity correl
static Int_t GetNumberOfTrackletsInEtaRange(AliAODEvent *ev, Double_t mineta, Double_t maxeta)
TH2F * fHistZVertexSPDBadTrackVert
! z-vertex distr.
TH1F * fHistNEvents
! hist. for No. of events
TH2F * fHistNEventsVsWhyRej
! hist. for No. of events
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
TH2F * fHistZVertexSPDAfterCuts
! z-vertex distr.
TH1F * fHistWhyRej
! hist. for No. of events
Bool_t IsEventRejectedDueToBadTrackVertex() const
Definition: AliRDHFCuts.h:373
TH2F * fHistT0AmplVsCL0Cent
! pileup control plot
TH2F * fHistNTracksFB4VsV0Cent
! Centrality-multiplicity correl
virtual void UserExec(Option_t *option)
TNtuple * fNtupleZvtxDistVsWhyRej
flag to enable ntuple
TH2F * fHistNTrackletsGoldenVsV0Cent
! Centrality-multiplicity correl
Float_t GetCentrality(AliAODEvent *aodEvent)
Definition: AliRDHFCuts.h:275
Bool_t IsEventRejectedDueToPileup() const
Definition: AliRDHFCuts.h:358
Bool_t fUseAliEventCuts
flag to enable ntuple for primary vertex studies
TH1F * fHistNCL1BeforePileup
! hist. for No. of tracklets
TH3F * fHistNTrackletsGoldenVsV0CentVsZvert
! Centrality-multiplicity correl
TH2F * fHistNTracksBC0VsV0Cent
! Centrality-multiplicity correl
Bool_t IsEventRejectedDuePhysicsSelection() const
Definition: AliRDHFCuts.h:379
Int_t fAODProtection
cut on zSPD vertex to remove outliers in centrality vs. tracklets (0=no cut, 1= cut at 12 cm...
TH2F * fHistNTracksFB4VsNTracklets
! Centrality-multiplicity correl
Bool_t IsEventSelected(AliVEvent *event)
Bool_t IsEventRejectedDueToTimeRangeCut()
Definition: AliRDHFCuts.h:389
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
TH1F * fHistNTrackletsBeforePileup
! hist. for No. of tracklets
TH2F * fHistZVertexSPDBeforeSPDCut
! z-vertex distr.
TH2F * fHistNEventsVsCL1
! hist. for No. of events
TH1F * fHistNTrackletsAfterPileup
! hist. for No. of tracklets
TH2F * fHistNCL0VsV0Cent
! pileup control plot
const char Option_t
Definition: External.C:48
Bool_t IsEventRejectedDueToTrigger() const
Definition: AliRDHFCuts.h:343
bool Bool_t
Definition: External.C:53
TH2F * fHistT0AmplVsV0Ampl
! pileup control plot
TH2F * fHistCL0vsV0MCentrality
! hist. of centrality (CL0 vs V0)
TH1F * fHistNCL1AfterPileup
! hist. for No. of tracklets
Int_t GetUseCentrality() const
Definition: AliRDHFCuts.h:297
Int_t fCutOnzVertexSPD
0=pp, 1=Pb-Pb, 2=p-Pb
Bool_t IsEventRejectedDueToCentralityFlattening() const
Definition: AliRDHFCuts.h:364
Bool_t IsEventRejectedDueToCentralityEstimCorrel() const
Definition: AliRDHFCuts.h:370
TH2F * fHistNCL1VsV0Cent
! pileup control plot
Double_t maxMult
TH2F * fHistZVertexSPDBeforeCuts
! z-vertex distr.