]>
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> | |
4d1e4179 | 11 | * aliroot -q compare-HLT-offline-grid.C'("000115322","/alice/data/2010/LHC10b","ESDcomparison","output","full","global")' 2>&1 | tee log |
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"); |
44 | ||
45 | ||
6b17ceb5 | 46 | Bool_t bAll=kFALSE, bTPC=kFALSE, bPHOS=kFALSE, bEMCAL=kFALSE, bITS=kFALSE, bGLOBAL=kFALSE; |
5291a23b | 47 | |
48 | TString allArgs = detectorTask; | |
49 | TString argument; | |
50 | ||
51 | TObjArray *pTokens = allArgs.Tokenize(" "); | |
52 | if(pTokens){ | |
53 | for(int i=0; i<pTokens->GetEntries(); i++){ | |
54 | argument=((TObjString*)pTokens->At(i))->GetString(); | |
55 | if(argument.IsNull()) continue; | |
56 | ||
57 | if(argument.CompareTo("tpc", TString::kIgnoreCase)==0){ | |
58 | bTPC = kTRUE; | |
59 | continue; | |
6b17ceb5 | 60 | } |
5291a23b | 61 | if(argument.CompareTo("phos", TString::kIgnoreCase)==0){ |
62 | bPHOS = kTRUE; | |
63 | continue; | |
6b17ceb5 | 64 | } |
65 | if(argument.CompareTo("emcal", TString::kIgnoreCase)==0){ | |
66 | bEMCAL = kTRUE; | |
67 | continue; | |
5291a23b | 68 | } |
69 | if(argument.CompareTo("its", TString::kIgnoreCase)==0){ | |
70 | bITS = kTRUE; | |
71 | continue; | |
72 | } | |
73 | if(argument.CompareTo("global", TString::kIgnoreCase)==0){ | |
74 | bGLOBAL = kTRUE; | |
75 | continue; | |
76 | } | |
77 | if(argument.CompareTo("all",TString::kIgnoreCase)==0){ | |
78 | bTPC = kTRUE; | |
79 | bPHOS = kTRUE; | |
6b17ceb5 | 80 | bEMCAL = kTRUE; |
5291a23b | 81 | bITS = kTRUE; |
82 | bGLOBAL = kTRUE; | |
83 | bAll = kTRUE; | |
84 | continue; | |
85 | } | |
86 | else break; | |
87 | } | |
88 | } | |
89 | ||
90 | //-------- Make the analysis manager ---------------// | |
91 | ||
92 | AliAnalysisManager *mgr = new AliAnalysisManager("TestManager"); | |
93 | AliESDInputHandler *esdH = new AliESDInputHandler; | |
94 | esdH->SetReadHLT(); | |
fcf71d87 | 95 | esdH->SetReadFriends(kFALSE); |
5291a23b | 96 | mgr->SetInputEventHandler(esdH); |
97 | mgr->SetNSysInfo(1000); | |
98 | ||
99 | // Create and configure the alien handler plugin | |
100 | gROOT->LoadMacro("CreateAlienHandler.C"); | |
12cc7125 | 101 | AliAnalysisGrid *alienHandler = CreateAlienHandler(runNumber, dataDir, gridWorkingDir, gridOutputDir, mode, detectorTask); |
5291a23b | 102 | if (!alienHandler) return; |
103 | ||
104 | // Connect plugin to the analysis manager | |
105 | mgr->SetGridHandler(alienHandler); | |
106 | ||
107 | //-------------- Compile the analysis tasks ---------- // | |
108 | if(bTPC) gROOT->LoadMacro("AliAnalysisTaskHLTTPC.cxx+"); | |
b29e3c94 | 109 | if(bPHOS) { |
110 | AliHLTSystem * pHLT = AliHLTPluginBase::GetInstance(); | |
111 | pHLT->LoadComponentLibraries("libHLTbase"); | |
112 | pHLT->LoadComponentLibraries("libAliHLTUtil"); | |
113 | pHLT->LoadComponentLibraries("libAliHLTGlobal"); | |
114 | gROOT->LoadMacro("AliAnalysisTaskHLTCalo.cxx+"); | |
115 | gROOT->LoadMacro("AliAnalysisTaskHLTPHOS.cxx+"); | |
116 | } | |
6b17ceb5 | 117 | if(bEMCAL) { |
118 | AliHLTSystem * pHLT = AliHLTPluginBase::GetInstance(); | |
119 | pHLT->LoadComponentLibraries("libHLTbase"); | |
120 | pHLT->LoadComponentLibraries("libAliHLTUtil"); | |
121 | pHLT->LoadComponentLibraries("libAliHLTGlobal"); | |
122 | gROOT->LoadMacro("AliAnalysisTaskHLTCalo.cxx+"); | |
123 | gROOT->LoadMacro("AliAnalysisTaskHLTEMCAL.cxx+"); | |
124 | } | |
5291a23b | 125 | if(bITS) gROOT->LoadMacro("AliAnalysisTaskHLTITS.cxx+"); |
126 | if(bGLOBAL) gROOT->LoadMacro("AliAnalysisTaskHLT.cxx+"); | |
127 | ||
128 | ||
129 | //-------------- define the tasks ------------// | |
130 | ||
131 | if(bTPC){ | |
132 | AliAnalysisTaskHLTTPC *taskTPC = new AliAnalysisTaskHLTTPC("offhlt_comparison_TPC"); | |
133 | mgr->AddTask(taskTPC); | |
134 | AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tpc_histograms", TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-TPC-comparison.root"); | |
135 | mgr->ConnectInput(taskTPC,0,mgr->GetCommonInputContainer()); | |
136 | mgr->ConnectOutput(taskTPC,1,coutput1); | |
137 | } | |
138 | ||
139 | if(bPHOS){ | |
140 | AliAnalysisTaskHLTPHOS *taskPHOS = new AliAnalysisTaskHLTPHOS("offhlt_comparison_PHOS"); | |
141 | mgr->AddTask(taskPHOS); | |
142 | AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("phos_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-PHOS-comparison.root"); | |
143 | mgr->ConnectInput(taskPHOS,0,mgr->GetCommonInputContainer()); | |
144 | mgr->ConnectOutput(taskPHOS,1,coutput2); | |
145 | } | |
6b17ceb5 | 146 | if(bEMCAL){ |
147 | AliAnalysisTaskHLTEMCAL *taskEMCAL = new AliAnalysisTaskHLTEMCAL("offhlt_comparison_EMCAL"); | |
148 | mgr->AddTask(taskEMCAL); | |
149 | AliAnalysisDataContainer *coutput5 = mgr->CreateContainer("emcal_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-EMCAL-comparison.root"); | |
150 | mgr->ConnectInput(taskEMCAL,0,mgr->GetCommonInputContainer()); | |
151 | mgr->ConnectOutput(taskEMCAL,1,coutput5); | |
152 | } | |
5291a23b | 153 | |
154 | if(bITS){ | |
155 | AliAnalysisTaskHLTITS *taskITS = new AliAnalysisTaskHLTITS("offhlt_comparison_ITS"); | |
156 | mgr->AddTask(taskITS); | |
157 | AliAnalysisDataContainer *coutput3 = mgr->CreateContainer("its_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-ITS-comparison.root"); | |
158 | mgr->ConnectInput(taskITS,0,mgr->GetCommonInputContainer()); | |
159 | mgr->ConnectOutput(taskITS,1,coutput3); | |
160 | } | |
161 | ||
162 | if(bGLOBAL){ | |
163 | AliAnalysisTaskHLT *taskGLOBAL = new AliAnalysisTaskHLT("offhlt_comparison_GLOBAL"); | |
164 | mgr->AddTask(taskGLOBAL); | |
165 | AliAnalysisDataContainer *coutput4 = mgr->CreateContainer("global_histograms",TList::Class(), AliAnalysisManager::kOutputContainer, "HLT-OFFLINE-GLOBAL-comparison.root"); | |
166 | mgr->ConnectInput(taskGLOBAL,0,mgr->GetCommonInputContainer()); | |
167 | mgr->ConnectOutput(taskGLOBAL,1,coutput4); | |
168 | } | |
169 | ||
170 | // Enable debug printouts | |
171 | mgr->SetDebugLevel(2); | |
172 | ||
173 | if (!mgr->InitAnalysis()) return; | |
174 | mgr->PrintStatus(); | |
175 | mgr->StartAnalysis("grid"); | |
176 | ||
177 | timer.Stop(); | |
178 | timer.Print(); | |
179 | } |