ROOT logo
/**************************************************************************
 * This file is property of and copyright by the ALICE HLT Project        *
 * All rights reserved.                                                   *
 *                                                                        *
 * Primary Authors:                                                       *
 *   Artur Szostak <artursz@iafrica.com>                                  *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

// $Id$

/**
 * \ingroup macros
 * \file RunChain.C
 * \brief Macro for running the dHLT chain in a standalone mode.
 *
 * This macro is used to run the dHLT component chain within the AliHLTSystem
 * framework, which is a simulation of the dHLT online system's output.
 * To run this macro you must be in the same directory as the galice.root
 * files or in the directory containing the rawXX/ directories produced from
 * AliRoot simulations.
 * Also make sure you specify CDB as for the lutDir (lookup table directory)
 * or that the appropriate LUTs are in the same directory as your working
 * directory, or you can specify the directory with the lutDir parameter option.
 *
 * The simplest way to run this macro with defaults is to copy "rootlogon.C" from
 * $ALICE_ROOT/HLT/MUON/macros into your current working directory, then from
 * the shell command prompt run the following command:
 * \code
 *   > aliroot -b -q -l $ALICE_ROOT/HLT/MUON/macros/RunChain.C+
 * \endcode
 *
 * \author Artur Szostak <artursz@iafrica.com>
 */

#if !defined(__CINT__) || defined(__MAKECINT__)
#include "AliRawReader.h"
#include "AliHLTOfflineInterface.h"
#include "AliCDBStorage.h"
#include "AliCDBManager.h"
#include "AliHLTSystem.h"
#include "AliHLTConfiguration.h"
#include "AliLog.h"
#include "TString.h"
#include <iostream>
using std::cerr;
using std::endl;
#endif

/**
 * Used to run the dimuon HLT (dHLT) chain in various configuration in a standalone
 * configuration. This is normally used for debugging, testing and can also be used
 * as an example of how to build chains for dHLT by hand.
 *
 * @param chainType  Specifies the type of chain to run. This can be one of the
 *     following:
 *       "full" - Run the full dHLT chain with manso tracker. (default)
 *       "full-tracker" - Run the full dHLT chain with the full tracker.
 *       "ddlreco" - Run only the reconstruction of the DDL raw data up to hits
 *                   and trigger records.
 *       "tracker" - Run the Manso tracker only using hits and trigger records from
 *                   AliRoot simulation or offline reconstruction.
 * @param firstEvent  The event number of the first event to process. (default = 0)
 * @param lastEvent  The event number of the last event to process. If this is
 *     less than firstEvent then it is set to firstEvent automatically. (default = -1)
 * @param output  Specifies the kind of output to generate. The options can be one
 *     of the following:
 *       "bin" - Generates all possible output and dumps it to binary files
 *                  using the FileWriter component.
 *       "root" - Generates all possible output and writes it to a ROOT file
 *                  using the ROOTFileWriter component.
 *       "tracks_bin" - Generates only track data and dumps it to binary files
 *                  using the FileWriter component. This option is equivalent to
 *                  'bin' if the chain type is 'ddlreco'.
 *       "tracks_root" - Generates only track data and writes it to a ROOT file
 *                  using the ROOTFileWriter component. This option is equivalent
 *                  to 'bin' if the chain type is 'ddlreco'.
 * @param dataSource  This is the data source from which to use hits and trigger
 *     records when we are running the tracker only chain and the DDL raw data
 *     reading method when running the 'full' or 'ddlreco' chain. If the
 *     chainType = "full" or "ddlreco", then the possible options are:
 *       "file"      - Reads the raw data directly from the DDL files. (default)
 *       "rawreader" - Reads the raw data using the AliRawReader interface from
 *               the current working directory.
 *     If the chainType = "tracker", then the possible options are:
 *       "sim" - Take data from GEANT hits. (default)
 *       "rec" - Take data from offline reconstructed hits and local trigger
 *               objects.
 * @param logLevel  Specifies the amount of logging messages produced by the HLT
 *     system. The possible options are:
 *       "normal" - Shows warnings, errors and information.
 *       "debug" - Shows all messages up to the debug level only for HLT and the
 *                 same as normal for all other modules.
 *       "max" - Shows everything including debug messages if they were compiled in.
 *       "min" - Shows only error messages.
 * @param lutDir  This is the directory in which the LUTs can be found.
 *      If it is set to "CDB" (case sensitive) then the LUTs will be loaded from
 *      CDB instead. The default behaviour is to read from the local CDB store.
 * @param checkData  A flag for indicating if the event data should be checked
 *      for consistency with the AliHLTMUONDataCheckerComponent.
 * @param rawDataPath  The path of the raw data (i.e. path to the rawXX directories)
 *      or can be the file name if using the "rawreader" option for dataSource.
 * @param runNumber  Specifies the run number to use. If it is set to -1 then the
 *      run number is not set if the CDB manager already has a run number set,
 *      otherwise a default run number of 0 is used. The default value is -1.
 * @param cdbPath  This gives the CDB path to use. If it is set to NULL then
 *      the CDB path is not set if the CDB manager already has a default storage
 *      CDB path set, otherwise a default value of "local://$ALICE_ROOT/OCDB" is used.
 *      The default value is NULL.
 * @param tryrecover  If this is true then the "-tryrecover" flag is set in the
 *      raw data reconstruction components. This is useful if when running RunChain
 *      log messages appear indicating that there was a problem decoding the raw data.
 *      The "-tryrecover" flag will turn on recovery logic in the raw data decoders
 *      to try and overcome errors in the data.
 */
