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>
32 #include <TProfile2D.h>
33 #include <TDatabasePDG.h>
35 #include <AliAnalysisDataSlot.h>
36 #include <AliAnalysisDataContainer.h>
37 #include "AliAnalysisManager.h"
38 #include "AliESDtrack.h"
39 #include "AliVertexerTracks.h"
41 #include "AliTPCPIDResponse.h"
42 #include "AliAODHandler.h"
43 #include "AliAODEvent.h"
44 #include "AliAODVertex.h"
45 #include "AliAODTrack.h"
46 #include "AliAODMCParticle.h"
47 #include "AliAODMCHeader.h"
48 #include "AliAODRecoDecayHF2Prong.h"
49 #include "AliAODRecoCascadeHF.h"
50 #include "AliAnalysisVertexingHF.h"
51 #include "AliAnalysisTaskSE.h"
52 #include "AliCounterCollection.h"
53 #include "AliRDHFCuts.h"
54 #include "AliRDHFCutsDplustoKpipi.h"
55 #include "AliRDHFCutsD0toKpipipi.h"
56 #include "AliRDHFCutsDstoKKpi.h"
57 #include "AliRDHFCutsDStartoKpipi.h"
58 #include "AliRDHFCutsD0toKpi.h"
59 #include "AliRDHFCutsLctopKpi.h"
60 #include "AliInputEventHandler.h"
62 #include "AliFlowEvent.h"
63 #include "AliFlowTrackCuts.h"
64 #include "AliFlowTrackSimple.h"
65 #include "AliFlowVector.h"
67 #include "AliAnalysisTaskSEHFQA.h"
69 ClassImp(AliAnalysisTaskSEHFQA)
71 //____________________________________________________________________________
73 AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA():AliAnalysisTaskSE(),
78 fOutputCheckCentrality(0x0),
79 fOutputEvSelection(0x0),
81 fDecayChannel(AliAnalysisTaskSEHFQA::kD0toKpi),
85 fEstimator(AliRDHFCuts::kCentTRK),
98 //____________________________________________________________________________
99 AliAnalysisTaskSEHFQA::AliAnalysisTaskSEHFQA(const char *name, AliAnalysisTaskSEHFQA::DecChannel ch,AliRDHFCuts* cuts):
100 AliAnalysisTaskSE(name),
104 fOutputCounters(0x0),
105 fOutputCheckCentrality(0x0),
106 fOutputEvSelection(0x0),
112 fEstimator(AliRDHFCuts::kCentTRK),
119 //SetCutObject(cuts);
128 // Output slot #1 writes into a TH1F container (number of events)
129 DefineOutput(1,TH1F::Class()); //My private output
130 // Output slot #2 writes into a TList container (PID)
131 if (fOnOff[1]) DefineOutput(2,TList::Class()); //My private output
132 // Output slot #3 writes into a TList container (Tracks)
133 if (fOnOff[0]) DefineOutput(3,TList::Class()); //My private output
134 // Output slot #4 writes into a AliRDHFCuts container (cuts)
135 switch(fDecayChannel){
137 DefineOutput(4,AliRDHFCutsDplustoKpipi::Class()); //My private output
140 DefineOutput(4,AliRDHFCutsD0toKpi::Class()); //My private output
143 DefineOutput(4,AliRDHFCutsDStartoKpipi::Class()); //My private output
146 DefineOutput(4,AliRDHFCutsDstoKKpi::Class()); //My private output
149 DefineOutput(4,AliRDHFCutsD0toKpipipi::Class()); //My private output
152 DefineOutput(4,AliRDHFCutsLctopKpi::Class()); //My private output
156 // Output slot #5 writes into a TList container (AliCounterCollection)
157 DefineOutput(5,TList::Class()); //My private output
158 // Output slot #6 writes into a TList container (TH1F)
159 DefineOutput(6,TList::Class()); //My private output
162 if(fOnOff[3]) DefineOutput(7,TList::Class()); //My private output
163 if(fOnOff[4]) DefineOutput(8,TList::Class()); //My private output
167 //___________________________________________________________________________
168 AliAnalysisTaskSEHFQA::~AliAnalysisTaskSEHFQA()
177 delete fOutputCounters;
179 delete fOutputCheckCentrality;
181 delete fOutputEvSelection;
184 delete fOutputFlowObs;
189 //___________________________________________________________________________
190 void AliAnalysisTaskSEHFQA::Init(){
193 if(fDebug > 1) printf("AnalysisTaskSEHFQA::Init() \n");
195 switch(fDecayChannel){
198 AliRDHFCutsDplustoKpipi* copycut=new AliRDHFCutsDplustoKpipi(*(static_cast<AliRDHFCutsDplustoKpipi*>(fCuts)));
205 AliRDHFCutsD0toKpi* copycut=new AliRDHFCutsD0toKpi(*(static_cast<AliRDHFCutsD0toKpi*>(fCuts)));
212 AliRDHFCutsDStartoKpipi* copycut=new AliRDHFCutsDStartoKpipi(*(static_cast<AliRDHFCutsDStartoKpipi*>(fCuts)));
219 AliRDHFCutsDstoKKpi* copycut=new AliRDHFCutsDstoKKpi(*(static_cast<AliRDHFCutsDstoKKpi*>(fCuts)));
226 AliRDHFCutsD0toKpipipi* copycut=new AliRDHFCutsD0toKpipipi(*(static_cast<AliRDHFCutsD0toKpipipi*>(fCuts)));
233 AliRDHFCutsLctopKpi* copycut=new AliRDHFCutsLctopKpi(*(static_cast<AliRDHFCutsLctopKpi*>(fCuts)));
247 //___________________________________________________________________________
248 void AliAnalysisTaskSEHFQA::UserCreateOutputObjects()
251 //create the output container
252 if(fDebug > 1) printf("AnalysisTaskSEHFQA::UserCreateOutputObjects() \n");
256 fNEntries=new TH1F(GetOutputSlot(1)->GetContainer()->GetName(), "Counts the number of events", 10,-0.5,9.5);
257 fNEntries->GetXaxis()->SetBinLabel(1,"nEventsAnal");
258 fNEntries->GetXaxis()->SetBinLabel(2,"Pile-up Rej");
259 fNEntries->GetXaxis()->SetBinLabel(3,"No VertexingHF");
260 fNEntries->GetXaxis()->SetBinLabel(4,"nCandidates(AnCuts)");
261 fNEntries->GetXaxis()->SetBinLabel(5,"EventsWithGoodVtx");
262 //fNEntries->GetXaxis()->SetBinLabel(6,"N. of 0SMH");
263 fNEntries->GetXaxis()->SetBinLabel(6,"N. of CSH1");
265 fNEntries->GetXaxis()->SetBinLabel(7,"MC Cand from c");
266 fNEntries->GetXaxis()->SetBinLabel(8,"MC Cand from b");
267 fNEntries->GetXaxis()->SetBinLabel(9,"N fake Trks");
268 fNEntries->GetXaxis()->SetBinLabel(10,"N true Trks");
270 fNEntries->GetXaxis()->SetBinLabel(7,"N candidates");
273 fNEntries->GetXaxis()->SetNdivisions(1,kFALSE);
277 fOutputPID=new TList();
278 fOutputPID->SetOwner();
279 fOutputPID->SetName(GetOutputSlot(2)->GetContainer()->GetName());
282 TH1F* hTOFflags=new TH1F("hTOFflags","TOF flags",6,-0.5,5.5);
283 hTOFflags->SetMinimum(0.);
284 hTOFflags->GetXaxis()->SetBinLabel(1,"All Tracks");
285 hTOFflags->GetXaxis()->SetBinLabel(2,"kTPCout");
286 hTOFflags->GetXaxis()->SetBinLabel(3,"kTOFout");
287 hTOFflags->GetXaxis()->SetBinLabel(4,"kTIME");
288 hTOFflags->GetXaxis()->SetBinLabel(5,"kTOFpid");
289 hTOFflags->GetXaxis()->SetBinLabel(6,"kTOFmismatch");
291 TString hname="hTOFsig";
292 TH1F* hTOFsig=new TH1F(hname.Data(),"Distribution of TOF signal;TOF time [ps];Entries", 100, -2.e3,40.e3);
295 TH1F* hTOFtime=new TH1F(hname.Data(),"Distribution of TOF time Kaon;TOF time(Kaon) [ps];Entries", 1000, 0.,50000.);
297 hname="hTOFtimeKaonHyptime";
298 TH2F* hTOFtimeKaonHyptime=new TH2F(hname.Data(),"TOFtime - timeHypothesisForKaon;p[GeV/c];TOFtime - timeHypothesisForKaon [ps]",500,0.,10.,1000,-20000.,20000.);
300 hname="hTOFtimeKaonHyptimeAC";
301 TH2F* hTOFtimeKaonHyptimeAC=new TH2F(hname.Data(),"TOFtime - timeHypothesisForKaon;p[GeV/c];TOFtime - timeHypothesisForKaon [ps]",500,0.,10.,1000,-20000.,20000.);
303 hname="hTOFsigmaKSigPid";
304 TH2F* hTOFsigmaKSigPid=new TH2F(hname.Data(),"(TOFsignal-timeK)/tofSigPid;p[GeV/c];(TOFsignal-timeK)/tofSigPid",500,0.,10.,400,-20,20);
306 hname="hTOFsigmaPionSigPid";
307 TH2F* hTOFsigmaPionSigPid=new TH2F(hname.Data(),"(TOFsignal-time#pi)/tofSigPid;p[GeV/c];(TOFsignal-time#pi)/tofSigPid",500,0.,10.,400,-20,20);
309 hname="hTOFsigmaProtonSigPid";
310 TH2F* hTOFsigmaProtonSigPid=new TH2F(hname.Data(),"(TOFsignal-timep)/tofSigPid;p[GeV/c];(TOFsignal-time p)/tofSigPid",500,0.,10.,400,-20,20);
312 hname="hTOFsigPid3sigPion";
313 TH1F* hTOFsigPid3sigPion=new TH1F(hname.Data(),"TOF PID resolution (#pi) [ps]",500,0.,1000.);
315 hname="hTOFsigPid3sigKaon";
316 TH1F* hTOFsigPid3sigKaon=new TH1F(hname.Data(),"TOF PID resolution (K) [ps]",500,0.,1000.);
318 hname="hTOFsigPid3sigProton";
319 TH1F* hTOFsigPid3sigProton=new TH1F(hname.Data(),"TOF PID resolution (p) [ps]",500,0.,1000.);
324 TH1F* hTPCsig=new TH1F(hname.Data(),"Distribution of TPC signal;TPC sig;Entries", 100, 35.,100.);
327 TH2F* hTPCsigvsp=new TH2F(hname.Data(),"TPCsig vs p;TPC p[GeV/c];TPCsig",500,0.,10.,1000,35.,100.);
329 hname="hTPCsigvspAC";
330 TH2F* hTPCsigvspAC=new TH2F(hname.Data(),"TPCsig vs p;TPCp[GeV/c];TPCsig",500,0.,10.,1000,35.,100.);
333 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);
335 hname="hTPCsigmaPion";
336 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);
338 hname="hTPCsigmaProton";
339 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);
341 fOutputPID->Add(hTOFflags);
342 fOutputPID->Add(hTOFsig);
343 fOutputPID->Add(hTPCsig);
344 fOutputPID->Add(hTOFtime);
345 fOutputPID->Add(hTOFtimeKaonHyptime);
346 fOutputPID->Add(hTOFtimeKaonHyptimeAC);
347 fOutputPID->Add(hTOFsigmaKSigPid);
348 fOutputPID->Add(hTOFsigmaPionSigPid);
349 fOutputPID->Add(hTOFsigmaProtonSigPid);
350 fOutputPID->Add(hTOFsigPid3sigPion);
351 fOutputPID->Add(hTOFsigPid3sigKaon);
352 fOutputPID->Add(hTOFsigPid3sigProton);
353 fOutputPID->Add(hTPCsigvsp);
354 fOutputPID->Add(hTPCsigvspAC);
355 fOutputPID->Add(hTPCsigmaK);
356 fOutputPID->Add(hTPCsigmaPion);
357 fOutputPID->Add(hTPCsigmaProton);
360 //quality of the tracks
362 fOutputTrack=new TList();
363 fOutputTrack->SetOwner();
364 fOutputTrack->SetName(GetOutputSlot(3)->GetContainer()->GetName());
366 TString hname="hnClsITS";
367 TH1F* hnClsITS=new TH1F(hname.Data(),"Distribution of number of ITS clusters;nITScls;Entries",7,-0.5,6.5);
369 hname="hnClsITSselTr";
370 TH1F* hnClsITSselTr=new TH1F(hname.Data(),"Distribution of number of ITS clusters selected tracks;nITScls;Entries",7,-0.5,6.5);
373 TH1F* hnClsITSSA=new TH1F(hname.Data(),"Distribution of number of ITS clusters(ITS-SA);nITScls;Entries",7,-0.5,6.5);
377 TH1F* hnLayerITS=new TH1F(hname.Data(),"Number of tracks with point in layer;ITS layer;",7,-1.5,5.5);
378 hnLayerITS->GetXaxis()->SetBinLabel(1,"n tracks");
380 hname="hnLayerITSsa";
381 TH1F* hnLayerITSsa=new TH1F(hname.Data(),"Number of tracks with point in layer;ITS layer;",7,-1.5,5.5);
382 hnLayerITSsa->GetXaxis()->SetBinLabel(1,"n tracks");
385 TH1F* hnClsSPD=new TH1F(hname.Data(),"Distribution of number of SPD clusters;nSPDcls;Entries",3,-0.5,2.5);
388 TH1F* hptGoodTr=new TH1F(hname.Data(),"Pt distribution of 'good' tracks;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
389 hptGoodTr->SetTitleOffset(1.3,"Y");
391 hname="hdistrGoodTr";
392 TH1F* hdistrGoodTr=new TH1F(hname.Data(),"Distribution of number of 'good' tracks per event;no.good-tracks/ev;Entries",4000,-0.5,3999.5);
393 hdistrGoodTr->SetTitleOffset(1.3,"Y");
396 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);
399 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);
401 fOutputTrack->Add(hnClsITS);
402 fOutputTrack->Add(hnClsITSselTr);
403 fOutputTrack->Add(hnClsITSSA);
404 fOutputTrack->Add(hnLayerITS);
405 fOutputTrack->Add(hnLayerITSsa);
406 fOutputTrack->Add(hnClsSPD);
407 fOutputTrack->Add(hptGoodTr);
408 fOutputTrack->Add(hdistrGoodTr);
409 fOutputTrack->Add(hd0);
410 fOutputTrack->Add(hd0z);
413 hname="hdistrFakeTr";
414 TH1F* hdistrFakeTr=new TH1F(hname.Data(),"Distribution of number of fake tracks per event;no.fake-tracks/ev;Entries",4000,-0.5,3999.5);
415 hdistrGoodTr->SetTitleOffset(1.3,"Y");
418 TH1F* hd0f=new TH1F(hname.Data(),"Impact parameter distribution of fake tracks;d_{0}[cm];Entries/10^{3} cm",200,-0.1,0.1);
421 TH1F* hptFakeTr=new TH1F(hname.Data(),"Pt distribution of fake tracks;p_{t}[GeV];Entries/0.05 GeV/c",400,0.,20.);
422 hptFakeTr->SetTitleOffset(1.3,"Y");
424 fOutputTrack->Add(hptFakeTr);
425 fOutputTrack->Add(hdistrFakeTr);
426 fOutputTrack->Add(hd0f);
432 if(fOnOff[2] && fCuts->GetUseCentrality()){
434 //Centrality (Counters)
435 fOutputCounters=new TList();
436 fOutputCounters->SetOwner();
437 fOutputCounters->SetName(GetOutputSlot(5)->GetContainer()->GetName());
439 AliCounterCollection *stdEstimator=new AliCounterCollection("stdEstimator");
440 stdEstimator->AddRubric("run",500000);
441 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");
442 stdEstimator->Init();
443 AliCounterCollection *secondEstimator=new AliCounterCollection("secondEstimator");
444 secondEstimator->AddRubric("run",500000);
445 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");
446 secondEstimator->Init();
448 fOutputCounters->Add(stdEstimator);
449 fOutputCounters->Add(secondEstimator);
451 //Centrality (Checks)
452 fOutputCheckCentrality=new TList();
453 fOutputCheckCentrality->SetOwner();
454 fOutputCheckCentrality->SetName(GetOutputSlot(6)->GetContainer()->GetName());
456 TString hname="hNtrackletsIn";
457 TH1F* hNtrackletsIn=new TH1F(hname.Data(),"Number of tracklets in Centrality range;ntracklets;Entries",5000,-0.5,4999.5);
460 TH1F* hMultIn=new TH1F(hname.Data(),"Multiplicity;multiplicity in Centrality range;Entries",10000,-0.5,9999.5);
462 hname="hNtrackletsOut";
463 TH1F* hNtrackletsOut=new TH1F(hname.Data(),"Number of tracklets out of Centrality range;ntracklets;Entries",5000,-0.5,4999.5);
466 TH1F* hMultOut=new TH1F(hname.Data(),"Multiplicity out of Centrality range;multiplicity;Entries",10000,-0.5,9999.5);
468 hname="hMultvsPercentile";
469 TH2F* hMultvsPercentile=new TH2F(hname.Data(),"Multiplicity vs Percentile;multiplicity;percentile",10000,-0.5,9999.5,12,-10.,110);
472 fOutputCheckCentrality->Add(hNtrackletsIn);
473 fOutputCheckCentrality->Add(hNtrackletsOut);
474 fOutputCheckCentrality->Add(hMultIn);
475 fOutputCheckCentrality->Add(hMultOut);
476 fOutputCheckCentrality->Add(hMultvsPercentile);
478 PostData(6,fOutputCheckCentrality);
482 TString hname="hNtracklets";
483 TH1F* hNtracklets=new TH1F(hname.Data(),"Number of tracklets;ntracklets;Entries",5000,-0.5,4999.5);
486 TH1F* hMult=new TH1F(hname.Data(),"Multiplicity;multiplicity;Entries",10000,-0.5,9999.5);
487 fOutputTrack->Add(hNtracklets);
488 fOutputTrack->Add(hMult);
492 //event selection (z vertex for the moment)
494 fOutputEvSelection=new TList();
495 fOutputEvSelection->SetOwner();
496 fOutputEvSelection->SetName(GetOutputSlot(7)->GetContainer()->GetName());
497 AliCounterCollection *evselection=new AliCounterCollection("evselection");
498 evselection->AddRubric("run",500000);
499 evselection->AddRubric("evnonsel","zvtx");
502 TH1F* hzvtx=new TH1F("hzvtx", "Distribution of z_{VTX};z_{VTX} [cm];Entries",100,-20,20);
505 TH2F* hTrigCent=new TH2F("hTrigCent","Centrality vs. Trigger types",12,-1.5,10.5,12,-10,110);
506 hTrigCent->GetXaxis()->SetBinLabel(1,"All");
507 hTrigCent->GetXaxis()->SetBinLabel(2,"kAny");
508 hTrigCent->GetXaxis()->SetBinLabel(3,"kMB");
509 hTrigCent->GetXaxis()->SetBinLabel(4,"kINT7");
510 hTrigCent->GetXaxis()->SetBinLabel(5,"kCINT5");
511 hTrigCent->GetXaxis()->SetBinLabel(6,"kCent");
512 hTrigCent->GetXaxis()->SetBinLabel(7,"kSemiCent");
513 hTrigCent->GetXaxis()->SetBinLabel(8,"kEMC1+7");
514 hTrigCent->GetXaxis()->SetBinLabel(9,"kEMCJET+GAMMA");
515 hTrigCent->GetXaxis()->SetBinLabel(10,"Muons");
516 hTrigCent->GetXaxis()->SetBinLabel(11,"PHOS");
517 hTrigCent->GetXaxis()->SetBinLabel(12,"Others");
519 TH2F* hTrigMul=new TH2F("hTrigMul","Multiplicity vs. Trigger types",12,-1.5,10.5,100,0.,10000.);
520 hTrigMul->GetXaxis()->SetBinLabel(1,"All");
521 hTrigMul->GetXaxis()->SetBinLabel(2,"kAny");
522 hTrigMul->GetXaxis()->SetBinLabel(3,"kMB");
523 hTrigMul->GetXaxis()->SetBinLabel(4,"kINT7");
524 hTrigMul->GetXaxis()->SetBinLabel(5,"kCINT5");
525 hTrigMul->GetXaxis()->SetBinLabel(6,"kCent");
526 hTrigMul->GetXaxis()->SetBinLabel(7,"kSemiCent");
527 hTrigMul->GetXaxis()->SetBinLabel(8,"kEMC1+7");
528 hTrigMul->GetXaxis()->SetBinLabel(9,"kEMCJET+GAMMA");
529 hTrigMul->GetXaxis()->SetBinLabel(10,"Muons");
530 hTrigMul->GetXaxis()->SetBinLabel(11,"PHOS");
531 hTrigMul->GetXaxis()->SetBinLabel(12,"Others");
533 TH2F* hTrigCentSel=new TH2F("hTrigCentSel","Trigger types",12,-1.5,10.5,12,-10,110);
534 hTrigCentSel->GetXaxis()->SetBinLabel(1,"All");
535 hTrigCentSel->GetXaxis()->SetBinLabel(2,"kAny");
536 hTrigCentSel->GetXaxis()->SetBinLabel(3,"kMB");
537 hTrigCentSel->GetXaxis()->SetBinLabel(4,"kINT7");
538 hTrigCentSel->GetXaxis()->SetBinLabel(5,"kCINT5");
539 hTrigCentSel->GetXaxis()->SetBinLabel(6,"kCent");
540 hTrigCentSel->GetXaxis()->SetBinLabel(7,"kSemiCent");
541 hTrigCentSel->GetXaxis()->SetBinLabel(8,"kEMC1+7");
542 hTrigCentSel->GetXaxis()->SetBinLabel(9,"kEMCJET+GAMMA");
543 hTrigCentSel->GetXaxis()->SetBinLabel(10,"Muons");
544 hTrigCentSel->GetXaxis()->SetBinLabel(11,"PHOS");
545 hTrigCentSel->GetXaxis()->SetBinLabel(12,"Others");
547 AliCounterCollection *trigCounter=new AliCounterCollection("trigCounter");
548 trigCounter->AddRubric("run",500000);
549 trigCounter->AddRubric("triggerType","Any/MB/Cent/SemiCent/EMCAL");
552 fOutputEvSelection->Add(evselection);
553 fOutputEvSelection->Add(hzvtx);
554 fOutputEvSelection->Add(hTrigCent);
555 fOutputEvSelection->Add(hTrigMul);
556 fOutputEvSelection->Add(hTrigCentSel);
557 fOutputEvSelection->Add(trigCounter);
559 if(fOnOff[4]){ // FLOW OBSERVABLES
560 fOutputFlowObs=new TList();
561 fOutputFlowObs->SetOwner();
562 fOutputFlowObs->SetName(GetOutputSlot(8)->GetContainer()->GetName());
564 fFlowEvent = new AliFlowEvent(3000);
565 fRFPcuts = new AliFlowTrackCuts("rfpCuts");
567 TH1F *hFEvents = new TH1F("hFlowEvents","FlowEvent Selection",4,0,4);
568 hFEvents->GetXaxis()->SetBinLabel(1,"REACHED");
569 hFEvents->GetXaxis()->SetBinLabel(2,"TRIGGERED");
570 hFEvents->GetXaxis()->SetBinLabel(3,"-7<Zvtx<7 + CC(0-60)");
571 hFEvents->GetXaxis()->SetBinLabel(4,"UnexpectedBehaviour");
572 fOutputFlowObs->Add(hFEvents);
577 TString ref[3] = {"FB1","FB128","VZE"};
578 Int_t etabin[3] = {40,40,20};
579 Int_t etamax[3] = { 1, 1, 5};
580 for(Int_t i=0; i<3; ++i) {
581 hQ[i]= new TProfile2D( Form("h%s_Q",ref[i].Data()),
582 Form("Q_{2} components for %s",ref[i].Data()),
584 hQ[i]->GetXaxis()->SetBinLabel(1,"Qx^{-}");
585 hQ[i]->GetXaxis()->SetBinLabel(2,"Qy^{-}");
586 hQ[i]->GetXaxis()->SetBinLabel(3,"Qx^{+}");
587 hQ[i]->GetXaxis()->SetBinLabel(4,"Qy^{+}");
588 hQ[i]->GetYaxis()->SetTitle("Centrality");
589 fOutputFlowObs->Add(hQ[i]);
591 hAngleQ[i] = new TH2F( Form("h%s_AngleQ",ref[i].Data()),
592 Form("#Psi_{2} for %s",ref[i].Data()),
593 72,0,TMath::Pi(),12,0,60);
594 hAngleQ[i]->GetXaxis()->SetTitle( Form("#Psi_{2}^{%s}",ref[i].Data()) );
595 hAngleQ[i]->GetYaxis()->SetTitle("Centrality");
596 fOutputFlowObs->Add(hAngleQ[i]);
598 hPhiEta[i] = new TH3F( Form("h%s_PhiEta",ref[i].Data()),
599 Form("Eta vs Phi for %s",ref[i].Data()),
600 72,0,TMath::Pi(),etabin[i],-1.0*etamax[i],+1.0*etamax[i],12,0,60);
601 hPhiEta[i]->GetXaxis()->SetTitle("Phi");
602 hPhiEta[i]->GetYaxis()->SetTitle("Eta");
603 hPhiEta[i]->GetZaxis()->SetTitle("Centrality");
604 fOutputFlowObs->Add(hPhiEta[i]);
607 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);
608 hTPCVZE_AngleQ->GetXaxis()->SetTitle("#Psi_{2}^{TPC}");
609 hTPCVZE_AngleQ->GetYaxis()->SetTitle("#Psi_{2}^{VZE}");
610 hTPCVZE_AngleQ->GetZaxis()->SetTitle("Centrality");
611 fOutputFlowObs->Add(hTPCVZE_AngleQ);
613 // AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
614 // AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
615 // AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
616 // fCuts->GetPidHF()->SetPidResponse(pidResp);
618 PostData(1,fNEntries);
620 if(fOnOff[1]) PostData(2,fOutputPID);
621 if(fOnOff[0]) PostData(3,fOutputTrack);
623 if(fOnOff[2]) PostData(5,fOutputCounters);
624 if(fOnOff[3]) PostData(7,fOutputEvSelection);
625 if(fOnOff[4]) PostData(8,fOutputFlowObs);
627 if(!fOnOff[0] && !fOnOff[1] && !fOnOff[2]) AliError("Nothing will be filled!");
630 //___________________________________________________________________________
631 void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
633 // Execute analysis for current event
635 AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
636 if(fDebug>2) printf("Analysing decay %d\n",fDecayChannel);
637 // Post the data already here
638 PostData(1,fNEntries);
639 if(fOnOff[1]) PostData(2,fOutputPID);
640 if(fOnOff[0]) PostData(3,fOutputTrack);
643 PostData(5,fOutputCounters);
644 if(fCuts->GetUseCentrality()) PostData(6,fOutputCheckCentrality);
647 TClonesArray *arrayProng =0;
649 Int_t *pdgdaughters=0x0;
651 if(!aod && AODEvent() && IsStandardAOD()) {
652 // In case there is an AOD handler writing a standard AOD, use the AOD
653 // event in memory rather than the input (ESD) event.
654 aod = dynamic_cast<AliAODEvent*> (AODEvent());
655 // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
656 // have to taken from the AOD event hold by the AliAODExtension
657 AliAODHandler* aodHandler = (AliAODHandler*)
658 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
659 if(aodHandler->GetExtensions()) {
661 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
662 AliAODEvent *aodFromExt = ext->GetAOD();
666 switch(fDecayChannel){
668 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
671 pdgdaughters =new Int_t[3];
672 pdgdaughters[0]=211;//pi
673 pdgdaughters[1]=321;//K
674 pdgdaughters[2]=211;//pi
678 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("D0toKpi");
681 pdgdaughters =new Int_t[2];
682 pdgdaughters[0]=211;//pi
683 pdgdaughters[1]=321;//K
687 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar");
690 pdgdaughters =new Int_t[3];
691 pdgdaughters[1]=211;//pi
692 pdgdaughters[0]=321;//K
693 pdgdaughters[2]=211;//pi (soft?)
697 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
700 pdgdaughters =new Int_t[3];
701 pdgdaughters[0]=321;//K
702 pdgdaughters[1]=321;//K
703 pdgdaughters[2]=211;//pi
707 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm4Prong");
710 pdgdaughters =new Int_t[4];
718 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
721 pdgdaughters =new Int_t[3];
722 pdgdaughters[0]=2212;//p
723 pdgdaughters[1]=321;//K
724 pdgdaughters[2]=211;//pi
730 switch(fDecayChannel){
732 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
735 pdgdaughters =new Int_t[3];
736 pdgdaughters[0]=211;//pi
737 pdgdaughters[1]=321;//K
738 pdgdaughters[2]=211;//pi
742 arrayProng=(TClonesArray*)aod->GetList()->FindObject("D0toKpi");
745 pdgdaughters =new Int_t[2];
746 pdgdaughters[0]=211;//pi
747 pdgdaughters[1]=321;//K
751 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Dstar");
754 pdgdaughters =new Int_t[3];
755 pdgdaughters[1]=211;//pi
756 pdgdaughters[0]=321;//K
757 pdgdaughters[2]=211;//pi (soft?)
761 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
764 pdgdaughters =new Int_t[3];
765 pdgdaughters[0]=321;//K
766 pdgdaughters[1]=321;//K
767 pdgdaughters[2]=211;//pi
771 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm4Prong");
774 pdgdaughters =new Int_t[4];
782 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
785 pdgdaughters =new Int_t[3];
786 pdgdaughters[0]=2212;//p
787 pdgdaughters[1]=321;//K
788 pdgdaughters[2]=211;//pi
793 Bool_t isSimpleMode=fSimpleMode;
795 AliInfo("Branch not found! The output will contain only trak related histograms\n");
800 TClonesArray *mcArray = 0;
801 AliAODMCHeader *mcHeader = 0;
804 delete [] pdgdaughters;
811 mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
813 printf("AliAnalysisTaskSEHFQA::UserExec: MC particles branch not found!\n");
814 delete [] pdgdaughters;
819 mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
821 printf("AliAnalysisTaskSEHFQA::UserExec: MC header branch not found!\n");
822 delete [] pdgdaughters;
828 UInt_t evSelMask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
829 Double_t centrality=fCuts->GetCentrality(aod);
830 Double_t multiplicity=aod->GetHeader()->GetRefMultiplicity();
831 Int_t runNumber = aod->GetRunNumber();
834 PostData(8,fOutputFlowObs);
837 TH2F* hTrigC=(TH2F*)fOutputEvSelection->FindObject("hTrigCent");
838 TH2F* hTrigM=(TH2F*)fOutputEvSelection->FindObject("hTrigMul");
839 AliCounterCollection* trigCount=(AliCounterCollection*)fOutputEvSelection->FindObject("trigCounter");
841 hTrigC->Fill(-1.,centrality);
842 hTrigM->Fill(-1.,multiplicity);
844 if(evSelMask & AliVEvent::kAny){
845 hTrigC->Fill(0.,centrality);
846 hTrigM->Fill(0.,multiplicity);
847 trigCount->Count(Form("triggerType:Any/Run:%d",runNumber));
849 if(evSelMask & AliVEvent::kMB){
850 hTrigC->Fill(1.,centrality);
851 hTrigM->Fill(1.,multiplicity);
852 trigCount->Count(Form("triggerType:MB/Run:%d",runNumber));
854 if(evSelMask & AliVEvent::kINT7){
855 hTrigC->Fill(2.,centrality);
856 hTrigM->Fill(2.,multiplicity);
858 if(evSelMask & AliVEvent::kCINT5){
859 hTrigC->Fill(3.,centrality);
860 hTrigM->Fill(3.,multiplicity);
862 if(evSelMask & AliVEvent::kCentral){
863 hTrigC->Fill(4.,centrality);
864 hTrigM->Fill(4.,multiplicity);
865 trigCount->Count(Form("triggerType:Cent/Run:%d",runNumber));
867 if(evSelMask & AliVEvent::kSemiCentral){
868 hTrigC->Fill(5.,centrality);
869 hTrigM->Fill(5.,multiplicity);
870 trigCount->Count(Form("triggerType:SemiCent/Run:%d",runNumber));
872 if(evSelMask & (AliVEvent::kEMC1 | AliVEvent::kEMC7)){
873 hTrigC->Fill(6.,centrality);
874 hTrigM->Fill(6.,multiplicity);
876 if(evSelMask & (AliVEvent::kEMCEJE | AliVEvent::kEMCEGA)){
877 hTrigC->Fill(7.,centrality);
878 hTrigM->Fill(7.,multiplicity);
879 trigCount->Count(Form("triggerType:EMCAL/Run:%d",runNumber));
881 if(evSelMask & (((AliVEvent::kCMUS5 | AliVEvent::kMUSH7) | (AliVEvent::kMUL7 | AliVEvent::kMUU7)) | (AliVEvent::kMUS7 | AliVEvent::kMUON))){
882 hTrigC->Fill(8.,centrality);
883 hTrigM->Fill(8.,multiplicity);
885 if(evSelMask & (AliVEvent::kPHI1 | AliVEvent::kPHI7)){
886 hTrigC->Fill(9.,centrality);
887 hTrigM->Fill(9.,multiplicity);
889 if(evSelMask & (AliVEvent::kDG5 | AliVEvent::kZED)){
890 hTrigC->Fill(10.,centrality);
891 hTrigM->Fill(10.,multiplicity);
896 // fix for temporary bug in ESDfilter
897 // the AODs with null vertex pointer didn't pass the PhysSel
898 if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) {
899 delete [] pdgdaughters;
906 //count events with good vertex
907 // AOD primary vertex
908 AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
909 TString primTitle = vtx1->GetTitle();
910 if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0) fNEntries->Fill(4);
912 // trigger class for PbPb C0SMH-B-NOPF-ALLNOTRD, C0SMH-B-NOPF-ALL
913 //TString trigclass=aod->GetFiredTriggerClasses();
914 //if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) fNEntries->Fill(5); //tmp
919 Bool_t evSelbyCentrality=kTRUE,evSelected=kTRUE,evSelByVertex=kTRUE,evselByPileup=kTRUE,evSelByPS=kTRUE;
921 if(!fCuts->IsEventSelected(aod)) {
923 if(fCuts->GetWhyRejection()==1) {fNEntries->Fill(1); evselByPileup=kFALSE;}// rejected for pileup
924 if(fCuts->GetWhyRejection()==2 || fCuts->GetWhyRejection()==3) evSelbyCentrality=kFALSE; //rejected by centrality
925 if(fCuts->GetWhyRejection()==4) evSelByVertex=kFALSE; //rejected by vertex
926 if(fCuts->GetWhyRejection()==5) fNEntries->Fill(5);//tmp
927 if(fCuts->GetWhyRejection()==6 && fOnOff[3]) ((AliCounterCollection*)fOutputEvSelection->FindObject("evselection"))->Count(Form("evnonsel:zvtx/Run:%d",runNumber));
928 if(fCuts->GetWhyRejection()==7) { evSelByPS=kFALSE; }
931 TH2F* hTrigS=(TH2F*)fOutputEvSelection->FindObject("hTrigCentSel");
932 hTrigS->Fill(-1.,centrality);
934 if(evSelMask & AliVEvent::kAny) hTrigS->Fill(0.,centrality);
935 if(evSelMask & AliVEvent::kMB) hTrigS->Fill(1.,centrality);
936 if(evSelMask & AliVEvent::kINT7) hTrigS->Fill(2.,centrality);
937 if(evSelMask & AliVEvent::kCINT5) hTrigS->Fill(3.,centrality);
938 if(evSelMask & AliVEvent::kCentral) hTrigS->Fill(4.,centrality);
939 if(evSelMask & AliVEvent::kSemiCentral) hTrigS->Fill(5.,centrality);
940 if(evSelMask & (AliVEvent::kEMC1 | AliVEvent::kEMC7)) hTrigS->Fill(6.,centrality);
941 if(evSelMask & (AliVEvent::kEMCEJE | AliVEvent::kEMCEGA)) hTrigS->Fill(7.,centrality);
942 if(evSelMask & (((AliVEvent::kCMUS5 | AliVEvent::kMUSH7) | (AliVEvent::kMUL7 | AliVEvent::kMUU7)) | (AliVEvent::kMUS7 | AliVEvent::kMUON))) hTrigS->Fill(8.,centrality);
943 if(evSelMask & (AliVEvent::kPHI1 | AliVEvent::kPHI7)) hTrigS->Fill(9.,centrality);
944 if(evSelMask & (AliVEvent::kDG5 | AliVEvent::kZED)) hTrigS->Fill(10.,centrality);
947 if(evSelected || (!evSelbyCentrality && evSelByVertex && evselByPileup && evSelByPS)){ //events selected or not selected because of centrality
948 if(fOnOff[2] && fCuts->GetUseCentrality()){
950 Float_t stdCentf=fCuts->GetCentrality(aod);
951 Int_t stdCent = (Int_t)(stdCentf+0.5);
952 Float_t secondCentf =fCuts->GetCentrality(aod,fEstimator);
953 Int_t secondCent = (Int_t)(secondCentf+0.5);
954 Int_t mincent=stdCent-stdCent%10;
959 if(mincent==100)mincent--;
960 ((AliCounterCollection*)fOutputCounters->FindObject("stdEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber));
962 mincent=secondCent-secondCent%10;
963 if(secondCentf==-1) {
967 if(mincent==100)mincent--;
968 ((AliCounterCollection*)fOutputCounters->FindObject("secondEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber));
970 if(stdCent<fCuts->GetMinCentrality() || stdCent>fCuts->GetMaxCentrality()){
971 ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsOut"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
972 ((TH1F*)fOutputCheckCentrality->FindObject("hMultOut"))->Fill(aod->GetHeader()->GetRefMultiplicity());
974 ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsIn"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
975 ((TH1F*)fOutputCheckCentrality->FindObject("hMultIn"))->Fill(aod->GetHeader()->GetRefMultiplicity());
977 ((TH2F*)fOutputCheckCentrality->FindObject("hMultvsPercentile"))->Fill(aod->GetHeader()->GetRefMultiplicity(),stdCentf);
979 PostData(6,fOutputCheckCentrality);
983 ((TH1F*)fOutputTrack->FindObject("hNtracklets"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
984 ((TH1F*)fOutputTrack->FindObject("hMult"))->Fill(aod->GetHeader()->GetRefMultiplicity());
990 const AliVVertex *vertex = aod->GetPrimaryVertex();
991 Double_t zvtx=vertex->GetZ();
992 if(evSelected || (!evSelected && TMath::Abs(zvtx) > 10.))
993 ((TH1F*)fOutputEvSelection->FindObject("hzvtx"))->Fill(zvtx);
997 delete [] pdgdaughters;
998 return; //discard all events not selected (vtx and/or centrality)
1002 AliAODPidHF* pidHF=fCuts->GetPidHF();
1004 delete [] pdgdaughters;
1007 AliPIDResponse* respF=pidHF->GetPidResponse();
1008 AliTPCPIDResponse* tpcres=new AliTPCPIDResponse();
1009 if(pidHF->GetOldPid()){
1010 Double_t alephParameters[5];
1011 pidHF->GetTPCBetheBlochParams(alephParameters);
1012 tpcres->SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2],alephParameters[3],alephParameters[4]);
1014 Bool_t oldPID=pidHF->GetOldPid();
1018 Int_t isGoodTrack=0, isFakeTrack=0;
1020 if(aod) ntracks=aod->GetNTracks();
1022 if(fOnOff[0] || fOnOff[1]){
1023 //loop on tracks in the event
1024 for (Int_t k=0;k<ntracks;k++){
1025 AliAODTrack* track=aod->GetTrack(k);
1026 AliAODPid *pid = track->GetDetPid();
1030 if(!pid) {if (fDebug>1)cout<<"No AliAODPid found"<<endl; continue;}
1031 Double_t times[AliPID::kSPECIES];
1032 pid->GetIntegratedTimes(times);
1034 Double_t tofRes[AliPID::kSPECIES];
1035 pid->GetTOFpidResolution(tofRes);
1038 TH1F* htmpfl=((TH1F*)fOutputPID->FindObject("hTOFflags"));
1040 if (track->GetStatus()&AliESDtrack::kTPCout) htmpfl->Fill(1.);
1041 if (track->GetStatus()&AliESDtrack::kTOFout) htmpfl->Fill(2.);
1042 if (track->GetStatus()&AliESDtrack::kTIME) htmpfl->Fill(3.);
1043 if (track->GetStatus()&AliESDtrack::kTOFpid) htmpfl->Fill(4.);
1044 if (track->GetStatus()&AliESDtrack::kTOFmismatch) htmpfl->Fill(5.);
1046 if(pidHF && pidHF->CheckStatus(track,"TOF")){
1047 ((TH1F*)fOutputPID->FindObject("hTOFtime"))->Fill(times[AliPID::kProton]);
1048 ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptime"))->Fill(track->P(),pid->GetTOFsignal()-times[3]); //3 is kaon
1049 ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(pid->GetTOFsignal());
1050 if (pid->GetTOFsignal()< 0) ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(-1);
1053 // test TOF sigma PID
1054 if (tofRes[2] != 0.) { // protection against 'old' AODs...
1055 ((TH2F*)fOutputPID->FindObject("hTOFsigmaKSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kKaon])/tofRes[3]);
1056 ((TH2F*)fOutputPID->FindObject("hTOFsigmaPionSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kPion])/tofRes[2]);
1057 ((TH2F*)fOutputPID->FindObject("hTOFsigmaProtonSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kProton])/tofRes[4]);
1058 for (Int_t iS=2; iS<5; iS++){ //we plot TOF Pid resolution for 3-sigma identified particles
1059 if ( (TMath::Abs(times[iS]-pid->GetTOFsignal())/tofRes[iS])<3.){
1062 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigPion"))->Fill(tofRes[iS]);
1065 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigKaon"))->Fill(tofRes[iS]);
1067 case AliPID::kProton:
1068 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigProton"))->Fill(tofRes[iS]);
1078 if(pidHF && pidHF->CheckStatus(track,"TPC")){
1080 Double_t TPCp=pid->GetTPCmomentum();
1081 Double_t TPCsignal=pid->GetTPCsignal();
1082 ((TH1F*)fOutputPID->FindObject("hTPCsig"))->Fill(TPCsignal);
1083 ((TH1F*)fOutputPID->FindObject("hTPCsigvsp"))->Fill(TPCp,TPCsignal);
1084 //if (pidHF->IsKaonRaw(track, "TOF"))
1085 if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaK"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kKaon));
1086 if (oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaK"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kKaon));
1087 //if (pidHF->IsPionRaw(track, "TOF"))
1088 if(oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaPion"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kPion));
1089 if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaPion"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kPion));
1090 //if (pidHF->IsProtonRaw(track,"TOF"))
1091 if(oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaProton"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kProton));
1092 if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaProton"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kProton));
1094 } //end PID histograms
1096 Int_t nclsTot=0,nclsSPD=0;
1098 //check clusters of the tracks
1101 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1);
1102 for(Int_t l=0;l<6;l++) {
1103 if(TESTBIT(track->GetITSClusterMap(),l)) {
1104 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(l);
1105 nclsTot++; if(l<2) nclsSPD++;
1108 ((TH1F*)fOutputTrack->FindObject("hnClsITS"))->Fill(nclsTot);
1109 ((TH1F*)fOutputTrack->FindObject("hnClsSPD"))->Fill(nclsSPD);
1110 if(track->Pt()>0.3 &&
1111 TMath::Abs(track->Eta())<0.8 &&
1112 track->GetStatus()&AliESDtrack::kITSrefit &&
1113 track->GetStatus()&AliESDtrack::kTPCrefit &&
1115 ((TH1F*)fOutputTrack->FindObject("hnClsITSselTr"))->Fill(nclsTot);
1117 if(!(track->GetStatus()&AliESDtrack::kTPCin) && track->GetStatus()&AliESDtrack::kITSrefit && !(track->GetStatus()&AliESDtrack::kITSpureSA)){//tracks retrieved in the ITS and not reconstructed in the TPC
1118 ((TH1F*)fOutputTrack->FindObject("hnClsITS-SA"))->Fill(nclsTot);
1119 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1);
1120 for(Int_t l=0;l<6;l++) {
1121 if(TESTBIT(track->GetITSClusterMap(),l)) {
1122 ((TH1F*)fOutputTrack->FindObject("hnLayerITSsa"))->Fill(l);
1128 label=track->GetLabel();
1129 if (label<0)fNEntries->Fill(8);
1130 else fNEntries->Fill(9);
1135 if (track->Pt()>0.3 &&
1136 track->GetStatus()&AliESDtrack::kTPCrefit &&
1137 track->GetStatus()&AliESDtrack::kITSrefit &&
1139 nclsSPD>0) {//count good tracks
1142 if(fReadMC && label<0) {
1143 ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt());
1146 ((TH1F*)fOutputTrack->FindObject("hptGoodTr"))->Fill(track->Pt());
1150 } //simple mode: no IsSelected on tracks: use "manual" cuts
1151 } //fill track histos
1152 } //end loop on tracks
1154 //fill once per event
1156 if (fReadMC) ((TH1F*)fOutputTrack->FindObject("hdistrFakeTr"))->Fill(isFakeTrack);
1157 ((TH1F*)fOutputTrack->FindObject("hdistrGoodTr"))->Fill(isGoodTrack);
1161 // loop over candidates
1162 Int_t nCand = arrayProng->GetEntriesFast();
1164 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi) ndaugh=2;
1165 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpipipi) ndaugh=4;
1167 for (Int_t iCand = 0; iCand < nCand; iCand++) {
1168 AliAODRecoDecayHF *d = (AliAODRecoDecayHF*)arrayProng->UncheckedAt(iCand);
1169 if(d->GetSelectionMap()) {
1170 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi && !d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)) continue; //skip the D0 from Dstar
1171 if(fDecayChannel==AliAnalysisTaskSEHFQA::kDplustoKpipi && !d->HasSelectionBit(AliRDHFCuts::kDplusCuts)) continue; //skip the 3 prong !D+
1175 Int_t labD = d->MatchToMC(pdg,mcArray,ndaugh,pdgdaughters);
1177 AliAODMCParticle *partD = (AliAODMCParticle*)mcArray->At(labD);
1178 Int_t label=partD->GetMother();
1179 AliAODMCParticle *mot = (AliAODMCParticle*)mcArray->At(label);
1180 while(label>=0){//get first mother
1181 mot = (AliAODMCParticle*)mcArray->At(label);
1182 label=mot->GetMother();
1184 Int_t pdgMotCode = mot->GetPdgCode();
1186 if(TMath::Abs(pdgMotCode)==4) fNEntries->Fill(6); //from primary charm
1187 if(TMath::Abs(pdgMotCode)==5) fNEntries->Fill(7); //from beauty
1191 else fNEntries->Fill(6); //count the candidates (data)
1193 for(Int_t id=0;id<ndaugh;id++){
1195 //other histograms to be filled when the cut object is given
1196 AliAODTrack* track=(AliAODTrack*)d->GetDaughter(id);
1200 if (fCuts->IsInFiducialAcceptance(d->Pt(),d->Y(pdg)) && fCuts->IsSelected(d,AliRDHFCuts::kTracks,aod)) {
1203 if(fReadMC)label=track->GetLabel();
1206 if(fReadMC && label<0) {
1208 ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt());
1210 ((TH1F*)fOutputTrack->FindObject("hd0f"))->Fill(d->Getd0Prong(id));
1213 ((TH1F*)fOutputTrack->FindObject("hptGoodTr"))->Fill(track->Pt());
1214 ((TH1F*)fOutputTrack->FindObject("hd0"))->Fill(d->Getd0Prong(id));
1215 Double_t d0rphiz[2],covd0[3];
1216 Bool_t isDCA=track->PropagateToDCA(aod->GetPrimaryVertex(),aod->GetMagneticField(),9999.,d0rphiz,covd0);
1217 if(isDCA) ((TH1F*)fOutputTrack->FindObject("hd0z"))->Fill(d0rphiz[1]);
1220 if (fCuts->IsSelected(d,AliRDHFCuts::kAll,aod) && fOnOff[1]){
1222 AliAODPid *pid = track->GetDetPid();
1224 pid->GetIntegratedTimes(times);
1225 if(pidHF && pidHF->CheckStatus(track,"TOF")) ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptimeAC"))->Fill(track->P(),pid->GetTOFsignal()-times[AliPID::kKaon]);
1226 if(pidHF && pidHF->CheckStatus(track,"TPC")) ((TH2F*)fOutputPID->FindObject("hTPCsigvspAC"))->Fill(pid->GetTPCmomentum(),pid->GetTPCsignal());
1229 } //end analysis cuts
1230 } //end acceptance and track cuts
1231 } //end loop on tracks in the candidate
1232 } //end loop on candidates
1234 if(fReadMC) ((TH1F*)fOutputTrack->FindObject("hdistrFakeTr"))->Fill(isFakeTrack);
1235 ((TH1F*)fOutputTrack->FindObject("hdistrGoodTr"))->Fill(isGoodTrack);
1238 } //end if on pid or track histograms
1241 delete [] pdgdaughters;
1242 PostData(1,fNEntries);
1243 if(fOnOff[1]) PostData(2,fOutputPID);
1244 if(fOnOff[0]) PostData(3,fOutputTrack);
1246 if(fOnOff[2]) PostData(5,fOutputCounters);
1247 //Post data 6 done in case of centrality on
1251 //____________________________________________________________________________
1252 void AliAnalysisTaskSEHFQA::FillFlowObs(AliAODEvent *aod){
1253 //fills the flow observables
1254 ((TH1F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(0);
1256 UInt_t mask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1257 UInt_t trigger=AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral;
1259 if(mask & trigger) {
1260 ((TH1F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(1); // fired
1261 Bool_t rejected=false;
1262 cc = fCuts->GetCentrality(aod);
1263 if(cc<0 || cc>60) rejected=true;
1264 const AliVVertex *vertex = aod->GetPrimaryVertex();
1265 Double_t zvtx=vertex->GetZ();
1266 if(TMath::Abs(zvtx)>7.) rejected=true;
1267 if(rejected) return; //not interesting for flow QA
1273 ((TH1F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(2);
1275 fRFPcuts->SetParamType(AliFlowTrackCuts::kGlobal);
1276 fRFPcuts->SetPtRange(0.2,5.);
1277 fRFPcuts->SetEtaRange(-0.8,0.8);
1278 fRFPcuts->SetMinNClustersTPC(70);
1279 fRFPcuts->SetMinChi2PerClusterTPC(0.2);
1280 fRFPcuts->SetMaxChi2PerClusterTPC(4.0);
1281 fRFPcuts->SetAcceptKinkDaughters(kFALSE);
1282 fRFPcuts->SetEvent(aod);
1284 TString ref[3] = {"FB1","FB128","VZE"};
1286 for(Int_t i=0; i!=3; ++i) {
1287 if(i==0) { // switching to bit 1
1288 fRFPcuts->SetMinimalTPCdedx(10.);
1289 fRFPcuts->SetAODfilterBit(1);
1290 } else { // switching to bit 128
1291 fRFPcuts->SetMinimalTPCdedx(-1);
1292 fRFPcuts->SetAODfilterBit(128);
1295 fRFPcuts->SetParamType(AliFlowTrackCuts::kV0);
1296 fRFPcuts->SetEtaRange(-5,+5);
1297 fRFPcuts->SetPhiMin(0);
1298 fRFPcuts->SetPhiMax(TMath::TwoPi());
1300 fFlowEvent->Fill(fRFPcuts,fRFPcuts);
1301 fFlowEvent->TagSubeventsInEta(-5,0,0,+5);
1302 // getting information
1303 AliFlowVector vQ, vQaQb[2];
1304 fFlowEvent->Get2Qsub(vQaQb,2);
1305 vQ = vQaQb[0]+vQaQb[1];
1306 Double_t dMa=vQaQb[0].GetMult();
1307 Double_t dMb=vQaQb[1].GetMult();
1308 if( dMa<2 || dMb<2 ) {
1309 ((TH1F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(3); //???
1312 psi[i] = vQ.Phi()/2;
1314 ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(0,cc,vQaQb[0].X()/dMa,dMa); // Qx-
1315 ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(1,cc,vQaQb[0].Y()/dMa,dMa); // Qy-
1316 ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(2,cc,vQaQb[1].X()/dMb,dMb); // Qx+
1317 ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(3,cc,vQaQb[1].Y()/dMb,dMb); // Qy+
1318 ((TH2F*) fOutputFlowObs->FindObject( Form("h%s_AngleQ",ref[i].Data()) ))->Fill(psi[i],cc); // Psi
1319 AliFlowTrackSimple *track;
1320 for(Int_t t=0; t!=fFlowEvent->NumberOfTracks(); ++t) {
1321 track = (AliFlowTrackSimple*) fFlowEvent->GetTrack(t);
1322 if(!track) continue;
1323 if(!track->InRPSelection()) continue;
1324 ((TH3F*) fOutputFlowObs->FindObject( Form("h%s_PhiEta",ref[i].Data()) ))->Fill(track->Phi(),track->Eta(),cc,track->Weight()); //PhiEta
1328 ((TH3F*) fOutputFlowObs->FindObject( "hTPCVZE_AngleQ" ))->Fill(psi[0],psi[2],cc);
1331 //____________________________________________________________________________
1332 void AliAnalysisTaskSEHFQA::Terminate(Option_t */*option*/){
1333 //terminate analysis
1335 fNEntries = dynamic_cast<TH1F*>(GetOutputData(1));
1337 printf("ERROR: %s not available\n",GetOutputSlot(1)->GetContainer()->GetName());
1341 fOutputPID = dynamic_cast<TList*> (GetOutputData(2));
1342 if (!fOutputPID && fOnOff[1]) {
1343 printf("ERROR: %s not available\n",GetOutputSlot(2)->GetContainer()->GetName());
1347 fOutputTrack = dynamic_cast<TList*> (GetOutputData(3));
1348 if (!fOutputTrack && fOnOff[0]) {
1349 printf("ERROR: %s not available\n",GetOutputSlot(3)->GetContainer()->GetName());