Coverity fixes.
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / macros / AddTaskHFQA.C
CommitLineData
0dbb51a0 1AliAnalysisTaskSEHFQA* AddTaskHFQA(AliAnalysisTaskSEHFQA::DecChannel ch,TString filecutsname="D0toKpiCuts.root"){
2 //
3 // Test macro for the AliAnalysisTaskSE for HF mesons quality assurance
4 //Author: C.Bianchin chiara.bianchin@pd.infn.it
5
6 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
7 if (!mgr) {
8 ::Error("AddTaskHFQA", "No analysis manager to connect to.");
9 return NULL;
10 }
11
12 Bool_t stdcuts=kFALSE;
13 TFile* filecuts=new TFile(filecutsname.Data());
14 if(!filecuts->IsOpen()){
15 cout<<"Input file not found: using std cut object"<<endl;
16 stdcuts=kTRUE;
17 }
18
19 AliRDHFCuts *analysiscuts=0x0;
20
21 TString filename="",out1name="nEntriesQA",out2name="outputPid",out3name="outputTrack",out4name="cuts",inname="input",suffix="",cutsobjname="";
22 filename = AliAnalysisManager::GetCommonFileName();
23 filename += ":PWG3_D2H_QA";
24
25 switch (ch){
26 case 0:
27 cutsobjname="AnalysisCuts";
28 if(stdcuts) {
29 analysiscuts = new AliRDHFCutsDplustoKpipi();
30 analysiscuts->SetStandardCutsPP2010();
31 }
32 else analysiscuts = (AliRDHFCutsDplustoKpipi*)filecuts->Get(cutsobjname);
33 suffix="Dplus";
34 break;
35 case 1:
36 cutsobjname="D0toKpiCuts";
37 if(stdcuts) {
38 analysiscuts = new AliRDHFCutsD0toKpi();
39 analysiscuts->SetStandardCutsPP2010();
40 }
41 else analysiscuts = (AliRDHFCutsD0toKpi*)filecuts->Get(cutsobjname);
42 suffix="D0";
43 break;
44 case 2:
45 cutsobjname="DStartoKpipiCuts";
46 if(stdcuts) {
47 analysiscuts = new AliRDHFCutsDStartoKpipi();
48 analysiscuts->SetStandardCutsPP2010();
49 }
50 else analysiscuts = (AliRDHFCutsDstartoKpipi*)filecuts->Get(cutsobjname);
51 suffix="Dstar";
52 break;
53 case 3:
54 cutsobjname="DstoKKpiCuts";
55 if(stdcuts) {
56 analysiscuts = new AliRDHFCutsDstoKKpi();
57 analysiscuts->SetStandardCutsPP2010();
58 }
59 else analysiscuts = (AliRDHFCutsDstoKKpi*)filecuts->Get(cutsobjname);
60 suffix="Ds";
61 break;
62 case 4:
63 cutsobjname="D0toKpipipiCuts";
64 if(stdcuts) {
65 analysiscuts = new AliRDHFCutsD0toKpipipi();
66 analysiscuts->SetStandardCutsPP2010();
67 }
68 else analysiscuts = (AliRDHFCutsD0toKpipipi*)filecuts->Get(cutsobjname);
69 suffix="D04";
70 break;
71 case 5:
72 cutsobjname="LctopKpiAnalysisCuts";
73 if(stdcuts) {
74 analysiscuts = new AliRDHFCutsLctopKpi();
75 analysiscuts->SetStandardCutsPP2010();
76 }
77 else analysiscuts = (AliRDHFCutsLctopKpi*)filecuts->Get(cutsobjname);
78 suffix="Lc";
79 break;
80 }
81
82 inname+=suffix;
83 out1name+=suffix;
84 out2name+=suffix;
85 out3name+=suffix;
86 out4name=cutsobjname;
87
88 if(!analysiscuts && filecutsname!="none"){
89 cout<<"Specific AliRDHFCuts not found"<<endl;
90 return;
91 }
92
93 AliAnalysisTaskSEHFQA* taskQA=new AliAnalysisTaskSEHFQA(Form("QA%s",suffix.Data()),ch,analysiscuts);
94
95 mgr->AddTask(taskQA);
96
97 //
98 // Create containers for input/output
99 AliAnalysisDataContainer *cinput = mgr->CreateContainer(inname,TChain::Class(), AliAnalysisManager::kInputContainer);
100 mgr->ConnectInput(taskQA,0,mgr->GetCommonInputContainer());
101
102 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(out1name,TH1F::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //events analysed
103 mgr->ConnectOutput(taskQA,1,coutput1);
104
105 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(out2name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //PID
106 mgr->ConnectOutput(taskQA,2,coutput2);
107
108 AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(out3name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of tracks
109 mgr->ConnectOutput(taskQA,3,coutput3);
110
111 AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(out4name,AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
112 mgr->ConnectOutput(taskQA,4,coutput4);
113
114 return taskQA;
115}