/************************************************************************
**
** ALICE HLT project
** Copyright (c) 2005
**
** This file is property of and copyright by the Experimental Nuclear
** Physics Group, Dep. of Physics and Technology
** University of Bergen, Norway, 2004
** This file has been written by Matthias Richter,
** Matthias.Richter@ift.uib.no
**
** 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.
**
*************************************************************************/
/** @file SampleLib/tutorial.c
@author Matthias Richter
@date
@brief HLT examples and tutorial. */
/**
@defgroup alihlt_tutorial HLT examples and tutorial
The HLT analysis components can be run either in the AliRoot
framework (simulation and/or reconstruction) or the HLT online
framework.
We think of the HLT as a 'black box' with data input and output. In
addition there is access to calibration data from OCDB (or the local
HLT copy HCDB). All components can only work on the data they get as
input. As the different detector algorithms/components will run in
separate processes and even on different machines, no data exchange
is possible via global data structures and variables.
HLT chains in the AliRoot framework are described by means of
AliHLTConfiguration.
-# @ref tut_hltsystem
-# @ref tut_load_libraries
-# @ref tut_dummy_chain
-# @ref tut_tpc_sector
-# @ref tut_simulation
-# @ref tut_reconstruction
-# @ref tut_module_agent
-# @ref tut_reconstruction_sample
-# @ref tut_reconstruction_custom
-# @ref tut_alirawreaderhlt
-# @ref tut_macros
{ AliHLTSystem gHLT; gHLT.LoadComponentLibraries("libAliHLTUtil.so"); }
{ AliHLTSystem gHLT; gHLT.LoadComponentLibraries("libAliHLTUtil.so libAliHLTSample.so"); // The AliHLTFilePublisher (component Id \em 'FilePublisher' provides // the given file (see AliHLTFilePublisher for more options) to the // subsequent components in the chain. AliHLTConfiguration publisher("fp1", "FilePublisher", NULL, "-datatype 'DUMMYDAT' 'SMPL' -datafile some-data.dat"); // The AliHLTDummyComponent (Id \em 'Dummy') just forwards a certain // fraction of the input to the output or just repeats the input data // if percentage > 100 AliHLTConfiguration copy("cp", "Dummy", "fp1", "output_percentage 80"); // The AliHLTFileWriter (Id 'FileWriter') is a data sink. It writes // all incoming data blocks to files. Several options available. AliHLTConfiguration sink1("sink1", "FileWriter", "cp", NULL); // here you specify the top most configuration of the chain. The // configuration depends on all the parents. The task lisy is build // according to that. gHLT.BuildTaskList("sink1"); gHLT.Run(); }@note You have to specify a real file name instead of \em some-data.dat
{ AliHLTSystem gHLT; // load the component library gHLT.LoadComponentLibraries("libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so"); // data source components AliHLTConfiguration fp0("fp0", "FilePublisher", NULL, "-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x00000000 " "-datafile TPC_768.ddl"); AliHLTConfiguration fp1("fp1", "FilePublisher", NULL, "-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x00000101 " "-datafile TPC_769.ddl"); AliHLTConfiguration fp2("fp2", "FilePublisher", NULL, "-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x00000202 " "-datafile TPC_840.ddl"); AliHLTConfiguration fp3("fp3", "FilePublisher", NULL, "-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x00000303 " "-datafile TPC_841.ddl"); AliHLTConfiguration fp4("fp4", "FilePublisher", NULL, "-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x00000404 " "-datafile TPC_842.ddl"); AliHLTConfiguration fp5("fp5", "FilePublisher", NULL, "-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x00000505 " "-datafile TPC_843.ddl"); // cluster finders AliHLTConfiguration cf0("cf0", "TPCClusterFinderPacked", "fp0", "pp-run rawreadermode 4 timebins 446"); AliHLTConfiguration cf1("cf1", "TPCClusterFinderPacked", "fp1", "pp-run rawreadermode 4 timebins 446"); AliHLTConfiguration cf2("cf2", "TPCClusterFinderPacked", "fp2", "pp-run rawreadermode 4 timebins 446"); AliHLTConfiguration cf3("cf3", "TPCClusterFinderPacked", "fp3", "pp-run rawreadermode 4 timebins 446"); AliHLTConfiguration cf4("cf4", "TPCClusterFinderPacked", "fp4", "pp-run rawreadermode 4 timebins 446"); AliHLTConfiguration cf5("cf5", "TPCClusterFinderPacked", "fp5", "pp-run rawreadermode 4 timebins 446"); // tracker AliHLTConfiguration tracker("tracker", "TPCSliceTracker", "cf0 cf1 cf2 cf3 cf4 cf5", "-pp-run -bfield 0.5"); // the data sink component AliHLTConfiguration writer("writer", "TPCEsdWriter", "tracker", "-datafile AliHLTTPCESDs.root"); gHLT.BuildTaskList("writer"); gHLT.Run(); }
{ AliReconstruction rec; // the reconstruction instance rec.SetInput("raw.root"); // choose some raw data rec.SetRunLocalReconstruction("HLT"); // run local rec only for HLT rec.SetRunTracking(""); // switch off tracking rec.SetFillESD("HLT"); // rec.SetOption("HLT", "libAliHLTSample.so loglevel=0x7c"); rec.Run(); }Please note the specification of raw data input. HLT reconstruction can only run on raw data, either real or simulated. HLT reconstruction on simulated digit data must be run embedded into @ref tut_simulation. @subsection tut_module_agent The Module Agent Each component library has to implement a module agent in order to be hooked up to the AliRoot reconstruction or simulation. The agent defines the features of the libraries and the configurations to be run during the different steps of the reconstruction. The agent - can register all components of the library. This is an alternative to the component registration via global objects (see @ref alihltcomponent-handling). - registers HLT configurations (see @ref AliHLTConfiguration) - specifies the configurations to be run - specifies additional component libraries required to run the configurations. - provides a preprocessor (see AliHLTModulePreprocessor / AliHLTPreprocessor) - provides handlers and handler descriptions for HLTOUT data blocks. Finally, one global object of the module agent has to be specified in the source code. All registration and integration into the HLT system is carried out automatically. @see @ref AliHLTModuleAgent for the interface description
{ AliReconstruction rec; // the reconstruction instance rec.SetInput("./"); // to be independent of galice.root rec.SetLoadAlignFromCDB(kFALSE); rec.SetFillTriggerESD(kFALSE); rec.SetRunQA(kFALSE); rec.SetRunVertexFinder(kFALSE); rec.SetRunLocalReconstruction("HLT"); // run local rec only for HLT rec.SetRunTracking(""); // switch off tracking rec.SetFillESD("HLT"); // rec.SetOption("HLT", "libAliHLTSample.so libAliHLTUtil.so " "config=$ALICE_ROOT/HLT/exa/conf-sample.C " "chains=sink"); //rec.SetEventRange(0,0); rec.Run(); }@see - conf-sample.C
AliSimulation sim; ... sim.SetRunHLT("libAliHLTSample.so loglevel=0x7c");Options: - config=\em macro
class AliHLTSampleRawDataHandler : public AliHLTOUTHandlerEquId { public: // ... constructors and destructor // overloaded AliHLTOUTHandlerEquId::ProcessData(AliHLTOUT*) int ProcessData(AliHLTOUT* pData); };Alternatively the AliHLTOUTHandlerEquId can be used directly. It implements a default processing. -# Adjust module agent The module agent needs to provide the handler and the description of the handler and has to implement the following functions:
// see AliHLTAgentSample::GetHandlerDescription() int GetHandlerDescription(AliHLTComponentDataType, AliHLTUInt32_t, AliHLTOUTHandlerDesc&) const; // see AliHLTAgentSample::GetOutputHandler() AliHLTOUTHandler* GetOutputHandler(AliHLTComponentDataType, AliHLTUInt32_t); // see AliHLTAgentSample::DeleteOutputHandler() int DeleteOutputHandler(AliHLTOUTHandler*);-# Set the HLT input The AliReconstruction class handles the redirection transparently by use of the AliRawReaderHLT.
AliReconstruction rec; // .... rec.SetUseHLTData("ITSSDD");-# Run Run the reconstruction as normal @see - AliHLTReconstructor - AliRawReaderHLT - rec-from-hltout.C