]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/vertexingHF/AliAnalysisTaskSEHFQA.cxx
Analysis files for kaon spectra analysis from kinks from Martha
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliAnalysisTaskSEHFQA.cxx
CommitLineData
0dbb51a0 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
27de2dfb 16/* $Id$ */
17
0dbb51a0 18/////////////////////////////////////////////////////////////
19//
20// AliAnalysisTaskSE for HF quality assurance
21//
22// Author: Chiara Bianchin, chiara.bianchin@pd.infn.it
23/////////////////////////////////////////////////////////////
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>
d48d81b5 31#include <TH3F.h>
32#include <TProfile2D.h>
0dbb51a0 33#include <TDatabasePDG.h>
34
35#include <AliAnalysisDataSlot.h>
36#include <AliAnalysisDataContainer.h>
37#include "AliAnalysisManager.h"
38#include "AliESDtrack.h"
824b448a 39#include "AliESDVertex.h"
0dbb51a0 40#include "AliVertexerTracks.h"
41#include "AliPID.h"
e7af8919 42#include "AliPIDResponse.h"
0dbb51a0 43#include "AliTPCPIDResponse.h"
44#include "AliAODHandler.h"
45#include "AliAODEvent.h"
46#include "AliAODVertex.h"
47#include "AliAODTrack.h"
48#include "AliAODMCParticle.h"
a4ef4383 49#include "AliAODMCHeader.h"
0dbb51a0 50#include "AliAODRecoDecayHF2Prong.h"
51#include "AliAODRecoCascadeHF.h"
52#include "AliAnalysisVertexingHF.h"
53#include "AliAnalysisTaskSE.h"
a4ef4383 54#include "AliCounterCollection.h"
0dbb51a0 55#include "AliRDHFCuts.h"
56#include "AliRDHFCutsDplustoKpipi.h"
57#include "AliRDHFCutsD0toKpipipi.h"
58#include "AliRDHFCutsDstoKKpi.h"
59#include "AliRDHFCutsDStartoKpipi.h"
60#include "AliRDHFCutsD0toKpi.h"
61#include "AliRDHFCutsLctopKpi.h"
ca688a98 62#include "AliRDHFCutsLctoV0.h"
a4b0ffc7 63#include "AliInputEventHandler.h"
0dbb51a0 64
d48d81b5 65#include "AliFlowEvent.h"
66#include "AliFlowTrackCuts.h"
67#include "AliFlowTrackSimple.h"
68#include "AliFlowVector.h"
69
0dbb51a0 70#include "AliAnalysisTaskSEHFQA.h"
71
c64cb1f6 72using std::cout;
73using std::endl;
74
0dbb51a0 75ClassImp(AliAnalysisTaskSEHFQA)
76
77//____________________________________________________________________________
78
79AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA():AliAnalysisTaskSE(),
80 fNEntries(0x0),
81 fOutputPID(0x0),
82 fOutputTrack(0x0),
a4ef4383 83 fOutputCounters(0x0),
84 fOutputCheckCentrality(0x0),
818c1271 85 fOutputEvSelection(0x0),
d48d81b5 86 fOutputFlowObs(0x0),
0dbb51a0 87 fDecayChannel(AliAnalysisTaskSEHFQA::kD0toKpi),
a4ef4383 88 fCuts(0x0),
d48d81b5 89 fFlowEvent(0x0),
90 fRFPcuts(0x0),
a4ef4383 91 fEstimator(AliRDHFCuts::kCentTRK),
19222b31 92 fReadMC(kFALSE),
5fc4893f 93 fSimpleMode(kFALSE),
94 fOnOff()
0dbb51a0 95{
96 //default constructor
5fc4893f 97 fOnOff[0]=kTRUE;
98 fOnOff[1]=kTRUE;
99 fOnOff[2]=kTRUE;
818c1271 100 fOnOff[3]=kTRUE;
d48d81b5 101 fOnOff[4]=kTRUE;
0dbb51a0 102}
103
104//____________________________________________________________________________
105AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA(const char *name, AliAnalysisTaskSEHFQA::DecChannel ch,AliRDHFCuts* cuts):
a4ef4383 106 AliAnalysisTaskSE(name),
107 fNEntries(0x0),
108 fOutputPID(0x0),
109 fOutputTrack(0x0),
110 fOutputCounters(0x0),
111 fOutputCheckCentrality(0x0),
818c1271 112 fOutputEvSelection(0x0),
d48d81b5 113 fOutputFlowObs(0x0),
a4ef4383 114 fDecayChannel(ch),
115 fCuts(0x0),
d48d81b5 116 fFlowEvent(0x0),
117 fRFPcuts(0x0),
a4ef4383 118 fEstimator(AliRDHFCuts::kCentTRK),
19222b31 119 fReadMC(kFALSE),
5fc4893f 120 fSimpleMode(kFALSE),
121 fOnOff()
0dbb51a0 122{
123 //constructor
124
125 //SetCutObject(cuts);
126 fCuts=cuts;
127
5fc4893f 128 fOnOff[0]=kTRUE;
129 fOnOff[1]=kTRUE;
130 fOnOff[2]=kTRUE;
818c1271 131 fOnOff[3]=kTRUE;
d48d81b5 132 fOnOff[4]=kTRUE;
5fc4893f 133
0dbb51a0 134 // Output slot #1 writes into a TH1F container (number of events)
135 DefineOutput(1,TH1F::Class()); //My private output
136 // Output slot #2 writes into a TList container (PID)
5fc4893f 137 if (fOnOff[1]) DefineOutput(2,TList::Class()); //My private output
0dbb51a0 138 // Output slot #3 writes into a TList container (Tracks)
5fc4893f 139 if (fOnOff[0]) DefineOutput(3,TList::Class()); //My private output
0dbb51a0 140 // Output slot #4 writes into a AliRDHFCuts container (cuts)
141 switch(fDecayChannel){
142 case 0:
143 DefineOutput(4,AliRDHFCutsDplustoKpipi::Class()); //My private output
144 break;
145 case 1:
146 DefineOutput(4,AliRDHFCutsD0toKpi::Class()); //My private output
147 break;
148 case 2:
149 DefineOutput(4,AliRDHFCutsDStartoKpipi::Class()); //My private output
150 break;
151 case 3:
152 DefineOutput(4,AliRDHFCutsDstoKKpi::Class()); //My private output
153 break;
154 case 4:
155 DefineOutput(4,AliRDHFCutsD0toKpipipi::Class()); //My private output
156 break;
a4ef4383 157 case 5:
0dbb51a0 158 DefineOutput(4,AliRDHFCutsLctopKpi::Class()); //My private output
159 break;
ca688a98 160 case kLambdactoV0:
161 DefineOutput(4,AliRDHFCutsLctoV0::Class()); //My private output
162 break;
a4ef4383 163 }
5fc4893f 164 if (fOnOff[2]) {
165 // Output slot #5 writes into a TList container (AliCounterCollection)
166 DefineOutput(5,TList::Class()); //My private output
167 // Output slot #6 writes into a TList container (TH1F)
168 DefineOutput(6,TList::Class()); //My private output
169 }
818c1271 170
171 if(fOnOff[3]) DefineOutput(7,TList::Class()); //My private output
d48d81b5 172 if(fOnOff[4]) DefineOutput(8,TList::Class()); //My private output
818c1271 173
0dbb51a0 174}
175
176//___________________________________________________________________________
177AliAnalysisTaskSEHFQA::~AliAnalysisTaskSEHFQA()
178{
179 //destructor
a4ef4383 180 delete fNEntries;
181
182 delete fOutputPID;
183
184 delete fOutputTrack;
185
186 delete fOutputCounters;
187
188 delete fOutputCheckCentrality;
189
818c1271 190 delete fOutputEvSelection;
191
d48d81b5 192 if(fOnOff[4]) {
193 delete fOutputFlowObs;
194 delete fFlowEvent;
195 }
0dbb51a0 196}
197
198//___________________________________________________________________________
199void AliAnalysisTaskSEHFQA::Init(){
200
201 //initialization
202 if(fDebug > 1) printf("AnalysisTaskSEHFQA::Init() \n");
203
204 switch(fDecayChannel){
205 case 0:
206 {
207 AliRDHFCutsDplustoKpipi* copycut=new AliRDHFCutsDplustoKpipi(*(static_cast<AliRDHFCutsDplustoKpipi*>(fCuts)));
208 // Post the data
209 PostData(4,copycut);
210 }
211 break;
212 case 1:
213 {
214 AliRDHFCutsD0toKpi* copycut=new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fCuts)));
215 // Post the data
216 PostData(4,copycut);
217 }
218 break;
219 case 2:
220 {
221 AliRDHFCutsDStartoKpipi* copycut=new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fCuts)));
222 // Post the data
223 PostData(4,copycut);
224 }
225 break;
226 case 3:
227 {
228 AliRDHFCutsDstoKKpi* copycut=new AliRDHFCutsDstoKKpi(*(static_cast<AliRDHFCutsDstoKKpi*>(fCuts)));
229 // Post the data
230 PostData(4,copycut);
231 }
232 break;
233 case 4:
234 {
235 AliRDHFCutsD0toKpipipi* copycut=new AliRDHFCutsD0toKpipipi(*(static_cast<AliRDHFCutsD0toKpipipi*>(fCuts)));
236 // Post the data
237 PostData(4,copycut);
238 }
239 break;
240 case 5:
241 {
242 AliRDHFCutsLctopKpi* copycut=new AliRDHFCutsLctopKpi(*(static_cast<AliRDHFCutsLctopKpi*>(fCuts)));
243 // Post the data
244 PostData(4,copycut);
245 }
246 break;
ca688a98 247 case kLambdactoV0:
248 {
249 AliRDHFCutsLctoV0* copycut=new AliRDHFCutsLctoV0(*(static_cast<AliRDHFCutsLctoV0*>(fCuts)));
250 // Post the data
251 PostData(4,copycut);
252 }
253 break;
0dbb51a0 254
255 default:
256 return;
257 }
258
259
260
261}
262
263//___________________________________________________________________________
264void AliAnalysisTaskSEHFQA::UserCreateOutputObjects()
265{
266
267 //create the output container
268 if(fDebug > 1) printf("AnalysisTaskSEHFQA::UserCreateOutputObjects() \n");
269
270 //count events
271
acc33385 272 fNEntries=new TH1F(GetOutputSlot(1)->GetContainer()->GetName(), "Counts the number of events", 10,-0.5,9.5);
0dbb51a0 273 fNEntries->GetXaxis()->SetBinLabel(1,"nEventsAnal");
274 fNEntries->GetXaxis()->SetBinLabel(2,"Pile-up Rej");
275 fNEntries->GetXaxis()->SetBinLabel(3,"No VertexingHF");
9af24f46 276 fNEntries->GetXaxis()->SetBinLabel(4,"nCandidates(AnCuts)");
277 fNEntries->GetXaxis()->SetBinLabel(5,"EventsWithGoodVtx");
5fc4893f 278 //fNEntries->GetXaxis()->SetBinLabel(6,"N. of 0SMH");
279 fNEntries->GetXaxis()->SetBinLabel(6,"N. of CSH1");
a4ef4383 280 if(fReadMC){
281 fNEntries->GetXaxis()->SetBinLabel(7,"MC Cand from c");
282 fNEntries->GetXaxis()->SetBinLabel(8,"MC Cand from b");
acc33385 283 fNEntries->GetXaxis()->SetBinLabel(9,"N fake Trks");
284 fNEntries->GetXaxis()->SetBinLabel(10,"N true Trks");
a4ef4383 285 } else{
286 fNEntries->GetXaxis()->SetBinLabel(7,"N candidates");
287 }
288
0dbb51a0 289 fNEntries->GetXaxis()->SetNdivisions(1,kFALSE);
290
291 //PID
5fc4893f 292 if(fOnOff[1]){
293 fOutputPID=new TList();
294 fOutputPID->SetOwner();
295 fOutputPID->SetName(GetOutputSlot(2)->GetContainer()->GetName());
0dbb51a0 296
5fc4893f 297 //TOF pid
23dfe729 298 TH1F* hTOFflags=new TH1F("hTOFflags","TOF flags",6,-0.5,5.5);
b906dda8 299 hTOFflags->SetMinimum(0.);
300 hTOFflags->GetXaxis()->SetBinLabel(1,"All Tracks");
23dfe729 301 hTOFflags->GetXaxis()->SetBinLabel(2,"kTPCout");
302 hTOFflags->GetXaxis()->SetBinLabel(3,"kTOFout");
303 hTOFflags->GetXaxis()->SetBinLabel(4,"kTIME");
304 hTOFflags->GetXaxis()->SetBinLabel(5,"kTOFpid");
305 hTOFflags->GetXaxis()->SetBinLabel(6,"kTOFmismatch");
b906dda8 306
5fc4893f 307 TString hname="hTOFsig";
308 TH1F* hTOFsig=new TH1F(hname.Data(),"Distribution of TOF signal;TOF time [ps];Entries", 100, -2.e3,40.e3);
0dbb51a0 309
20baad42 310 hname="hTOFstartTimeMask";
311 TH1F* hTOFstartTimeMask=new TH1F(hname.Data(),"TOF start time mask; Mask ;Entries", 8, -0.5,7.5);
312 hTOFstartTimeMask->GetXaxis()->SetBinLabel(1,"FILL");
313 hTOFstartTimeMask->GetXaxis()->SetBinLabel(2,"TOF");
314 hTOFstartTimeMask->GetXaxis()->SetBinLabel(3,"T0A");
315 hTOFstartTimeMask->GetXaxis()->SetBinLabel(4,"TOF.and.T0A");
316 hTOFstartTimeMask->GetXaxis()->SetBinLabel(5,"T0C");
317 hTOFstartTimeMask->GetXaxis()->SetBinLabel(6,"TOF.and.T0C");
318 hTOFstartTimeMask->GetXaxis()->SetBinLabel(7,"T0AC");
319 hTOFstartTimeMask->GetXaxis()->SetBinLabel(8,"TOF.and.T0AC");
320
321 hname="hTOFstartTimeRes";
322 TH1F* hTOFstartTimeRes=new TH1F(hname.Data(),"TOF start time resolution; Resolution (ps) ;Entries", 100, 0.,300.);
323
5fc4893f 324 hname="hTOFtime";
325 TH1F* hTOFtime=new TH1F(hname.Data(),"Distribution of TOF time Kaon;TOF time(Kaon) [ps];Entries", 1000, 0.,50000.);
0dbb51a0 326
5fc4893f 327 hname="hTOFtimeKaonHyptime";
b906dda8 328 TH2F* hTOFtimeKaonHyptime=new TH2F(hname.Data(),"TOFtime - timeHypothesisForKaon;p[GeV/c];TOFtime - timeHypothesisForKaon [ps]",500,0.,10.,1000,-20000.,20000.);
0dbb51a0 329
5fc4893f 330 hname="hTOFtimeKaonHyptimeAC";
b906dda8 331 TH2F* hTOFtimeKaonHyptimeAC=new TH2F(hname.Data(),"TOFtime - timeHypothesisForKaon;p[GeV/c];TOFtime - timeHypothesisForKaon [ps]",500,0.,10.,1000,-20000.,20000.);
0dbb51a0 332
5fc4893f 333 hname="hTOFsigmaKSigPid";
23dfe729 334 TH2F* hTOFsigmaKSigPid=new TH2F(hname.Data(),"(TOFsignal-timeK)/tofSigPid;p[GeV/c];(TOFsignal-timeK)/tofSigPid",500,0.,10.,400,-20,20);
0dbb51a0 335
5fc4893f 336 hname="hTOFsigmaPionSigPid";
23dfe729 337 TH2F* hTOFsigmaPionSigPid=new TH2F(hname.Data(),"(TOFsignal-time#pi)/tofSigPid;p[GeV/c];(TOFsignal-time#pi)/tofSigPid",500,0.,10.,400,-20,20);
a4ef4383 338
5fc4893f 339 hname="hTOFsigmaProtonSigPid";
23dfe729 340 TH2F* hTOFsigmaProtonSigPid=new TH2F(hname.Data(),"(TOFsignal-timep)/tofSigPid;p[GeV/c];(TOFsignal-time p)/tofSigPid",500,0.,10.,400,-20,20);
a4ef4383 341
5fc4893f 342 hname="hTOFsigPid3sigPion";
343 TH1F* hTOFsigPid3sigPion=new TH1F(hname.Data(),"TOF PID resolution (#pi) [ps]",500,0.,1000.);
a4ef4383 344
5fc4893f 345 hname="hTOFsigPid3sigKaon";
346 TH1F* hTOFsigPid3sigKaon=new TH1F(hname.Data(),"TOF PID resolution (K) [ps]",500,0.,1000.);
0dbb51a0 347
5fc4893f 348 hname="hTOFsigPid3sigProton";
349 TH1F* hTOFsigPid3sigProton=new TH1F(hname.Data(),"TOF PID resolution (p) [ps]",500,0.,1000.);
a4ef4383 350
0dbb51a0 351
5fc4893f 352 //TPC pid
353 hname="hTPCsig";
354 TH1F* hTPCsig=new TH1F(hname.Data(),"Distribution of TPC signal;TPC sig;Entries", 100, 35.,100.);
0dbb51a0 355
5fc4893f 356 hname="hTPCsigvsp";
b906dda8 357 TH2F* hTPCsigvsp=new TH2F(hname.Data(),"TPCsig vs p;TPC p[GeV/c];TPCsig",500,0.,10.,1000,35.,100.);
0dbb51a0 358
5fc4893f 359 hname="hTPCsigvspAC";
b906dda8 360 TH2F* hTPCsigvspAC=new TH2F(hname.Data(),"TPCsig vs p;TPCp[GeV/c];TPCsig",500,0.,10.,1000,35.,100.);
5fc4893f 361
362 hname="hTPCsigmaK";
b906dda8 363 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);
5fc4893f 364
365 hname="hTPCsigmaPion";
b906dda8 366 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);
5fc4893f 367
368 hname="hTPCsigmaProton";
b906dda8 369 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);
5fc4893f 370
b906dda8 371 fOutputPID->Add(hTOFflags);
5fc4893f 372 fOutputPID->Add(hTOFsig);
373 fOutputPID->Add(hTPCsig);
20baad42 374 fOutputPID->Add(hTOFstartTimeMask);
375 fOutputPID->Add(hTOFstartTimeRes);
5fc4893f 376 fOutputPID->Add(hTOFtime);
377 fOutputPID->Add(hTOFtimeKaonHyptime);
378 fOutputPID->Add(hTOFtimeKaonHyptimeAC);
5fc4893f 379 fOutputPID->Add(hTOFsigmaKSigPid);
380 fOutputPID->Add(hTOFsigmaPionSigPid);
381 fOutputPID->Add(hTOFsigmaProtonSigPid);
382 fOutputPID->Add(hTOFsigPid3sigPion);
383 fOutputPID->Add(hTOFsigPid3sigKaon);
384 fOutputPID->Add(hTOFsigPid3sigProton);
385 fOutputPID->Add(hTPCsigvsp);
386 fOutputPID->Add(hTPCsigvspAC);
387 fOutputPID->Add(hTPCsigmaK);
388 fOutputPID->Add(hTPCsigmaPion);
389 fOutputPID->Add(hTPCsigmaProton);
24748c57 390
391 if(fReadMC){
392 //TOF
393 hname="hTOFsigmaMCKSigPid";
394 TH2F* hTOFsigmaMCKSigPid=new TH2F(hname.Data(),"(TOFsignal-timeK)/tofSigPid;p[GeV/c];(TOFsignal-timeK)/tofSigPid",500,0.,10.,400,-20,20);
395
396 hname="hTOFsigmaMCPionSigPid";
397 TH2F* hTOFsigmaMCPionSigPid=new TH2F(hname.Data(),"(TOFsignal-time#pi)/tofSigPid;p[GeV/c];(TOFsignal-time#pi)/tofSigPid",500,0.,10.,400,-20,20);
398
399 hname="hTOFsigmaMCProtonSigPid";
400 TH2F* hTOFsigmaMCProtonSigPid=new TH2F(hname.Data(),"(TOFsignal-timep)/tofSigPid;p[GeV/c];(TOFsignal-time p)/tofSigPid",500,0.,10.,400,-20,20);
401
402 //TPC
403 hname="hTPCsigmaMCK";
404 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);
405
406 hname="hTPCsigmaMCPion";
407 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);
408
409 hname="hTPCsigmaMCProton";
410 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);
411
412 fOutputPID->Add(hTOFsigmaMCKSigPid);
413 fOutputPID->Add(hTOFsigmaMCPionSigPid);
414 fOutputPID->Add(hTOFsigmaMCProtonSigPid);
415 fOutputPID->Add(hTPCsigmaMCK);
416 fOutputPID->Add(hTPCsigmaMCPion);
417 fOutputPID->Add(hTPCsigmaMCProton);
418
419 }
5fc4893f 420 }
0dbb51a0 421
422 //quality of the tracks
5fc4893f 423 if(fOnOff[0]){
424 fOutputTrack=new TList();
425 fOutputTrack->SetOwner();
426 fOutputTrack->SetName(GetOutputSlot(3)->GetContainer()->GetName());
0dbb51a0 427
5fc4893f 428 TString hname="hnClsITS";
429 TH1F* hnClsITS=new TH1F(hname.Data(),"Distribution of number of ITS clusters;nITScls;Entries",7,-0.5,6.5);
0dbb51a0 430
39dd297f 431 hname="hnClsITSselTr";
432 TH1F* hnClsITSselTr=new TH1F(hname.Data(),"Distribution of number of ITS clusters selected tracks;nITScls;Entries",7,-0.5,6.5);
433
5fc4893f 434 hname="hnClsITS-SA";
435 TH1F* hnClsITSSA=new TH1F(hname.Data(),"Distribution of number of ITS clusters(ITS-SA);nITScls;Entries",7,-0.5,6.5);
0dbb51a0 436
bc6846db 437
438 hname="hnLayerITS";
f3e1ad2f 439 TH1F* hnLayerITS=new TH1F(hname.Data(),"Number of tracks with point in layer;ITS layer;",7,-1.5,5.5);
440 hnLayerITS->GetXaxis()->SetBinLabel(1,"n tracks");
4a4aee7b 441 hnLayerITS->GetXaxis()->SetBinLabel(2,"SPDin");
442 hnLayerITS->GetXaxis()->SetBinLabel(3,"SPDout");
443 hnLayerITS->GetXaxis()->SetBinLabel(4,"SDDin");
444 hnLayerITS->GetXaxis()->SetBinLabel(5,"SDDout");
445 hnLayerITS->GetXaxis()->SetBinLabel(6,"SSDin");
446 hnLayerITS->GetXaxis()->SetBinLabel(7,"SSDout");
bc6846db 447
448 hname="hnLayerITSsa";
f3e1ad2f 449 TH1F* hnLayerITSsa=new TH1F(hname.Data(),"Number of tracks with point in layer;ITS layer;",7,-1.5,5.5);
450 hnLayerITSsa->GetXaxis()->SetBinLabel(1,"n tracks");
4a4aee7b 451 hnLayerITSsa->GetXaxis()->SetBinLabel(2,"SPDin");
452 hnLayerITSsa->GetXaxis()->SetBinLabel(3,"SPDout");
453 hnLayerITSsa->GetXaxis()->SetBinLabel(4,"SDDin");
454 hnLayerITSsa->GetXaxis()->SetBinLabel(5,"SDDout");
455 hnLayerITSsa->GetXaxis()->SetBinLabel(6,"SSDin");
456 hnLayerITSsa->GetXaxis()->SetBinLabel(7,"SSDout");
f3e1ad2f 457
5fc4893f 458 hname="hnClsSPD";
459 TH1F* hnClsSPD=new TH1F(hname.Data(),"Distribution of number of SPD clusters;nSPDcls;Entries",3,-0.5,2.5);
0dbb51a0 460
5fc4893f 461 hname="hptGoodTr";
462 TH1F* hptGoodTr=new TH1F(hname.Data(),"Pt distribution of 'good' tracks;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
463 hptGoodTr->SetTitleOffset(1.3,"Y");
0dbb51a0 464
824b448a 465 if(!fSimpleMode){
466 hname="hptGoodTrFromDaugh";
467 TH1F* hptGoodTrFromDaugh=new TH1F(hname.Data(),"Pt distribution of 'good' candidate's daughters;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
468 hptGoodTrFromDaugh->SetTitleOffset(1.3,"Y");
469 fOutputTrack->Add(hptGoodTrFromDaugh);
470 }
471
5fc4893f 472 hname="hdistrGoodTr";
824b448a 473 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);
5fc4893f 474 hdistrGoodTr->SetTitleOffset(1.3,"Y");
0dbb51a0 475
824b448a 476 hname="hdistrSelTr";
477 TH1F* hdistrSelTr=new TH1F(hname.Data(),"Distribution of number of Selected tracks per event;no.good-tracks/ev;Entries",4000,-0.5,3999.5);
478 hdistrSelTr->SetTitleOffset(1.3,"Y");
479
5fc4893f 480 hname="hd0";
4563d678 481 TH1F* hd0=new TH1F(hname.Data(),"Impact parameter (rphi) distribution of 'good' tracks;d_{0rphi}[cm];Entries/10^{3} cm",200,-0.1,0.1);
482
483 hname="hd0z";
484 TH1F* hd0z=new TH1F(hname.Data(),"Impact parameter (z) distribution of 'good' tracks;d_{0z}[cm];Entries/10^{3} cm",200,-0.1,0.1);
0dbb51a0 485
5fc4893f 486 fOutputTrack->Add(hnClsITS);
39dd297f 487 fOutputTrack->Add(hnClsITSselTr);
5fc4893f 488 fOutputTrack->Add(hnClsITSSA);
bc6846db 489 fOutputTrack->Add(hnLayerITS);
490 fOutputTrack->Add(hnLayerITSsa);
5fc4893f 491 fOutputTrack->Add(hnClsSPD);
492 fOutputTrack->Add(hptGoodTr);
493 fOutputTrack->Add(hdistrGoodTr);
824b448a 494 fOutputTrack->Add(hdistrSelTr);
5fc4893f 495 fOutputTrack->Add(hd0);
4563d678 496 fOutputTrack->Add(hd0z);
acc33385 497
5fc4893f 498 if(fReadMC){
499 hname="hdistrFakeTr";
500 TH1F* hdistrFakeTr=new TH1F(hname.Data(),"Distribution of number of fake tracks per event;no.fake-tracks/ev;Entries",4000,-0.5,3999.5);
824b448a 501 hdistrFakeTr->SetTitleOffset(1.3,"Y");
acc33385 502
5fc4893f 503 hname="hd0f";
504 TH1F* hd0f=new TH1F(hname.Data(),"Impact parameter distribution of fake tracks;d_{0}[cm];Entries/10^{3} cm",200,-0.1,0.1);
acc33385 505
5fc4893f 506 hname="hptFakeTr";
507 TH1F* hptFakeTr=new TH1F(hname.Data(),"Pt distribution of fake tracks;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
ad42e35b 508 hptFakeTr->SetTitleOffset(1.3,"Y");
824b448a 509 if(!fSimpleMode){
510 hname="hptFakeTrFromDaugh";
511 TH1F* hptFakeTrFromDaugh=new TH1F(hname.Data(),"Pt distribution of fake tracks from daughters;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
512 hptFakeTrFromDaugh->SetTitleOffset(1.3,"Y");
513 fOutputTrack->Add(hptFakeTrFromDaugh);
514 }
acc33385 515
5fc4893f 516 fOutputTrack->Add(hptFakeTr);
517 fOutputTrack->Add(hdistrFakeTr);
518 fOutputTrack->Add(hd0f);
519
520 }
acc33385 521 }
522
0dbb51a0 523
5fc4893f 524 if(fOnOff[2] && fCuts->GetUseCentrality()){
a4ef4383 525
526 //Centrality (Counters)
527 fOutputCounters=new TList();
528 fOutputCounters->SetOwner();
529 fOutputCounters->SetName(GetOutputSlot(5)->GetContainer()->GetName());
530
531 AliCounterCollection *stdEstimator=new AliCounterCollection("stdEstimator");
532 stdEstimator->AddRubric("run",500000);
5fc4893f 533 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");
a4ef4383 534 stdEstimator->Init();
535 AliCounterCollection *secondEstimator=new AliCounterCollection("secondEstimator");
536 secondEstimator->AddRubric("run",500000);
5fc4893f 537 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");
a4ef4383 538 secondEstimator->Init();
1b765719 539
a4ef4383 540 fOutputCounters->Add(stdEstimator);
541 fOutputCounters->Add(secondEstimator);
1b765719 542
a4ef4383 543 //Centrality (Checks)
544 fOutputCheckCentrality=new TList();
545 fOutputCheckCentrality->SetOwner();
546 fOutputCheckCentrality->SetName(GetOutputSlot(6)->GetContainer()->GetName());
547
5fc4893f 548 TString hname="hNtrackletsIn";
a4ef4383 549 TH1F* hNtrackletsIn=new TH1F(hname.Data(),"Number of tracklets in Centrality range;ntracklets;Entries",5000,-0.5,4999.5);
550
551 hname="hMultIn";
552 TH1F* hMultIn=new TH1F(hname.Data(),"Multiplicity;multiplicity in Centrality range;Entries",10000,-0.5,9999.5);
553
554 hname="hNtrackletsOut";
555 TH1F* hNtrackletsOut=new TH1F(hname.Data(),"Number of tracklets out of Centrality range;ntracklets;Entries",5000,-0.5,4999.5);
556
557 hname="hMultOut";
558 TH1F* hMultOut=new TH1F(hname.Data(),"Multiplicity out of Centrality range;multiplicity;Entries",10000,-0.5,9999.5);
559
ac0c2841 560 hname="hMultvsPercentile";
7a5f2502 561 TH2F* hMultvsPercentile=new TH2F(hname.Data(),"Multiplicity vs Percentile;multiplicity;percentile",10000,-0.5,9999.5,240,-10.,110);
ac0c2841 562
7a5f2502 563 hname="hntrklvsPercentile";
564 TH2F* hntrklvsPercentile=new TH2F(hname.Data(),"N tracklets vs Percentile;ntracklets;percentile",5000,-0.5,4999.5,240,-10.,110);
23dfe729 565
138e0d89 566 hname="hnTPCTracksvsPercentile";
567 TH2F* hnTPCTracksvsPercentile=new TH2F(hname.Data(),"N TPC tracks vs Percentile;nTPCTracks;percentile",5000,-0.5,9999.5,240,-10.,110);
568
569 hname="hnTPCITSTracksvsPercentile";
570 TH2F* hnTPCITSTracksvsPercentile=new TH2F(hname.Data(),"N TPC+ITS tracks vs Percentile;nTPCITSTracks;percentile",5000,-0.5,9999.5,240,-10.,110);
571
572 hname="hnTPCITS1SPDTracksvsPercentile";
573 TH2F* hnTPCITS1SPDTracksvsPercentile=new TH2F(hname.Data(),"N TPC+ITS+1SPD tracks vs Percentile;nTPCITS1SPDTracks;percentile",5000,-0.5,9999.5,240,-10.,110);
574
b68a0f6a 575 hname="hV0MultiplicityPercentile";
576 TH2F*hV0MultiplicityPercentile = new TH2F(hname.Data(),"V0 Multiplicity vs Percentile;V0 multiplicity;percentile",1000,-0.5,9999.5,120,-10.,110);
577
578 hname="hV0MultiplicityNtrackletsIn";
579 TH2F*hV0MultiplicityNtrackletsIn = new TH2F(hname.Data(),"V0 Multiplicity vs Number of tracklets in the CC;V0 multiplicity;percentile",1000,-0.5,9999.5,5000,-0.5,4999.5);
580
581 hname="hStdPercentileSPDPercentile";
582 TH2F* hStdPercentileSPDPercentile = new TH2F(hname.Data(),"Std estimator Percentile Vs SPD Percentile;Std estimator percentile;SPD percentile",120,-10.,110,120,-10.,110);
583
a4ef4383 584 fOutputCheckCentrality->Add(hNtrackletsIn);
585 fOutputCheckCentrality->Add(hNtrackletsOut);
586 fOutputCheckCentrality->Add(hMultIn);
587 fOutputCheckCentrality->Add(hMultOut);
ac0c2841 588 fOutputCheckCentrality->Add(hMultvsPercentile);
7a5f2502 589 fOutputCheckCentrality->Add(hntrklvsPercentile);
138e0d89 590 fOutputCheckCentrality->Add(hnTPCTracksvsPercentile);
591 fOutputCheckCentrality->Add(hnTPCITSTracksvsPercentile);
592 fOutputCheckCentrality->Add(hnTPCITS1SPDTracksvsPercentile);
b68a0f6a 593 fOutputCheckCentrality->Add(hV0MultiplicityPercentile);
594 fOutputCheckCentrality->Add(hV0MultiplicityNtrackletsIn);
595 fOutputCheckCentrality->Add(hStdPercentileSPDPercentile);
82f89d0d 596
597 PostData(6,fOutputCheckCentrality);
598
a4ef4383 599 } else{
5fc4893f 600 if(fOnOff[0]){
601 TString hname="hNtracklets";
602 TH1F* hNtracklets=new TH1F(hname.Data(),"Number of tracklets;ntracklets;Entries",5000,-0.5,4999.5);
603
604 hname="hMult";
605 TH1F* hMult=new TH1F(hname.Data(),"Multiplicity;multiplicity;Entries",10000,-0.5,9999.5);
606 fOutputTrack->Add(hNtracklets);
607 fOutputTrack->Add(hMult);
608 }
a4ef4383 609 }
610
818c1271 611 //event selection (z vertex for the moment)
612 if(fOnOff[3]){
613 fOutputEvSelection=new TList();
614 fOutputEvSelection->SetOwner();
615 fOutputEvSelection->SetName(GetOutputSlot(7)->GetContainer()->GetName());
616 AliCounterCollection *evselection=new AliCounterCollection("evselection");
617 evselection->AddRubric("run",500000);
618 evselection->AddRubric("evnonsel","zvtx");
619 evselection->Init();
620
6c66ddad 621 TH1F* hxvtx=new TH1F("hxvtx", "Distribution of x_{VTX};x_{VTX} [cm];Entries",100,-1,1);
622 TH1F* hyvtx=new TH1F("hyvtx", "Distribution of y_{VTX};y_{VTX} [cm];Entries",100,-1,1);
623 TH1F* hzvtx=new TH1F("hzvtx", "Distribution of z_{VTX};z_{VTX} [cm];Entries",100,-30,30);
624 TH1F* hxvtxSelEv=new TH1F("hxvtxSelEv", "Distribution of x_{VTX} Selected Ev;x_{VTX} [cm];Entries",100,-1,1);
625 TH1F* hyvtxSelEv=new TH1F("hyvtxSelEv", "Distribution of y_{VTX} Selected Ev;y_{VTX} [cm];Entries",100,-1,1);
626 TH1F* hzvtxSelEv=new TH1F("hzvtxSelEv", "Distribution of z_{VTX} Selected Ev;z_{VTX} [cm];Entries",100,-30,30);
627 TH1F* hWhichVert=new TH1F("hWhichVert","Vertex Type",4,-1.5,2.5);
628 hWhichVert->GetXaxis()->SetBinLabel(1,"Not found");
629 hWhichVert->GetXaxis()->SetBinLabel(2,"Track");
630 hWhichVert->GetXaxis()->SetBinLabel(3,"SPD-3D");
631 hWhichVert->GetXaxis()->SetBinLabel(4,"SPD-z");
632 TH1F* hWhichVertSelEv=new TH1F("hWhichVertSelEv","Vertex Type",4,-1.5,2.5);
633 hWhichVertSelEv->GetXaxis()->SetBinLabel(1,"Not found");
634 hWhichVertSelEv->GetXaxis()->SetBinLabel(2,"Track");
635 hWhichVertSelEv->GetXaxis()->SetBinLabel(3,"SPD-3D");
636 hWhichVertSelEv->GetXaxis()->SetBinLabel(4,"SPD-z");
23dfe729 637
2a844546 638 TH2F* hTrigCent=new TH2F("hTrigCent","Centrality vs. Trigger types",12,-1.5,10.5,12,-10,110);
23dfe729 639 hTrigCent->GetXaxis()->SetBinLabel(1,"All");
2a844546 640 hTrigCent->GetXaxis()->SetBinLabel(2,"kAny");
641 hTrigCent->GetXaxis()->SetBinLabel(3,"kMB");
642 hTrigCent->GetXaxis()->SetBinLabel(4,"kINT7");
643 hTrigCent->GetXaxis()->SetBinLabel(5,"kCINT5");
644 hTrigCent->GetXaxis()->SetBinLabel(6,"kCent");
645 hTrigCent->GetXaxis()->SetBinLabel(7,"kSemiCent");
646 hTrigCent->GetXaxis()->SetBinLabel(8,"kEMC1+7");
647 hTrigCent->GetXaxis()->SetBinLabel(9,"kEMCJET+GAMMA");
648 hTrigCent->GetXaxis()->SetBinLabel(10,"Muons");
649 hTrigCent->GetXaxis()->SetBinLabel(11,"PHOS");
650 hTrigCent->GetXaxis()->SetBinLabel(12,"Others");
651
652 TH2F* hTrigMul=new TH2F("hTrigMul","Multiplicity vs. Trigger types",12,-1.5,10.5,100,0.,10000.);
23dfe729 653 hTrigMul->GetXaxis()->SetBinLabel(1,"All");
2a844546 654 hTrigMul->GetXaxis()->SetBinLabel(2,"kAny");
655 hTrigMul->GetXaxis()->SetBinLabel(3,"kMB");
656 hTrigMul->GetXaxis()->SetBinLabel(4,"kINT7");
657 hTrigMul->GetXaxis()->SetBinLabel(5,"kCINT5");
658 hTrigMul->GetXaxis()->SetBinLabel(6,"kCent");
659 hTrigMul->GetXaxis()->SetBinLabel(7,"kSemiCent");
660 hTrigMul->GetXaxis()->SetBinLabel(8,"kEMC1+7");
661 hTrigMul->GetXaxis()->SetBinLabel(9,"kEMCJET+GAMMA");
662 hTrigMul->GetXaxis()->SetBinLabel(10,"Muons");
663 hTrigMul->GetXaxis()->SetBinLabel(11,"PHOS");
664 hTrigMul->GetXaxis()->SetBinLabel(12,"Others");
665
666 TH2F* hTrigCentSel=new TH2F("hTrigCentSel","Trigger types",12,-1.5,10.5,12,-10,110);
23dfe729 667 hTrigCentSel->GetXaxis()->SetBinLabel(1,"All");
2a844546 668 hTrigCentSel->GetXaxis()->SetBinLabel(2,"kAny");
669 hTrigCentSel->GetXaxis()->SetBinLabel(3,"kMB");
670 hTrigCentSel->GetXaxis()->SetBinLabel(4,"kINT7");
671 hTrigCentSel->GetXaxis()->SetBinLabel(5,"kCINT5");
672 hTrigCentSel->GetXaxis()->SetBinLabel(6,"kCent");
673 hTrigCentSel->GetXaxis()->SetBinLabel(7,"kSemiCent");
674 hTrigCentSel->GetXaxis()->SetBinLabel(8,"kEMC1+7");
675 hTrigCentSel->GetXaxis()->SetBinLabel(9,"kEMCJET+GAMMA");
676 hTrigCentSel->GetXaxis()->SetBinLabel(10,"Muons");
677 hTrigCentSel->GetXaxis()->SetBinLabel(11,"PHOS");
678 hTrigCentSel->GetXaxis()->SetBinLabel(12,"Others");
23dfe729 679
1b765719 680 AliCounterCollection *trigCounter=new AliCounterCollection("trigCounter");
681 trigCounter->AddRubric("run",500000);
5e67f11a 682 trigCounter->AddRubric("triggerType","All/Any/MB/Cent/SemiCent/EMCAL/MUON/NoPhysSelMUON/NoPhysSelEvNot7/NoPhysSelCMUP1/NoPhysSelMB/NoPhysSelCent/NoPhysSelSemiCent");
1b765719 683 trigCounter->Init();
684
818c1271 685 fOutputEvSelection->Add(evselection);
6c66ddad 686 fOutputEvSelection->Add(hxvtx);
687 fOutputEvSelection->Add(hyvtx);
818c1271 688 fOutputEvSelection->Add(hzvtx);
6c66ddad 689 fOutputEvSelection->Add(hxvtxSelEv);
690 fOutputEvSelection->Add(hyvtxSelEv);
691 fOutputEvSelection->Add(hzvtxSelEv);
692 fOutputEvSelection->Add(hWhichVert);
693 fOutputEvSelection->Add(hWhichVertSelEv);
23dfe729 694 fOutputEvSelection->Add(hTrigCent);
695 fOutputEvSelection->Add(hTrigMul);
696 fOutputEvSelection->Add(hTrigCentSel);
1b765719 697 fOutputEvSelection->Add(trigCounter);
818c1271 698 }
d48d81b5 699 if(fOnOff[4]){ // FLOW OBSERVABLES
700 fOutputFlowObs=new TList();
701 fOutputFlowObs->SetOwner();
702 fOutputFlowObs->SetName(GetOutputSlot(8)->GetContainer()->GetName());
703
704 fFlowEvent = new AliFlowEvent(3000);
705 fRFPcuts = new AliFlowTrackCuts("rfpCuts");
706
65274ad6 707 TH2F *hFEvents = new TH2F("hFlowEvents","FlowEvent Selection",7,0,7,7,-10,60);
d48d81b5 708 hFEvents->GetXaxis()->SetBinLabel(1,"REACHED");
709 hFEvents->GetXaxis()->SetBinLabel(2,"TRIGGERED");
65274ad6 710 hFEvents->GetXaxis()->SetBinLabel(3,"kMB");
711 hFEvents->GetXaxis()->SetBinLabel(4,"kCent");
712 hFEvents->GetXaxis()->SetBinLabel(5,"kSemiC");
713 hFEvents->GetXaxis()->SetBinLabel(6,"Triggered + vtx cut");
714 hFEvents->GetXaxis()->SetBinLabel(7,"UnexpectedBehaviour");
d48d81b5 715 fOutputFlowObs->Add(hFEvents);
716
717 TProfile2D *hQ[3];
718 TH2F *hAngleQ[3];
719 TH3F *hPhiEta[3];
720 TString ref[3] = {"FB1","FB128","VZE"};
721 Int_t etabin[3] = {40,40,20};
722 Int_t etamax[3] = { 1, 1, 5};
723 for(Int_t i=0; i<3; ++i) {
724 hQ[i]= new TProfile2D( Form("h%s_Q",ref[i].Data()),
725 Form("Q_{2} components for %s",ref[i].Data()),
726 4,0,4,12,0,60,"s");
727 hQ[i]->GetXaxis()->SetBinLabel(1,"Qx^{-}");
728 hQ[i]->GetXaxis()->SetBinLabel(2,"Qy^{-}");
729 hQ[i]->GetXaxis()->SetBinLabel(3,"Qx^{+}");
730 hQ[i]->GetXaxis()->SetBinLabel(4,"Qy^{+}");
731 hQ[i]->GetYaxis()->SetTitle("Centrality");
732 fOutputFlowObs->Add(hQ[i]);
733
734 hAngleQ[i] = new TH2F( Form("h%s_AngleQ",ref[i].Data()),
735 Form("#Psi_{2} for %s",ref[i].Data()),
736 72,0,TMath::Pi(),12,0,60);
737 hAngleQ[i]->GetXaxis()->SetTitle( Form("#Psi_{2}^{%s}",ref[i].Data()) );
738 hAngleQ[i]->GetYaxis()->SetTitle("Centrality");
739 fOutputFlowObs->Add(hAngleQ[i]);
740
741 hPhiEta[i] = new TH3F( Form("h%s_PhiEta",ref[i].Data()),
742 Form("Eta vs Phi for %s",ref[i].Data()),
65274ad6 743 144,0,TMath::TwoPi(),etabin[i],-1.0*etamax[i],+1.0*etamax[i],12,0,60);
d48d81b5 744 hPhiEta[i]->GetXaxis()->SetTitle("Phi");
745 hPhiEta[i]->GetYaxis()->SetTitle("Eta");
746 hPhiEta[i]->GetZaxis()->SetTitle("Centrality");
747 fOutputFlowObs->Add(hPhiEta[i]);
748
749 }
750 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);
751 hTPCVZE_AngleQ->GetXaxis()->SetTitle("#Psi_{2}^{TPC}");
752 hTPCVZE_AngleQ->GetYaxis()->SetTitle("#Psi_{2}^{VZE}");
753 hTPCVZE_AngleQ->GetZaxis()->SetTitle("Centrality");
754 fOutputFlowObs->Add(hTPCVZE_AngleQ);
65274ad6 755
756 TH2F *hCentVsMultRPS = new TH2F("hCentVsMultRPS", " Centrality Vs. Multiplicity RPs",5000, 0, 5000.,12,0,60 );
757 hCentVsMultRPS->GetXaxis()->SetTitle("Multiplicity RPs");
758 hCentVsMultRPS->GetYaxis()->SetTitle("Centrality");
759 fOutputFlowObs->Add(hCentVsMultRPS);
d48d81b5 760 }
e7af8919 761
762 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
763 AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
764 AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
765 if (fCuts->GetIsUsePID() && fDecayChannel==kLambdactoV0) {
766 fCuts->GetPidHF()->SetPidResponse(pidResp);
89b8ddf3 767 AliRDHFCutsLctoV0* lccuts=dynamic_cast<AliRDHFCutsLctoV0*>(fCuts);
768 if(lccuts){
769 lccuts->GetPidV0pos()->SetPidResponse(pidResp);
770 lccuts->GetPidV0neg()->SetPidResponse(pidResp);
771 fCuts->GetPidHF()->SetOldPid(kFALSE);
772 lccuts->GetPidV0pos()->SetOldPid(kFALSE);
773 lccuts->GetPidV0neg()->SetOldPid(kFALSE);
774 }
e7af8919 775 }
776
0dbb51a0 777 // Post the data
778 PostData(1,fNEntries);
d48d81b5 779
5fc4893f 780 if(fOnOff[1]) PostData(2,fOutputPID);
781 if(fOnOff[0]) PostData(3,fOutputTrack);
0dbb51a0 782 PostData(4,fCuts);
5fc4893f 783 if(fOnOff[2]) PostData(5,fOutputCounters);
818c1271 784 if(fOnOff[3]) PostData(7,fOutputEvSelection);
d48d81b5 785 if(fOnOff[4]) PostData(8,fOutputFlowObs);
818c1271 786
5fc4893f 787 if(!fOnOff[0] && !fOnOff[1] && !fOnOff[2]) AliError("Nothing will be filled!");
0dbb51a0 788}
789
790//___________________________________________________________________________
791void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
792{
793 // Execute analysis for current event
794
795 AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
796 if(fDebug>2) printf("Analysing decay %d\n",fDecayChannel);
797 // Post the data already here
798 PostData(1,fNEntries);
5fc4893f 799 if(fOnOff[1]) PostData(2,fOutputPID);
800 if(fOnOff[0]) PostData(3,fOutputTrack);
0dbb51a0 801 PostData(4,fCuts);
5fc4893f 802 if(fOnOff[2]) {
803 PostData(5,fOutputCounters);
804 if(fCuts->GetUseCentrality()) PostData(6,fOutputCheckCentrality);
805 }
0dbb51a0 806
807 TClonesArray *arrayProng =0;
808 Int_t pdg=0;
a4ef4383 809 Int_t *pdgdaughters=0x0;
810
0dbb51a0 811 if(!aod && AODEvent() && IsStandardAOD()) {
812 // In case there is an AOD handler writing a standard AOD, use the AOD
813 // event in memory rather than the input (ESD) event.
814 aod = dynamic_cast<AliAODEvent*> (AODEvent());
815 // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
816 // have to taken from the AOD event hold by the AliAODExtension
817 AliAODHandler* aodHandler = (AliAODHandler*)
818 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
819 if(aodHandler->GetExtensions()) {
820
821 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
822 AliAODEvent *aodFromExt = ext->GetAOD();
823
824
825
826 switch(fDecayChannel){
827 case 0:
828 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
829 pdg=411;
a4ef4383 830 if(fReadMC){
831 pdgdaughters =new Int_t[3];
832 pdgdaughters[0]=211;//pi
833 pdgdaughters[1]=321;//K
834 pdgdaughters[2]=211;//pi
835 }
0dbb51a0 836 break;
837 case 1:
838 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("D0toKpi");
839 pdg=421;
a4ef4383 840 if(fReadMC){
841 pdgdaughters =new Int_t[2];
842 pdgdaughters[0]=211;//pi
843 pdgdaughters[1]=321;//K
844 }
0dbb51a0 845 break;
846 case 2:
847 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar");
848 pdg=413;
a4ef4383 849 if(fReadMC){
fb9311e8 850 pdgdaughters =new Int_t[3];
a4ef4383 851 pdgdaughters[1]=211;//pi
852 pdgdaughters[0]=321;//K
853 pdgdaughters[2]=211;//pi (soft?)
854 }
0dbb51a0 855 break;
856 case 3:
857 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
858 pdg=431;
a4ef4383 859 if(fReadMC){
860 pdgdaughters =new Int_t[3];
861 pdgdaughters[0]=321;//K
862 pdgdaughters[1]=321;//K
863 pdgdaughters[2]=211;//pi
864 }
0dbb51a0 865 break;
866 case 4:
867 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm4Prong");
868 pdg=421;
a4ef4383 869 if(fReadMC){
870 pdgdaughters =new Int_t[4];
871 pdgdaughters[0]=321;
872 pdgdaughters[1]=211;
873 pdgdaughters[2]=211;
874 pdgdaughters[3]=211;
875 }
0dbb51a0 876 break;
877 case 5:
878 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
879 pdg=4122;
a4ef4383 880 if(fReadMC){
881 pdgdaughters =new Int_t[3];
882 pdgdaughters[0]=2212;//p
883 pdgdaughters[1]=321;//K
884 pdgdaughters[2]=211;//pi
885 }
0dbb51a0 886 break;
ca688a98 887 case kLambdactoV0:
e7af8919 888 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("CascadesHF");
ca688a98 889 pdg=4122;
890 if(fReadMC){
891 pdgdaughters =new Int_t[3];
892 pdgdaughters[0]=2212;//p
893 pdgdaughters[1]=211;//pi
894 pdgdaughters[2]=211;//pi
895 }
896 break;
0dbb51a0 897 }
898 }
dc222f77 899 } else if(aod) {
0dbb51a0 900 switch(fDecayChannel){
901 case 0:
902 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
903 pdg=411;
a4ef4383 904 if(fReadMC){
905 pdgdaughters =new Int_t[3];
906 pdgdaughters[0]=211;//pi
907 pdgdaughters[1]=321;//K
908 pdgdaughters[2]=211;//pi
909 }
0dbb51a0 910 break;
911 case 1:
912 arrayProng=(TClonesArray*)aod->GetList()->FindObject("D0toKpi");
913 pdg=421;
a4ef4383 914 if(fReadMC){
915 pdgdaughters =new Int_t[2];
916 pdgdaughters[0]=211;//pi
917 pdgdaughters[1]=321;//K
918 }
0dbb51a0 919 break;
920 case 2:
921 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Dstar");
922 pdg=413;
a4ef4383 923 if(fReadMC){
24bcb2f3 924 pdgdaughters =new Int_t[3];
a4ef4383 925 pdgdaughters[1]=211;//pi
926 pdgdaughters[0]=321;//K
927 pdgdaughters[2]=211;//pi (soft?)
928 }
0dbb51a0 929 break;
930 case 3:
931 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
932 pdg=431;
a4ef4383 933 if(fReadMC){
934 pdgdaughters =new Int_t[3];
935 pdgdaughters[0]=321;//K
936 pdgdaughters[1]=321;//K
937 pdgdaughters[2]=211;//pi
938 }
0dbb51a0 939 break;
940 case 4:
941 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm4Prong");
942 pdg=421;
a4ef4383 943 if(fReadMC){
944 pdgdaughters =new Int_t[4];
945 pdgdaughters[0]=321;
946 pdgdaughters[1]=211;
947 pdgdaughters[2]=211;
948 pdgdaughters[3]=211;
949 }
0dbb51a0 950 break;
951 case 5:
952 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
953 pdg=4122;
a4ef4383 954 if(fReadMC){
955 pdgdaughters =new Int_t[3];
956 pdgdaughters[0]=2212;//p
957 pdgdaughters[1]=321;//K
958 pdgdaughters[2]=211;//pi
959 }
0dbb51a0 960 break;
ca688a98 961 case kLambdactoV0:
e7af8919 962 arrayProng=(TClonesArray*)aod->GetList()->FindObject("CascadesHF");
ca688a98 963 pdg=4122;
964 if(fReadMC){
965 pdgdaughters =new Int_t[3];
966 pdgdaughters[0]=2212;//p
967 pdgdaughters[1]=211;//pi
968 pdgdaughters[2]=211;//pi
969 }
970 break;
0dbb51a0 971 }
972 }
19222b31 973 Bool_t isSimpleMode=fSimpleMode;
0dbb51a0 974 if(!arrayProng) {
975 AliInfo("Branch not found! The output will contain only trak related histograms\n");
976 isSimpleMode=kTRUE;
9af24f46 977 fNEntries->Fill(2);
0dbb51a0 978 }
979
a4ef4383 980 TClonesArray *mcArray = 0;
981 AliAODMCHeader *mcHeader = 0;
982
3655ecf2 983 if(!aod) {
984 delete [] pdgdaughters;
985 return;
986 }
987
a4ef4383 988 //check if MC
989 if(fReadMC) {
990 // load MC particles
991 mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
992 if(!mcArray) {
993 printf("AliAnalysisTaskSEHFQA::UserExec: MC particles branch not found!\n");
fb9311e8 994 delete [] pdgdaughters;
a4ef4383 995 return;
996 }
997
998 // load MC header
999 mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1000 if(!mcHeader) {
1001 printf("AliAnalysisTaskSEHFQA::UserExec: MC header branch not found!\n");
fb9311e8 1002 delete [] pdgdaughters;
a4ef4383 1003 return;
1004 }
1005 }
23dfe729 1006
1007
1008 UInt_t evSelMask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1009 Double_t centrality=fCuts->GetCentrality(aod);
1010 Double_t multiplicity=aod->GetHeader()->GetRefMultiplicity();
17531bbd 1011 Int_t runNumber = aod->GetRunNumber();
5e67f11a 1012 TString trigClass=aod->GetFiredTriggerClasses();
138e0d89 1013 Int_t nAODtracks=aod->GetNTracks();
1014 Int_t nSelTracksTPCOnly=0;
1015 Int_t nSelTracksTPCITS=0;
1016 Int_t nSelTracksTPCITS1SPD=0;
1017
1018 for (Int_t k=0;k<nAODtracks;k++){
1019 AliAODTrack* track=aod->GetTrack(k);
1020 if(track->GetID()<0) continue;
1021 Int_t nclsTot=0,nclsSPD=0;
1022 for(Int_t l=0;l<6;l++) {
1023 if(TESTBIT(track->GetITSClusterMap(),l)) {
1024 nclsTot++; if(l<2) nclsSPD++;
1025 }
1026 }
1027 UShort_t nTPCClus=track->GetTPCClusterMap().CountBits();
1028 if(TMath::Abs(track->Eta())<0.8 && nTPCClus>=70 && track->GetStatus()&AliESDtrack::kTPCrefit){
1029 if(track->TestFilterBit(1)) nSelTracksTPCOnly++;
1030 if(track->GetStatus()&AliESDtrack::kITSrefit){
1031 nSelTracksTPCITS++;
1032 if(nclsSPD>0) nSelTracksTPCITS1SPD++;
1033 }
1034 }
1035 }
1036
d48d81b5 1037 if(fOnOff[4]) {
1038 FillFlowObs(aod);
1039 PostData(8,fOutputFlowObs);
1040 }
1b765719 1041 if(fOnOff[3]){
1042 TH2F* hTrigC=(TH2F*)fOutputEvSelection->FindObject("hTrigCent");
1043 TH2F* hTrigM=(TH2F*)fOutputEvSelection->FindObject("hTrigMul");
1044 AliCounterCollection* trigCount=(AliCounterCollection*)fOutputEvSelection->FindObject("trigCounter");
17531bbd 1045
2a844546 1046 hTrigC->Fill(-1.,centrality);
1047 hTrigM->Fill(-1.,multiplicity);
da3b34af 1048 trigCount->Count(Form("triggerType:All/Run:%d",runNumber));
5e67f11a 1049 if(evSelMask==0){
1050 if(aod->GetEventType()!=7){
1051 trigCount->Count(Form("triggerType:NoPhysSelEvNot7/Run:%d",runNumber));
1052 }else if(trigClass.Contains("CMUP1")){
1053 trigCount->Count(Form("triggerType:NoPhysSelCMUP1/Run:%d",runNumber));
1054 }else if(trigClass.Contains("MUON")){
1055 trigCount->Count(Form("triggerType:NoPhysSelMUON/Run:%d",runNumber));
1056 }else if(trigClass.Contains("CPBI2_B1-B") || trigClass.Contains(" CPBI2WU_B1-B")){
1057 trigCount->Count(Form("triggerType:NoPhysSelMB/Run:%d",runNumber));
1058 }else if(trigClass.Contains("CCENT") || trigClass.Contains("CVHN")){
1059 trigCount->Count(Form("triggerType:NoPhysSelCent/Run:%d",runNumber));
1060 }else if(trigClass.Contains("CSEMI") || trigClass.Contains("CVLN")){
1061 trigCount->Count(Form("triggerType:NoPhysSelSemiCent/Run:%d",runNumber));
1062 }
1063 }
2a844546 1064 if(evSelMask & AliVEvent::kAny){
1065 hTrigC->Fill(0.,centrality);
1066 hTrigM->Fill(0.,multiplicity);
1067 trigCount->Count(Form("triggerType:Any/Run:%d",runNumber));
1068 }
1b765719 1069 if(evSelMask & AliVEvent::kMB){
1070 hTrigC->Fill(1.,centrality);
1071 hTrigM->Fill(1.,multiplicity);
1072 trigCount->Count(Form("triggerType:MB/Run:%d",runNumber));
1073 }
1074 if(evSelMask & AliVEvent::kINT7){
1075 hTrigC->Fill(2.,centrality);
1076 hTrigM->Fill(2.,multiplicity);
1077 }
1078 if(evSelMask & AliVEvent::kCINT5){
1079 hTrigC->Fill(3.,centrality);
1080 hTrigM->Fill(3.,multiplicity);
1081 }
1082 if(evSelMask & AliVEvent::kCentral){
1083 hTrigC->Fill(4.,centrality);
1084 hTrigM->Fill(4.,multiplicity);
1085 trigCount->Count(Form("triggerType:Cent/Run:%d",runNumber));
1086 }
1087 if(evSelMask & AliVEvent::kSemiCentral){
1088 hTrigC->Fill(5.,centrality);
1089 hTrigM->Fill(5.,multiplicity);
1090 trigCount->Count(Form("triggerType:SemiCent/Run:%d",runNumber));
1091 }
1092 if(evSelMask & (AliVEvent::kEMC1 | AliVEvent::kEMC7)){
1093 hTrigC->Fill(6.,centrality);
1094 hTrigM->Fill(6.,multiplicity);
1095 }
1096 if(evSelMask & (AliVEvent::kEMCEJE | AliVEvent::kEMCEGA)){
1097 hTrigC->Fill(7.,centrality);
1098 hTrigM->Fill(7.,multiplicity);
1099 trigCount->Count(Form("triggerType:EMCAL/Run:%d",runNumber));
1100 }
1101 if(evSelMask & (((AliVEvent::kCMUS5 | AliVEvent::kMUSH7) | (AliVEvent::kMUL7 | AliVEvent::kMUU7)) | (AliVEvent::kMUS7 | AliVEvent::kMUON))){
1102 hTrigC->Fill(8.,centrality);
1103 hTrigM->Fill(8.,multiplicity);
5e67f11a 1104 trigCount->Count(Form("triggerType:MUON/Run:%d",runNumber));
1b765719 1105 }
1106 if(evSelMask & (AliVEvent::kPHI1 | AliVEvent::kPHI7)){
1107 hTrigC->Fill(9.,centrality);
1108 hTrigM->Fill(9.,multiplicity);
1109 }
1110 if(evSelMask & (AliVEvent::kDG5 | AliVEvent::kZED)){
1111 hTrigC->Fill(10.,centrality);
1112 hTrigM->Fill(10.,multiplicity);
1113 }
23dfe729 1114 }
1115
1116
0dbb51a0 1117 // fix for temporary bug in ESDfilter
1118 // the AODs with null vertex pointer didn't pass the PhysSel
3655ecf2 1119 if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) {
1120 delete [] pdgdaughters;
1121 return;
1122 }
0dbb51a0 1123
1124 // count event
1125 fNEntries->Fill(0);
9af24f46 1126
1127 //count events with good vertex
1128 // AOD primary vertex
1129 AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
824b448a 1130
1131 Double_t pos[3],cov[6];
1132 vtx1->GetXYZ(pos);
1133 vtx1->GetCovarianceMatrix(cov);
1134 const AliESDVertex vESD(pos,cov,100.,100);
1135
9af24f46 1136 TString primTitle = vtx1->GetTitle();
1137 if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0) fNEntries->Fill(4);
1138
a3aa1279 1139 // trigger class for PbPb C0SMH-B-NOPF-ALLNOTRD, C0SMH-B-NOPF-ALL
5fc4893f 1140 //TString trigclass=aod->GetFiredTriggerClasses();
1141 //if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) fNEntries->Fill(5); //tmp
a3aa1279 1142
818c1271 1143
23dfe729 1144
1145
2a844546 1146 Bool_t evSelbyCentrality=kTRUE,evSelected=kTRUE,evSelByVertex=kTRUE,evselByPileup=kTRUE,evSelByPS=kTRUE;
0dbb51a0 1147 //select event
1148 if(!fCuts->IsEventSelected(aod)) {
82f89d0d 1149 evSelected=kFALSE;
2a844546 1150 if(fCuts->GetWhyRejection()==1) {fNEntries->Fill(1); evselByPileup=kFALSE;}// rejected for pileup
ac0c2841 1151 if(fCuts->GetWhyRejection()==2 || fCuts->GetWhyRejection()==3) evSelbyCentrality=kFALSE; //rejected by centrality
1152 if(fCuts->GetWhyRejection()==4) evSelByVertex=kFALSE; //rejected by vertex
5fc4893f 1153 if(fCuts->GetWhyRejection()==5) fNEntries->Fill(5);//tmp
00c00d8e 1154 if(fCuts->GetWhyRejection()==6 && fOnOff[3]) ((AliCounterCollection*)fOutputEvSelection->FindObject("evselection"))->Count(Form("evnonsel:zvtx/Run:%d",runNumber));
2a844546 1155 if(fCuts->GetWhyRejection()==7) { evSelByPS=kFALSE; }
0dbb51a0 1156 }
23dfe729 1157 if(evSelected){
1158 TH2F* hTrigS=(TH2F*)fOutputEvSelection->FindObject("hTrigCentSel");
2a844546 1159 hTrigS->Fill(-1.,centrality);
23dfe729 1160
2a844546 1161 if(evSelMask & AliVEvent::kAny) hTrigS->Fill(0.,centrality);
23dfe729 1162 if(evSelMask & AliVEvent::kMB) hTrigS->Fill(1.,centrality);
1163 if(evSelMask & AliVEvent::kINT7) hTrigS->Fill(2.,centrality);
1164 if(evSelMask & AliVEvent::kCINT5) hTrigS->Fill(3.,centrality);
1165 if(evSelMask & AliVEvent::kCentral) hTrigS->Fill(4.,centrality);
1166 if(evSelMask & AliVEvent::kSemiCentral) hTrigS->Fill(5.,centrality);
1167 if(evSelMask & (AliVEvent::kEMC1 | AliVEvent::kEMC7)) hTrigS->Fill(6.,centrality);
1168 if(evSelMask & (AliVEvent::kEMCEJE | AliVEvent::kEMCEGA)) hTrigS->Fill(7.,centrality);
1169 if(evSelMask & (((AliVEvent::kCMUS5 | AliVEvent::kMUSH7) | (AliVEvent::kMUL7 | AliVEvent::kMUU7)) | (AliVEvent::kMUS7 | AliVEvent::kMUON))) hTrigS->Fill(8.,centrality);
1170 if(evSelMask & (AliVEvent::kPHI1 | AliVEvent::kPHI7)) hTrigS->Fill(9.,centrality);
1171 if(evSelMask & (AliVEvent::kDG5 | AliVEvent::kZED)) hTrigS->Fill(10.,centrality);
1172 }
1173
2a844546 1174 if(evSelected || (!evSelbyCentrality && evSelByVertex && evselByPileup && evSelByPS)){ //events selected or not selected because of centrality
5fc4893f 1175 if(fOnOff[2] && fCuts->GetUseCentrality()){
818c1271 1176
ac0c2841 1177 Float_t stdCentf=fCuts->GetCentrality(aod);
1178 Int_t stdCent = (Int_t)(stdCentf+0.5);
5fc4893f 1179 Float_t secondCentf =fCuts->GetCentrality(aod,fEstimator);
1180 Int_t secondCent = (Int_t)(secondCentf+0.5);
82f89d0d 1181 Int_t mincent=stdCent-stdCent%10;
b68a0f6a 1182 AliAODVZERO *vzeroAOD = (AliAODVZERO*)aod->GetVZEROData();
1183 Float_t vzeroMult = vzeroAOD->GetMTotV0A() + vzeroAOD->GetMTotV0C();
1184 AliCentrality *aodcent = aod->GetCentrality();
1185 Float_t spdCentf = aodcent->GetCentralityPercentile("CL1");
5fc4893f 1186 if(stdCentf==-1) {
5587ae1a 1187 mincent=-10;
5fc4893f 1188 stdCent=-1;
1189 }
c40c91c6 1190 if(mincent==100)mincent--;
82f89d0d 1191 ((AliCounterCollection*)fOutputCounters->FindObject("stdEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber));
5fc4893f 1192
82f89d0d 1193 mincent=secondCent-secondCent%10;
5fc4893f 1194 if(secondCentf==-1) {
5587ae1a 1195 mincent=-10;
5fc4893f 1196 secondCent=-1;
1197 }
c40c91c6 1198 if(mincent==100)mincent--;
82f89d0d 1199 ((AliCounterCollection*)fOutputCounters->FindObject("secondEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber));
1200
1201 if(stdCent<fCuts->GetMinCentrality() || stdCent>fCuts->GetMaxCentrality()){
1202 ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsOut"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
1203 ((TH1F*)fOutputCheckCentrality->FindObject("hMultOut"))->Fill(aod->GetHeader()->GetRefMultiplicity());
1204 }else{
1205 ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsIn"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
1206 ((TH1F*)fOutputCheckCentrality->FindObject("hMultIn"))->Fill(aod->GetHeader()->GetRefMultiplicity());
1207 }
ac0c2841 1208 ((TH2F*)fOutputCheckCentrality->FindObject("hMultvsPercentile"))->Fill(aod->GetHeader()->GetRefMultiplicity(),stdCentf);
7a5f2502 1209 ((TH2F*)fOutputCheckCentrality->FindObject("hntrklvsPercentile"))->Fill(aod->GetTracklets()->GetNumberOfTracklets(),stdCentf);
138e0d89 1210 ((TH2F*)fOutputCheckCentrality->FindObject("hnTPCTracksvsPercentile"))->Fill(nSelTracksTPCOnly,stdCentf);
1211 ((TH2F*)fOutputCheckCentrality->FindObject("hnTPCITSTracksvsPercentile"))->Fill(nSelTracksTPCITS,stdCentf);
1212 ((TH2F*)fOutputCheckCentrality->FindObject("hnTPCITS1SPDTracksvsPercentile"))->Fill(nSelTracksTPCITS1SPD,stdCentf);
b68a0f6a 1213 ((TH2F*)fOutputCheckCentrality->FindObject("hV0MultiplicityPercentile"))->Fill(vzeroMult,stdCentf);
1214 ((TH2F*)fOutputCheckCentrality->FindObject("hV0MultiplicityNtrackletsIn"))->Fill(vzeroMult,aod->GetTracklets()->GetNumberOfTracklets());
1215 ((TH2F*)fOutputCheckCentrality->FindObject("hStdPercentileSPDPercentile"))->Fill(stdCentf,spdCentf);
0dbb51a0 1216
82f89d0d 1217 PostData(6,fOutputCheckCentrality);
1218
1219 } else{
5fc4893f 1220 if(fOnOff[0]){
1221 ((TH1F*)fOutputTrack->FindObject("hNtracklets"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
1222 ((TH1F*)fOutputTrack->FindObject("hMult"))->Fill(aod->GetHeader()->GetRefMultiplicity());
1223 }
a4ef4383 1224 }
82f89d0d 1225 }
1226
818c1271 1227 if(fOnOff[3]){
1228 const AliVVertex *vertex = aod->GetPrimaryVertex();
6c66ddad 1229 Double_t xvtx=vertex->GetX();
1230 Double_t yvtx=vertex->GetY();
818c1271 1231 Double_t zvtx=vertex->GetZ();
6c66ddad 1232 Int_t vtxTyp=0;
1233 if(vertex->GetNContributors()<=0) vtxTyp=-1;
1234 TString title=vertex->GetTitle();
1235 if(title.Contains("Z")) vtxTyp=3;
1236 if(title.Contains("3D")) vtxTyp=2;
1237 ((TH1F*)fOutputEvSelection->FindObject("hxvtx"))->Fill(xvtx);
1238 ((TH1F*)fOutputEvSelection->FindObject("hyvtx"))->Fill(yvtx);
818c1271 1239 ((TH1F*)fOutputEvSelection->FindObject("hzvtx"))->Fill(zvtx);
6c66ddad 1240 ((TH1F*)fOutputEvSelection->FindObject("hWhichVert"))->Fill(vtxTyp);
1241 if(evSelected){
1242 ((TH1F*)fOutputEvSelection->FindObject("hxvtxSelEv"))->Fill(xvtx);
1243 ((TH1F*)fOutputEvSelection->FindObject("hyvtxSelEv"))->Fill(yvtx);
1244 ((TH1F*)fOutputEvSelection->FindObject("hzvtxSelEv"))->Fill(zvtx);
1245 ((TH1F*)fOutputEvSelection->FindObject("hWhichVertSelEv"))->Fill(vtxTyp);
1246 }
818c1271 1247 }
1248
82f89d0d 1249 if(!evSelected) {
1250 delete [] pdgdaughters;
1251 return; //discard all events not selected (vtx and/or centrality)
a4ef4383 1252 }
1253
818c1271 1254
476db98d 1255 AliAODPidHF* pidHF=fCuts->GetPidHF();
362242bf 1256 if(!pidHF) {
1257 delete [] pdgdaughters;
1258 return;
1259 }
4940d5bf 1260 //AliPIDResponse* respF=pidHF->GetPidResponse();
476db98d 1261 AliTPCPIDResponse* tpcres=new AliTPCPIDResponse();
4940d5bf 1262 Bool_t oldPID=pidHF->GetOldPid();
1263 if(oldPID){
70e398d3 1264 Double_t alephParameters[5];
1265 pidHF->GetTPCBetheBlochParams(alephParameters);
1266 tpcres->SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2],alephParameters[3],alephParameters[4]);
1267 }
476db98d 1268
1269
0dbb51a0 1270 Int_t ntracks=0;
824b448a 1271 Int_t isGoodTrack=0, isFakeTrack=0, isSelTrack=0;
0dbb51a0 1272
1273 if(aod) ntracks=aod->GetNTracks();
1274
5fc4893f 1275 if(fOnOff[0] || fOnOff[1]){
1276 //loop on tracks in the event
1277 for (Int_t k=0;k<ntracks;k++){
1278 AliAODTrack* track=aod->GetTrack(k);
138e0d89 1279 if(track->GetID()<0) continue;
5fc4893f 1280 AliAODPid *pid = track->GetDetPid();
138e0d89 1281 if(!pid && fDebug>1) cout<<"No AliAODPid found"<<endl;
5fc4893f 1282
138e0d89 1283 if(pid && fOnOff[1]){
5fc4893f 1284 Double_t times[AliPID::kSPECIES];
1285 pid->GetIntegratedTimes(times);
0dbb51a0 1286
5fc4893f 1287 Double_t tofRes[AliPID::kSPECIES];
1288 pid->GetTOFpidResolution(tofRes);
1289
1290 //check TOF
b906dda8 1291 TH1F* htmpfl=((TH1F*)fOutputPID->FindObject("hTOFflags"));
1292 htmpfl->Fill(0.);
23dfe729 1293 if (track->GetStatus()&AliESDtrack::kTPCout) htmpfl->Fill(1.);
1294 if (track->GetStatus()&AliESDtrack::kTOFout) htmpfl->Fill(2.);
1295 if (track->GetStatus()&AliESDtrack::kTIME) htmpfl->Fill(3.);
1296 if (track->GetStatus()&AliESDtrack::kTOFpid) htmpfl->Fill(4.);
1297 if (track->GetStatus()&AliESDtrack::kTOFmismatch) htmpfl->Fill(5.);
b906dda8 1298
5fc4893f 1299 if(pidHF && pidHF->CheckStatus(track,"TOF")){
20baad42 1300 Double_t tofTime=pid->GetTOFsignal();
1301 AliTOFHeader* tofH=(AliTOFHeader*)aod->GetTOFHeader();
1302 if (tofH && (TMath::Abs(tofRes[0]) <= 1.E-16) ) { // new AOD
1303 // with new AOD we need to retrieve startTime, subtract it and retrieve correctly TOF PID resolutions *PA*
1304 AliTOFPIDResponse tofResp=pidHF->GetPidResponse()->GetTOFResponse();
1305 Double_t startTime = tofResp.GetStartTime(track->P());
1306 Float_t startTimeRes = tofResp.GetStartTimeRes(track->P());
1307 Int_t startTimeMask = tofResp.GetStartTimeMask(track->P());
1308 ((TH1F*)fOutputPID->FindObject("hTOFstartTimeMask"))->Fill(startTimeMask);
1309 ((TH1F*)fOutputPID->FindObject("hTOFstartTimeRes"))->Fill(startTimeRes);
1310 tofTime-=startTime;
1311 for (Int_t type=0;type<=AliPID::kSPECIES;type++) tofRes[type]=tofResp.GetExpectedSigma(track->P(),times[type],AliPID::ParticleMassZ(type));
1312 }
5fc4893f 1313 ((TH1F*)fOutputPID->FindObject("hTOFtime"))->Fill(times[AliPID::kProton]);
20baad42 1314 ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptime"))->Fill(track->P(),tofTime-times[3]); //3 is kaon
1315 ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(tofTime);
5fc4893f 1316 if (pid->GetTOFsignal()< 0) ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(-1);
1317
4940d5bf 1318 Double_t nsigma[3]={-10,-10,-10};
1319 pidHF->GetnSigmaTOF(track,(Int_t)AliPID::kPion,nsigma[0]);
1320 pidHF->GetnSigmaTOF(track,(Int_t)AliPID::kKaon,nsigma[1]);
1321 pidHF->GetnSigmaTOF(track,(Int_t)AliPID::kProton,nsigma[2]);
1322
1323 ((TH2F*)fOutputPID->FindObject("hTOFsigmaKSigPid"))->Fill(track->P(),nsigma[1]);
1324 ((TH2F*)fOutputPID->FindObject("hTOFsigmaPionSigPid"))->Fill(track->P(),nsigma[0]);
1325 ((TH2F*)fOutputPID->FindObject("hTOFsigmaProtonSigPid"))->Fill(track->P(),nsigma[2]);
1326 if(fReadMC){
1327 Int_t label=track->GetLabel();
1328 if(label<=0) continue;
1329 AliMCParticle* mcpart=(AliMCParticle*)mcArray->At(label);
1330 if(mcpart){
1331 Int_t abspdgcode=TMath::Abs(mcpart->PdgCode());
1332 if(abspdgcode==211) ((TH2F*)fOutputPID->FindObject("hTOFsigmaMCPionSigPid"))->Fill(track->P(),nsigma[0]);
1333 if(abspdgcode==321) ((TH2F*)fOutputPID->FindObject("hTOFsigmaMCKSigPid"))->Fill(track->P(),nsigma[1]);
1334 if(abspdgcode==2212) ((TH2F*)fOutputPID->FindObject("hTOFsigmaMCProtonSigPid"))->Fill(track->P(),nsigma[2]);
24748c57 1335
24748c57 1336 }
4940d5bf 1337 }
24748c57 1338
4940d5bf 1339 for (Int_t iS=2; iS<5; iS++){ //we plot TOF Pid resolution for 3-sigma identified particles
1340 if ( TMath::Abs(nsigma[iS-2])<3.){
1341 switch (iS) {
1342 case AliPID::kPion:
1343 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigPion"))->Fill(tofRes[iS]);
1344 break;
1345 case AliPID::kKaon:
1346 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigKaon"))->Fill(tofRes[iS]);
1347 break;
1348 case AliPID::kProton:
1349 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigProton"))->Fill(tofRes[iS]);
1350 break;
1351 default:
1352 break;
5fc4893f 1353 }
a4ef4383 1354 }
1355 }
5fc4893f 1356 }//if TOF status
4940d5bf 1357 //}
5fc4893f 1358
1359 if(pidHF && pidHF->CheckStatus(track,"TPC")){
476db98d 1360
5fc4893f 1361 Double_t TPCp=pid->GetTPCmomentum();
1362 Double_t TPCsignal=pid->GetTPCsignal();
1363 ((TH1F*)fOutputPID->FindObject("hTPCsig"))->Fill(TPCsignal);
1364 ((TH1F*)fOutputPID->FindObject("hTPCsigvsp"))->Fill(TPCp,TPCsignal);
1365 //if (pidHF->IsKaonRaw(track, "TOF"))
4940d5bf 1366 Double_t nsigma[3]={-10,-10,-10};
1367 pidHF->GetnSigmaTPC(track,(Int_t)AliPID::kPion,nsigma[0]);
1368 pidHF->GetnSigmaTPC(track,(Int_t)AliPID::kKaon,nsigma[1]);
1369 pidHF->GetnSigmaTPC(track,(Int_t)AliPID::kProton,nsigma[2]);
24748c57 1370
4940d5bf 1371 ((TH2F*)fOutputPID->FindObject("hTPCsigmaK"))->Fill(TPCp,nsigma[1]);
1372
1373 ((TH2F*)fOutputPID->FindObject("hTPCsigmaPion"))->Fill(TPCp,nsigma[0]);
1374 ((TH2F*)fOutputPID->FindObject("hTPCsigmaProton"))->Fill(TPCp,nsigma[2]);
1375
24748c57 1376 if(fReadMC){
1377 Int_t label=track->GetLabel();
1378 if(label<=0) continue;
1379 AliMCParticle* mcpart=(AliMCParticle*)mcArray->At(label);
1380 if(mcpart){
1381 Int_t abspdgcode=TMath::Abs(mcpart->PdgCode());
1382 if(abspdgcode==211) ((TH2F*)fOutputPID->FindObject("hTPCsigmaMCPion"))->Fill(track->P(),nsigma[0]);
1383 if(abspdgcode==321) ((TH2F*)fOutputPID->FindObject("hTPCsigmaMCK"))->Fill(track->P(),nsigma[1]);
1384 if(abspdgcode==2212) ((TH2F*)fOutputPID->FindObject("hTPCsigmaMCProton"))->Fill(track->P(),nsigma[2]);
1385
1386 }
1387
1388 }
1389
1390
5fc4893f 1391 }//if TPC status
1392 } //end PID histograms
1393
1394 Int_t nclsTot=0,nclsSPD=0;
1395
1396 //check clusters of the tracks
1397 if(fOnOff[0]){
1398
bc6846db 1399 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1);
5fc4893f 1400 for(Int_t l=0;l<6;l++) {
1401 if(TESTBIT(track->GetITSClusterMap(),l)) {
bc6846db 1402 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(l);
5fc4893f 1403 nclsTot++; if(l<2) nclsSPD++;
1404 }
1405 }
1406 ((TH1F*)fOutputTrack->FindObject("hnClsITS"))->Fill(nclsTot);
1407 ((TH1F*)fOutputTrack->FindObject("hnClsSPD"))->Fill(nclsSPD);
39dd297f 1408 if(track->Pt()>0.3 &&
1409 TMath::Abs(track->Eta())<0.8 &&
1410 track->GetStatus()&AliESDtrack::kITSrefit &&
1411 track->GetStatus()&AliESDtrack::kTPCrefit &&
1412 nclsSPD>0){
1413 ((TH1F*)fOutputTrack->FindObject("hnClsITSselTr"))->Fill(nclsTot);
1414 }
5fc4893f 1415 if(!(track->GetStatus()&AliESDtrack::kTPCin) && track->GetStatus()&AliESDtrack::kITSrefit && !(track->GetStatus()&AliESDtrack::kITSpureSA)){//tracks retrieved in the ITS and not reconstructed in the TPC
1416 ((TH1F*)fOutputTrack->FindObject("hnClsITS-SA"))->Fill(nclsTot);
bc6846db 1417 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1);
1418 for(Int_t l=0;l<6;l++) {
1419 if(TESTBIT(track->GetITSClusterMap(),l)) {
1420 ((TH1F*)fOutputTrack->FindObject("hnLayerITSsa"))->Fill(l);
1421 }
1422 }
acc33385 1423 }
5fc4893f 1424 Int_t label=0;
1425 if(fReadMC){
1426 label=track->GetLabel();
1427 if (label<0)fNEntries->Fill(8);
1428 else fNEntries->Fill(9);
acc33385 1429 }
0dbb51a0 1430
5fc4893f 1431
824b448a 1432 if (track->Pt()>0.3 &&
1433 track->GetStatus()&AliESDtrack::kTPCrefit &&
1434 track->GetStatus()&AliESDtrack::kITSrefit &&
1435 /*nclsTot>3 &&*/
1436 nclsSPD>0) {//count good tracks
5fc4893f 1437
1438
824b448a 1439 if(fReadMC && label<0) {
1440 ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt());
1441 isFakeTrack++;
1442 } else {
1443 ((TH1F*)fOutputTrack->FindObject("hptGoodTr"))->Fill(track->Pt());
1444 isGoodTrack++;
ad42e35b 1445 }
824b448a 1446 }
1447 if(fCuts->IsDaughterSelected(track,&vESD,fCuts->GetTrackCuts())){
1448 isSelTrack++;
1449 }//select tracks for our analyses
818c1271 1450 } //fill track histos
5fc4893f 1451 } //end loop on tracks
0dbb51a0 1452
4940d5bf 1453 //fill once per event
5fc4893f 1454 if(fOnOff[0]){
1455 if (fReadMC) ((TH1F*)fOutputTrack->FindObject("hdistrFakeTr"))->Fill(isFakeTrack);
1456 ((TH1F*)fOutputTrack->FindObject("hdistrGoodTr"))->Fill(isGoodTrack);
824b448a 1457 ((TH1F*)fOutputTrack->FindObject("hdistrSelTr"))->Fill(isSelTrack);
5fc4893f 1458 }
0dbb51a0 1459
5fc4893f 1460 if(!isSimpleMode){
1461 // loop over candidates
1462 Int_t nCand = arrayProng->GetEntriesFast();
1463 Int_t ndaugh=3;
1464 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi) ndaugh=2;
1465 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpipipi) ndaugh=4;
1466
1467 for (Int_t iCand = 0; iCand < nCand; iCand++) {
1468 AliAODRecoDecayHF *d = (AliAODRecoDecayHF*)arrayProng->UncheckedAt(iCand);
1469 if(d->GetSelectionMap()) {
1470 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi && !d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)) continue; //skip the D0 from Dstar
1471 if(fDecayChannel==AliAnalysisTaskSEHFQA::kDplustoKpipi && !d->HasSelectionBit(AliRDHFCuts::kDplusCuts)) continue; //skip the 3 prong !D+
1472 }
acc33385 1473
5fc4893f 1474 if(fReadMC){
e7af8919 1475
1476 Int_t labD = -1;
1477 if (fDecayChannel==AliAnalysisTaskSEHFQA::kLambdactoV0 && (dynamic_cast<AliAODRecoCascadeHF*>(d))->Getv0()) {
1478
1479 Int_t pdgDgLctoV0bachelor[2]={310,2212};
1480 Int_t pdgDgV0toDaughters[2]={211,211};
1481 Int_t mcLabelK0S = (dynamic_cast<AliAODRecoCascadeHF*>(d))->MatchToMC(pdg,pdgDgLctoV0bachelor[0],pdgDgLctoV0bachelor,pdgDgV0toDaughters,mcArray,kTRUE); // Lc->K0S+p and cc
1482 pdgDgLctoV0bachelor[0]=3122, pdgDgLctoV0bachelor[1]=211;
1483 pdgDgV0toDaughters[0]=2212, pdgDgV0toDaughters[1]=211;
1484 Int_t mcLabelLambda = (dynamic_cast<AliAODRecoCascadeHF*>(d))->MatchToMC(pdg,pdgDgLctoV0bachelor[0],pdgDgLctoV0bachelor,pdgDgV0toDaughters,mcArray,kTRUE); // Lc->Lambda+pi and cc
1485 if (mcLabelK0S!=-1 || mcLabelLambda!=-1) AliInfo(Form("mcLabelK0S=%d - mcLabelLambda=%d",mcLabelK0S,mcLabelLambda));
1486
1487 if (mcLabelK0S!=-1 && mcLabelLambda!=-1)
1488 AliInfo("Strange: current Lc->V0+bachelor candidate has two MC different labels!");
1489 else if (mcLabelK0S>-1 && mcLabelLambda==-1)
1490 labD = mcLabelK0S;
1491 else if (mcLabelLambda>-1 && mcLabelK0S==-1)
1492 labD = mcLabelLambda;
1493 }
1494 else
1495 labD = d->MatchToMC(pdg,mcArray,ndaugh,pdgdaughters);
1496
5fc4893f 1497 if(labD>=0){
1498 AliAODMCParticle *partD = (AliAODMCParticle*)mcArray->At(labD);
1499 Int_t label=partD->GetMother();
1500 AliAODMCParticle *mot = (AliAODMCParticle*)mcArray->At(label);
1501 while(label>=0){//get first mother
1502 mot = (AliAODMCParticle*)mcArray->At(label);
1503 label=mot->GetMother();
1504 }
24748c57 1505 if(mot){
1506 Int_t pdgMotCode = mot->GetPdgCode();
5fc4893f 1507
24748c57 1508 if(TMath::Abs(pdgMotCode)==4) fNEntries->Fill(6); //from primary charm
1509 if(TMath::Abs(pdgMotCode)==5) fNEntries->Fill(7); //from beauty
1510 }
acc33385 1511 }
5fc4893f 1512 }//end MC
1513 else fNEntries->Fill(6); //count the candidates (data)
1514
1515 for(Int_t id=0;id<ndaugh;id++){
5fc4893f 1516 //other histograms to be filled when the cut object is given
e7af8919 1517 AliAODTrack* track=0;
1518
1519 if (fDecayChannel==AliAnalysisTaskSEHFQA::kLambdactoV0 && (dynamic_cast<AliAODRecoCascadeHF*>(d))->Getv0()) {
1520 if (id==0)
1521 track=(AliAODTrack*)(dynamic_cast<AliAODRecoCascadeHF*>(d))->GetBachelor();
1522 else if (id==1)
1523 track=(AliAODTrack*)(dynamic_cast<AliAODRecoCascadeHF*>(d))->Getv0PositiveTrack();
1524 else if (id==2)
1525 track=(AliAODTrack*)(dynamic_cast<AliAODRecoCascadeHF*>(d))->Getv0NegativeTrack();
1526 }
1527 else
1528 track=(AliAODTrack*)d->GetDaughter(id);
5fc4893f 1529
1530 //track quality
1531
1532 if (fCuts->IsInFiducialAcceptance(d->Pt(),d->Y(pdg)) && fCuts->IsSelected(d,AliRDHFCuts::kTracks,aod)) {
1533
1534 Int_t label=0;
1535 if(fReadMC)label=track->GetLabel();
ad42e35b 1536 if(fOnOff[0]){
818c1271 1537
ad42e35b 1538 if(fReadMC && label<0) {
1539 isFakeTrack++;
824b448a 1540 ((TH1F*)fOutputTrack->FindObject("hptFakeTrFromDaugh"))->Fill(track->Pt());
5fc4893f 1541
ad42e35b 1542 ((TH1F*)fOutputTrack->FindObject("hd0f"))->Fill(d->Getd0Prong(id));
1543 } else {
824b448a 1544 ((TH1F*)fOutputTrack->FindObject("hptGoodTrFromDaugh"))->Fill(track->Pt());
ad42e35b 1545 ((TH1F*)fOutputTrack->FindObject("hd0"))->Fill(d->Getd0Prong(id));
4563d678 1546 Double_t d0rphiz[2],covd0[3];
1547 Bool_t isDCA=track->PropagateToDCA(aod->GetPrimaryVertex(),aod->GetMagneticField(),9999.,d0rphiz,covd0);
1548 if(isDCA) ((TH1F*)fOutputTrack->FindObject("hd0z"))->Fill(d0rphiz[1]);
ad42e35b 1549 }
818c1271 1550 }
5fc4893f 1551 if (fCuts->IsSelected(d,AliRDHFCuts::kAll,aod) && fOnOff[1]){
0dbb51a0 1552
5fc4893f 1553 AliAODPid *pid = track->GetDetPid();
138e0d89 1554 if(pid){
1555 Double_t times[5];
1556 pid->GetIntegratedTimes(times);
20baad42 1557 if(pidHF && pidHF->CheckStatus(track,"TOF")){
1558 Double_t tofTime=pid->GetTOFsignal();
1559 AliTOFHeader* tofH=(AliTOFHeader*)aod->GetTOFHeader();
1560 Double_t tofRes[AliPID::kSPECIES];
1561 pid->GetTOFpidResolution(tofRes);
1562 if (tofH && (TMath::Abs(tofRes[0]) <= 1.E-16) ) { // new AOD
1563 AliTOFPIDResponse tofResp=pidHF->GetPidResponse()->GetTOFResponse();
1564 Double_t startTime=tofResp.GetStartTime(track->P());
1565 tofTime-=startTime;
1566 }
1567 ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptimeAC"))->Fill(track->P(),tofTime-times[AliPID::kKaon]);
1568 }
138e0d89 1569 if(pidHF && pidHF->CheckStatus(track,"TPC")) ((TH2F*)fOutputPID->FindObject("hTPCsigvspAC"))->Fill(pid->GetTPCmomentum(),pid->GetTPCsignal());
1570 }
5fc4893f 1571 fNEntries->Fill(3);
1572 } //end analysis cuts
1573 } //end acceptance and track cuts
1574 } //end loop on tracks in the candidate
1575 } //end loop on candidates
824b448a 1576
5fc4893f 1577 }
1578 } //end if on pid or track histograms
fb9311e8 1579
476db98d 1580 delete tpcres;
fb9311e8 1581 delete [] pdgdaughters;
a4ef4383 1582 PostData(1,fNEntries);
5fc4893f 1583 if(fOnOff[1]) PostData(2,fOutputPID);
1584 if(fOnOff[0]) PostData(3,fOutputTrack);
a4ef4383 1585 PostData(4,fCuts);
5fc4893f 1586 if(fOnOff[2]) PostData(5,fOutputCounters);
1587 //Post data 6 done in case of centrality on
82f89d0d 1588
0dbb51a0 1589}
1590
d48d81b5 1591//____________________________________________________________________________
1592void AliAnalysisTaskSEHFQA::FillFlowObs(AliAODEvent *aod){
1593 //fills the flow observables
65274ad6 1594 Double_t cc;
1595 cc = fCuts->GetCentrality(aod);
1596 ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(0., cc);
d48d81b5 1597
1598 UInt_t mask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1599 UInt_t trigger=AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral;
d48d81b5 1600 if(mask & trigger) {
65274ad6 1601 ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(1.,cc); // fired
1602 if (mask & AliVEvent::kMB) ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(2.,cc);
1603 if (mask & AliVEvent::kCentral) ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(3.,cc);
1604 if (mask & AliVEvent::kSemiCentral) ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(4.,cc);
d48d81b5 1605 Bool_t rejected=false;
d48d81b5 1606 if(cc<0 || cc>60) rejected=true;
1607 const AliVVertex *vertex = aod->GetPrimaryVertex();
1608 Double_t zvtx=vertex->GetZ();
65274ad6 1609 if(TMath::Abs(zvtx)>fCuts->GetMaxVtxZ()) rejected=true;
d48d81b5 1610 if(rejected) return; //not interesting for flow QA
1611 } else {
1612 return;
1613 }
1614
1615 // event accepted
65274ad6 1616 ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(5.,cc);
d48d81b5 1617 fRFPcuts->SetParamType(AliFlowTrackCuts::kGlobal);
1618 fRFPcuts->SetPtRange(0.2,5.);
1619 fRFPcuts->SetEtaRange(-0.8,0.8);
1620 fRFPcuts->SetMinNClustersTPC(70);
1621 fRFPcuts->SetMinChi2PerClusterTPC(0.2);
1622 fRFPcuts->SetMaxChi2PerClusterTPC(4.0);
1623 fRFPcuts->SetAcceptKinkDaughters(kFALSE);
1624 fRFPcuts->SetEvent(aod);
1625
1626 TString ref[3] = {"FB1","FB128","VZE"};
1627 Double_t psi[3];
1628 for(Int_t i=0; i!=3; ++i) {
1629 if(i==0) { // switching to bit 1
1630 fRFPcuts->SetMinimalTPCdedx(10.);
1631 fRFPcuts->SetAODfilterBit(1);
1632 } else { // switching to bit 128
1633 fRFPcuts->SetMinimalTPCdedx(-1);
1634 fRFPcuts->SetAODfilterBit(128);
1635 }
1636 if(i>1) {
1637 fRFPcuts->SetParamType(AliFlowTrackCuts::kV0);
1638 fRFPcuts->SetEtaRange(-5,+5);
1639 fRFPcuts->SetPhiMin(0);
1640 fRFPcuts->SetPhiMax(TMath::TwoPi());
1641 }
1642 fFlowEvent->Fill(fRFPcuts,fRFPcuts);
1643 fFlowEvent->TagSubeventsInEta(-5,0,0,+5);
65274ad6 1644 // getting informationt
d48d81b5 1645 AliFlowVector vQ, vQaQb[2];
1646 fFlowEvent->Get2Qsub(vQaQb,2);
1647 vQ = vQaQb[0]+vQaQb[1];
1648 Double_t dMa=vQaQb[0].GetMult();
1649 Double_t dMb=vQaQb[1].GetMult();
1650 if( dMa<2 || dMb<2 ) {
65274ad6 1651 ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(6.,cc); //???
d48d81b5 1652 continue;
1653 }
1654 psi[i] = vQ.Phi()/2;
1655 // publishing
1656 ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(0,cc,vQaQb[0].X()/dMa,dMa); // Qx-
1657 ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(1,cc,vQaQb[0].Y()/dMa,dMa); // Qy-
1658 ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(2,cc,vQaQb[1].X()/dMb,dMb); // Qx+
1659 ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(3,cc,vQaQb[1].Y()/dMb,dMb); // Qy+
1660 ((TH2F*) fOutputFlowObs->FindObject( Form("h%s_AngleQ",ref[i].Data()) ))->Fill(psi[i],cc); // Psi
1661 AliFlowTrackSimple *track;
1662 for(Int_t t=0; t!=fFlowEvent->NumberOfTracks(); ++t) {
1663 track = (AliFlowTrackSimple*) fFlowEvent->GetTrack(t);
1664 if(!track) continue;
1665 if(!track->InRPSelection()) continue;
1666 ((TH3F*) fOutputFlowObs->FindObject( Form("h%s_PhiEta",ref[i].Data()) ))->Fill(track->Phi(),track->Eta(),cc,track->Weight()); //PhiEta
1667 }
65274ad6 1668
1669 //histo filled only for TPCFB1
1670 if (i==0) {
1671 ((TH2F*) fOutputFlowObs->FindObject("hCentVsMultRPS"))->Fill(fFlowEvent->GetNumberOfRPs(),cc);
1672 }
d48d81b5 1673 }
1674 // TPC vs VZERO
1675 ((TH3F*) fOutputFlowObs->FindObject( "hTPCVZE_AngleQ" ))->Fill(psi[0],psi[2],cc);
1676}
1677
a4ef4383 1678//____________________________________________________________________________
0dbb51a0 1679void AliAnalysisTaskSEHFQA::Terminate(Option_t */*option*/){
1680 //terminate analysis
1681
1682 fNEntries = dynamic_cast<TH1F*>(GetOutputData(1));
1683 if(!fNEntries){
1684 printf("ERROR: %s not available\n",GetOutputSlot(1)->GetContainer()->GetName());
1685 return;
1686 }
1687
1688 fOutputPID = dynamic_cast<TList*> (GetOutputData(2));
5fc4893f 1689 if (!fOutputPID && fOnOff[1]) {
0dbb51a0 1690 printf("ERROR: %s not available\n",GetOutputSlot(2)->GetContainer()->GetName());
1691 return;
1692 }
1693
1694 fOutputTrack = dynamic_cast<TList*> (GetOutputData(3));
5fc4893f 1695 if (!fOutputTrack && fOnOff[0]) {
0dbb51a0 1696 printf("ERROR: %s not available\n",GetOutputSlot(3)->GetContainer()->GetName());
1697 return;
1698 }
1699
1700}
1701