AliPhysics  de71be2 (de71be2)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AliAnalysisTaskSEHFQA.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2009, 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 // AliAnalysisTaskSE for HF quality assurance
21 //
22 // Author: Chiara Bianchin, chiara.bianchin@pd.infn.it
24 
25 #include <Riostream.h>
26 #include <TClonesArray.h>
27 #include <TCanvas.h>
28 #include <TList.h>
29 #include <TH1F.h>
30 #include <TH2F.h>
31 #include <TH3F.h>
32 #include <TProfile2D.h>
33 #include <TDatabasePDG.h>
34 
35 #include <AliAnalysisDataSlot.h>
36 #include <AliAnalysisDataContainer.h>
37 #include "AliAnalysisManager.h"
38 #include "AliESDtrack.h"
39 #include "AliESDVertex.h"
40 #include "AliVertexerTracks.h"
41 #include "AliPID.h"
42 #include "AliPIDResponse.h"
43 #include "AliTPCPIDResponse.h"
44 #include "AliAODHandler.h"
45 #include "AliAODEvent.h"
46 #include "AliAODVertex.h"
47 #include "AliAODTrack.h"
48 #include "AliAODMCParticle.h"
49 #include "AliAODMCHeader.h"
51 #include "AliAODRecoCascadeHF.h"
52 #include "AliAnalysisVertexingHF.h"
53 #include "AliAnalysisTaskSE.h"
54 #include "AliCounterCollection.h"
55 #include "AliRDHFCuts.h"
57 #include "AliRDHFCutsD0toKpipipi.h"
58 #include "AliRDHFCutsDstoKKpi.h"
60 #include "AliRDHFCutsD0toKpi.h"
61 #include "AliRDHFCutsLctopKpi.h"
62 #include "AliRDHFCutsLctoV0.h"
63 #include "AliVertexingHFUtils.h"
64 #include "AliInputEventHandler.h"
65 
66 #include "AliFlowEvent.h"
67 #include "AliFlowTrackCuts.h"
68 #include "AliFlowTrackSimple.h"
69 #include "AliFlowVector.h"
70 
71 #include "AliTRDTriggerAnalysis.h"
72 
73 #include "AliAnalysisTaskSEHFQA.h"
74 
75 using std::cout;
76 using std::endl;
77 
78 
82 
83 //____________________________________________________________________________
84 
86  fOutputEntries(0x0),
87  fOutputPID(0x0),
88  fOutputTrack(0x0),
89  fOutputCounters(0x0),
90  fOutputCheckCentrality(0x0),
91  fOutputEvSelection(0x0),
92  fOutputFlowObs(0x0),
93  fDecayChannel(AliAnalysisTaskSEHFQA::kD0toKpi),
94  fCuts(0x0),
95  fFlowEvent(0x0),
96  fRFPcuts(0x0),
97  fEstimator(AliRDHFCuts::kCentTRK),
98  fReadMC(kFALSE),
99  fSimpleMode(kFALSE),
100  fUseSelectionBit(kTRUE),
101  fOnOff(),
102  fFillDistrTrackEffChecks(kFALSE)
103 {
105  fOnOff[0]=kTRUE;
106  fOnOff[1]=kTRUE;
107  fOnOff[2]=kTRUE;
108  fOnOff[3]=kTRUE;
109  fOnOff[4]=kTRUE;
110 }
111 
112 //____________________________________________________________________________
114  AliAnalysisTaskSE(name),
115  fOutputEntries(0x0),
116  fOutputPID(0x0),
117  fOutputTrack(0x0),
118  fOutputCounters(0x0),
119  fOutputCheckCentrality(0x0),
120  fOutputEvSelection(0x0),
121  fOutputFlowObs(0x0),
122  fDecayChannel(ch),
123  fCuts(0x0),
124  fFlowEvent(0x0),
125  fRFPcuts(0x0),
126  fEstimator(AliRDHFCuts::kCentTRK),
127  fReadMC(kFALSE),
128  fSimpleMode(kFALSE),
129  fUseSelectionBit(kTRUE),
130  fOnOff(),
131  fFillDistrTrackEffChecks(kFALSE)
132 {
134 
135  //SetCutObject(cuts);
136  fCuts=cuts;
137 
138  fOnOff[0]=kTRUE;
139  fOnOff[1]=kTRUE;
140  fOnOff[2]=kTRUE;
141  fOnOff[3]=kTRUE;
142  fOnOff[4]=kTRUE;
143 
144  // Output slot #1 writes into a TList container (number of events)
145  DefineOutput(1,TList::Class());
146  // Output slot #2 writes into a TList container (PID)
147  if (fOnOff[1]) DefineOutput(2,TList::Class()); //My private output
148  // Output slot #3 writes into a TList container (Tracks)
149  if (fOnOff[0]) DefineOutput(3,TList::Class()); //My private output
150  // Output slot #4 writes into a AliRDHFCuts container (cuts)
151  switch(fDecayChannel){
152  case 0:
153  DefineOutput(4,AliRDHFCutsDplustoKpipi::Class()); //My private output
154  break;
155  case 1:
156  DefineOutput(4,AliRDHFCutsD0toKpi::Class()); //My private output
157  break;
158  case 2:
159  DefineOutput(4,AliRDHFCutsDStartoKpipi::Class()); //My private output
160  break;
161  case 3:
162  DefineOutput(4,AliRDHFCutsDstoKKpi::Class()); //My private output
163  break;
164  case 4:
165  DefineOutput(4,AliRDHFCutsD0toKpipipi::Class()); //My private output
166  break;
167  case 5:
168  DefineOutput(4,AliRDHFCutsLctopKpi::Class()); //My private output
169  break;
170  case kLambdactoV0:
171  DefineOutput(4,AliRDHFCutsLctoV0::Class()); //My private output
172  break;
173  }
174  if (fOnOff[2]) {
175  // Output slot #5 writes into a TList container (AliCounterCollection)
176  DefineOutput(5,TList::Class()); //My private output
177  // Output slot #6 writes into a TList container (TH1F)
178  DefineOutput(6,TList::Class()); //My private output
179  }
180 
181  if(fOnOff[3]) DefineOutput(7,TList::Class()); //My private output
182  if(fOnOff[4]) DefineOutput(8,TList::Class()); //My private output
183 
184 }
185 
186 //___________________________________________________________________________
188 {
190 
191  delete fOutputEntries;
192 
193  delete fOutputPID;
194 
195  delete fOutputTrack;
196 
197  delete fOutputCounters;
198 
199  delete fOutputCheckCentrality;
200 
201  delete fOutputEvSelection;
202 
203  if(fOnOff[4]) {
204  delete fOutputFlowObs;
205  delete fFlowEvent;
206  }
207 }
208 
209 //___________________________________________________________________________
211 
213  if(fDebug > 1) printf("AnalysisTaskSEHFQA::Init() \n");
214  AliRDHFCuts *copycut = 0x0;
215 
216  switch(fDecayChannel){
217  case 0:
218  {
219  copycut=new AliRDHFCutsDplustoKpipi(*(static_cast<AliRDHFCutsDplustoKpipi*>(fCuts)));
220  }
221  break;
222  case 1:
223  {
224  copycut=new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fCuts)));
225  }
226  break;
227  case 2:
228  {
229  copycut=new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fCuts)));
230  }
231  break;
232  case 3:
233  {
234  copycut=new AliRDHFCutsDstoKKpi(*(static_cast<AliRDHFCutsDstoKKpi*>(fCuts)));
235  }
236  break;
237  case 4:
238  {
239  copycut=new AliRDHFCutsD0toKpipipi(*(static_cast<AliRDHFCutsD0toKpipipi*>(fCuts)));
240  }
241  break;
242  case 5:
243  {
244  copycut=new AliRDHFCutsLctopKpi(*(static_cast<AliRDHFCutsLctopKpi*>(fCuts)));
245  }
246  break;
247  case kLambdactoV0:
248  {
249  copycut=new AliRDHFCutsLctoV0(*(static_cast<AliRDHFCutsLctoV0*>(fCuts)));
250  }
251  break;
252  default:
253  AliFatal("Bad initialization for the decay channe - Exiting...");
254  break;
255  }
256 
257  const char* nameoutput=GetOutputSlot(4)->GetContainer()->GetName();
258  if (copycut){
259  copycut->SetName(nameoutput);
260 
261  // Post the data
262  PostData(4,copycut);
263  }else{
264  AliFatal("Failing initializing AliRDHFCuts object - Exiting...");
265  }
266 
267  return;
268 
269 }
270 
271 //___________________________________________________________________________
273 {
274 
276  if(fDebug > 1) printf("AnalysisTaskSEHFQA::UserCreateOutputObjects() \n");
277 
278  //count events
279  fOutputEntries=new TList();
280  fOutputEntries->SetOwner();
281  fOutputEntries->SetName(GetOutputSlot(1)->GetContainer()->GetName());
282 
283 
284  TString hnameEntries="hNentries";
285  TH1F* hNentries=new TH1F(hnameEntries.Data(), "Counts the number of events", 10,-0.5,9.5);
286  hNentries->GetXaxis()->SetBinLabel(1,"nEventsAnal");
287  hNentries->GetXaxis()->SetBinLabel(2,"Pile-up Rej");
288  hNentries->GetXaxis()->SetBinLabel(3,"No VertexingHF");
289  hNentries->GetXaxis()->SetBinLabel(4,"nCandidates(AnCuts)");
290  hNentries->GetXaxis()->SetBinLabel(5,"EventsWithGoodVtx");
291  hNentries->GetXaxis()->SetBinLabel(6,"N candidates");
292  if(fReadMC){
293  hNentries->GetXaxis()->SetBinLabel(7,"MC Cand from c");
294  hNentries->GetXaxis()->SetBinLabel(8,"MC Cand from b");
295  hNentries->GetXaxis()->SetBinLabel(9,"N fake Trks");
296  hNentries->GetXaxis()->SetBinLabel(10,"N true Trks");
297  }
298 
299  hNentries->GetXaxis()->SetNdivisions(1,kFALSE);
300 
301  hnameEntries="HasSelBit";
302  TH2F* hNentriesSelBit=new TH2F(hnameEntries.Data(), "Counts the number of events with SelectionBit", 5,0.,5.,100,0.,30.);
303  hNentriesSelBit->GetXaxis()->SetBinLabel(1,"Dplus");
304  hNentriesSelBit->GetXaxis()->SetBinLabel(2,"Ds");
305  hNentriesSelBit->GetXaxis()->SetBinLabel(3,"LcKpi");
306  hNentriesSelBit->GetXaxis()->SetBinLabel(4,"D0toKpi");
307  hNentriesSelBit->GetXaxis()->SetBinLabel(5,"Dstar");
308 
309  fOutputEntries->Add(hNentries);
310  fOutputEntries->Add(hNentriesSelBit);
311 
312 
313  //PID
314  if(fOnOff[1]){
315  fOutputPID=new TList();
316  fOutputPID->SetOwner();
317  fOutputPID->SetName(GetOutputSlot(2)->GetContainer()->GetName());
318 
319  //TOF pid
320  TH1F* hTOFflags=new TH1F("hTOFflags","TOF flags",7,-0.5,6.5);
321  hTOFflags->SetMinimum(0.);
322  hTOFflags->GetXaxis()->SetBinLabel(1,"All Tracks");
323  hTOFflags->GetXaxis()->SetBinLabel(2,"kTPCout");
324  hTOFflags->GetXaxis()->SetBinLabel(3,"kTOFout");
325  hTOFflags->GetXaxis()->SetBinLabel(4,"kTIME");
326  hTOFflags->GetXaxis()->SetBinLabel(5,"kTOFpid");
327  hTOFflags->GetXaxis()->SetBinLabel(6,"kTOFmismatch");
328  hTOFflags->GetXaxis()->SetBinLabel(7,"kDetPidOK");
329 
330  TString hname="hTOFsig";
331  TH1F* hTOFsig=new TH1F(hname.Data(),"Distribution of TOF signal;TOF time [ps];Entries", 100, -2.e3,40.e3);
332 
333  hname="hTOFstartTimeMask";
334  TH1F* hTOFstartTimeMask=new TH1F(hname.Data(),"TOF start time mask; Mask ;Entries", 8, -0.5,7.5);
335  hTOFstartTimeMask->GetXaxis()->SetBinLabel(1,"FILL");
336  hTOFstartTimeMask->GetXaxis()->SetBinLabel(2,"TOF");
337  hTOFstartTimeMask->GetXaxis()->SetBinLabel(3,"T0A");
338  hTOFstartTimeMask->GetXaxis()->SetBinLabel(4,"TOF.and.T0A");
339  hTOFstartTimeMask->GetXaxis()->SetBinLabel(5,"T0C");
340  hTOFstartTimeMask->GetXaxis()->SetBinLabel(6,"TOF.and.T0C");
341  hTOFstartTimeMask->GetXaxis()->SetBinLabel(7,"T0AC");
342  hTOFstartTimeMask->GetXaxis()->SetBinLabel(8,"TOF.and.T0AC");
343 
344  hname="hTOFstartTimeRes";
345  TH1F* hTOFstartTimeRes=new TH1F(hname.Data(),"TOF start time resolution; Resolution (ps) ;Entries", 100, 0.,300.);
346 
347  hname="hTOFstartTimeDistrib";
348  TH1F* hTOFstartTimeDistrib=new TH1F(hname.Data(),"TOF start time distribution; Start time ;Entries", 400, -1000.,1000.);
349 
350  hname="hTOFtime";
351  TH1F* hTOFtime=new TH1F(hname.Data(),"Distribution of TOF time Kaon;TOF time(Kaon) [ps];Entries", 1000, 0.,50000.);
352 
353  hname="hTOFtimeKaonHyptime";
354  TH2F* hTOFtimeKaonHyptime=new TH2F(hname.Data(),"TOFtime - timeHypothesisForKaon;p[GeV/c];TOFtime - timeHypothesisForKaon [ps]",500,0.,10.,1000,-20000.,20000.);
355 
356  hname="hTOFtimeKaonHyptimeAC";
357  TH2F* hTOFtimeKaonHyptimeAC=new TH2F(hname.Data(),"TOFtime - timeHypothesisForKaon;p[GeV/c];TOFtime - timeHypothesisForKaon [ps]",500,0.,10.,1000,-20000.,20000.);
358 
359  hname="hTOFsigmaKSigPid";
360  TH2F* hTOFsigmaKSigPid=new TH2F(hname.Data(),"(TOFsignal-timeK)/tofSigPid;p[GeV/c];(TOFsignal-timeK)/tofSigPid",500,0.,10.,400,-20,20);
361 
362  hname="hTOFsigmaPionSigPid";
363  TH2F* hTOFsigmaPionSigPid=new TH2F(hname.Data(),"(TOFsignal-time#pi)/tofSigPid;p[GeV/c];(TOFsignal-time#pi)/tofSigPid",500,0.,10.,400,-20,20);
364 
365  hname="hTOFsigmaProtonSigPid";
366  TH2F* hTOFsigmaProtonSigPid=new TH2F(hname.Data(),"(TOFsignal-timep)/tofSigPid;p[GeV/c];(TOFsignal-time p)/tofSigPid",500,0.,10.,400,-20,20);
367 
368  hname="hTOFsigPid3sigPion";
369  TH1F* hTOFsigPid3sigPion=new TH1F(hname.Data(),"TOF PID resolution (#pi) [ps]",500,0.,1000.);
370 
371  hname="hTOFsigPid3sigKaon";
372  TH1F* hTOFsigPid3sigKaon=new TH1F(hname.Data(),"TOF PID resolution (K) [ps]",500,0.,1000.);
373 
374  hname="hTOFsigPid3sigProton";
375  TH1F* hTOFsigPid3sigProton=new TH1F(hname.Data(),"TOF PID resolution (p) [ps]",500,0.,1000.);
376 
377 
378  //TPC pid
379  hname="hTPCsig";
380  TH1F* hTPCsig=new TH1F(hname.Data(),"Distribution of TPC signal;TPC sig;Entries", 100, 35.,100.);
381 
382  hname="hTPCsigvsp";
383  TH2F* hTPCsigvsp=new TH2F(hname.Data(),"TPCsig vs p;TPC p[GeV/c];TPCsig",500,0.,10.,1000,35.,100.);
384 
385  hname="hTPCsigvspAC";
386  TH2F* hTPCsigvspAC=new TH2F(hname.Data(),"TPCsig vs p;TPCp[GeV/c];TPCsig",500,0.,10.,1000,35.,100.);
387 
388  hname="hTPCsigmaK";
389  TH2F* hTPCsigmaK=new TH2F(hname.Data(),"TPC Sigma for K as a function of momentum;p[GeV/c];Sigma Kaon",500,0.,10.,400,-20,20);
390 
391  hname="hTPCsigmaPion";
392  TH2F* hTPCsigmaPion=new TH2F(hname.Data(),"TPC Sigma for #pi as a function of momentum;p[GeV/c];Sigma #pi",500,0.,10.,400,-20,20);
393 
394  hname="hTPCsigmaProton";
395  TH2F* hTPCsigmaProton=new TH2F(hname.Data(),"TPC Sigma for proton as a function of momentum;p[GeV/c];Sigma Proton",500,0.,10.,400,-20,20);
396 
397 
398  fOutputPID->Add(hTOFflags);
399  fOutputPID->Add(hTOFsig);
400  fOutputPID->Add(hTPCsig);
401  fOutputPID->Add(hTOFstartTimeMask);
402  fOutputPID->Add(hTOFstartTimeRes);
403  fOutputPID->Add(hTOFstartTimeDistrib);
404  fOutputPID->Add(hTOFtime);
405  fOutputPID->Add(hTOFtimeKaonHyptime);
406  fOutputPID->Add(hTOFtimeKaonHyptimeAC);
407  fOutputPID->Add(hTOFsigmaKSigPid);
408  fOutputPID->Add(hTOFsigmaPionSigPid);
409  fOutputPID->Add(hTOFsigmaProtonSigPid);
410  fOutputPID->Add(hTOFsigPid3sigPion);
411  fOutputPID->Add(hTOFsigPid3sigKaon);
412  fOutputPID->Add(hTOFsigPid3sigProton);
413  fOutputPID->Add(hTPCsigvsp);
414  fOutputPID->Add(hTPCsigvspAC);
415  fOutputPID->Add(hTPCsigmaK);
416  fOutputPID->Add(hTPCsigmaPion);
417  fOutputPID->Add(hTPCsigmaProton);
418 
420 
421  hname="hTPCsigNvsPtAllTracks";
422  TH2F* hTPCsigNvsPtAllTracks=new TH2F(hname.Data(),"Distribution of n. points used for TPC dE/dx vs. p_{T};p_{T} [GeV/c]; n. points", 200, 0.,20.,161,-0.5,160.5);
423 
424  hname="hTPCsigNvsPhiAllTracks";
425  TH2F* hTPCsigNvsPhiAllTracks=new TH2F(hname.Data(),"Distribution of n. points used for TPC dE/dx vs. #phi;#phi [rad]; n. points", 100, 0.,2*TMath::Pi(),161,-0.5,160.5);
426 
427  hname="hTPCsigNvsEtaAllTracks";
428  TH2F* hTPCsigNvsEtaAllTracks=new TH2F(hname.Data(),"Distribution of n. points used for TPC dE/dx vs. #eta;eta; n. points", 80,-2.,2.,161,-0.5,160.5);
429 
430  hname="hTPCsigNvsPtDaughters";
431  TH2F* hTPCsigNvsPtDaughters=new TH2F(hname.Data(),"Distribution of n. points used for TPC dE/dx vs. p_{T};p_{T} [GeV/c]; n. points", 200, 0.,20.,161,-0.5,160.5);
432 
433  hname="hTPCsigNvsPhiDaughters";
434  TH2F* hTPCsigNvsPhiDaughters=new TH2F(hname.Data(),"Distribution of n. points used for TPC dE/dx vs. #phi;#phi [rad]; n. points", 100, 0.,2*TMath::Pi(),161,-0.5,160.5);
435 
436  hname="hTPCsigNvsEtaDaughters";
437  TH2F* hTPCsigNvsEtaDaughters=new TH2F(hname.Data(),"Distribution of n. points used for TPC dE/dx vs. #eta;eta; n. points", 80,-2.,2.,161,-0.5,160.5);
438 
439  fOutputPID->Add(hTPCsigNvsPtAllTracks);
440  fOutputPID->Add(hTPCsigNvsPhiAllTracks);
441  fOutputPID->Add(hTPCsigNvsEtaAllTracks);
442  fOutputPID->Add(hTPCsigNvsPtDaughters);
443  fOutputPID->Add(hTPCsigNvsPhiDaughters);
444  fOutputPID->Add(hTPCsigNvsEtaDaughters);
445  }
446 
447 
448  if(fReadMC){
449  //TOF
450  hname="hTOFsigmaMCKSigPid";
451  TH2F* hTOFsigmaMCKSigPid=new TH2F(hname.Data(),"(TOFsignal-timeK)/tofSigPid;p[GeV/c];(TOFsignal-timeK)/tofSigPid",500,0.,10.,400,-20,20);
452 
453  hname="hTOFsigmaMCPionSigPid";
454  TH2F* hTOFsigmaMCPionSigPid=new TH2F(hname.Data(),"(TOFsignal-time#pi)/tofSigPid;p[GeV/c];(TOFsignal-time#pi)/tofSigPid",500,0.,10.,400,-20,20);
455 
456  hname="hTOFsigmaMCProtonSigPid";
457  TH2F* hTOFsigmaMCProtonSigPid=new TH2F(hname.Data(),"(TOFsignal-timep)/tofSigPid;p[GeV/c];(TOFsignal-time p)/tofSigPid",500,0.,10.,400,-20,20);
458 
459  //TPC
460  hname="hTPCsigmaMCK";
461  TH2F* hTPCsigmaMCK=new TH2F(hname.Data(),"TPC Sigma for K as a function of momentum;p[GeV/c];Sigma Kaon",500,0.,10.,400,-20,20);
462 
463  hname="hTPCsigmaMCPion";
464  TH2F* hTPCsigmaMCPion=new TH2F(hname.Data(),"TPC Sigma for #pi as a function of momentum;p[GeV/c];Sigma #pi",500,0.,10.,400,-20,20);
465 
466  hname="hTPCsigmaMCProton";
467  TH2F* hTPCsigmaMCProton=new TH2F(hname.Data(),"TPC Sigma for proton as a function of momentum;p[GeV/c];Sigma Proton",500,0.,10.,400,-20,20);
468 
469  fOutputPID->Add(hTOFsigmaMCKSigPid);
470  fOutputPID->Add(hTOFsigmaMCPionSigPid);
471  fOutputPID->Add(hTOFsigmaMCProtonSigPid);
472  fOutputPID->Add(hTPCsigmaMCK);
473  fOutputPID->Add(hTPCsigmaMCPion);
474  fOutputPID->Add(hTPCsigmaMCProton);
475 
476  }
477  }
478 
479  //quality of the tracks
480  if(fOnOff[0]){
481  fOutputTrack=new TList();
482  fOutputTrack->SetOwner();
483  fOutputTrack->SetName(GetOutputSlot(3)->GetContainer()->GetName());
484 
485  TString hname="hnClsITS";
486  TH1F* hnClsITS=new TH1F(hname.Data(),"Distribution of number of ITS clusters;nITScls;Entries",7,-0.5,6.5);
487 
488  hname="hnClsITSselTr";
489  TH1F* hnClsITSselTr=new TH1F(hname.Data(),"Distribution of number of ITS clusters selected tracks;nITScls;Entries",7,-0.5,6.5);
490 
491  hname="hnClsITS-SA";
492  TH1F* hnClsITSSA=new TH1F(hname.Data(),"Distribution of number of ITS clusters(ITS-SA);nITScls;Entries",7,-0.5,6.5);
493 
494 
495  hname="hnLayerITS";
496  TH1F* hnLayerITS=new TH1F(hname.Data(),"Number of tracks with point in layer;ITS layer;",7,-1.5,5.5);
497  hnLayerITS->GetXaxis()->SetBinLabel(1,"n tracks");
498  hnLayerITS->GetXaxis()->SetBinLabel(2,"SPDin");
499  hnLayerITS->GetXaxis()->SetBinLabel(3,"SPDout");
500  hnLayerITS->GetXaxis()->SetBinLabel(4,"SDDin");
501  hnLayerITS->GetXaxis()->SetBinLabel(5,"SDDout");
502  hnLayerITS->GetXaxis()->SetBinLabel(6,"SSDin");
503  hnLayerITS->GetXaxis()->SetBinLabel(7,"SSDout");
504 
505  hname="hnLayerITSselTr";
506  TH1F* hnLayerITSselTr=new TH1F(hname.Data(),"Number of selected tracks with point in layer;ITS layer;",7,-1.5,5.5);
507  hnLayerITSselTr->GetXaxis()->SetBinLabel(1,"n tracks");
508  hnLayerITSselTr->GetXaxis()->SetBinLabel(2,"SPDin");
509  hnLayerITSselTr->GetXaxis()->SetBinLabel(3,"SPDout");
510  hnLayerITSselTr->GetXaxis()->SetBinLabel(4,"SDDin");
511  hnLayerITSselTr->GetXaxis()->SetBinLabel(5,"SDDout");
512  hnLayerITSselTr->GetXaxis()->SetBinLabel(6,"SSDin");
513  hnLayerITSselTr->GetXaxis()->SetBinLabel(7,"SSDout");
514 
515  hname="hnLayerITSsa";
516  TH1F* hnLayerITSsa=new TH1F(hname.Data(),"Number of ITSsa tracks with point in layer;ITS layer;",7,-1.5,5.5);
517  hnLayerITSsa->GetXaxis()->SetBinLabel(1,"n tracks");
518  hnLayerITSsa->GetXaxis()->SetBinLabel(2,"SPDin");
519  hnLayerITSsa->GetXaxis()->SetBinLabel(3,"SPDout");
520  hnLayerITSsa->GetXaxis()->SetBinLabel(4,"SDDin");
521  hnLayerITSsa->GetXaxis()->SetBinLabel(5,"SDDout");
522  hnLayerITSsa->GetXaxis()->SetBinLabel(6,"SSDin");
523  hnLayerITSsa->GetXaxis()->SetBinLabel(7,"SSDout");
524 
525  hname="hnClsSPD";
526  TH1F* hnClsSPD=new TH1F(hname.Data(),"Distribution of number of SPD clusters;nSPDcls;Entries",3,-0.5,2.5);
527 
528  hname="hptGoodTr";
529  TH1F* hptGoodTr=new TH1F(hname.Data(),"Pt distribution of 'good' tracks;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
530  hptGoodTr->SetTitleOffset(1.3,"Y");
531 
532  if(!fSimpleMode){
533  hname="hptGoodTrFromDaugh";
534  TH1F* hptGoodTrFromDaugh=new TH1F(hname.Data(),"Pt distribution of 'good' candidate's daughters;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
535  hptGoodTrFromDaugh->SetTitleOffset(1.3,"Y");
536  fOutputTrack->Add(hptGoodTrFromDaugh);
537  hname="hptGoodTrFromDaugh_filt";
538  TH1F* hptGoodTrFromDaugh_filt=new TH1F(hname.Data(),"Pt distribution of 'good' candidate's daughters, cuts level;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
539  hptGoodTrFromDaugh_filt->SetTitleOffset(1.3,"Y");
540  fOutputTrack->Add(hptGoodTrFromDaugh_filt);
541  }
542 
543  hname="hdistrGoodTr";
544  TH1F* hdistrGoodTr=new TH1F(hname.Data(),"Distribution of number of 'good' candidate's daughters per event;no.good-tracks/ev;Entries",4000,-0.5,3999.5);
545  hdistrGoodTr->SetTitleOffset(1.3,"Y");
546 
547  hname="hdistrSelTr";
548  TH1F* hdistrSelTr=new TH1F(hname.Data(),"Distribution of number of Selected tracks per event;no.good-tracks/ev;Entries",4000,-0.5,3999.5);
549  hdistrSelTr->SetTitleOffset(1.3,"Y");
550 
551  hname="hd0dau";
552  TH1F* hd0dau=new TH1F(hname.Data(),"Impact parameter (rphi) distribution of D daughter tracks;d_{0rphi}[cm];Entries/10^{3} cm",200,-0.1,0.1);
553 
554  hname="hd0dau_filt";
555  TH1F* hd0dau_filt=new TH1F(hname.Data(),"Impact parameter (rphi) distribution of D daughter tracks, cut level;d_{0rphi}[cm];Entries/10^{3} cm",200,-0.1,0.1);
556 
557  hname="hd0dauphi";
558  TH2F* hd0dauphi=new TH2F(hname.Data(), "Impact parameter (rphi) distribution of D daughter tracks versus #phi; #phi [rad]; d_{0rphi} [cm]",400,0,6.3,200,-0.1,0.1);
559 
560  hname="hd0dauphi_filt";
561  TH2F* hd0dauphi_filt=new TH2F(hname.Data(), "Impact parameter (rphi) distribution of D daughter tracks versus #phi, cut level; #phi [rad]; d_{0rphi} [cm]",400,0,6.3,200,-0.1,0.1);
562 
563  hname="hd0zdau";
564  TH1F* hd0zdau=new TH1F(hname.Data(),"Impact parameter (z) distribution of D daughter tracks;d_{0z}[cm];Entries/10^{3} cm",200,-0.1,0.1);
565 
566  hname="hd0zdau_filt";
567  TH1F* hd0zdau_filt=new TH1F(hname.Data(),"Impact parameter (z) distribution of D daughter tracks, cut level;d_{0z}[cm];Entries/10^{3} cm",200,-0.1,0.1);
568 
569 
570  hname="hd0zdauphi";
571  TH2F* hd0zdauphi=new TH2F(hname.Data(), "Impact parameter (z) distribution of D daughter tracks versus #phi; #phi [rad]; d_{0z} [cm]",400,0,6.3,200,-0.1,0.1);
572 
573  hname="hd0zdauphi_filt";
574  TH2F* hd0zdauphi_filt=new TH2F(hname.Data(), "Impact parameter (z) distribution of D daughter tracks versus #phi, filtering level; #phi [rad]; d_{0z} [cm]",400,0,6.3,200,-0.1,0.1);
575 
576  hname="hd0TracksSPDin";
577  TH1F* hd0TracksSPDin=new TH1F(hname.Data(),"Impact parameter (rphi) distribution of AOD tracks kITSrefit, SPDinner; d_{0rphi}[cm];Entries",200,-0.5,0.5);
578 
579  hname="hd0TracksSPDany";
580  TH1F* hd0TracksSPDany=new TH1F(hname.Data(),"Impact parameter (rphi) distribution of AOD tracks kITSrefit, SPDany; d_{0rphi}[cm];Entries",200,-0.5,0.5);
581 
582  hname="hd0TracksFilterBit4";
583  TH1F* hd0TracksFilterBit4=new TH1F(hname.Data(),"Impact parameter (rphi) distribution of AOD tracks FilterBit4; d_{0rphi}[cm];Entries",200,-0.5,0.5);
584 
585  hname="hd0TracksTPCITSSPDany";
586  TH1F* hd0TracksTPCITSSPDany=new TH1F(hname.Data(),"Impact parameter (rphi) distribution of AOD tracks TPC+ITScuts+SPDany; d_{0rphi}[cm];Entries",200,-0.5,0.5);
587 
588 
590  hname="hPtDaughters";
591  TH1F *hPtDaughters=new TH1F(hname.Data(),"p_{T} distributions of the daughter tracks;p_{T} [GeV/c];Entries",200,0.,20.);
592 
593  hname="hPhiDaughters";
594  TH1F *hPhiDaughters=new TH1F(hname.Data(),"#phi distribution of the daughter tracks;#phi [rad];Entries",100,0.,2*(TMath::Pi()));
595 
596  hname="hEtaDaughters";
597  TH1F *hEtaDaughters=new TH1F(hname.Data(),"#eta distribution of the daughter tracks;#eta;Entries",80,-2.,2.);
598 
599  hname="hEtavsPhiDaughters";
600  TH2F *hEtavsPhiDaughters=new TH2F(hname.Data(),"#eta vs #phi distribution of the daughter tracks;#phi;#eta",100,0.,2*(TMath::Pi()),80,-2.,2.);
601 
602  hname="hNTPCclsvsPtDaughters";
603  TH2F *hNTPCclsvsPtDaughters=new TH2F(hname.Data(),"N TPC clusters vs p_{T} distribution of the daughter tracks;p_{T} [GeV/c];N TPC cls",200,0.,20.,85,-0.5,169.5);
604 
605  hname="hNTPCclsvsPhiDaughters";
606  TH2F *hNTPCclsvsPhiDaughters=new TH2F(hname.Data(),"N TPC clusters vs #phi distribution of the daughter tracks;#phi [rad];N TPC cls",100,0.,2*(TMath::Pi()),85,-0.5,169.5);
607 
608  hname="hNTPCclsvsEtaDaughters";
609  TH2F *hNTPCclsvsEtaDaughters=new TH2F(hname.Data(),"N TPC clusters vs #eta distribution of the daughter tracks;#eta;N TPC cls",80,-2.,2.,85,-0.5,169.5);
610 
611  hname="hNTPCCrossedRowsvsPtDaughters";
612  TH2F *hNTPCCrossedRowsvsPtDaughters=new TH2F(hname.Data(),"N TPC crossed rows vs p_{T} distribution of the daughter tracks;p_{T} [GeV/c];N TPC cros. rows",200,0.,20.,100,-0.5,199.5);
613 
614  hname="hNTPCCrossedRowsvsPhiDaughters";
615  TH2F *hNTPCCrossedRowsvsPhiDaughters=new TH2F(hname.Data(),"N TPC crossed rows vs #phi distribution of the daughter tracks;#phi [rad];N TPC cros. rows",100,0.,2*(TMath::Pi()),100,-0.5,199.5);
616 
617  hname="hNTPCCrossedRowsvsEtaDaughters";
618  TH2F *hNTPCCrossedRowsvsEtaDaughters=new TH2F(hname.Data(),"N TPC crossed rows vs #eta distribution of the daughter tracks;#eta;N TPC cros. rows",80,-2.,2.,100,-0.5,199.5);
619 
620  hname="hRatioCRowsOverFclsvsPtDaughters";
621  TH2F *hRatioCRowsOverFclsvsPtDaughters=new TH2F(hname.Data(),"CrossedRows/FindableClusters vs p_{T} distribution of the daughter tracks;p_{T} [GeV/c];CRows/FCls",200,0.,20,100,0.,1.);
622 
623  hname="hRatioCRowsOverFclsvsPhiDaughters";
624  TH2F *hRatioCRowsOverFclsvsPhiDaughters=new TH2F(hname.Data(),"CrossedRows/FindableClusters vs #phi distribution of the daughter tracks;#phi [rad];CRows/FCls",100,0.,2*(TMath::Pi()),100,0.,1.);
625 
626  hname="hRatioCRowsOverFclsvsEtaDaughters";
627  TH2F *hRatioCRowsOverFclsvsEtaDaughters=new TH2F(hname.Data(),"CrossedRows/FindableClusters vs #eta distribution of the daughter tracks;#eta;CRows/FCls",80,-2.,2.,100,0.,1.);
628 
629  hname="hNITSclsvsPtDaughters";
630  TH2F *hNITSclsvsPtDaughters=new TH2F(hname.Data(),"N ITS clusters vs p_{T} distribution of the daughter tracks;p_{T} [GeV/c];N ITS cls",200,0.,20,7,-0.5,6.5);
631 
632  hname="hNITSclsvsPhiDaughters";
633  TH2F *hNITSclsvsPhiDaughters=new TH2F(hname.Data(),"N ITS clusters vs #phi distribution of the daughter tracks;#phi [rad];N ITS cls",100,0.,2*(TMath::Pi()),7,-0.5,6.5);
634 
635  hname="hNITSclsvsEtaDaughters";
636  TH2F *hNITSclsvsEtaDaughters=new TH2F(hname.Data(),"N ITS clusters vs #eta distribution of the daughter tracks;#eta;N ITS cls",80,-2.,2.,7,-0.5,6.5);
637 
638  hname="hSPDclsDaughters";
639  TH1I *hSPDclsDaughters = new TH1I(hname.Data(),"N SPD points distribution;;Entries",4,-0.5,3.5);
640  hSPDclsDaughters->GetXaxis()->SetBinLabel(1, "no SPD");
641  hSPDclsDaughters->GetXaxis()->SetBinLabel(2, "kOnlyFirst");
642  hSPDclsDaughters->GetXaxis()->SetBinLabel(3, "kOnlySecond");
643  hSPDclsDaughters->GetXaxis()->SetBinLabel(4, "kBoth");
644 
645  hname="hPtAllTracks";
646  TH1F *hPtAllTracks=new TH1F(hname.Data(),"p_{T} distributions of the AOD tracks (ID>0);p_{T} [GeV/c];Entries",200,0.,20.);
647 
648  hname="hPhiAllTracks";
649  TH1F *hPhiAllTracks=new TH1F(hname.Data(),"#phi distribution of the AOD tracks (ID>0);#phi [rad];Entries",100,0.,2*(TMath::Pi()));
650 
651  hname="hEtaAllTracks";
652  TH1F *hEtaAllTracks=new TH1F(hname.Data(),"#eta distribution of the AOD tracks (ID>0);#eta;Entries",80,-2.,2.);
653 
654  hname="hEtavsPhiAllTracks";
655  TH2F *hEtavsPhiAllTracks=new TH2F(hname.Data(),"#eta vs #phi distribution of the AOD tracks (ID>0);#phi;#eta",100,0.,2*(TMath::Pi()),80,-2.,2.);
656 
657  hname="hNTPCclsvsPtAllTracks";
658  TH2F *hNTPCclsvsPtAllTracks=new TH2F(hname.Data(),"N TPC clusters vs p_{T} distribution of the AOD tracks (ID>0);p_{T} [GeV/c];N TPC cls",200,0.,20,85,-0.5,169.5);
659 
660  hname="hNTPCclsvsPhiAllTracks";
661  TH2F *hNTPCclsvsPhiAllTracks=new TH2F(hname.Data(),"N TPC clusters vs #phi distribution of the AOD tracks (ID>0);#phi [rad];N TPC cls",100,0.,2*(TMath::Pi()),85,-0.5,169.5);
662 
663  hname="hNTPCclsvsEtaAllTracks";
664  TH2F *hNTPCclsvsEtaAllTracks=new TH2F(hname.Data(),"N TPC clusters vs #eta distribution of the AOD tracks (ID>0);#eta;N TPC cls",80,-2.,2.,85,-0.5,169.5);
665 
666  hname="hNTPCCrossedRowsvsPtAllTracks";
667  TH2F *hNTPCCrossedRowsvsPtAllTracks=new TH2F(hname.Data(),"N TPC crossed rows vs p_{T} distribution of the AOD tracks;p_{T} [GeV/c];N TPC cros. rows",200,0.,20.,100,-0.5,199.5);
668 
669  hname="hNTPCCrossedRowsvsPhiAllTracks";
670  TH2F *hNTPCCrossedRowsvsPhiAllTracks=new TH2F(hname.Data(),"N TPC crossed rows vs #phi distribution of the AOD tracks;#phi [rad];N TPC cros. rows",100,0.,2*(TMath::Pi()),100,-0.5,199.5);
671 
672  hname="hNTPCCrossedRowsvsEtaAllTracks";
673  TH2F *hNTPCCrossedRowsvsEtaAllTracks=new TH2F(hname.Data(),"N TPC crossed rows vs #eta distribution of the AOD tracks;#eta;N TPC cros. rows",80,-2.,2.,100,-0.5,199.5);
674 
675  hname="hRatioCRowsOverFclsvsPtAllTracks";
676  TH2F *hRatioCRowsOverFclsvsPtAllTracks=new TH2F(hname.Data(),"CrossedRows/FindableClusters vs p_{T} distribution of the AOD tracks (ID>0);p_{T} [GeV/c];CRows/FCls",200,0.,20,100,0.,1.);
677 
678  hname="hRatioCRowsOverFclsvsPhiAllTracks";
679  TH2F *hRatioCRowsOverFclsvsPhiAllTracks=new TH2F(hname.Data(),"CrossedRows/FindableClusters vs #phi distribution of the AOD tracks (ID>0);#phi [rad];CRows/FCls",100,0.,2*(TMath::Pi()),100,0.,1.);
680 
681  hname="hRatioCRowsOverFclsvsEtaAllTracks";
682  TH2F *hRatioCRowsOverFclsvsEtaAllTracks=new TH2F(hname.Data(),"CrossedRows/FindableClusters vs #eta distribution of the AOD tracks (ID>0);#eta;CRows/FCls",80,-2.,2.,100,0.,1.);
683 
684  hname="hNITSclsvsPtAllTracks";
685  TH2F *hNITSclsvsPtAllTracks=new TH2F(hname.Data(),"N ITS clusters vs p_{T} distribution of the AOD tracks (ID>0);p_{T} [GeV/c];N ITS cls",200,0.,20,7,-0.5,6.5);
686 
687  hname="hNITSclsvsPhiAllTracks";
688  TH2F *hNITSclsvsPhiAllTracks=new TH2F(hname.Data(),"N ITS clusters vs #phi distribution of the AOD tracks (ID>0);#phi [rad];N ITS cls",100,0.,2*(TMath::Pi()),7,-0.5,6.5);
689 
690  hname="hNITSclsvsEtaAllTracks";
691  TH2F *hNITSclsvsEtaAllTracks=new TH2F(hname.Data(),"N ITS clusters vs #eta distribution of the AOD tracks (ID>0);#eta;N ITS cls",80,-2.,2.,7,-0.5,6.5);
692 
693  hname="hSPDclsAllTracks";
694  TH1I *hSPDclsAllTracks = new TH1I(hname.Data(),"N SPD points distribution AOD tracks (ID>0);;Entries",4,-0.5,3.5);
695  hSPDclsAllTracks->GetXaxis()->SetBinLabel(1, "no SPD");
696  hSPDclsAllTracks->GetXaxis()->SetBinLabel(2, "kOnlyFirst");
697  hSPDclsAllTracks->GetXaxis()->SetBinLabel(3, "kOnlySecond");
698  hSPDclsAllTracks->GetXaxis()->SetBinLabel(4, "kBoth");
699 
700 
701  fOutputTrack->Add(hPtDaughters);
702  fOutputTrack->Add(hPhiDaughters);
703  fOutputTrack->Add(hEtaDaughters);
704  fOutputTrack->Add(hEtavsPhiDaughters);
705  fOutputTrack->Add(hNTPCclsvsPtDaughters);
706  fOutputTrack->Add(hNTPCclsvsPhiDaughters);
707  fOutputTrack->Add(hNTPCclsvsEtaDaughters);
708  fOutputTrack->Add(hNTPCCrossedRowsvsPtDaughters);
709  fOutputTrack->Add(hNTPCCrossedRowsvsPhiDaughters);
710  fOutputTrack->Add(hNTPCCrossedRowsvsEtaDaughters);
711  fOutputTrack->Add(hRatioCRowsOverFclsvsPtDaughters);
712  fOutputTrack->Add(hRatioCRowsOverFclsvsPhiDaughters);
713  fOutputTrack->Add(hRatioCRowsOverFclsvsEtaDaughters);
714  fOutputTrack->Add(hNITSclsvsPtDaughters);
715  fOutputTrack->Add(hNITSclsvsPhiDaughters);
716  fOutputTrack->Add(hNITSclsvsEtaDaughters);
717  fOutputTrack->Add(hSPDclsDaughters);
718  fOutputTrack->Add(hPtAllTracks);
719  fOutputTrack->Add(hPhiAllTracks);
720  fOutputTrack->Add(hEtaAllTracks);
721  fOutputTrack->Add(hEtavsPhiAllTracks);
722  fOutputTrack->Add(hNTPCclsvsPtAllTracks);
723  fOutputTrack->Add(hNTPCclsvsPhiAllTracks);
724  fOutputTrack->Add(hNTPCclsvsEtaAllTracks);
725  fOutputTrack->Add(hNTPCCrossedRowsvsPtAllTracks);
726  fOutputTrack->Add(hNTPCCrossedRowsvsPhiAllTracks);
727  fOutputTrack->Add(hNTPCCrossedRowsvsEtaAllTracks);
728  fOutputTrack->Add(hRatioCRowsOverFclsvsPtAllTracks);
729  fOutputTrack->Add(hRatioCRowsOverFclsvsPhiAllTracks);
730  fOutputTrack->Add(hRatioCRowsOverFclsvsEtaAllTracks);
731  fOutputTrack->Add(hNITSclsvsPtAllTracks);
732  fOutputTrack->Add(hNITSclsvsPhiAllTracks);
733  fOutputTrack->Add(hNITSclsvsEtaAllTracks);
734  fOutputTrack->Add(hSPDclsAllTracks);
735 
736  }
737 
738  fOutputTrack->Add(hnClsITS);
739  fOutputTrack->Add(hnClsITSselTr);
740  fOutputTrack->Add(hnClsITSSA);
741  fOutputTrack->Add(hnLayerITS);
742  fOutputTrack->Add(hnLayerITSselTr);
743  fOutputTrack->Add(hnLayerITSsa);
744  fOutputTrack->Add(hnClsSPD);
745  fOutputTrack->Add(hptGoodTr);
746  fOutputTrack->Add(hdistrGoodTr);
747  fOutputTrack->Add(hdistrSelTr);
748  fOutputTrack->Add(hd0TracksSPDin);
749  fOutputTrack->Add(hd0TracksSPDany);
750  fOutputTrack->Add(hd0TracksFilterBit4);
751  fOutputTrack->Add(hd0TracksTPCITSSPDany);
752  fOutputTrack->Add(hd0dau);
753  fOutputTrack->Add(hd0dauphi);
754  fOutputTrack->Add(hd0zdau);
755  fOutputTrack->Add(hd0zdauphi);
756  fOutputTrack->Add(hd0dau_filt);
757  fOutputTrack->Add(hd0dauphi_filt);
758  fOutputTrack->Add(hd0zdau_filt);
759  fOutputTrack->Add(hd0zdauphi_filt);
760 
761 
762  if(fReadMC){
763  hname="hdistrFakeTr";
764  TH1F* hdistrFakeTr=new TH1F(hname.Data(),"Distribution of number of fake tracks per event;no.fake-tracks/ev;Entries",4000,-0.5,3999.5);
765  hdistrFakeTr->SetTitleOffset(1.3,"Y");
766 
767  hname="hd0f";
768  TH1F* hd0f=new TH1F(hname.Data(),"Impact parameter distribution of fake tracks;d_{0}[cm];Entries/10^{3} cm",200,-0.1,0.1);
769 
770  hname="hd0f_filt";
771  TH1F* hd0f_filt=new TH1F(hname.Data(),"Impact parameter distribution of fake tracks, cut level;d_{0}[cm];Entries/10^{3} cm",200,-0.1,0.1);
772 
773 
774  hname="hptFakeTr";
775  TH1F* hptFakeTr=new TH1F(hname.Data(),"Pt distribution of fake tracks;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
776  hptFakeTr->SetTitleOffset(1.3,"Y");
777  if(!fSimpleMode){
778  hname="hptFakeTrFromDaugh";
779  TH1F* hptFakeTrFromDaugh=new TH1F(hname.Data(),"Pt distribution of fake tracks from daughters;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
780  hptFakeTrFromDaugh->SetTitleOffset(1.3,"Y");
781  fOutputTrack->Add(hptFakeTrFromDaugh);
782 
783  hname="hptFakeTrFromDaugh_filt";
784  TH1F* hptFakeTrFromDaughFilt=new TH1F(hname.Data(),"Pt distribution of fake tracks from daughters, cut level;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
785  hptFakeTrFromDaughFilt->SetTitleOffset(1.3,"Y");
786  fOutputTrack->Add(hptFakeTrFromDaughFilt);
787  }
788 
789  fOutputTrack->Add(hptFakeTr);
790  fOutputTrack->Add(hdistrFakeTr);
791  fOutputTrack->Add(hd0f);
792  fOutputTrack->Add(hd0f_filt);
793  }
794  }
795 
796 
797  if(fOnOff[2] && fCuts->GetUseCentrality()){
798 
799  //Centrality (Counters)
800  fOutputCounters=new TList();
801  fOutputCounters->SetOwner();
802  fOutputCounters->SetName(GetOutputSlot(5)->GetContainer()->GetName());
803 
804  AliCounterCollection *stdEstimator=new AliCounterCollection("stdEstimator");
805  stdEstimator->AddRubric("run",500000);
806  stdEstimator->AddRubric("centralityclass","-10_0/0_10/10_20/20_30/30_40/40_50/50_60/60_70/70_80/80_90/90_100/-990_-980");
807  stdEstimator->Init();
808  AliCounterCollection *secondEstimator=new AliCounterCollection("secondEstimator");
809  secondEstimator->AddRubric("run",500000);
810  secondEstimator->AddRubric("centralityclass","-10_0/0_10/10_20/20_30/30_40/40_50/50_60/60_70/70_80/80_90/90_100/-990_-980");
811  secondEstimator->Init();
812 
813  fOutputCounters->Add(stdEstimator);
814  fOutputCounters->Add(secondEstimator);
815 
816  //Centrality (Checks)
817  fOutputCheckCentrality=new TList();
818  fOutputCheckCentrality->SetOwner();
819  fOutputCheckCentrality->SetName(GetOutputSlot(6)->GetContainer()->GetName());
820 
821  TString hname="hNtrackletsIn";
822  TH1F* hNtrackletsIn=new TH1F(hname.Data(),"Number of tracklets in Centrality range;ntracklets;Entries",5000,-0.5,4999.5);
823 
824  hname="hMultIn";
825  TH1F* hMultIn=new TH1F(hname.Data(),"Multiplicity;multiplicity in Centrality range;Entries",10000,-0.5,9999.5);
826 
827  hname="hNtrackletsOut";
828  TH1F* hNtrackletsOut=new TH1F(hname.Data(),"Number of tracklets out of Centrality range;ntracklets;Entries",5000,-0.5,4999.5);
829 
830  hname="hMultOut";
831  TH1F* hMultOut=new TH1F(hname.Data(),"Multiplicity out of Centrality range;multiplicity;Entries",10000,-0.5,9999.5);
832 
833  hname="hMultvsPercentile";
834  TH2F* hMultvsPercentile=new TH2F(hname.Data(),"Multiplicity vs Percentile;multiplicity;percentile",10000,-0.5,9999.5,240,-10.,110);
835 
836  hname="hntrklvsPercentile";
837  TH2F* hntrklvsPercentile=new TH2F(hname.Data(),"N tracklets vs Percentile;ntracklets;percentile",5000,-0.5,4999.5,240,-10.,110);
838 
839  hname="hntrklvsPercentile01";
840  TH2F* hntrklvsPercentile01=new TH2F(hname.Data(),"N tracklets vs Percentile |#eta|<1;ntracklets;percentile",5000,-0.5,4999.5,240,-10.,110);
841 
842  hname="hntrklvsPercentile01AllEv";
843  TH2F* hntrklvsPercentile01AllEv=new TH2F(hname.Data(),"N tracklets vs Percentile |#eta|<1 - All Events;ntracklets;percentile",5000,-0.5,4999.5,240,-10.,110);
844 
845  hname="hnTPCTracksvsPercentile";
846  TH2F* hnTPCTracksvsPercentile=new TH2F(hname.Data(),"N TPC tracks vs Percentile;nTPCTracks;percentile",5000,-0.5,9999.5,240,-10.,110);
847 
848  hname="hnTPCITSTracksvsPercentile";
849  TH2F* hnTPCITSTracksvsPercentile=new TH2F(hname.Data(),"N TPC+ITS tracks vs Percentile;nTPCITSTracks;percentile",5000,-0.5,9999.5,240,-10.,110);
850 
851  hname="hnTPCITS1SPDTracksvsPercentile";
852  TH2F* hnTPCITS1SPDTracksvsPercentile=new TH2F(hname.Data(),"N TPC+ITS+1SPD tracks vs Percentile;nTPCITS1SPDTracks;percentile",5000,-0.5,9999.5,240,-10.,110);
853 
854  hname="hStdEstimSignalPercentile";
855  TH2F*hStdEstimSignalPercentile = new TH2F(hname.Data(),"Std estimator signal vs Percentile;Std estimator signal;percentile",1000,-0.5,9999.5,120,-10.,110);
856 
857  hname="hStdEstimSignalNtrackletsIn";
858  TH2F*hStdEstimSignalNtrackletsIn = new TH2F(hname.Data(),"Std estimator signal vs Number of tracklets in the CC;Std estimator signal;number of tracklets",1000,-0.5,9999.5,5000,-0.5,4999.5);
859 
860  hname="hStdEstimSignal";
861  TH1F*hStdEstimSignal = new TH1F(hname.Data(),"Std estimator signal",700,0,1400);
862 
863  hname="hStdPercentileSecondPercentile";
864  TH2F* hStdPercentileSecondPercentile = new TH2F(hname.Data(),"Std estimator Percentile Vs Second Estimator Percentile;Std estimator percentile;Second estimator percentile",120,-10.,110,120,-10.,110);
865 
866  hname="hStdSignalSecondSignal";
867  TH2F* hStdSignalSecondSignal = new TH2F(hname.Data(),"Std estimator signal Vs Second Estimator signal;Std estimator;Second estimator",1000,-0.5,9999.5,1000,-0.5,9999.5);
868 
869  fOutputCheckCentrality->Add(hNtrackletsIn);
870  fOutputCheckCentrality->Add(hNtrackletsOut);
871  fOutputCheckCentrality->Add(hMultIn);
872  fOutputCheckCentrality->Add(hMultOut);
873  fOutputCheckCentrality->Add(hMultvsPercentile);
874  fOutputCheckCentrality->Add(hntrklvsPercentile);
875  fOutputCheckCentrality->Add(hntrklvsPercentile01);
876  fOutputCheckCentrality->Add(hntrklvsPercentile01AllEv);
877  fOutputCheckCentrality->Add(hnTPCTracksvsPercentile);
878  fOutputCheckCentrality->Add(hnTPCITSTracksvsPercentile);
879  fOutputCheckCentrality->Add(hnTPCITS1SPDTracksvsPercentile);
880  fOutputCheckCentrality->Add(hStdEstimSignalPercentile);
881  fOutputCheckCentrality->Add(hStdEstimSignal);
882  fOutputCheckCentrality->Add(hStdEstimSignalNtrackletsIn);
883  fOutputCheckCentrality->Add(hStdPercentileSecondPercentile);
884  fOutputCheckCentrality->Add(hStdSignalSecondSignal);
885 
886  PostData(6,fOutputCheckCentrality);
887 
888  } else{
889  if(fOnOff[0]){
890  TString hname="hNtracklets";
891  TH1F* hNtracklets=new TH1F(hname.Data(),"Number of tracklets;ntracklets;Entries",5000,-0.5,4999.5);
892  hname="hNtracklets01";
893  TH1F* hNtracklets01=new TH1F(hname.Data(),"Number of tracklets |#eta|<1;ntracklets;Entries",5000,-0.5,4999.5);
894  hname="hNtracklets01AllEv";
895  TH1F* hNtracklets01AllEv=new TH1F(hname.Data(),"Number of tracklets |#eta|<1 - All events;ntracklets;Entries",5000,-0.5,4999.5);
896  hname="hMult";
897  TH1F* hMult=new TH1F(hname.Data(),"Multiplicity;multiplicity;Entries",10000,-0.5,9999.5);
898  hname="hMultFBit4";
899  TH1F* hMultFBit4=new TH1F(hname.Data(),"Multiplicity (global+tracklet) with filter bit 4;multiplicity;Entries",10000,-0.5,9999.5);
900  hname="hMultComb05";
901  TH1F* hMultC05=new TH1F(hname.Data(),"Multiplicity (global+tracklet) in |#eta|<0.5;multiplicity;Entries",10000,-0.5,9999.5);
902  hname="hMultComb08";
903  TH1F* hMultC08=new TH1F(hname.Data(),"Multiplicity (global+tracklet) in |#eta|<0.8;multiplicity;Entries",10000,-0.5,9999.5);
904 
905  fOutputTrack->Add(hNtracklets);
906  fOutputTrack->Add(hNtracklets01);
907  fOutputTrack->Add(hNtracklets01AllEv);
908  fOutputTrack->Add(hMult);
909  fOutputTrack->Add(hMultFBit4);
910  fOutputTrack->Add(hMultC05);
911  fOutputTrack->Add(hMultC08);
912  }
913  }
914 
915  //event selection (z vertex for the moment)
916  if(fOnOff[3]){
917  fOutputEvSelection=new TList();
918  fOutputEvSelection->SetOwner();
919  fOutputEvSelection->SetName(GetOutputSlot(7)->GetContainer()->GetName());
920  AliCounterCollection *evselection=new AliCounterCollection("evselection");
921  evselection->AddRubric("run",500000);
922  evselection->AddRubric("evnonsel","zvtx");
923  evselection->Init();
924 
925  TH1F* hxvtx=new TH1F("hxvtx", "Distribution of x_{VTX};x_{VTX} [cm];Entries",800,-1,1);
926  TH1F* hyvtx=new TH1F("hyvtx", "Distribution of y_{VTX};y_{VTX} [cm];Entries",800,-1,1);
927  TH1F* hzvtx=new TH1F("hzvtx", "Distribution of z_{VTX};z_{VTX} [cm];Entries",800,-30,30);
928  TH1F* hxvtxSelEv=new TH1F("hxvtxSelEv", "Distribution of x_{VTX} Selected Ev;x_{VTX} [cm];Entries",800,-1,1);
929  TH1F* hyvtxSelEv=new TH1F("hyvtxSelEv", "Distribution of y_{VTX} Selected Ev;y_{VTX} [cm];Entries",800,-1,1);
930  TH1F* hzvtxSelEv=new TH1F("hzvtxSelEv", "Distribution of z_{VTX} Selected Ev;z_{VTX} [cm];Entries",800,-30,30);
931  TH1F* hWhichVert=new TH1F("hWhichVert","Vertex Type",4,-1.5,2.5);
932  hWhichVert->GetXaxis()->SetBinLabel(1,"Not found");
933  hWhichVert->GetXaxis()->SetBinLabel(2,"Track");
934  hWhichVert->GetXaxis()->SetBinLabel(3,"SPD-3D");
935  hWhichVert->GetXaxis()->SetBinLabel(4,"SPD-z");
936  TH1F* hWhichVertSelEv=new TH1F("hWhichVertSelEv","Vertex Type",4,-1.5,2.5);
937  hWhichVertSelEv->GetXaxis()->SetBinLabel(1,"Not found");
938  hWhichVertSelEv->GetXaxis()->SetBinLabel(2,"Track");
939  hWhichVertSelEv->GetXaxis()->SetBinLabel(3,"SPD-3D");
940  hWhichVertSelEv->GetXaxis()->SetBinLabel(4,"SPD-z");
941 
942  TH2F* hTrigCent=new TH2F("hTrigCent","Centrality vs. Trigger types",24,-1.5,22.5,12,-10,110);
943  hTrigCent->GetXaxis()->SetBinLabel(1,"All");
944  hTrigCent->GetXaxis()->SetBinLabel(2,"kAny");
945  hTrigCent->GetXaxis()->SetBinLabel(3,"kMB");
946  hTrigCent->GetXaxis()->SetBinLabel(4,"kINT7");
947  hTrigCent->GetXaxis()->SetBinLabel(5,"kINT8");
948  hTrigCent->GetXaxis()->SetBinLabel(6,"kCINT5");
949  hTrigCent->GetXaxis()->SetBinLabel(7,"kCent");
950  hTrigCent->GetXaxis()->SetBinLabel(8,"kSemiCent");
951  hTrigCent->GetXaxis()->SetBinLabel(9,"kEMC1");
952  hTrigCent->GetXaxis()->SetBinLabel(10,"kEMC7");
953  hTrigCent->GetXaxis()->SetBinLabel(11,"kEMC8");
954  hTrigCent->GetXaxis()->SetBinLabel(12,"kEMCJET7");
955  hTrigCent->GetXaxis()->SetBinLabel(13,"kEMCGAMMA7");
956  hTrigCent->GetXaxis()->SetBinLabel(14,"kEMCJET8");
957  hTrigCent->GetXaxis()->SetBinLabel(15,"kEMCGAMMA8");
958  hTrigCent->GetXaxis()->SetBinLabel(16,"Muons");
959  hTrigCent->GetXaxis()->SetBinLabel(17,"PHOS");
960  hTrigCent->GetXaxis()->SetBinLabel(18,"TRD");
961  hTrigCent->GetXaxis()->SetBinLabel(19,"TRDHJT");
962  hTrigCent->GetXaxis()->SetBinLabel(20,"TRDHSE");
963  hTrigCent->GetXaxis()->SetBinLabel(21,"HighMult");
964  hTrigCent->GetXaxis()->SetBinLabel(22,"SPI7");
965  hTrigCent->GetXaxis()->SetBinLabel(23,"SPI8");
966  hTrigCent->GetXaxis()->SetBinLabel(24,"Others");
967 
968  TH2F* hTrigMul=new TH2F("hTrigMul","Multiplicity vs. Trigger types",24,-1.5,22.5,1000,0.,10000.);
969  hTrigMul->GetXaxis()->SetBinLabel(1,"All");
970  hTrigMul->GetXaxis()->SetBinLabel(2,"kAny");
971  hTrigMul->GetXaxis()->SetBinLabel(3,"kMB");
972  hTrigMul->GetXaxis()->SetBinLabel(4,"kINT7");
973  hTrigMul->GetXaxis()->SetBinLabel(5,"kINT8");
974  hTrigMul->GetXaxis()->SetBinLabel(6,"kCINT5");
975  hTrigMul->GetXaxis()->SetBinLabel(7,"kCent");
976  hTrigMul->GetXaxis()->SetBinLabel(8,"kSemiCent");
977  hTrigMul->GetXaxis()->SetBinLabel(9,"kEMC1");
978  hTrigMul->GetXaxis()->SetBinLabel(10,"kEMC7");
979  hTrigMul->GetXaxis()->SetBinLabel(11,"kEMC8");
980  hTrigMul->GetXaxis()->SetBinLabel(12,"kEMCJET7");
981  hTrigMul->GetXaxis()->SetBinLabel(13,"kEMCGAMMA7");
982  hTrigMul->GetXaxis()->SetBinLabel(14,"kEMCJET8");
983  hTrigMul->GetXaxis()->SetBinLabel(15,"kEMCGAMMA8");
984  hTrigMul->GetXaxis()->SetBinLabel(16,"Muons");
985  hTrigMul->GetXaxis()->SetBinLabel(17,"PHOS");
986  hTrigMul->GetXaxis()->SetBinLabel(18,"TRD");
987  hTrigMul->GetXaxis()->SetBinLabel(19,"TRDHJT");
988  hTrigMul->GetXaxis()->SetBinLabel(20,"TRDHSE");
989  hTrigMul->GetXaxis()->SetBinLabel(21,"HighMult");
990  hTrigMul->GetXaxis()->SetBinLabel(22,"SPI7");
991  hTrigMul->GetXaxis()->SetBinLabel(23,"SPI8");
992  hTrigMul->GetXaxis()->SetBinLabel(24,"Others");
993 
994  TH2F* hTrigCentSel=new TH2F("hTrigCentSel","Trigger types",24,-1.5,22.5,12,-10,110);
995  hTrigCentSel->GetXaxis()->SetBinLabel(1,"All");
996  hTrigCentSel->GetXaxis()->SetBinLabel(2,"kAny");
997  hTrigCentSel->GetXaxis()->SetBinLabel(3,"kMB");
998  hTrigCentSel->GetXaxis()->SetBinLabel(4,"kINT7");
999  hTrigCentSel->GetXaxis()->SetBinLabel(5,"kINT8");
1000  hTrigCentSel->GetXaxis()->SetBinLabel(6,"kCINT5");
1001  hTrigCentSel->GetXaxis()->SetBinLabel(7,"kCent");
1002  hTrigCentSel->GetXaxis()->SetBinLabel(8,"kSemiCent");
1003  hTrigCentSel->GetXaxis()->SetBinLabel(9,"kEMC1");
1004  hTrigCentSel->GetXaxis()->SetBinLabel(10,"kEMC7");
1005  hTrigCentSel->GetXaxis()->SetBinLabel(11,"kEMC8");
1006  hTrigCentSel->GetXaxis()->SetBinLabel(12,"kEMCJET7");
1007  hTrigCentSel->GetXaxis()->SetBinLabel(13,"kEMCGAMMA7");
1008  hTrigCentSel->GetXaxis()->SetBinLabel(14,"kEMCJET8");
1009  hTrigCentSel->GetXaxis()->SetBinLabel(15,"kEMCGAMMA8");
1010  hTrigCentSel->GetXaxis()->SetBinLabel(16,"Muons");
1011  hTrigCentSel->GetXaxis()->SetBinLabel(17,"PHOS");
1012  hTrigCentSel->GetXaxis()->SetBinLabel(18,"TRD");
1013  hTrigCentSel->GetXaxis()->SetBinLabel(19,"TRDHJT");
1014  hTrigCentSel->GetXaxis()->SetBinLabel(20,"TRDHSE");
1015  hTrigCentSel->GetXaxis()->SetBinLabel(21,"HighMult");
1016  hTrigCentSel->GetXaxis()->SetBinLabel(22,"SPI7");
1017  hTrigCentSel->GetXaxis()->SetBinLabel(23,"SPI8");
1018  hTrigCentSel->GetXaxis()->SetBinLabel(24,"Others");
1019 
1020  TH2F* hTrigMulSel=new TH2F("hTrigMulSel","Multiplicity after selection vs. Trigger types",24,-1.5,22.5,1000,0.,10000.);
1021  hTrigMulSel->GetXaxis()->SetBinLabel(1,"All");
1022  hTrigMulSel->GetXaxis()->SetBinLabel(2,"kAny");
1023  hTrigMulSel->GetXaxis()->SetBinLabel(3,"kMB");
1024  hTrigMulSel->GetXaxis()->SetBinLabel(4,"kINT7");
1025  hTrigMulSel->GetXaxis()->SetBinLabel(5,"kINT8");
1026  hTrigMulSel->GetXaxis()->SetBinLabel(6,"kCINT5");
1027  hTrigMulSel->GetXaxis()->SetBinLabel(7,"kCent");
1028  hTrigMulSel->GetXaxis()->SetBinLabel(8,"kSemiCent");
1029  hTrigMulSel->GetXaxis()->SetBinLabel(9,"kEMC1");
1030  hTrigMulSel->GetXaxis()->SetBinLabel(10,"kEMC7");
1031  hTrigMulSel->GetXaxis()->SetBinLabel(11,"kEMC8");
1032  hTrigMulSel->GetXaxis()->SetBinLabel(12,"kEMCJET7");
1033  hTrigMulSel->GetXaxis()->SetBinLabel(13,"kEMCGAMMA7");
1034  hTrigMulSel->GetXaxis()->SetBinLabel(14,"kEMCJET8");
1035  hTrigMulSel->GetXaxis()->SetBinLabel(15,"kEMCGAMMA8");
1036  hTrigMulSel->GetXaxis()->SetBinLabel(16,"Muons");
1037  hTrigMulSel->GetXaxis()->SetBinLabel(17,"PHOS");
1038  hTrigMulSel->GetXaxis()->SetBinLabel(18,"TRD");
1039  hTrigMulSel->GetXaxis()->SetBinLabel(19,"TRDHJT");
1040  hTrigMulSel->GetXaxis()->SetBinLabel(20,"TRDHSE");
1041  hTrigMulSel->GetXaxis()->SetBinLabel(21,"HighMult");
1042  hTrigMulSel->GetXaxis()->SetBinLabel(22,"SPI7");
1043  hTrigMulSel->GetXaxis()->SetBinLabel(23,"SPI8");
1044  hTrigMulSel->GetXaxis()->SetBinLabel(24,"Others");
1045 
1046  AliCounterCollection *trigCounter=new AliCounterCollection("trigCounter");
1047  trigCounter->AddRubric("run",500000);
1048  trigCounter->AddRubric("triggerType","All/Any/MB/Cent/SemiCent/EMCAL/MUON/NoPhysSelMUON/NoPhysSelEvNot7/NoPhysSelCMUP1/NoPhysSelMB/NoPhysSelCent/NoPhysSelSemiCent/CINT7/INT8");
1049  trigCounter->Init();
1050 
1051  AliCounterCollection *trigCounter2=new AliCounterCollection("trigCounter2");
1052  trigCounter2->AddRubric("run",500000);
1053  trigCounter2->AddRubric("triggerType","All/Any/MB/CINT7/INT8/NoPhysSelEvNot7/NoPhysSelMB/HighMult/SPI7/SPI8/EMC1/EMC7/EMC8/EMCJET7/EMCJET8/EMCGAMMA/TRD/TRDHJT/TRDHSE");
1054  trigCounter2->Init();
1055 
1056  TH1F* hWhyEvRejected=new TH1F("hWhyEvRejected", "Why Event rejected",7,-1.5,5.5);
1057 
1058  hWhyEvRejected->GetXaxis()->SetBinLabel(1,"N events");
1059  hWhyEvRejected->GetXaxis()->SetBinLabel(2,"pileup");
1060  hWhyEvRejected->GetXaxis()->SetBinLabel(3,"centrality");
1061  hWhyEvRejected->GetXaxis()->SetBinLabel(4,"Vertex not found");
1062  hWhyEvRejected->GetXaxis()->SetBinLabel(5,"trigger");
1063  hWhyEvRejected->GetXaxis()->SetBinLabel(6,"z vertex out of 10 cm");
1064  hWhyEvRejected->GetXaxis()->SetBinLabel(7,"physics sel");
1065 
1066 
1067  fOutputEvSelection->Add(evselection);
1068  fOutputEvSelection->Add(hxvtx);
1069  fOutputEvSelection->Add(hyvtx);
1070  fOutputEvSelection->Add(hzvtx);
1071  fOutputEvSelection->Add(hxvtxSelEv);
1072  fOutputEvSelection->Add(hyvtxSelEv);
1073  fOutputEvSelection->Add(hzvtxSelEv);
1074  fOutputEvSelection->Add(hWhichVert);
1075  fOutputEvSelection->Add(hWhichVertSelEv);
1076  fOutputEvSelection->Add(hTrigCent);
1077  fOutputEvSelection->Add(hTrigMul);
1078  fOutputEvSelection->Add(hTrigMulSel);
1079  fOutputEvSelection->Add(hTrigCentSel);
1080  fOutputEvSelection->Add(trigCounter);
1081  fOutputEvSelection->Add(trigCounter2);
1082  fOutputEvSelection->Add(hWhyEvRejected);
1083 
1084  }
1085  if(fOnOff[4]){ // FLOW OBSERVABLES
1086  fOutputFlowObs=new TList();
1087  fOutputFlowObs->SetOwner();
1088  fOutputFlowObs->SetName(GetOutputSlot(8)->GetContainer()->GetName());
1089 
1090  fFlowEvent = new AliFlowEvent(3000);
1091  fRFPcuts = new AliFlowTrackCuts("rfpCuts");
1092 
1093  TH2F *hFEvents = new TH2F("hFlowEvents","FlowEvent Selection",7,0,7,7,-10,60);
1094  hFEvents->GetXaxis()->SetBinLabel(1,"REACHED");
1095  hFEvents->GetXaxis()->SetBinLabel(2,"TRIGGERED");
1096  hFEvents->GetXaxis()->SetBinLabel(3,"kMB");
1097  hFEvents->GetXaxis()->SetBinLabel(4,"kCent");
1098  hFEvents->GetXaxis()->SetBinLabel(5,"kSemiC");
1099  hFEvents->GetXaxis()->SetBinLabel(6,"Triggered + vtx cut");
1100  hFEvents->GetXaxis()->SetBinLabel(7,"UnexpectedBehaviour");
1101  fOutputFlowObs->Add(hFEvents);
1102 
1103  TProfile2D *hQ[3];
1104  TH2F *hAngleQ[3];
1105  TH3F *hPhiEta[3];
1106  TString ref[3] = {"FB1","FB128","VZE"};
1107  Int_t etabin[3] = {40,40,20};
1108  Int_t etamax[3] = { 1, 1, 5};
1109  for(Int_t i=0; i<3; ++i) {
1110  hQ[i]= new TProfile2D( Form("h%s_Q",ref[i].Data()),
1111  Form("Q_{2} components for %s",ref[i].Data()),
1112  4,0,4,12,0,60,"s");
1113  hQ[i]->GetXaxis()->SetBinLabel(1,"Qx^{-}");
1114  hQ[i]->GetXaxis()->SetBinLabel(2,"Qy^{-}");
1115  hQ[i]->GetXaxis()->SetBinLabel(3,"Qx^{+}");
1116  hQ[i]->GetXaxis()->SetBinLabel(4,"Qy^{+}");
1117  hQ[i]->GetYaxis()->SetTitle("Centrality");
1118  fOutputFlowObs->Add(hQ[i]);
1119 
1120  hAngleQ[i] = new TH2F( Form("h%s_AngleQ",ref[i].Data()),
1121  Form("#Psi_{2} for %s",ref[i].Data()),
1122  72,0,TMath::Pi(),12,0,60);
1123  hAngleQ[i]->GetXaxis()->SetTitle( Form("#Psi_{2}^{%s}",ref[i].Data()) );
1124  hAngleQ[i]->GetYaxis()->SetTitle("Centrality");
1125  fOutputFlowObs->Add(hAngleQ[i]);
1126 
1127  hPhiEta[i] = new TH3F( Form("h%s_PhiEta",ref[i].Data()),
1128  Form("Eta vs Phi for %s",ref[i].Data()),
1129  144,0,TMath::TwoPi(),etabin[i],-1.0*etamax[i],+1.0*etamax[i],12,0,60);
1130  hPhiEta[i]->GetXaxis()->SetTitle("Phi");
1131  hPhiEta[i]->GetYaxis()->SetTitle("Eta");
1132  hPhiEta[i]->GetZaxis()->SetTitle("Centrality");
1133  fOutputFlowObs->Add(hPhiEta[i]);
1134 
1135  }
1136  TH3F *hTPCVZE_AngleQ = new TH3F("hTPCVZE_AngleQ","#Psi_{2}^{VZERO} vs #Psi_{2}^{TPC}", 72,0,TMath::Pi(),72,0,TMath::Pi(),12,0,60);
1137  hTPCVZE_AngleQ->GetXaxis()->SetTitle("#Psi_{2}^{TPC}");
1138  hTPCVZE_AngleQ->GetYaxis()->SetTitle("#Psi_{2}^{VZE}");
1139  hTPCVZE_AngleQ->GetZaxis()->SetTitle("Centrality");
1140  fOutputFlowObs->Add(hTPCVZE_AngleQ);
1141 
1142  TH2F *hCentVsMultRPS = new TH2F("hCentVsMultRPS", " Centrality Vs. Multiplicity RPs",5000, 0, 5000.,12,0,60 );
1143  hCentVsMultRPS->GetXaxis()->SetTitle("Multiplicity RPs");
1144  hCentVsMultRPS->GetYaxis()->SetTitle("Centrality");
1145  fOutputFlowObs->Add(hCentVsMultRPS);
1146  }
1147 
1148  // Post the data
1149  PostData(1,fOutputEntries);
1150 
1151  if(fOnOff[1]) PostData(2,fOutputPID);
1152  if(fOnOff[0]) PostData(3,fOutputTrack);
1153  PostData(4,fCuts);
1154  if(fOnOff[2]) PostData(5,fOutputCounters);
1155  if(fOnOff[3]) PostData(7,fOutputEvSelection);
1156  if(fOnOff[4]) PostData(8,fOutputFlowObs);
1157 
1158  if(!fOnOff[0] && !fOnOff[1] && !fOnOff[2]) AliError("Nothing will be filled!");
1159 }
1160 
1161 //___________________________________________________________________________
1162 void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
1163 {
1165 
1166  AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
1167  if(fDebug>2) printf("Analysing decay %d\n",fDecayChannel);
1168  // Post the data already here
1169  PostData(1,fOutputEntries);
1170  if(fOnOff[1]) PostData(2,fOutputPID);
1171  if(fOnOff[0]) PostData(3,fOutputTrack);
1172  PostData(4,fCuts);
1173  if(fOnOff[2]) {
1174  PostData(5,fOutputCounters);
1175  if(fCuts->GetUseCentrality()) PostData(6,fOutputCheckCentrality);
1176  }
1177 
1178  TClonesArray *arrayProng =0;
1179 
1180  // Load all the branches of the DeltaAOD - needed for SelectionBit counting
1181  TClonesArray *arrayProngD0toKpi =0;
1182  TClonesArray *arrayProng3Prong =0;
1183  TClonesArray *arrayProng4Prong =0;
1184  TClonesArray *arrayProngDstar =0;
1185  TClonesArray *arrayProngCascades =0;
1186 
1187  Int_t pdg=0;
1188  Int_t *pdgdaughters=0x0;
1189 
1190  if(!aod && AODEvent() && IsStandardAOD()) {
1191  // In case there is an AOD handler writing a standard AOD, use the AOD
1192  // event in memory rather than the input (ESD) event.
1193  aod = dynamic_cast<AliAODEvent*> (AODEvent());
1194  // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
1195  // have to taken from the AOD event hold by the AliAODExtension
1196  AliAODHandler* aodHandler = (AliAODHandler*)
1197  ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
1198  if(aodHandler->GetExtensions()) {
1199 
1200  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
1201  AliAODEvent *aodFromExt = ext->GetAOD();
1202 
1203  arrayProng3Prong =(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
1204  arrayProng4Prong =(TClonesArray*)aodFromExt->GetList()->FindObject("Charm4Prong");
1205  arrayProngD0toKpi =(TClonesArray*)aodFromExt->GetList()->FindObject("D0toKpi");
1206  arrayProngDstar =(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar");
1207  arrayProngCascades=(TClonesArray*)aodFromExt->GetList()->FindObject("CascadesHF");
1208 
1209  switch(fDecayChannel){
1210 
1211  case 0:
1212  arrayProng=arrayProng3Prong;
1213  pdg=411;
1214  if(fReadMC){
1215  pdgdaughters =new Int_t[3];
1216  pdgdaughters[0]=211;//pi
1217  pdgdaughters[1]=321;//K
1218  pdgdaughters[2]=211;//pi
1219  }
1220  break;
1221  case 1:
1222  arrayProng=arrayProngD0toKpi;
1223  pdg=421;
1224  if(fReadMC){
1225  pdgdaughters =new Int_t[2];
1226  pdgdaughters[0]=211;//pi
1227  pdgdaughters[1]=321;//K
1228  }
1229  break;
1230  case 2:
1231  arrayProng=arrayProngDstar;
1232  pdg=413;
1233  if(fReadMC){
1234  pdgdaughters =new Int_t[3];
1235  pdgdaughters[1]=211;//pi
1236  pdgdaughters[0]=321;//K
1237  pdgdaughters[2]=211;//pi (soft?)
1238  }
1239  break;
1240  case 3:
1241  arrayProng=arrayProng3Prong;
1242  pdg=431;
1243  if(fReadMC){
1244  pdgdaughters =new Int_t[3];
1245  pdgdaughters[0]=321;//K
1246  pdgdaughters[1]=321;//K
1247  pdgdaughters[2]=211;//pi
1248  }
1249  break;
1250  case 4:
1251  arrayProng=arrayProng4Prong;
1252  pdg=421;
1253  if(fReadMC){
1254  pdgdaughters =new Int_t[4];
1255  pdgdaughters[0]=321;
1256  pdgdaughters[1]=211;
1257  pdgdaughters[2]=211;
1258  pdgdaughters[3]=211;
1259  }
1260  break;
1261  case 5:
1262  arrayProng=arrayProng3Prong;
1263  pdg=4122;
1264  if(fReadMC){
1265  pdgdaughters =new Int_t[3];
1266  pdgdaughters[0]=2212;//p
1267  pdgdaughters[1]=321;//K
1268  pdgdaughters[2]=211;//pi
1269  }
1270  break;
1271  case kLambdactoV0:
1272  arrayProng=arrayProngCascades;
1273  pdg=4122;
1274  if(fReadMC){
1275  pdgdaughters =new Int_t[3];
1276  pdgdaughters[0]=2212;//p
1277  pdgdaughters[1]=211;//pi
1278  pdgdaughters[2]=211;//pi
1279  }
1280  break;
1281  }
1282  }
1283  } else if(aod) {
1284 
1285  arrayProng3Prong =(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
1286  arrayProng4Prong =(TClonesArray*)aod->GetList()->FindObject("Charm4Prong");
1287  arrayProngD0toKpi =(TClonesArray*)aod->GetList()->FindObject("D0toKpi");
1288  arrayProngDstar =(TClonesArray*)aod->GetList()->FindObject("Dstar");
1289  arrayProngCascades=(TClonesArray*)aod->GetList()->FindObject("CascadesHF");
1290 
1291  switch(fDecayChannel){
1292 
1293  case 0:
1294  arrayProng=arrayProng3Prong;
1295  pdg=411;
1296  if(fReadMC){
1297  pdgdaughters =new Int_t[3];
1298  pdgdaughters[0]=211;//pi
1299  pdgdaughters[1]=321;//K
1300  pdgdaughters[2]=211;//pi
1301  }
1302  break;
1303  case 1:
1304  arrayProng=arrayProngD0toKpi;
1305  pdg=421;
1306  if(fReadMC){
1307  pdgdaughters =new Int_t[2];
1308  pdgdaughters[0]=211;//pi
1309  pdgdaughters[1]=321;//K
1310  }
1311  break;
1312  case 2:
1313  arrayProng=arrayProngDstar;
1314  pdg=413;
1315  if(fReadMC){
1316  pdgdaughters =new Int_t[3];
1317  pdgdaughters[1]=211;//pi
1318  pdgdaughters[0]=321;//K
1319  pdgdaughters[2]=211;//pi (soft?)
1320  }
1321  break;
1322  case 3:
1323  arrayProng=arrayProng3Prong;
1324  pdg=431;
1325  if(fReadMC){
1326  pdgdaughters =new Int_t[3];
1327  pdgdaughters[0]=321;//K
1328  pdgdaughters[1]=321;//K
1329  pdgdaughters[2]=211;//pi
1330  }
1331  break;
1332  case 4:
1333  arrayProng=arrayProng4Prong;
1334  pdg=421;
1335  if(fReadMC){
1336  pdgdaughters =new Int_t[4];
1337  pdgdaughters[0]=321;
1338  pdgdaughters[1]=211;
1339  pdgdaughters[2]=211;
1340  pdgdaughters[3]=211;
1341  }
1342  break;
1343  case 5:
1344  arrayProng=arrayProng3Prong;
1345  pdg=4122;
1346  if(fReadMC){
1347  pdgdaughters =new Int_t[3];
1348  pdgdaughters[0]=2212;//p
1349  pdgdaughters[1]=321;//K
1350  pdgdaughters[2]=211;//pi
1351  }
1352  break;
1353  case kLambdactoV0:
1354  arrayProng=arrayProngCascades;
1355  pdg=4122;
1356  if(fReadMC){
1357  pdgdaughters =new Int_t[3];
1358  pdgdaughters[0]=2212;//p
1359  pdgdaughters[1]=211;//pi
1360  pdgdaughters[2]=211;//pi
1361  }
1362  break;
1363  }
1364  }
1365  Bool_t isSimpleMode=fSimpleMode;
1366  if(!arrayProng) {
1367  AliInfo("Branch not found! The output will contain only track related histograms\n");
1368  isSimpleMode=kTRUE;
1369  ((TH1F*)fOutputEntries->FindObject("hNentries"))->Fill(2);
1370  }
1371 
1372  TClonesArray *mcArray = 0;
1373  AliAODMCHeader *mcHeader = 0;
1374 
1375  if(!aod) {
1376  delete [] pdgdaughters;
1377  return;
1378  }
1379 
1380  //check if MC
1381  if(fReadMC) {
1382  // load MC particles
1383  mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
1384  if(!mcArray) {
1385  printf("AliAnalysisTaskSEHFQA::UserExec: MC particles branch not found!\n");
1386  delete [] pdgdaughters;
1387  return;
1388  }
1389 
1390  // load MC header
1391  mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1392  if(!mcHeader) {
1393  printf("AliAnalysisTaskSEHFQA::UserExec: MC header branch not found!\n");
1394  delete [] pdgdaughters;
1395  return;
1396  }
1397  }
1398 
1399 
1400  UInt_t evSelMask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1401  Double_t centrality=fCuts->GetCentrality(aod);
1402  AliAODHeader * header = dynamic_cast<AliAODHeader*>(aod->GetHeader());
1403  if(!header) AliFatal("Not a standard AOD");
1404 
1405  Double_t multiplicity=header->GetRefMultiplicity();
1406  Int_t runNumber = aod->GetRunNumber();
1407  TString trigClass=aod->GetFiredTriggerClasses();
1408  Int_t nAODtracks=aod->GetNumberOfTracks();
1409  Int_t nSelTracksTPCOnly=0;
1410  Int_t nSelTracksTPCITS=0;
1411  Int_t nSelTracksTPCITS1SPD=0;
1412  Int_t ntracksFBit4=0;
1413 
1414  AliTRDTriggerAnalysis trdSelection;
1415  trdSelection.CalcTriggers(aod);
1416 
1417  if(fReadMC) {
1418  if(aod->GetTriggerMask()==0 &&
1419  (runNumber>=195344 && runNumber<=195677)){
1420  AliDebug(3,"Event rejected because of null trigger mask");
1421  delete [] pdgdaughters;
1422  return;
1423  }
1424  }
1425 
1426  for (Int_t k=0;k<nAODtracks;k++){
1427  AliAODTrack* track=dynamic_cast<AliAODTrack*>(aod->GetTrack(k));
1428  if(!track) AliFatal("Not a standard AOD");
1429  if(track->GetID()<0) continue;
1430  Int_t nclsTot=0,nclsSPD=0;
1431  for(Int_t l=0;l<6;l++) {
1432  if(TESTBIT(track->GetITSClusterMap(),l)) {
1433  nclsTot++; if(l<2) nclsSPD++;
1434  }
1435  }
1436  UShort_t nTPCClus=track->GetTPCClusterMap().CountBits();
1437  if(TMath::Abs(track->Eta())<0.8 && nTPCClus>=70 && track->GetStatus()&AliESDtrack::kTPCrefit){
1438  if(track->TestFilterBit(1)) nSelTracksTPCOnly++;
1439  if(track->GetStatus()&AliESDtrack::kITSrefit){
1440  nSelTracksTPCITS++;
1441  if(nclsSPD>0) nSelTracksTPCITS1SPD++;
1442  }
1443  }
1444  if(track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)){
1445  ntracksFBit4++;
1446  }
1447  }
1448 
1449  if(fOnOff[4]) {
1450  FillFlowObs(aod);
1451  PostData(8,fOutputFlowObs);
1452  }
1453  if(fOnOff[3]){
1454  TH2F* hTrigC=(TH2F*)fOutputEvSelection->FindObject("hTrigCent");
1455  TH2F* hTrigM=(TH2F*)fOutputEvSelection->FindObject("hTrigMul");
1456  AliCounterCollection* trigCount=(AliCounterCollection*)fOutputEvSelection->FindObject("trigCounter");
1457  AliCounterCollection* trigCount2=(AliCounterCollection*)fOutputEvSelection->FindObject("trigCounter2");
1458 
1459  hTrigC->Fill(-1.,centrality);
1460  hTrigM->Fill(-1.,multiplicity);
1461  trigCount->Count(Form("triggerType:All/Run:%d",runNumber));
1462  trigCount2->Count(Form("triggerType:All/Run:%d",runNumber));
1463  if(evSelMask==0){
1464  if(aod->GetEventType()!=7 || trigClass.Contains("BEAMB")){
1465  trigCount->Count(Form("triggerType:NoPhysSelEvNot7/Run:%d",runNumber));
1466  trigCount2->Count(Form("triggerType:NoPhysSelEvNot7/Run:%d",runNumber));
1467  }else if(trigClass.Contains("CMUP1")){
1468  trigCount->Count(Form("triggerType:NoPhysSelCMUP1/Run:%d",runNumber));
1469  }else if(trigClass.Contains("MUON")){
1470  trigCount->Count(Form("triggerType:NoPhysSelMUON/Run:%d",runNumber));
1471  }else if(trigClass.Contains("CPBI2_B1-B") || trigClass.Contains(" CPBI2WU_B1-B")){
1472  trigCount->Count(Form("triggerType:NoPhysSelMB/Run:%d",runNumber));
1473  trigCount2->Count(Form("triggerType:NoPhysSelMB/Run:%d",runNumber));
1474  }else if(trigClass.Contains("CCENT") || trigClass.Contains("CVHN")){
1475  trigCount->Count(Form("triggerType:NoPhysSelCent/Run:%d",runNumber));
1476  }else if(trigClass.Contains("CSEMI") || trigClass.Contains("CVLN")){
1477  trigCount->Count(Form("triggerType:NoPhysSelSemiCent/Run:%d",runNumber));
1478  }
1479  }
1480  if(evSelMask & AliVEvent::kAny){
1481  hTrigC->Fill(0.,centrality);
1482  hTrigM->Fill(0.,multiplicity);
1483  trigCount->Count(Form("triggerType:Any/Run:%d",runNumber));
1484  trigCount2->Count(Form("triggerType:Any/Run:%d",runNumber));
1485  }
1486  if(evSelMask & AliVEvent::kMB){
1487  hTrigC->Fill(1.,centrality);
1488  hTrigM->Fill(1.,multiplicity);
1489  trigCount->Count(Form("triggerType:MB/Run:%d",runNumber));
1490  trigCount2->Count(Form("triggerType:MB/Run:%d",runNumber));
1491  }
1492  if(evSelMask & AliVEvent::kINT7){
1493  hTrigC->Fill(2.,centrality);
1494  hTrigM->Fill(2.,multiplicity);
1495  trigCount->Count(Form("triggerType:CINT7/Run:%d",runNumber));
1496  trigCount2->Count(Form("triggerType:CINT7/Run:%d",runNumber));
1497  }
1498  if(evSelMask & AliVEvent::kINT8){
1499  hTrigC->Fill(3.,centrality);
1500  hTrigM->Fill(3.,multiplicity);
1501  trigCount->Count(Form("triggerType:INT8/Run:%d",runNumber));
1502  trigCount2->Count(Form("triggerType:INT8/Run:%d",runNumber));
1503  }
1504  if(evSelMask & AliVEvent::kCINT5){
1505  hTrigC->Fill(4.,centrality);
1506  hTrigM->Fill(4.,multiplicity);
1507  }
1508  if(evSelMask & AliVEvent::kCentral){
1509  hTrigC->Fill(5.,centrality);
1510  hTrigM->Fill(5.,multiplicity);
1511  trigCount->Count(Form("triggerType:Cent/Run:%d",runNumber));
1512  }
1513  if(evSelMask & AliVEvent::kSemiCentral){
1514  hTrigC->Fill(6.,centrality);
1515  hTrigM->Fill(6.,multiplicity);
1516  trigCount->Count(Form("triggerType:SemiCent/Run:%d",runNumber));
1517  }
1518 
1519  if(evSelMask & AliVEvent::kEMC1){
1520  hTrigC->Fill(7.,centrality);
1521  hTrigM->Fill(7.,multiplicity);
1522  trigCount->Count(Form("triggerType:EMCAL/Run:%d",runNumber));
1523  trigCount2->Count(Form("triggerType:EMC1/Run:%d",runNumber));
1524  }
1525  if((evSelMask & AliVEvent::kEMC7) && trigClass.Contains("CEMC7")){
1526  hTrigC->Fill(8.,centrality);
1527  hTrigM->Fill(8.,multiplicity);
1528  trigCount->Count(Form("triggerType:EMCAL/Run:%d",runNumber));
1529  trigCount2->Count(Form("triggerType:EMC7/Run:%d",runNumber));
1530  }
1531  if((evSelMask & AliVEvent::kEMC8) && trigClass.Contains("CEMC8")){
1532  hTrigC->Fill(9.,centrality);
1533  hTrigM->Fill(9.,multiplicity);
1534  trigCount->Count(Form("triggerType:EMCAL/Run:%d",runNumber));
1535  trigCount2->Count(Form("triggerType:EMC8/Run:%d",runNumber));
1536  }
1537  if(evSelMask & AliVEvent::kEMCEJE){
1538  trigCount->Count(Form("triggerType:EMCAL/Run:%d",runNumber));
1539  if(trigClass.Contains("CEMC7EJE")) {
1540  trigCount2->Count(Form("triggerType:EMCJET7/Run:%d",runNumber));
1541  hTrigC->Fill(10.,centrality);
1542  hTrigM->Fill(10.,multiplicity);
1543 
1544  }
1545  else if(trigClass.Contains("CEMC8EJE")) {
1546  trigCount2->Count(Form("triggerType:EMCJET8/Run:%d",runNumber));
1547  hTrigC->Fill(12.,centrality);
1548  hTrigM->Fill(12.,multiplicity);
1549  }
1550  }
1551  if(evSelMask & AliVEvent::kEMCEGA){
1552  if(trigClass.Contains("CEMC7EGA")) {
1553  hTrigC->Fill(11.,centrality);
1554  hTrigM->Fill(11.,multiplicity);
1555  } else if (trigClass.Contains("CEMC8EGA")){
1556  hTrigC->Fill(13.,centrality);
1557  hTrigM->Fill(13.,multiplicity);
1558 
1559  }
1560  trigCount->Count(Form("triggerType:EMCAL/Run:%d",runNumber));
1561  trigCount2->Count(Form("triggerType:EMCGAMMA/Run:%d",runNumber));
1562  }
1563  if(evSelMask & (((AliVEvent::kCMUS5 | AliVEvent::kMUSH7) | (AliVEvent::kMUL7 | AliVEvent::kMUU7)) | (AliVEvent::kMUS7 | AliVEvent::kMUON))){
1564  hTrigC->Fill(14.,centrality);
1565  hTrigM->Fill(14.,multiplicity);
1566  trigCount->Count(Form("triggerType:MUON/Run:%d",runNumber));
1567  }
1568  if(evSelMask & (AliVEvent::kPHI1 | AliVEvent::kPHI7)){
1569  hTrigC->Fill(15.,centrality);
1570  hTrigM->Fill(15.,multiplicity);
1571  }
1572  if(evSelMask & (AliVEvent::kTRD)){
1573  hTrigC->Fill(16.,centrality);
1574  hTrigM->Fill(16.,multiplicity);
1575  trigCount2->Count(Form("triggerType:TRD/Run:%d",runNumber));
1576  }
1577  if((evSelMask & AliVEvent::kTRD) && trdSelection.IsFired(AliTRDTriggerAnalysis::kHJT)){
1578  hTrigC->Fill(17.,centrality);
1579  hTrigM->Fill(17.,multiplicity);
1580  trigCount2->Count(Form("triggerType:TRDHJT/Run:%d",runNumber));
1581  }
1582  if((evSelMask & AliVEvent::kTRD) && trdSelection.IsFired(AliTRDTriggerAnalysis::kHSE)){
1583  hTrigC->Fill(18.,centrality);
1584  hTrigM->Fill(18.,multiplicity);
1585  trigCount2->Count(Form("triggerType:TRDHSE/Run:%d",runNumber));
1586  }
1587  if(evSelMask & (AliVEvent::kHighMult)){
1588  hTrigC->Fill(19.,centrality);
1589  hTrigM->Fill(19.,multiplicity);
1590  trigCount2->Count(Form("triggerType:HighMult/Run:%d",runNumber));
1591  }
1592  if(evSelMask & AliVEvent::kSPI7){
1593  if(trigClass.Contains("CSPI7")) {
1594  hTrigC->Fill(20.,centrality);
1595  hTrigM->Fill(20.,multiplicity);
1596  trigCount2->Count(Form("triggerType:SPI7/Run:%d",runNumber));
1597  }
1598  }
1599  if(evSelMask & AliVEvent::kSPI){
1600  if(trigClass.Contains("CSPI8")) {
1601  hTrigC->Fill(21.,centrality);
1602  hTrigM->Fill(21.,multiplicity);
1603  trigCount2->Count(Form("triggerType:SPI8/Run:%d",runNumber));
1604  }
1605  }
1606  if(evSelMask & (AliVEvent::kDG5 | AliVEvent::kZED)){
1607  hTrigC->Fill(22.,centrality);
1608  hTrigM->Fill(22.,multiplicity);
1609  }
1610  }
1611 
1612 
1613  // fix for temporary bug in ESDfilter
1614  // the AODs with null vertex pointer didn't pass the PhysSel
1615  Double_t magField = aod->GetMagneticField();
1616  if(!aod->GetPrimaryVertex() || TMath::Abs(magField)<0.001) {
1617  delete [] pdgdaughters;
1618  return;
1619  }
1620 
1621  // count event
1622  ((TH1F*)fOutputEntries->FindObject("hNentries"))->Fill(0);
1623  //count events with good vertex
1624  // AOD primary vertex
1625  AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
1626  Double_t pos[3],cov[6];
1627  vtx1->GetXYZ(pos);
1628  vtx1->GetCovarianceMatrix(cov);
1629  const AliESDVertex vESD(pos,cov,100.,100);
1630 
1631  TString primTitle = vtx1->GetTitle();
1632  if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0) ((TH1F*)fOutputEntries->FindObject("hNentries"))->Fill(4);
1633 
1634  // trigger class for PbPb C0SMH-B-NOPF-ALLNOTRD, C0SMH-B-NOPF-ALL
1635  //TString trigclass=aod->GetFiredTriggerClasses();
1636  //if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) hNentries->Fill(5); //tmp
1637 
1638 
1639 
1640 
1641  Bool_t evSelbyCentrality=kTRUE,evSelected=kTRUE,evSelByVertex=kTRUE,evselByPileup=kTRUE,evSelByPS=kTRUE;
1642 
1643  TH1F* hWhyEvRejected=0x0;
1644  if(fOnOff[3]){
1645  hWhyEvRejected=(TH1F*)fOutputEvSelection->FindObject("hWhyEvRejected");
1646  if(hWhyEvRejected) hWhyEvRejected->Fill(-1);
1647  }
1648 
1649  //select event
1650  if(!fCuts->IsEventSelected(aod)) {
1651  evSelected=kFALSE;
1653  if(hWhyEvRejected) hWhyEvRejected->Fill(0);
1654  evselByPileup=kFALSE;
1655  }// rejected for pileup
1657  if(hWhyEvRejected) hWhyEvRejected->Fill(1);
1658  evSelbyCentrality=kFALSE; //rejected by centrality
1659  }
1662  evSelByVertex=kFALSE;
1663  if(hWhyEvRejected) hWhyEvRejected->Fill(2);
1664  }
1666  if(hWhyEvRejected) hWhyEvRejected->Fill(3);
1667  }
1669  evSelByVertex=kFALSE;
1670  if(fOnOff[3]) ((AliCounterCollection*)fOutputEvSelection->FindObject("evselection"))->Count(Form("evnonsel:zvtx/Run:%d",runNumber));
1671  if(hWhyEvRejected) hWhyEvRejected->Fill(4);
1672  }
1674  evSelByPS=kFALSE;
1675  if(hWhyEvRejected) hWhyEvRejected->Fill(5);
1676  }
1677  }
1678  if(evSelected && fOnOff[3]){
1679  TH2F* hTrigS=(TH2F*)fOutputEvSelection->FindObject("hTrigCentSel");
1680  TH2F* hTrigSM=(TH2F*)fOutputEvSelection->FindObject("hTrigMulSel");
1681  hTrigS->Fill(-1.,centrality);
1682  hTrigSM->Fill(-1.,multiplicity);
1683  if(evSelMask & AliVEvent::kAny) {
1684  hTrigS->Fill(0.,centrality);
1685  hTrigSM->Fill(0.,multiplicity);}
1686  if(evSelMask & AliVEvent::kMB) {
1687  hTrigS->Fill(1.,centrality);
1688  hTrigSM->Fill(1.,multiplicity);}
1689  if(evSelMask & AliVEvent::kINT7){
1690  hTrigS->Fill(2.,centrality);
1691  hTrigSM->Fill(2.,multiplicity);}
1692  if(evSelMask & AliVEvent::kINT8){
1693  hTrigS->Fill(3.,centrality);
1694  hTrigSM->Fill(3.,multiplicity);}
1695  if(evSelMask & AliVEvent::kCINT5){
1696  hTrigS->Fill(4.,centrality);
1697  hTrigSM->Fill(4.,multiplicity);}
1698  if(evSelMask & AliVEvent::kCentral){
1699  hTrigS->Fill(5.,centrality);
1700  hTrigSM->Fill(5.,multiplicity);}
1701  if(evSelMask & AliVEvent::kSemiCentral){
1702  hTrigS->Fill(6.,centrality);
1703  hTrigSM->Fill(6.,multiplicity);}
1704  if(evSelMask & AliVEvent::kEMC1){
1705  hTrigS->Fill(7.,centrality);
1706  hTrigSM->Fill(7.,multiplicity);
1707  }
1708  if((evSelMask & AliVEvent::kEMC7) && trigClass.Contains("CEMC7")){
1709  hTrigS->Fill(8.,centrality);
1710  hTrigSM->Fill(8.,multiplicity);
1711  }
1712  if((evSelMask & AliVEvent::kEMC8) && trigClass.Contains("CEMC8")){
1713  hTrigS->Fill(9.,centrality);
1714  hTrigSM->Fill(9.,multiplicity);
1715  }
1716  if((evSelMask & AliVEvent::kEMCEJE) && trigClass.Contains("CEMC7EJE")){
1717  hTrigS->Fill(10.,centrality);
1718  hTrigSM->Fill(10.,multiplicity);
1719  }
1720  if((evSelMask & AliVEvent::kEMCEGA) && trigClass.Contains("CEMC7EGA")){
1721  hTrigS->Fill(11.,centrality);
1722  hTrigSM->Fill(11.,multiplicity);
1723  }
1724  if((evSelMask & AliVEvent::kEMCEJE) && trigClass.Contains("CEMC8EJE")){
1725  hTrigS->Fill(12.,centrality);
1726  hTrigSM->Fill(12.,multiplicity);
1727  }
1728  if((evSelMask & AliVEvent::kEMCEGA) && trigClass.Contains("CEMC8EGA")){
1729  hTrigS->Fill(13.,centrality);
1730  hTrigSM->Fill(13.,multiplicity);
1731  }
1732  if(evSelMask & (((AliVEvent::kCMUS5 | AliVEvent::kMUSH7) | (AliVEvent::kMUL7 | AliVEvent::kMUU7)) | (AliVEvent::kMUS7 | AliVEvent::kMUON))){
1733  hTrigS->Fill(14.,centrality);
1734  hTrigSM->Fill(14.,multiplicity);}
1735  if(evSelMask & (AliVEvent::kPHI1 | AliVEvent::kPHI7)){
1736  hTrigS->Fill(15.,centrality);
1737  hTrigSM->Fill(15.,multiplicity);}
1738  if(evSelMask & (AliVEvent::kTRD)){
1739  hTrigS->Fill(16.,centrality);
1740  hTrigSM->Fill(16.,multiplicity);
1741  }
1742  if((evSelMask & AliVEvent::kTRD) && trdSelection.IsFired(AliTRDTriggerAnalysis::kHJT)){
1743  hTrigS->Fill(17.,centrality);
1744  hTrigSM->Fill(17.,multiplicity);
1745  }
1746  if((evSelMask & AliVEvent::kTRD) && trdSelection.IsFired(AliTRDTriggerAnalysis::kHSE)){
1747  hTrigS->Fill(18.,centrality);
1748  hTrigSM->Fill(18.,multiplicity);
1749  }
1750  if(evSelMask & (AliVEvent::kHighMult)){
1751  hTrigS->Fill(19.,centrality);
1752  hTrigSM->Fill(19.,multiplicity);}
1753  if(evSelMask & AliVEvent::kSPI7){
1754  if(trigClass.Contains("CSPI7")) {
1755  hTrigS->Fill(20.,centrality);
1756  hTrigSM->Fill(20.,multiplicity);
1757  }
1758  }
1759  if(evSelMask & AliVEvent::kSPI){
1760  if(trigClass.Contains("CSPI8")) {
1761  hTrigS->Fill(21.,centrality);
1762  hTrigSM->Fill(21.,multiplicity);
1763  }
1764  }
1765  if(evSelMask & (AliVEvent::kDG5 | AliVEvent::kZED)){
1766  hTrigS->Fill(22.,centrality);
1767  hTrigSM->Fill(22.,multiplicity);}
1768  }
1769 
1770  if(evSelected || (!evSelbyCentrality && evSelByVertex && evselByPileup && evSelByPS)){ //events selected or not selected because of centrality
1771  if(fOnOff[2] && fCuts->GetUseCentrality()){
1772 
1773  Float_t stdCentf=fCuts->GetCentrality(aod);
1774  Int_t stdCent = (Int_t)(stdCentf+0.5);
1775  Float_t secondCentf =fCuts->GetCentrality(aod,fEstimator);
1776  Int_t secondCent = (Int_t)(secondCentf+0.5);
1777  Int_t mincent=stdCent-stdCent%10;
1778  Float_t stdSignal = 0.;
1779  Float_t secondSignal = 0.;
1780  AliAODVZERO *vzeroAOD = (AliAODVZERO*)aod->GetVZEROData();
1781  AliAODZDC *zdcAOD = (AliAODZDC*)aod->GetZDCData();
1782  const Double_t *towerZNASignal = zdcAOD->GetZNATowerEnergy();
1783  switch(fCuts->GetUseCentrality())
1784  {
1785  case AliRDHFCuts::kCentV0M:
1786  stdSignal = vzeroAOD->GetMTotV0A() + vzeroAOD->GetMTotV0C();
1787  break;
1788  case AliRDHFCuts::kCentV0A:
1789  stdSignal = vzeroAOD->GetMTotV0A();
1790  break;
1791  case AliRDHFCuts::kCentZNA:
1792  stdSignal = towerZNASignal[0];
1793  break;
1794  default:
1795  stdSignal = 0.;
1796  break;
1797  }
1798  switch(fEstimator)
1799  {
1800  case AliRDHFCuts::kCentV0M:
1801  secondSignal = vzeroAOD->GetMTotV0A() + vzeroAOD->GetMTotV0C();
1802  break;
1803  case AliRDHFCuts::kCentV0A:
1804  secondSignal = vzeroAOD->GetMTotV0A();
1805  break;
1806  case AliRDHFCuts::kCentZNA:
1807  secondSignal = towerZNASignal[0];
1808  break;
1809  default:
1810  secondSignal = 0.;
1811  break;
1812  }
1813  //AliCentrality *aodcent = aod->GetCentrality();
1814  // Float_t spdCentf = aodcent->GetCentralityPercentile("CL1");
1815  if(stdCentf==-1) {
1816  mincent=-10;
1817  stdCent=-1;
1818  }
1819  if(mincent==100)mincent--;
1820  ((AliCounterCollection*)fOutputCounters->FindObject("stdEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber));
1821 
1822  mincent=secondCent-secondCent%10;
1823  if(secondCentf==-1) {
1824  mincent=-10;
1825  secondCent=-1;
1826  }
1827  if(mincent==100)mincent--;
1828  ((AliCounterCollection*)fOutputCounters->FindObject("secondEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber));
1829 
1830  if(stdCent<fCuts->GetMinCentrality() || stdCent>fCuts->GetMaxCentrality()){
1831  ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsOut"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
1832  ((TH1F*)fOutputCheckCentrality->FindObject("hMultOut"))->Fill(header->GetRefMultiplicity());
1833  }else{
1834  ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsIn"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
1835  ((TH1F*)fOutputCheckCentrality->FindObject("hMultIn"))->Fill(header->GetRefMultiplicity());
1836  }
1837  ((TH2F*)fOutputCheckCentrality->FindObject("hMultvsPercentile"))->Fill(header->GetRefMultiplicity(),stdCentf);
1838  ((TH2F*)fOutputCheckCentrality->FindObject("hntrklvsPercentile"))->Fill(aod->GetTracklets()->GetNumberOfTracklets(),stdCentf);
1839  ((TH2F*)fOutputCheckCentrality->FindObject("hntrklvsPercentile01"))->Fill(AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(aod,-1.,1.),stdCentf);
1840  ((TH2F*)fOutputCheckCentrality->FindObject("hnTPCTracksvsPercentile"))->Fill(nSelTracksTPCOnly,stdCentf);
1841  ((TH2F*)fOutputCheckCentrality->FindObject("hnTPCITSTracksvsPercentile"))->Fill(nSelTracksTPCITS,stdCentf);
1842  ((TH2F*)fOutputCheckCentrality->FindObject("hnTPCITS1SPDTracksvsPercentile"))->Fill(nSelTracksTPCITS1SPD,stdCentf);
1843  ((TH2F*)fOutputCheckCentrality->FindObject("hStdEstimSignalPercentile"))->Fill(stdSignal,stdCentf);
1844  ((TH1F*)fOutputCheckCentrality->FindObject("hStdEstimSignal"))->Fill(stdSignal);
1845  ((TH2F*)fOutputCheckCentrality->FindObject("hStdEstimSignalNtrackletsIn"))->Fill(stdSignal,aod->GetTracklets()->GetNumberOfTracklets());
1846  ((TH2F*)fOutputCheckCentrality->FindObject("hStdPercentileSecondPercentile"))->Fill(stdCentf,secondCentf);
1847  ((TH2F*)fOutputCheckCentrality->FindObject("hStdSignalSecondSignal"))->Fill(stdSignal,secondSignal);
1848 
1849  PostData(6,fOutputCheckCentrality);
1850 
1851  } else{
1852  if(fOnOff[0]){
1853  ((TH1F*)fOutputTrack->FindObject("hNtracklets"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
1854  ((TH1F*)fOutputTrack->FindObject("hNtracklets01"))->Fill(AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(aod,-1.,1.));
1855  ((TH1F*)fOutputTrack->FindObject("hMult"))->Fill(header->GetRefMultiplicity());
1856  ((TH1F*)fOutputTrack->FindObject("hMultFBit4"))->Fill(ntracksFBit4);
1857  ((TH1F*)fOutputTrack->FindObject("hMultComb05"))->Fill(header->GetRefMultiplicityComb05());
1858  ((TH1F*)fOutputTrack->FindObject("hMultComb08"))->Fill(header->GetRefMultiplicityComb08());
1859  }
1860  }
1861  }
1862 
1863  if(evSelected || (!evSelbyCentrality && evSelByVertex && evselByPileup && evSelByPS) || (!evSelByVertex && evselByPileup && evSelByPS)){ //events selected or not selected because of centrality
1864  if(fOnOff[2] && fCuts->GetUseCentrality()){
1865  ((TH2F*)fOutputCheckCentrality->FindObject("hntrklvsPercentile01AllEv"))->Fill(AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(aod,-1.,1.),fCuts->GetCentrality(aod));
1866  }else{
1867  if(fOnOff[0]){
1868  ((TH1F*)fOutputTrack->FindObject("hNtracklets01AllEv"))->Fill(AliVertexingHFUtils::GetNumberOfTrackletsInEtaRange(aod,-1.,1.));
1869  }
1870  }
1871  }
1872 
1873  if(fOnOff[3]){
1874  const AliVVertex *vertex = aod->GetPrimaryVertex();
1875  Double_t xvtx=vertex->GetX();
1876  Double_t yvtx=vertex->GetY();
1877  Double_t zvtx=vertex->GetZ();
1878  Int_t vtxTyp=0;
1879  if(vertex->GetNContributors()<=0) vtxTyp=-1;
1880  TString title=vertex->GetTitle();
1881  if(title.Contains("Z")) vtxTyp=2;
1882  if(title.Contains("3D")) vtxTyp=1;
1883  ((TH1F*)fOutputEvSelection->FindObject("hxvtx"))->Fill(xvtx);
1884  ((TH1F*)fOutputEvSelection->FindObject("hyvtx"))->Fill(yvtx);
1885  ((TH1F*)fOutputEvSelection->FindObject("hzvtx"))->Fill(zvtx);
1886  ((TH1F*)fOutputEvSelection->FindObject("hWhichVert"))->Fill(vtxTyp);
1887  if(evSelected){
1888  ((TH1F*)fOutputEvSelection->FindObject("hxvtxSelEv"))->Fill(xvtx);
1889  ((TH1F*)fOutputEvSelection->FindObject("hyvtxSelEv"))->Fill(yvtx);
1890  ((TH1F*)fOutputEvSelection->FindObject("hzvtxSelEv"))->Fill(zvtx);
1891  ((TH1F*)fOutputEvSelection->FindObject("hWhichVertSelEv"))->Fill(vtxTyp);
1892  }
1893  }
1894 
1895  if(!evSelected) {
1896  delete [] pdgdaughters;
1897  return; //discard all events not selected (vtx and/or centrality)
1898  }
1899 
1900 
1901  AliAODPidHF* pidHF=fCuts->GetPidHF();
1902  if(!pidHF) {
1903  delete [] pdgdaughters;
1904  return;
1905  }
1906 
1907  // load all the branches and fill the SelectionBit histo
1908  if(fUseSelectionBit && !isSimpleMode){
1909 
1910  //load branches
1911  Int_t nCand3Prong = arrayProng3Prong->GetEntriesFast();
1912  Int_t nCandD0toKpi = arrayProngD0toKpi->GetEntriesFast();
1913  Int_t nCandDstar = arrayProngDstar->GetEntriesFast();
1914 
1915  // D+, Ds and Lc
1916  for (Int_t iCand = 0; iCand < nCand3Prong; iCand++) {
1917  AliAODRecoDecayHF *d = (AliAODRecoDecayHF*)arrayProng3Prong->UncheckedAt(iCand);
1918  Double_t ptCand_selBit = d->Pt();
1919  if(fUseSelectionBit && d->GetSelectionMap()) {
1920  if(d->HasSelectionBit(AliRDHFCuts::kDplusCuts)) ((TH2F*)fOutputEntries->FindObject("HasSelBit"))->Fill(0.0,ptCand_selBit);
1921  if(d->HasSelectionBit(AliRDHFCuts::kDsCuts)) ((TH2F*)fOutputEntries->FindObject("HasSelBit"))->Fill(1.0,ptCand_selBit);
1922  if(d->HasSelectionBit(AliRDHFCuts::kLcCuts)) ((TH2F*)fOutputEntries->FindObject("HasSelBit"))->Fill(2.0,ptCand_selBit);
1923  }
1924  }
1925  // D0kpi
1926  for (Int_t iCand = 0; iCand < nCandD0toKpi; iCand++) {
1927  AliAODRecoDecayHF *d = (AliAODRecoDecayHF*)arrayProngD0toKpi->UncheckedAt(iCand);
1928  Double_t ptCand_selBit = d->Pt();
1929  if(fUseSelectionBit && d->GetSelectionMap()) {
1930  if(d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)) ((TH2F*)fOutputEntries->FindObject("HasSelBit"))->Fill(4.0,ptCand_selBit);
1931  }
1932  }
1933  // Dstar
1934  for (Int_t iCand = 0; iCand < nCandDstar; iCand++) {
1935  AliAODRecoDecayHF *d = (AliAODRecoDecayHF*)arrayProngDstar->UncheckedAt(iCand);
1936  Double_t ptCand_selBit = d->Pt();
1937  if(fUseSelectionBit && d->GetSelectionMap()) {
1938  if(d->HasSelectionBit(AliRDHFCuts::kDstarCuts)) ((TH2F*)fOutputEntries->FindObject("HasSelBit"))->Fill(3.0,ptCand_selBit);
1939  }
1940  }
1941  }
1942 
1943  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
1944  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
1945  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
1946 
1947  //AliPIDResponse* respF=pidHF->GetPidResponse();
1948  AliTPCPIDResponse* tpcres=new AliTPCPIDResponse();
1949  Bool_t oldPID=pidHF->GetOldPid();
1950  if(oldPID){
1951  Double_t alephParameters[5];
1952  pidHF->GetTPCBetheBlochParams(alephParameters);
1953  tpcres->SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2],alephParameters[3],alephParameters[4]);
1954  }
1955 
1956 
1957  Int_t ntracks=0;
1958  Int_t isGoodTrack=0, isFakeTrack=0, isSelTrack=0;
1959 
1960  if(aod) ntracks=aod->GetNumberOfTracks();
1961 
1962  if(fOnOff[0] || fOnOff[1]){
1963  //loop on tracks in the event
1964  for (Int_t k=0;k<ntracks;k++){
1965  AliAODTrack* track=dynamic_cast<AliAODTrack*>(aod->GetTrack(k));
1966  if(!track) AliFatal("Not a standard AOD");
1967  // Track selection cuts
1968  if(track->GetID()<0) continue;
1969  Double_t d0z0[2],covd0z0[3];
1970  if(!track->PropagateToDCA(vtx1,magField,99999.,d0z0,covd0z0)) continue;
1971  if(track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)){
1972  ((TH1F*)fOutputTrack->FindObject("hd0TracksFilterBit4"))->Fill(d0z0[0]);
1973  }
1974  ULong_t trStatus=track->GetStatus();
1975  if(trStatus&AliESDtrack::kITSrefit){
1976  if(track->HasPointOnITSLayer(0) || track->HasPointOnITSLayer(1)){
1977  ((TH1F*)fOutputTrack->FindObject("hd0TracksSPDany"))->Fill(d0z0[0]);
1978  if(track->HasPointOnITSLayer(0)){
1979  ((TH1F*)fOutputTrack->FindObject("hd0TracksSPDin"))->Fill(d0z0[0]);
1980  }
1981  }
1982  }
1983 
1984  Bool_t selTrack=kTRUE;
1985  if (!((trStatus & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||
1986  !((trStatus & AliVTrack::kITSrefit) == AliVTrack::kITSrefit)){
1987  selTrack=kFALSE;
1988  }
1989  if(!track->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)){ // BIT(4) standard cuts with very loose DCA
1990  selTrack=kFALSE;
1991  }
1992  if(TMath::Abs(track->Eta())>0.9){
1993  selTrack=kFALSE;
1994  }
1995  Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);
1996  Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;
1997  if (track->GetTPCNclsF()>0) {
1998  ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();
1999  }
2000 
2001  Bool_t selTrackNoSPD=selTrack;
2002  if(selTrack){
2003  if(track->HasPointOnITSLayer(0) || track->HasPointOnITSLayer(1)){
2004  ((TH1F*)fOutputTrack->FindObject("hd0TracksTPCITSSPDany"))->Fill(d0z0[0]);
2005  }
2006  }
2007 
2008  AliAODPid *pid = track->GetDetPid();
2009  if(!pid && fDebug>1) cout<<"No AliAODPid found"<<endl;
2010 
2011  if(pid && fOnOff[1]){
2012  Double_t times[AliPID::kSPECIES];
2013  pid->GetIntegratedTimes(times);
2014 
2015  Double_t tofRes[AliPID::kSPECIES];
2016  pid->GetTOFpidResolution(tofRes);
2017 
2018  //check TOF
2019  TH1F* htmpfl=((TH1F*)fOutputPID->FindObject("hTOFflags"));
2020  htmpfl->Fill(0.);
2021  if (trStatus&AliESDtrack::kTPCout) htmpfl->Fill(1.);
2022  if (trStatus&AliESDtrack::kTOFout) htmpfl->Fill(2.);
2023  if (trStatus&AliESDtrack::kTIME) htmpfl->Fill(3.);
2024  if (trStatus&AliESDtrack::kTOFpid) htmpfl->Fill(4.);
2025  if (trStatus&AliESDtrack::kTOFmismatch) htmpfl->Fill(5.);
2026 
2027  Bool_t isTOFok=kFALSE;
2028  if(pidResp){
2029  Double_t prob[AliPID::kSPECIES];
2030  if(pidResp->ComputeTOFProbability(track,AliPID::kSPECIES,prob)==AliPIDResponse::kDetPidOk){
2031  isTOFok=kTRUE;
2032  htmpfl->Fill(6.);
2033  }
2034  }
2035 
2036  if(selTrack && isTOFok){
2037  Double_t tofTime=pid->GetTOFsignal();
2038  AliTOFHeader* tofH=(AliTOFHeader*)aod->GetTOFHeader();
2039  if (tofH && (TMath::Abs(tofRes[0]) <= 1.E-16) ) { // new AOD
2040  // with new AOD we need to retrieve startTime, subtract it and retrieve correctly TOF PID resolutions *PA*
2041  AliTOFPIDResponse tofResp=pidResp->GetTOFResponse();
2042  Double_t startTime = tofResp.GetStartTime(track->P());
2043  Float_t startTimeRes = tofResp.GetStartTimeRes(track->P());
2044  Int_t startTimeMask = tofResp.GetStartTimeMask(track->P());
2045  ((TH1F*)fOutputPID->FindObject("hTOFstartTimeDistrib"))->Fill(startTime);
2046  ((TH1F*)fOutputPID->FindObject("hTOFstartTimeMask"))->Fill(startTimeMask);
2047  ((TH1F*)fOutputPID->FindObject("hTOFstartTimeRes"))->Fill(startTimeRes);
2048  tofTime-=startTime;
2049  for (Int_t type=0;type<AliPID::kSPECIES;type++) tofRes[type]=tofResp.GetExpectedSigma(track->P(),times[type],AliPID::ParticleMassZ(type));
2050  }
2051  ((TH1F*)fOutputPID->FindObject("hTOFtime"))->Fill(times[AliPID::kProton]);
2052  ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptime"))->Fill(track->P(),tofTime-times[3]); //3 is kaon
2053  ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(tofTime);
2054  if (pid->GetTOFsignal()< 0) ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(-1);
2055 
2056  Double_t nsigma[3]={-10,-10,-10};
2057  nsigma[0]=pidResp->NumberOfSigmasTOF(track,AliPID::kPion);
2058  nsigma[1]=pidResp->NumberOfSigmasTOF(track,AliPID::kKaon);
2059  nsigma[2]=pidResp->NumberOfSigmasTOF(track,AliPID::kProton);
2060 
2061  ((TH2F*)fOutputPID->FindObject("hTOFsigmaKSigPid"))->Fill(track->P(),nsigma[1]);
2062  ((TH2F*)fOutputPID->FindObject("hTOFsigmaPionSigPid"))->Fill(track->P(),nsigma[0]);
2063  ((TH2F*)fOutputPID->FindObject("hTOFsigmaProtonSigPid"))->Fill(track->P(),nsigma[2]);
2064  if(fReadMC){
2065  Int_t label=track->GetLabel();
2066  if(label<=0) continue;
2067  AliMCParticle* mcpart=(AliMCParticle*)mcArray->At(label);
2068  if(mcpart){
2069  Int_t abspdgcode=TMath::Abs(mcpart->PdgCode());
2070  if(abspdgcode==211) ((TH2F*)fOutputPID->FindObject("hTOFsigmaMCPionSigPid"))->Fill(track->P(),nsigma[0]);
2071  if(abspdgcode==321) ((TH2F*)fOutputPID->FindObject("hTOFsigmaMCKSigPid"))->Fill(track->P(),nsigma[1]);
2072  if(abspdgcode==2212) ((TH2F*)fOutputPID->FindObject("hTOFsigmaMCProtonSigPid"))->Fill(track->P(),nsigma[2]);
2073 
2074  }
2075  }
2076 
2077  for (Int_t iS=2; iS<5; iS++){ //we plot TOF Pid resolution for 3-sigma identified particles
2078  if ( TMath::Abs(nsigma[iS-2])<3.){
2079  switch (iS) {
2080  case AliPID::kPion:
2081  ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigPion"))->Fill(tofRes[iS]);
2082  break;
2083  case AliPID::kKaon:
2084  ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigKaon"))->Fill(tofRes[iS]);
2085  break;
2086  case AliPID::kProton:
2087  ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigProton"))->Fill(tofRes[iS]);
2088  break;
2089  default:
2090  break;
2091  }
2092  }
2093  }
2094  }//if TOF status
2095  //}
2096 
2097  if(pidHF && pidHF->CheckStatus(track,"TPC") && selTrack){
2098 
2099  Double_t TPCp=pid->GetTPCmomentum();
2100  Double_t TPCsignal=pid->GetTPCsignal();
2101  UShort_t TPCsignalN=pid->GetTPCsignalN();
2102  ((TH1F*)fOutputPID->FindObject("hTPCsig"))->Fill(TPCsignal);
2103  ((TH1F*)fOutputPID->FindObject("hTPCsigvsp"))->Fill(TPCp,TPCsignal);
2104  //if (pidHF->IsKaonRaw(track, "TOF"))
2105  Double_t nsigma[3]={-10,-10,-10};
2106  pidHF->GetnSigmaTPC(track,(Int_t)AliPID::kPion,nsigma[0]);
2107  pidHF->GetnSigmaTPC(track,(Int_t)AliPID::kKaon,nsigma[1]);
2108  pidHF->GetnSigmaTPC(track,(Int_t)AliPID::kProton,nsigma[2]);
2109 
2110  ((TH2F*)fOutputPID->FindObject("hTPCsigmaK"))->Fill(TPCp,nsigma[1]);
2111 
2112  ((TH2F*)fOutputPID->FindObject("hTPCsigmaPion"))->Fill(TPCp,nsigma[0]);
2113  ((TH2F*)fOutputPID->FindObject("hTPCsigmaProton"))->Fill(TPCp,nsigma[2]);
2114 
2115  if(fReadMC){
2116  Int_t label=track->GetLabel();
2117  if(label<=0) continue;
2118  AliMCParticle* mcpart=(AliMCParticle*)mcArray->At(label);
2119  if(mcpart){
2120  Int_t abspdgcode=TMath::Abs(mcpart->PdgCode());
2121  if(abspdgcode==211) ((TH2F*)fOutputPID->FindObject("hTPCsigmaMCPion"))->Fill(track->P(),nsigma[0]);
2122  if(abspdgcode==321) ((TH2F*)fOutputPID->FindObject("hTPCsigmaMCK"))->Fill(track->P(),nsigma[1]);
2123  if(abspdgcode==2212) ((TH2F*)fOutputPID->FindObject("hTPCsigmaMCProton"))->Fill(track->P(),nsigma[2]);
2124 
2125  }
2126 
2127  }
2128  if(fFillDistrTrackEffChecks && track->GetStatus()&AliESDtrack::kITSrefit && track->GetStatus()&AliESDtrack::kTPCrefit){
2129  ((TH2F*)fOutputPID->FindObject("hTPCsigNvsPtAllTracks"))->Fill(track->Pt(),(Float_t)TPCsignalN);
2130  ((TH2F*)fOutputPID->FindObject("hTPCsigNvsPhiAllTracks"))->Fill(track->Phi(),(Float_t)TPCsignalN);
2131  ((TH2F*)fOutputPID->FindObject("hTPCsigNvsEtaAllTracks"))->Fill(track->Eta(),(Float_t)TPCsignalN);
2132  }
2133 
2134  }//if TPC status
2135  } //end PID histograms
2136 
2137  Int_t nclsTot=0,nclsSPD=0;
2138 
2139  //check clusters of the tracks
2140  if(fOnOff[0]){
2141 
2142  ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1);
2143  if(selTrackNoSPD) ((TH1F*)fOutputTrack->FindObject("hnLayerITSselTr"))->Fill(-1);
2144  for(Int_t l=0;l<6;l++) {
2145  if(TESTBIT(track->GetITSClusterMap(),l)) {
2146  ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(l);
2147  if(selTrackNoSPD) ((TH1F*)fOutputTrack->FindObject("hnLayerITSselTr"))->Fill(l);
2148  nclsTot++; if(l<2) nclsSPD++;
2149  }
2150  }
2151  ((TH1F*)fOutputTrack->FindObject("hnClsITS"))->Fill(nclsTot);
2152  ((TH1F*)fOutputTrack->FindObject("hnClsSPD"))->Fill(nclsSPD);
2153 
2154  if(fFillDistrTrackEffChecks && track->GetStatus()&AliESDtrack::kITSrefit && track->GetStatus()&AliESDtrack::kTPCrefit){
2155 
2156  ((TH1F*)fOutputTrack->FindObject("hPtAllTracks"))->Fill(track->Pt());
2157  ((TH1F*)fOutputTrack->FindObject("hPhiAllTracks"))->Fill(track->Phi());
2158  ((TH1F*)fOutputTrack->FindObject("hEtaAllTracks"))->Fill(track->Eta());
2159  ((TH2F*)fOutputTrack->FindObject("hEtavsPhiAllTracks"))->Fill(track->Phi(),track->Eta());
2160  ((TH2F*)fOutputTrack->FindObject("hNTPCclsvsPtAllTracks"))->Fill(track->Pt(),track->GetTPCNcls());
2161  ((TH2F*)fOutputTrack->FindObject("hNTPCclsvsPhiAllTracks"))->Fill(track->Phi(),track->GetTPCNcls());
2162  ((TH2F*)fOutputTrack->FindObject("hNTPCclsvsEtaAllTracks"))->Fill(track->Eta(),track->GetTPCNcls());
2163 
2164  ((TH2F*)fOutputTrack->FindObject("hNTPCCrossedRowsvsPtAllTracks"))->Fill(track->Pt(),nCrossedRowsTPC);
2165  ((TH2F*)fOutputTrack->FindObject("hNTPCCrossedRowsvsPhiAllTracks"))->Fill(track->Phi(),nCrossedRowsTPC);
2166  ((TH2F*)fOutputTrack->FindObject("hNTPCCrossedRowsvsEtaAllTracks"))->Fill(track->Eta(),nCrossedRowsTPC);
2167 
2168  ((TH2F*)fOutputTrack->FindObject("hRatioCRowsOverFclsvsPtAllTracks"))->Fill(track->Pt(),ratioCrossedRowsOverFindableClustersTPC);
2169  ((TH2F*)fOutputTrack->FindObject("hRatioCRowsOverFclsvsPhiAllTracks"))->Fill(track->Phi(),ratioCrossedRowsOverFindableClustersTPC);
2170  ((TH2F*)fOutputTrack->FindObject("hRatioCRowsOverFclsvsEtaAllTracks"))->Fill(track->Eta(),ratioCrossedRowsOverFindableClustersTPC);
2171 
2172  if(!(track->HasPointOnITSLayer(0)) && !(track->HasPointOnITSLayer(1))){ //no SPD points
2173  ((TH1I*)fOutputTrack->FindObject("hSPDclsAllTracks"))->Fill(0);
2174  }
2175  if(track->HasPointOnITSLayer(0) && !(track->HasPointOnITSLayer(1))){ //kOnlyFirst
2176  ((TH1I*)fOutputTrack->FindObject("hSPDclsAllTracks"))->Fill(1);
2177  }
2178  if(!(track->HasPointOnITSLayer(0)) && track->HasPointOnITSLayer(1)){ //kOnlySecond
2179  ((TH1I*)fOutputTrack->FindObject("hSPDclsAllTracks"))->Fill(2);
2180  }
2181  if(track->HasPointOnITSLayer(0) && track->HasPointOnITSLayer(1)){ //kBoth
2182  ((TH1I*)fOutputTrack->FindObject("hSPDclsAllTracks"))->Fill(3);
2183  }
2184  ((TH2F*)fOutputTrack->FindObject("hNITSclsvsPtAllTracks"))->Fill(track->Pt(), nclsTot);
2185  ((TH2F*)fOutputTrack->FindObject("hNITSclsvsPhiAllTracks"))->Fill(track->Phi(), nclsTot);
2186  ((TH2F*)fOutputTrack->FindObject("hNITSclsvsEtaAllTracks"))->Fill(track->Eta(), nclsTot);
2187 
2188  }
2189 
2190  if(track->Pt()>0.3 &&
2191  TMath::Abs(track->Eta())<0.8 &&
2192  track->GetStatus()&AliESDtrack::kITSrefit &&
2193  track->GetStatus()&AliESDtrack::kTPCrefit &&
2194  nclsSPD>0){
2195  ((TH1F*)fOutputTrack->FindObject("hnClsITSselTr"))->Fill(nclsTot);
2196  }
2197  if(!(track->GetStatus()&AliESDtrack::kTPCin) && track->GetStatus()&AliESDtrack::kITSrefit && !(track->GetStatus()&AliESDtrack::kITSpureSA)){//tracks retrieved in the ITS and not reconstructed in the TPC
2198  ((TH1F*)fOutputTrack->FindObject("hnClsITS-SA"))->Fill(nclsTot);
2199  ((TH1F*)fOutputTrack->FindObject("hnLayerITSsa"))->Fill(-1);
2200  for(Int_t l=0;l<6;l++) {
2201  if(TESTBIT(track->GetITSClusterMap(),l)) {
2202  ((TH1F*)fOutputTrack->FindObject("hnLayerITSsa"))->Fill(l);
2203  }
2204  }
2205  }
2206  Int_t label=0;
2207  if(fReadMC){
2208  label=track->GetLabel();
2209  if (label<0)((TH1F*)fOutputEntries->FindObject("hNentries"))->Fill(8);
2210  else ((TH1F*)fOutputEntries->FindObject("hNentries"))->Fill(9);
2211  }
2212 
2213 
2214  if (track->Pt()>0.3 &&
2215  track->GetStatus()&AliESDtrack::kTPCrefit &&
2216  track->GetStatus()&AliESDtrack::kITSrefit &&
2217  /*nclsTot>3 &&*/
2218  nclsSPD>0) {//count good tracks
2219 
2220 
2221  if(fReadMC && label<0) {
2222  ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt());
2223  isFakeTrack++;
2224  } else {
2225  ((TH1F*)fOutputTrack->FindObject("hptGoodTr"))->Fill(track->Pt());
2226  isGoodTrack++;
2227  }
2228 
2229  if(fCuts->IsDaughterSelected(track,&vESD,fCuts->GetTrackCuts())){
2230  isSelTrack++;
2231  }//select tracks for our analyses
2232 
2233  }
2234  } //fill track histos
2235  } //end loop on tracks
2236 
2237  //fill once per event
2238  if(fOnOff[0]){
2239  if (fReadMC) ((TH1F*)fOutputTrack->FindObject("hdistrFakeTr"))->Fill(isFakeTrack);
2240  ((TH1F*)fOutputTrack->FindObject("hdistrGoodTr"))->Fill(isGoodTrack);
2241  ((TH1F*)fOutputTrack->FindObject("hdistrSelTr"))->Fill(isSelTrack);
2242  }
2243 
2244  if(!isSimpleMode){
2245  // loop over candidates
2246  Int_t nCand = arrayProng->GetEntriesFast();
2247  Int_t ndaugh=3;
2250 
2251  for (Int_t iCand = 0; iCand < nCand; iCand++) {
2252  AliAODRecoDecayHF *d = (AliAODRecoDecayHF*)arrayProng->UncheckedAt(iCand);
2253  if(fUseSelectionBit && d->GetSelectionMap()) {
2254  if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi && !d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)) continue; //skip the D0 from Dstar
2256  }
2257 
2258  if(fReadMC){
2259 
2260  Int_t labD = -1;
2261  if (fDecayChannel==AliAnalysisTaskSEHFQA::kLambdactoV0 && (dynamic_cast<AliAODRecoCascadeHF*>(d))->Getv0()) {
2262 
2263  Int_t pdgDgLctoV0bachelor[2]={2212,310};
2264  Int_t pdgDgV0toDaughters[2]={211,211};
2265  Int_t mcLabelK0S = (dynamic_cast<AliAODRecoCascadeHF*>(d))->MatchToMC(pdg,pdgDgLctoV0bachelor[1],pdgDgLctoV0bachelor,pdgDgV0toDaughters,mcArray,kTRUE); // Lc->K0S+p and cc
2266  pdgDgLctoV0bachelor[1]=3122, pdgDgLctoV0bachelor[0]=211;
2267  pdgDgV0toDaughters[0]=2212, pdgDgV0toDaughters[1]=211;
2268  Int_t mcLabelLambda = (dynamic_cast<AliAODRecoCascadeHF*>(d))->MatchToMC(pdg,pdgDgLctoV0bachelor[1],pdgDgLctoV0bachelor,pdgDgV0toDaughters,mcArray,kTRUE); // Lc->Lambda+pi and cc
2269  if (mcLabelK0S!=-1 || mcLabelLambda!=-1) AliInfo(Form("mcLabelK0S=%d - mcLabelLambda=%d",mcLabelK0S,mcLabelLambda));
2270 
2271  if (mcLabelK0S!=-1 && mcLabelLambda!=-1)
2272  AliInfo("Strange: current Lc->V0+bachelor candidate has two MC different labels!");
2273  else if (mcLabelK0S>-1 && mcLabelLambda==-1)
2274  labD = mcLabelK0S;
2275  else if (mcLabelLambda>-1 && mcLabelK0S==-1)
2276  labD = mcLabelLambda;
2277  }
2278  else
2279  labD = d->MatchToMC(pdg,mcArray,ndaugh,pdgdaughters);
2280 
2281  if(labD>=0){
2282  AliAODMCParticle *partD = (AliAODMCParticle*)mcArray->At(labD);
2283  Int_t label=partD->GetMother();
2284  AliAODMCParticle *mot = (AliAODMCParticle*)mcArray->At(label);
2285  while(label>=0){//get first mother
2286  mot = (AliAODMCParticle*)mcArray->At(label);
2287  label=mot->GetMother();
2288  }
2289  if(mot){
2290  Int_t pdgMotCode = mot->GetPdgCode();
2291 
2292  if(TMath::Abs(pdgMotCode)==4) ((TH1F*)fOutputEntries->FindObject("hNentries"))->Fill(6); //from primary charm
2293  if(TMath::Abs(pdgMotCode)==5) ((TH1F*)fOutputEntries->FindObject("hNentries"))->Fill(7); //from beauty
2294  }
2295  }
2296  }//end MC
2297  ((TH1F*)fOutputEntries->FindObject("hNentries"))->Fill(5);//count the candidates (data and MC)
2298 
2299  for(Int_t id=0;id<ndaugh;id++){
2300  //other histograms to be filled when the cut object is given
2301  AliAODTrack* track=0;
2302 
2303  if (fDecayChannel==AliAnalysisTaskSEHFQA::kLambdactoV0 && (dynamic_cast<AliAODRecoCascadeHF*>(d))->Getv0()) {
2304  if (id==0)
2305  track=(AliAODTrack*)(dynamic_cast<AliAODRecoCascadeHF*>(d))->GetBachelor();
2306  else if (id==1)
2307  track=(AliAODTrack*)(dynamic_cast<AliAODRecoCascadeHF*>(d))->Getv0PositiveTrack();
2308  else if (id==2)
2309  track=(AliAODTrack*)(dynamic_cast<AliAODRecoCascadeHF*>(d))->Getv0NegativeTrack();
2310  }
2311  else
2312  track=(AliAODTrack*)d->GetDaughter(id);
2313 
2314 
2315  // filtering cut level
2316 
2317  if (fCuts->IsInFiducialAcceptance(d->Pt(),d->Y(pdg)) && fCuts->IsSelected(d,AliRDHFCuts::kAll,aod)) {
2318 
2319  Int_t label=0;
2320  if(fReadMC)label=track->GetLabel();
2321  if(fOnOff[0]){
2322 
2323  if(fReadMC && label<0) {
2324  isFakeTrack++;
2325  ((TH1F*)fOutputTrack->FindObject("hptFakeTrFromDaugh_filt"))->Fill(track->Pt());
2326 
2327  ((TH1F*)fOutputTrack->FindObject("hd0f_filt"))->Fill(d->Getd0Prong(id));
2328  } else {
2329  ((TH1F*)fOutputTrack->FindObject("hptGoodTrFromDaugh_filt"))->Fill(track->Pt());
2330  ((TH1F*)fOutputTrack->FindObject("hd0dau_filt"))->Fill(d->Getd0Prong(id));
2331  Double_t phidaughter = d->PhiProng(id);
2332  if(phidaughter<0) phidaughter=2.0*TMath::Pi()+phidaughter;
2333  ((TH2F*)fOutputTrack->FindObject("hd0dauphi_filt"))->Fill(phidaughter, d->Getd0Prong(id));
2334  Double_t d0rphiz[2],covd0[3];
2335  Bool_t isDCA=track->PropagateToDCA(vtx1,magField,9999.,d0rphiz,covd0);
2336  if(isDCA){
2337  ((TH1F*)fOutputTrack->FindObject("hd0zdau_filt"))->Fill(d0rphiz[1]);
2338  ((TH2F*)fOutputTrack->FindObject("hd0zdauphi_filt"))->Fill(phidaughter,d0rphiz[1]);
2339  }
2340  }
2341  }
2342  }
2343 
2344 
2345 
2346  //track quality
2347 
2348  if (fCuts->IsInFiducialAcceptance(d->Pt(),d->Y(pdg)) && fCuts->IsSelected(d,AliRDHFCuts::kTracks,aod)) {
2349 
2350  Int_t label=0;
2351  if(fReadMC)label=track->GetLabel();
2352  if(fOnOff[0]){
2353 
2354  if(fReadMC && label<0) {
2355  isFakeTrack++;
2356  ((TH1F*)fOutputTrack->FindObject("hptFakeTrFromDaugh"))->Fill(track->Pt());
2357 
2358  ((TH1F*)fOutputTrack->FindObject("hd0f"))->Fill(d->Getd0Prong(id));
2359  } else {
2360  ((TH1F*)fOutputTrack->FindObject("hptGoodTrFromDaugh"))->Fill(track->Pt());
2361  ((TH1F*)fOutputTrack->FindObject("hd0dau"))->Fill(d->Getd0Prong(id));
2362  Double_t phidaughter = d->PhiProng(id);
2363  if(phidaughter<0) phidaughter=2.0*TMath::Pi()+phidaughter;
2364  ((TH2F*)fOutputTrack->FindObject("hd0dauphi"))->Fill(phidaughter, d->Getd0Prong(id));
2365  Double_t d0rphiz[2],covd0[3];
2366  Bool_t isDCA=track->PropagateToDCA(vtx1,magField,9999.,d0rphiz,covd0);
2367  if(isDCA){
2368  ((TH1F*)fOutputTrack->FindObject("hd0zdau"))->Fill(d0rphiz[1]);
2369  ((TH2F*)fOutputTrack->FindObject("hd0zdauphi"))->Fill(phidaughter,d0rphiz[1]);
2370  }
2371  }
2372  }
2373 
2374 
2376  Int_t nITScls = 0;
2377  Double_t nTPCCrossedRows = track->GetTPCClusterInfo(2,1);
2378  Double_t ratioCrossedRowsOverFcls = 1.0;
2379  if(track->GetTPCNclsF()>0){
2380  ratioCrossedRowsOverFcls = (nTPCCrossedRows)/(track->GetTPCNclsF());
2381  }
2382  for(Int_t l=0;l<6;l++) {
2383  if(TESTBIT(track->GetITSClusterMap(),l)) {
2384  nITScls++;
2385  }
2386  }
2387 
2388  ((TH1F*)fOutputTrack->FindObject("hPtDaughters"))->Fill(track->Pt());
2389  ((TH1F*)fOutputTrack->FindObject("hPhiDaughters"))->Fill(track->Phi());
2390  ((TH1F*)fOutputTrack->FindObject("hEtaDaughters"))->Fill(track->Eta());
2391  ((TH2F*)fOutputTrack->FindObject("hEtavsPhiDaughters"))->Fill(track->Phi(),track->Eta());
2392 
2393  ((TH2F*)fOutputTrack->FindObject("hNTPCclsvsPtDaughters"))->Fill(track->Pt(),track->GetTPCNcls());
2394  ((TH2F*)fOutputTrack->FindObject("hNTPCclsvsPhiDaughters"))->Fill(track->Phi(),track->GetTPCNcls());
2395  ((TH2F*)fOutputTrack->FindObject("hNTPCclsvsEtaDaughters"))->Fill(track->Eta(),track->GetTPCNcls());
2396 
2397  ((TH2F*)fOutputTrack->FindObject("hNTPCCrossedRowsvsPtDaughters"))->Fill(track->Pt(),nTPCCrossedRows);
2398  ((TH2F*)fOutputTrack->FindObject("hNTPCCrossedRowsvsPhiDaughters"))->Fill(track->Phi(),nTPCCrossedRows);
2399  ((TH2F*)fOutputTrack->FindObject("hNTPCCrossedRowsvsEtaDaughters"))->Fill(track->Eta(),nTPCCrossedRows);
2400 
2401  ((TH2F*)fOutputTrack->FindObject("hRatioCRowsOverFclsvsPtDaughters"))->Fill(track->Pt(),ratioCrossedRowsOverFcls);
2402  ((TH2F*)fOutputTrack->FindObject("hRatioCRowsOverFclsvsPhiDaughters"))->Fill(track->Phi(),ratioCrossedRowsOverFcls);
2403  ((TH2F*)fOutputTrack->FindObject("hRatioCRowsOverFclsvsEtaDaughters"))->Fill(track->Eta(),ratioCrossedRowsOverFcls);
2404 
2405  ((TH2F*)fOutputTrack->FindObject("hNITSclsvsPtDaughters"))->Fill(track->Pt(), nITScls);
2406  ((TH2F*)fOutputTrack->FindObject("hNITSclsvsPhiDaughters"))->Fill(track->Phi(), nITScls);
2407  ((TH2F*)fOutputTrack->FindObject("hNITSclsvsEtaDaughters"))->Fill(track->Eta(), nITScls);
2408  if(!(track->HasPointOnITSLayer(0)) && !(track->HasPointOnITSLayer(1))){ //no SPD points
2409  ((TH1I*)fOutputTrack->FindObject("hSPDclsDaughters"))->Fill(0);
2410  }
2411  if(track->HasPointOnITSLayer(0) && !(track->HasPointOnITSLayer(1))){ //kOnlyFirst
2412  ((TH1I*)fOutputTrack->FindObject("hSPDclsDaughters"))->Fill(1);
2413  }
2414  if(!(track->HasPointOnITSLayer(0)) && track->HasPointOnITSLayer(1)){ //kOnlySecond
2415  ((TH1I*)fOutputTrack->FindObject("hSPDclsDaughters"))->Fill(2);
2416  }
2417  if(track->HasPointOnITSLayer(0) && track->HasPointOnITSLayer(1)){ //kBoth
2418  ((TH1I*)fOutputTrack->FindObject("hSPDclsDaughters"))->Fill(3);
2419  }
2420 
2421 
2422  if(fOnOff[1]){
2423  AliAODPid *pid = track->GetDetPid();
2424  if(pid){
2425  if(pidHF && pidHF->CheckStatus(track,"TPC")){
2426  ((TH2F*)fOutputPID->FindObject("hTPCsigNvsPtDaughters"))->Fill(track->Pt(),pid->GetTPCsignalN());
2427  ((TH2F*)fOutputPID->FindObject("hTPCsigNvsPhiDaughters"))->Fill(track->Phi(),pid->GetTPCsignalN());
2428  ((TH2F*)fOutputPID->FindObject("hTPCsigNvsEtaDaughters"))->Fill(track->Eta(),pid->GetTPCsignalN());
2429  }
2430  }
2431  }
2432  }
2433 
2434 
2435  if (fCuts->IsSelected(d,AliRDHFCuts::kAll,aod) && fOnOff[1]){
2436  ((TH1F*)fOutputEntries->FindObject("hNentries"))->Fill(3); //candidates passing analysis cuts
2437 
2438  AliAODPid *pid = track->GetDetPid();
2439  if(pid){
2440  Double_t times[5];
2441  pid->GetIntegratedTimes(times);
2442  if(pidHF && pidHF->CheckStatus(track,"TOF")){
2443  Double_t tofTime=pid->GetTOFsignal();
2444  AliTOFHeader* tofH=(AliTOFHeader*)aod->GetTOFHeader();
2445  Double_t tofRes[AliPID::kSPECIES];
2446  pid->GetTOFpidResolution(tofRes);
2447  if (tofH && (TMath::Abs(tofRes[0]) <= 1.E-16) ) { // new AOD
2448  AliTOFPIDResponse tofResp=pidHF->GetPidResponse()->GetTOFResponse();
2449  Double_t startTime=tofResp.GetStartTime(track->P());
2450  tofTime-=startTime;
2451  }
2452  ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptimeAC"))->Fill(track->P(),tofTime-times[AliPID::kKaon]);
2453  }
2454  if(pidHF && pidHF->CheckStatus(track,"TPC")) ((TH2F*)fOutputPID->FindObject("hTPCsigvspAC"))->Fill(pid->GetTPCmomentum(),pid->GetTPCsignal());
2455  }
2456 
2457  } //end analysis cuts
2458  } //end acceptance and track cuts
2459  } //end loop on tracks in the candidate
2460  } //end loop on candidates
2461 
2462  }
2463  } //end if on pid or track histograms
2464 
2465  delete tpcres;
2466  delete [] pdgdaughters;
2467  PostData(1,fOutputEntries);
2468  if(fOnOff[1]) PostData(2,fOutputPID);
2469  if(fOnOff[0]) PostData(3,fOutputTrack);
2470  PostData(4,fCuts);
2471  if(fOnOff[2]) PostData(5,fOutputCounters);
2472  //Post data 6 done in case of centrality on
2473 }
2474 
2475 //____________________________________________________________________________
2476 void AliAnalysisTaskSEHFQA::FillFlowObs(AliAODEvent *aod){
2478  Double_t cc;
2479  cc = fCuts->GetCentrality(aod);
2480  ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(0., cc);
2481 
2482  UInt_t mask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
2483  UInt_t trigger=AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral;
2484  if(mask & trigger) {
2485  ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(1.,cc); // fired
2486  if (mask & AliVEvent::kMB) ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(2.,cc);
2487  if (mask & AliVEvent::kCentral) ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(3.,cc);
2488  if (mask & AliVEvent::kSemiCentral) ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(4.,cc);
2489  Bool_t rejected=false;
2490  if(cc<0 || cc>60) rejected=true;
2491  const AliVVertex *vertex = aod->GetPrimaryVertex();
2492  Double_t zvtx=vertex->GetZ();
2493  if(TMath::Abs(zvtx)>fCuts->GetMaxVtxZ()) rejected=true;
2494  if(rejected) return; //not interesting for flow QA
2495  } else {
2496  return;
2497  }
2498 
2499  // event accepted
2500  ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(5.,cc);
2501  fRFPcuts->SetParamType(AliFlowTrackCuts::kGlobal);
2502  fRFPcuts->SetPtRange(0.2,5.);
2503  fRFPcuts->SetEtaRange(-0.8,0.8);
2504  fRFPcuts->SetMinNClustersTPC(70);
2505  fRFPcuts->SetMinChi2PerClusterTPC(0.2);
2506  fRFPcuts->SetMaxChi2PerClusterTPC(4.0);
2507  fRFPcuts->SetAcceptKinkDaughters(kFALSE);
2508  fRFPcuts->SetEvent(aod);
2509 
2510  TString ref[3] = {"FB1","FB128","VZE"};
2511  Double_t psi[3];
2512  for(Int_t i=0; i!=3; ++i) {
2513  if(i==0) { // switching to bit 1
2514  fRFPcuts->SetMinimalTPCdedx(10.);
2515  fRFPcuts->SetAODfilterBit(1);
2516  } else { // switching to bit 128
2517  fRFPcuts->SetMinimalTPCdedx(-1);
2518  fRFPcuts->SetAODfilterBit(128);
2519  }
2520  if(i>1) {
2521  fRFPcuts->SetParamType(AliFlowTrackCuts::kVZERO);
2522  fRFPcuts->SetEtaRange(-5,+5);
2523  fRFPcuts->SetPhiMin(0);
2524  fRFPcuts->SetPhiMax(TMath::TwoPi());
2525  }
2526  fFlowEvent->Fill(fRFPcuts,fRFPcuts);
2527  fFlowEvent->TagSubeventsInEta(-5,0,0,+5);
2528  // getting informationt
2529  AliFlowVector vQ, vQaQb[2];
2530  fFlowEvent->Get2Qsub(vQaQb,2);
2531  vQ = vQaQb[0]+vQaQb[1];
2532  Double_t dMa=vQaQb[0].GetMult();
2533  Double_t dMb=vQaQb[1].GetMult();
2534  if( dMa<2 || dMb<2 ) {
2535  ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(6.,cc); //???
2536  continue;
2537  }
2538  psi[i] = vQ.Phi()/2;
2539  // publishing
2540  ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(0,cc,vQaQb[0].X()/dMa,dMa); // Qx-
2541  ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(1,cc,vQaQb[0].Y()/dMa,dMa); // Qy-
2542  ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(2,cc,vQaQb[1].X()/dMb,dMb); // Qx+
2543  ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(3,cc,vQaQb[1].Y()/dMb,dMb); // Qy+
2544  ((TH2F*) fOutputFlowObs->FindObject( Form("h%s_AngleQ",ref[i].Data()) ))->Fill(psi[i],cc); // Psi
2545  AliFlowTrackSimple *track;
2546  for(Int_t t=0; t!=fFlowEvent->NumberOfTracks(); ++t) {
2547  track = (AliFlowTrackSimple*) fFlowEvent->GetTrack(t);
2548  if(!track) continue;
2549  if(!track->InRPSelection()) continue;
2550  ((TH3F*) fOutputFlowObs->FindObject( Form("h%s_PhiEta",ref[i].Data()) ))->Fill(track->Phi(),track->Eta(),cc,track->Weight()); //PhiEta
2551  }
2552 
2553  //histo filled only for TPCFB1
2554  if (i==0) {
2555  ((TH2F*) fOutputFlowObs->FindObject("hCentVsMultRPS"))->Fill(fFlowEvent->GetNumberOfRPs(),cc);
2556  }
2557  }
2558  // TPC vs VZERO
2559  ((TH3F*) fOutputFlowObs->FindObject( "hTPCVZE_AngleQ" ))->Fill(psi[0],psi[2],cc);
2560 }
2561 
2562 //____________________________________________________________________________
2563 void AliAnalysisTaskSEHFQA::Terminate(Option_t */*option*/){
2565 
2566  fOutputEntries = dynamic_cast<TList*> (GetOutputData(1));
2567  if (!fOutputEntries && fOnOff[1]) {
2568  printf("ERROR: %s not available\n",GetOutputSlot(1)->GetContainer()->GetName());
2569  return;
2570  }
2571 
2572  fOutputPID = dynamic_cast<TList*> (GetOutputData(2));
2573  if (!fOutputPID && fOnOff[1]) {
2574  printf("ERROR: %s not available\n",GetOutputSlot(2)->GetContainer()->GetName());
2575  return;
2576  }
2577 
2578  fOutputTrack = dynamic_cast<TList*> (GetOutputData(3));
2579  if (!fOutputTrack && fOnOff[0]) {
2580  printf("ERROR: %s not available\n",GetOutputSlot(3)->GetContainer()->GetName());
2581  return;
2582  }
2583 
2584 }
2585 
2586 
Bool_t fOnOff[5]
flag to use or not the selection bit
Float_t GetMaxCentrality() const
Definition: AliRDHFCuts.h:266
Bool_t IsEventRejectedDueToCentrality() const
Definition: AliRDHFCuts.h:311
Int_t pdg
Bool_t IsEventRejectedDueToZVertexOutsideFiducialRegion() const
Definition: AliRDHFCuts.h:305
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Bool_t IsEventRejectedDueToNotRecoVertex() const
Definition: AliRDHFCuts.h:299
TList * fOutputCounters
! list sent on output slot 5
Bool_t fUseSelectionBit
if true, don't do candidates (much faster in PbPb)
const char * title
Definition: MakeQAPdf.C:26
virtual void UserCreateOutputObjects()
Implementation of interface methods.
Bool_t HasSelectionBit(Int_t i) const
Int_t GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &sigma) const
centrality
Bool_t IsEventRejectedDueToVertexContributors() const
Definition: AliRDHFCuts.h:302
TList * fOutputEvSelection
! list sent on output slot 7
AliFlowEvent * fFlowEvent
! to handle the reusage of the flowEvent object
ULong_t GetSelectionMap() const
Double_t GetMaxVtxZ() const
Definition: AliRDHFCuts.h:241
Bool_t GetOldPid()
Definition: AliAODPidHF.h:157
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:231
Class for cuts on AOD reconstructed D+->Kpipi.
AliRDHFCuts::ECentrality fEstimator
static Int_t GetNumberOfTrackletsInEtaRange(AliAODEvent *ev, Double_t mineta, Double_t maxeta)
void GetTPCBetheBlochParams(Double_t alephParameters[5]) const
TList * fOutputPID
! list sent on output slot 2
Bool_t CheckStatus(AliAODTrack *track, TString detectors) const
TList * fOutputCheckCentrality
! list sent on output slot 6
TList * fOutputEntries
! list sent on output slot 1
Bool_t IsDaughterSelected(AliAODTrack *track, const AliESDVertex *primary, AliESDtrackCuts *cuts) const
virtual void UserExec(Option_t *option)
AliESDtrackCuts * GetTrackCuts() const
Definition: AliRDHFCuts.h:246
Float_t GetCentrality(AliAODEvent *aodEvent)
Definition: AliRDHFCuts.h:242
Bool_t IsEventRejectedDueToPileup() const
Definition: AliRDHFCuts.h:308
Double_t nsigma
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
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)
Bool_t IsEventRejectedDuePhysicsSelection() const
Definition: AliRDHFCuts.h:320
TList * fOutputFlowObs
! list sent on output slot 8
Bool_t fSimpleMode
flag to read MC
AliFlowTrackCuts * fRFPcuts
! reference flow particle cuts
Bool_t IsEventSelected(AliVEvent *event)
TList * fOutputTrack
! list sent on output slot 3
const Double_t etamax
Bool_t IsSelected(TObject *obj)
Definition: AliRDHFCuts.h:274
Bool_t IsEventRejectedDueToTrigger() const
Definition: AliRDHFCuts.h:296
virtual void Terminate(Option_t *option)
void FillFlowObs(AliAODEvent *aod)
virtual Bool_t IsInFiducialAcceptance(Double_t, Double_t) const
Definition: AliRDHFCuts.h:291
Int_t GetUseCentrality() const
Definition: AliRDHFCuts.h:264
Bool_t fFillDistrTrackEffChecks
on-off the QA on tracks (0), PID (1), centrality (2), event selection – default is {kTRUE...