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