remove confusing setter for MC
[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
d4598f43 12 * aliroot -b -q -l compare_HLT_offline_local.C'("phos tpc global")' 2>&1 | tee task.log
be1fa04a 13 * aliroot -b -q -l compare_HLT_offline_local.C 2>&1 | tee task.log
14 * </pre>
15 *
3efff739 16 * If no argument is specified, the global task is run.
7742dbd5 17 *
b71630ca 18 * @ingroup alihlt_qa
be1fa04a 19 * @author zbyin@mail.ccnu.edu.cn, Kalliopi.Kanaki@ift.uib.no
20 */
21
064730e4 22void compare_HLT_offline_local(const char* detectorTask="global"){
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
064730e4 43 Bool_t 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;
7742dbd5 75 continue;
76 }
77 else break;
78 }
79 }
80
be1fa04a 81
7742dbd5 82 //-------------- Compile the analysis tasks ---------- //
db575e59 83 if(bTPC) gROOT->LoadMacro("AliAnalysisTaskHLTTPC.cxx+");
84 if(bPHOS) gROOT->LoadMacro("AliAnalysisTaskHLTPHOS.cxx+");
85 if(bITS) gROOT->LoadMacro("AliAnalysisTaskHLTITS.cxx+");
86 if(bGLOBAL) gROOT->LoadMacro("AliAnalysisTaskHLT.cxx+");
064730e4 87
3efff739 88 //TGrid::Connect("alien://");
be1fa04a 89
d4598f43 90 TChain *chain = new TChain("esdTree");
3efff739 91 //chain->Add("alien:///alice/data/2010/LHC10b/000115322/ESDs/pass1/10000115322040.20/AliESDs.root");
064730e4 92
b71630ca 93 chain->Add("AliESDs.root");
94 //chain->Add("~/7TeV/115322/10000115322040.110/AliESDs.root");
d4598f43 95 //chain->Add("...");
96
be1fa04a 97 //-------- Make the analysis manager ---------------//
98
99 AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
100 AliESDInputHandler *esdH = new AliESDInputHandler;
101 esdH->SetReadHLT();
102 mgr->SetInputEventHandler(esdH);
103 mgr->SetNSysInfo(1000);
104
105 //-------------- define the tasks ------------//
106
7742dbd5 107 if(bTPC){
108 AliAnalysisTaskHLTTPC *taskTPC = new AliAnalysisTaskHLTTPC("offhlt_comparison_TPC");
109 mgr->AddTask(taskTPC);
110 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tpc_histograms", TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-TPC-comparison.root");
111 mgr->ConnectInput(taskTPC,0,mgr->GetCommonInputContainer());
7742dbd5 112 mgr->ConnectOutput(taskTPC,1,coutput1);
113 }
be1fa04a 114
7742dbd5 115 if(bPHOS){
116 AliAnalysisTaskHLTPHOS *taskPHOS = new AliAnalysisTaskHLTPHOS("offhlt_comparison_PHOS");
117 mgr->AddTask(taskPHOS);
118 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("phos_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-PHOS-comparison.root");
119 mgr->ConnectInput(taskPHOS,0,mgr->GetCommonInputContainer());
120 mgr->ConnectOutput(taskPHOS,1,coutput2);
121 }
a63c69d8 122
89ad7eb5 123 if(bITS){
124 AliAnalysisTaskHLTITS *taskITS = new AliAnalysisTaskHLTITS("offhlt_comparison_ITS");
125 mgr->AddTask(taskITS);
126 AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("its_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-ITS-comparison.root");
127 mgr->ConnectInput(taskITS,0,mgr->GetCommonInputContainer());
128 mgr->ConnectOutput(taskITS,1,coutput3);
129 }
db575e59 130
131 if(bGLOBAL){
132 AliAnalysisTaskHLT *taskGLOBAL = new AliAnalysisTaskHLT("offhlt_comparison_GLOBAL");
133 mgr->AddTask(taskGLOBAL);
134 AliAnalysisDataContainer *coutput4 = mgr->CreateContainer("global_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-GLOBAL-comparison.root");
135 mgr->ConnectInput(taskGLOBAL,0,mgr->GetCommonInputContainer());
136 mgr->ConnectOutput(taskGLOBAL,1,coutput4);
137 }
89ad7eb5 138
be1fa04a 139 if (!mgr->InitAnalysis()) return;
140 mgr->PrintStatus();
141 mgr->StartAnalysis("local",chain);
142
143 timer.Stop();
144 timer.Print();
145}