]>
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 | |
2c7cd1be | 15 | * - GRID working directory, where the .xml, .jdl and the task are uploaded |
16 | * - GRID output directory with respect to the working one, where the output files of the task are located | |
4d1e4179 | 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 | |
1daea170 | 19 | * - specify the path where the task is located, by default it takes $ALICE_ROOT/HLT/QA/tasks |
53482c1f | 20 | * - specify the beam type |
21 | * - specify which THnSparse objects you want to have filled | |
4b621d9c | 22 | * - specify whether you are interested only in HLT triggered events |
2c7cd1be | 23 | * - specify how many events you want to analyze |
5291a23b | 24 | * |
b71630ca | 25 | * @ingroup alihlt_qa |
4b621d9c | 26 | * @author Hege.Erdal@student.uib.no, Kalliopi.Kanaki@ift.uib.no |
5291a23b | 27 | */ |
28 | ||
184b64eb | 29 | void compare_HLT_offline_grid( TString runNumber |
30 | ,TString dataDir | |
31 | ,TString gridWorkingDir | |
32 | ,TString gridOutputDir | |
33 | ,const char* mode = "full" | |
34 | ,const char* detectorTask="global" | |
35 | ,TString taskFolder="$ALICE_ROOT/HLT/QA/tasks/" | |
36 | ,TString beamType="p-p" | |
37 | ,TString options="event-off event-hlt track-off track-hlt" | |
38 | ,bool fUseHLTTrigger=kFALSE | |
39 | ,Long64_t nEvents=1234567890 | |
4b621d9c | 40 | ) |
41 | { | |
5291a23b | 42 | |
43 | TStopwatch timer; | |
44 | timer.Start(); | |
45 | ||
12cc7125 | 46 | //gSystem->Load("libTree"); |
47 | gSystem->Load("libCore"); | |
ca6554da | 48 | gSystem->Load("libGeom"); |
49 | gSystem->Load("libVMC"); | |
50 | gSystem->Load("libPhysics"); | |
5291a23b | 51 | |
52 | //----------- Loading the required libraries ---------// | |
53 | ||
ca6554da | 54 | gSystem->Load("libSTEERBase"); |
55 | gSystem->Load("libESD"); | |
56 | gSystem->Load("libAOD"); | |
57 | gSystem->Load("libANALYSIS"); | |
58 | gSystem->Load("libANALYSISalice"); | |
59 | gSystem->Load("libHLTbase"); | |
9a49afed | 60 | gROOT->ProcessLine(".include $ALICE_ROOT/include"); |
0e76c8bc | 61 | gSystem->AddIncludePath("-I$ALICE_ROOT/HLT/BASE -I. -I$ALICE_ROOT/STEER -I$ALICE_ROOT/ANALYSIS"); |
63b6cbd0 | 62 | //gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskPhysicsSelection.C"); |
5291a23b | 63 | |
64 | ||
184b64eb | 65 | Bool_t bTPC=kFALSE, bPHOS=kFALSE, bEMCAL=kFALSE, bGLOBAL=kFALSE, bD0=kFALSE, bCB=kFALSE; |
5291a23b | 66 | |
67 | TString allArgs = detectorTask; | |
68 | TString argument; | |
69 | ||
70 | TObjArray *pTokens = allArgs.Tokenize(" "); | |
71 | if(pTokens){ | |
72 | for(int i=0; i<pTokens->GetEntries(); i++){ | |
73 | argument=((TObjString*)pTokens->At(i))->GetString(); | |
74 | if(argument.IsNull()) continue; | |
75 | ||
5291a23b | 76 | if(argument.CompareTo("phos", TString::kIgnoreCase)==0){ |
77 | bPHOS = kTRUE; | |
78 | continue; | |
6b17ceb5 | 79 | } |
80 | if(argument.CompareTo("emcal", TString::kIgnoreCase)==0){ | |
81 | bEMCAL = kTRUE; | |
82 | continue; | |
5291a23b | 83 | } |
5291a23b | 84 | if(argument.CompareTo("global", TString::kIgnoreCase)==0){ |
85 | bGLOBAL = kTRUE; | |
86 | continue; | |
cd785861 | 87 | } |
88 | if(argument.CompareTo("D0", TString::kIgnoreCase)==0){ | |
89 | bD0 = kTRUE; | |
90 | continue; | |
91 | } | |
9a49afed | 92 | if(argument.CompareTo("cb", TString::kIgnoreCase)==0){ |
78dbc30d | 93 | bCB = kTRUE; |
94 | continue; | |
95 | } | |
5291a23b | 96 | else break; |
97 | } | |
98 | } | |
99 | ||
100 | //-------- Make the analysis manager ---------------// | |
101 | ||
102 | AliAnalysisManager *mgr = new AliAnalysisManager("TestManager"); | |
103 | AliESDInputHandler *esdH = new AliESDInputHandler; | |
104 | esdH->SetReadHLT(); | |
fcf71d87 | 105 | esdH->SetReadFriends(kFALSE); |
5291a23b | 106 | mgr->SetInputEventHandler(esdH); |
107 | mgr->SetNSysInfo(1000); | |
da6744ee | 108 | |
109 | //To use Physics Selection | |
4b621d9c | 110 | //AliPhysicsSelectionTask *physSelTask = AddTaskPhysicsSelection(kFALSE,kTRUE); |
111 | ||
5291a23b | 112 | // Create and configure the alien handler plugin |
62a84e27 | 113 | gROOT->LoadMacro("$ALICE_ROOT/HLT/QA/tasks/macros/CreateAlienHandler.C"); |
12cc7125 | 114 | AliAnalysisGrid *alienHandler = CreateAlienHandler(runNumber, dataDir, gridWorkingDir, gridOutputDir, mode, detectorTask); |
5291a23b | 115 | if (!alienHandler) return; |
116 | ||
117 | // Connect plugin to the analysis manager | |
118 | mgr->SetGridHandler(alienHandler); | |
119 | ||
120 | //-------------- Compile the analysis tasks ---------- // | |
2378381e | 121 | if(bPHOS && bEMCAL) { |
9a49afed | 122 | gSystem->Load("libHLTbase"); |
123 | gSystem->Load("libAliHLTUtil"); | |
124 | gSystem->Load("libAliHLTGlobal"); | |
125 | TString strTask1("AliAnalysisTaskHLTCalo.cxx+"); | |
126 | TString strTask2("AliAnalysisTaskHLTPHOS.cxx+"); | |
127 | TString strTask3("AliAnalysisTaskHLTEMCAL.cxx+"); | |
128 | gROOT->LoadMacro(taskFolder+strTask1); | |
129 | gROOT->LoadMacro(taskFolder+strTask2); | |
130 | gROOT->LoadMacro(taskFolder+strTask3); | |
2378381e | 131 | } |
132 | else if(bPHOS) { | |
9a49afed | 133 | gSystem->Load("libHLTbase"); |
134 | gSystem->Load("libAliHLTUtil"); | |
135 | gSystem->Load("libAliHLTGlobal"); | |
136 | TString strTask1("AliAnalysisTaskHLTCalo.cxx+"); | |
137 | TString strTask2("AliAnalysisTaskHLTPHOS.cxx+"); | |
138 | gROOT->LoadMacro(taskFolder+strTask1); | |
139 | gROOT->LoadMacro(taskFolder+strTask2); | |
b29e3c94 | 140 | } |
2378381e | 141 | else if(bEMCAL) { |
9a49afed | 142 | gSystem->Load("libHLTbase"); |
143 | gSystem->Load("libAliHLTUtil"); | |
144 | gSystem->Load("libAliHLTGlobal"); | |
145 | TString strTask1("AliAnalysisTaskHLTCalo.cxx+"); | |
146 | TString strTask2("AliAnalysisTaskHLTEMCAL.cxx+"); | |
147 | gROOT->LoadMacro(taskFolder+strTask1); | |
148 | gROOT->LoadMacro(taskFolder+strTask2); | |
149 | } | |
150 | if(bGLOBAL){ | |
151 | TString strTask("AliAnalysisTaskHLT.cxx+"); | |
152 | gROOT->LoadMacro(taskFolder+strTask); | |
6b17ceb5 | 153 | } |
9a49afed | 154 | if(bD0){ |
155 | TString strTask("AliAnalysisTaskD0Trigger.cxx+"); | |
156 | gROOT->LoadMacro(taskFolder+strTask); | |
157 | } | |
158 | if(bCB){ | |
159 | TString strTask("AliAnalysisTaskHLTCentralBarrel.cxx+"); | |
160 | gROOT->LoadMacro(taskFolder+strTask); | |
161 | } | |
162 | ||
5291a23b | 163 | //-------------- define the tasks ------------// |
164 | ||
5291a23b | 165 | if(bPHOS){ |
166 | AliAnalysisTaskHLTPHOS *taskPHOS = new AliAnalysisTaskHLTPHOS("offhlt_comparison_PHOS"); | |
167 | mgr->AddTask(taskPHOS); | |
4b621d9c | 168 | AliAnalysisDataContainer *coutputPHOS = mgr->CreateContainer("phos_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-PHOS-comparison.root"); |
5291a23b | 169 | mgr->ConnectInput(taskPHOS,0,mgr->GetCommonInputContainer()); |
4b621d9c | 170 | mgr->ConnectOutput(taskPHOS,1,coutputPHOS); |
5291a23b | 171 | } |
6b17ceb5 | 172 | if(bEMCAL){ |
173 | AliAnalysisTaskHLTEMCAL *taskEMCAL = new AliAnalysisTaskHLTEMCAL("offhlt_comparison_EMCAL"); | |
174 | mgr->AddTask(taskEMCAL); | |
4b621d9c | 175 | AliAnalysisDataContainer *coutputEMCAL = mgr->CreateContainer("emcal_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-EMCAL-comparison.root"); |
6b17ceb5 | 176 | mgr->ConnectInput(taskEMCAL,0,mgr->GetCommonInputContainer()); |
4b621d9c | 177 | mgr->ConnectOutput(taskEMCAL,1,coutputEMCAL); |
6b17ceb5 | 178 | } |
5291a23b | 179 | |
5291a23b | 180 | if(bGLOBAL){ |
181 | AliAnalysisTaskHLT *taskGLOBAL = new AliAnalysisTaskHLT("offhlt_comparison_GLOBAL"); | |
4b621d9c | 182 | taskGLOBAL->SetUseHLTTriggerDecision(fUseHLTTrigger); |
183 | if(fUseHLTTrigger==kTRUE) printf("\n\nOnly HLT triggered events will be used to fill the distributions for task %s.\n\n", taskGLOBAL->GetName()); | |
184 | //taskGLOBAL->SelectCollisionCandidates(); | |
5291a23b | 185 | mgr->AddTask(taskGLOBAL); |
78e2a8dc | 186 | if(fUseHLTTrigger==kFALSE) |
4b621d9c | 187 | AliAnalysisDataContainer *coutputGLOBAL = mgr->CreateContainer("global_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-GLOBAL-comparison.root"); |
188 | else | |
189 | AliAnalysisDataContainer *coutputGLOBAL = mgr->CreateContainer("global_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-GLOBAL-comparison_triggered.root"); | |
5291a23b | 190 | mgr->ConnectInput(taskGLOBAL,0,mgr->GetCommonInputContainer()); |
4b621d9c | 191 | mgr->ConnectOutput(taskGLOBAL,1,coutputGLOBAL); |
5291a23b | 192 | } |
cd785861 | 193 | if(bD0){ |
194 | float cuts[7]={0.5,0.04,0.7,0.8,0.05,-0.00025,0.7}; | |
195 | AliAnalysisTaskD0Trigger *taskD0 = new AliAnalysisTaskD0Trigger("offhlt_comparison_D0_Trigger",cuts); | |
196 | mgr->AddTask(taskD0); | |
4b621d9c | 197 | AliAnalysisDataContainer *coutputD0 = mgr->CreateContainer("D0_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-D0-comparison.root"); |
cd785861 | 198 | mgr->ConnectInput(taskD0,0,mgr->GetCommonInputContainer()); |
4b621d9c | 199 | mgr->ConnectOutput(taskD0,1,coutputD0); |
cd785861 | 200 | } |
78dbc30d | 201 | if(bCB){ |
9a49afed | 202 | AliAnalysisTaskHLTCentralBarrel *taskCB = new AliAnalysisTaskHLTCentralBarrel("offhlt_comparison_CB"); |
0e76c8bc | 203 | mgr->AddTask(taskCB); |
204 | taskCB->SetBeamType(beamType); | |
205 | if(beamType.Contains("Pb-Pb")){ | |
1c06a186 | 206 | gROOT->LoadMacro("$ALICE_ROOT/OADB/macros/AddTaskCentrality.C"); |
c08d03bf | 207 | AliCentralitySelectionTask *taskCentrality = AddTaskCentrality(); |
208 | taskCentrality->SetPass(1); | |
184b64eb | 209 | } |
210 | taskCB->SetOptions(options); | |
9a49afed | 211 | AliAnalysisDataContainer *coutputCB = mgr->CreateContainer("esd_thnsparse",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-CentralBarrel-comparison.root"); |
78dbc30d | 212 | mgr->ConnectInput(taskCB,0,mgr->GetCommonInputContainer()); |
213 | mgr->ConnectOutput(taskCB,1,coutputCB); | |
214 | } | |
5291a23b | 215 | // Enable debug printouts |
216 | mgr->SetDebugLevel(2); | |
217 | ||
218 | if (!mgr->InitAnalysis()) return; | |
219 | mgr->PrintStatus(); | |
fa8f0d65 | 220 | mgr->StartAnalysis("grid", nEvents); |
5291a23b | 221 | |
222 | timer.Stop(); | |
223 | timer.Print(); | |
224 | } | |
4b621d9c | 225 | |
226 | void compare_HLT_offline_grid(){ | |
227 | cout << " " << endl; | |
228 | cout << " Usage examples:" << endl; | |
c03ba98c | 229 | cout << " compare-HLT-offline-grid.C'(runNumber, dataDir, gridWorkingDir, gridOutputDir, mode, taskOption, taskFolder, beamType, THnSparse_names, fUseHLTTrigger)'" << endl; |
230 | cout << " compare-HLT-offline-grid.C'(\"000115322\",\"/alice/data/2010/LHC10b\",\"ESDcomparison\",\"output\",\"full\",\"global\",\"./\",\"p-p\",\"event-off event-hlt track-off track-hlt\",kTRUE)'" << endl; | |
4b621d9c | 231 | cout << " " << endl; |
232 | } |