]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/vertexingHF/AliAnalysisTaskSEHFQA.cxx
no ITS refit required for hybrid tracks
[u/mrichter/AliRoot.git] / PWG3 / 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>
31#include <TDatabasePDG.h>
32
33#include <AliAnalysisDataSlot.h>
34#include <AliAnalysisDataContainer.h>
35#include "AliAnalysisManager.h"
36#include "AliESDtrack.h"
37#include "AliVertexerTracks.h"
38#include "AliPID.h"
39#include "AliTPCPIDResponse.h"
40#include "AliAODHandler.h"
41#include "AliAODEvent.h"
42#include "AliAODVertex.h"
43#include "AliAODTrack.h"
44#include "AliAODMCParticle.h"
a4ef4383 45#include "AliAODMCHeader.h"
0dbb51a0 46#include "AliAODRecoDecayHF2Prong.h"
47#include "AliAODRecoCascadeHF.h"
48#include "AliAnalysisVertexingHF.h"
49#include "AliAnalysisTaskSE.h"
a4ef4383 50#include "AliCounterCollection.h"
0dbb51a0 51#include "AliRDHFCuts.h"
52#include "AliRDHFCutsDplustoKpipi.h"
53#include "AliRDHFCutsD0toKpipipi.h"
54#include "AliRDHFCutsDstoKKpi.h"
55#include "AliRDHFCutsDStartoKpipi.h"
56#include "AliRDHFCutsD0toKpi.h"
57#include "AliRDHFCutsLctopKpi.h"
a4b0ffc7 58#include "AliInputEventHandler.h"
0dbb51a0 59
60#include "AliAnalysisTaskSEHFQA.h"
61
0dbb51a0 62ClassImp(AliAnalysisTaskSEHFQA)
63
64//____________________________________________________________________________
65
66AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA():AliAnalysisTaskSE(),
67 fNEntries(0x0),
68 fOutputPID(0x0),
69 fOutputTrack(0x0),
a4ef4383 70 fOutputCounters(0x0),
71 fOutputCheckCentrality(0x0),
818c1271 72 fOutputEvSelection(0x0),
0dbb51a0 73 fDecayChannel(AliAnalysisTaskSEHFQA::kD0toKpi),
a4ef4383 74 fCuts(0x0),
75 fEstimator(AliRDHFCuts::kCentTRK),
19222b31 76 fReadMC(kFALSE),
5fc4893f 77 fSimpleMode(kFALSE),
78 fOnOff()
0dbb51a0 79{
80 //default constructor
5fc4893f 81 fOnOff[0]=kTRUE;
82 fOnOff[1]=kTRUE;
83 fOnOff[2]=kTRUE;
818c1271 84 fOnOff[3]=kTRUE;
0dbb51a0 85}
86
87//____________________________________________________________________________
88AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA(const char *name, AliAnalysisTaskSEHFQA::DecChannel ch,AliRDHFCuts* cuts):
a4ef4383 89 AliAnalysisTaskSE(name),
90 fNEntries(0x0),
91 fOutputPID(0x0),
92 fOutputTrack(0x0),
93 fOutputCounters(0x0),
94 fOutputCheckCentrality(0x0),
818c1271 95 fOutputEvSelection(0x0),
a4ef4383 96 fDecayChannel(ch),
97 fCuts(0x0),
98 fEstimator(AliRDHFCuts::kCentTRK),
19222b31 99 fReadMC(kFALSE),
5fc4893f 100 fSimpleMode(kFALSE),
101 fOnOff()
0dbb51a0 102{
103 //constructor
104
105 //SetCutObject(cuts);
106 fCuts=cuts;
107
5fc4893f 108 fOnOff[0]=kTRUE;
109 fOnOff[1]=kTRUE;
110 fOnOff[2]=kTRUE;
818c1271 111 fOnOff[3]=kTRUE;
5fc4893f 112
0dbb51a0 113 // Output slot #1 writes into a TH1F container (number of events)
114 DefineOutput(1,TH1F::Class()); //My private output
115 // Output slot #2 writes into a TList container (PID)
5fc4893f 116 if (fOnOff[1]) DefineOutput(2,TList::Class()); //My private output
0dbb51a0 117 // Output slot #3 writes into a TList container (Tracks)
5fc4893f 118 if (fOnOff[0]) DefineOutput(3,TList::Class()); //My private output
0dbb51a0 119 // Output slot #4 writes into a AliRDHFCuts container (cuts)
120 switch(fDecayChannel){
121 case 0:
122 DefineOutput(4,AliRDHFCutsDplustoKpipi::Class()); //My private output
123 break;
124 case 1:
125 DefineOutput(4,AliRDHFCutsD0toKpi::Class()); //My private output
126 break;
127 case 2:
128 DefineOutput(4,AliRDHFCutsDStartoKpipi::Class()); //My private output
129 break;
130 case 3:
131 DefineOutput(4,AliRDHFCutsDstoKKpi::Class()); //My private output
132 break;
133 case 4:
134 DefineOutput(4,AliRDHFCutsD0toKpipipi::Class()); //My private output
135 break;
a4ef4383 136 case 5:
0dbb51a0 137 DefineOutput(4,AliRDHFCutsLctopKpi::Class()); //My private output
138 break;
a4ef4383 139 }
5fc4893f 140 if (fOnOff[2]) {
141 // Output slot #5 writes into a TList container (AliCounterCollection)
142 DefineOutput(5,TList::Class()); //My private output
143 // Output slot #6 writes into a TList container (TH1F)
144 DefineOutput(6,TList::Class()); //My private output
145 }
818c1271 146
147 if(fOnOff[3]) DefineOutput(7,TList::Class()); //My private output
148
0dbb51a0 149}
150
151//___________________________________________________________________________
152AliAnalysisTaskSEHFQA::~AliAnalysisTaskSEHFQA()
153{
154 //destructor
a4ef4383 155 delete fNEntries;
156
157 delete fOutputPID;
158
159 delete fOutputTrack;
160
161 delete fOutputCounters;
162
163 delete fOutputCheckCentrality;
164
818c1271 165 delete fOutputEvSelection;
166
0dbb51a0 167}
168
169//___________________________________________________________________________
170void AliAnalysisTaskSEHFQA::Init(){
171
172 //initialization
173 if(fDebug > 1) printf("AnalysisTaskSEHFQA::Init() \n");
174
175 switch(fDecayChannel){
176 case 0:
177 {
178 AliRDHFCutsDplustoKpipi* copycut=new AliRDHFCutsDplustoKpipi(*(static_cast<AliRDHFCutsDplustoKpipi*>(fCuts)));
179 // Post the data
180 PostData(4,copycut);
181 }
182 break;
183 case 1:
184 {
185 AliRDHFCutsD0toKpi* copycut=new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fCuts)));
186 // Post the data
187 PostData(4,copycut);
188 }
189 break;
190 case 2:
191 {
192 AliRDHFCutsDStartoKpipi* copycut=new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fCuts)));
193 // Post the data
194 PostData(4,copycut);
195 }
196 break;
197 case 3:
198 {
199 AliRDHFCutsDstoKKpi* copycut=new AliRDHFCutsDstoKKpi(*(static_cast<AliRDHFCutsDstoKKpi*>(fCuts)));
200 // Post the data
201 PostData(4,copycut);
202 }
203 break;
204 case 4:
205 {
206 AliRDHFCutsD0toKpipipi* copycut=new AliRDHFCutsD0toKpipipi(*(static_cast<AliRDHFCutsD0toKpipipi*>(fCuts)));
207 // Post the data
208 PostData(4,copycut);
209 }
210 break;
211 case 5:
212 {
213 AliRDHFCutsLctopKpi* copycut=new AliRDHFCutsLctopKpi(*(static_cast<AliRDHFCutsLctopKpi*>(fCuts)));
214 // Post the data
215 PostData(4,copycut);
216 }
217 break;
218
219 default:
220 return;
221 }
222
223
224
225}
226
227//___________________________________________________________________________
228void AliAnalysisTaskSEHFQA::UserCreateOutputObjects()
229{
230
231 //create the output container
232 if(fDebug > 1) printf("AnalysisTaskSEHFQA::UserCreateOutputObjects() \n");
233
234 //count events
235
acc33385 236 fNEntries=new TH1F(GetOutputSlot(1)->GetContainer()->GetName(), "Counts the number of events", 10,-0.5,9.5);
0dbb51a0 237 fNEntries->GetXaxis()->SetBinLabel(1,"nEventsAnal");
238 fNEntries->GetXaxis()->SetBinLabel(2,"Pile-up Rej");
239 fNEntries->GetXaxis()->SetBinLabel(3,"No VertexingHF");
9af24f46 240 fNEntries->GetXaxis()->SetBinLabel(4,"nCandidates(AnCuts)");
241 fNEntries->GetXaxis()->SetBinLabel(5,"EventsWithGoodVtx");
5fc4893f 242 //fNEntries->GetXaxis()->SetBinLabel(6,"N. of 0SMH");
243 fNEntries->GetXaxis()->SetBinLabel(6,"N. of CSH1");
a4ef4383 244 if(fReadMC){
245 fNEntries->GetXaxis()->SetBinLabel(7,"MC Cand from c");
246 fNEntries->GetXaxis()->SetBinLabel(8,"MC Cand from b");
acc33385 247 fNEntries->GetXaxis()->SetBinLabel(9,"N fake Trks");
248 fNEntries->GetXaxis()->SetBinLabel(10,"N true Trks");
a4ef4383 249 } else{
250 fNEntries->GetXaxis()->SetBinLabel(7,"N candidates");
251 }
252
0dbb51a0 253 fNEntries->GetXaxis()->SetNdivisions(1,kFALSE);
254
255 //PID
5fc4893f 256 if(fOnOff[1]){
257 fOutputPID=new TList();
258 fOutputPID->SetOwner();
259 fOutputPID->SetName(GetOutputSlot(2)->GetContainer()->GetName());
0dbb51a0 260
5fc4893f 261 //TOF pid
23dfe729 262 TH1F* hTOFflags=new TH1F("hTOFflags","TOF flags",6,-0.5,5.5);
b906dda8 263 hTOFflags->SetMinimum(0.);
264 hTOFflags->GetXaxis()->SetBinLabel(1,"All Tracks");
23dfe729 265 hTOFflags->GetXaxis()->SetBinLabel(2,"kTPCout");
266 hTOFflags->GetXaxis()->SetBinLabel(3,"kTOFout");
267 hTOFflags->GetXaxis()->SetBinLabel(4,"kTIME");
268 hTOFflags->GetXaxis()->SetBinLabel(5,"kTOFpid");
269 hTOFflags->GetXaxis()->SetBinLabel(6,"kTOFmismatch");
b906dda8 270
5fc4893f 271 TString hname="hTOFsig";
272 TH1F* hTOFsig=new TH1F(hname.Data(),"Distribution of TOF signal;TOF time [ps];Entries", 100, -2.e3,40.e3);
0dbb51a0 273
5fc4893f 274 hname="hTOFtime";
275 TH1F* hTOFtime=new TH1F(hname.Data(),"Distribution of TOF time Kaon;TOF time(Kaon) [ps];Entries", 1000, 0.,50000.);
0dbb51a0 276
5fc4893f 277 hname="hTOFtimeKaonHyptime";
b906dda8 278 TH2F* hTOFtimeKaonHyptime=new TH2F(hname.Data(),"TOFtime - timeHypothesisForKaon;p[GeV/c];TOFtime - timeHypothesisForKaon [ps]",500,0.,10.,1000,-20000.,20000.);
0dbb51a0 279
5fc4893f 280 hname="hTOFtimeKaonHyptimeAC";
b906dda8 281 TH2F* hTOFtimeKaonHyptimeAC=new TH2F(hname.Data(),"TOFtime - timeHypothesisForKaon;p[GeV/c];TOFtime - timeHypothesisForKaon [ps]",500,0.,10.,1000,-20000.,20000.);
0dbb51a0 282
5fc4893f 283 hname="hTOFsigmaKSigPid";
23dfe729 284 TH2F* hTOFsigmaKSigPid=new TH2F(hname.Data(),"(TOFsignal-timeK)/tofSigPid;p[GeV/c];(TOFsignal-timeK)/tofSigPid",500,0.,10.,400,-20,20);
0dbb51a0 285
5fc4893f 286 hname="hTOFsigmaPionSigPid";
23dfe729 287 TH2F* hTOFsigmaPionSigPid=new TH2F(hname.Data(),"(TOFsignal-time#pi)/tofSigPid;p[GeV/c];(TOFsignal-time#pi)/tofSigPid",500,0.,10.,400,-20,20);
a4ef4383 288
5fc4893f 289 hname="hTOFsigmaProtonSigPid";
23dfe729 290 TH2F* hTOFsigmaProtonSigPid=new TH2F(hname.Data(),"(TOFsignal-timep)/tofSigPid;p[GeV/c];(TOFsignal-time p)/tofSigPid",500,0.,10.,400,-20,20);
a4ef4383 291
5fc4893f 292 hname="hTOFsigPid3sigPion";
293 TH1F* hTOFsigPid3sigPion=new TH1F(hname.Data(),"TOF PID resolution (#pi) [ps]",500,0.,1000.);
a4ef4383 294
5fc4893f 295 hname="hTOFsigPid3sigKaon";
296 TH1F* hTOFsigPid3sigKaon=new TH1F(hname.Data(),"TOF PID resolution (K) [ps]",500,0.,1000.);
0dbb51a0 297
5fc4893f 298 hname="hTOFsigPid3sigProton";
299 TH1F* hTOFsigPid3sigProton=new TH1F(hname.Data(),"TOF PID resolution (p) [ps]",500,0.,1000.);
a4ef4383 300
0dbb51a0 301
5fc4893f 302 //TPC pid
303 hname="hTPCsig";
304 TH1F* hTPCsig=new TH1F(hname.Data(),"Distribution of TPC signal;TPC sig;Entries", 100, 35.,100.);
0dbb51a0 305
5fc4893f 306 hname="hTPCsigvsp";
b906dda8 307 TH2F* hTPCsigvsp=new TH2F(hname.Data(),"TPCsig vs p;TPC p[GeV/c];TPCsig",500,0.,10.,1000,35.,100.);
0dbb51a0 308
5fc4893f 309 hname="hTPCsigvspAC";
b906dda8 310 TH2F* hTPCsigvspAC=new TH2F(hname.Data(),"TPCsig vs p;TPCp[GeV/c];TPCsig",500,0.,10.,1000,35.,100.);
5fc4893f 311
312 hname="hTPCsigmaK";
b906dda8 313 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 314
315 hname="hTPCsigmaPion";
b906dda8 316 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 317
318 hname="hTPCsigmaProton";
b906dda8 319 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 320
b906dda8 321 fOutputPID->Add(hTOFflags);
5fc4893f 322 fOutputPID->Add(hTOFsig);
323 fOutputPID->Add(hTPCsig);
324 fOutputPID->Add(hTOFtime);
325 fOutputPID->Add(hTOFtimeKaonHyptime);
326 fOutputPID->Add(hTOFtimeKaonHyptimeAC);
5fc4893f 327 fOutputPID->Add(hTOFsigmaKSigPid);
328 fOutputPID->Add(hTOFsigmaPionSigPid);
329 fOutputPID->Add(hTOFsigmaProtonSigPid);
330 fOutputPID->Add(hTOFsigPid3sigPion);
331 fOutputPID->Add(hTOFsigPid3sigKaon);
332 fOutputPID->Add(hTOFsigPid3sigProton);
333 fOutputPID->Add(hTPCsigvsp);
334 fOutputPID->Add(hTPCsigvspAC);
335 fOutputPID->Add(hTPCsigmaK);
336 fOutputPID->Add(hTPCsigmaPion);
337 fOutputPID->Add(hTPCsigmaProton);
338 }
0dbb51a0 339
340 //quality of the tracks
5fc4893f 341 if(fOnOff[0]){
342 fOutputTrack=new TList();
343 fOutputTrack->SetOwner();
344 fOutputTrack->SetName(GetOutputSlot(3)->GetContainer()->GetName());
0dbb51a0 345
5fc4893f 346 TString hname="hnClsITS";
347 TH1F* hnClsITS=new TH1F(hname.Data(),"Distribution of number of ITS clusters;nITScls;Entries",7,-0.5,6.5);
0dbb51a0 348
39dd297f 349 hname="hnClsITSselTr";
350 TH1F* hnClsITSselTr=new TH1F(hname.Data(),"Distribution of number of ITS clusters selected tracks;nITScls;Entries",7,-0.5,6.5);
351
5fc4893f 352 hname="hnClsITS-SA";
353 TH1F* hnClsITSSA=new TH1F(hname.Data(),"Distribution of number of ITS clusters(ITS-SA);nITScls;Entries",7,-0.5,6.5);
0dbb51a0 354
bc6846db 355
356 hname="hnLayerITS";
f3e1ad2f 357 TH1F* hnLayerITS=new TH1F(hname.Data(),"Number of tracks with point in layer;ITS layer;",7,-1.5,5.5);
358 hnLayerITS->GetXaxis()->SetBinLabel(1,"n tracks");
bc6846db 359
360 hname="hnLayerITSsa";
f3e1ad2f 361 TH1F* hnLayerITSsa=new TH1F(hname.Data(),"Number of tracks with point in layer;ITS layer;",7,-1.5,5.5);
362 hnLayerITSsa->GetXaxis()->SetBinLabel(1,"n tracks");
363
5fc4893f 364 hname="hnClsSPD";
365 TH1F* hnClsSPD=new TH1F(hname.Data(),"Distribution of number of SPD clusters;nSPDcls;Entries",3,-0.5,2.5);
0dbb51a0 366
5fc4893f 367 hname="hptGoodTr";
368 TH1F* hptGoodTr=new TH1F(hname.Data(),"Pt distribution of 'good' tracks;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
369 hptGoodTr->SetTitleOffset(1.3,"Y");
0dbb51a0 370
5fc4893f 371 hname="hdistrGoodTr";
372 TH1F* hdistrGoodTr=new TH1F(hname.Data(),"Distribution of number of 'good' tracks per event;no.good-tracks/ev;Entries",4000,-0.5,3999.5);
373 hdistrGoodTr->SetTitleOffset(1.3,"Y");
0dbb51a0 374
5fc4893f 375 hname="hd0";
376 TH1F* hd0=new TH1F(hname.Data(),"Impact parameter distribution of 'good' tracks;d_{0}[cm];Entries/10^{3} cm",200,-0.1,0.1);
0dbb51a0 377
5fc4893f 378 fOutputTrack->Add(hnClsITS);
39dd297f 379 fOutputTrack->Add(hnClsITSselTr);
5fc4893f 380 fOutputTrack->Add(hnClsITSSA);
bc6846db 381 fOutputTrack->Add(hnLayerITS);
382 fOutputTrack->Add(hnLayerITSsa);
5fc4893f 383 fOutputTrack->Add(hnClsSPD);
384 fOutputTrack->Add(hptGoodTr);
385 fOutputTrack->Add(hdistrGoodTr);
386 fOutputTrack->Add(hd0);
acc33385 387
5fc4893f 388 if(fReadMC){
389 hname="hdistrFakeTr";
390 TH1F* hdistrFakeTr=new TH1F(hname.Data(),"Distribution of number of fake tracks per event;no.fake-tracks/ev;Entries",4000,-0.5,3999.5);
391 hdistrGoodTr->SetTitleOffset(1.3,"Y");
acc33385 392
5fc4893f 393 hname="hd0f";
394 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 395
5fc4893f 396 hname="hptFakeTr";
397 TH1F* hptFakeTr=new TH1F(hname.Data(),"Pt distribution of fake tracks;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
ad42e35b 398 hptFakeTr->SetTitleOffset(1.3,"Y");
acc33385 399
5fc4893f 400 fOutputTrack->Add(hptFakeTr);
401 fOutputTrack->Add(hdistrFakeTr);
402 fOutputTrack->Add(hd0f);
403
404 }
acc33385 405 }
406
0dbb51a0 407
5fc4893f 408 if(fOnOff[2] && fCuts->GetUseCentrality()){
a4ef4383 409
410 //Centrality (Counters)
411 fOutputCounters=new TList();
412 fOutputCounters->SetOwner();
413 fOutputCounters->SetName(GetOutputSlot(5)->GetContainer()->GetName());
414
415 AliCounterCollection *stdEstimator=new AliCounterCollection("stdEstimator");
416 stdEstimator->AddRubric("run",500000);
5fc4893f 417 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 418 stdEstimator->Init();
419 AliCounterCollection *secondEstimator=new AliCounterCollection("secondEstimator");
420 secondEstimator->AddRubric("run",500000);
5fc4893f 421 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 422 secondEstimator->Init();
423
424 fOutputCounters->Add(stdEstimator);
425 fOutputCounters->Add(secondEstimator);
426
427 //Centrality (Checks)
428 fOutputCheckCentrality=new TList();
429 fOutputCheckCentrality->SetOwner();
430 fOutputCheckCentrality->SetName(GetOutputSlot(6)->GetContainer()->GetName());
431
5fc4893f 432 TString hname="hNtrackletsIn";
a4ef4383 433 TH1F* hNtrackletsIn=new TH1F(hname.Data(),"Number of tracklets in Centrality range;ntracklets;Entries",5000,-0.5,4999.5);
434
435 hname="hMultIn";
436 TH1F* hMultIn=new TH1F(hname.Data(),"Multiplicity;multiplicity in Centrality range;Entries",10000,-0.5,9999.5);
437
438 hname="hNtrackletsOut";
439 TH1F* hNtrackletsOut=new TH1F(hname.Data(),"Number of tracklets out of Centrality range;ntracklets;Entries",5000,-0.5,4999.5);
440
441 hname="hMultOut";
442 TH1F* hMultOut=new TH1F(hname.Data(),"Multiplicity out of Centrality range;multiplicity;Entries",10000,-0.5,9999.5);
443
ac0c2841 444 hname="hMultvsPercentile";
5fc4893f 445 TH2F* hMultvsPercentile=new TH2F(hname.Data(),"Multiplicity vs Percentile;multiplicity;percentile",10000,-0.5,9999.5,12,-10.,110);
ac0c2841 446
23dfe729 447
a4ef4383 448 fOutputCheckCentrality->Add(hNtrackletsIn);
449 fOutputCheckCentrality->Add(hNtrackletsOut);
450 fOutputCheckCentrality->Add(hMultIn);
451 fOutputCheckCentrality->Add(hMultOut);
ac0c2841 452 fOutputCheckCentrality->Add(hMultvsPercentile);
82f89d0d 453
454 PostData(6,fOutputCheckCentrality);
455
a4ef4383 456 } else{
5fc4893f 457 if(fOnOff[0]){
458 TString hname="hNtracklets";
459 TH1F* hNtracklets=new TH1F(hname.Data(),"Number of tracklets;ntracklets;Entries",5000,-0.5,4999.5);
460
461 hname="hMult";
462 TH1F* hMult=new TH1F(hname.Data(),"Multiplicity;multiplicity;Entries",10000,-0.5,9999.5);
463 fOutputTrack->Add(hNtracklets);
464 fOutputTrack->Add(hMult);
465 }
a4ef4383 466 }
467
818c1271 468 //event selection (z vertex for the moment)
469 if(fOnOff[3]){
470 fOutputEvSelection=new TList();
471 fOutputEvSelection->SetOwner();
472 fOutputEvSelection->SetName(GetOutputSlot(7)->GetContainer()->GetName());
473 AliCounterCollection *evselection=new AliCounterCollection("evselection");
474 evselection->AddRubric("run",500000);
475 evselection->AddRubric("evnonsel","zvtx");
476 evselection->Init();
477
478 TH1F* hzvtx=new TH1F("hzvtx", "Distribution of z_{VTX};z_{VTX} [cm];Entries",100,-20,20);
479
23dfe729 480
481 TH2F* hTrigCent=new TH2F("hTrigCent","Centrality vs. Trigger types",11,-0.5,10.5,12,-10,110);
482 hTrigCent->GetXaxis()->SetBinLabel(1,"All");
483 hTrigCent->GetXaxis()->SetBinLabel(2,"kMB");
484 hTrigCent->GetXaxis()->SetBinLabel(3,"kINT7");
485 hTrigCent->GetXaxis()->SetBinLabel(4,"kCINT5");
486 hTrigCent->GetXaxis()->SetBinLabel(5,"kCent");
487 hTrigCent->GetXaxis()->SetBinLabel(6,"kSemiCent");
488 hTrigCent->GetXaxis()->SetBinLabel(7,"kEMC1+7");
489 hTrigCent->GetXaxis()->SetBinLabel(8,"kEMCJET+GAMMA");
490 hTrigCent->GetXaxis()->SetBinLabel(9,"Muons");
491 hTrigCent->GetXaxis()->SetBinLabel(10,"PHOS");
492 hTrigCent->GetXaxis()->SetBinLabel(11,"Others");
493
494 TH2F* hTrigMul=new TH2F("hTrigMul","Multiplicity vs. Trigger types",11,-0.5,10.5,100,0.,10000.);
495 hTrigMul->GetXaxis()->SetBinLabel(1,"All");
496 hTrigMul->GetXaxis()->SetBinLabel(2,"kMB");
497 hTrigMul->GetXaxis()->SetBinLabel(3,"kINT7");
498 hTrigMul->GetXaxis()->SetBinLabel(4,"kCINT5");
499 hTrigMul->GetXaxis()->SetBinLabel(5,"kCent");
500 hTrigMul->GetXaxis()->SetBinLabel(6,"kSemiCent");
501 hTrigMul->GetXaxis()->SetBinLabel(7,"kEMC1+7");
502 hTrigMul->GetXaxis()->SetBinLabel(8,"kEMCJET+GAMMA");
503 hTrigMul->GetXaxis()->SetBinLabel(9,"Muons");
504 hTrigMul->GetXaxis()->SetBinLabel(10,"PHOS");
505 hTrigMul->GetXaxis()->SetBinLabel(11,"Others");
506
507 TH2F* hTrigCentSel=new TH2F("hTrigCentSel","Trigger types",11,-0.5,10.5,12,-10,110);
508 hTrigCentSel->GetXaxis()->SetBinLabel(1,"All");
509 hTrigCentSel->GetXaxis()->SetBinLabel(2,"kMB");
510 hTrigCentSel->GetXaxis()->SetBinLabel(3,"kINT7");
511 hTrigCentSel->GetXaxis()->SetBinLabel(4,"kCINT5");
512 hTrigCentSel->GetXaxis()->SetBinLabel(5,"kCent");
513 hTrigCentSel->GetXaxis()->SetBinLabel(6,"kSemiCent");
514 hTrigCentSel->GetXaxis()->SetBinLabel(7,"kEMC1+7");
515 hTrigCentSel->GetXaxis()->SetBinLabel(8,"kEMCJET+GAMMA");
516 hTrigCentSel->GetXaxis()->SetBinLabel(9,"Muons");
517 hTrigCentSel->GetXaxis()->SetBinLabel(10,"PHOS");
518 hTrigCentSel->GetXaxis()->SetBinLabel(11,"Others");
519
818c1271 520 fOutputEvSelection->Add(evselection);
521 fOutputEvSelection->Add(hzvtx);
23dfe729 522 fOutputEvSelection->Add(hTrigCent);
523 fOutputEvSelection->Add(hTrigMul);
524 fOutputEvSelection->Add(hTrigCentSel);
818c1271 525 }
a4b0ffc7 526// AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
527// AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
528// AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
529// fCuts->GetPidHF()->SetPidResponse(pidResp);
0dbb51a0 530 // Post the data
531 PostData(1,fNEntries);
5fc4893f 532 if(fOnOff[1]) PostData(2,fOutputPID);
533 if(fOnOff[0]) PostData(3,fOutputTrack);
0dbb51a0 534 PostData(4,fCuts);
5fc4893f 535 if(fOnOff[2]) PostData(5,fOutputCounters);
818c1271 536 if(fOnOff[3]) PostData(7,fOutputEvSelection);
537
5fc4893f 538 if(!fOnOff[0] && !fOnOff[1] && !fOnOff[2]) AliError("Nothing will be filled!");
0dbb51a0 539}
540
541//___________________________________________________________________________
542void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
543{
544 // Execute analysis for current event
545
546 AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
547 if(fDebug>2) printf("Analysing decay %d\n",fDecayChannel);
548 // Post the data already here
549 PostData(1,fNEntries);
5fc4893f 550 if(fOnOff[1]) PostData(2,fOutputPID);
551 if(fOnOff[0]) PostData(3,fOutputTrack);
0dbb51a0 552 PostData(4,fCuts);
5fc4893f 553 if(fOnOff[2]) {
554 PostData(5,fOutputCounters);
555 if(fCuts->GetUseCentrality()) PostData(6,fOutputCheckCentrality);
556 }
0dbb51a0 557
558 TClonesArray *arrayProng =0;
559 Int_t pdg=0;
a4ef4383 560 Int_t *pdgdaughters=0x0;
561
0dbb51a0 562 if(!aod && AODEvent() && IsStandardAOD()) {
563 // In case there is an AOD handler writing a standard AOD, use the AOD
564 // event in memory rather than the input (ESD) event.
565 aod = dynamic_cast<AliAODEvent*> (AODEvent());
566 // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
567 // have to taken from the AOD event hold by the AliAODExtension
568 AliAODHandler* aodHandler = (AliAODHandler*)
569 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
570 if(aodHandler->GetExtensions()) {
571
572 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
573 AliAODEvent *aodFromExt = ext->GetAOD();
574
575
576
577 switch(fDecayChannel){
578 case 0:
579 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
580 pdg=411;
a4ef4383 581 if(fReadMC){
582 pdgdaughters =new Int_t[3];
583 pdgdaughters[0]=211;//pi
584 pdgdaughters[1]=321;//K
585 pdgdaughters[2]=211;//pi
586 }
0dbb51a0 587 break;
588 case 1:
589 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("D0toKpi");
590 pdg=421;
a4ef4383 591 if(fReadMC){
592 pdgdaughters =new Int_t[2];
593 pdgdaughters[0]=211;//pi
594 pdgdaughters[1]=321;//K
595 }
0dbb51a0 596 break;
597 case 2:
598 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar");
599 pdg=413;
a4ef4383 600 if(fReadMC){
fb9311e8 601 pdgdaughters =new Int_t[3];
a4ef4383 602 pdgdaughters[1]=211;//pi
603 pdgdaughters[0]=321;//K
604 pdgdaughters[2]=211;//pi (soft?)
605 }
0dbb51a0 606 break;
607 case 3:
608 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
609 pdg=431;
a4ef4383 610 if(fReadMC){
611 pdgdaughters =new Int_t[3];
612 pdgdaughters[0]=321;//K
613 pdgdaughters[1]=321;//K
614 pdgdaughters[2]=211;//pi
615 }
0dbb51a0 616 break;
617 case 4:
618 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm4Prong");
619 pdg=421;
a4ef4383 620 if(fReadMC){
621 pdgdaughters =new Int_t[4];
622 pdgdaughters[0]=321;
623 pdgdaughters[1]=211;
624 pdgdaughters[2]=211;
625 pdgdaughters[3]=211;
626 }
0dbb51a0 627 break;
628 case 5:
629 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
630 pdg=4122;
a4ef4383 631 if(fReadMC){
632 pdgdaughters =new Int_t[3];
633 pdgdaughters[0]=2212;//p
634 pdgdaughters[1]=321;//K
635 pdgdaughters[2]=211;//pi
636 }
0dbb51a0 637 break;
638 }
639 }
dc222f77 640 } else if(aod) {
0dbb51a0 641 switch(fDecayChannel){
642 case 0:
643 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
644 pdg=411;
a4ef4383 645 if(fReadMC){
646 pdgdaughters =new Int_t[3];
647 pdgdaughters[0]=211;//pi
648 pdgdaughters[1]=321;//K
649 pdgdaughters[2]=211;//pi
650 }
0dbb51a0 651 break;
652 case 1:
653 arrayProng=(TClonesArray*)aod->GetList()->FindObject("D0toKpi");
654 pdg=421;
a4ef4383 655 if(fReadMC){
656 pdgdaughters =new Int_t[2];
657 pdgdaughters[0]=211;//pi
658 pdgdaughters[1]=321;//K
659 }
0dbb51a0 660 break;
661 case 2:
662 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Dstar");
663 pdg=413;
a4ef4383 664 if(fReadMC){
24bcb2f3 665 pdgdaughters =new Int_t[3];
a4ef4383 666 pdgdaughters[1]=211;//pi
667 pdgdaughters[0]=321;//K
668 pdgdaughters[2]=211;//pi (soft?)
669 }
0dbb51a0 670 break;
671 case 3:
672 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
673 pdg=431;
a4ef4383 674 if(fReadMC){
675 pdgdaughters =new Int_t[3];
676 pdgdaughters[0]=321;//K
677 pdgdaughters[1]=321;//K
678 pdgdaughters[2]=211;//pi
679 }
0dbb51a0 680 break;
681 case 4:
682 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm4Prong");
683 pdg=421;
a4ef4383 684 if(fReadMC){
685 pdgdaughters =new Int_t[4];
686 pdgdaughters[0]=321;
687 pdgdaughters[1]=211;
688 pdgdaughters[2]=211;
689 pdgdaughters[3]=211;
690 }
0dbb51a0 691 break;
692 case 5:
693 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
694 pdg=4122;
a4ef4383 695 if(fReadMC){
696 pdgdaughters =new Int_t[3];
697 pdgdaughters[0]=2212;//p
698 pdgdaughters[1]=321;//K
699 pdgdaughters[2]=211;//pi
700 }
0dbb51a0 701 break;
702 }
703 }
19222b31 704 Bool_t isSimpleMode=fSimpleMode;
0dbb51a0 705 if(!arrayProng) {
706 AliInfo("Branch not found! The output will contain only trak related histograms\n");
707 isSimpleMode=kTRUE;
9af24f46 708 fNEntries->Fill(2);
0dbb51a0 709 }
710
a4ef4383 711 TClonesArray *mcArray = 0;
712 AliAODMCHeader *mcHeader = 0;
713
3655ecf2 714 if(!aod) {
715 delete [] pdgdaughters;
716 return;
717 }
718
a4ef4383 719 //check if MC
720 if(fReadMC) {
721 // load MC particles
722 mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
723 if(!mcArray) {
724 printf("AliAnalysisTaskSEHFQA::UserExec: MC particles branch not found!\n");
fb9311e8 725 delete [] pdgdaughters;
a4ef4383 726 return;
727 }
728
729 // load MC header
730 mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
731 if(!mcHeader) {
732 printf("AliAnalysisTaskSEHFQA::UserExec: MC header branch not found!\n");
fb9311e8 733 delete [] pdgdaughters;
a4ef4383 734 return;
735 }
736 }
23dfe729 737
738
739 UInt_t evSelMask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
740 Double_t centrality=fCuts->GetCentrality(aod);
741 Double_t multiplicity=aod->GetHeader()->GetRefMultiplicity();
742 TH2F* hTrigC=(TH2F*)fOutputEvSelection->FindObject("hTrigCent");
743 TH2F* hTrigM=(TH2F*)fOutputEvSelection->FindObject("hTrigMul");
744
745 hTrigC->Fill(0.,centrality);
746 hTrigM->Fill(0.,multiplicity);
747
748 if(evSelMask & AliVEvent::kMB){
749 hTrigC->Fill(1.,centrality);
750 hTrigM->Fill(1.,multiplicity);
751 }
752 if(evSelMask & AliVEvent::kINT7){
753 hTrigC->Fill(2.,centrality);
754 hTrigM->Fill(2.,multiplicity);
755 }
756 if(evSelMask & AliVEvent::kCINT5){
757 hTrigC->Fill(3.,centrality);
758 hTrigM->Fill(3.,multiplicity);
759 }
760 if(evSelMask & AliVEvent::kCentral){
761 hTrigC->Fill(4.,centrality);
762 hTrigM->Fill(4.,multiplicity);
763 }
764 if(evSelMask & AliVEvent::kSemiCentral){
765 hTrigC->Fill(5.,centrality);
766 hTrigM->Fill(5.,multiplicity);
767 }
768 if(evSelMask & (AliVEvent::kEMC1 | AliVEvent::kEMC7)){
769 hTrigC->Fill(6.,centrality);
770 hTrigM->Fill(6.,multiplicity);
771 }
772 if(evSelMask & (AliVEvent::kEMCEJE | AliVEvent::kEMCEGA)){
773 hTrigC->Fill(7.,centrality);
774 hTrigM->Fill(7.,multiplicity);
775 }
776 if(evSelMask & (((AliVEvent::kCMUS5 | AliVEvent::kMUSH7) | (AliVEvent::kMUL7 | AliVEvent::kMUU7)) | (AliVEvent::kMUS7 | AliVEvent::kMUON))){
777 hTrigC->Fill(8.,centrality);
778 hTrigM->Fill(8.,multiplicity);
779 }
780 if(evSelMask & (AliVEvent::kPHI1 | AliVEvent::kPHI7)){
781 hTrigC->Fill(9.,centrality);
782 hTrigM->Fill(9.,multiplicity);
783 }
784 if(evSelMask & (AliVEvent::kDG5 | AliVEvent::kZED)){
785 hTrigC->Fill(10.,centrality);
786 hTrigM->Fill(10.,multiplicity);
787 }
788
789
0dbb51a0 790 // fix for temporary bug in ESDfilter
791 // the AODs with null vertex pointer didn't pass the PhysSel
3655ecf2 792 if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) {
793 delete [] pdgdaughters;
794 return;
795 }
0dbb51a0 796
797 // count event
798 fNEntries->Fill(0);
9af24f46 799
800 //count events with good vertex
801 // AOD primary vertex
802 AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
803 TString primTitle = vtx1->GetTitle();
804 if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0) fNEntries->Fill(4);
805
a3aa1279 806 // trigger class for PbPb C0SMH-B-NOPF-ALLNOTRD, C0SMH-B-NOPF-ALL
5fc4893f 807 //TString trigclass=aod->GetFiredTriggerClasses();
808 //if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) fNEntries->Fill(5); //tmp
a3aa1279 809
818c1271 810 Int_t runNumber = aod->GetRunNumber();
811
23dfe729 812
813
ac0c2841 814 Bool_t evSelbyCentrality=kTRUE,evSelected=kTRUE,evSelByVertex=kTRUE,evselByPileup=kFALSE;
0dbb51a0 815 //select event
816 if(!fCuts->IsEventSelected(aod)) {
82f89d0d 817 evSelected=kFALSE;
ac0c2841 818 if(fCuts->GetWhyRejection()==1) {fNEntries->Fill(1); evselByPileup=kTRUE;}// rejected for pileup
819 if(fCuts->GetWhyRejection()==2 || fCuts->GetWhyRejection()==3) evSelbyCentrality=kFALSE; //rejected by centrality
820 if(fCuts->GetWhyRejection()==4) evSelByVertex=kFALSE; //rejected by vertex
5fc4893f 821 if(fCuts->GetWhyRejection()==5) fNEntries->Fill(5);//tmp
00c00d8e 822 if(fCuts->GetWhyRejection()==6 && fOnOff[3]) ((AliCounterCollection*)fOutputEvSelection->FindObject("evselection"))->Count(Form("evnonsel:zvtx/Run:%d",runNumber));
0dbb51a0 823 }
23dfe729 824 if(evSelected){
825 TH2F* hTrigS=(TH2F*)fOutputEvSelection->FindObject("hTrigCentSel");
826 hTrigS->Fill(0.,centrality);
827
828 if(evSelMask & AliVEvent::kMB) hTrigS->Fill(1.,centrality);
829 if(evSelMask & AliVEvent::kINT7) hTrigS->Fill(2.,centrality);
830 if(evSelMask & AliVEvent::kCINT5) hTrigS->Fill(3.,centrality);
831 if(evSelMask & AliVEvent::kCentral) hTrigS->Fill(4.,centrality);
832 if(evSelMask & AliVEvent::kSemiCentral) hTrigS->Fill(5.,centrality);
833 if(evSelMask & (AliVEvent::kEMC1 | AliVEvent::kEMC7)) hTrigS->Fill(6.,centrality);
834 if(evSelMask & (AliVEvent::kEMCEJE | AliVEvent::kEMCEGA)) hTrigS->Fill(7.,centrality);
835 if(evSelMask & (((AliVEvent::kCMUS5 | AliVEvent::kMUSH7) | (AliVEvent::kMUL7 | AliVEvent::kMUU7)) | (AliVEvent::kMUS7 | AliVEvent::kMUON))) hTrigS->Fill(8.,centrality);
836 if(evSelMask & (AliVEvent::kPHI1 | AliVEvent::kPHI7)) hTrigS->Fill(9.,centrality);
837 if(evSelMask & (AliVEvent::kDG5 | AliVEvent::kZED)) hTrigS->Fill(10.,centrality);
838 }
839
ac0c2841 840 if(evSelected || (!evSelected && !evSelbyCentrality && evSelByVertex && !evselByPileup)){ //events selected or not selected because of vtx or pileup
5fc4893f 841 if(fOnOff[2] && fCuts->GetUseCentrality()){
818c1271 842
ac0c2841 843 Float_t stdCentf=fCuts->GetCentrality(aod);
844 Int_t stdCent = (Int_t)(stdCentf+0.5);
5fc4893f 845 Float_t secondCentf =fCuts->GetCentrality(aod,fEstimator);
846 Int_t secondCent = (Int_t)(secondCentf+0.5);
82f89d0d 847 Int_t mincent=stdCent-stdCent%10;
5fc4893f 848 if(stdCentf==-1) {
5587ae1a 849 mincent=-10;
5fc4893f 850 stdCent=-1;
851 }
c40c91c6 852 if(mincent==100)mincent--;
82f89d0d 853 ((AliCounterCollection*)fOutputCounters->FindObject("stdEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber));
5fc4893f 854
82f89d0d 855 mincent=secondCent-secondCent%10;
5fc4893f 856 if(secondCentf==-1) {
5587ae1a 857 mincent=-10;
5fc4893f 858 secondCent=-1;
859 }
c40c91c6 860 if(mincent==100)mincent--;
82f89d0d 861 ((AliCounterCollection*)fOutputCounters->FindObject("secondEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber));
862
863 if(stdCent<fCuts->GetMinCentrality() || stdCent>fCuts->GetMaxCentrality()){
864 ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsOut"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
865 ((TH1F*)fOutputCheckCentrality->FindObject("hMultOut"))->Fill(aod->GetHeader()->GetRefMultiplicity());
866 }else{
867 ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsIn"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
868 ((TH1F*)fOutputCheckCentrality->FindObject("hMultIn"))->Fill(aod->GetHeader()->GetRefMultiplicity());
869 }
ac0c2841 870 ((TH2F*)fOutputCheckCentrality->FindObject("hMultvsPercentile"))->Fill(aod->GetHeader()->GetRefMultiplicity(),stdCentf);
0dbb51a0 871
82f89d0d 872 PostData(6,fOutputCheckCentrality);
873
874 } else{
5fc4893f 875 if(fOnOff[0]){
876 ((TH1F*)fOutputTrack->FindObject("hNtracklets"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
877 ((TH1F*)fOutputTrack->FindObject("hMult"))->Fill(aod->GetHeader()->GetRefMultiplicity());
878 }
a4ef4383 879 }
82f89d0d 880 }
881
818c1271 882 if(fOnOff[3]){
883 const AliVVertex *vertex = aod->GetPrimaryVertex();
884 Double_t zvtx=vertex->GetZ();
a4b0ffc7 885 if(evSelected || (!evSelected && TMath::Abs(zvtx) > 10.))
818c1271 886 ((TH1F*)fOutputEvSelection->FindObject("hzvtx"))->Fill(zvtx);
887 }
888
82f89d0d 889 if(!evSelected) {
890 delete [] pdgdaughters;
891 return; //discard all events not selected (vtx and/or centrality)
a4ef4383 892 }
893
818c1271 894
476db98d 895 AliAODPidHF* pidHF=fCuts->GetPidHF();
362242bf 896 if(!pidHF) {
897 delete [] pdgdaughters;
898 return;
899 }
a4b0ffc7 900 AliPIDResponse* respF=pidHF->GetPidResponse();
476db98d 901 AliTPCPIDResponse* tpcres=new AliTPCPIDResponse();
a4b0ffc7 902 if(pidHF->GetOldPid()) pidHF->SetBetheBloch(*tpcres);
903 Bool_t oldPID=pidHF->GetOldPid();
476db98d 904
905
0dbb51a0 906 Int_t ntracks=0;
5fc4893f 907 Int_t isGoodTrack=0, isFakeTrack=0;
0dbb51a0 908
909 if(aod) ntracks=aod->GetNTracks();
910
5fc4893f 911 if(fOnOff[0] || fOnOff[1]){
912 //loop on tracks in the event
913 for (Int_t k=0;k<ntracks;k++){
914 AliAODTrack* track=aod->GetTrack(k);
5fc4893f 915 AliAODPid *pid = track->GetDetPid();
916
0dbb51a0 917
5fc4893f 918 if(fOnOff[1]){
919 if(!pid) {if (fDebug>1)cout<<"No AliAODPid found"<<endl; continue;}
920 Double_t times[AliPID::kSPECIES];
921 pid->GetIntegratedTimes(times);
0dbb51a0 922
5fc4893f 923 Double_t tofRes[AliPID::kSPECIES];
924 pid->GetTOFpidResolution(tofRes);
925
926 //check TOF
b906dda8 927 TH1F* htmpfl=((TH1F*)fOutputPID->FindObject("hTOFflags"));
928 htmpfl->Fill(0.);
23dfe729 929 if (track->GetStatus()&AliESDtrack::kTPCout) htmpfl->Fill(1.);
930 if (track->GetStatus()&AliESDtrack::kTOFout) htmpfl->Fill(2.);
931 if (track->GetStatus()&AliESDtrack::kTIME) htmpfl->Fill(3.);
932 if (track->GetStatus()&AliESDtrack::kTOFpid) htmpfl->Fill(4.);
933 if (track->GetStatus()&AliESDtrack::kTOFmismatch) htmpfl->Fill(5.);
b906dda8 934
5fc4893f 935 if(pidHF && pidHF->CheckStatus(track,"TOF")){
936 ((TH1F*)fOutputPID->FindObject("hTOFtime"))->Fill(times[AliPID::kProton]);
937 ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptime"))->Fill(track->P(),pid->GetTOFsignal()-times[3]); //3 is kaon
938 ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(pid->GetTOFsignal());
939 if (pid->GetTOFsignal()< 0) ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(-1);
940
5587ae1a 941
5fc4893f 942 // test TOF sigma PID
943 if (tofRes[2] != 0.) { // protection against 'old' AODs...
944 ((TH2F*)fOutputPID->FindObject("hTOFsigmaKSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kKaon])/tofRes[3]);
945 ((TH2F*)fOutputPID->FindObject("hTOFsigmaPionSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kPion])/tofRes[2]);
946 ((TH2F*)fOutputPID->FindObject("hTOFsigmaProtonSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kProton])/tofRes[4]);
947 for (Int_t iS=2; iS<5; iS++){ //we plot TOF Pid resolution for 3-sigma identified particles
948 if ( (TMath::Abs(times[iS]-pid->GetTOFsignal())/tofRes[iS])<3.){
949 switch (iS) {
950 case AliPID::kPion:
951 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigPion"))->Fill(tofRes[iS]);
952 break;
953 case AliPID::kKaon:
954 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigKaon"))->Fill(tofRes[iS]);
955 break;
956 case AliPID::kProton:
957 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigProton"))->Fill(tofRes[iS]);
958 break;
959 default:
960 break;
961 }
962 }
a4ef4383 963 }
964 }
5fc4893f 965 }//if TOF status
966
967 if(pidHF && pidHF->CheckStatus(track,"TPC")){
476db98d 968
5fc4893f 969 Double_t TPCp=pid->GetTPCmomentum();
970 Double_t TPCsignal=pid->GetTPCsignal();
971 ((TH1F*)fOutputPID->FindObject("hTPCsig"))->Fill(TPCsignal);
972 ((TH1F*)fOutputPID->FindObject("hTPCsigvsp"))->Fill(TPCp,TPCsignal);
973 //if (pidHF->IsKaonRaw(track, "TOF"))
a4b0ffc7 974 if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaK"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kKaon));
975 if (oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaK"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kKaon));
5fc4893f 976 //if (pidHF->IsPionRaw(track, "TOF"))
a4b0ffc7 977 if(oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaPion"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kPion));
978 if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaPion"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kPion));
5fc4893f 979 //if (pidHF->IsProtonRaw(track,"TOF"))
a4b0ffc7 980 if(oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaProton"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kProton));
981 if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaProton"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kProton));
5fc4893f 982 }//if TPC status
983 } //end PID histograms
984
985 Int_t nclsTot=0,nclsSPD=0;
986
987 //check clusters of the tracks
988 if(fOnOff[0]){
989
bc6846db 990 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1);
5fc4893f 991 for(Int_t l=0;l<6;l++) {
992 if(TESTBIT(track->GetITSClusterMap(),l)) {
bc6846db 993 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(l);
5fc4893f 994 nclsTot++; if(l<2) nclsSPD++;
995 }
996 }
997 ((TH1F*)fOutputTrack->FindObject("hnClsITS"))->Fill(nclsTot);
998 ((TH1F*)fOutputTrack->FindObject("hnClsSPD"))->Fill(nclsSPD);
39dd297f 999 if(track->Pt()>0.3 &&
1000 TMath::Abs(track->Eta())<0.8 &&
1001 track->GetStatus()&AliESDtrack::kITSrefit &&
1002 track->GetStatus()&AliESDtrack::kTPCrefit &&
1003 nclsSPD>0){
1004 ((TH1F*)fOutputTrack->FindObject("hnClsITSselTr"))->Fill(nclsTot);
1005 }
5fc4893f 1006 if(!(track->GetStatus()&AliESDtrack::kTPCin) && track->GetStatus()&AliESDtrack::kITSrefit && !(track->GetStatus()&AliESDtrack::kITSpureSA)){//tracks retrieved in the ITS and not reconstructed in the TPC
1007 ((TH1F*)fOutputTrack->FindObject("hnClsITS-SA"))->Fill(nclsTot);
bc6846db 1008 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1);
1009 for(Int_t l=0;l<6;l++) {
1010 if(TESTBIT(track->GetITSClusterMap(),l)) {
1011 ((TH1F*)fOutputTrack->FindObject("hnLayerITSsa"))->Fill(l);
1012 }
1013 }
acc33385 1014 }
5fc4893f 1015 Int_t label=0;
1016 if(fReadMC){
1017 label=track->GetLabel();
1018 if (label<0)fNEntries->Fill(8);
1019 else fNEntries->Fill(9);
acc33385 1020 }
0dbb51a0 1021
5fc4893f 1022 if(isSimpleMode){
1023
1024 if (track->Pt()>0.3 &&
1025 track->GetStatus()&AliESDtrack::kTPCrefit &&
1026 track->GetStatus()&AliESDtrack::kITSrefit &&
1027 /*nclsTot>3 &&*/
1028 nclsSPD>0) {//count good tracks
1029
1030
1031 if(fReadMC && label<0) {
1032 ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt());
1033 isFakeTrack++;
1034 } else {
1035 ((TH1F*)fOutputTrack->FindObject("hptGoodTr"))->Fill(track->Pt());
1036 isGoodTrack++;
1037 }
ad42e35b 1038 }
818c1271 1039 } //simple mode: no IsSelected on tracks: use "manual" cuts
1040 } //fill track histos
5fc4893f 1041 } //end loop on tracks
0dbb51a0 1042
5fc4893f 1043 //fill once per event
1044 if(fOnOff[0]){
1045 if (fReadMC) ((TH1F*)fOutputTrack->FindObject("hdistrFakeTr"))->Fill(isFakeTrack);
1046 ((TH1F*)fOutputTrack->FindObject("hdistrGoodTr"))->Fill(isGoodTrack);
1047 }
0dbb51a0 1048
5fc4893f 1049 if(!isSimpleMode){
1050 // loop over candidates
1051 Int_t nCand = arrayProng->GetEntriesFast();
1052 Int_t ndaugh=3;
1053 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi) ndaugh=2;
1054 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpipipi) ndaugh=4;
1055
1056 for (Int_t iCand = 0; iCand < nCand; iCand++) {
1057 AliAODRecoDecayHF *d = (AliAODRecoDecayHF*)arrayProng->UncheckedAt(iCand);
1058 if(d->GetSelectionMap()) {
1059 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi && !d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)) continue; //skip the D0 from Dstar
1060 if(fDecayChannel==AliAnalysisTaskSEHFQA::kDplustoKpipi && !d->HasSelectionBit(AliRDHFCuts::kDplusCuts)) continue; //skip the 3 prong !D+
1061 }
acc33385 1062
5fc4893f 1063 if(fReadMC){
1064 Int_t labD = d->MatchToMC(pdg,mcArray,ndaugh,pdgdaughters);
1065 if(labD>=0){
1066 AliAODMCParticle *partD = (AliAODMCParticle*)mcArray->At(labD);
1067 Int_t label=partD->GetMother();
1068 AliAODMCParticle *mot = (AliAODMCParticle*)mcArray->At(label);
1069 while(label>=0){//get first mother
1070 mot = (AliAODMCParticle*)mcArray->At(label);
1071 label=mot->GetMother();
1072 }
1073 Int_t pdgMotCode = mot->GetPdgCode();
1074
1075 if(TMath::Abs(pdgMotCode)==4) fNEntries->Fill(6); //from primary charm
1076 if(TMath::Abs(pdgMotCode)==5) fNEntries->Fill(7); //from beauty
0dbb51a0 1077
acc33385 1078 }
5fc4893f 1079 }//end MC
1080 else fNEntries->Fill(6); //count the candidates (data)
1081
1082 for(Int_t id=0;id<ndaugh;id++){
1083
1084 //other histograms to be filled when the cut object is given
1085 AliAODTrack* track=(AliAODTrack*)d->GetDaughter(id);
1086
1087 //track quality
1088
1089 if (fCuts->IsInFiducialAcceptance(d->Pt(),d->Y(pdg)) && fCuts->IsSelected(d,AliRDHFCuts::kTracks,aod)) {
1090
1091 Int_t label=0;
1092 if(fReadMC)label=track->GetLabel();
ad42e35b 1093 if(fOnOff[0]){
818c1271 1094
ad42e35b 1095 if(fReadMC && label<0) {
1096 isFakeTrack++;
1097 ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt());
5fc4893f 1098
ad42e35b 1099 ((TH1F*)fOutputTrack->FindObject("hd0f"))->Fill(d->Getd0Prong(id));
1100 } else {
1101 isGoodTrack++;
1102 ((TH1F*)fOutputTrack->FindObject("hptGoodTr"))->Fill(track->Pt());
5fc4893f 1103
ad42e35b 1104 ((TH1F*)fOutputTrack->FindObject("hd0"))->Fill(d->Getd0Prong(id));
1105 }
818c1271 1106 }
5fc4893f 1107 if (fCuts->IsSelected(d,AliRDHFCuts::kAll,aod) && fOnOff[1]){
0dbb51a0 1108
5fc4893f 1109 AliAODPid *pid = track->GetDetPid();
5fc4893f 1110 Double_t times[5];
1111 pid->GetIntegratedTimes(times);
1112 if(pidHF && pidHF->CheckStatus(track,"TOF")) ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptimeAC"))->Fill(track->P(),pid->GetTOFsignal()-times[AliPID::kKaon]);
1113 if(pidHF && pidHF->CheckStatus(track,"TPC")) ((TH2F*)fOutputPID->FindObject("hTPCsigvspAC"))->Fill(pid->GetTPCmomentum(),pid->GetTPCsignal());
1114
1115 fNEntries->Fill(3);
1116 } //end analysis cuts
1117 } //end acceptance and track cuts
1118 } //end loop on tracks in the candidate
1119 } //end loop on candidates
1120 if(fOnOff[0]){
1121 if(fReadMC) ((TH1F*)fOutputTrack->FindObject("hdistrFakeTr"))->Fill(isFakeTrack);
1122 ((TH1F*)fOutputTrack->FindObject("hdistrGoodTr"))->Fill(isGoodTrack);
1123 }
1124 }
1125 } //end if on pid or track histograms
fb9311e8 1126
476db98d 1127 delete tpcres;
fb9311e8 1128 delete [] pdgdaughters;
a4ef4383 1129 PostData(1,fNEntries);
5fc4893f 1130 if(fOnOff[1]) PostData(2,fOutputPID);
1131 if(fOnOff[0]) PostData(3,fOutputTrack);
a4ef4383 1132 PostData(4,fCuts);
5fc4893f 1133 if(fOnOff[2]) PostData(5,fOutputCounters);
1134 //Post data 6 done in case of centrality on
82f89d0d 1135
0dbb51a0 1136}
1137
a4ef4383 1138//____________________________________________________________________________
0dbb51a0 1139void AliAnalysisTaskSEHFQA::Terminate(Option_t */*option*/){
1140 //terminate analysis
1141
1142 fNEntries = dynamic_cast<TH1F*>(GetOutputData(1));
1143 if(!fNEntries){
1144 printf("ERROR: %s not available\n",GetOutputSlot(1)->GetContainer()->GetName());
1145 return;
1146 }
1147
1148 fOutputPID = dynamic_cast<TList*> (GetOutputData(2));
5fc4893f 1149 if (!fOutputPID && fOnOff[1]) {
0dbb51a0 1150 printf("ERROR: %s not available\n",GetOutputSlot(2)->GetContainer()->GetName());
1151 return;
1152 }
1153
1154 fOutputTrack = dynamic_cast<TList*> (GetOutputData(3));
5fc4893f 1155 if (!fOutputTrack && fOnOff[0]) {
0dbb51a0 1156 printf("ERROR: %s not available\n",GetOutputSlot(3)->GetContainer()->GetName());
1157 return;
1158 }
1159
1160}
1161