void RunChain(
		const char* chainType = "full",
		Int_t firstEvent = 0,
		Int_t lastEvent = -1,
		const char* output = "bin",
		const char* dataSource = "file",
		const char* logLevel = "normal",
		const char* lutDir = "CDB",
		bool checkData = false,
		const char* rawDataPath = "./",
		Int_t runNumber = -1,
		const char* cdbPath = NULL,
		bool tryrecover = false
	)
{
	// Setup the CDB default storage and run number if nothing was set.
	AliCDBManager* cdbManager = AliCDBManager::Instance();
	if (cdbManager == NULL)
	{
		cerr << "ERROR: Global CDB manager object does not exist." << endl;
		return;
	}
	if (runNumber != -1)
	{
		cdbManager->SetRun(runNumber);
	}
	else if (cdbManager->GetRun() == -1)
	{
		cdbManager->SetRun(0);
	}
	if (cdbPath != NULL)
	{
		cdbManager->SetDefaultStorage(cdbPath);
	}
	else if (cdbManager->GetDefaultStorage() == NULL)
	{
		cdbManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
	}
	
	if (cdbManager->GetDefaultStorage() == NULL)
	{
		cerr << "ERROR: There is no value for the default CDB storage, cannot continue." << endl;
		return;
	}

	// Make sure that the lastEvent is greater than firstEvent.
	if (lastEvent < firstEvent)
		lastEvent = firstEvent;
	int eventCount = lastEvent - firstEvent + 1;
	
	bool buildDDLFilePubs = false;
	bool buildRawReaderPubs = false;
	bool buildDDLRecoComps = false;
	bool buildSimDataPubs = false;
	bool buildRecDataPubs = false;
	bool buildTrackerComp = false;
	bool buildFullTrackerComp = false;
	bool maxLogging = false;
	bool debugLogging = false;
	bool minLogging = false;
	bool useRootWriter = false;
	bool makeTracksOnly = false;
	bool buildDecisionComp = false;
	bool buildESDComp = false;
	
	// Parse the chainType, output, dataSource and logLevel option strings:
	TString outOpt = output;
	if (outOpt.CompareTo("bin", TString::kIgnoreCase) == 0)
	{
		useRootWriter = false;
	}
	else if (outOpt.CompareTo("root", TString::kIgnoreCase) == 0)
	{
		useRootWriter = true;
	}
	else if (outOpt.CompareTo("tracks_bin", TString::kIgnoreCase) == 0)
	{
		useRootWriter = false;
		makeTracksOnly = true;
	}
	else if (outOpt.CompareTo("tracks_root", TString::kIgnoreCase) == 0)
	{
		useRootWriter = true;
		makeTracksOnly = true;
	}
	else
	{
		cerr << "ERROR: Unknown option for output: '" << output << "'" << endl;
		return;
	}
	
	TString chainOpt = chainType;
	if (chainOpt.CompareTo("full", TString::kIgnoreCase) == 0)
	{
		buildDDLRecoComps = true;
		buildTrackerComp = true;
		buildDecisionComp = true;
		buildESDComp = true;
		
		TString dataOpt = dataSource;
		if (dataOpt.CompareTo("file", TString::kIgnoreCase) == 0)
		{
			buildDDLFilePubs = true;
		}
		else if (dataOpt.CompareTo("rawreader", TString::kIgnoreCase) == 0)
		{
			buildRawReaderPubs = true;
		}
		else
		{
			cerr << "ERROR: Unknown option for dataSource: '" << dataSource
				<< "'. Valid options are: 'file' or 'rawreader'" << endl;
			return;
		}
	}
	else if (chainOpt.CompareTo("full-tracker", TString::kIgnoreCase) == 0)
	{
		buildDDLRecoComps = true;
		buildFullTrackerComp = true;
		buildDecisionComp = true;
		buildESDComp = true;
		
		TString dataOpt = dataSource;
		if (dataOpt.CompareTo("file", TString::kIgnoreCase) == 0)
		{
			buildDDLFilePubs = true;
		}
		else if (dataOpt.CompareTo("rawreader", TString::kIgnoreCase) == 0)
		{
			buildRawReaderPubs = true;
		}
		else
		{
			cerr << "ERROR: Unknown option for dataSource: '" << dataSource
				<< "'. Valid options are: 'file' or 'rawreader'" << endl;
			return;
		}
	}
	else if (chainOpt.CompareTo("ddlreco", TString::kIgnoreCase) == 0)
	{
		buildDDLRecoComps = true;
		buildDecisionComp = false;
		buildESDComp = false;
		
		TString dataOpt = dataSource;
		if (dataOpt.CompareTo("file", TString::kIgnoreCase) == 0)
		{
			buildDDLFilePubs = true;
		}
		else if (dataOpt.CompareTo("rawreader", TString::kIgnoreCase) == 0)
		{
			buildRawReaderPubs = true;
		}
		else
		{
			cerr << "ERROR: Unknown option for dataSource: '" << dataSource
				<< "'. Valid options are: 'file' or 'rawreader'" << endl;
			return;
		}
	}
	else if (chainOpt.CompareTo("tracker", TString::kIgnoreCase) == 0)
	{
		buildTrackerComp = true;
		buildDecisionComp = true;
		buildESDComp = true;
		
		TString dataOpt = dataSource;
		if (dataOpt.CompareTo("sim", TString::kIgnoreCase) == 0)
		{
			buildSimDataPubs = true;
		}
		else if (dataOpt.CompareTo("rec", TString::kIgnoreCase) == 0)
		{
			buildRecDataPubs = true;
		}
		else
		{
			cerr << "ERROR: Unknown option for dataSource: '" << dataSource
				<< "'. Valid options are: 'sim' or 'rec'" << endl;
			return;
		}
	}
	else
	{
		cerr << "ERROR: Unknown option for chainType: '" << chainType << "'" << endl;
		return;
	}
	
	TString logOpt = logLevel;
	if (logOpt.CompareTo("normal", TString::kIgnoreCase) == 0)
	{
		// nothing to do.
	}
	else if (logOpt.CompareTo("debug", TString::kIgnoreCase) == 0)
	{
		debugLogging = true;
	}
	else if (logOpt.CompareTo("max", TString::kIgnoreCase) == 0)
	{
		maxLogging = true;
	}
	else if (logOpt.CompareTo("min", TString::kIgnoreCase) == 0)
	{
		minLogging = true;
	}
	else
	{
		cerr << "ERROR: Unknown option for logLevel: '" << logLevel << "'" << endl;
		return;
	}
	
	// If we are supposed to make tracks only but are in a ddlreco chain
	// then we clearly can only generate the DDL reconstructed data, so do that.
	if (makeTracksOnly && ! buildTrackerComp)
	{
		makeTracksOnly = false;
	}
	
	// Now we can initialise the AliHLTSystem...
	AliHLTSystem sys;
	
	// Start by setting up the logging.
	if (maxLogging)
	{
		AliLog::SetGlobalLogLevel(AliLog::kMaxType);
		sys.SetGlobalLoggingLevel(kHLTLogAll);
	}
	if (debugLogging)
	{
		AliLog::SetModuleDebugLevel("HLT", AliLog::kMaxType);
		sys.SetGlobalLoggingLevel(kHLTLogAll);
	}
	if (minLogging)
	{
		sys.SetGlobalLoggingLevel(AliHLTComponentLogSeverity(
			kHLTLogFatal | kHLTLogError
		));
	}
	
	sys.LoadComponentLibraries("libAliHLTUtil.so");
	sys.LoadComponentLibraries("libAliHLTMUON.so");

	// The DDL file publishers are only needed if we create the ddlreco or
	// full chains. The filename lists are built assuming the aliroot rawXX/
	// directory structure.
	if (buildDDLFilePubs)
	{
		string cmd1 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x000001";
		string cmd2 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x000002";
		string cmd3 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x000004";
		string cmd4 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x000008";
		string cmd5 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x000010";
		string cmd6 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x000020";
		string cmd7 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x000040";
		string cmd8 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x000080";
		string cmd9 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x000100";
		string cmd10 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x000200";
		string cmd11 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x000400";
		string cmd12 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x000800";
		string cmd13 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x001000";
		string cmd14 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x002000";
		string cmd15 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x004000";
		string cmd16 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x008000";
		string cmd17 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x010000";
		string cmd18 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x020000";
		string cmd19 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x040000";
		string cmd20 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x080000";
		string cmd21 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x100000";
		string cmd22 = "-datatype 'DDL_RAW ' 'MUON' -dataspec 0x200000";
		for (int i = firstEvent; i < lastEvent+1; i++)
		{
			if (i != 0)
			{
				cmd13 += " -nextevent";
				cmd14 += " -nextevent";
				cmd15 += " -nextevent";
				cmd16 += " -nextevent";
				cmd17 += " -nextevent";
				cmd18 += " -nextevent";
				cmd19 += " -nextevent";
				cmd20 += " -nextevent";
				cmd21 += " -nextevent";
				cmd22 += " -nextevent";
			}
			char buf[16];
			sprintf(buf, "%d", i);
			cmd1 += " -datafile "; cmd1 += rawDataPath; cmd1 += "raw"; cmd1 += buf; cmd1 += "/MUONTRK_2560.ddl";
			cmd2 += " -datafile "; cmd2 += rawDataPath; cmd2 += "raw"; cmd2 += buf; cmd2 += "/MUONTRK_2561.ddl";
			cmd3 += " -datafile "; cmd3 += rawDataPath; cmd3 += "raw"; cmd3 += buf; cmd3 += "/MUONTRK_2562.ddl";
			cmd4 += " -datafile "; cmd4 += rawDataPath; cmd4 += "raw"; cmd4 += buf; cmd4 += "/MUONTRK_2563.ddl";
			cmd5 += " -datafile "; cmd5 += rawDataPath; cmd5 += "raw"; cmd5 += buf; cmd5 += "/MUONTRK_2564.ddl";
			cmd6 += " -datafile "; cmd6 += rawDataPath; cmd6 += "raw"; cmd6 += buf; cmd6 += "/MUONTRK_2565.ddl";
			cmd7 += " -datafile "; cmd7 += rawDataPath; cmd7 += "raw"; cmd7 += buf; cmd7 += "/MUONTRK_2566.ddl";
			cmd8 += " -datafile "; cmd8 += rawDataPath; cmd8 += "raw"; cmd8 += buf; cmd8 += "/MUONTRK_2567.ddl";
			cmd9 += " -datafile "; cmd9 += rawDataPath; cmd9 += "raw"; cmd9 += buf; cmd9 += "/MUONTRK_2568.ddl";
			cmd10 += " -datafile "; cmd10 += rawDataPath; cmd10 += "raw"; cmd10 += buf; cmd10 += "/MUONTRK_2569.ddl";
			cmd11 += " -datafile "; cmd11 += rawDataPath; cmd11 += "raw"; cmd11 += buf; cmd11 += "/MUONTRK_2570.ddl";
			cmd12 += " -datafile "; cmd12 += rawDataPath; cmd12 += "raw"; cmd12 += buf; cmd12 += "/MUONTRK_2571.ddl";
			cmd13 += " -datafile "; cmd13 += rawDataPath; cmd13 += "raw"; cmd13 += buf; cmd13 += "/MUONTRK_2572.ddl";
			cmd14 += " -datafile "; cmd14 += rawDataPath; cmd14 += "raw"; cmd14 += buf; cmd14 += "/MUONTRK_2573.ddl";
			cmd15 += " -datafile "; cmd15 += rawDataPath; cmd15 += "raw"; cmd15 += buf; cmd15 += "/MUONTRK_2574.ddl";
			cmd16 += " -datafile "; cmd16 += rawDataPath; cmd16 += "raw"; cmd16 += buf; cmd16 += "/MUONTRK_2575.ddl";
			cmd17 += " -datafile "; cmd17 += rawDataPath; cmd17 += "raw"; cmd17 += buf; cmd17 += "/MUONTRK_2576.ddl";
			cmd18 += " -datafile "; cmd18 += rawDataPath; cmd18 += "raw"; cmd18 += buf; cmd18 += "/MUONTRK_2577.ddl";
			cmd19 += " -datafile "; cmd19 += rawDataPath; cmd19 += "raw"; cmd19 += buf; cmd19 += "/MUONTRK_2578.ddl";
			cmd20 += " -datafile "; cmd20 += rawDataPath; cmd20 += "raw"; cmd20 += buf; cmd20 += "/MUONTRK_2579.ddl";
			cmd21 += " -datafile "; cmd21 += rawDataPath; cmd21 += "raw"; cmd21 += buf; cmd21 += "/MUONTRG_2816.ddl";
			cmd22 += " -datafile "; cmd22 += rawDataPath; cmd22 += "raw"; cmd22 += buf; cmd22 += "/MUONTRG_2817.ddl";
		}
		
		AliHLTConfiguration pubDDL1("pubDDL1", "FilePublisher", NULL, cmd1.c_str());
		AliHLTConfiguration pubDDL2("pubDDL2", "FilePublisher", NULL, cmd2.c_str());
		AliHLTConfiguration pubDDL3("pubDDL3", "FilePublisher", NULL, cmd3.c_str());
		AliHLTConfiguration pubDDL4("pubDDL4", "FilePublisher", NULL, cmd4.c_str());
		AliHLTConfiguration pubDDL5("pubDDL5", "FilePublisher", NULL, cmd5.c_str());
		AliHLTConfiguration pubDDL6("pubDDL6", "FilePublisher", NULL, cmd6.c_str());
		AliHLTConfiguration pubDDL7("pubDDL7", "FilePublisher", NULL, cmd7.c_str());
		AliHLTConfiguration pubDDL8("pubDDL8", "FilePublisher", NULL, cmd8.c_str());
		AliHLTConfiguration pubDDL9("pubDDL9", "FilePublisher", NULL, cmd9.c_str());
		AliHLTConfiguration pubDDL10("pubDDL10", "FilePublisher", NULL, cmd10.c_str());
		AliHLTConfiguration pubDDL11("pubDDL11", "FilePublisher", NULL, cmd11.c_str());
		AliHLTConfiguration pubDDL12("pubDDL12", "FilePublisher", NULL, cmd12.c_str());
		AliHLTConfiguration pubDDL13("pubDDL13", "FilePublisher", NULL, cmd13.c_str());
		AliHLTConfiguration pubDDL14("pubDDL14", "FilePublisher", NULL, cmd14.c_str());
		AliHLTConfiguration pubDDL15("pubDDL15", "FilePublisher", NULL, cmd15.c_str());
		AliHLTConfiguration pubDDL16("pubDDL16", "FilePublisher", NULL, cmd16.c_str());
		AliHLTConfiguration pubDDL17("pubDDL17", "FilePublisher", NULL, cmd17.c_str());
		AliHLTConfiguration pubDDL18("pubDDL18", "FilePublisher", NULL, cmd18.c_str());
		AliHLTConfiguration pubDDL19("pubDDL19", "FilePublisher", NULL, cmd19.c_str());
		AliHLTConfiguration pubDDL20("pubDDL20", "FilePublisher", NULL, cmd20.c_str());
	        AliHLTConfiguration pubDDL21("pubDDL21", "FilePublisher", NULL, cmd21.c_str());
	        AliHLTConfiguration pubDDL22("pubDDL22", "FilePublisher", NULL, cmd22.c_str());
	}

	// Build the DDL file publishers using AliRawReaderPublisher components.
	if (buildRawReaderPubs)
	{
		string cmd1 = "-skipempty -minid 2560 -maxid 2560 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x000001";
		string cmd2 = "-skipempty -minid 2561 -maxid 2561 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x000002";
		string cmd3 = "-skipempty -minid 2562 -maxid 2562 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x000004";
		string cmd4 = "-skipempty -minid 2563 -maxid 2563 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x000008";
		string cmd5 = "-skipempty -minid 2564 -maxid 2564 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x000010";
		string cmd6 = "-skipempty -minid 2565 -maxid 2565 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x000020";
		string cmd7 = "-skipempty -minid 2566 -maxid 2566 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x000040";
		string cmd8 = "-skipempty -minid 2567 -maxid 2567 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x000080";
		string cmd9 = "-skipempty -minid 2568 -maxid 2568 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x000100";
		string cmd10 = "-skipempty -minid 2569 -maxid 2569 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x000200";
		string cmd11 = "-skipempty -minid 2570 -maxid 2570 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x000400";
		string cmd12 = "-skipempty -minid 2571 -maxid 2571 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x000800";
		string cmd13 = "-skipempty -minid 2572 -maxid 2572 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x001000";
		string cmd14 = "-skipempty -minid 2573 -maxid 2573 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x002000";
		string cmd15 = "-skipempty -minid 2574 -maxid 2574 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x004000";
		string cmd16 = "-skipempty -minid 2575 -maxid 2575 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x008000";
		string cmd17 = "-skipempty -minid 2576 -maxid 2576 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x010000";
		string cmd18 = "-skipempty -minid 2577 -maxid 2577 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x020000";
		string cmd19 = "-skipempty -minid 2578 -maxid 2578 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x040000";
		string cmd20 = "-skipempty -minid 2579 -maxid 2579 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x080000";
		string cmd21 = "-skipempty -minid 2816 -maxid 2816 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x100000";
		string cmd22 = "-skipempty -minid 2817 -maxid 2817 -datatype 'DDL_RAW ' 'MUON' -dataspec 0x200000";

		AliHLTConfiguration pubDDL1("pubDDL1", "AliRawReaderPublisher", NULL, cmd1.c_str());
		AliHLTConfiguration pubDDL2("pubDDL2", "AliRawReaderPublisher", NULL, cmd2.c_str());
		AliHLTConfiguration pubDDL3("pubDDL3", "AliRawReaderPublisher", NULL, cmd3.c_str());
		AliHLTConfiguration pubDDL4("pubDDL4", "AliRawReaderPublisher", NULL, cmd4.c_str());
		AliHLTConfiguration pubDDL5("pubDDL5", "AliRawReaderPublisher", NULL, cmd5.c_str());
		AliHLTConfiguration pubDDL6("pubDDL6", "AliRawReaderPublisher", NULL, cmd6.c_str());
		AliHLTConfiguration pubDDL7("pubDDL7", "AliRawReaderPublisher", NULL, cmd7.c_str());
		AliHLTConfiguration pubDDL8("pubDDL8", "AliRawReaderPublisher", NULL, cmd8.c_str());
		AliHLTConfiguration pubDDL9("pubDDL9", "AliRawReaderPublisher", NULL, cmd9.c_str());
		AliHLTConfiguration pubDDL10("pubDDL10", "AliRawReaderPublisher", NULL, cmd10.c_str());
		AliHLTConfiguration pubDDL11("pubDDL11", "AliRawReaderPublisher", NULL, cmd11.c_str());
		AliHLTConfiguration pubDDL12("pubDDL12", "AliRawReaderPublisher", NULL, cmd12.c_str());
		AliHLTConfiguration pubDDL13("pubDDL13", "AliRawReaderPublisher", NULL, cmd13.c_str());
		AliHLTConfiguration pubDDL14("pubDDL14", "AliRawReaderPublisher", NULL, cmd14.c_str());
		AliHLTConfiguration pubDDL15("pubDDL15", "AliRawReaderPublisher", NULL, cmd15.c_str());
		AliHLTConfiguration pubDDL16("pubDDL16", "AliRawReaderPublisher", NULL, cmd16.c_str());
		AliHLTConfiguration pubDDL17("pubDDL17", "AliRawReaderPublisher", NULL, cmd17.c_str());
		AliHLTConfiguration pubDDL18("pubDDL18", "AliRawReaderPublisher", NULL, cmd18.c_str());
		AliHLTConfiguration pubDDL19("pubDDL19", "AliRawReaderPublisher", NULL, cmd19.c_str());
		AliHLTConfiguration pubDDL20("pubDDL20", "AliRawReaderPublisher", NULL, cmd20.c_str());
	        AliHLTConfiguration pubDDL21("pubDDL21", "AliRawReaderPublisher", NULL, cmd21.c_str());
	        AliHLTConfiguration pubDDL22("pubDDL22", "AliRawReaderPublisher", NULL, cmd22.c_str());
	}
	
	// Build the DDL reconstructor components for all the DDLs 13 to 22, that
	// is for chambers 7 to 10 and trigger stations. We only need to build
	// these components if we are are building the ddlreco or full chains.
	if (buildDDLRecoComps)
	{
		const char* recoverFlag = tryrecover ? "-tryrecover" : "";
		for (int k = 1; k <= 22; k++)
		{
			string compId = Form("recDDL%d", k);
			string name = (k <= 20) ? "MUONHitReconstructor" : "MUONTriggerReconstructor";
			string parent = Form("pubDDL%d", k);
			string cmd;
			const char* extraInfoFlags = k < 21 ? "-makeclusters -makechannels" : "-makedebuginfo";
			if (TString(lutDir) == "CDB")
			{
				const char* path = cdbManager->GetDefaultStorage()->GetURI().Data();
				cmd = Form("-ddl %d -cdbpath %s -run %d %s %s",
					k, path, cdbManager->GetRun(), recoverFlag, extraInfoFlags
				);
			}
			else
			{
				cmd = Form("-ddl %d -lut %s/Lut%d.dat %s %s",
					k, lutDir, k, recoverFlag, extraInfoFlags
				);
			}
			if (k >= 21)
			{
				cmd += " -suppress_partial_triggers -dont_use_crateid -dont_use_localid";
			}
			AliHLTConfiguration recDDL(compId.c_str(), name.c_str(), parent.c_str(), cmd.c_str());
		}
	}

	TString startEventStr = "-firstevent ";
	startEventStr += firstEvent;
	
	// Build the data source components to take data from simulated hits if
	// we are building the tracker only chain with the 'sim' data source.
	if (buildSimDataPubs)
	{
		AliHLTConfiguration recDDL1("recDDL1", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left  -chamber 1");
		AliHLTConfiguration recDDL2("recDDL2", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 1");
		AliHLTConfiguration recDDL3("recDDL3", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left  -chamber 2");
		AliHLTConfiguration recDDL4("recDDL4", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 2");
		AliHLTConfiguration recDDL5("recDDL5", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left  -chamber 3");
		AliHLTConfiguration recDDL6("recDDL6", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 3");
		AliHLTConfiguration recDDL7("recDDL7", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left  -chamber 4");
		AliHLTConfiguration recDDL8("recDDL8", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 4");
		AliHLTConfiguration recDDL9("recDDL9", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left  -chamber 5");
		AliHLTConfiguration recDDL10("recDDL10", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 5");
		AliHLTConfiguration recDDL11("recDDL11", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left  -chamber 6");
		AliHLTConfiguration recDDL12("recDDL12", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 6");
		AliHLTConfiguration recDDL13("recDDL13", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left  -chamber 7");
		AliHLTConfiguration recDDL14("recDDL14", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 7");
		AliHLTConfiguration recDDL15("recDDL15", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left  -chamber 8");
		AliHLTConfiguration recDDL16("recDDL16", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 8");
		AliHLTConfiguration recDDL17("recDDL17", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left  -chamber 9");
		AliHLTConfiguration recDDL18("recDDL18", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 9");
		AliHLTConfiguration recDDL19("recDDL19", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane left  -chamber 10");
		AliHLTConfiguration recDDL20("recDDL20", "MUONRecHitsSource", NULL, startEventStr + " -simdata -plane right -chamber 10");
		AliHLTConfiguration recDDL21("recDDL21", "MUONTriggerRecordsSource", NULL, startEventStr + " -hitdata -plane left");
		AliHLTConfiguration recDDL22("recDDL22", "MUONTriggerRecordsSource", NULL, startEventStr + " -hitdata -plane right");
	}
	
        // Build the data source components to take data from offline reconstructed
        // objects if we are building the tracker only chain with the 'rec' data source.
	if (buildRecDataPubs)
	{
		AliHLTConfiguration recDDL1("recDDL1", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left  -chamber 1");
		AliHLTConfiguration recDDL2("recDDL2", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 1");
		AliHLTConfiguration recDDL3("recDDL3", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left  -chamber 2");
		AliHLTConfiguration recDDL4("recDDL4", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 2");
		AliHLTConfiguration recDDL5("recDDL5", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left  -chamber 3");
		AliHLTConfiguration recDDL6("recDDL6", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 3");
		AliHLTConfiguration recDDL7("recDDL7", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left  -chamber 4");
		AliHLTConfiguration recDDL8("recDDL8", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 4");
		AliHLTConfiguration recDDL9("recDDL9", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left  -chamber 5");
		AliHLTConfiguration recDDL10("recDDL10", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 5");
		AliHLTConfiguration recDDL11("recDDL11", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left  -chamber 6");
		AliHLTConfiguration recDDL12("recDDL12", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 6");
		AliHLTConfiguration recDDL13("recDDL13", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left  -chamber 7");
		AliHLTConfiguration recDDL14("recDDL14", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 7");
		AliHLTConfiguration recDDL15("recDDL15", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left  -chamber 8");
		AliHLTConfiguration recDDL16("recDDL16", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 8");
		AliHLTConfiguration recDDL17("recDDL17", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left  -chamber 9");
		AliHLTConfiguration recDDL18("recDDL18", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 9");
		AliHLTConfiguration recDDL19("recDDL19", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane left  -chamber 10");
		AliHLTConfiguration recDDL20("recDDL20", "MUONRecHitsSource", NULL, startEventStr + " -recdata -plane right -chamber 10");
		AliHLTConfiguration recDDL21("recDDL21", "MUONTriggerRecordsSource", NULL, startEventStr + " -recdata -plane left");
		AliHLTConfiguration recDDL22("recDDL22", "MUONTriggerRecordsSource", NULL, startEventStr + " -recdata -plane right");
	}
	
	// Build the tracker component if we are building the tracker only or
	// full chains.
	if (buildTrackerComp)
	{
		AliHLTConfiguration tracker(
			"tracker",
			"MUONMansoTrackerFSM",
			"recDDL13 recDDL14 recDDL15 recDDL16 recDDL17 recDDL18 recDDL19 recDDL20 recDDL21 recDDL22",
			"-makecandidates"
		);
	}
	if (buildFullTrackerComp)
	{
		AliHLTConfiguration fulltracker(
			"tracker-full",
			"MUONFullTracker",
			"recDDL1 recDDL2 recDDL3 recDDL4 recDDL5 recDDL6 recDDL7 recDDL8 recDDL9 recDDL10 recDDL11"
			" recDDL12 recDDL13 recDDL14 recDDL15 recDDL16 recDDL17 recDDL18 recDDL19 recDDL20 recDDL21 recDDL22",
			""
		);
	}
	
	// Build the dHLT trigger decision component if enabled.
	if (buildDecisionComp)
	{
		const char* decisionSource = "tracker";
		if (buildFullTrackerComp) decisionSource = "tracker-full";
		AliHLTConfiguration decision("decision", "MUONDecisionComponent", decisionSource, "");
	}
	if (buildESDComp)
	{
	        const char* ESDSource = "tracker recDDL21 recDDL22 ";
		if (buildFullTrackerComp) ESDSource = "tracker-full recDDL21 recDDL22 ";
		AliHLTConfiguration ESD("ESD", AliHLTMUONConstants::ESDMakerId(), ESDSource, " -make_minimal_esd");
	}

	// Build the data sink to subscribe only to what has been created and
	// to the data source we actaully want.
	TString sources = "";
	if (makeTracksOnly)
	{
		sources += "tracker ";
	}
	else
	{
		if (buildTrackerComp) sources += "tracker ";
		if (buildFullTrackerComp) sources += "tracker-full ";
		sources += "recDDL1 recDDL2 recDDL3 recDDL4 recDDL5 recDDL6 recDDL7 recDDL8 recDDL9 recDDL10 recDDL11"
			" recDDL12 recDDL13 recDDL14 recDDL15 recDDL16 recDDL17 recDDL18 recDDL19 recDDL20 recDDL21 recDDL22";
	}
	if (buildDecisionComp)
	{
		// Add the trigger decision component if it was enabled.
		sources += " decision";
	}
	if (buildESDComp)
	{
		sources += " ESD ";
	}
	
	// Build the data checker component if so requested.
	if (checkData)
	{
		AliHLTConfiguration checker("checker", "MUONDataChecker", sources, "-warn_on_unexpected_block");
		sources = "checker"; // Only add the checker to the sources in this case since it will forward just the bad events.
	}
	
	if (useRootWriter)
	{
		AliHLTConfiguration convert("convert", "MUONRootifier", sources, "");
		AliHLTConfiguration sink("sink", "ROOTFileWriter", "convert", "-concatenate-events -datafile output.root -specfmt");
	}
	else
	{
		AliHLTConfiguration sink("sink", "FileWriter", sources, "-datafile output.dat -specfmt");
	}
	
	// Build and run the chain's tasks.
	sys.BuildTaskList("sink");
	if (buildDDLFilePubs)
	{
		sys.Run(eventCount);
	}
	else
	{
		// Setup the raw reader.
		AliRawReader* rawReader = AliRawReader::Create(rawDataPath);
		if (rawReader == NULL)
		{
			cerr << "ERROR: Could not create raw reader." << endl;
			return;
		}
		if (! rawReader->IsRawReaderValid())
		{
			cerr << "ERROR: Raw reader is not valid." << endl;
			return;
		}
		AliHLTOfflineInterface::SetParamsToComponents(NULL, rawReader);
		rawReader->NextEvent(); // Need to call this once here or we will start at the wrong event.
		// Now step through the events.
		for (int i = 0; i < firstEvent; i++) rawReader->NextEvent();
		for (int i = firstEvent; i <= lastEvent; i++)
		{
			// The "(i == lastEvent) ? 1 : 0" part is to indicate a
			// stop run command when we hit the last event.
			sys.Run(1, (i == lastEvent) ? 1 : 0);
			rawReader->NextEvent();
		}
	}
}
 RunChain.C:1
 RunChain.C:2
 RunChain.C:3
 RunChain.C:4
 RunChain.C:5
 RunChain.C:6
 RunChain.C:7
 RunChain.C:8
 RunChain.C:9
 RunChain.C:10
 RunChain.C:11
 RunChain.C:12
 RunChain.C:13
 RunChain.C:14
 RunChain.C:15
 RunChain.C:16
 RunChain.C:17
 RunChain.C:18
 RunChain.C:19
 RunChain.C:20
 RunChain.C:21
 RunChain.C:22
 RunChain.C:23
 RunChain.C:24
 RunChain.C:25
 RunChain.C:26
 RunChain.C:27
 RunChain.C:28
 RunChain.C:29
 RunChain.C:30
 RunChain.C:31
 RunChain.C:32
 RunChain.C:33
 RunChain.C:34
 RunChain.C:35
 RunChain.C:36
 RunChain.C:37
 RunChain.C:38
 RunChain.C:39
 RunChain.C:40
 RunChain.C:41
 RunChain.C:42
 RunChain.C:43
 RunChain.C:44
 RunChain.C:45
 RunChain.C:46
 RunChain.C:47
 RunChain.C:48
 RunChain.C:49
 RunChain.C:50
 RunChain.C:51
 RunChain.C:52
 RunChain.C:53
 RunChain.C:54
 RunChain.C:55
 RunChain.C:56
 RunChain.C:57
 RunChain.C:58
 RunChain.C:59
 RunChain.C:60
 RunChain.C:61
 RunChain.C:62
 RunChain.C:63
 RunChain.C:64
 RunChain.C:65
 RunChain.C:66
 RunChain.C:67
 RunChain.C:68
 RunChain.C:69
 RunChain.C:70
 RunChain.C:71
 RunChain.C:72
 RunChain.C:73
 RunChain.C:74
 RunChain.C:75
 RunChain.C:76
 RunChain.C:77
 RunChain.C:78
 RunChain.C:79
 RunChain.C:80
 RunChain.C:81
 RunChain.C:82
 RunChain.C:83
 RunChain.C:84
 RunChain.C:85
 RunChain.C:86
 RunChain.C:87
 RunChain.C:88
 RunChain.C:89
 RunChain.C:90
 RunChain.C:91
 RunChain.C:92
 RunChain.C:93
 RunChain.C:94
 RunChain.C:95
 RunChain.C:96
 RunChain.C:97
 RunChain.C:98
 RunChain.C:99
 RunChain.C:100
 RunChain.C:101
 RunChain.C:102
 RunChain.C:103
 RunChain.C:104
 RunChain.C:105
 RunChain.C:106
 RunChain.C:107
 RunChain.C:108
 RunChain.C:109
 RunChain.C:110
 RunChain.C:111
 RunChain.C:112
 RunChain.C:113
 RunChain.C:114
 RunChain.C:115
 RunChain.C:116
 RunChain.C:117
 RunChain.C:118
 RunChain.C:119
 RunChain.C:120
 RunChain.C:121
 RunChain.C:122
 RunChain.C:123
 RunChain.C:124
 RunChain.C:125
 RunChain.C:126
 RunChain.C:127
 RunChain.C:128
 RunChain.C:129
 RunChain.C:130
 RunChain.C:131
 RunChain.C:132
 RunChain.C:133
 RunChain.C:134
 RunChain.C:135
 RunChain.C:136
 RunChain.C:137
 RunChain.C:138
 RunChain.C:139
 RunChain.C:140
 RunChain.C:141
 RunChain.C:142
 RunChain.C:143
 RunChain.C:144
 RunChain.C:145
 RunChain.C:146
 RunChain.C:147
 RunChain.C:148
 RunChain.C:149
 RunChain.C:150
 RunChain.C:151
 RunChain.C:152
 RunChain.C:153
 RunChain.C:154
 RunChain.C:155
 RunChain.C:156
 RunChain.C:157
 RunChain.C:158
 RunChain.C:159
 RunChain.C:160
 RunChain.C:161
 RunChain.C:162
 RunChain.C:163
 RunChain.C:164
 RunChain.C:165
 RunChain.C:166
 RunChain.C:167
 RunChain.C:168
 RunChain.C:169
 RunChain.C:170
 RunChain.C:171
 RunChain.C:172
 RunChain.C:173
 RunChain.C:174
 RunChain.C:175
 RunChain.C:176
 RunChain.C:177
 RunChain.C:178
 RunChain.C:179
 RunChain.C:180
 RunChain.C:181
 RunChain.C:182
 RunChain.C:183
 RunChain.C:184
 RunChain.C:185
 RunChain.C:186
 RunChain.C:187
 RunChain.C:188
 RunChain.C:189
 RunChain.C:190
 RunChain.C:191
 RunChain.C:192
 RunChain.C:193
 RunChain.C:194
 RunChain.C:195
 RunChain.C:196
 RunChain.C:197
 RunChain.C:198
 RunChain.C:199
 RunChain.C:200
 RunChain.C:201
 RunChain.C:202
 RunChain.C:203
 RunChain.C:204
 RunChain.C:205
 RunChain.C:206
 RunChain.C:207
 RunChain.C:208
 RunChain.C:209
 RunChain.C:210
 RunChain.C:211
 RunChain.C:212
 RunChain.C:213
 RunChain.C:214
 RunChain.C:215
 RunChain.C:216
 RunChain.C:217
 RunChain.C:218
 RunChain.C:219
 RunChain.C:220
 RunChain.C:221
 RunChain.C:222
 RunChain.C:223
 RunChain.C:224
 RunChain.C:225
 RunChain.C:226
 RunChain.C:227
 RunChain.C:228
 RunChain.C:229
 RunChain.C:230
 RunChain.C:231
 RunChain.C:232
 RunChain.C:233
 RunChain.C:234
 RunChain.C:235
 RunChain.C:236
 RunChain.C:237
 RunChain.C:238
 RunChain.C:239
 RunChain.C:240
 RunChain.C:241
 RunChain.C:242
 RunChain.C:243
 RunChain.C:244
 RunChain.C:245
 RunChain.C:246
 RunChain.C:247
 RunChain.C:248
 RunChain.C:249
 RunChain.C:250
 RunChain.C:251
 RunChain.C:252
 RunChain.C:253
 RunChain.C:254
 RunChain.C:255
 RunChain.C:256
 RunChain.C:257
 RunChain.C:258
 RunChain.C:259
 RunChain.C:260
 RunChain.C:261
 RunChain.C:262
 RunChain.C:263
 RunChain.C:264
 RunChain.C:265
 RunChain.C:266
 RunChain.C:267
 RunChain.C:268
 RunChain.C:269
 RunChain.C:270
 RunChain.C:271
 RunChain.C:272
 RunChain.C:273
 RunChain.C:274
 RunChain.C:275
 RunChain.C:276
 RunChain.C:277
 RunChain.C:278
 RunChain.C:279
 RunChain.C:280
 RunChain.C:281
 RunChain.C:282
 RunChain.C:283
 RunChain.C:284
 RunChain.C:285
 RunChain.C:286
 RunChain.C:287
 RunChain.C:288
 RunChain.C:289
 RunChain.C:290
 RunChain.C:291
 RunChain.C:292
 RunChain.C:293
 RunChain.C:294
 RunChain.C:295
 RunChain.C:296
 RunChain.C:297
 RunChain.C:298
 RunChain.C:299
 RunChain.C:300
 RunChain.C:301
 RunChain.C:302
 RunChain.C:303
 RunChain.C:304
 RunChain.C:305
 RunChain.C:306
 RunChain.C:307
 RunChain.C:308
 RunChain.C:309
 RunChain.C:310
 RunChain.C:311
 RunChain.C:312
 RunChain.C:313
 RunChain.C:314
 RunChain.C:315
 RunChain.C:316
 RunChain.C:317
 RunChain.C:318
 RunChain.C:319
 RunChain.C:320
 RunChain.C:321
 RunChain.C:322
 RunChain.C:323
 RunChain.C:324
 RunChain.C:325
 RunChain.C:326
 RunChain.C:327
 RunChain.C:328
 RunChain.C:329
 RunChain.C:330
 RunChain.C:331
 RunChain.C:332
 RunChain.C:333
 RunChain.C:334
 RunChain.C:335
 RunChain.C:336
 RunChain.C:337
 RunChain.C:338
 RunChain.C:339
 RunChain.C:340
 RunChain.C:341
 RunChain.C:342
 RunChain.C:343
 RunChain.C:344
 RunChain.C:345
 RunChain.C:346
 RunChain.C:347
 RunChain.C:348
 RunChain.C:349
 RunChain.C:350
 RunChain.C:351
 RunChain.C:352
 RunChain.C:353
 RunChain.C:354
 RunChain.C:355
 RunChain.C:356
 RunChain.C:357
 RunChain.C:358
 RunChain.C:359
 RunChain.C:360
 RunChain.C:361
 RunChain.C:362
 RunChain.C:363
 RunChain.C:364
 RunChain.C:365
 RunChain.C:366
 RunChain.C:367
 RunChain.C:368
 RunChain.C:369
 RunChain.C:370
 RunChain.C:371
 RunChain.C:372
 RunChain.C:373
 RunChain.C:374
 RunChain.C:375
 RunChain.C:376
 RunChain.C:377
 RunChain.C:378
 RunChain.C:379
 RunChain.C:380
 RunChain.C:381
 RunChain.C:382
 RunChain.C:383
 RunChain.C:384
 RunChain.C:385
 RunChain.C:386
 RunChain.C:387
 RunChain.C:388
 RunChain.C:389
 RunChain.C:390
 RunChain.C:391
 RunChain.C:392
 RunChain.C:393
 RunChain.C:394
 RunChain.C:395
 RunChain.C:396
 RunChain.C:397
 RunChain.C:398
 RunChain.C:399
 RunChain.C:400
 RunChain.C:401
 RunChain.C:402
 RunChain.C:403
 RunChain.C:404
 RunChain.C:405
 RunChain.C:406
 RunChain.C:407
 RunChain.C:408
 RunChain.C:409
 RunChain.C:410
 RunChain.C:411
 RunChain.C:412
 RunChain.C:413
 RunChain.C:414
 RunChain.C:415
 RunChain.C:416
 RunChain.C:417
 RunChain.C:418
 RunChain.C:419
 RunChain.C:420
 RunChain.C:421
 RunChain.C:422
 RunChain.C:423
 RunChain.C:424
 RunChain.C:425
 RunChain.C:426
 RunChain.C:427
 RunChain.C:428
 RunChain.C:429
 RunChain.C:430
 RunChain.C:431
 RunChain.C:432
 RunChain.C:433
 RunChain.C:434
 RunChain.C:435
 RunChain.C:436
 RunChain.C:437
 RunChain.C:438
 RunChain.C:439
 RunChain.C:440
 RunChain.C:441
 RunChain.C:442
 RunChain.C:443
 RunChain.C:444
 RunChain.C:445
 RunChain.C:446
 RunChain.C:447
 RunChain.C:448
 RunChain.C:449
 RunChain.C:450
 RunChain.C:451
 RunChain.C:452
 RunChain.C:453
 RunChain.C:454
 RunChain.C:455
 RunChain.C:456
 RunChain.C:457
 RunChain.C:458
 RunChain.C:459
 RunChain.C:460
 RunChain.C:461
 RunChain.C:462
 RunChain.C:463
 RunChain.C:464
 RunChain.C:465
 RunChain.C:466
 RunChain.C:467
 RunChain.C:468
 RunChain.C:469
 RunChain.C:470
 RunChain.C:471
 RunChain.C:472
 RunChain.C:473
 RunChain.C:474
 RunChain.C:475
 RunChain.C:476
 RunChain.C:477
 RunChain.C:478
 RunChain.C:479
 RunChain.C:480
 RunChain.C:481
 RunChain.C:482
 RunChain.C:483
 RunChain.C:484
 RunChain.C:485
 RunChain.C:486
 RunChain.C:487
 RunChain.C:488
 RunChain.C:489
 RunChain.C:490
 RunChain.C:491
 RunChain.C:492
 RunChain.C:493
 RunChain.C:494
 RunChain.C:495
 RunChain.C:496
 RunChain.C:497
 RunChain.C:498
 RunChain.C:499
 RunChain.C:500
 RunChain.C:501
 RunChain.C:502
 RunChain.C:503
 RunChain.C:504
 RunChain.C:505
 RunChain.C:506
 RunChain.C:507
 RunChain.C:508
 RunChain.C:509
 RunChain.C:510
 RunChain.C:511
 RunChain.C:512
 RunChain.C:513
 RunChain.C:514
 RunChain.C:515
 RunChain.C:516
 RunChain.C:517
 RunChain.C:518
 RunChain.C:519
 RunChain.C:520
 RunChain.C:521
 RunChain.C:522
 RunChain.C:523
 RunChain.C:524
 RunChain.C:525
 RunChain.C:526
 RunChain.C:527
 RunChain.C:528
 RunChain.C:529
 RunChain.C:530
 RunChain.C:531
 RunChain.C:532
 RunChain.C:533
 RunChain.C:534
 RunChain.C:535
 RunChain.C:536
 RunChain.C:537
 RunChain.C:538
 RunChain.C:539
 RunChain.C:540
 RunChain.C:541
 RunChain.C:542
 RunChain.C:543
 RunChain.C:544
 RunChain.C:545
 RunChain.C:546
 RunChain.C:547
 RunChain.C:548
 RunChain.C:549
 RunChain.C:550
 RunChain.C:551
 RunChain.C:552
 RunChain.C:553
 RunChain.C:554
 RunChain.C:555
 RunChain.C:556
 RunChain.C:557
 RunChain.C:558
 RunChain.C:559
 RunChain.C:560
 RunChain.C:561
 RunChain.C:562
 RunChain.C:563
 RunChain.C:564
 RunChain.C:565
 RunChain.C:566
 RunChain.C:567
 RunChain.C:568
 RunChain.C:569
 RunChain.C:570
 RunChain.C:571
 RunChain.C:572
 RunChain.C:573
 RunChain.C:574
 RunChain.C:575
 RunChain.C:576
 RunChain.C:577
 RunChain.C:578
 RunChain.C:579
 RunChain.C:580
 RunChain.C:581
 RunChain.C:582
 RunChain.C:583
 RunChain.C:584
 RunChain.C:585
 RunChain.C:586
 RunChain.C:587
 RunChain.C:588
 RunChain.C:589
 RunChain.C:590
 RunChain.C:591
 RunChain.C:592
 RunChain.C:593
 RunChain.C:594
 RunChain.C:595
 RunChain.C:596
 RunChain.C:597
 RunChain.C:598
 RunChain.C:599
 RunChain.C:600
 RunChain.C:601
 RunChain.C:602
 RunChain.C:603
 RunChain.C:604
 RunChain.C:605
 RunChain.C:606
 RunChain.C:607
 RunChain.C:608
 RunChain.C:609
 RunChain.C:610
 RunChain.C:611
 RunChain.C:612
 RunChain.C:613
 RunChain.C:614
 RunChain.C:615
 RunChain.C:616
 RunChain.C:617
 RunChain.C:618
 RunChain.C:619
 RunChain.C:620
 RunChain.C:621
 RunChain.C:622
 RunChain.C:623
 RunChain.C:624
 RunChain.C:625
 RunChain.C:626
 RunChain.C:627
 RunChain.C:628
 RunChain.C:629
 RunChain.C:630
 RunChain.C:631
 RunChain.C:632
 RunChain.C:633
 RunChain.C:634
 RunChain.C:635
 RunChain.C:636
 RunChain.C:637
 RunChain.C:638
 RunChain.C:639
 RunChain.C:640
 RunChain.C:641
 RunChain.C:642
 RunChain.C:643
 RunChain.C:644
 RunChain.C:645
 RunChain.C:646
 RunChain.C:647
 RunChain.C:648
 RunChain.C:649
 RunChain.C:650
 RunChain.C:651
 RunChain.C:652
 RunChain.C:653
 RunChain.C:654
 RunChain.C:655
 RunChain.C:656
 RunChain.C:657
 RunChain.C:658
 RunChain.C:659
 RunChain.C:660
 RunChain.C:661
 RunChain.C:662
 RunChain.C:663
 RunChain.C:664
 RunChain.C:665
 RunChain.C:666
 RunChain.C:667
 RunChain.C:668
 RunChain.C:669
 RunChain.C:670
 RunChain.C:671
 RunChain.C:672
 RunChain.C:673
 RunChain.C:674
 RunChain.C:675
 RunChain.C:676
 RunChain.C:677
 RunChain.C:678
 RunChain.C:679
 RunChain.C:680
 RunChain.C:681
 RunChain.C:682
 RunChain.C:683
 RunChain.C:684
 RunChain.C:685
 RunChain.C:686
 RunChain.C:687
 RunChain.C:688
 RunChain.C:689
 RunChain.C:690
 RunChain.C:691
 RunChain.C:692
 RunChain.C:693
 RunChain.C:694
 RunChain.C:695
 RunChain.C:696
 RunChain.C:697
 RunChain.C:698
 RunChain.C:699
 RunChain.C:700
 RunChain.C:701
 RunChain.C:702
 RunChain.C:703
 RunChain.C:704
 RunChain.C:705
 RunChain.C:706
 RunChain.C:707
 RunChain.C:708
 RunChain.C:709
 RunChain.C:710