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,240,-10.,110);
471 hname="hntrklvsPercentile";
472 TH2F* hntrklvsPercentile=new TH2F(hname.Data(),"N tracklets vs Percentile;ntracklets;percentile",5000,-0.5,4999.5,240,-10.,110);
474 fOutputCheckCentrality->Add(hNtrackletsIn);
475 fOutputCheckCentrality->Add(hNtrackletsOut);
476 fOutputCheckCentrality->Add(hMultIn);
477 fOutputCheckCentrality->Add(hMultOut);
478 fOutputCheckCentrality->Add(hMultvsPercentile);
479 fOutputCheckCentrality->Add(hntrklvsPercentile);
481 PostData(6,fOutputCheckCentrality);
485 TString hname="hNtracklets";
486 TH1F* hNtracklets=new TH1F(hname.Data(),"Number of tracklets;ntracklets;Entries",5000,-0.5,4999.5);
489 TH1F* hMult=new TH1F(hname.Data(),"Multiplicity;multiplicity;Entries",10000,-0.5,9999.5);
490 fOutputTrack->Add(hNtracklets);
491 fOutputTrack->Add(hMult);
495 //event selection (z vertex for the moment)
497 fOutputEvSelection=new TList();
498 fOutputEvSelection->SetOwner();
499 fOutputEvSelection->SetName(GetOutputSlot(7)->GetContainer()->GetName());
500 AliCounterCollection *evselection=new AliCounterCollection("evselection");
501 evselection->AddRubric("run",500000);
502 evselection->AddRubric("evnonsel","zvtx");
505 TH1F* hzvtx=new TH1F("hzvtx", "Distribution of z_{VTX};z_{VTX} [cm];Entries",100,-20,20);
508 TH2F* hTrigCent=new TH2F("hTrigCent","Centrality vs. Trigger types",12,-1.5,10.5,12,-10,110);
509 hTrigCent->GetXaxis()->SetBinLabel(1,"All");
510 hTrigCent->GetXaxis()->SetBinLabel(2,"kAny");
511 hTrigCent->GetXaxis()->SetBinLabel(3,"kMB");
512 hTrigCent->GetXaxis()->SetBinLabel(4,"kINT7");
513 hTrigCent->GetXaxis()->SetBinLabel(5,"kCINT5");
514 hTrigCent->GetXaxis()->SetBinLabel(6,"kCent");
515 hTrigCent->GetXaxis()->SetBinLabel(7,"kSemiCent");
516 hTrigCent->GetXaxis()->SetBinLabel(8,"kEMC1+7");
517 hTrigCent->GetXaxis()->SetBinLabel(9,"kEMCJET+GAMMA");
518 hTrigCent->GetXaxis()->SetBinLabel(10,"Muons");
519 hTrigCent->GetXaxis()->SetBinLabel(11,"PHOS");
520 hTrigCent->GetXaxis()->SetBinLabel(12,"Others");
522 TH2F* hTrigMul=new TH2F("hTrigMul","Multiplicity vs. Trigger types",12,-1.5,10.5,100,0.,10000.);
523 hTrigMul->GetXaxis()->SetBinLabel(1,"All");
524 hTrigMul->GetXaxis()->SetBinLabel(2,"kAny");
525 hTrigMul->GetXaxis()->SetBinLabel(3,"kMB");
526 hTrigMul->GetXaxis()->SetBinLabel(4,"kINT7");
527 hTrigMul->GetXaxis()->SetBinLabel(5,"kCINT5");
528 hTrigMul->GetXaxis()->SetBinLabel(6,"kCent");
529 hTrigMul->GetXaxis()->SetBinLabel(7,"kSemiCent");
530 hTrigMul->GetXaxis()->SetBinLabel(8,"kEMC1+7");
531 hTrigMul->GetXaxis()->SetBinLabel(9,"kEMCJET+GAMMA");
532 hTrigMul->GetXaxis()->SetBinLabel(10,"Muons");
533 hTrigMul->GetXaxis()->SetBinLabel(11,"PHOS");
534 hTrigMul->GetXaxis()->SetBinLabel(12,"Others");
536 TH2F* hTrigCentSel=new TH2F("hTrigCentSel","Trigger types",12,-1.5,10.5,12,-10,110);
537 hTrigCentSel->GetXaxis()->SetBinLabel(1,"All");
538 hTrigCentSel->GetXaxis()->SetBinLabel(2,"kAny");
539 hTrigCentSel->GetXaxis()->SetBinLabel(3,"kMB");
540 hTrigCentSel->GetXaxis()->SetBinLabel(4,"kINT7");
541 hTrigCentSel->GetXaxis()->SetBinLabel(5,"kCINT5");
542 hTrigCentSel->GetXaxis()->SetBinLabel(6,"kCent");
543 hTrigCentSel->GetXaxis()->SetBinLabel(7,"kSemiCent");
544 hTrigCentSel->GetXaxis()->SetBinLabel(8,"kEMC1+7");
545 hTrigCentSel->GetXaxis()->SetBinLabel(9,"kEMCJET+GAMMA");
546 hTrigCentSel->GetXaxis()->SetBinLabel(10,"Muons");
547 hTrigCentSel->GetXaxis()->SetBinLabel(11,"PHOS");
548 hTrigCentSel->GetXaxis()->SetBinLabel(12,"Others");
550 AliCounterCollection *trigCounter=new AliCounterCollection("trigCounter");
551 trigCounter->AddRubric("run",500000);
552 trigCounter->AddRubric("triggerType","All/Any/MB/Cent/SemiCent/EMCAL/MUON/NoPhysSelMUON/NoPhysSelEvNot7/NoPhysSelCMUP1/NoPhysSelMB/NoPhysSelCent/NoPhysSelSemiCent");
555 fOutputEvSelection->Add(evselection);
556 fOutputEvSelection->Add(hzvtx);
557 fOutputEvSelection->Add(hTrigCent);
558 fOutputEvSelection->Add(hTrigMul);
559 fOutputEvSelection->Add(hTrigCentSel);
560 fOutputEvSelection->Add(trigCounter);
562 if(fOnOff[4]){ // FLOW OBSERVABLES
563 fOutputFlowObs=new TList();
564 fOutputFlowObs->SetOwner();
565 fOutputFlowObs->SetName(GetOutputSlot(8)->GetContainer()->GetName());
567 fFlowEvent = new AliFlowEvent(3000);
568 fRFPcuts = new AliFlowTrackCuts("rfpCuts");
570 TH2F *hFEvents = new TH2F("hFlowEvents","FlowEvent Selection",7,0,7,7,-10,60);
571 hFEvents->GetXaxis()->SetBinLabel(1,"REACHED");
572 hFEvents->GetXaxis()->SetBinLabel(2,"TRIGGERED");
573 hFEvents->GetXaxis()->SetBinLabel(3,"kMB");
574 hFEvents->GetXaxis()->SetBinLabel(4,"kCent");
575 hFEvents->GetXaxis()->SetBinLabel(5,"kSemiC");
576 hFEvents->GetXaxis()->SetBinLabel(6,"Triggered + vtx cut");
577 hFEvents->GetXaxis()->SetBinLabel(7,"UnexpectedBehaviour");
578 fOutputFlowObs->Add(hFEvents);
583 TString ref[3] = {"FB1","FB128","VZE"};
584 Int_t etabin[3] = {40,40,20};
585 Int_t etamax[3] = { 1, 1, 5};
586 for(Int_t i=0; i<3; ++i) {
587 hQ[i]= new TProfile2D( Form("h%s_Q",ref[i].Data()),
588 Form("Q_{2} components for %s",ref[i].Data()),
590 hQ[i]->GetXaxis()->SetBinLabel(1,"Qx^{-}");
591 hQ[i]->GetXaxis()->SetBinLabel(2,"Qy^{-}");
592 hQ[i]->GetXaxis()->SetBinLabel(3,"Qx^{+}");
593 hQ[i]->GetXaxis()->SetBinLabel(4,"Qy^{+}");
594 hQ[i]->GetYaxis()->SetTitle("Centrality");
595 fOutputFlowObs->Add(hQ[i]);
597 hAngleQ[i] = new TH2F( Form("h%s_AngleQ",ref[i].Data()),
598 Form("#Psi_{2} for %s",ref[i].Data()),
599 72,0,TMath::Pi(),12,0,60);
600 hAngleQ[i]->GetXaxis()->SetTitle( Form("#Psi_{2}^{%s}",ref[i].Data()) );
601 hAngleQ[i]->GetYaxis()->SetTitle("Centrality");
602 fOutputFlowObs->Add(hAngleQ[i]);
604 hPhiEta[i] = new TH3F( Form("h%s_PhiEta",ref[i].Data()),
605 Form("Eta vs Phi for %s",ref[i].Data()),
606 144,0,TMath::TwoPi(),etabin[i],-1.0*etamax[i],+1.0*etamax[i],12,0,60);
607 hPhiEta[i]->GetXaxis()->SetTitle("Phi");
608 hPhiEta[i]->GetYaxis()->SetTitle("Eta");
609 hPhiEta[i]->GetZaxis()->SetTitle("Centrality");
610 fOutputFlowObs->Add(hPhiEta[i]);
613 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);
614 hTPCVZE_AngleQ->GetXaxis()->SetTitle("#Psi_{2}^{TPC}");
615 hTPCVZE_AngleQ->GetYaxis()->SetTitle("#Psi_{2}^{VZE}");
616 hTPCVZE_AngleQ->GetZaxis()->SetTitle("Centrality");
617 fOutputFlowObs->Add(hTPCVZE_AngleQ);
619 TH2F *hCentVsMultRPS = new TH2F("hCentVsMultRPS", " Centrality Vs. Multiplicity RPs",5000, 0, 5000.,12,0,60 );
620 hCentVsMultRPS->GetXaxis()->SetTitle("Multiplicity RPs");
621 hCentVsMultRPS->GetYaxis()->SetTitle("Centrality");
622 fOutputFlowObs->Add(hCentVsMultRPS);
624 // AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
625 // AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
626 // AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
627 // fCuts->GetPidHF()->SetPidResponse(pidResp);
629 PostData(1,fNEntries);
631 if(fOnOff[1]) PostData(2,fOutputPID);
632 if(fOnOff[0]) PostData(3,fOutputTrack);
634 if(fOnOff[2]) PostData(5,fOutputCounters);
635 if(fOnOff[3]) PostData(7,fOutputEvSelection);
636 if(fOnOff[4]) PostData(8,fOutputFlowObs);
638 if(!fOnOff[0] && !fOnOff[1] && !fOnOff[2]) AliError("Nothing will be filled!");
641 //___________________________________________________________________________
642 void AliAnalysisTaskSEHFQA::UserExec(Option_t */*option*/)
644 // Execute analysis for current event
646 AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
647 if(fDebug>2) printf("Analysing decay %d\n",fDecayChannel);
648 // Post the data already here
649 PostData(1,fNEntries);
650 if(fOnOff[1]) PostData(2,fOutputPID);
651 if(fOnOff[0]) PostData(3,fOutputTrack);
654 PostData(5,fOutputCounters);
655 if(fCuts->GetUseCentrality()) PostData(6,fOutputCheckCentrality);
658 TClonesArray *arrayProng =0;
660 Int_t *pdgdaughters=0x0;
662 if(!aod && AODEvent() && IsStandardAOD()) {
663 // In case there is an AOD handler writing a standard AOD, use the AOD
664 // event in memory rather than the input (ESD) event.
665 aod = dynamic_cast<AliAODEvent*> (AODEvent());
666 // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
667 // have to taken from the AOD event hold by the AliAODExtension
668 AliAODHandler* aodHandler = (AliAODHandler*)
669 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
670 if(aodHandler->GetExtensions()) {
672 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
673 AliAODEvent *aodFromExt = ext->GetAOD();
677 switch(fDecayChannel){
679 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
682 pdgdaughters =new Int_t[3];
683 pdgdaughters[0]=211;//pi
684 pdgdaughters[1]=321;//K
685 pdgdaughters[2]=211;//pi
689 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("D0toKpi");
692 pdgdaughters =new Int_t[2];
693 pdgdaughters[0]=211;//pi
694 pdgdaughters[1]=321;//K
698 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Dstar");
701 pdgdaughters =new Int_t[3];
702 pdgdaughters[1]=211;//pi
703 pdgdaughters[0]=321;//K
704 pdgdaughters[2]=211;//pi (soft?)
708 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
711 pdgdaughters =new Int_t[3];
712 pdgdaughters[0]=321;//K
713 pdgdaughters[1]=321;//K
714 pdgdaughters[2]=211;//pi
718 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm4Prong");
721 pdgdaughters =new Int_t[4];
729 arrayProng=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
732 pdgdaughters =new Int_t[3];
733 pdgdaughters[0]=2212;//p
734 pdgdaughters[1]=321;//K
735 pdgdaughters[2]=211;//pi
741 switch(fDecayChannel){
743 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
746 pdgdaughters =new Int_t[3];
747 pdgdaughters[0]=211;//pi
748 pdgdaughters[1]=321;//K
749 pdgdaughters[2]=211;//pi
753 arrayProng=(TClonesArray*)aod->GetList()->FindObject("D0toKpi");
756 pdgdaughters =new Int_t[2];
757 pdgdaughters[0]=211;//pi
758 pdgdaughters[1]=321;//K
762 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Dstar");
765 pdgdaughters =new Int_t[3];
766 pdgdaughters[1]=211;//pi
767 pdgdaughters[0]=321;//K
768 pdgdaughters[2]=211;//pi (soft?)
772 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
775 pdgdaughters =new Int_t[3];
776 pdgdaughters[0]=321;//K
777 pdgdaughters[1]=321;//K
778 pdgdaughters[2]=211;//pi
782 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm4Prong");
785 pdgdaughters =new Int_t[4];
793 arrayProng=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
796 pdgdaughters =new Int_t[3];
797 pdgdaughters[0]=2212;//p
798 pdgdaughters[1]=321;//K
799 pdgdaughters[2]=211;//pi
804 Bool_t isSimpleMode=fSimpleMode;
806 AliInfo("Branch not found! The output will contain only trak related histograms\n");
811 TClonesArray *mcArray = 0;
812 AliAODMCHeader *mcHeader = 0;
815 delete [] pdgdaughters;
822 mcArray = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
824 printf("AliAnalysisTaskSEHFQA::UserExec: MC particles branch not found!\n");
825 delete [] pdgdaughters;
830 mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
832 printf("AliAnalysisTaskSEHFQA::UserExec: MC header branch not found!\n");
833 delete [] pdgdaughters;
839 UInt_t evSelMask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
840 Double_t centrality=fCuts->GetCentrality(aod);
841 Double_t multiplicity=aod->GetHeader()->GetRefMultiplicity();
842 Int_t runNumber = aod->GetRunNumber();
843 TString trigClass=aod->GetFiredTriggerClasses();
846 PostData(8,fOutputFlowObs);
849 TH2F* hTrigC=(TH2F*)fOutputEvSelection->FindObject("hTrigCent");
850 TH2F* hTrigM=(TH2F*)fOutputEvSelection->FindObject("hTrigMul");
851 AliCounterCollection* trigCount=(AliCounterCollection*)fOutputEvSelection->FindObject("trigCounter");
853 hTrigC->Fill(-1.,centrality);
854 hTrigM->Fill(-1.,multiplicity);
855 trigCount->Count(Form("triggerType:All/Run:%d",runNumber));
857 if(aod->GetEventType()!=7){
858 trigCount->Count(Form("triggerType:NoPhysSelEvNot7/Run:%d",runNumber));
859 }else if(trigClass.Contains("CMUP1")){
860 trigCount->Count(Form("triggerType:NoPhysSelCMUP1/Run:%d",runNumber));
861 }else if(trigClass.Contains("MUON")){
862 trigCount->Count(Form("triggerType:NoPhysSelMUON/Run:%d",runNumber));
863 }else if(trigClass.Contains("CPBI2_B1-B") || trigClass.Contains(" CPBI2WU_B1-B")){
864 trigCount->Count(Form("triggerType:NoPhysSelMB/Run:%d",runNumber));
865 }else if(trigClass.Contains("CCENT") || trigClass.Contains("CVHN")){
866 trigCount->Count(Form("triggerType:NoPhysSelCent/Run:%d",runNumber));
867 }else if(trigClass.Contains("CSEMI") || trigClass.Contains("CVLN")){
868 trigCount->Count(Form("triggerType:NoPhysSelSemiCent/Run:%d",runNumber));
871 if(evSelMask & AliVEvent::kAny){
872 hTrigC->Fill(0.,centrality);
873 hTrigM->Fill(0.,multiplicity);
874 trigCount->Count(Form("triggerType:Any/Run:%d",runNumber));
876 if(evSelMask & AliVEvent::kMB){
877 hTrigC->Fill(1.,centrality);
878 hTrigM->Fill(1.,multiplicity);
879 trigCount->Count(Form("triggerType:MB/Run:%d",runNumber));
881 if(evSelMask & AliVEvent::kINT7){
882 hTrigC->Fill(2.,centrality);
883 hTrigM->Fill(2.,multiplicity);
885 if(evSelMask & AliVEvent::kCINT5){
886 hTrigC->Fill(3.,centrality);
887 hTrigM->Fill(3.,multiplicity);
889 if(evSelMask & AliVEvent::kCentral){
890 hTrigC->Fill(4.,centrality);
891 hTrigM->Fill(4.,multiplicity);
892 trigCount->Count(Form("triggerType:Cent/Run:%d",runNumber));
894 if(evSelMask & AliVEvent::kSemiCentral){
895 hTrigC->Fill(5.,centrality);
896 hTrigM->Fill(5.,multiplicity);
897 trigCount->Count(Form("triggerType:SemiCent/Run:%d",runNumber));
899 if(evSelMask & (AliVEvent::kEMC1 | AliVEvent::kEMC7)){
900 hTrigC->Fill(6.,centrality);
901 hTrigM->Fill(6.,multiplicity);
903 if(evSelMask & (AliVEvent::kEMCEJE | AliVEvent::kEMCEGA)){
904 hTrigC->Fill(7.,centrality);
905 hTrigM->Fill(7.,multiplicity);
906 trigCount->Count(Form("triggerType:EMCAL/Run:%d",runNumber));
908 if(evSelMask & (((AliVEvent::kCMUS5 | AliVEvent::kMUSH7) | (AliVEvent::kMUL7 | AliVEvent::kMUU7)) | (AliVEvent::kMUS7 | AliVEvent::kMUON))){
909 hTrigC->Fill(8.,centrality);
910 hTrigM->Fill(8.,multiplicity);
911 trigCount->Count(Form("triggerType:MUON/Run:%d",runNumber));
913 if(evSelMask & (AliVEvent::kPHI1 | AliVEvent::kPHI7)){
914 hTrigC->Fill(9.,centrality);
915 hTrigM->Fill(9.,multiplicity);
917 if(evSelMask & (AliVEvent::kDG5 | AliVEvent::kZED)){
918 hTrigC->Fill(10.,centrality);
919 hTrigM->Fill(10.,multiplicity);
924 // fix for temporary bug in ESDfilter
925 // the AODs with null vertex pointer didn't pass the PhysSel
926 if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) {
927 delete [] pdgdaughters;
934 //count events with good vertex
935 // AOD primary vertex
936 AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
937 TString primTitle = vtx1->GetTitle();
938 if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0) fNEntries->Fill(4);
940 // trigger class for PbPb C0SMH-B-NOPF-ALLNOTRD, C0SMH-B-NOPF-ALL
941 //TString trigclass=aod->GetFiredTriggerClasses();
942 //if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) fNEntries->Fill(5); //tmp
947 Bool_t evSelbyCentrality=kTRUE,evSelected=kTRUE,evSelByVertex=kTRUE,evselByPileup=kTRUE,evSelByPS=kTRUE;
949 if(!fCuts->IsEventSelected(aod)) {
951 if(fCuts->GetWhyRejection()==1) {fNEntries->Fill(1); evselByPileup=kFALSE;}// rejected for pileup
952 if(fCuts->GetWhyRejection()==2 || fCuts->GetWhyRejection()==3) evSelbyCentrality=kFALSE; //rejected by centrality
953 if(fCuts->GetWhyRejection()==4) evSelByVertex=kFALSE; //rejected by vertex
954 if(fCuts->GetWhyRejection()==5) fNEntries->Fill(5);//tmp
955 if(fCuts->GetWhyRejection()==6 && fOnOff[3]) ((AliCounterCollection*)fOutputEvSelection->FindObject("evselection"))->Count(Form("evnonsel:zvtx/Run:%d",runNumber));
956 if(fCuts->GetWhyRejection()==7) { evSelByPS=kFALSE; }
959 TH2F* hTrigS=(TH2F*)fOutputEvSelection->FindObject("hTrigCentSel");
960 hTrigS->Fill(-1.,centrality);
962 if(evSelMask & AliVEvent::kAny) hTrigS->Fill(0.,centrality);
963 if(evSelMask & AliVEvent::kMB) hTrigS->Fill(1.,centrality);
964 if(evSelMask & AliVEvent::kINT7) hTrigS->Fill(2.,centrality);
965 if(evSelMask & AliVEvent::kCINT5) hTrigS->Fill(3.,centrality);
966 if(evSelMask & AliVEvent::kCentral) hTrigS->Fill(4.,centrality);
967 if(evSelMask & AliVEvent::kSemiCentral) hTrigS->Fill(5.,centrality);
968 if(evSelMask & (AliVEvent::kEMC1 | AliVEvent::kEMC7)) hTrigS->Fill(6.,centrality);
969 if(evSelMask & (AliVEvent::kEMCEJE | AliVEvent::kEMCEGA)) hTrigS->Fill(7.,centrality);
970 if(evSelMask & (((AliVEvent::kCMUS5 | AliVEvent::kMUSH7) | (AliVEvent::kMUL7 | AliVEvent::kMUU7)) | (AliVEvent::kMUS7 | AliVEvent::kMUON))) hTrigS->Fill(8.,centrality);
971 if(evSelMask & (AliVEvent::kPHI1 | AliVEvent::kPHI7)) hTrigS->Fill(9.,centrality);
972 if(evSelMask & (AliVEvent::kDG5 | AliVEvent::kZED)) hTrigS->Fill(10.,centrality);
975 if(evSelected || (!evSelbyCentrality && evSelByVertex && evselByPileup && evSelByPS)){ //events selected or not selected because of centrality
976 if(fOnOff[2] && fCuts->GetUseCentrality()){
978 Float_t stdCentf=fCuts->GetCentrality(aod);
979 Int_t stdCent = (Int_t)(stdCentf+0.5);
980 Float_t secondCentf =fCuts->GetCentrality(aod,fEstimator);
981 Int_t secondCent = (Int_t)(secondCentf+0.5);
982 Int_t mincent=stdCent-stdCent%10;
987 if(mincent==100)mincent--;
988 ((AliCounterCollection*)fOutputCounters->FindObject("stdEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber));
990 mincent=secondCent-secondCent%10;
991 if(secondCentf==-1) {
995 if(mincent==100)mincent--;
996 ((AliCounterCollection*)fOutputCounters->FindObject("secondEstimator"))->Count(Form("centralityclass:%d_%d/Run:%d",mincent,mincent+10,runNumber));
998 if(stdCent<fCuts->GetMinCentrality() || stdCent>fCuts->GetMaxCentrality()){
999 ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsOut"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
1000 ((TH1F*)fOutputCheckCentrality->FindObject("hMultOut"))->Fill(aod->GetHeader()->GetRefMultiplicity());
1002 ((TH1F*)fOutputCheckCentrality->FindObject("hNtrackletsIn"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
1003 ((TH1F*)fOutputCheckCentrality->FindObject("hMultIn"))->Fill(aod->GetHeader()->GetRefMultiplicity());
1005 ((TH2F*)fOutputCheckCentrality->FindObject("hMultvsPercentile"))->Fill(aod->GetHeader()->GetRefMultiplicity(),stdCentf);
1006 ((TH2F*)fOutputCheckCentrality->FindObject("hntrklvsPercentile"))->Fill(aod->GetTracklets()->GetNumberOfTracklets(),stdCentf);
1008 PostData(6,fOutputCheckCentrality);
1012 ((TH1F*)fOutputTrack->FindObject("hNtracklets"))->Fill(aod->GetTracklets()->GetNumberOfTracklets());
1013 ((TH1F*)fOutputTrack->FindObject("hMult"))->Fill(aod->GetHeader()->GetRefMultiplicity());
1019 const AliVVertex *vertex = aod->GetPrimaryVertex();
1020 Double_t zvtx=vertex->GetZ();
1021 if(evSelected || (!evSelected && TMath::Abs(zvtx) > 10.))
1022 ((TH1F*)fOutputEvSelection->FindObject("hzvtx"))->Fill(zvtx);
1026 delete [] pdgdaughters;
1027 return; //discard all events not selected (vtx and/or centrality)
1031 AliAODPidHF* pidHF=fCuts->GetPidHF();
1033 delete [] pdgdaughters;
1036 AliPIDResponse* respF=pidHF->GetPidResponse();
1037 AliTPCPIDResponse* tpcres=new AliTPCPIDResponse();
1038 if(pidHF->GetOldPid()){
1039 Double_t alephParameters[5];
1040 pidHF->GetTPCBetheBlochParams(alephParameters);
1041 tpcres->SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2],alephParameters[3],alephParameters[4]);
1043 Bool_t oldPID=pidHF->GetOldPid();
1047 Int_t isGoodTrack=0, isFakeTrack=0;
1049 if(aod) ntracks=aod->GetNTracks();
1051 if(fOnOff[0] || fOnOff[1]){
1052 //loop on tracks in the event
1053 for (Int_t k=0;k<ntracks;k++){
1054 AliAODTrack* track=aod->GetTrack(k);
1055 AliAODPid *pid = track->GetDetPid();
1059 if(!pid) {if (fDebug>1)cout<<"No AliAODPid found"<<endl; continue;}
1060 Double_t times[AliPID::kSPECIES];
1061 pid->GetIntegratedTimes(times);
1063 Double_t tofRes[AliPID::kSPECIES];
1064 pid->GetTOFpidResolution(tofRes);
1067 TH1F* htmpfl=((TH1F*)fOutputPID->FindObject("hTOFflags"));
1069 if (track->GetStatus()&AliESDtrack::kTPCout) htmpfl->Fill(1.);
1070 if (track->GetStatus()&AliESDtrack::kTOFout) htmpfl->Fill(2.);
1071 if (track->GetStatus()&AliESDtrack::kTIME) htmpfl->Fill(3.);
1072 if (track->GetStatus()&AliESDtrack::kTOFpid) htmpfl->Fill(4.);
1073 if (track->GetStatus()&AliESDtrack::kTOFmismatch) htmpfl->Fill(5.);
1075 if(pidHF && pidHF->CheckStatus(track,"TOF")){
1076 ((TH1F*)fOutputPID->FindObject("hTOFtime"))->Fill(times[AliPID::kProton]);
1077 ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptime"))->Fill(track->P(),pid->GetTOFsignal()-times[3]); //3 is kaon
1078 ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(pid->GetTOFsignal());
1079 if (pid->GetTOFsignal()< 0) ((TH1F*)fOutputPID->FindObject("hTOFsig"))->Fill(-1);
1082 // test TOF sigma PID
1083 if (tofRes[2] != 0.) { // protection against 'old' AODs...
1084 ((TH2F*)fOutputPID->FindObject("hTOFsigmaKSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kKaon])/tofRes[3]);
1085 ((TH2F*)fOutputPID->FindObject("hTOFsigmaPionSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kPion])/tofRes[2]);
1086 ((TH2F*)fOutputPID->FindObject("hTOFsigmaProtonSigPid"))->Fill(track->P(),(pid->GetTOFsignal()-times[AliPID::kProton])/tofRes[4]);
1087 for (Int_t iS=2; iS<5; iS++){ //we plot TOF Pid resolution for 3-sigma identified particles
1088 if ( (TMath::Abs(times[iS]-pid->GetTOFsignal())/tofRes[iS])<3.){
1091 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigPion"))->Fill(tofRes[iS]);
1094 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigKaon"))->Fill(tofRes[iS]);
1096 case AliPID::kProton:
1097 ((TH1F*)fOutputPID->FindObject("hTOFsigPid3sigProton"))->Fill(tofRes[iS]);
1107 if(pidHF && pidHF->CheckStatus(track,"TPC")){
1109 Double_t TPCp=pid->GetTPCmomentum();
1110 Double_t TPCsignal=pid->GetTPCsignal();
1111 ((TH1F*)fOutputPID->FindObject("hTPCsig"))->Fill(TPCsignal);
1112 ((TH1F*)fOutputPID->FindObject("hTPCsigvsp"))->Fill(TPCp,TPCsignal);
1113 //if (pidHF->IsKaonRaw(track, "TOF"))
1114 if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaK"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kKaon));
1115 if (oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaK"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kKaon));
1116 //if (pidHF->IsPionRaw(track, "TOF"))
1117 if(oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaPion"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kPion));
1118 if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaPion"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kPion));
1119 //if (pidHF->IsProtonRaw(track,"TOF"))
1120 if(oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaProton"))->Fill(TPCp,tpcres->GetNumberOfSigmas(TPCp,TPCsignal,track->GetTPCNcls(),AliPID::kProton));
1121 if(!oldPID) ((TH2F*)fOutputPID->FindObject("hTPCsigmaProton"))->Fill(TPCp,respF->NumberOfSigmasTPC(track,AliPID::kProton));
1123 } //end PID histograms
1125 Int_t nclsTot=0,nclsSPD=0;
1127 //check clusters of the tracks
1130 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1);
1131 for(Int_t l=0;l<6;l++) {
1132 if(TESTBIT(track->GetITSClusterMap(),l)) {
1133 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(l);
1134 nclsTot++; if(l<2) nclsSPD++;
1137 ((TH1F*)fOutputTrack->FindObject("hnClsITS"))->Fill(nclsTot);
1138 ((TH1F*)fOutputTrack->FindObject("hnClsSPD"))->Fill(nclsSPD);
1139 if(track->Pt()>0.3 &&
1140 TMath::Abs(track->Eta())<0.8 &&
1141 track->GetStatus()&AliESDtrack::kITSrefit &&
1142 track->GetStatus()&AliESDtrack::kTPCrefit &&
1144 ((TH1F*)fOutputTrack->FindObject("hnClsITSselTr"))->Fill(nclsTot);
1146 if(!(track->GetStatus()&AliESDtrack::kTPCin) && track->GetStatus()&AliESDtrack::kITSrefit && !(track->GetStatus()&AliESDtrack::kITSpureSA)){//tracks retrieved in the ITS and not reconstructed in the TPC
1147 ((TH1F*)fOutputTrack->FindObject("hnClsITS-SA"))->Fill(nclsTot);
1148 ((TH1F*)fOutputTrack->FindObject("hnLayerITS"))->Fill(-1);
1149 for(Int_t l=0;l<6;l++) {
1150 if(TESTBIT(track->GetITSClusterMap(),l)) {
1151 ((TH1F*)fOutputTrack->FindObject("hnLayerITSsa"))->Fill(l);
1157 label=track->GetLabel();
1158 if (label<0)fNEntries->Fill(8);
1159 else fNEntries->Fill(9);
1164 if (track->Pt()>0.3 &&
1165 track->GetStatus()&AliESDtrack::kTPCrefit &&
1166 track->GetStatus()&AliESDtrack::kITSrefit &&
1168 nclsSPD>0) {//count good tracks
1171 if(fReadMC && label<0) {
1172 ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt());
1175 ((TH1F*)fOutputTrack->FindObject("hptGoodTr"))->Fill(track->Pt());
1179 } //simple mode: no IsSelected on tracks: use "manual" cuts
1180 } //fill track histos
1181 } //end loop on tracks
1183 //fill once per event
1185 if (fReadMC) ((TH1F*)fOutputTrack->FindObject("hdistrFakeTr"))->Fill(isFakeTrack);
1186 ((TH1F*)fOutputTrack->FindObject("hdistrGoodTr"))->Fill(isGoodTrack);
1190 // loop over candidates
1191 Int_t nCand = arrayProng->GetEntriesFast();
1193 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi) ndaugh=2;
1194 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpipipi) ndaugh=4;
1196 for (Int_t iCand = 0; iCand < nCand; iCand++) {
1197 AliAODRecoDecayHF *d = (AliAODRecoDecayHF*)arrayProng->UncheckedAt(iCand);
1198 if(d->GetSelectionMap()) {
1199 if(fDecayChannel==AliAnalysisTaskSEHFQA::kD0toKpi && !d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)) continue; //skip the D0 from Dstar
1200 if(fDecayChannel==AliAnalysisTaskSEHFQA::kDplustoKpipi && !d->HasSelectionBit(AliRDHFCuts::kDplusCuts)) continue; //skip the 3 prong !D+
1204 Int_t labD = d->MatchToMC(pdg,mcArray,ndaugh,pdgdaughters);
1206 AliAODMCParticle *partD = (AliAODMCParticle*)mcArray->At(labD);
1207 Int_t label=partD->GetMother();
1208 AliAODMCParticle *mot = (AliAODMCParticle*)mcArray->At(label);
1209 while(label>=0){//get first mother
1210 mot = (AliAODMCParticle*)mcArray->At(label);
1211 label=mot->GetMother();
1213 Int_t pdgMotCode = mot->GetPdgCode();
1215 if(TMath::Abs(pdgMotCode)==4) fNEntries->Fill(6); //from primary charm
1216 if(TMath::Abs(pdgMotCode)==5) fNEntries->Fill(7); //from beauty
1220 else fNEntries->Fill(6); //count the candidates (data)
1222 for(Int_t id=0;id<ndaugh;id++){
1224 //other histograms to be filled when the cut object is given
1225 AliAODTrack* track=(AliAODTrack*)d->GetDaughter(id);
1229 if (fCuts->IsInFiducialAcceptance(d->Pt(),d->Y(pdg)) && fCuts->IsSelected(d,AliRDHFCuts::kTracks,aod)) {
1232 if(fReadMC)label=track->GetLabel();
1235 if(fReadMC && label<0) {
1237 ((TH1F*)fOutputTrack->FindObject("hptFakeTr"))->Fill(track->Pt());
1239 ((TH1F*)fOutputTrack->FindObject("hd0f"))->Fill(d->Getd0Prong(id));
1242 ((TH1F*)fOutputTrack->FindObject("hptGoodTr"))->Fill(track->Pt());
1243 ((TH1F*)fOutputTrack->FindObject("hd0"))->Fill(d->Getd0Prong(id));
1244 Double_t d0rphiz[2],covd0[3];
1245 Bool_t isDCA=track->PropagateToDCA(aod->GetPrimaryVertex(),aod->GetMagneticField(),9999.,d0rphiz,covd0);
1246 if(isDCA) ((TH1F*)fOutputTrack->FindObject("hd0z"))->Fill(d0rphiz[1]);
1249 if (fCuts->IsSelected(d,AliRDHFCuts::kAll,aod) && fOnOff[1]){
1251 AliAODPid *pid = track->GetDetPid();
1253 pid->GetIntegratedTimes(times);
1254 if(pidHF && pidHF->CheckStatus(track,"TOF")) ((TH2F*)fOutputPID->FindObject("hTOFtimeKaonHyptimeAC"))->Fill(track->P(),pid->GetTOFsignal()-times[AliPID::kKaon]);
1255 if(pidHF && pidHF->CheckStatus(track,"TPC")) ((TH2F*)fOutputPID->FindObject("hTPCsigvspAC"))->Fill(pid->GetTPCmomentum(),pid->GetTPCsignal());
1258 } //end analysis cuts
1259 } //end acceptance and track cuts
1260 } //end loop on tracks in the candidate
1261 } //end loop on candidates
1263 if(fReadMC) ((TH1F*)fOutputTrack->FindObject("hdistrFakeTr"))->Fill(isFakeTrack);
1264 ((TH1F*)fOutputTrack->FindObject("hdistrGoodTr"))->Fill(isGoodTrack);
1267 } //end if on pid or track histograms
1270 delete [] pdgdaughters;
1271 PostData(1,fNEntries);
1272 if(fOnOff[1]) PostData(2,fOutputPID);
1273 if(fOnOff[0]) PostData(3,fOutputTrack);
1275 if(fOnOff[2]) PostData(5,fOutputCounters);
1276 //Post data 6 done in case of centrality on
1280 //____________________________________________________________________________
1281 void AliAnalysisTaskSEHFQA::FillFlowObs(AliAODEvent *aod){
1282 //fills the flow observables
1284 cc = fCuts->GetCentrality(aod);
1285 ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(0., cc);
1287 UInt_t mask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1288 UInt_t trigger=AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral;
1289 if(mask & trigger) {
1290 ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(1.,cc); // fired
1291 if (mask & AliVEvent::kMB) ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(2.,cc);
1292 if (mask & AliVEvent::kCentral) ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(3.,cc);
1293 if (mask & AliVEvent::kSemiCentral) ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(4.,cc);
1294 Bool_t rejected=false;
1295 if(cc<0 || cc>60) rejected=true;
1296 const AliVVertex *vertex = aod->GetPrimaryVertex();
1297 Double_t zvtx=vertex->GetZ();
1298 if(TMath::Abs(zvtx)>fCuts->GetMaxVtxZ()) rejected=true;
1299 if(rejected) return; //not interesting for flow QA
1305 ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(5.,cc);
1306 fRFPcuts->SetParamType(AliFlowTrackCuts::kGlobal);
1307 fRFPcuts->SetPtRange(0.2,5.);
1308 fRFPcuts->SetEtaRange(-0.8,0.8);
1309 fRFPcuts->SetMinNClustersTPC(70);
1310 fRFPcuts->SetMinChi2PerClusterTPC(0.2);
1311 fRFPcuts->SetMaxChi2PerClusterTPC(4.0);
1312 fRFPcuts->SetAcceptKinkDaughters(kFALSE);
1313 fRFPcuts->SetEvent(aod);
1315 TString ref[3] = {"FB1","FB128","VZE"};
1317 for(Int_t i=0; i!=3; ++i) {
1318 if(i==0) { // switching to bit 1
1319 fRFPcuts->SetMinimalTPCdedx(10.);
1320 fRFPcuts->SetAODfilterBit(1);
1321 } else { // switching to bit 128
1322 fRFPcuts->SetMinimalTPCdedx(-1);
1323 fRFPcuts->SetAODfilterBit(128);
1326 fRFPcuts->SetParamType(AliFlowTrackCuts::kV0);
1327 fRFPcuts->SetEtaRange(-5,+5);
1328 fRFPcuts->SetPhiMin(0);
1329 fRFPcuts->SetPhiMax(TMath::TwoPi());
1331 fFlowEvent->Fill(fRFPcuts,fRFPcuts);
1332 fFlowEvent->TagSubeventsInEta(-5,0,0,+5);
1333 // getting informationt
1334 AliFlowVector vQ, vQaQb[2];
1335 fFlowEvent->Get2Qsub(vQaQb,2);
1336 vQ = vQaQb[0]+vQaQb[1];
1337 Double_t dMa=vQaQb[0].GetMult();
1338 Double_t dMb=vQaQb[1].GetMult();
1339 if( dMa<2 || dMb<2 ) {
1340 ((TH2F*) fOutputFlowObs->FindObject("hFlowEvents"))->Fill(6.,cc); //???
1343 psi[i] = vQ.Phi()/2;
1345 ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(0,cc,vQaQb[0].X()/dMa,dMa); // Qx-
1346 ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(1,cc,vQaQb[0].Y()/dMa,dMa); // Qy-
1347 ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(2,cc,vQaQb[1].X()/dMb,dMb); // Qx+
1348 ((TProfile2D*) fOutputFlowObs->FindObject( Form("h%s_Q",ref[i].Data())))->Fill(3,cc,vQaQb[1].Y()/dMb,dMb); // Qy+
1349 ((TH2F*) fOutputFlowObs->FindObject( Form("h%s_AngleQ",ref[i].Data()) ))->Fill(psi[i],cc); // Psi
1350 AliFlowTrackSimple *track;
1351 for(Int_t t=0; t!=fFlowEvent->NumberOfTracks(); ++t) {
1352 track = (AliFlowTrackSimple*) fFlowEvent->GetTrack(t);
1353 if(!track) continue;
1354 if(!track->InRPSelection()) continue;
1355 ((TH3F*) fOutputFlowObs->FindObject( Form("h%s_PhiEta",ref[i].Data()) ))->Fill(track->Phi(),track->Eta(),cc,track->Weight()); //PhiEta
1358 //histo filled only for TPCFB1
1360 ((TH2F*) fOutputFlowObs->FindObject("hCentVsMultRPS"))->Fill(fFlowEvent->GetNumberOfRPs(),cc);
1364 ((TH3F*) fOutputFlowObs->FindObject( "hTPCVZE_AngleQ" ))->Fill(psi[0],psi[2],cc);
1367 //____________________________________________________________________________
1368 void AliAnalysisTaskSEHFQA::Terminate(Option_t */*option*/){
1369 //terminate analysis
1371 fNEntries = dynamic_cast<TH1F*>(GetOutputData(1));
1373 printf("ERROR: %s not available\n",GetOutputSlot(1)->GetContainer()->GetName());
1377 fOutputPID = dynamic_cast<TList*> (GetOutputData(2));
1378 if (!fOutputPID && fOnOff[1]) {
1379 printf("ERROR: %s not available\n",GetOutputSlot(2)->GetContainer()->GetName());
1383 fOutputTrack = dynamic_cast<TList*> (GetOutputData(3));
1384 if (!fOutputTrack && fOnOff[0]) {
1385 printf("ERROR: %s not available\n",GetOutputSlot(3)->GetContainer()->GetName());