Enhanced doxygen documentation
[u/mrichter/AliRoot.git] / HLT / rec / AliHLTReconstructor.h
CommitLineData
3e820254 1// @(#) $Id$
2
3#ifndef ALIHLTRECONSTRUCTOR_H
4#define ALIHLTRECONSTRUCTOR_H
c5123824 5//* This file is property of and copyright by the ALICE HLT Project *
6//* ALICE Experiment at CERN, All rights reserved. *
7//* See cxx source for full Copyright notice *
3e820254 8
3a7c0444 9/** @file AliHLTReconstructor.h
c534985b 10 @author Matthias Richter
11 @date
12 @brief Binding class for HLT simulation in AliRoot
c5123824 13*/
c534985b 14
3e820254 15#include "AliReconstructor.h"
a3ef3c1d 16#include "AliHLTReconstructorBase.h"
3e820254 17
18class AliHLTSystem;
19class AliRawReader;
20class AliESDEvent;
c5123824 21class AliHLTOUT;
22class AliHLTEsdManager;
9d4cf2ab 23/**
24 * @defgroup alihlt_aliroot_reconstruction AliRoot reconstruction.
25 *
fb345ed7 26 * @section alihlt_aliroot_reconstruction_intro General Remarks
9d4cf2ab 27 * Like all other ALICE detectors, HLT utilizes the AliReconstruction interface
28 * to implement a plugin for the AliRoot reconstruction. The reconstructor can be
29 * used to
fb345ed7 30 * -# run HLT analysis chains in the AliRoot reconstruction <br>
31 * This option is mainly intended for the <em>development and debugging cycle</em>.
32 * HLT chains can be defined by means of AliHLTConfiguration and can be run either
33 * stand-alone or embedded into the AliReconstruction cycle.
34 * -# run the default analysis chains <br>
35 * HLT modules can define default analysis chains to be run during AliRoot
36 * reconstruction.
37 * -# handle the HLTOUT data<br>
38 * The HLT output stream contains multiple data blocks produced by the various
39 * components of the HLT chain. Each block might need different and even
40 * detector specific processing, like e.g. the processing of ESD objects or the
41 * handling of compressed data.
42 *
43 * @section alihlt_aliroot_reconstruction_steering Steering
44 * The AliHLTReconstructor provides the main interface for the reconstruction.
45 * The handling of the HLTOUT data is described in AliRawReaderHLT.
46 *
47 * @section alihlt_aliroot_reconstruction_examples Examples
48 * @subsection alihlt_aliroot_reconstruction_examples_reco Run chains
49 * - @ref tut_reconstruction
50 *
51 * @subsection alihlt_aliroot_reconstruction_examples_hltout Handle HLTOUT
52 * - @ref tut_alirawreaderhlt
9d4cf2ab 53 *
9d4cf2ab 54 * @ingroup alihlt_system
55 */
3e820254 56
57/**
58 * @class AliHLTReconstructor
9d4cf2ab 59 * AliRoot event reconstruction plug-in for the HLT.
3e820254 60 * The AliHLTReconstructor holds an instance of the @ref AliHLTSystem
61 * steering class. The actual reconstruction depends on the loaded component
62 * libraries. Each library must implement a module agent (@ref AliHLTModuleAgent)
63 * in order to provide information on the supported features and the
64 * configurations to be run.
65 *
d1d1bbd7 66 * The AliHLTReconstructor provides both the functionality to run customized
67 * analysis chains and the treatment of the HLTOUT data.
68 *
69 * @section sec_alihltreconstructor_options Options
3e820254 70 * The default component libraries which are loaded through the initialization
60dd5042 71 * are determined by the @ref AliHLTSystem::fgkHLTDefaultLibs array. The library
72 * loading can be overridden by an option to the AliHLTReconstructor through the
3e820254 73 * <tt>SetOption</tt> method of <tt>AliReconstruction</tt>, e.g.
74 * <pre>
75 * AliReconstruction rec;
76 * rec.SetOption("HLT", "libAliHLTSample.so");
77 * </pre>
78 * will only load <tt>libAliHLTSample.so</tt>
79 *
80 * Optional arguments:<br>
1ac82ce6 81 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
3e820254 82 * \li loglevel=<i>level</i><br>
83 * level can be a hex number encoding the @ref AliHLTComponentLogSeverity
84 * \li alilog=off <br>
85 * disables the logging of HLT log messages through <tt>AliLog</tt> <br>
86 *
87 * For further information on the AliRoot reconstruction refer to the AliRoot
88 * documentation, namely <tt>AliReconstruction</tt>.
d1d1bbd7 89 *
90 * @section sec_alihltreconstructor_chains Custom reconstruction chains
91 * In order to run an HLT chain during the AliRoot reconstruction, a chain
92 * configuration must be defined. This can be done by
93 * - specifying a configuration macro defining a configuration macro and
94 * the name of the chain as parameters
95 * <pre>
96 * rec.SetOption("HLT", "config=[macro.C] chains=[name]")
97 * </pre>
98 * - providing the configuration and the name by the module agent.
99 * AliHLTModuleAgent and the functions AliHLTModuleAgent::CreateConfigurations
100 * and AliHLTModuleAgent::GetReconstructionChains
101 *
102 * @section sec_alihltreconstructor_hltout Treatment of HLTOUT data.
103 * The HLTOUT data is a collation of output blocks produced by the various
104 * components running in an HLT chain. Typically its the output of the last
105 * component(s) in the chain, or components specifically connected to the HLT
106 * output.
107 *
108 * The treatment of the HLTOUT data blocks is implemented in handlers of type
109 * AliHLTOUTHandler. The AliHLTModuleAgent of the module creates the appropriate
110 * handler for a data block.
111 * The data type of the individual blocks is set by the producer component and
112 * specifies the nature of the data processing. There are 5 overall groups:
113 * - output is in ESD format:
114 * @ref sec_alihltreconstructor_hltout_esd
115 * - data describes DDL raw format:
116 * @ref sec_alihltreconstructor_hltout_rawreader
117 * - pre-analyzed data to be fed into the normal reconstruction:
118 * @ref sec_alihltreconstructor_hltout_rawstream
119 * - data is fed into an analysis chain:
120 * @ref sec_alihltreconstructor_hltout_chain
121 * - detector specific handler:
122 * @ref sec_alihltreconstructor_hltout_proprietary
123 *
124 * @subsection sec_alihltreconstructor_hltout_esd ESD HLTOUT data
9d4cf2ab 125 * The framework implements a standard handling of ESD data
126 * blocks of type ::kAliHLTDataTypeESDTree {ESD_TREE:ANY}. \em ANY can be
d1d1bbd7 127 * any detector origin. Each ESD block contains the data of only one event,
128 * the ESDs are merged by the AliHLTEsdManager and written to files of the
833b3167 129 * naming scheme AliHLT\em DET ESDs.root. The first ESD block is also copied
d1d1bbd7 130 * to the hltEsd provided by the AliReconstruction. This is a temporary
131 * solution as the handling and merging of HLT ESDs is under discussion.
132 * At the time of writing (May 08) only the TPC HLT components produce ESD
133 * blocks.
134 * The module agent can provide a handler for multiple ESD data blocks, e.g.
135 * for merging within one event prior to the writing. Instead of the individual
136 * ESDs the one provided by the handler is passed to the AliHLTEsdManager. The
9d4cf2ab 137 * handler is of type \link AliHLTModuleAgent::AliHLTOUTHandlerType kEsd \endlink.
d1d1bbd7 138 *
139 * @subsection sec_alihltreconstructor_hltout_rawreader DDL raw HLTOUT data
140 * The HLT can perform selective readout and produces a reduced amount of data
141 * in the original raw ddl format. In order to feed this data from the HLTOUT
142 * DDL links into the normal reconstruction, a handler of type
9d4cf2ab 143 * \link AliHLTModuleAgent::AliHLTOUTHandlerType kRawReader \endlink must be
144 * implemented and provided by the
d1d1bbd7 145 * module agent. The handler has to derive the original equipment id from the
146 * data type and specification of the block. The offline reconstruction does
9d4cf2ab 147 * not need to be changed or adapted at all. See AliRawReaderHLT for details.
d1d1bbd7 148 *
149 * @subsection sec_alihltreconstructor_hltout_rawstream Preprocessed Raw HLTOUT data
9d4cf2ab 150 * Handlers of type \link AliHLTModuleAgent::AliHLTOUTHandlerType kRawStream \endlink
151 * are foreseen though at the time of writing (May 08) the
d1d1bbd7 152 * concept is not fixed. Advanced data compression algorithms can produce a
153 * raw data format which is not convertible into the raw DDL data, e.g. lossy
154 * compression techniques storing clusters parametrized regarding to tracks. A
155 * specific RawStream is needed here since the data is detector specific and the
156 * first stage of the offline reconstruction might need some adaptions.
157 *
158 * @subsection sec_alihltreconstructor_hltout_chain HLTOUT data fed into a chain
9d4cf2ab 159 * At the time of writing (May 08), handler type
160 * \link AliHLTModuleAgent::AliHLTOUTHandlerType kChain \endlink
d1d1bbd7 161 * is foreseen but not yet implemented. Has to be discussed.
162 *
163 * @subsection sec_alihltreconstructor_hltout_proprietary Proprietary HLTOUT data
9d4cf2ab 164 * This is a handler of proprietary detector data. Handlers of type
165 * \link AliHLTModuleAgent::AliHLTOUTHandlerType kProprietary \endlink
166 * do not have any standard output to the framework. Data can be processed and
167 * stored to files.
168 *
169 * @section sec_alihltreconstructor_helper Tools and helper functions
7ec2b0ab 170 * Some helper functions of the AliHLTReconstruction can be used in stand-alone
171 * mode. Remember to Init() the reconstructor.
172 * <pre>
173 * {
174 * gSystem->Load("libHLTrec.so");
175 * AliHLTReconstructor rec;
176 * rec.Init();
177 * // do something
178 * }
179 * </pre>
9d4cf2ab 180 * @subsection sec_alihltreconstructor_hltout_standalone Stand-alone HLTOUT processing
181 * - HLTOUT processing from a digit file:
182 * <pre>
183 * void ProcessHLTOUT(const char*, AliESDEvent*) const;
184 * </pre>
185 * - HLTOUT processing from an AliRawReader
186 * <pre>
187 * void ProcessHLTOUT(AliRawReader*, AliESDEvent*) const;
188 * </pre>
d1d1bbd7 189 *
190 * @ingroup alihlt_aliroot_reconstruction
9d4cf2ab 191 * @section sec_alihltreconstructor_members Class members
3e820254 192 */
a3ef3c1d 193class AliHLTReconstructor: public AliReconstructor, public AliHLTReconstructorBase {
3e820254 194public:
032c5e5e 195 /** standard constructor */
3e820254 196 AliHLTReconstructor();
032c5e5e 197 /** constructor */
198 AliHLTReconstructor(const char* options);
3e820254 199 /** destructor */
200 virtual ~AliHLTReconstructor();
201
202 /** init the reconstructor */
203 void Init();
204
032c5e5e 205 /** init the reconstructor */
206 void Init(const char* options);
207
3e820254 208 /**
209 * This Reconstructor function is not applicable for the AliHLTReconstructor
210 * as it gets a detector specific digits tree. But HLT processes all detectors.
7f9ab840 211 * Furthermore it's purely simulated data. <br>
212 * The function forwards to the default bahavior of AliReconstructor but gives
213 * a warning if there were options set, i.e. the user runs customized
214 * reconstruction.
c5123824 215 *
216 * @note HLT reconstruction on simulated data is processed at the end of
217 * simulation. <br>
3e820254 218 */
7f9ab840 219 void Reconstruct(TTree* digitsTree, TTree* clustersTree) const;
3e820254 220
221 /**
222 * Reconstruction from RAW data.
223 * The rawReader holds data for all detectors and this version of Reconstruct
224 * is thus applicable for the HLT. The clustersTree is just ignored.
225 */
226 void Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const;
227
228 /**
c5123824 229 * This function treats the simulated HLTOUT data.
230 * Opens a handler for simulated HLTOUT data and forwards to ::ProcessHLTOUT.
3e820254 231 */
7f9ab840 232 void FillESD(TTree* digitsTree, TTree* clustersTree, AliESDEvent* esd) const;
3e820254 233
234 /**
c5123824 235 * Process the raw HLTOUT data and fill ESD.
236 * Opens a handler for raw HLTOUT data and forwards to ::ProcessHLTOUT.
3e820254 237 */
238 void FillESD(AliRawReader* rawReader, TTree* clustersTree, AliESDEvent* esd) const;
239
c5123824 240 /**
241 * Process HLTOUT data and fill ESD.
242 * This is the final treatment of the HLTOUT data, either simulated or real.
243 * HLTOUT data is stored in HOMER format, the AliHLTOUT object provides the interface
244 * to the individual data blocks.
245 *
246 * During reconstruction (::Reconstruct), module or user defined chains can be
247 * processed and may add additional data to the HLTOUT object. This data is then
248 * treated in the same way.
249 */
b005ef92 250 void ProcessHLTOUT(AliHLTOUT* pHLTOUT, AliESDEvent* esd, bool bVerbose=false) const;
c5123824 251
032c5e5e 252 /**
253 * Process HLTOUT data.
254 * Open digit file and process the HLTOUT digit data.
255 * This function is mostly intended for debugging purposes and stand-alone
256 * processing of the output from the simulation. Loops over all events.
257 * @param digitFile path of the digit file
258 * @param pEsd optional ESD to be filled
259 */
260 void ProcessHLTOUT(const char* digitFile="HLT.Digits.root", AliESDEvent* pEsd=NULL) const;
261
262 /**
263 * Process HLTOUT data.
264 * Process the HLTOUT from the raw reader.
265 * This function is mostly intended for debugging purposes and stand-alone
266 * processing of simulated or real raw data.
267 * \em Note: Loops over all events, i.e. the current event of the the raw
268 * reader will change. Not to be called inside the normal AliRoot processsing.
269 * @param pRawReader raw reader instance
270 * @param pEsd optional ESD to be filled
271 */
272 void ProcessHLTOUT(AliRawReader* pRawReader, AliESDEvent* pEsd=NULL) const;
273
274 /**
275 * Print a short info about the HLTOUT content.
276 */
277 void PrintHLTOUTContent(AliHLTOUT* pHLTOUT) const;
278
3e820254 279private:
280 /** copy constructor prohibited */
281 AliHLTReconstructor(const AliHLTReconstructor& src);
282 /** assignment operator prohibited */
283 AliHLTReconstructor& operator=(const AliHLTReconstructor& src);
284
c5123824 285 /** function pointer: processing of HLTOUT data */
286 void* fFctProcessHLTOUT; //!transient
287
288 /** ESD manger instance for this reconstruction */
289 AliHLTEsdManager* fpEsdManager; //!transient
290
291 ClassDef(AliHLTReconstructor, 5) // class for the HLT reconstruction
292
3e820254 293};
294
295typedef AliHLTReconstructor AliL3Reconstructor; // for backward compatibility
296
297#endif