Update (Chiara)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / macros / AddTaskHFQA.C
CommitLineData
29df3603 1AliAnalysisTaskSEHFQA* AddTaskHFQA(AliAnalysisTaskSEHFQA::DecChannel ch,TString filecutsname="D0toKpiCuts.root",Bool_t readMC=kFALSE, Bool_t simplemode=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
818c1271 19 Bool_t onoff[4]={kTRUE,kTRUE,kFALSE,kTRUE};
5fc4893f 20
0dbb51a0 21 AliRDHFCuts *analysiscuts=0x0;
22
818c1271 23 TString filename="",out1name="nEntriesQA",out2name="outputPid",out3name="outputTrack",out4name="cuts",out5name="countersCentrality",out6name="outputCentrCheck",out7name="outputEvSel",inname="input",suffix="",cutsobjname="",centr="";
0dbb51a0 24 filename = AliAnalysisManager::GetCommonFileName();
25 filename += ":PWG3_D2H_QA";
26
27 switch (ch){
28 case 0:
29 cutsobjname="AnalysisCuts";
30 if(stdcuts) {
31 analysiscuts = new AliRDHFCutsDplustoKpipi();
82f89d0d 32 analysiscuts->SetStandardCutsPP2010();
0dbb51a0 33 }
34 else analysiscuts = (AliRDHFCutsDplustoKpipi*)filecuts->Get(cutsobjname);
35 suffix="Dplus";
36 break;
37 case 1:
38 cutsobjname="D0toKpiCuts";
39 if(stdcuts) {
40 analysiscuts = new AliRDHFCutsD0toKpi();
82f89d0d 41 analysiscuts->SetStandardCutsPP2010();
0dbb51a0 42 }
43 else analysiscuts = (AliRDHFCutsD0toKpi*)filecuts->Get(cutsobjname);
44 suffix="D0";
45 break;
46 case 2:
47 cutsobjname="DStartoKpipiCuts";
48 if(stdcuts) {
49 analysiscuts = new AliRDHFCutsDStartoKpipi();
50 analysiscuts->SetStandardCutsPP2010();
51 }
52 else analysiscuts = (AliRDHFCutsDstartoKpipi*)filecuts->Get(cutsobjname);
53 suffix="Dstar";
54 break;
55 case 3:
56 cutsobjname="DstoKKpiCuts";
57 if(stdcuts) {
58 analysiscuts = new AliRDHFCutsDstoKKpi();
59 analysiscuts->SetStandardCutsPP2010();
60 }
61 else analysiscuts = (AliRDHFCutsDstoKKpi*)filecuts->Get(cutsobjname);
62 suffix="Ds";
63 break;
64 case 4:
65 cutsobjname="D0toKpipipiCuts";
66 if(stdcuts) {
67 analysiscuts = new AliRDHFCutsD0toKpipipi();
68 analysiscuts->SetStandardCutsPP2010();
69 }
70 else analysiscuts = (AliRDHFCutsD0toKpipipi*)filecuts->Get(cutsobjname);
71 suffix="D04";
72 break;
73 case 5:
74 cutsobjname="LctopKpiAnalysisCuts";
75 if(stdcuts) {
76 analysiscuts = new AliRDHFCutsLctopKpi();
77 analysiscuts->SetStandardCutsPP2010();
78 }
79 else analysiscuts = (AliRDHFCutsLctopKpi*)filecuts->Get(cutsobjname);
80 suffix="Lc";
81 break;
82 }
83
84 inname+=suffix;
85 out1name+=suffix;
86 out2name+=suffix;
87 out3name+=suffix;
88 out4name=cutsobjname;
a4ef4383 89 out5name+=suffix;
90 out6name+=suffix;
818c1271 91 out7name+=suffix;
0dbb51a0 92
93 if(!analysiscuts && filecutsname!="none"){
94 cout<<"Specific AliRDHFCuts not found"<<endl;
95 return;
96 }
a4ef4383 97
98 centr=Form("%.0f%.0f",analysiscuts->GetMinCentrality(),analysiscuts->GetMaxCentrality());
99 inname+=centr;
100 out1name+=centr;
101 out2name+=centr;
102 out3name+=centr;
103 out4name+=centr;
104 out5name+=centr;
105 out6name+=centr;
818c1271 106 out7name+=centr;
a4ef4383 107
0dbb51a0 108
109 AliAnalysisTaskSEHFQA* taskQA=new AliAnalysisTaskSEHFQA(Form("QA%s",suffix.Data()),ch,analysiscuts);
110
a4ef4383 111 taskQA->SetReadMC(readMC);
29df3603 112 taskQA->SetSimpleMode(simplemode); // set to kTRUE to go faster in PbPb
5fc4893f 113 taskQA->SetTrackOn(onoff[0]);
114 taskQA->SetPIDOn(onoff[1]);
115 taskQA->SetCentralityOn(onoff[2]);
818c1271 116 taskQA->SetEvSelectionOn(onoff[3]);
0dbb51a0 117 mgr->AddTask(taskQA);
118
119 //
120 // Create containers for input/output
121 AliAnalysisDataContainer *cinput = mgr->CreateContainer(inname,TChain::Class(), AliAnalysisManager::kInputContainer);
122 mgr->ConnectInput(taskQA,0,mgr->GetCommonInputContainer());
123
124 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(out1name,TH1F::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //events analysed
125 mgr->ConnectOutput(taskQA,1,coutput1);
126
127 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer(out2name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //PID
5fc4893f 128 if(onoff[1]) mgr->ConnectOutput(taskQA,2,coutput2);
0dbb51a0 129
130 AliAnalysisDataContainer *coutput3 = mgr->CreateContainer(out3name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of tracks
5fc4893f 131 if(onoff[0]) mgr->ConnectOutput(taskQA,3,coutput3);
0dbb51a0 132
133 AliAnalysisDataContainer *coutput4 = mgr->CreateContainer(out4name,AliRDHFCuts::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //cuts
134 mgr->ConnectOutput(taskQA,4,coutput4);
135
5fc4893f 136 AliAnalysisDataContainer *coutput5 = mgr->CreateContainer(out5name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of centrality
137 if(onoff[2]) mgr->ConnectOutput(taskQA,5,coutput5);
a4ef4383 138
5fc4893f 139 AliAnalysisDataContainer *coutput6 = mgr->CreateContainer(out6name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //quality of centrality
140 if(onoff[2]) mgr->ConnectOutput(taskQA,6,coutput6);
a4ef4383 141
818c1271 142 AliAnalysisDataContainer *coutput7 = mgr->CreateContainer(out7name,TList::Class(),AliAnalysisManager::kOutputContainer, filename.Data()); //event selection
143 if(onoff[3]) mgr->ConnectOutput(taskQA,7,coutput7);
144
0dbb51a0 145 return taskQA;
146}
5fc4893f 147