Extacting the OCDB in a separate module. The detectors have write permission in the...
[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
1b3806c8 17/* $Id$ */
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"
846e6f41 51#include "TClassTable.h"
cc76079a 52#include <iostream>
53using std::cerr;
54using 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.
cc76079a 109 */
110void RunChain(
111 const char* chainType = "full",
112 Int_t firstEvent = 0,
113 Int_t lastEvent = -1,
1f50d9b1 114 const char* output = "bin",
90af8855 115 const char* dataSource = "file",
1f50d9b1 116 const char* logLevel = "normal",
dba14d7d 117 const char* lutDir = "CDB",
90af8855 118 bool checkData = false,
119 const char* rawDataPath = "./"
cc76079a 120 )
121{
846e6f41 122 // Setup the CDB default storage and run number if nothing was set.
123 AliCDBManager* cdbManager = AliCDBManager::Instance();
124 if (cdbManager == NULL)
125 {
126 cerr << "ERROR: Global CDB manager object does not exist." << endl;
127 return;
128 }
129 if (cdbManager->GetDefaultStorage() == NULL)
130 {
162637e4 131 cdbManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
846e6f41 132 }
133 if (cdbManager->GetRun() == -1)
134 {
135 cdbManager->SetRun(0);
136 }
137
cc76079a 138 // Make sure that the lastEvent is greater than firstEvent.
139 if (lastEvent < firstEvent)
140 lastEvent = firstEvent;
141 int eventCount = lastEvent - firstEvent + 1;
142
143 bool buildDDLFilePubs = false;
90af8855 144 bool buildRawReaderPubs = false;
cc76079a 145 bool buildDDLRecoComps = false;
146 bool buildSimDataPubs = false;
147 bool buildRecDataPubs = false;
cc76079a 148 bool buildTrackerComp = false;
cc76079a 149 bool maxLogging = false;
24f12607 150 bool debugLogging = false;
cc76079a 151 bool minLogging = false;
1f50d9b1 152 bool useRootWriter = false;
153 bool makeTracksOnly = false;
c9537879 154 bool buildDecisionComp = true;
1f50d9b1 155
156 // Parse the chainType, output, dataSource and logLevel option strings:
157 TString outOpt = output;
158 if (outOpt.CompareTo("bin", TString::kIgnoreCase) == 0)
159 {
160 useRootWriter = false;
161 }
162 else if (outOpt.CompareTo("root", TString::kIgnoreCase) == 0)
163 {
164 useRootWriter = true;
165 }
166 else if (outOpt.CompareTo("tracks_bin", TString::kIgnoreCase) == 0)
167 {
168 useRootWriter = false;
169 makeTracksOnly = true;
170 }
171 else if (outOpt.CompareTo("tracks_root", TString::kIgnoreCase) == 0)
172 {
173 useRootWriter = true;
174 makeTracksOnly = true;
175 }
176 else
177 {
90af8855 178 cerr << "ERROR: Unknown option for output: '" << output << "'" << endl;
1f50d9b1 179 return;
180 }
cc76079a 181
cc76079a 182 TString chainOpt = chainType;
183 if (chainOpt.CompareTo("full", TString::kIgnoreCase) == 0)
184 {
cc76079a 185 buildDDLRecoComps = true;
186 buildTrackerComp = true;
90af8855 187
188 TString dataOpt = dataSource;
189 if (dataOpt.CompareTo("file", TString::kIgnoreCase) == 0)
190 {
191 buildDDLFilePubs = true;
192 }
193 else if (dataOpt.CompareTo("rawreader", TString::kIgnoreCase) == 0)
194 {
195 buildRawReaderPubs = true;
196 }
197 else
198 {
199 cerr << "ERROR: Unknown option for dataSource: '" << dataSource
200 << "'. Valid options are: 'file' or 'rawreader'" << endl;
201 return;
202 }
cc76079a 203 }
1f50d9b1 204 else if (chainOpt.CompareTo("ddlreco", TString::kIgnoreCase) == 0)
cc76079a 205 {
cc76079a 206 buildDDLRecoComps = true;
c9537879 207 buildDecisionComp = false;
90af8855 208
209 TString dataOpt = dataSource;
210 if (dataOpt.CompareTo("file", TString::kIgnoreCase) == 0)
211 {
212 buildDDLFilePubs = true;
213 }
214 else if (dataOpt.CompareTo("rawreader", TString::kIgnoreCase) == 0)
215 {
216 buildRawReaderPubs = true;
217 }
218 else
219 {
220 cerr << "ERROR: Unknown option for dataSource: '" << dataSource
221 << "'. Valid options are: 'file' or 'rawreader'" << endl;
222 return;
223 }
cc76079a 224 }
225 else if (chainOpt.CompareTo("tracker", TString::kIgnoreCase) == 0)
226 {
cc76079a 227 buildTrackerComp = true;
1f50d9b1 228
cc76079a 229 TString dataOpt = dataSource;
230 if (dataOpt.CompareTo("sim", TString::kIgnoreCase) == 0)
231 {
232 buildSimDataPubs = true;
233 }
234 else if (dataOpt.CompareTo("rec", TString::kIgnoreCase) == 0)
235 {
236 buildRecDataPubs = true;
237 }
238 else
239 {
90af8855 240 cerr << "ERROR: Unknown option for dataSource: '" << dataSource
241 << "'. Valid options are: 'sim' or 'rec'" << endl;
cc76079a 242 return;
243 }
244 }
1f50d9b1 245 else
246 {
90af8855 247 cerr << "ERROR: Unknown option for chainType: '" << chainType << "'" << endl;
1f50d9b1 248 return;
249 }
cc76079a 250
251 TString logOpt = logLevel;
a563b588 252 if (logOpt.CompareTo("normal", TString::kIgnoreCase) == 0)
cc76079a 253 {
254 // nothing to do.
255 }
24f12607 256 else if (logOpt.CompareTo("debug", TString::kIgnoreCase) == 0)
257 {
258 debugLogging = true;
259 }
a563b588 260 else if (logOpt.CompareTo("max", TString::kIgnoreCase) == 0)
cc76079a 261 {
262 maxLogging = true;
263 }
a563b588 264 else if (logOpt.CompareTo("min", TString::kIgnoreCase) == 0)
cc76079a 265 {
266 minLogging = true;
267 }
268 else
269 {
90af8855 270 cerr << "ERROR: Unknown option for logLevel: '" << logLevel << "'" << endl;
cc76079a 271 return;
272 }
273
1f50d9b1 274 // If we are supposed to make tracks only but are in a ddlreco chain
275 // then we clearly can only generate the DDL reconstructed data, so do that.
276 if (makeTracksOnly && ! buildTrackerComp)
277 {
278 makeTracksOnly = false;
279 }
280
cc76079a 281 // Now we can initialise the AliHLTSystem...
282 AliHLTSystem sys;
cc76079a 283
284 // Start by setting up the logging.
285 if (maxLogging)
286 {
287 AliLog::SetGlobalLogLevel(AliLog::kMaxType);
288 sys.SetGlobalLoggingLevel(kHLTLogAll);
289 }
24f12607 290 if (debugLogging)
291 {
292 AliLog::SetModuleDebugLevel("HLT", AliLog::kMaxType);
293 sys.SetGlobalLoggingLevel(kHLTLogAll);
294 }
cc76079a 295 if (minLogging)
296 {
1b3806c8 297 sys.SetGlobalLoggingLevel(AliHLTComponentLogSeverity(
298 kHLTLogFatal | kHLTLogError
299 ));
cc76079a 300 }
a563b588 301
846e6f41 302 if (gClassTable->GetID("AliHLTAgentUtil") < 0)
303 {
304 sys.LoadComponentLibraries("libAliHLTUtil.so");
305 }
306 if (gClassTable->GetID("AliHLTMUONAgent") < 0)
307 {
308 sys.LoadComponentLibraries("libAliHLTMUON.so");
309 }
cc76079a 310
311 // The DDL file publishers are only needed if we create the ddlreco or
312 // full chains. The filename lists are built assuming the aliroot rawXX/
313 // directory structure.
314 if (buildDDLFilePubs)
315 {
668eee9f 316 string cmd13 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x001000";
317 string cmd14 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x002000";
318 string cmd15 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x004000";
319 string cmd16 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x008000";
320 string cmd17 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x010000";
321 string cmd18 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x020000";
322 string cmd19 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x040000";
323 string cmd20 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x080000";
324 string cmd21 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x100000";
325 string cmd22 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x200000";
cc76079a 326 for (int i = firstEvent; i < lastEvent+1; i++)
327 {
328 if (i != 0)
329 {
330 cmd13 += " -nextevent";
331 cmd14 += " -nextevent";
332 cmd15 += " -nextevent";
333 cmd16 += " -nextevent";
334 cmd17 += " -nextevent";
335 cmd18 += " -nextevent";
336 cmd19 += " -nextevent";
337 cmd20 += " -nextevent";
338 cmd21 += " -nextevent";
339 cmd22 += " -nextevent";
340 }
341 char buf[16];
342 sprintf(buf, "%d", i);
90af8855 343 cmd13 += " -datafile "; cmd13 += rawDataPath; cmd13 += "raw"; cmd13 += buf; cmd13 += "/MUONTRK_2572.ddl";
344 cmd14 += " -datafile "; cmd14 += rawDataPath; cmd14 += "raw"; cmd14 += buf; cmd14 += "/MUONTRK_2573.ddl";
345 cmd15 += " -datafile "; cmd15 += rawDataPath; cmd15 += "raw"; cmd15 += buf; cmd15 += "/MUONTRK_2574.ddl";
346 cmd16 += " -datafile "; cmd16 += rawDataPath; cmd16 += "raw"; cmd16 += buf; cmd16 += "/MUONTRK_2575.ddl";
347 cmd17 += " -datafile "; cmd17 += rawDataPath; cmd17 += "raw"; cmd17 += buf; cmd17 += "/MUONTRK_2576.ddl";
348 cmd18 += " -datafile "; cmd18 += rawDataPath; cmd18 += "raw"; cmd18 += buf; cmd18 += "/MUONTRK_2577.ddl";
349 cmd19 += " -datafile "; cmd19 += rawDataPath; cmd19 += "raw"; cmd19 += buf; cmd19 += "/MUONTRK_2578.ddl";
350 cmd20 += " -datafile "; cmd20 += rawDataPath; cmd20 += "raw"; cmd20 += buf; cmd20 += "/MUONTRK_2579.ddl";
351 cmd21 += " -datafile "; cmd21 += rawDataPath; cmd21 += "raw"; cmd21 += buf; cmd21 += "/MUONTRG_2816.ddl";
352 cmd22 += " -datafile "; cmd22 += rawDataPath; cmd22 += "raw"; cmd22 += buf; cmd22 += "/MUONTRG_2817.ddl";
cc76079a 353 }
354
355 AliHLTConfiguration pubDDL13("pubDDL13", "FilePublisher", NULL, cmd13.c_str());
356 AliHLTConfiguration pubDDL14("pubDDL14", "FilePublisher", NULL, cmd14.c_str());
357 AliHLTConfiguration pubDDL15("pubDDL15", "FilePublisher", NULL, cmd15.c_str());
358 AliHLTConfiguration pubDDL16("pubDDL16", "FilePublisher", NULL, cmd16.c_str());
359 AliHLTConfiguration pubDDL17("pubDDL17", "FilePublisher", NULL, cmd17.c_str());
360 AliHLTConfiguration pubDDL18("pubDDL18", "FilePublisher", NULL, cmd18.c_str());
361 AliHLTConfiguration pubDDL19("pubDDL19", "FilePublisher", NULL, cmd19.c_str());
362 AliHLTConfiguration pubDDL20("pubDDL20", "FilePublisher", NULL, cmd20.c_str());
363 AliHLTConfiguration pubDDL21("pubDDL21", "FilePublisher", NULL, cmd21.c_str());
364 AliHLTConfiguration pubDDL22("pubDDL22", "FilePublisher", NULL, cmd22.c_str());
365 }
90af8855 366
367 // Build the DDL file publishers using AliRawReaderPublisher components.
368 if (buildRawReaderPubs)
369 {
370 string cmd13 = "-skipempty -minid 2572 -maxid 2572 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x001000";
371 string cmd14 = "-skipempty -minid 2573 -maxid 2573 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x002000";
372 string cmd15 = "-skipempty -minid 2574 -maxid 2574 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x004000";
373 string cmd16 = "-skipempty -minid 2575 -maxid 2575 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x008000";
374 string cmd17 = "-skipempty -minid 2576 -maxid 2576 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x010000";
375 string cmd18 = "-skipempty -minid 2577 -maxid 2577 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x020000";
376 string cmd19 = "-skipempty -minid 2578 -maxid 2578 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x040000";
377 string cmd20 = "-skipempty -minid 2579 -maxid 2579 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x080000";
378 string cmd21 = "-skipempty -minid 2816 -maxid 2816 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x100000";
379 string cmd22 = "-skipempty -minid 2817 -maxid 2817 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x200000";
380
381 AliHLTConfiguration pubDDL13("pubDDL13", "AliRawReaderPublisher", NULL, cmd13.c_str());
382 AliHLTConfiguration pubDDL14("pubDDL14", "AliRawReaderPublisher", NULL, cmd14.c_str());
383 AliHLTConfiguration pubDDL15("pubDDL15", "AliRawReaderPublisher", NULL, cmd15.c_str());
384 AliHLTConfiguration pubDDL16("pubDDL16", "AliRawReaderPublisher", NULL, cmd16.c_str());
385 AliHLTConfiguration pubDDL17("pubDDL17", "AliRawReaderPublisher", NULL, cmd17.c_str());
386 AliHLTConfiguration pubDDL18("pubDDL18", "AliRawReaderPublisher", NULL, cmd18.c_str());
387 AliHLTConfiguration pubDDL19("pubDDL19", "AliRawReaderPublisher", NULL, cmd19.c_str());
388 AliHLTConfiguration pubDDL20("pubDDL20", "AliRawReaderPublisher", NULL, cmd20.c_str());
389 AliHLTConfiguration pubDDL21("pubDDL21", "AliRawReaderPublisher", NULL, cmd21.c_str());
390 AliHLTConfiguration pubDDL22("pubDDL22", "AliRawReaderPublisher", NULL, cmd22.c_str());
391 }
cc76079a 392
393 // Build the DDL reconstructor components for all the DDLs 13 to 22, that
394 // is for chambers 7 to 10 and trigger stations. We only need to build
395 // these components if we are are building the ddlreco or full chains.
396 if (buildDDLRecoComps)
397 {
1b3806c8 398 if (TString(lutDir) == "CDB")
399 {
162637e4 400 AliHLTConfiguration recDDL13("recDDL13", "MUONHitReconstructor", "pubDDL13", TString("-ddl 13 -cdbpath local://$ALICE_ROOT/OCDB -run 0"));
401 AliHLTConfiguration recDDL14("recDDL14", "MUONHitReconstructor", "pubDDL14", TString("-ddl 14 -cdbpath local://$ALICE_ROOT/OCDB -run 0"));
402 AliHLTConfiguration recDDL15("recDDL15", "MUONHitReconstructor", "pubDDL15", TString("-ddl 15 -cdbpath local://$ALICE_ROOT/OCDB -run 0"));
403 AliHLTConfiguration recDDL16("recDDL16", "MUONHitReconstructor", "pubDDL16", TString("-ddl 16 -cdbpath local://$ALICE_ROOT/OCDB -run 0"));
404 AliHLTConfiguration recDDL17("recDDL17", "MUONHitReconstructor", "pubDDL17", TString("-ddl 17 -cdbpath local://$ALICE_ROOT/OCDB -run 0"));
405 AliHLTConfiguration recDDL18("recDDL18", "MUONHitReconstructor", "pubDDL18", TString("-ddl 18 -cdbpath local://$ALICE_ROOT/OCDB -run 0"));
406 AliHLTConfiguration recDDL19("recDDL19", "MUONHitReconstructor", "pubDDL19", TString("-ddl 19 -cdbpath local://$ALICE_ROOT/OCDB -run 0"));
407 AliHLTConfiguration recDDL20("recDDL20", "MUONHitReconstructor", "pubDDL20", TString("-ddl 20 -cdbpath local://$ALICE_ROOT/OCDB -run 0"));
408 AliHLTConfiguration recDDL21("recDDL21", "MUONTriggerReconstructor", "pubDDL21", TString("-ddl 21 -cdbpath local://$ALICE_ROOT/OCDB -run 0 -suppress_partial_triggers"));
409 AliHLTConfiguration recDDL22("recDDL22", "MUONTriggerReconstructor", "pubDDL22", TString("-ddl 22 -cdbpath local://$ALICE_ROOT/OCDB -run 0 -suppress_partial_triggers"));
1b3806c8 410 }
411 else
412 {
413 AliHLTConfiguration recDDL13("recDDL13", "MUONHitReconstructor", "pubDDL13", TString("-ddl 13 -lut ") + lutDir + TString("/Lut13.dat"));
414 AliHLTConfiguration recDDL14("recDDL14", "MUONHitReconstructor", "pubDDL14", TString("-ddl 14 -lut ") + lutDir + TString("/Lut14.dat"));
415 AliHLTConfiguration recDDL15("recDDL15", "MUONHitReconstructor", "pubDDL15", TString("-ddl 15 -lut ") + lutDir + TString("/Lut15.dat"));
416 AliHLTConfiguration recDDL16("recDDL16", "MUONHitReconstructor", "pubDDL16", TString("-ddl 16 -lut ") + lutDir + TString("/Lut16.dat"));
417 AliHLTConfiguration recDDL17("recDDL17", "MUONHitReconstructor", "pubDDL17", TString("-ddl 17 -lut ") + lutDir + TString("/Lut17.dat"));
418 AliHLTConfiguration recDDL18("recDDL18", "MUONHitReconstructor", "pubDDL18", TString("-ddl 18 -lut ") + lutDir + TString("/Lut18.dat"));
419 AliHLTConfiguration recDDL19("recDDL19", "MUONHitReconstructor", "pubDDL19", TString("-ddl 19 -lut ") + lutDir + TString("/Lut19.dat"));
420 AliHLTConfiguration recDDL20("recDDL20", "MUONHitReconstructor", "pubDDL20", TString("-ddl 20 -lut ") + lutDir + TString("/Lut20.dat"));
421 AliHLTConfiguration recDDL21("recDDL21", "MUONTriggerReconstructor", "pubDDL21", TString("-ddl 21 -lut ") + lutDir + TString("/Lut21.dat -suppress_partial_triggers"));
422 AliHLTConfiguration recDDL22("recDDL22", "MUONTriggerReconstructor", "pubDDL22", TString("-ddl 22 -lut ") + lutDir + TString("/Lut22.dat -suppress_partial_triggers"));
423 }
1f50d9b1 424 }
425
426 TString startEventStr = "-firstevent ";
427 startEventStr += firstEvent;
ee3678d3 428
1f50d9b1 429 // Build the data source components to take data from simulated hits if
430 // we are building the tracker only chain with the 'sim' data source.
cc76079a 431 if (buildSimDataPubs)
432 {
1f50d9b1 433 AliHLTConfiguration recDDL13("recDDL13", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left -chamber 7");
434 AliHLTConfiguration recDDL14("recDDL14", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 7");
435 AliHLTConfiguration recDDL15("recDDL15", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left -chamber 8");
436 AliHLTConfiguration recDDL16("recDDL16", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 8");
437 AliHLTConfiguration recDDL17("recDDL17", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left -chamber 9");
438 AliHLTConfiguration recDDL18("recDDL18", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 9");
439 AliHLTConfiguration recDDL19("recDDL19", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left -chamber 10");
440 AliHLTConfiguration recDDL20("recDDL20", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 10");
441 AliHLTConfiguration recDDL21("recDDL21", "MUONTriggerRecordsSource", NULL, startEventStr + " -hitdata -plane left");
442 AliHLTConfiguration recDDL22("recDDL22", "MUONTriggerRecordsSource", NULL, startEventStr + " -hitdata -plane right");
cc76079a 443 }
444
445 // Build the data source components to take data from offline reconstructed
446 // objects if we are building the tracker only chain with the 'rec' data source.
447 if (buildRecDataPubs)
448 {
1f50d9b1 449 AliHLTConfiguration recDDL13("recDDL13", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left -chamber 7");
450 AliHLTConfiguration recDDL14("recDDL14", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 7");
451 AliHLTConfiguration recDDL15("recDDL15", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left -chamber 8");
452 AliHLTConfiguration recDDL16("recDDL16", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 8");
453 AliHLTConfiguration recDDL17("recDDL17", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left -chamber 9");
454 AliHLTConfiguration recDDL18("recDDL18", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 9");
455 AliHLTConfiguration recDDL19("recDDL19", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left -chamber 10");
456 AliHLTConfiguration recDDL20("recDDL20", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 10");
457 AliHLTConfiguration recDDL21("recDDL21", "MUONTriggerRecordsSource", NULL, startEventStr + " -recdata -plane left");
458 AliHLTConfiguration recDDL22("recDDL22", "MUONTriggerRecordsSource", NULL, startEventStr + " -recdata -plane right");
cc76079a 459 }
460
461 // Build the tracker component if we are building the tracker only or
462 // full chains.
463 if (buildTrackerComp)
464 {
465 AliHLTConfiguration tracker("tracker", "MUONMansoTrackerFSM", "recDDL13 recDDL14 recDDL15 recDDL16 recDDL17 recDDL18 recDDL19 recDDL20 recDDL21 recDDL22", "");
466 }
c9537879 467
468 // Build the dHLT trigger decision component if enabled.
469 if (buildDecisionComp)
470 {
471 AliHLTConfiguration decision("decision", "MUONDecisionComponent", "tracker", "");
472 }
cc76079a 473
1f50d9b1 474 // Build the data sink to subscribe only to what has been created and
475 // to the data source we actaully want.
476 TString sources = "";
477 if (makeTracksOnly)
cc76079a 478 {
1f50d9b1 479 sources += "tracker ";
cc76079a 480 }
1f50d9b1 481 else
482 {
483 if (buildTrackerComp)
484 sources += "tracker ";
485 sources += "recDDL13 recDDL14 recDDL15 recDDL16 recDDL17 recDDL18 recDDL19 recDDL20 recDDL21 recDDL22";
486 }
c9537879 487 if (buildDecisionComp)
488 {
489 // Add the trigger decision component if it was enabled.
490 sources += " decision";
491 }
dba14d7d 492
493 // Build the data checker component if so requested.
494 if (checkData)
495 {
496 AliHLTConfiguration checker("checker", "MUONDataChecker", sources, "-warn_on_unexpected_block");
497 sources = "checker";
498 }
499
1f50d9b1 500 if (useRootWriter)
501 {
502 AliHLTConfiguration convert("convert", "MUONRootifier", sources, "");
d8cf7391 503 AliHLTConfiguration sink("sink", "ROOTFileWriter", "convert", "-concatenate-events -datafile output.root -specfmt");
1f50d9b1 504 }
505 else
cc76079a 506 {
1f50d9b1 507 AliHLTConfiguration sink("sink", "FileWriter", sources, "-datafile output.dat -specfmt");
cc76079a 508 }
509
1f50d9b1 510 // Build and run the chain's tasks.
511 sys.BuildTaskList("sink");
90af8855 512 if (buildDDLFilePubs)
513 {
514 sys.Run(eventCount);
515 }
516 else
517 {
518 // Setup the raw reader.
519 AliRawReader* rawReader = AliRawReader::Create(rawDataPath);
520 if (rawReader == NULL)
521 {
522 cerr << "ERROR: Could not create raw reader." << endl;
523 return;
524 }
525 if (! rawReader->IsRawReaderValid())
526 {
527 cerr << "ERROR: Raw reader is not valid." << endl;
528 return;
529 }
530 AliHLTOfflineInterface::SetParamsToComponents(NULL, rawReader);
531 // Now step through the events.
532 for (int i = 0; i < firstEvent; i++) rawReader->NextEvent();
533 for (int i = firstEvent; i <= lastEvent; i++)
534 {
535 // The "(i == lastEvent) ? 1 : 0" part is to indicate a
536 // stop run command when we hit the last event.
537 sys.Run(1, (i == lastEvent) ? 1 : 0);
538 rawReader->NextEvent();
539 }
540 }
cc76079a 541}