- fixed momentum range for dEdx
[u/mrichter/AliRoot.git] / HLT / QA / tasks / macros / compare-HLT-offline-local.C
CommitLineData
be1fa04a 1// $Id$
2/*
3 * Example macro to run locally an analysis task for comparing the offline
4 * with the HLT esd tree.
5 *
7742dbd5 6 * The output is a root file containing the histograms defined in the
7 * analysis task. There is one output file per detector.
be1fa04a 8 *
9 * Usage:
10 * <pre>
7742dbd5 11 * aliroot -b -q -l compare_HLT_offline_local.C'("phos")' 2>&1 | tee task.log
12 * aliroot -b -q -l compare_HLT_offline_local.C'("phos tpc")' 2>&1 | tee task.log
be1fa04a 13 * aliroot -b -q -l compare_HLT_offline_local.C 2>&1 | tee task.log
14 * </pre>
15 *
7742dbd5 16 * If no argument is specified, ALL detector tasks are run.
17 *
be1fa04a 18 * @ingroup alihlt_tpc
19 * @author zbyin@mail.ccnu.edu.cn, Kalliopi.Kanaki@ift.uib.no
20 */
21
7742dbd5 22void compare_HLT_offline_local(const char* detectorTask="all"){
be1fa04a 23
24 TStopwatch timer;
25 timer.Start();
26
27 gSystem->Load("libTree.so");
28 gSystem->Load("libGeom.so");
29 gSystem->Load("libVMC.so");
30 gSystem->Load("libPhysics.so");
31
32 //----------- Loading the required libraries ---------//
33
34 gSystem->Load("libSTEERBase.so");
35 gSystem->Load("libESD.so");
36 gSystem->Load("libAOD.so");
37 gSystem->Load("libANALYSIS.so");
38 gSystem->Load("libANALYSISalice.so");
39 gSystem->Load("libHLTbase.so");
40 gROOT->ProcessLine(".include $ALICE_ROOT/include");
41
7742dbd5 42
db575e59 43 Bool_t bAll=kFALSE, bTPC=kFALSE, bPHOS=kFALSE, bITS=kFALSE, bGLOBAL=kFALSE;
7742dbd5 44
45 TString allArgs = detectorTask;
46 TString argument;
47
48 TObjArray *pTokens = allArgs.Tokenize(" ");
49 if(pTokens){
50 for(int i=0; i<pTokens->GetEntries(); i++){
51 argument=((TObjString*)pTokens->At(i))->GetString();
52 if(argument.IsNull()) continue;
be1fa04a 53
7742dbd5 54 if(argument.CompareTo("tpc", TString::kIgnoreCase)==0){
55 bTPC = kTRUE;
56 continue;
db575e59 57 }
7742dbd5 58 if(argument.CompareTo("phos", TString::kIgnoreCase)==0){
59 bPHOS = kTRUE;
60 continue;
db575e59 61 }
89ad7eb5 62 if(argument.CompareTo("its", TString::kIgnoreCase)==0){
63 bITS = kTRUE;
64 continue;
db575e59 65 }
66 if(argument.CompareTo("global", TString::kIgnoreCase)==0){
67 bGLOBAL = kTRUE;
68 continue;
69 }
7742dbd5 70 if(argument.CompareTo("all",TString::kIgnoreCase)==0){
db575e59 71 bTPC = kTRUE;
72 bPHOS = kTRUE;
73 bITS = kTRUE;
74 bGLOBAL = kTRUE;
75 bAll = kTRUE;
7742dbd5 76 continue;
77 }
78 else break;
79 }
80 }
81
be1fa04a 82
7742dbd5 83 //-------------- Compile the analysis tasks ---------- //
db575e59 84 if(bTPC) gROOT->LoadMacro("AliAnalysisTaskHLTTPC.cxx+");
85 if(bPHOS) gROOT->LoadMacro("AliAnalysisTaskHLTPHOS.cxx+");
86 if(bITS) gROOT->LoadMacro("AliAnalysisTaskHLTITS.cxx+");
87 if(bGLOBAL) gROOT->LoadMacro("AliAnalysisTaskHLT.cxx+");
be1fa04a 88
89
90 AliTagAnalysis *TagAna = new AliTagAnalysis("ESD");
91 //TagAna->ChainLocalTags("../Tags");
92
93// AliRunTagCuts *runCuts = new AliRunTagCuts();
94// AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
95// AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
96// AliEventTagCuts *evCuts = new AliEventTagCuts();
97// evCuts->SetMultiplicityRange(11,12);
98
99
100 TChain *chain = 0x0;
101 //chain = TagAna->QueryTags(runCuts,lhcCuts,detCuts,evCuts);
102 chain = new TChain("esdTree");
103
104 //gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
105 //chain = CreateESDChain("esd_run84254.txt", 2);
106
107 //chain->Add("/afs/.alihlt.cern.ch/public/rec/79876/AliESDs.root");
108 //chain->Add("/opt/HLT-public/rec/83683/rec/09000083683000.10/AliESDs.root");
109
110 //chain->Add("/opt/HLT-public/rec/82762/ESDs/pass1/09000082762002.10/AliESDs.root");
111 //chain->Add("/opt/HLT-public/rec/82762/ESDs/pass1/09000082762004.10/AliESDs.root");
112 //chain->Add("/opt/HLT-public/rec/82762/ESDs/pass1/09000082762005.10/AliESDs.root");
113 //chain->Add("/opt/HLT-public/rec/82762/ESDs/pass1/09000082762006.10/AliESDs.root");
114
115 //chain->Add("/opt/HLT-public/rec/84254/alien/09000084254009.200/AliESDs.root");
116 //chain->Add("/opt/HLT-public/rec/84254/alien/09000084254009.40/AliESDs.root");
117 //chain->Add("/opt/HLT-public/rec/84254/alien/09000084254009.10/AliESDs.root");
118
119 chain->Add("~/7TeV/115322/10000115322040.110/AliESDs.root");
120 //chain->SetBranchStatus("*Calo*",0);
121
122
123 //-------- Make the analysis manager ---------------//
124
125 AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
126 AliESDInputHandler *esdH = new AliESDInputHandler;
127 esdH->SetReadHLT();
128 mgr->SetInputEventHandler(esdH);
129 mgr->SetNSysInfo(1000);
130
131 //-------------- define the tasks ------------//
132
7742dbd5 133 if(bTPC){
134 AliAnalysisTaskHLTTPC *taskTPC = new AliAnalysisTaskHLTTPC("offhlt_comparison_TPC");
135 mgr->AddTask(taskTPC);
136 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tpc_histograms", TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-TPC-comparison.root");
137 mgr->ConnectInput(taskTPC,0,mgr->GetCommonInputContainer());
138 //mgr->ConnectOutput (taskTPC, 0, mgr->GetCommonOutputContainer());
139 mgr->ConnectOutput(taskTPC,1,coutput1);
140 }
be1fa04a 141
7742dbd5 142 if(bPHOS){
143 AliAnalysisTaskHLTPHOS *taskPHOS = new AliAnalysisTaskHLTPHOS("offhlt_comparison_PHOS");
144 mgr->AddTask(taskPHOS);
145 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("phos_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-PHOS-comparison.root");
146 mgr->ConnectInput(taskPHOS,0,mgr->GetCommonInputContainer());
147 mgr->ConnectOutput(taskPHOS,1,coutput2);
148 }
a63c69d8 149
89ad7eb5 150 if(bITS){
151 AliAnalysisTaskHLTITS *taskITS = new AliAnalysisTaskHLTITS("offhlt_comparison_ITS");
152 mgr->AddTask(taskITS);
153 AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("its_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-ITS-comparison.root");
154 mgr->ConnectInput(taskITS,0,mgr->GetCommonInputContainer());
155 mgr->ConnectOutput(taskITS,1,coutput3);
156 }
db575e59 157
158 if(bGLOBAL){
159 AliAnalysisTaskHLT *taskGLOBAL = new AliAnalysisTaskHLT("offhlt_comparison_GLOBAL");
160 mgr->AddTask(taskGLOBAL);
161 AliAnalysisDataContainer *coutput4 = mgr->CreateContainer("global_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-GLOBAL-comparison.root");
162 mgr->ConnectInput(taskGLOBAL,0,mgr->GetCommonInputContainer());
163 mgr->ConnectOutput(taskGLOBAL,1,coutput4);
164 }
89ad7eb5 165
be1fa04a 166 if (!mgr->InitAnalysis()) return;
167 mgr->PrintStatus();
168 mgr->StartAnalysis("local",chain);
169
170 timer.Stop();
171 timer.Print();
172}