]>
Commit | Line | Data |
---|---|---|
cc76079a | 1 | /************************************************************************** |
1b3806c8 | 2 | * This file is property of and copyright by the ALICE HLT Project * |
cc76079a | 3 | * All rights reserved. * |
4 | * * | |
5 | * Primary Authors: * | |
6 | * Artur Szostak <artursz@iafrica.com> * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | ||
1d8ae082 | 17 | // $Id$ |
1b3806c8 | 18 | |
19 | /** | |
20 | * \ingroup macros | |
21 | * \file RunChain.C | |
22 | * \brief Macro for running the dHLT chain in a standalone mode. | |
23 | * | |
24 | * This macro is used to run the dHLT component chain within the AliHLTSystem | |
cc76079a | 25 | * framework, which is a simulation of the dHLT online system's output. |
26 | * To run this macro you must be in the same directory as the galice.root | |
27 | * files or in the directory containing the rawXX/ directories produced from | |
28 | * AliRoot simulations. | |
1b3806c8 | 29 | * Also make sure you specify CDB as for the lutDir (lookup table directory) |
30 | * or that the appropriate LUTs are in the same directory as your working | |
31 | * directory, or you can specify the directory with the lutDir parameter option. | |
32 | * | |
33 | * The simplest way to run this macro with defaults is to copy "rootlogon.C" from | |
34 | * $ALICE_ROOT/HLT/MUON/macros into your current working directory, then from | |
35 | * the shell command prompt run the following command: | |
36 | * \code | |
37 | * > aliroot -b -q -l $ALICE_ROOT/HLT/MUON/macros/RunChain.C+ | |
38 | * \endcode | |
39 | * | |
40 | * \author Artur Szostak <artursz@iafrica.com> | |
cc76079a | 41 | */ |
42 | ||
43 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
90af8855 | 44 | #include "AliRawReader.h" |
45 | #include "AliHLTOfflineInterface.h" | |
bc5cb6d6 | 46 | #include "AliCDBStorage.h" |
846e6f41 | 47 | #include "AliCDBManager.h" |
48 | #include "AliHLTSystem.h" | |
49 | #include "AliHLTConfiguration.h" | |
cc76079a | 50 | #include "AliLog.h" |
51 | #include "TString.h" | |
52 | #include <iostream> | |
53 | using std::cerr; | |
54 | using std::endl; | |
55 | #endif | |
56 | ||
1b3806c8 | 57 | /** |
58 | * Used to run the dimuon HLT (dHLT) chain in various configuration in a standalone | |
59 | * configuration. This is normally used for debugging, testing and can also be used | |
60 | * as an example of how to build chains for dHLT by hand. | |
61 | * | |
62 | * @param chainType Specifies the type of chain to run. This can be one of the | |
cc76079a | 63 | * following: |
64 | * "full" - Run the full dHLT chain. (default) | |
65 | * "ddlreco" - Run only the reconstruction of the DDL raw data up to hits | |
66 | * and trigger records. | |
67 | * "tracker" - Run the tracker only using hits and trigger records from | |
68 | * AliRoot simulation or offline reconstruction. | |
69 | * @param firstEvent The event number of the first event to process. (default = 0) | |
70 | * @param lastEvent The event number of the last event to process. If this is | |
71 | * less than firstEvent then it is set to firstEvent automatically. (default = -1) | |
1f50d9b1 | 72 | * @param output Specifies the kind of output to generate. The options can be one |
73 | * of the following: | |
74 | * "bin" - Generates all possible output and dumps it to binary files | |
75 | * using the FileWriter component. | |
76 | * "root" - Generates all possible output and writes it to a ROOT file | |
77 | * using the ROOTFileWriter component. | |
78 | * "tracks_bin" - Generates only track data and dumps it to binary files | |
79 | * using the FileWriter component. This option is equivalent to | |
80 | * 'bin' if the chain type is 'ddlreco'. | |
81 | * "tracks_root" - Generates only track data and writes it to a ROOT file | |
82 | * using the ROOTFileWriter component. This option is equivalent | |
83 | * to 'bin' if the chain type is 'ddlreco'. | |
cc76079a | 84 | * @param dataSource This is the data source from which to use hits and trigger |
90af8855 | 85 | * records when we are running the tracker only chain and the DDL raw data |
86 | * reading method when running the 'full' or 'ddlreco' chain. If the | |
87 | * chainType = "full" or "ddlreco", then the possible options are: | |
88 | * "file" - Reads the raw data directly from the DDL files. (default) | |
89 | * "rawreader" - Reads the raw data using the AliRawReader interface from | |
90 | * the current working directory. | |
91 | * If the chainType = "tracker", then the possible options are: | |
cc76079a | 92 | * "sim" - Take data from GEANT hits. (default) |
93 | * "rec" - Take data from offline reconstructed hits and local trigger | |
94 | * objects. | |
95 | * @param logLevel Specifies the amount of logging messages produced by the HLT | |
96 | * system. The possible options are: | |
97 | * "normal" - Shows warnings, errors and information. | |
24f12607 | 98 | * "debug" - Shows all messages up to the debug level only for HLT and the |
99 | * same as normal for all other modules. | |
cc76079a | 100 | * "max" - Shows everything including debug messages if they were compiled in. |
101 | * "min" - Shows only error messages. | |
1f50d9b1 | 102 | * @param lutDir This is the directory in which the LUTs can be found. |
1b3806c8 | 103 | * If it is set to "CDB" (case sensitive) then the LUTs will be loaded from |
104 | * CDB instead. The default behaviour is to read from the local CDB store. | |
dba14d7d | 105 | * @param checkData A flag for indicating if the event data should be checked |
106 | * for consistency with the AliHLTMUONDataCheckerComponent. | |
90af8855 | 107 | * @param rawDataPath The path of the raw data (i.e. path to the rawXX directories) |
108 | * or can be the file name if using the "rawreader" option for dataSource. | |
1d8ae082 | 109 | * @param runNumber Specifies the run number to use. If it is set to -1 then the |
110 | * run number is not set if the CDB manager already has a run number set, | |
111 | * otherwise a default run number of 0 is used. The default value is -1. | |
112 | * @param cdbPath This gives the CDB path to use. If it is set to NULL then | |
113 | * the CDB path is not set if the CDB manager already has a default storage | |
114 | * CDB path set, otherwise a default value of "local://$ALICE_ROOT/OCDB" is used. | |
115 | * The default value is NULL. | |
116 | * @param tryrecover If this is true then the "-tryrecover" flag is set in the | |
117 | * raw data reconstruction components. This is useful if when running RunChain | |
118 | * log messages appear indicating that there was a problem decoding the raw data. | |
119 | * The "-tryrecover" flag will turn on recovery logic in the raw data decoders | |
120 | * to try and overcome errors in the data. | |
cc76079a | 121 | */ |
122 | void RunChain( | |
123 | const char* chainType = "full", | |
124 | Int_t firstEvent = 0, | |
125 | Int_t lastEvent = -1, | |
1f50d9b1 | 126 | const char* output = "bin", |
90af8855 | 127 | const char* dataSource = "file", |
1f50d9b1 | 128 | const char* logLevel = "normal", |
dba14d7d | 129 | const char* lutDir = "CDB", |
90af8855 | 130 | bool checkData = false, |
1d8ae082 | 131 | const char* rawDataPath = "./", |
132 | Int_t runNumber = -1, | |
133 | const char* cdbPath = NULL, | |
134 | bool tryrecover = false | |
cc76079a | 135 | ) |
136 | { | |
846e6f41 | 137 | // Setup the CDB default storage and run number if nothing was set. |
138 | AliCDBManager* cdbManager = AliCDBManager::Instance(); | |
139 | if (cdbManager == NULL) | |
140 | { | |
141 | cerr << "ERROR: Global CDB manager object does not exist." << endl; | |
142 | return; | |
143 | } | |
1d8ae082 | 144 | if (runNumber != -1) |
846e6f41 | 145 | { |
1d8ae082 | 146 | cdbManager->SetRun(runNumber); |
846e6f41 | 147 | } |
1d8ae082 | 148 | else if (cdbManager->GetRun() == -1) |
846e6f41 | 149 | { |
150 | cdbManager->SetRun(0); | |
151 | } | |
1d8ae082 | 152 | if (cdbPath != NULL) |
153 | { | |
154 | cdbManager->SetDefaultStorage(cdbPath); | |
155 | } | |
156 | else if (cdbManager->GetDefaultStorage() == NULL) | |
157 | { | |
158 | cdbManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
159 | } | |
160 | ||
161 | if (cdbManager->GetDefaultStorage() == NULL) | |
162 | { | |
163 | cerr << "ERROR: There is no value for the default CDB storage, cannot continue." << endl; | |
164 | return; | |
165 | } | |
846e6f41 | 166 | |
cc76079a | 167 | // Make sure that the lastEvent is greater than firstEvent. |
168 | if (lastEvent < firstEvent) | |
169 | lastEvent = firstEvent; | |
170 | int eventCount = lastEvent - firstEvent + 1; | |
171 | ||
172 | bool buildDDLFilePubs = false; | |
90af8855 | 173 | bool buildRawReaderPubs = false; |
cc76079a | 174 | bool buildDDLRecoComps = false; |
175 | bool buildSimDataPubs = false; | |
176 | bool buildRecDataPubs = false; | |
cc76079a | 177 | bool buildTrackerComp = false; |
cc76079a | 178 | bool maxLogging = false; |
24f12607 | 179 | bool debugLogging = false; |
cc76079a | 180 | bool minLogging = false; |
1f50d9b1 | 181 | bool useRootWriter = false; |
182 | bool makeTracksOnly = false; | |
c9537879 | 183 | bool buildDecisionComp = true; |
1f50d9b1 | 184 | |
185 | // Parse the chainType, output, dataSource and logLevel option strings: | |
186 | TString outOpt = output; | |
187 | if (outOpt.CompareTo("bin", TString::kIgnoreCase) == 0) | |
188 | { | |
189 | useRootWriter = false; | |
190 | } | |
191 | else if (outOpt.CompareTo("root", TString::kIgnoreCase) == 0) | |
192 | { | |
193 | useRootWriter = true; | |
194 | } | |
195 | else if (outOpt.CompareTo("tracks_bin", TString::kIgnoreCase) == 0) | |
196 | { | |
197 | useRootWriter = false; | |
198 | makeTracksOnly = true; | |
199 | } | |
200 | else if (outOpt.CompareTo("tracks_root", TString::kIgnoreCase) == 0) | |
201 | { | |
202 | useRootWriter = true; | |
203 | makeTracksOnly = true; | |
204 | } | |
205 | else | |
206 | { | |
90af8855 | 207 | cerr << "ERROR: Unknown option for output: '" << output << "'" << endl; |
1f50d9b1 | 208 | return; |
209 | } | |
cc76079a | 210 | |
cc76079a | 211 | TString chainOpt = chainType; |
212 | if (chainOpt.CompareTo("full", TString::kIgnoreCase) == 0) | |
213 | { | |
cc76079a | 214 | buildDDLRecoComps = true; |
215 | buildTrackerComp = true; | |
90af8855 | 216 | |
217 | TString dataOpt = dataSource; | |
218 | if (dataOpt.CompareTo("file", TString::kIgnoreCase) == 0) | |
219 | { | |
220 | buildDDLFilePubs = true; | |
221 | } | |
222 | else if (dataOpt.CompareTo("rawreader", TString::kIgnoreCase) == 0) | |
223 | { | |
224 | buildRawReaderPubs = true; | |
225 | } | |
226 | else | |
227 | { | |
228 | cerr << "ERROR: Unknown option for dataSource: '" << dataSource | |
229 | << "'. Valid options are: 'file' or 'rawreader'" << endl; | |
230 | return; | |
231 | } | |
cc76079a | 232 | } |
1f50d9b1 | 233 | else if (chainOpt.CompareTo("ddlreco", TString::kIgnoreCase) == 0) |
cc76079a | 234 | { |
cc76079a | 235 | buildDDLRecoComps = true; |
c9537879 | 236 | buildDecisionComp = false; |
90af8855 | 237 | |
238 | TString dataOpt = dataSource; | |
239 | if (dataOpt.CompareTo("file", TString::kIgnoreCase) == 0) | |
240 | { | |
241 | buildDDLFilePubs = true; | |
242 | } | |
243 | else if (dataOpt.CompareTo("rawreader", TString::kIgnoreCase) == 0) | |
244 | { | |
245 | buildRawReaderPubs = true; | |
246 | } | |
247 | else | |
248 | { | |
249 | cerr << "ERROR: Unknown option for dataSource: '" << dataSource | |
250 | << "'. Valid options are: 'file' or 'rawreader'" << endl; | |
251 | return; | |
252 | } | |
cc76079a | 253 | } |
254 | else if (chainOpt.CompareTo("tracker", TString::kIgnoreCase) == 0) | |
255 | { | |
cc76079a | 256 | buildTrackerComp = true; |
1f50d9b1 | 257 | |
cc76079a | 258 | TString dataOpt = dataSource; |
259 | if (dataOpt.CompareTo("sim", TString::kIgnoreCase) == 0) | |
260 | { | |
261 | buildSimDataPubs = true; | |
262 | } | |
263 | else if (dataOpt.CompareTo("rec", TString::kIgnoreCase) == 0) | |
264 | { | |
265 | buildRecDataPubs = true; | |
266 | } | |
267 | else | |
268 | { | |
90af8855 | 269 | cerr << "ERROR: Unknown option for dataSource: '" << dataSource |
270 | << "'. Valid options are: 'sim' or 'rec'" << endl; | |
cc76079a | 271 | return; |
272 | } | |
273 | } | |
1f50d9b1 | 274 | else |
275 | { | |
90af8855 | 276 | cerr << "ERROR: Unknown option for chainType: '" << chainType << "'" << endl; |
1f50d9b1 | 277 | return; |
278 | } | |
cc76079a | 279 | |
280 | TString logOpt = logLevel; | |
a563b588 | 281 | if (logOpt.CompareTo("normal", TString::kIgnoreCase) == 0) |
cc76079a | 282 | { |
283 | // nothing to do. | |
284 | } | |
24f12607 | 285 | else if (logOpt.CompareTo("debug", TString::kIgnoreCase) == 0) |
286 | { | |
287 | debugLogging = true; | |
288 | } | |
a563b588 | 289 | else if (logOpt.CompareTo("max", TString::kIgnoreCase) == 0) |
cc76079a | 290 | { |
291 | maxLogging = true; | |
292 | } | |
a563b588 | 293 | else if (logOpt.CompareTo("min", TString::kIgnoreCase) == 0) |
cc76079a | 294 | { |
295 | minLogging = true; | |
296 | } | |
297 | else | |
298 | { | |
90af8855 | 299 | cerr << "ERROR: Unknown option for logLevel: '" << logLevel << "'" << endl; |
cc76079a | 300 | return; |
301 | } | |
302 | ||
1f50d9b1 | 303 | // If we are supposed to make tracks only but are in a ddlreco chain |
304 | // then we clearly can only generate the DDL reconstructed data, so do that. | |
305 | if (makeTracksOnly && ! buildTrackerComp) | |
306 | { | |
307 | makeTracksOnly = false; | |
308 | } | |
309 | ||
cc76079a | 310 | // Now we can initialise the AliHLTSystem... |
311 | AliHLTSystem sys; | |
cc76079a | 312 | |
313 | // Start by setting up the logging. | |
314 | if (maxLogging) | |
315 | { | |
316 | AliLog::SetGlobalLogLevel(AliLog::kMaxType); | |
317 | sys.SetGlobalLoggingLevel(kHLTLogAll); | |
318 | } | |
24f12607 | 319 | if (debugLogging) |
320 | { | |
321 | AliLog::SetModuleDebugLevel("HLT", AliLog::kMaxType); | |
322 | sys.SetGlobalLoggingLevel(kHLTLogAll); | |
323 | } | |
cc76079a | 324 | if (minLogging) |
325 | { | |
1b3806c8 | 326 | sys.SetGlobalLoggingLevel(AliHLTComponentLogSeverity( |
327 | kHLTLogFatal | kHLTLogError | |
328 | )); | |
cc76079a | 329 | } |
a563b588 | 330 | |
1f614081 | 331 | sys.LoadComponentLibraries("libAliHLTUtil.so"); |
332 | sys.LoadComponentLibraries("libAliHLTMUON.so"); | |
cc76079a | 333 | |
334 | // The DDL file publishers are only needed if we create the ddlreco or | |
335 | // full chains. The filename lists are built assuming the aliroot rawXX/ | |
336 | // directory structure. | |
337 | if (buildDDLFilePubs) | |
338 | { | |
668eee9f | 339 | string cmd13 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x001000"; |
340 | string cmd14 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x002000"; | |
341 | string cmd15 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x004000"; | |
342 | string cmd16 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x008000"; | |
343 | string cmd17 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x010000"; | |
344 | string cmd18 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x020000"; | |
345 | string cmd19 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x040000"; | |
346 | string cmd20 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x080000"; | |
347 | string cmd21 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x100000"; | |
348 | string cmd22 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x200000"; | |
cc76079a | 349 | for (int i = firstEvent; i < lastEvent+1; i++) |
350 | { | |
351 | if (i != 0) | |
352 | { | |
353 | cmd13 += " -nextevent"; | |
354 | cmd14 += " -nextevent"; | |
355 | cmd15 += " -nextevent"; | |
356 | cmd16 += " -nextevent"; | |
357 | cmd17 += " -nextevent"; | |
358 | cmd18 += " -nextevent"; | |
359 | cmd19 += " -nextevent"; | |
360 | cmd20 += " -nextevent"; | |
361 | cmd21 += " -nextevent"; | |
362 | cmd22 += " -nextevent"; | |
363 | } | |
364 | char buf[16]; | |
365 | sprintf(buf, "%d", i); | |
90af8855 | 366 | cmd13 += " -datafile "; cmd13 += rawDataPath; cmd13 += "raw"; cmd13 += buf; cmd13 += "/MUONTRK_2572.ddl"; |
367 | cmd14 += " -datafile "; cmd14 += rawDataPath; cmd14 += "raw"; cmd14 += buf; cmd14 += "/MUONTRK_2573.ddl"; | |
368 | cmd15 += " -datafile "; cmd15 += rawDataPath; cmd15 += "raw"; cmd15 += buf; cmd15 += "/MUONTRK_2574.ddl"; | |
369 | cmd16 += " -datafile "; cmd16 += rawDataPath; cmd16 += "raw"; cmd16 += buf; cmd16 += "/MUONTRK_2575.ddl"; | |
370 | cmd17 += " -datafile "; cmd17 += rawDataPath; cmd17 += "raw"; cmd17 += buf; cmd17 += "/MUONTRK_2576.ddl"; | |
371 | cmd18 += " -datafile "; cmd18 += rawDataPath; cmd18 += "raw"; cmd18 += buf; cmd18 += "/MUONTRK_2577.ddl"; | |
372 | cmd19 += " -datafile "; cmd19 += rawDataPath; cmd19 += "raw"; cmd19 += buf; cmd19 += "/MUONTRK_2578.ddl"; | |
373 | cmd20 += " -datafile "; cmd20 += rawDataPath; cmd20 += "raw"; cmd20 += buf; cmd20 += "/MUONTRK_2579.ddl"; | |
374 | cmd21 += " -datafile "; cmd21 += rawDataPath; cmd21 += "raw"; cmd21 += buf; cmd21 += "/MUONTRG_2816.ddl"; | |
375 | cmd22 += " -datafile "; cmd22 += rawDataPath; cmd22 += "raw"; cmd22 += buf; cmd22 += "/MUONTRG_2817.ddl"; | |
cc76079a | 376 | } |
377 | ||
378 | AliHLTConfiguration pubDDL13("pubDDL13", "FilePublisher", NULL, cmd13.c_str()); | |
379 | AliHLTConfiguration pubDDL14("pubDDL14", "FilePublisher", NULL, cmd14.c_str()); | |
380 | AliHLTConfiguration pubDDL15("pubDDL15", "FilePublisher", NULL, cmd15.c_str()); | |
381 | AliHLTConfiguration pubDDL16("pubDDL16", "FilePublisher", NULL, cmd16.c_str()); | |
382 | AliHLTConfiguration pubDDL17("pubDDL17", "FilePublisher", NULL, cmd17.c_str()); | |
383 | AliHLTConfiguration pubDDL18("pubDDL18", "FilePublisher", NULL, cmd18.c_str()); | |
384 | AliHLTConfiguration pubDDL19("pubDDL19", "FilePublisher", NULL, cmd19.c_str()); | |
385 | AliHLTConfiguration pubDDL20("pubDDL20", "FilePublisher", NULL, cmd20.c_str()); | |
386 | AliHLTConfiguration pubDDL21("pubDDL21", "FilePublisher", NULL, cmd21.c_str()); | |
387 | AliHLTConfiguration pubDDL22("pubDDL22", "FilePublisher", NULL, cmd22.c_str()); | |
388 | } | |
90af8855 | 389 | |
390 | // Build the DDL file publishers using AliRawReaderPublisher components. | |
391 | if (buildRawReaderPubs) | |
392 | { | |
393 | string cmd13 = "-skipempty -minid 2572 -maxid 2572 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x001000"; | |
394 | string cmd14 = "-skipempty -minid 2573 -maxid 2573 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x002000"; | |
395 | string cmd15 = "-skipempty -minid 2574 -maxid 2574 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x004000"; | |
396 | string cmd16 = "-skipempty -minid 2575 -maxid 2575 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x008000"; | |
397 | string cmd17 = "-skipempty -minid 2576 -maxid 2576 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x010000"; | |
398 | string cmd18 = "-skipempty -minid 2577 -maxid 2577 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x020000"; | |
399 | string cmd19 = "-skipempty -minid 2578 -maxid 2578 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x040000"; | |
400 | string cmd20 = "-skipempty -minid 2579 -maxid 2579 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x080000"; | |
401 | string cmd21 = "-skipempty -minid 2816 -maxid 2816 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x100000"; | |
402 | string cmd22 = "-skipempty -minid 2817 -maxid 2817 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x200000"; | |
403 | ||
404 | AliHLTConfiguration pubDDL13("pubDDL13", "AliRawReaderPublisher", NULL, cmd13.c_str()); | |
405 | AliHLTConfiguration pubDDL14("pubDDL14", "AliRawReaderPublisher", NULL, cmd14.c_str()); | |
406 | AliHLTConfiguration pubDDL15("pubDDL15", "AliRawReaderPublisher", NULL, cmd15.c_str()); | |
407 | AliHLTConfiguration pubDDL16("pubDDL16", "AliRawReaderPublisher", NULL, cmd16.c_str()); | |
408 | AliHLTConfiguration pubDDL17("pubDDL17", "AliRawReaderPublisher", NULL, cmd17.c_str()); | |
409 | AliHLTConfiguration pubDDL18("pubDDL18", "AliRawReaderPublisher", NULL, cmd18.c_str()); | |
410 | AliHLTConfiguration pubDDL19("pubDDL19", "AliRawReaderPublisher", NULL, cmd19.c_str()); | |
411 | AliHLTConfiguration pubDDL20("pubDDL20", "AliRawReaderPublisher", NULL, cmd20.c_str()); | |
412 | AliHLTConfiguration pubDDL21("pubDDL21", "AliRawReaderPublisher", NULL, cmd21.c_str()); | |
413 | AliHLTConfiguration pubDDL22("pubDDL22", "AliRawReaderPublisher", NULL, cmd22.c_str()); | |
414 | } | |
cc76079a | 415 | |
416 | // Build the DDL reconstructor components for all the DDLs 13 to 22, that | |
417 | // is for chambers 7 to 10 and trigger stations. We only need to build | |
418 | // these components if we are are building the ddlreco or full chains. | |
419 | if (buildDDLRecoComps) | |
420 | { | |
1d8ae082 | 421 | const char* recoverFlag = tryrecover ? "-tryrecover" : ""; |
422 | for (int k = 13; k <= 22; k++) | |
1b3806c8 | 423 | { |
1d8ae082 | 424 | string compId = Form("recDDL%d", k); |
425 | string name = (k <= 20) ? "MUONHitReconstructor" : "MUONTriggerReconstructor"; | |
426 | string parent = Form("pubDDL%d", k); | |
427 | string cmd; | |
462e3880 | 428 | const char* extraInfoFlags = k < 21 ? "-makeclusters -makechannels" : "-makedebuginfo"; |
1d8ae082 | 429 | if (TString(lutDir) == "CDB") |
430 | { | |
431 | const char* path = cdbManager->GetDefaultStorage()->GetURI().Data(); | |
462e3880 | 432 | cmd = Form("-ddl %d -cdbpath %s -run %d %s %s", |
433 | k, path, cdbManager->GetRun(), recoverFlag, extraInfoFlags | |
1d8ae082 | 434 | ); |
435 | } | |
436 | else | |
437 | { | |
462e3880 | 438 | cmd = Form("-ddl %d -lut %s/Lut%d.dat %s %s", |
439 | k, lutDir, k, recoverFlag, extraInfoFlags | |
1d8ae082 | 440 | ); |
441 | } | |
442 | if (k >= 21) | |
443 | { | |
444 | cmd += " -suppress_partial_triggers -dont_use_crateid -dont_use_localid"; | |
445 | } | |
446 | AliHLTConfiguration recDDL(compId.c_str(), name.c_str(), parent.c_str(), cmd.c_str()); | |
1b3806c8 | 447 | } |
1f50d9b1 | 448 | } |
449 | ||
450 | TString startEventStr = "-firstevent "; | |
451 | startEventStr += firstEvent; | |
ee3678d3 | 452 | |
1f50d9b1 | 453 | // Build the data source components to take data from simulated hits if |
454 | // we are building the tracker only chain with the 'sim' data source. | |
cc76079a | 455 | if (buildSimDataPubs) |
456 | { | |
1f50d9b1 | 457 | AliHLTConfiguration recDDL13("recDDL13", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left -chamber 7"); |
458 | AliHLTConfiguration recDDL14("recDDL14", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 7"); | |
459 | AliHLTConfiguration recDDL15("recDDL15", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left -chamber 8"); | |
460 | AliHLTConfiguration recDDL16("recDDL16", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 8"); | |
461 | AliHLTConfiguration recDDL17("recDDL17", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left -chamber 9"); | |
462 | AliHLTConfiguration recDDL18("recDDL18", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 9"); | |
463 | AliHLTConfiguration recDDL19("recDDL19", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left -chamber 10"); | |
464 | AliHLTConfiguration recDDL20("recDDL20", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 10"); | |
465 | AliHLTConfiguration recDDL21("recDDL21", "MUONTriggerRecordsSource", NULL, startEventStr + " -hitdata -plane left"); | |
466 | AliHLTConfiguration recDDL22("recDDL22", "MUONTriggerRecordsSource", NULL, startEventStr + " -hitdata -plane right"); | |
cc76079a | 467 | } |
468 | ||
469 | // Build the data source components to take data from offline reconstructed | |
470 | // objects if we are building the tracker only chain with the 'rec' data source. | |
471 | if (buildRecDataPubs) | |
472 | { | |
1f50d9b1 | 473 | AliHLTConfiguration recDDL13("recDDL13", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left -chamber 7"); |
474 | AliHLTConfiguration recDDL14("recDDL14", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 7"); | |
475 | AliHLTConfiguration recDDL15("recDDL15", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left -chamber 8"); | |
476 | AliHLTConfiguration recDDL16("recDDL16", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 8"); | |
477 | AliHLTConfiguration recDDL17("recDDL17", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left -chamber 9"); | |
478 | AliHLTConfiguration recDDL18("recDDL18", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 9"); | |
479 | AliHLTConfiguration recDDL19("recDDL19", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left -chamber 10"); | |
480 | AliHLTConfiguration recDDL20("recDDL20", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 10"); | |
481 | AliHLTConfiguration recDDL21("recDDL21", "MUONTriggerRecordsSource", NULL, startEventStr + " -recdata -plane left"); | |
482 | AliHLTConfiguration recDDL22("recDDL22", "MUONTriggerRecordsSource", NULL, startEventStr + " -recdata -plane right"); | |
cc76079a | 483 | } |
484 | ||
485 | // Build the tracker component if we are building the tracker only or | |
486 | // full chains. | |
487 | if (buildTrackerComp) | |
488 | { | |
bc5cb6d6 | 489 | AliHLTConfiguration tracker( |
490 | "tracker", | |
491 | "MUONMansoTrackerFSM", | |
492 | "recDDL13 recDDL14 recDDL15 recDDL16 recDDL17 recDDL18 recDDL19 recDDL20 recDDL21 recDDL22", | |
493 | "-makecandidates" | |
494 | ); | |
cc76079a | 495 | } |
c9537879 | 496 | |
497 | // Build the dHLT trigger decision component if enabled. | |
498 | if (buildDecisionComp) | |
499 | { | |
500 | AliHLTConfiguration decision("decision", "MUONDecisionComponent", "tracker", ""); | |
501 | } | |
cc76079a | 502 | |
1f50d9b1 | 503 | // Build the data sink to subscribe only to what has been created and |
504 | // to the data source we actaully want. | |
505 | TString sources = ""; | |
506 | if (makeTracksOnly) | |
cc76079a | 507 | { |
1f50d9b1 | 508 | sources += "tracker "; |
cc76079a | 509 | } |
1f50d9b1 | 510 | else |
511 | { | |
512 | if (buildTrackerComp) | |
513 | sources += "tracker "; | |
514 | sources += "recDDL13 recDDL14 recDDL15 recDDL16 recDDL17 recDDL18 recDDL19 recDDL20 recDDL21 recDDL22"; | |
515 | } | |
c9537879 | 516 | if (buildDecisionComp) |
517 | { | |
518 | // Add the trigger decision component if it was enabled. | |
519 | sources += " decision"; | |
520 | } | |
dba14d7d | 521 | |
522 | // Build the data checker component if so requested. | |
523 | if (checkData) | |
524 | { | |
525 | AliHLTConfiguration checker("checker", "MUONDataChecker", sources, "-warn_on_unexpected_block"); | |
526 | sources = "checker"; | |
527 | } | |
528 | ||
1f50d9b1 | 529 | if (useRootWriter) |
530 | { | |
531 | AliHLTConfiguration convert("convert", "MUONRootifier", sources, ""); | |
d8cf7391 | 532 | AliHLTConfiguration sink("sink", "ROOTFileWriter", "convert", "-concatenate-events -datafile output.root -specfmt"); |
1f50d9b1 | 533 | } |
534 | else | |
cc76079a | 535 | { |
1f50d9b1 | 536 | AliHLTConfiguration sink("sink", "FileWriter", sources, "-datafile output.dat -specfmt"); |
cc76079a | 537 | } |
538 | ||
1f50d9b1 | 539 | // Build and run the chain's tasks. |
540 | sys.BuildTaskList("sink"); | |
90af8855 | 541 | if (buildDDLFilePubs) |
542 | { | |
543 | sys.Run(eventCount); | |
544 | } | |
545 | else | |
546 | { | |
547 | // Setup the raw reader. | |
548 | AliRawReader* rawReader = AliRawReader::Create(rawDataPath); | |
549 | if (rawReader == NULL) | |
550 | { | |
551 | cerr << "ERROR: Could not create raw reader." << endl; | |
552 | return; | |
553 | } | |
554 | if (! rawReader->IsRawReaderValid()) | |
555 | { | |
556 | cerr << "ERROR: Raw reader is not valid." << endl; | |
557 | return; | |
558 | } | |
559 | AliHLTOfflineInterface::SetParamsToComponents(NULL, rawReader); | |
1d8ae082 | 560 | rawReader->NextEvent(); // Need to call this once here or we will start at the wrong event. |
90af8855 | 561 | // Now step through the events. |
562 | for (int i = 0; i < firstEvent; i++) rawReader->NextEvent(); | |
563 | for (int i = firstEvent; i <= lastEvent; i++) | |
564 | { | |
565 | // The "(i == lastEvent) ? 1 : 0" part is to indicate a | |
566 | // stop run command when we hit the last event. | |
567 | sys.Run(1, (i == lastEvent) ? 1 : 0); | |
568 | rawReader->NextEvent(); | |
569 | } | |
570 | } | |
cc76079a | 571 | } |