]>
Commit | Line | Data |
---|---|---|
5291a23b | 1 | // $Id$ |
2 | /* | |
3 | * Example macro to run an HLT analysis task for comparing the offline | |
4 | * with the HLT esd tree on the GRID. | |
5 | * | |
6 | * The output is a root file containing the histograms defined in the | |
7 | * analysis task. There is one output file per detector. | |
8 | * | |
9 | * Usage: | |
10 | * <pre> | |
da6744ee | 11 | * aliroot -q compare-HLT-offline-grid.C'("000115322","/alice/data/2010/LHC10b","ESDcomparison","output","full","global")' |
57a6a985 | 12 | * </pre> |
4d1e4179 | 13 | * - run number |
14 | * - GRID input directory, where you define in which LHC period the run number belongs to | |
15 | * - GRID working directory, where the .xml, .jdl and the task are uploaded (you have to create it yourself in advance) | |
16 | * - GRID output directory with respect to the working one, where the output files of the task are located (you have to create it yourself in advance) | |
17 | * - run in full mode, i.e. completely on the GRID with all the chunks of the run processed | |
18 | * - specify the analysis task you want to run | |
5291a23b | 19 | * |
b71630ca | 20 | * @ingroup alihlt_qa |
5291a23b | 21 | * @author zbyin@mail.ccnu.edu.cn, Kalliopi.Kanaki@ift.uib.no |
22 | */ | |
23 | ||
12cc7125 | 24 | void compare_HLT_offline_grid(TString runNumber, TString dataDir, TString gridWorkingDir, TString gridOutputDir, const char* mode = "full", const char* detectorTask="global"){ |
5291a23b | 25 | |
26 | TStopwatch timer; | |
27 | timer.Start(); | |
28 | ||
12cc7125 | 29 | //gSystem->Load("libTree"); |
30 | gSystem->Load("libCore"); | |
ca6554da | 31 | gSystem->Load("libGeom"); |
32 | gSystem->Load("libVMC"); | |
33 | gSystem->Load("libPhysics"); | |
5291a23b | 34 | |
35 | //----------- Loading the required libraries ---------// | |
36 | ||
ca6554da | 37 | gSystem->Load("libSTEERBase"); |
38 | gSystem->Load("libESD"); | |
39 | gSystem->Load("libAOD"); | |
40 | gSystem->Load("libANALYSIS"); | |
41 | gSystem->Load("libANALYSISalice"); | |
42 | gSystem->Load("libHLTbase"); | |
5291a23b | 43 | gROOT->ProcessLine(".include $ALICE_ROOT/include"); |
da6744ee | 44 | gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C"); |
5291a23b | 45 | |
46 | ||
6b17ceb5 | 47 | Bool_t bAll=kFALSE, bTPC=kFALSE, bPHOS=kFALSE, bEMCAL=kFALSE, bITS=kFALSE, bGLOBAL=kFALSE; |
5291a23b | 48 | |
49 | TString allArgs = detectorTask; | |
50 | TString argument; | |
51 | ||
52 | TObjArray *pTokens = allArgs.Tokenize(" "); | |
53 | if(pTokens){ | |
54 | for(int i=0; i<pTokens->GetEntries(); i++){ | |
55 | argument=((TObjString*)pTokens->At(i))->GetString(); | |
56 | if(argument.IsNull()) continue; | |
57 | ||
58 | if(argument.CompareTo("tpc", TString::kIgnoreCase)==0){ | |
59 | bTPC = kTRUE; | |
60 | continue; | |
6b17ceb5 | 61 | } |
5291a23b | 62 | if(argument.CompareTo("phos", TString::kIgnoreCase)==0){ |
63 | bPHOS = kTRUE; | |
64 | continue; | |
6b17ceb5 | 65 | } |
66 | if(argument.CompareTo("emcal", TString::kIgnoreCase)==0){ | |
67 | bEMCAL = kTRUE; | |
68 | continue; | |
5291a23b | 69 | } |
70 | if(argument.CompareTo("its", TString::kIgnoreCase)==0){ | |
71 | bITS = kTRUE; | |
72 | continue; | |
73 | } | |
74 | if(argument.CompareTo("global", TString::kIgnoreCase)==0){ | |
75 | bGLOBAL = kTRUE; | |
76 | continue; | |
77 | } | |
78 | if(argument.CompareTo("all",TString::kIgnoreCase)==0){ | |
79 | bTPC = kTRUE; | |
80 | bPHOS = kTRUE; | |
6b17ceb5 | 81 | bEMCAL = kTRUE; |
5291a23b | 82 | bITS = kTRUE; |
83 | bGLOBAL = kTRUE; | |
84 | bAll = kTRUE; | |
85 | continue; | |
86 | } | |
87 | else break; | |
88 | } | |
89 | } | |
90 | ||
91 | //-------- Make the analysis manager ---------------// | |
92 | ||
93 | AliAnalysisManager *mgr = new AliAnalysisManager("TestManager"); | |
94 | AliESDInputHandler *esdH = new AliESDInputHandler; | |
95 | esdH->SetReadHLT(); | |
fcf71d87 | 96 | esdH->SetReadFriends(kFALSE); |
5291a23b | 97 | mgr->SetInputEventHandler(esdH); |
98 | mgr->SetNSysInfo(1000); | |
da6744ee | 99 | |
100 | //To use Physics Selection | |
101 | AliPhysicsSelectionTask* physSelTask =AddTaskPhysicsSelection(kFALSE,kTRUE); | |
5291a23b | 102 | |
103 | // Create and configure the alien handler plugin | |
104 | gROOT->LoadMacro("CreateAlienHandler.C"); | |
12cc7125 | 105 | AliAnalysisGrid *alienHandler = CreateAlienHandler(runNumber, dataDir, gridWorkingDir, gridOutputDir, mode, detectorTask); |
5291a23b | 106 | if (!alienHandler) return; |
107 | ||
108 | // Connect plugin to the analysis manager | |
109 | mgr->SetGridHandler(alienHandler); | |
110 | ||
111 | //-------------- Compile the analysis tasks ---------- // | |
112 | if(bTPC) gROOT->LoadMacro("AliAnalysisTaskHLTTPC.cxx+"); | |
2378381e | 113 | if(bPHOS && bEMCAL) { |
114 | AliHLTSystem * pHLT = AliHLTPluginBase::GetInstance(); | |
115 | pHLT->LoadComponentLibraries("libHLTbase"); | |
116 | pHLT->LoadComponentLibraries("libAliHLTUtil"); | |
117 | pHLT->LoadComponentLibraries("libAliHLTGlobal"); | |
118 | gROOT->LoadMacro("AliAnalysisTaskHLTCalo.cxx+"); | |
119 | gROOT->LoadMacro("AliAnalysisTaskHLTPHOS.cxx+"); | |
120 | gROOT->LoadMacro("AliAnalysisTaskHLTEMCAL.cxx+"); | |
121 | ||
122 | } | |
123 | else if(bPHOS) { | |
b29e3c94 | 124 | AliHLTSystem * pHLT = AliHLTPluginBase::GetInstance(); |
125 | pHLT->LoadComponentLibraries("libHLTbase"); | |
126 | pHLT->LoadComponentLibraries("libAliHLTUtil"); | |
127 | pHLT->LoadComponentLibraries("libAliHLTGlobal"); | |
128 | gROOT->LoadMacro("AliAnalysisTaskHLTCalo.cxx+"); | |
129 | gROOT->LoadMacro("AliAnalysisTaskHLTPHOS.cxx+"); | |
130 | } | |
2378381e | 131 | else if(bEMCAL) { |
6b17ceb5 | 132 | AliHLTSystem * pHLT = AliHLTPluginBase::GetInstance(); |
133 | pHLT->LoadComponentLibraries("libHLTbase"); | |
134 | pHLT->LoadComponentLibraries("libAliHLTUtil"); | |
135 | pHLT->LoadComponentLibraries("libAliHLTGlobal"); | |
136 | gROOT->LoadMacro("AliAnalysisTaskHLTCalo.cxx+"); | |
137 | gROOT->LoadMacro("AliAnalysisTaskHLTEMCAL.cxx+"); | |
138 | } | |
5291a23b | 139 | if(bITS) gROOT->LoadMacro("AliAnalysisTaskHLTITS.cxx+"); |
140 | if(bGLOBAL) gROOT->LoadMacro("AliAnalysisTaskHLT.cxx+"); | |
141 | ||
142 | ||
143 | //-------------- define the tasks ------------// | |
144 | ||
145 | if(bTPC){ | |
146 | AliAnalysisTaskHLTTPC *taskTPC = new AliAnalysisTaskHLTTPC("offhlt_comparison_TPC"); | |
147 | mgr->AddTask(taskTPC); | |
148 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tpc_histograms", TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-TPC-comparison.root"); | |
149 | mgr->ConnectInput(taskTPC,0,mgr->GetCommonInputContainer()); | |
150 | mgr->ConnectOutput(taskTPC,1,coutput1); | |
151 | } | |
152 | ||
153 | if(bPHOS){ | |
154 | AliAnalysisTaskHLTPHOS *taskPHOS = new AliAnalysisTaskHLTPHOS("offhlt_comparison_PHOS"); | |
155 | mgr->AddTask(taskPHOS); | |
156 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("phos_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-PHOS-comparison.root"); | |
157 | mgr->ConnectInput(taskPHOS,0,mgr->GetCommonInputContainer()); | |
158 | mgr->ConnectOutput(taskPHOS,1,coutput2); | |
159 | } | |
6b17ceb5 | 160 | if(bEMCAL){ |
161 | AliAnalysisTaskHLTEMCAL *taskEMCAL = new AliAnalysisTaskHLTEMCAL("offhlt_comparison_EMCAL"); | |
162 | mgr->AddTask(taskEMCAL); | |
163 | AliAnalysisDataContainer *coutput5 = mgr->CreateContainer("emcal_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-EMCAL-comparison.root"); | |
164 | mgr->ConnectInput(taskEMCAL,0,mgr->GetCommonInputContainer()); | |
165 | mgr->ConnectOutput(taskEMCAL,1,coutput5); | |
166 | } | |
5291a23b | 167 | |
168 | if(bITS){ | |
169 | AliAnalysisTaskHLTITS *taskITS = new AliAnalysisTaskHLTITS("offhlt_comparison_ITS"); | |
170 | mgr->AddTask(taskITS); | |
171 | AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("its_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-ITS-comparison.root"); | |
172 | mgr->ConnectInput(taskITS,0,mgr->GetCommonInputContainer()); | |
173 | mgr->ConnectOutput(taskITS,1,coutput3); | |
174 | } | |
175 | ||
176 | if(bGLOBAL){ | |
177 | AliAnalysisTaskHLT *taskGLOBAL = new AliAnalysisTaskHLT("offhlt_comparison_GLOBAL"); | |
da6744ee | 178 | taskGLOBAL->SelectCollisionCandidates(); |
5291a23b | 179 | mgr->AddTask(taskGLOBAL); |
180 | AliAnalysisDataContainer *coutput4 = mgr->CreateContainer("global_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-GLOBAL-comparison.root"); | |
181 | mgr->ConnectInput(taskGLOBAL,0,mgr->GetCommonInputContainer()); | |
182 | mgr->ConnectOutput(taskGLOBAL,1,coutput4); | |
183 | } | |
184 | ||
185 | // Enable debug printouts | |
186 | mgr->SetDebugLevel(2); | |
187 | ||
188 | if (!mgr->InitAnalysis()) return; | |
189 | mgr->PrintStatus(); | |
190 | mgr->StartAnalysis("grid"); | |
191 | ||
192 | timer.Stop(); | |
193 | timer.Print(); | |
194 | } |