1 /**************************************************************************
2 * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 /////////////////////////////////////////////////////////////
20 // AliAnalysisTaskSE for HF quality assurance
22 // Author: Chiara Bianchin, chiara.bianchin@pd.infn.it
23 /////////////////////////////////////////////////////////////
25 #include <Riostream.h>
26 #include <TClonesArray.h>
31 #include <TDatabasePDG.h>
33 #include <AliAnalysisDataSlot.h>
34 #include <AliAnalysisDataContainer.h>
35 #include "AliAnalysisManager.h"
36 #include "AliESDtrack.h"
37 #include "AliVertexerTracks.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"
45 #include "AliAODMCHeader.h"
46 #include "AliAODRecoDecayHF2Prong.h"
47 #include "AliAODRecoCascadeHF.h"
48 #include "AliAnalysisVertexingHF.h"
49 #include "AliAnalysisTaskSE.h"
50 #include "AliCounterCollection.h"
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"
58 #include "AliInputEventHandler.h"
60 #include "AliAnalysisTaskSEHFQA.h"
62 ClassImp(AliAnalysisTaskSEHFQA)
64 //____________________________________________________________________________
66 AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA():AliAnalysisTaskSE(),
71 fOutputCheckCentrality(0x0),
72 fOutputEvSelection(0x0),
73 fDecayChannel(AliAnalysisTaskSEHFQA::kD0toKpi),
75 fEstimator(AliRDHFCuts::kCentTRK),
87 //____________________________________________________________________________
88 AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA(const char *name, AliAnalysisTaskSEHFQA::DecChannel ch,AliRDHFCuts* cuts):
89 AliAnalysisTaskSE(name),
94 fOutputCheckCentrality(0x0),
95 fOutputEvSelection(0x0),
98 fEstimator(AliRDHFCuts::kCentTRK),
105 //SetCutObject(cuts);
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)
116 if (fOnOff[1]) DefineOutput(2,TList::Class()); //My private output
117 // Output slot #3 writes into a TList container (Tracks)
118 if (fOnOff[0]) DefineOutput(3,TList::Class()); //My private output
119 // Output slot #4 writes into a AliRDHFCuts container (cuts)
120 switch(fDecayChannel){
122 DefineOutput(4,AliRDHFCutsDplustoKpipi::Class()); //My private output
125 DefineOutput(4,AliRDHFCutsD0toKpi::Class()); //My private output
128 DefineOutput(4,AliRDHFCutsDStartoKpipi::Class()); //My private output
131 DefineOutput(4,AliRDHFCutsDstoKKpi::Class()); //My private output
134 DefineOutput(4,AliRDHFCutsD0toKpipipi::Class()); //My private output
137 DefineOutput(4,AliRDHFCutsLctopKpi::Class()); //My private output
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
147 if(fOnOff[3]) DefineOutput(7,TList::Class()); //My private output
151 //___________________________________________________________________________
152 AliAnalysisTaskSEHFQA::~AliAnalysisTaskSEHFQA()
161 delete fOutputCounters;
163 delete fOutputCheckCentrality;
165 delete fOutputEvSelection;
169 //___________________________________________________________________________
170 void AliAnalysisTaskSEHFQA::Init(){
173 if(fDebug > 1) printf("AnalysisTaskSEHFQA::Init() \n");
175 switch(fDecayChannel){
178 AliRDHFCutsDplustoKpipi* copycut=new AliRDHFCutsDplustoKpipi(*(static_cast<AliRDHFCutsDplustoKpipi*>(fCuts)));
185 AliRDHFCutsD0toKpi* copycut=new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fCuts)));
192 AliRDHFCutsDStartoKpipi* copycut=new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fCuts)));
199 AliRDHFCutsDstoKKpi* copycut=new AliRDHFCutsDstoKKpi(*(static_cast<AliRDHFCutsDstoKKpi*>(fCuts)));
206 AliRDHFCutsD0toKpipipi* copycut=new AliRDHFCutsD0toKpipipi(*(static_cast<AliRDHFCutsD0toKpipipi*>(fCuts)));
213 AliRDHFCutsLctopKpi* copycut=new AliRDHFCutsLctopKpi(*(static_cast<AliRDHFCutsLctopKpi*>(fCuts)));
227 //___________________________________________________________________________
228 void AliAnalysisTaskSEHFQA::UserCreateOutputObjects()
231 //create the output container
232 if(fDebug > 1) printf("AnalysisTaskSEHFQA::UserCreateOutputObjects() \n");
236 fNEntries=new TH1F(GetOutputSlot(1)->GetContainer()->GetName(), "Counts the number of events", 10,-0.5,9.5);
237 fNEntries->GetXaxis()->SetBinLabel(1,"nEventsAnal");
238 fNEntries->GetXaxis()->SetBinLabel(2,"Pile-up Rej");
239 fNEntries->GetXaxis()->SetBinLabel(3,"No VertexingHF");
240 fNEntries->GetXaxis()->SetBinLabel(4,"nCandidates(AnCuts)");
241 fNEntries->GetXaxis()->SetBinLabel(5,"EventsWithGoodVtx");
242 //fNEntries->GetXaxis()->SetBinLabel(6,"N. of 0SMH");
243 fNEntries->GetXaxis()->SetBinLabel(6,"N. of CSH1");
245 fNEntries->GetXaxis()->SetBinLabel(7,"MC Cand from c");
246 fNEntries->GetXaxis()->SetBinLabel(8,"MC Cand from b");
247 fNEntries->GetXaxis()->SetBinLabel(9,"N fake Trks");
248 fNEntries->GetXaxis()->SetBinLabel(10,"N true Trks");
250 fNEntries->GetXaxis()->SetBinLabel(7,"N candidates");
253 fNEntries->GetXaxis()->SetNdivisions(1,kFALSE);
257 fOutputPID=new TList();
258 fOutputPID->SetOwner();
259 fOutputPID->SetName(GetOutputSlot(2)->GetContainer()->GetName());
262 TH1F* hTOFflags=new TH1F("hTOFflags","TOF flags",6,-0.5,5.5);
263 hTOFflags->SetMinimum(0.);
264 hTOFflags->GetXaxis()->SetBinLabel(1,"All Tracks");
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");
271 TString hname="hTOFsig";
272 TH1F* hTOFsig=new TH1F(hname.Data(),"Distribution of TOF signal;TOF time [ps];Entries", 100, -2.e3,40.e3);
275 TH1F* hTOFtime=new TH1F(hname.Data(),"Distribution of TOF time Kaon;TOF time(Kaon) [ps];Entries", 1000, 0.,50000.);
277 hname="hTOFtimeKaonHyptime";
278 TH2F* hTOFtimeKaonHyptime=new TH2F(hname.Data(),"TOFtime - timeHypothesisForKaon;p[GeV/c];TOFtime - timeHypothesisForKaon [ps]",500,0.,10.,1000,-20000.,20000.);
280 hname="hTOFtimeKaonHyptimeAC";
281 TH2F* hTOFtimeKaonHyptimeAC=new TH2F(hname.Data(),"TOFtime - timeHypothesisForKaon;p[GeV/c];TOFtime - timeHypothesisForKaon [ps]",500,0.,10.,1000,-20000.,20000.);
283 hname="hTOFsigmaKSigPid";
284 TH2F* hTOFsigmaKSigPid=new TH2F(hname.Data(),"(TOFsignal-timeK)/tofSigPid;p[GeV/c];(TOFsignal-timeK)/tofSigPid",500,0.,10.,400,-20,20);
286 hname="hTOFsigmaPionSigPid";
287 TH2F* hTOFsigmaPionSigPid=new TH2F(hname.Data(),"(TOFsignal-time#pi)/tofSigPid;p[GeV/c];(TOFsignal-time#pi)/tofSigPid",500,0.,10.,400,-20,20);
289 hname="hTOFsigmaProtonSigPid";
290 TH2F* hTOFsigmaProtonSigPid=new TH2F(hname.Data(),"(TOFsignal-timep)/tofSigPid;p[GeV/c];(TOFsignal-time p)/tofSigPid",500,0.,10.,400,-20,20);
292 hname="hTOFsigPid3sigPion";
293 TH1F* hTOFsigPid3sigPion=new TH1F(hname.Data(),"TOF PID resolution (#pi) [ps]",500,0.,1000.);
295 hname="hTOFsigPid3sigKaon";
296 TH1F* hTOFsigPid3sigKaon=new TH1F(hname.Data(),"TOF PID resolution (K) [ps]",500,0.,1000.);
298 hname="hTOFsigPid3sigProton";
299 TH1F* hTOFsigPid3sigProton=new TH1F(hname.Data(),"TOF PID resolution (p) [ps]",500,0.,1000.);
304 TH1F* hTPCsig=new TH1F(hname.Data(),"Distribution of TPC signal;TPC sig;Entries", 100, 35.,100.);
307 TH2F* hTPCsigvsp=new TH2F(hname.Data(),"TPCsig vs p;TPC p[GeV/c];TPCsig",500,0.,10.,1000,35.,100.);
309 hname="hTPCsigvspAC";
310 TH2F* hTPCsigvspAC=new TH2F(hname.Data(),"TPCsig vs p;TPCp[GeV/c];TPCsig",500,0.,10.,1000,35.,100.);
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);
315 hname="hTPCsigmaPion";
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);
318 hname="hTPCsigmaProton";
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);
321 fOutputPID->Add(hTOFflags);
322 fOutputPID->Add(hTOFsig);
323 fOutputPID->Add(hTPCsig);
324 fOutputPID->Add(hTOFtime);
325 fOutputPID->Add(hTOFtimeKaonHyptime);
326 fOutputPID->Add(hTOFtimeKaonHyptimeAC);
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);
340 //quality of the tracks
342 fOutputTrack=new TList();
343 fOutputTrack->SetOwner();
344 fOutputTrack->SetName(GetOutputSlot(3)->GetContainer()->GetName());
346 TString hname="hnClsITS";
347 TH1F* hnClsITS=new TH1F(hname.Data(),"Distribution of number of ITS clusters;nITScls;Entries",7,-0.5,6.5);
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);
353 TH1F* hnClsITSSA=new TH1F(hname.Data(),"Distribution of number of ITS clusters(ITS-SA);nITScls;Entries",7,-0.5,6.5);
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");
360 hname="hnLayerITSsa";
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");
365 TH1F* hnClsSPD=new TH1F(hname.Data(),"Distribution of number of SPD clusters;nSPDcls;Entries",3,-0.5,2.5);
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");
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");
376 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);
379 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);
381 fOutputTrack->Add(hnClsITS);
382 fOutputTrack->Add(hnClsITSselTr);
383 fOutputTrack->Add(hnClsITSSA);
384 fOutputTrack->Add(hnLayerITS);
385 fOutputTrack->Add(hnLayerITSsa);
386 fOutputTrack->Add(hnClsSPD);
387 fOutputTrack->Add(hptGoodTr);
388 fOutputTrack->Add(hdistrGoodTr);
389 fOutputTrack->Add(hd0);
390 fOutputTrack->Add(hd0z);
393 hname="hdistrFakeTr";
394 TH1F* hdistrFakeTr=new TH1F(hname.Data(),"Distribution of number of fake tracks per event;no.fake-tracks/ev;Entries",4000,-0.5,3999.5);
395 hdistrGoodTr->SetTitleOffset(1.3,"Y");
398 TH1F* hd0f=new TH1F(hname.Data(),"Impact parameter distribution of fake tracks;d_{0}[cm];Entries/10^{3} cm",200,-0.1,0.1);
401 TH1F* hptFakeTr=new TH1F(hname.Data(),"Pt distribution of fake tracks;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
402 hptFakeTr->SetTitleOffset(1.3,"Y");
404 fOutputTrack->Add(hptFakeTr);
405 fOutputTrack->Add(hdistrFakeTr);
406 fOutputTrack->Add(hd0f);
412 if(fOnOff[2] && fCuts->GetUseCentrality()){
414 //Centrality (Counters)
415 fOutputCounters=new TList();
416 fOutputCounters->SetOwner();
417 fOutputCounters->SetName(GetOutputSlot(5)->GetContainer()->GetName());
419 AliCounterCollection *stdEstimator=new AliCounterCollection("stdEstimator");
420 stdEstimator->AddRubric("run",500000);
421 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");
422 stdEstimator->Init();
423 AliCounterCollection *secondEstimator=new AliCounterCollection("secondEstimator");
424 secondEstimator->AddRubric("run",500000);
425 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");
426 secondEstimator->Init();
428 fOutputCounters->Add(stdEstimator);
429 fOutputCounters->Add(secondEstimator);
431 //Centrality (Checks)
432 fOutputCheckCentrality=new TList();
433 fOutputCheckCentrality->SetOwner();
434 fOutputCheckCentrality->SetName(GetOutputSlot(6)->GetContainer()->GetName());
436 TString hname="hNtrackletsIn";
437 TH1F* hNtrackletsIn=new TH1F(hname.Data(),"Number of tracklets in Centrality range;ntracklets;Entries",5000,-0.5,4999.5);
440 TH1F* hMultIn=new TH1F(hname.Data(),"Multiplicity;multiplicity in Centrality range;Entries",10000,-0.5,9999.5);
442 hname="hNtrackletsOut";
443 TH1F* hNtrackletsOut=new TH1F(hname.Data(),"Number of tracklets out of Centrality range;ntracklets;Entries",5000,-0.5,4999.5);
446 TH1F* hMultOut=new TH1F(hname.Data(),"Multiplicity out of Centrality range;multiplicity;Entries",10000,-0.5,9999.5);
448 hname="hMultvsPercentile";
449 TH2F* hMultvsPercentile=new TH2F(hname.Data(),"Multiplicity vs Percentile;multiplicity;percentile",10000,-0.5,9999.5,12,-10.,110);
452 fOutputCheckCentrality->Add(hNtrackletsIn);
453 fOutputCheckCentrality->Add(hNtrackletsOut);
454 fOutputCheckCentrality->Add(hMultIn);
455 fOutputCheckCentrality->Add(hMultOut);
456 fOutputCheckCentrality->Add(hMultvsPercentile);
458 PostData(6,fOutputCheckCentrality);
462 TString hname="hNtracklets";
463 TH1F* hNtracklets=new TH1F(hname.Data(),"Number of tracklets;ntracklets;Entries",5000,-0.5,4999.5);
466 TH1F* hMult=new TH1F(hname.Data(),"Multiplicity;multiplicity;Entries",10000,-0.5,9999.5);
467 fOutputTrack->Add(hNtracklets);
468 fOutputTrack->Add(hMult);
472 //event selection (z vertex for the moment)
474 fOutputEvSelection=new TList();
475 fOutputEvSelection->SetOwner();
476 fOutputEvSelection->SetName(GetOutputSlot(7)->GetContainer()->GetName());
477 AliCounterCollection *evselection=new AliCounterCollection("evselection");
478 evselection->AddRubric("run",500000);
479 evselection->AddRubric("evnonsel","zvtx");
482 TH1F* hzvtx=new TH1F("hzvtx", "Distribution of z_{VTX};z_{VTX} [cm];Entries",100,-20,20);
485 TH2F* hTrigCent=new TH2F("hTrigCent","Centrality vs. Trigger types",12,-1.5,10.5,12,-10,110);
486 hTrigCent->GetXaxis()->SetBinLabel(1,"All");
487 hTrigCent->GetXaxis()->SetBinLabel(2,"kAny");
488 hTrigCent->GetXaxis()->SetBinLabel(3,"kMB");
489 hTrigCent->GetXaxis()->SetBinLabel(4,"kINT7");
490 hTrigCent->GetXaxis()->SetBinLabel(5,"kCINT5");
491 hTrigCent->GetXaxis()->SetBinLabel(6,"kCent");
492 hTrigCent->GetXaxis()->SetBinLabel(7,"kSemiCent");
493 hTrigCent->GetXaxis()->SetBinLabel(8,"kEMC1+7");
494 hTrigCent->GetXaxis()->SetBinLabel(9,"kEMCJET+GAMMA");
495 hTrigCent->GetXaxis()->SetBinLabel(10,"Muons");
496 hTrigCent->GetXaxis()->SetBinLabel(11,"PHOS");
497 hTrigCent->GetXaxis()->SetBinLabel(12,"Others");
499 TH2F* hTrigMul=new TH2F("hTrigMul","Multiplicity vs. Trigger types",12,-1.5,10.5,100,0.,10000.);
500 hTrigMul->GetXaxis()->SetBinLabel(1,"All");
501 hTrigMul->GetXaxis()->SetBinLabel(2,"kAny");
502 hTrigMul->GetXaxis()->SetBinLabel(3,"kMB");
503 hTrigMul->GetXaxis()->SetBinLabel(4,"kINT7");
504 hTrigMul->GetXaxis()->SetBinLabel(5,"kCINT5");
505 hTrigMul->GetXaxis()->SetBinLabel(6,"kCent");
506 hTrigMul->GetXaxis()->SetBinLabel(7,"kSemiCent");
507 hTrigMul->GetXaxis()->SetBinLabel(8,"kEMC1+7");
508 hTrigMul->GetXaxis()->SetBinLabel(9,"kEMCJET+GAMMA");
509 hTrigMul->GetXaxis()->SetBinLabel(10,"Muons");
510 hTrigMul->GetXaxis()->SetBinLabel(11,"PHOS");
511 hTrigMul->GetXaxis()->SetBinLabel(12,"Others");
513 TH2F* hTrigCentSel=new TH2F("hTrigCentSel","Trigger types",12,-1.5,10.5,12,-10,110);
514 hTrigCentSel->GetXaxis()->SetBinLabel(1,"All");
515 hTrigCentSel->GetXaxis()->SetBinLabel(2,"kAny");
516 hTrigCentSel->GetXaxis()->SetBinLabel(3,"kMB");
517 hTrigCentSel->GetXaxis()->SetBinLabel(4,"kINT7");
518 hTrigCentSel->GetXaxis()->SetBinLabel(5,"kCINT5");
519 hTrigCentSel->GetXaxis()->SetBinLabel(6,"kCent");
520 hTrigCentSel->GetXaxis()->SetBinLabel(7,"kSemiCent");
521 hTrigCentSel->GetXaxis()->SetBinLabel(8,"kEMC1+7");
522 hTrigCentSel->GetXaxis()->SetBinLabel(9,"kEMCJET+GAMMA");
523 hTrigCentSel->GetXaxis()->SetBinLabel(10,"Muons");
524 hTrigCentSel->GetXaxis()->SetBinLabel(11,"PHOS");
525 hTrigCentSel->GetXaxis()->SetBinLabel(12,"Others");
527 AliCounterCollection *trigCounter=new AliCounterCollection("trigCounter");
528 trigCounter->AddRubric("run",500000);
529 trigCounter->AddRubric("triggerType","Any/MB/Cent/SemiCent/EMCAL");
532 fOutputEvSelection->Add(evselection);
533 fOutputEvSelection->Add(hzvtx);
534 fOutputEvSelection->Add(hTrigCent);
535 fOutputEvSelection->Add(hTrigMul);
536 fOutputEvSelection->Add(hTrigCentSel);
537 fOutputEvSelection->Add(trigCounter);
539 // AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
540 // AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
541 // AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
542 // fCuts->GetPidHF()->SetPidResponse(pidResp);
544 PostData(1,fNEntries);
545 if(fOnOff[1]) PostData(2,fOutputPID);
546 if(fOnOff[0]) PostData(3,fOutputTrack);
548 if(fOnOff[2]) PostData(5,fOutputCounters);
549 if(fOnOff[3]) PostData(7,fOutputEvSelection);
551 if(!fOnOff[0] && !fOnOff[1] && !fOnOff[2]) AliError("Nothing will be filled!");
554 //___________________________________________________________________________
555 void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
557 // Execute analysis for current event
559 AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
560 if(fDebug>2) printf("Analysing decay %d\n",fDecayChannel);
561 // Post the data already here
562 PostData(1,fNEntries);
563 if(fOnOff[1]) PostData(2,fOutputPID);
564 if(fOnOff[0]) PostData(3,fOutputTrack);
567 PostData(5,fOutputCounters);
568 if(fCuts->GetUseCentrality()) PostData(6,fOutputCheckCentrality);
571 TClonesArray *arrayProng =0;
573 Int_t *pdgdaughters=0x0;
575 if(!aod && AODEvent() && IsStandardAOD()) {
576 // In case there is an AOD handler writing a standard AOD, use the AOD
577 // event in memory rather than the input (ESD) event.
578 aod = dynamic_cast<AliAODEvent*> (AODEvent());
579 // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
580 // have to taken from the AOD event hold by the AliAODExtension
581 AliAODHandler* aodHandler = (AliAODHandler*)
582 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
583 if(aodHandler->GetExtensions()) {
585 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
586 AliAODEvent *aodFromExt = ext->GetAOD();
590 switch(fDecayChannel){
592 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
595 pdgdaughters =new Int_t[3];
596 pdgdaughters[0]=211;//pi
597 pdgdaughters[1]=321;//K
598 pdgdaughters[2]=211;//pi
602 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("D0toKpi");
605 pdgdaughters =new Int_t[2];
606 pdgdaughters[0]=211;//pi
607 pdgdaughters[1]=321;//K
611 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar");
614 pdgdaughters =new Int_t[3];
615 pdgdaughters[1]=211;//pi
616 pdgdaughters[0]=321;//K
617 pdgdaughters[2]=211;//pi (soft?)
621 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
624 pdgdaughters =new Int_t[3];
625 pdgdaughters[0]=321;//K
626 pdgdaughters[1]=321;//K
627 pdgdaughters[2]=211;//pi
631 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm4Prong");
634 pdgdaughters =new Int_t[4];
642 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
645 pdgdaughters =new Int_t[3];
646 pdgdaughters[0]=2212;//p
647 pdgdaughters[1]=321;//K
648 pdgdaughters[2]=211;//pi
654 switch(fDecayChannel){
656 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
659 pdgdaughters =new Int_t[3];
660 pdgdaughters[0]=211;//pi
661 pdgdaughters[1]=321;//K
662 pdgdaughters[2]=211;//pi
666 arrayProng=(TClonesArray*)aod->GetList()->FindObject("D0toKpi");
669 pdgdaughters =new Int_t[2];
670 pdgdaughters[0]=211;//pi
671 pdgdaughters[1]=321;//K
675 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Dstar");
678 pdgdaughters =new Int_t[3];
679 pdgdaughters[1]=211;//pi
680 pdgdaughters[0]=321;//K
681 pdgdaughters[2]=211;//pi (soft?)
685 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
688 pdgdaughters =new Int_t[3];
689 pdgdaughters[0]=321;//K
690 pdgdaughters[1]=321;//K
691 pdgdaughters[2]=211;//pi
695 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm4Prong");
698 pdgdaughters =new Int_t[4];
706 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
709 pdgdaughters =new Int_t[3];
710 pdgdaughters[0]=2212;//p
711 pdgdaughters[1]=321;//K
712 pdgdaughters[2]=211;//pi
717 Bool_t isSimpleMode=fSimpleMode;
719 AliInfo("Branch not found! The output will contain only trak related histograms\n");
724 TClonesArray *mcArray = 0;
725 AliAODMCHeader *mcHeader = 0;
728 delete [] pdgdaughters;
735 mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
737 printf("AliAnalysisTaskSEHFQA::UserExec: MC particles branch not found!\n");
738 delete [] pdgdaughters;
743 mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
745 printf("AliAnalysisTaskSEHFQA::UserExec: MC header branch not found!\n");
746 delete [] pdgdaughters;
752 UInt_t evSelMask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
753 Double_t centrality=fCuts->GetCentrality(aod);
754 Double_t multiplicity=aod->GetHeader()->GetRefMultiplicity();
755 Int_t runNumber = aod->GetRunNumber();
757 TH2F* hTrigC=(TH2F*)fOutputEvSelection->FindObject("hTrigCent");
758 TH2F* hTrigM=(TH2F*)fOutputEvSelection->FindObject("hTrigMul");
759 AliCounterCollection* trigCount=(AliCounterCollection*)fOutputEvSelection->FindObject("trigCounter");
761 hTrigC->Fill(-1.,centrality);
762 hTrigM->Fill(-1.,multiplicity);
764 if(evSelMask & AliVEvent::kAny){
765 hTrigC->Fill(0.,centrality);
766 hTrigM->Fill(0.,multiplicity);
767 trigCount->Count(Form("triggerType:Any/Run:%d",runNumber));
769 if(evSelMask & AliVEvent::kMB){
770 hTrigC->Fill(1.,centrality);
771 hTrigM->Fill(1.,multiplicity);
772 trigCount->Count(Form("triggerType:MB/Run:%d",runNumber));
774 if(evSelMask & AliVEvent::kINT7){
775 hTrigC->Fill(2.,centrality);
776 hTrigM->Fill(2.,multiplicity);
778 if(evSelMask & AliVEvent::kCINT5){
779 hTrigC->Fill(3.,centrality);
780 hTrigM->Fill(3.,multiplicity);
782 if(evSelMask & AliVEvent::kCentral){
783 hTrigC->Fill(4.,centrality);
784 hTrigM->Fill(4.,multiplicity);
785 trigCount->Count(Form("triggerType:Cent/Run:%d",runNumber));
787 if(evSelMask & AliVEvent::kSemiCentral){
788 hTrigC->Fill(5.,centrality);
789 hTrigM->Fill(5.,multiplicity);
790 trigCount->Count(Form("triggerType:SemiCent/Run:%d",runNumber));
792 if(evSelMask & (AliVEvent::kEMC1 | AliVEvent::kEMC7)){
793 hTrigC->Fill(6.,centrality);
794 hTrigM->Fill(6.,multiplicity);
796 if(evSelMask & (AliVEvent::kEMCEJE | AliVEvent::kEMCEGA)){
797 hTrigC->Fill(7.,centrality);
798 hTrigM->Fill(7.,multiplicity);
799 trigCount->Count(Form("triggerType:EMCAL/Run:%d",runNumber));
801 if(evSelMask & (((AliVEvent::kCMUS5 | AliVEvent::kMUSH7) | (AliVEvent::kMUL7 | AliVEvent::kMUU7)) | (AliVEvent::kMUS7 | AliVEvent::kMUON))){
802 hTrigC->Fill(8.,centrality);
803 hTrigM->Fill(8.,multiplicity);
805 if(evSelMask & (AliVEvent::kPHI1 | AliVEvent::kPHI7)){
806 hTrigC->Fill(9.,centrality);
807 hTrigM->Fill(9.,multiplicity);
809 if(evSelMask & (AliVEvent::kDG5 | AliVEvent::kZED)){
810 hTrigC->Fill(10.,centrality);
811 hTrigM->Fill(10.,multiplicity);
816 // fix for temporary bug in ESDfilter
817 // the AODs with null vertex pointer didn't pass the PhysSel
818 if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) {
819 delete [] pdgdaughters;
826 //count events with good vertex
827 // AOD primary vertex
828 AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
829 TString primTitle = vtx1->GetTitle();
830 if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0) fNEntries->Fill(4);
832 // trigger class for PbPb C0SMH-B-NOPF-ALLNOTRD, C0SMH-B-NOPF-ALL
833 //TString trigclass=aod->GetFiredTriggerClasses();
834 //if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) fNEntries->Fill(5); //tmp
839 Bool_t evSelbyCentrality=kTRUE,evSelected=kTRUE,evSelByVertex=kTRUE,evselByPileup=kTRUE,evSelByPS=kTRUE;
841 if(!fCuts->IsEventSelected(aod)) {
843 if(fCuts->GetWhyRejection()==1) {fNEntries->Fill(1); evselByPileup=kFALSE;}// rejected for pileup
844 if(fCuts->GetWhyRejection()==2 || fCuts->GetWhyRejection()==3) evSelbyCentrality=kFALSE; //rejected by centrality
845 if(fCuts->GetWhyRejection()==4) evSelByVertex=kFALSE; //rejected by vertex
846 if(fCuts->GetWhyRejection()==5) fNEntries->Fill(5);//tmp
847 if(fCuts->GetWhyRejection()==6 && fOnOff[3]) ((AliCounterCollection*)fOutputEvSelection->FindObject("evselection"))->Count(Form("evnonsel:zvtx/Run:%d",runNumber));
848 if(fCuts->GetWhyRejection()==7) { evSelByPS=kFALSE; }
851 TH2F* hTrigS=(TH2F*)fOutputEvSelection->FindObject("hTrigCentSel");
852 hTrigS->Fill(-1.,centrality);
854 if(evSelMask & AliVEvent::kAny) hTrigS->Fill(0.,centrality);
855 if(evSelMask & AliVEvent::kMB) hTrigS->Fill(1.,centrality);
856 if(evSelMask & AliVEvent::kINT7) hTrigS->Fill(2.,centrality);
857 if(evSelMask & AliVEvent::kCINT5) hTrigS->Fill(3.,centrality);
858 if(evSelMask & AliVEvent::kCentral) hTrigS->Fill(4.,centrality);
859 if(evSelMask & AliVEvent::kSemiCentral) hTrigS->Fill(5.,centrality);
860 if(evSelMask & (AliVEvent::kEMC1 | AliVEvent::kEMC7)) hTrigS->Fill(6.,centrality);
861 if(evSelMask & (AliVEvent::kEMCEJE | AliVEvent::kEMCEGA)) hTrigS->Fill(7.,centrality);
862 if(evSelMask & (((AliVEvent::kCMUS5 | AliVEvent::kMUSH7) | (AliVEvent::kMUL7 | AliVEvent::kMUU7)) | (AliVEvent::kMUS7 | AliVEvent::kMUON))) hTrigS->Fill(8.,centrality);
863 if(evSelMask & (AliVEvent::kPHI1 | AliVEvent::kPHI7)) hTrigS->Fill(9.,centrality);
864 if(evSelMask & (AliVEvent::kDG5 | AliVEvent::kZED)) hTrigS->Fill(10.,centrality);
867 if(evSelected || (!evSelbyCentrality && evSelByVertex && evselByPileup && evSelByPS)){ //events selected or not selected because of centrality
868 if(fOnOff[2] && fCuts->GetUseCentrality()){
870 Float_t stdCentf=fCuts->GetCentrality(aod);
871 Int_t stdCent = (Int_t)(stdCentf+0.5);
872 Float_t secondCentf =fCuts->GetCentrality(aod,fEstimator);
873 Int_t secondCent = (Int_t)(secondCentf+0.5);
874 Int_t mincent=stdCent-stdCent%10;
879 if(mincent==100)mincent--;
880 ((AliCounterCollection*)fOutputCounters->FindObject("stdEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber));
882 mincent=secondCent-secondCent%10;
883 if(secondCentf==-1) {
887 if(mincent==100)mincent--;
888 ((AliCounterCollection*)fOutputCounters->FindObject("secondEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber));
890 if(stdCent<fCuts->GetMinCentrality() || stdCent>fCuts->GetMaxCentrality()){
891 ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsOut"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
892 ((TH1F*)fOutputCheckCentrality->FindObject("hMultOut"))->Fill(aod->GetHeader()->GetRefMultiplicity());
894 ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsIn"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
895 ((TH1F*)fOutputCheckCentrality->FindObject("hMultIn"))->Fill(aod->GetHeader()->GetRefMultiplicity());
897 ((TH2F*)fOutputCheckCentrality->FindObject("hMultvsPercentile"))->Fill(aod->GetHeader()->GetRefMultiplicity(),stdCentf);
899 PostData(6,fOutputCheckCentrality);
903 ((TH1F*)fOutputTrack->FindObject("hNtracklets"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
904 ((TH1F*)fOutputTrack->FindObject("hMult"))->Fill(aod->GetHeader()->GetRefMultiplicity());
910 const AliVVertex *vertex = aod->GetPrimaryVertex();
911 Double_t zvtx=vertex->GetZ();
912 if(evSelected || (!evSelected && TMath::Abs(zvtx) > 10.))
913 ((TH1F*)fOutputEvSelection->FindObject("hzvtx"))->Fill(zvtx);
917 delete [] pdgdaughters;
918 return; //discard all events not selected (vtx and/or centrality)
922 AliAODPidHF* pidHF=fCuts->GetPidHF();
924 delete [] pdgdaughters;
927 AliPIDResponse* respF=pidHF->GetPidResponse();
928 AliTPCPIDResponse* tpcres=new AliTPCPIDResponse();
929 if(pidHF->GetOldPid()) pidHF->SetBetheBloch(*tpcres);
930 Bool_t oldPID=pidHF->GetOldPid();
934 Int_t isGoodTrack=0, isFakeTrack=0;
936 if(aod) ntracks=aod->GetNTracks();
938 if(fOnOff[0] || fOnOff[1]){
939 //loop on tracks in the event
940 for (Int_t k=0;k<ntracks;k++){
941 AliAODTrack* track=aod->GetTrack(k);
942 AliAODPid *pid = track->GetDetPid();
946 if(!pid) {if (fDebug>1)cout<<"No AliAODPid found"<<endl; continue;}
947 Double_t times[AliPID::kSPECIES];
948 pid->GetIntegratedTimes(times);
950 Double_t tofRes[AliPID::kSPECIES];
951 pid->GetTOFpidResolution(tofRes);
954 TH1F* htmpfl=((TH1F*)fOutputPID->FindObject("hTOFflags"));
956 if (track->GetStatus()&AliESDtrack::kTPCout) htmpfl->Fill(1.);
957 if (track->GetStatus()&AliESDtrack::kTOFout) htmpfl->Fill(2.);
958 if (track->GetStatus()&AliESDtrack::kTIME) htmpfl->Fill(3.);
959 if (track->GetStatus()&AliESDtrack::kTOFpid) htmpfl->Fill(4.);
960 if (track->GetStatus()&AliESDtrack::kTOFmismatch) htmpfl->Fill(5.);
962 if(pidHF && pidHF->CheckStatus(track,"TOF")){
963 ((TH1F*)fOutputPID->FindObject("hTOFtime"))->Fill(times[AliPID::kProton]);
964 ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptime"))->Fill(track->P(),pid->GetTOFsignal()-times[3]); //3 is kaon
965 ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(pid->GetTOFsignal());
966 if (pid->GetTOFsignal()< 0) ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(-1);
969 // test TOF sigma PID
970 if (tofRes[2] != 0.) { // protection against 'old' AODs...
971 ((TH2F*)fOutputPID->FindObject("hTOFsigmaKSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kKaon])/tofRes[3]);
972 ((TH2F*)fOutputPID->FindObject("hTOFsigmaPionSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kPion])/tofRes[2]);
973 ((TH2F*)fOutputPID->FindObject("hTOFsigmaProtonSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kProton])/tofRes[4]);
974 for (Int_t iS=2; iS<5; iS++){ //we plot TOF Pid resolution for 3-sigma identified particles
975 if ( (TMath::Abs(times[iS]-pid->GetTOFsignal())/tofRes[iS])<3.){
978 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigPion"))->Fill(tofRes[iS]);
981 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigKaon"))->Fill(tofRes[iS]);
983 case AliPID::kProton:
984 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigProton"))->Fill(tofRes[iS]);
994 if(pidHF && pidHF->CheckStatus(track,"TPC")){
996 Double_t TPCp=pid->GetTPCmomentum();
997 Double_t TPCsignal=pid->GetTPCsignal();
998 ((TH1F*)fOutputPID->FindObject("hTPCsig"))->Fill(TPCsignal);
999 ((TH1F*)fOutputPID->FindObject("hTPCsigvsp"))->Fill(TPCp,TPCsignal);
1000 //if (pidHF->IsKaonRaw(track, "TOF"))
1001 if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaK"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kKaon));
1002 if (oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaK"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kKaon));
1003 //if (pidHF->IsPionRaw(track, "TOF"))
1004 if(oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaPion"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kPion));
1005 if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaPion"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kPion));
1006 //if (pidHF->IsProtonRaw(track,"TOF"))
1007 if(oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaProton"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kProton));
1008 if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaProton"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kProton));
1010 } //end PID histograms
1012 Int_t nclsTot=0,nclsSPD=0;
1014 //check clusters of the tracks
1017 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1);
1018 for(Int_t l=0;l<6;l++) {
1019 if(TESTBIT(track->GetITSClusterMap(),l)) {
1020 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(l);
1021 nclsTot++; if(l<2) nclsSPD++;
1024 ((TH1F*)fOutputTrack->FindObject("hnClsITS"))->Fill(nclsTot);
1025 ((TH1F*)fOutputTrack->FindObject("hnClsSPD"))->Fill(nclsSPD);
1026 if(track->Pt()>0.3 &&
1027 TMath::Abs(track->Eta())<0.8 &&
1028 track->GetStatus()&AliESDtrack::kITSrefit &&
1029 track->GetStatus()&AliESDtrack::kTPCrefit &&
1031 ((TH1F*)fOutputTrack->FindObject("hnClsITSselTr"))->Fill(nclsTot);
1033 if(!(track->GetStatus()&AliESDtrack::kTPCin) && track->GetStatus()&AliESDtrack::kITSrefit && !(track->GetStatus()&AliESDtrack::kITSpureSA)){//tracks retrieved in the ITS and not reconstructed in the TPC
1034 ((TH1F*)fOutputTrack->FindObject("hnClsITS-SA"))->Fill(nclsTot);
1035 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1);
1036 for(Int_t l=0;l<6;l++) {
1037 if(TESTBIT(track->GetITSClusterMap(),l)) {
1038 ((TH1F*)fOutputTrack->FindObject("hnLayerITSsa"))->Fill(l);
1044 label=track->GetLabel();
1045 if (label<0)fNEntries->Fill(8);
1046 else fNEntries->Fill(9);
1051 if (track->Pt()>0.3 &&
1052 track->GetStatus()&AliESDtrack::kTPCrefit &&
1053 track->GetStatus()&AliESDtrack::kITSrefit &&
1055 nclsSPD>0) {//count good tracks
1058 if(fReadMC && label<0) {
1059 ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt());
1062 ((TH1F*)fOutputTrack->FindObject("hptGoodTr"))->Fill(track->Pt());
1066 } //simple mode: no IsSelected on tracks: use "manual" cuts
1067 } //fill track histos
1068 } //end loop on tracks
1070 //fill once per event
1072 if (fReadMC) ((TH1F*)fOutputTrack->FindObject("hdistrFakeTr"))->Fill(isFakeTrack);
1073 ((TH1F*)fOutputTrack->FindObject("hdistrGoodTr"))->Fill(isGoodTrack);
1077 // loop over candidates
1078 Int_t nCand = arrayProng->GetEntriesFast();
1080 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi) ndaugh=2;
1081 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpipipi) ndaugh=4;
1083 for (Int_t iCand = 0; iCand < nCand; iCand++) {
1084 AliAODRecoDecayHF *d = (AliAODRecoDecayHF*)arrayProng->UncheckedAt(iCand);
1085 if(d->GetSelectionMap()) {
1086 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi && !d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)) continue; //skip the D0 from Dstar
1087 if(fDecayChannel==AliAnalysisTaskSEHFQA::kDplustoKpipi && !d->HasSelectionBit(AliRDHFCuts::kDplusCuts)) continue; //skip the 3 prong !D+
1091 Int_t labD = d->MatchToMC(pdg,mcArray,ndaugh,pdgdaughters);
1093 AliAODMCParticle *partD = (AliAODMCParticle*)mcArray->At(labD);
1094 Int_t label=partD->GetMother();
1095 AliAODMCParticle *mot = (AliAODMCParticle*)mcArray->At(label);
1096 while(label>=0){//get first mother
1097 mot = (AliAODMCParticle*)mcArray->At(label);
1098 label=mot->GetMother();
1100 Int_t pdgMotCode = mot->GetPdgCode();
1102 if(TMath::Abs(pdgMotCode)==4) fNEntries->Fill(6); //from primary charm
1103 if(TMath::Abs(pdgMotCode)==5) fNEntries->Fill(7); //from beauty
1107 else fNEntries->Fill(6); //count the candidates (data)
1109 for(Int_t id=0;id<ndaugh;id++){
1111 //other histograms to be filled when the cut object is given
1112 AliAODTrack* track=(AliAODTrack*)d->GetDaughter(id);
1116 if (fCuts->IsInFiducialAcceptance(d->Pt(),d->Y(pdg)) && fCuts->IsSelected(d,AliRDHFCuts::kTracks,aod)) {
1119 if(fReadMC)label=track->GetLabel();
1122 if(fReadMC && label<0) {
1124 ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt());
1126 ((TH1F*)fOutputTrack->FindObject("hd0f"))->Fill(d->Getd0Prong(id));
1129 ((TH1F*)fOutputTrack->FindObject("hptGoodTr"))->Fill(track->Pt());
1130 ((TH1F*)fOutputTrack->FindObject("hd0"))->Fill(d->Getd0Prong(id));
1131 Double_t d0rphiz[2],covd0[3];
1132 Bool_t isDCA=track->PropagateToDCA(aod->GetPrimaryVertex(),aod->GetMagneticField(),9999.,d0rphiz,covd0);
1133 if(isDCA) ((TH1F*)fOutputTrack->FindObject("hd0z"))->Fill(d0rphiz[1]);
1136 if (fCuts->IsSelected(d,AliRDHFCuts::kAll,aod) && fOnOff[1]){
1138 AliAODPid *pid = track->GetDetPid();
1140 pid->GetIntegratedTimes(times);
1141 if(pidHF && pidHF->CheckStatus(track,"TOF")) ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptimeAC"))->Fill(track->P(),pid->GetTOFsignal()-times[AliPID::kKaon]);
1142 if(pidHF && pidHF->CheckStatus(track,"TPC")) ((TH2F*)fOutputPID->FindObject("hTPCsigvspAC"))->Fill(pid->GetTPCmomentum(),pid->GetTPCsignal());
1145 } //end analysis cuts
1146 } //end acceptance and track cuts
1147 } //end loop on tracks in the candidate
1148 } //end loop on candidates
1150 if(fReadMC) ((TH1F*)fOutputTrack->FindObject("hdistrFakeTr"))->Fill(isFakeTrack);
1151 ((TH1F*)fOutputTrack->FindObject("hdistrGoodTr"))->Fill(isGoodTrack);
1154 } //end if on pid or track histograms
1157 delete [] pdgdaughters;
1158 PostData(1,fNEntries);
1159 if(fOnOff[1]) PostData(2,fOutputPID);
1160 if(fOnOff[0]) PostData(3,fOutputTrack);
1162 if(fOnOff[2]) PostData(5,fOutputCounters);
1163 //Post data 6 done in case of centrality on
1167 //____________________________________________________________________________
1168 void AliAnalysisTaskSEHFQA::Terminate(Option_t */*option*/){
1169 //terminate analysis
1171 fNEntries = dynamic_cast<TH1F*>(GetOutputData(1));
1173 printf("ERROR: %s not available\n",GetOutputSlot(1)->GetContainer()->GetName());
1177 fOutputPID = dynamic_cast<TList*> (GetOutputData(2));
1178 if (!fOutputPID && fOnOff[1]) {
1179 printf("ERROR: %s not available\n",GetOutputSlot(2)->GetContainer()->GetName());
1183 fOutputTrack = dynamic_cast<TList*> (GetOutputData(3));
1184 if (!fOutputTrack && fOnOff[0]) {
1185 printf("ERROR: %s not available\n",GetOutputSlot(3)->GetContainer()->GetName());