- add option for the user to switch on and off the detector tasks. If no argument...
[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
43 Bool_t bAll=kFALSE, bTPC=kFALSE, bPHOS=kFALSE;
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;
57 }
58
59 if(argument.CompareTo("phos", TString::kIgnoreCase)==0){
60 bPHOS = kTRUE;
61 continue;
62 }
63
64 if(argument.CompareTo("all",TString::kIgnoreCase)==0){
65 bTPC = kTRUE;
66 bPHOS = kTRUE;
67 bAll = kTRUE;
68 continue;
69 }
70 else break;
71 }
72 }
73
be1fa04a 74
7742dbd5 75 //-------------- Compile the analysis tasks ---------- //
76 if(bTPC) gROOT->LoadMacro("AliAnalysisTaskHLTTPC.cxx+");
77 if(bPHOS) gROOT->LoadMacro("AliAnalysisTaskHLTPHOS.cxx+");
be1fa04a 78
79
80 AliTagAnalysis *TagAna = new AliTagAnalysis("ESD");
81 //TagAna->ChainLocalTags("../Tags");
82
83// AliRunTagCuts *runCuts = new AliRunTagCuts();
84// AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
85// AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
86// AliEventTagCuts *evCuts = new AliEventTagCuts();
87// evCuts->SetMultiplicityRange(11,12);
88
89
90 TChain *chain = 0x0;
91 //chain = TagAna->QueryTags(runCuts,lhcCuts,detCuts,evCuts);
92 chain = new TChain("esdTree");
93
94 //gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
95 //chain = CreateESDChain("esd_run84254.txt", 2);
96
97 //chain->Add("/afs/.alihlt.cern.ch/public/rec/79876/AliESDs.root");
98 //chain->Add("/opt/HLT-public/rec/83683/rec/09000083683000.10/AliESDs.root");
99
100 //chain->Add("/opt/HLT-public/rec/82762/ESDs/pass1/09000082762002.10/AliESDs.root");
101 //chain->Add("/opt/HLT-public/rec/82762/ESDs/pass1/09000082762004.10/AliESDs.root");
102 //chain->Add("/opt/HLT-public/rec/82762/ESDs/pass1/09000082762005.10/AliESDs.root");
103 //chain->Add("/opt/HLT-public/rec/82762/ESDs/pass1/09000082762006.10/AliESDs.root");
104
105 //chain->Add("/opt/HLT-public/rec/84254/alien/09000084254009.200/AliESDs.root");
106 //chain->Add("/opt/HLT-public/rec/84254/alien/09000084254009.40/AliESDs.root");
107 //chain->Add("/opt/HLT-public/rec/84254/alien/09000084254009.10/AliESDs.root");
108
109 chain->Add("~/7TeV/115322/10000115322040.110/AliESDs.root");
110 //chain->SetBranchStatus("*Calo*",0);
111
112
113 //-------- Make the analysis manager ---------------//
114
115 AliAnalysisManager *mgr = new AliAnalysisManager("TestManager");
116 AliESDInputHandler *esdH = new AliESDInputHandler;
117 esdH->SetReadHLT();
118 mgr->SetInputEventHandler(esdH);
119 mgr->SetNSysInfo(1000);
120
121 //-------------- define the tasks ------------//
122
7742dbd5 123 if(bTPC){
124 AliAnalysisTaskHLTTPC *taskTPC = new AliAnalysisTaskHLTTPC("offhlt_comparison_TPC");
125 mgr->AddTask(taskTPC);
126 AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tpc_histograms", TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-TPC-comparison.root");
127 mgr->ConnectInput(taskTPC,0,mgr->GetCommonInputContainer());
128 //mgr->ConnectOutput (taskTPC, 0, mgr->GetCommonOutputContainer());
129 mgr->ConnectOutput(taskTPC,1,coutput1);
130 }
be1fa04a 131
7742dbd5 132 if(bPHOS){
133 AliAnalysisTaskHLTPHOS *taskPHOS = new AliAnalysisTaskHLTPHOS("offhlt_comparison_PHOS");
134 mgr->AddTask(taskPHOS);
135 AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("phos_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-PHOS-comparison.root");
136 mgr->ConnectInput(taskPHOS,0,mgr->GetCommonInputContainer());
137 mgr->ConnectOutput(taskPHOS,1,coutput2);
138 }
a63c69d8 139
be1fa04a 140 if (!mgr->InitAnalysis()) return;
141 mgr->PrintStatus();
142 mgr->StartAnalysis("local",chain);
143
144 timer.Stop();
145 timer.Print();
146}