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