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