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