changes for PbPb from RR
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / macros / AddTaskHFQA.C
CommitLineData
a4ef4383 1AliAnalysisTaskSEHFQA* AddTaskHFQA(AliAnalysisTaskSEHFQA::DecChannel ch,TString filecutsname="D0toKpiCuts.root",Bool_t readMC=kFALSE){
0dbb51a0 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
a4ef4383 21 TString filename="",out1name="nEntriesQA",out2name="outputPid",out3name="outputTrack",out4name="cuts",out5name="countersCentrality",out6name="outputCentrCheck",inname="input",suffix="",cutsobjname="",centr="";
0dbb51a0 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();
a4ef4383 30 analysiscuts->SetStandardCutsPbPb2010();
0dbb51a0 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();
a4ef4383 39 analysiscuts->SetStandardCutsPbPb2010();
0dbb51a0 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;
a4ef4383 87 out5name+=suffix;
88 out6name+=suffix;
0dbb51a0 89
90 if(!analysiscuts && filecutsname!="none"){
91 cout<<"Specific AliRDHFCuts not found"<<endl;
92 return;
93 }
a4ef4383 94
95 centr=Form("%.0f%.0f",analysiscuts->GetMinCentrality(),analysiscuts->GetMaxCentrality());
96 inname+=centr;
97 out1name+=centr;
98 out2name+=centr;
99 out3name+=centr;
100 out4name+=centr;
101 out5name+=centr;
102 out6name+=centr;
103
0dbb51a0 104
105 AliAnalysisTaskSEHFQA* taskQA=new AliAnalysisTaskSEHFQA(Form("QA%s",suffix.Data()),ch,analysiscuts);
106
a4ef4383 107 taskQA->SetReadMC(readMC);
0dbb51a0 108 mgr->AddTask(taskQA);
109
110 //
111 // Create containers for input/output
112 AliAnalysisDataContainer *cinput = mgr->CreateContainer(inname,TChain::Class(), AliAnalysisManager::kInputContainer);
113 mgr->ConnectInput(taskQA,0,mgr->GetCommonInputContainer());
114
115 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(out1name,TH1F::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //events analysed
116 mgr->ConnectOutput(taskQA,1,coutput1);
117
118 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(out2name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //PID
119 mgr->ConnectOutput(taskQA,2,coutput2);
120
121 AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(out3name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of tracks
122 mgr->ConnectOutput(taskQA,3,coutput3);
123
124 AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(out4name,AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
125 mgr->ConnectOutput(taskQA,4,coutput4);
126
a4ef4383 127 AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(out5name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of tracks
128 mgr->ConnectOutput(taskQA,5,coutput5);
129
130 AliAnalysisDataContainer *coutput6 = mgr->CreateContainer(out6name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of tracks
131 mgr->ConnectOutput(taskQA,6,coutput6);
132
0dbb51a0 133 return taskQA;
134}