]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTComponent.h
fixing compilation bug
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTComponent.h
CommitLineData
a655eae3 1//-*- Mode: C++ -*-
45c0a780 2// $Id$
f23a6e1a 3
4#ifndef ALIHLTCOMPONENT_H
5#define ALIHLTCOMPONENT_H
45c0a780 6//* This file is property of and copyright by the ALICE HLT Project *
7//* ALICE Experiment at CERN, All rights reserved. *
8//* See cxx source for full Copyright notice *
f23a6e1a 9
0007ed52 10// @file AliHLTComponent.h
11// @author Matthias Richter, Timm Steinbeck
12// @date
13// @brief Base class declaration for HLT components.
14// @note The class is both used in Online (PubSub) and Offline (AliRoot)
15// context
16
30338a30 17
b22e91eb 18/**
19 * @defgroup alihlt_component Component handling of the HLT module
45c0a780 20 * This section describes the the component base classes and handling for
21 * the HLT module.
22 *
23 * @section alihlt_component_intro General remarks
24 * HLT analysis is organized in so called components. Each component can
25 * subscribe to the data produced by other components and can from the
26 * analysis publish new data for the subsequent components. Only the
27 * input data blocks and entries from CDB are available for the analysis.
28 *
fb345ed7 29 * @section alihlt_component_implementation Component implementation
45c0a780 30 * AliHLTComponent provides the interface for all components, see there
31 * for details. Three types are provided:
32 * - AliHLTProcessor
33 * - AliHLTDataSource
34 * - AliHLTDataSink
35 *
36 * The two last represent data sinks and sources for the HLT integration
37 * into AliRoot. When running only, only the processors are relevant,
38 * sources and sinks are provided by the HLT PubSub framework. Please check
39 * AliHLTComponent for detailed description.
40 *
41 * @section alihlt_component_registration Component registration
42 * Components need to be registered with the AliHLTComponentHandler in
43 * order to be used with the system. Registration is purely done from the
44 * module library. Two methods are possible:
45 * - the module library implements an AliHLTModuleAgent and overloads the
46 * AliHLTModuleAgent::RegisterComponents() function
47 * - in the implementation file, one object is defined. The global object is
48 * automatically instantiated when the library is loaded for the first
49 * time and the object is used for registration.
50 *
51 * In both cases, the library must be loaded via the method
52 * <pre>
53 * AliHLTComponentHandler::LoadComponentLibraries()
54 * </pre>
55 * For the global object approach it is important that the library is
56 * not loaded elsewhere before (e.g. a gSystem->Load operation in your
57 * rootlogon.C).
58 *
59 *
b22e91eb 60 */
8ede8717 61
62#include <vector>
9ce4bf4a 63#include <string>
5ec8e281 64#include "AliHLTLogging.h"
f23a6e1a 65#include "AliHLTDataTypes.h"
1ac82ce6 66#include "AliHLTCommonCDBEntries.h"
f23a6e1a 67
2d7ff710 68/* Matthias Dec 2006
69 * The names have been changed for Aliroot's coding conventions sake
70 * The old names are defined for backward compatibility with the
71 * stand alone SampleLib package
72 */
73typedef AliHLTComponentLogSeverity AliHLTComponent_LogSeverity;
74typedef AliHLTComponentEventData AliHLTComponent_EventData;
75typedef AliHLTComponentShmData AliHLTComponent_ShmData;
76typedef AliHLTComponentDataType AliHLTComponent_DataType;
77typedef AliHLTComponentBlockData AliHLTComponent_BlockData;
78typedef AliHLTComponentTriggerData AliHLTComponent_TriggerData;
79typedef AliHLTComponentEventDoneData AliHLTComponent_EventDoneData;
80
f23a6e1a 81class AliHLTComponentHandler;
a655eae3 82class TObjArray;
5ef2a37b 83class TMap;
90ebac25 84class TStopwatch;
89413559 85class AliRawDataHeader;
2be3f004 86class AliHLTComponent;
79c114b5 87class AliHLTMemoryFile;
adb91bc3 88class AliHLTCTPData;
89413559 89class AliHLTReadoutList;
f23a6e1a 90
2be3f004 91/** list of component data type structures */
92typedef vector<AliHLTComponentDataType> AliHLTComponentDataTypeList;
93/** list of component block data structures */
94typedef vector<AliHLTComponentBlockData> AliHLTComponentBlockDataList;
a0aeb701 95/** list of component statistics struct */
96typedef vector<AliHLTComponentStatistics> AliHLTComponentStatisticsList;
2be3f004 97/** list of component pointers */
98typedef vector<AliHLTComponent*> AliHLTComponentPList;
99/** list of memory file pointers */
100typedef vector<AliHLTMemoryFile*> AliHLTMemoryFilePList;
101
bfccbf68 102/**
103 * @class AliHLTComponent
104 * Base class of HLT data processing components.
105 * The class provides a common interface for HLT data processing components.
106 * The interface can be accessed from the online HLT framework or the AliRoot
107 * offline analysis framework.
a655eae3 108 * @section alihltcomponent-properties Component identification and properties
109 * Each component must provide a unique ID, input and output data type indications,
110 * and a spawn function.
111 * @subsection alihltcomponent-req-methods Required property methods
112 * - @ref GetComponentID
113 * - @ref GetInputDataTypes (see @ref alihltcomponent-type for default
114 * implementations.)
115 * - @ref GetOutputDataType (see @ref alihltcomponent-type for default
116 * implementations.)
117 * - @ref GetOutputDataSize (see @ref alihltcomponent-type for default
118 * implementations.)
119 * - @ref Spawn
bfccbf68 120 *
a655eae3 121 * @subsection alihltcomponent-opt-mehods Optional handlers
122 * - @ref DoInit
123 * - @ref DoDeinit
de6593d0 124 * - @ref GetOutputDataTypes
125 * If the component has multiple output data types @ref GetOutputDataType
126 * should return @ref kAliHLTMultipleDataType. The framework will invoke
127 * @ref GetOutputDataTypes, a list can be filled.
02bc7a5f 128 * - @ref Reconfigure
129 * This function is invoked by the framework on a special event which
130 * triggers the reconfiguration of the component.
a655eae3 131 *
132 * @subsection alihltcomponent-processing-mehods Data processing
133 *
134 *
135 * @subsection alihltcomponent-type Component type
136 * Components can be of type
90ebac25 137 * - @ref kSource components which only produce data
138 * - @ref kProcessor components which consume and produce data
139 * - @ref kSink components which only consume data
a655eae3 140 *
141 * where data production and consumption refer to the analysis data stream. In
142 * order to indicate the type, a child component can overload the
143 * @ref GetComponentType function.
144 * @subsubsection alihltcomponent-type-std Standard implementations
145 * Components in general do not need to implement this function, standard
146 * implementations of the 3 types are available:
147 * - AliHLTDataSource for components of type @ref kSource <br>
148 * All types of data sources can inherit from AliHLTDataSource and must
149 * implement the @ref AliHLTDataSource::GetEvent method. The class
150 * also implements a standard method for @ref GetInputDataTypes.
151 *
152 * - AliHLTProcessor for components of type @ref kProcessor <br>
48abe484 153 * All types of data processors can inherit from AliHLTProcessor and must
a655eae3 154 * implement the @ref AliHLTProcessor::DoEvent method.
155 *
156 * - AliHLTDataSink for components of type @ref kSink <br>
48abe484 157 * All types of data processors can inherit from AliHLTDataSink and must
a655eae3 158 * implement the @ref AliHLTDataSink::DumpEvent method. The class
159 * also implements a standard method for @ref GetOutputDataType and @ref
160 * GetOutputDataSize.
161 *
162 * @subsection alihltcomponent-environment Running environment
bfccbf68 163 *
164 * In order to adapt to different environments (on-line/off-line), the component
165 * gets an environment structure with function pointers. The base class provides
166 * member functions for those environment dependend functions. The member
167 * functions are used by the component implementation and are re-mapped to the
168 * corresponding functions.
b6800be0 169 *
a655eae3 170 * @section alihltcomponent-interfaces Component interfaces
171 * Each of the 3 standard component base classes AliHLTProcessor, AliHLTDataSource
172 * and AliHLTDataSink provides it's own processing method (see
173 * @ref alihltcomponent-type-std), which splits into a high and a low-level
174 * method. For the @ref alihltcomponent-low-level-interface, all parameters are
48abe484 175 * shipped as function arguments, the component is supposed to write data to the
a655eae3 176 * output buffer and handle all block descriptors.
177 * The @ref alihltcomponent-high-level-interface is the standard processing
178 * method and will be used whenever the low-level method is not overloaded.
179 *
b6800be0 180 * In both cases it is necessary to calculate/estimate the size of the output
181 * buffer before the processing. Output buffers can never be allocated inside
182 * the component because of the push-architecture of the HLT.
183 * For that reason the @ref GetOutputDataSize function should return a rough
184 * estimatian of the data to be produced by the component. The component is
185 * responsible for checking the memory size and must return -ENOSPC if the
48abe484 186 * available buffer is too small, and update the estimator respectively. The
b6800be0 187 * framework will allocate a buffer of appropriate size and call the processing
188 * again.
189 *
02bc7a5f 190 * @subsection alihltcomponent-error-codes Return values/Error codes
b426991e 191 * For return codes, the following scheme applies:
192 * - The data processing methods have to indicate error conditions by a negative
193 * error/return code. Preferably the system error codes are used like
194 * e.g. -EINVAL. This requires to include the header
195 * <pre>
616eb170 196 * \#include \<cerrno\>
b426991e 197 * </pre>
02bc7a5f 198 * This schema aplies to all interface functions of the component base class.
199 * For data processing it is as follows:
b426991e 200 * - If no suitable input block could be found (e.g. no clusters for the TPC cluster
201 * finder) set size to 0, block list is empty, return 0
202 * - If no ususable or significant signal could be found in the input blocks
203 * return an empty output block, set size accordingly, and return 0. An empty output
204 * block here could be either a real empty one of size 0 (in which case size also
205 * would have to be set to zero) or a block filled with just the minimum necessary
206 * accounting/meta-structures. E.g. in the TPC
207 *
a655eae3 208 * @subsection alihltcomponent-high-level-interface High-level interface
209 * The high-level component interface provides functionality to exchange ROOT
210 * structures between components. In contrast to the
211 * @ref alihltcomponent-low-level-interface, a couple of functions can be used
212 * to access data blocks of the input stream
213 * and send data blocks or ROOT TObject's to the output stream. The functionality
214 * is hidden from the user and is implemented by using ROOT's TMessage class.
215 *
216 * @subsubsection alihltcomponent-high-level-int-methods Interface methods
217 * The interface provides a couple of methods in order to get objects from the
218 * input, data blocks (non TObject) from the input, and to push back objects and
219 * data blocks to the output. For convenience there are several functions of
220 * identical name (and similar behavior) with different parameters defined.
221 * Please refer to the function documentation.
222 * - @ref GetNumberOfInputBlocks <br>
223 * return the number of data blocks in the input stream
224 * - @ref GetFirstInputObject <br>
225 * get the first object of a specific data type
226 * - @ref GetNextInputObject <br>
227 * get the next object of same data type as last GetFirstInputObject/Block call
228 * - @ref GetFirstInputBlock <br>
229 * get the first block of a specific data type
230 * - @ref GetNextInputBlock <br>
231 * get the next block of same data type as last GetFirstInputBlock/Block call
232 * - @ref PushBack <br>
233 * insert an object or data buffer into the output
234 * - @ref CreateEventDoneData <br>
235 * add event information to the output
236 *
237 * In addition, the processing methods are simplified a bit by cutting out most of
79c114b5 238 * the parameters.
239 * @see
240 * - @ref AliHLTProcessor::DoEvent
241 * - @ref AliHLTDataSource::GetEvent
242 * - @ref AliHLTDataSink::DumpEvent
a655eae3 243 *
8451168b 244 * \em IMPORTANT: objects and block descriptors provided by the high-level interface
245 * <b>MUST NOT BE DELETED</b> by the caller.
246 *
a655eae3 247 * @subsubsection alihltcomponent-high-level-int-guidelines High-level interface guidelines
248 * - Structures must inherit from the ROOT object base class TObject in order be
249 * transported by the transportation framework.
250 * - all pointer members must be transient (marked <tt>//!</tt> behind the member
251 * definition), i.e. will not be stored/transported, or properly marked
252 * (<tt>//-></tt>) in order to call the streamer of the object the member is pointing
253 * to. The latter is not recomended. Structures to be transported between components
254 * should be streamlined.
255 * - no use of stl vectors/strings, use appropriate ROOT classes instead
256 *
257 * @subsection alihltcomponent-low-level-interface Low-level interface
258 * The low-level component interface consists of the specific data processing
259 * methods for @ref AliHLTProcessor, @ref AliHLTDataSource, and @ref AliHLTDataSink.
260 * - @ref AliHLTProcessor::DoEvent
261 * - @ref AliHLTDataSource::GetEvent
262 * - @ref AliHLTDataSink::DumpEvent
263 *
02bc7a5f 264 * The base class passes all relevant parameters for data access directly on to the
265 * component. Input blocks can be accessed by means of the array <tt> blocks </tt>.
266 * Output data are written directly to shared memory provided by the pointer
267 * <tt> outputPtr </tt> and output block descriptors are inserted directly to the
268 * list <tt> outputBlocks </tt>.
269 *
270 * \b NOTE: The high-level input data access methods can be used also from the low
271 * level interface. Also the PushBack functions can be used BUT ONLY if no data is
272 * written to the output buffer and no data block descriptors are inserted into the
273 * output block list.
274 *
275 * @section alihltcomponent-initialization Component initialization and configuration
276 * The component interface provides two optional methods for component initialization
277 * and configuration. The @ref DoInit function is called once before the processing.
278 * During the event processing, a special event can trigger a reconfiguration and the
279 * @ref Reconfigure method is called. There are three possible options of initialization
280 * and configuration:
281 * - default values: set directly in the source code
282 * - OCDB objects: all necessary information must be loaded from OCDB objects. The
283 * Offline Conditions Data Base stores objects specifically valid for individual runs
284 * or run ranges.
285 * - Component arguments: can be specified for every component in the chain
286 * configuration. The arguments can be used to override specific parameters of the
287 * component.
288 *
289 * As a general rule, the three options should be processed in that sequence, i.e
290 * default parameters might be overridden by OCDB configuration, and the latter one
291 * by component arguments.
292 *
293 * @subsection alihltcomponent-initialization-arguments Component arguments
294 * In normal operation, components are supposed to run without any additional argument,
295 * however such arguments can be useful for testing and debugging. The idea follows
296 * the format of command line arguments. A keyword is indicated by a dash and an
297 * optional argument might follow, e.g.:
298 * <pre>
299 * -argument1 0.5 -argument2
300 * </pre>
301 * In this case argument1 requires an additional parameter whereas argument2 does not.
302 * The arguments will be provided as an array of separated arguments.
303 *
304 * Component arguments can be classified into initialization arguments and configuration
305 * arguments. The latter are applicable for both the @ref DoInit and @ref Reconfigure
306 * method whereas initialization arguments are not applicable after DoInit.
307 *
308 * @subsection alihltcomponent-initialization-ocdb OCDB objects
309 * OCDB objects are ROOT <tt>TObjects</tt> and can be of any type. This is in particular
310 * useful for complex parameter sets. However in most cases, a simple approach of human
311 * readable command line arguments is appropriate. Such a string can be simply stored
312 * in a TObjString (take note that the TString does not derive from TObject). The
313 * same arguments as for the command line can be used. Take note that in the TObjString
314 * all arguments are separated by blanks, instead of being in an array of separate
315 * strings.
316 *
317 * The base class provides two functions regarding OCDB objects:
318 * - LoadAndExtractOCDBObject() loads the OCDB entry for the specified path and extracts
319 * the TObject from it.
320 * - ConfigureFromCDBTObjString() can load a number of OCDB objects and calls the
321 * argument parsing ConfigureFromArgumentString
322 *
323 *
324 * @subsection alihltcomponent-initialization-sequence Initialization sequence
325 * Using the approach of <tt>TObjString</tt>-type configuration objects allows to treat
326 * configuration from both @ref DoInit and @ref Reconfigure in the same way.
327 *
328 * The base class provides the function ConfigureFromArgumentString() which loops over
329 * all arguments and calls the child's method ScanConfigurationArgument(). Here the
330 * actual treatment of the argument and its parameters needs to be implemented.
331 * ConfigureFromArgumentString() can treat both arrays of arguments and arguments in
332 * one single string separated by blanks. The two options can be mixed.
333 *
334 * A second bas class function ConfigureFromCDBTObjString() allows to configure
335 * directly from a number of OCDB objects. This requires the entries to be of
336 * type TObjString and the child implementation of ScanConfigurationArgument().
337 *
a655eae3 338 * @section alihltcomponent-handling Component handling
339 * The handling of HLT analysis components is carried out by the AliHLTComponentHandler.
340 * Component are registered automatically at load-time of the component shared library
341 * under the following suppositions:
342 * - the component library has to be loaded from the AliHLTComponentHandler using the
343 * @ref AliHLTComponentHandler::LoadLibrary method.
02bc7a5f 344 * - the library defines an AliHLTModuleAgent which registers all components.
345 * See AliHLTModuleAgent::RegisterComponents <br>
346 * or <br>
a655eae3 347 * - the component implementation defines one global object (which is generated
02bc7a5f 348 * when the library is loaded) <br>
a655eae3 349 *
350 * @subsection alihltcomponent-design-rules General design considerations
351 * The analysis code should be implemented in one or more destict class(es). A
352 * \em component should be implemented which interface the destict analysis code to the
353 * component interface. This component generates the analysis object dynamically. <br>
354 *
355 * Assume you have an implemetation <tt> AliHLTDetMyAnalysis </tt>, another class <tt>
356 * AliHLTDetMyAnalysisComponent </tt> contains:
357 * <pre>
358 * private:
359 * AliHLTDetMyAnalysis* fMyAnalysis; //!
360 * </pre>
361 * The object should then be instantiated in the DoInit handler of
362 * <tt>AliHLTDetMyAnalysisComponent </tt>, and cleaned in the DoDeinit handler.
363 *
364 * Further rules:
365 * - avoid big static arrays in the component, allocate the memory at runtime
02bc7a5f 366 * - allocate all kind of complex data members (like classes, ROOT TObjects of
367 * any kind) dynamically in DoInit and clean up in DoDeinit
a655eae3 368 *
9ace7282 369 * @section alihlt_component_arguments Default arguments
370 * The component base class provides some default arguments:
371 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
66108417 372 * \li -loglevel=level <br>
9ace7282 373 * \li -object-compression=level <br>
374 * compression level for ROOT objects, default is defined by
375 * @ref ALIHLTCOMPONENT_DEFAULT_OBJECT_COMPRESSION
9d4d4b02 376 * \li -pushback-period=period <br>
377 * scale down for PushBack of objects, shipped only for one event
378 * every <i>period</i> seconds
9ace7282 379 *
b22e91eb 380 * @ingroup alihlt_component
a655eae3 381 * @section alihltcomponent-members Class members
bfccbf68 382 */
5ec8e281 383class AliHLTComponent : public AliHLTLogging {
f23a6e1a 384 public:
bfccbf68 385 /** standard constructor */
f23a6e1a 386 AliHLTComponent();
bfccbf68 387 /** standard destructor */
f23a6e1a 388 virtual ~AliHLTComponent();
389
bfccbf68 390 /** component type definitions */
f23a6e1a 391 enum TComponentType { kUnknown=0, kSource=1, kProcessor=2, kSink=3 };
bfccbf68 392
393 /**
394 * Init function to prepare data processing.
395 * Initialization of common data structures for a sequence of events.
18e3dbba 396 * The call is redirected to the internal method DoInit which can be
397 * overridden by the child class.
bfccbf68 398 * During Init also the environment structure is passed to the component.
c528fdc6 399 * @param comenv environment pointer with environment dependent function
bfccbf68 400 * calls
18e3dbba 401 * @param environParam additional parameter for function calls, the pointer
bfccbf68 402 * is passed as it is
403 * @param argc size of the argument array
18e3dbba 404 * @param argv augment array for component initialization
bfccbf68 405 */
c528fdc6 406 virtual int Init( const AliHLTAnalysisEnvironment* comenv, void* environParam, int argc, const char** argv );
bfccbf68 407
408 /**
409 * Clean-up function to terminate data processing.
410 * Clean-up of common data structures after data processing.
411 * The call is redirected to the internal method @ref DoDeinit which can be
412 * overridden by the child class.
413 */
f23a6e1a 414 virtual int Deinit();
bfccbf68 415
416 /**
417 * Processing of one event.
3cde846d 418 * The method is the entrance of the event processing. The parameters are
419 * cached for uses with the high-level interface and the DoProcessing
420 * implementation is called.
421 *
422 * @param evtData
423 * @param blocks
424 * @param trigData
425 * @param outputPtr
426 * @param size
427 * @param outputBlockCnt out: size of the output block array, set by the component
428 * @param outputBlocks out: the output block array is allocated internally
429 * @param edd
430 * @return neg. error code if failed
431 */
432 int ProcessEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
433 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
434 AliHLTUInt32_t& size, AliHLTUInt32_t& outputBlockCnt,
435 AliHLTComponentBlockData*& outputBlocks,
436 AliHLTComponentEventDoneData*& edd );
437
438 /**
439 * Internal processing of one event.
bfccbf68 440 * The method is pure virtual and implemented by the child classes
441 * - @ref AliHLTProcessor
442 * - @ref AliHLTDataSource
443 * - @ref AliHLTDataSink
444 *
445 * @param evtData
446 * @param blocks
447 * @param trigData
448 * @param outputPtr
449 * @param size
2d7ff710 450 * @param outputBlocks out: the output block array is allocated internally
bfccbf68 451 * @param edd
452 * @return neg. error code if failed
453 */
3cde846d 454 virtual int DoProcessing( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
8ede8717 455 AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
a655eae3 456 AliHLTUInt32_t& size,
2be3f004 457 AliHLTComponentBlockDataList& outputBlocks,
8ede8717 458 AliHLTComponentEventDoneData*& edd ) = 0;
f23a6e1a 459
579d9eb7 460 /**
461 * Init the CDB.
462 * The function must not be called when running in AliRoot unless it it
463 * really wanted. The CDB path will be set to the specified path, which might
464 * override the path initialized at the beginning of the AliRoot reconstruction.
465 *
466 * The method is used from the external interface in order to set the correct
82c58a87 467 * path when running on-line. The function also initializes the function
468 * callback for setting the run no during operation.
469 *
470 * A separation of library and component handling is maybe appropriate in the
471 * future. Using the global component handler here is maybe not the cleanest
472 * solution.
473 * @param cdbPath path of the CDB
474 * @param pHandler the component handler used for llibrary handling.
579d9eb7 475 */
82c58a87 476 int InitCDB(const char* cdbPath, AliHLTComponentHandler* pHandler);
579d9eb7 477
478 /**
479 * Set the run no for the CDB.
480 * The function must not be called when running in AliRoot unless it it
481 * really wanted. The CDB path will be set to the specified path, which might
482 * override the run no initialized at the beginning of the AliRoot reconstruction.
45c0a780 483 * InitCDB() has to be called before in order to really change the CDB settings.
579d9eb7 484 *
485 * The method is used from the external interface in order to set the correct
486 * path when running on-line.
487 */
488 int SetCDBRunNo(int runNo);
489
45c0a780 490 /**
491 * Set the run description.
492 * The run description is set before the call of Init() -> DoInit().
493 * @note: This functionality has been added in Juli 2008. The transmission of
494 * run properties by a special SOR (SOD event in DAQ terminalogy but this was
495 * changed after the HLT interface was designed) event is not sufficient because
496 * the data might be needed already in the DoInit handler of the component.
497 * @param desc run descriptor, currently only the run no member is used
498 * @param runType originally, run type was supposed to be a number and part
499 * of the run descriptor. But it was defined as string later
500 */
501 int SetRunDescription(const AliHLTRunDesc* desc, const char* runType);
502
9a0ef890 503 /**
504 * Set the component description.
505 * The description string can contain tokens separated by blanks, a token
506 * consists of a key and an optional value separated by '='.
507 * Possible keys:
508 * \li -chainid=id string id within the chain of the instance
509 *
510 * @param desc component description
511 */
512 int SetComponentDescription(const char* desc);
513
c528fdc6 514 /**
515 * Set the running environment for the component.
516 * Originally, the environment was set in the Init function. However, the setup of
517 * the CDB is required before. In order to have proper logging functionality, the
518 * environment is required.
519 * @param comenv environment pointer with environment dependent function
520 * calls
521 * @param environParam additional parameter for function calls, the pointer
522 * is passed as it is
523 */
524 int SetComponentEnvironment(const AliHLTAnalysisEnvironment* comenv, void* environParam);
525
f23a6e1a 526 // Information member functions for registration.
bfccbf68 527
528 /**
529 * Get the type of the component.
530 * The function is pure virtual and must be implemented by the child class.
531 * @return component type id
532 */
f23a6e1a 533 virtual TComponentType GetComponentType() = 0; // Source, sink, or processor
bfccbf68 534
535 /**
536 * Get the id of the component.
537 * Each component is identified by a unique id.
538 * The function is pure virtual and must be implemented by the child class.
539 * @return component id (string)
540 */
f23a6e1a 541 virtual const char* GetComponentID() = 0;
bfccbf68 542
543 /**
544 * Get the input data types of the component.
545 * The function is pure virtual and must be implemented by the child class.
546 * @return list of data types in the vector reference
547 */
2be3f004 548 virtual void GetInputDataTypes( AliHLTComponentDataTypeList& ) = 0;
bfccbf68 549
550 /**
551 * Get the output data type of the component.
552 * The function is pure virtual and must be implemented by the child class.
553 * @return output data type
554 */
8ede8717 555 virtual AliHLTComponentDataType GetOutputDataType() = 0;
bfccbf68 556
de6593d0 557 /**
558 * Get the output data types of the component.
559 * The function can be implemented to indicate multiple output data types
560 * in the target array.
561 * @ref GetOutputDataType must return @ref kAliHLTMultipleDataType in order
562 * to invoke this method.
563 * @param tgtList list to receive the data types
564 * @return no of output data types, data types in the target list
565 */
2be3f004 566 virtual int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
de6593d0 567
bfccbf68 568 /**
18e3dbba 569 * Get a ratio by how much the data volume is shrunken or enhanced.
bfccbf68 570 * The function is pure virtual and must be implemented by the child class.
571 * @param constBase <i>return</i>: additive part, independent of the
572 * input data volume
573 * @param inputMultiplier <i>return</i>: multiplication ratio
574 * @return values in the reference variables
575 */
71d7c760 576 virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) = 0;
f23a6e1a 577
5ef2a37b 578 /**
579 * Get a list of OCDB object description.
580 * The list of objects is provided in a TMap
581 * - key: complete OCDB path, e.g. GRP/GRP/Data
582 * - value: short description why the object is needed
583 * Key and value objects created inside this class go into ownership of
584 * target TMap.
585 * @param targetMap TMap instance receiving the list
586 * @return void
587 */
588 virtual void GetOCDBObjectDescription( TMap* const targetArray);
589
bfccbf68 590 /**
591 * Spawn function.
592 * Each component must implement a spawn function to create a new instance of
593 * the class. Basically the function must return <i>new <b>my_class_name</b></i>.
594 * @return new class instance
595 */
f23a6e1a 596 virtual AliHLTComponent* Spawn() = 0;
0c0c9d99 597
5ef2a37b 598 /**
599 * check the availability of the OCDB entry descriptions in the TMap
600 * key : complete OCDB path of the entry
601 * value : auxiliary object - short description
602 * if the external map was not provided the function invokes
603 * interface function GetOCDBObjectDescription() to retrieve the list.
604 * @param externList map of entries to be tested
605 * @result 0 if all found, -ENOENT if objects not found
606 */
607 int CheckOCDBEntries(const TMap* const externList=NULL);
608
bfccbf68 609 /**
610 * Find matching data types between this component and a consumer component.
611 * Currently, a component can produce only one type of data. This restriction is most
612 * likely to be abolished in the future.
613 * @param pConsumer a component and consumer of the data produced by this component
614 * @param tgtList reference to a vector list to receive the matching data types.
615 * @return >= 0 success, neg. error code if failed
616 */
2be3f004 617 int FindMatchingDataTypes(AliHLTComponent* pConsumer, AliHLTComponentDataTypeList* tgtList);
f23a6e1a 618
bfccbf68 619 /**
620 * Set the global component handler.
621 * The static method is needed for the automatic registration of components.
622 */
85869391 623 static int SetGlobalComponentHandler(AliHLTComponentHandler* pCH, int bOverwrite=0);
bfccbf68 624
625 /**
626 * Clear the global component handler.
627 * The static method is needed for the automatic registration of components.
628 */
85869391 629 static int UnsetGlobalComponentHandler();
bfccbf68 630
9ce4bf4a 631 /**
632 * Helper function to convert the data type to a string.
fbdb63fd 633 * @param type data type structure
634 * @param mode 0 print string origin:type <br>
635 * 1 print chars <br>
636 * 2 print numbers
9ce4bf4a 637 */
fbdb63fd 638 static string DataType2Text( const AliHLTComponentDataType& type, int mode=0);
9ce4bf4a 639
48abe484 640 /**
641 * Calculate a CRC checksum of a data buffer.
642 * Polynomial for the calculation is 0xD8.
643 */
644 static AliHLTUInt32_t CalculateChecksum(const AliHLTUInt8_t* buffer, int size);
645
5f5b708b 646 /**
647 * Helper function to print content of data type.
648 */
8b97f4f1 649 static void PrintDataTypeContent(AliHLTComponentDataType& dt, const char* format=NULL);
5f5b708b 650
9ce4bf4a 651 /**
652 * helper function to initialize AliHLTComponentEventData structure
653 */
654 static void FillEventData(AliHLTComponentEventData& evtData);
655
656 /**
657 * Print info on an AliHLTComponentDataType structure
658 * This is just a helper function to examine an @ref AliHLTComponentDataType
659 * structur.
660 */
8b97f4f1 661 static void PrintComponentDataTypeInfo(const AliHLTComponentDataType& dt);
9ce4bf4a 662
fbdb63fd 663 /**
664 * Fill AliHLTComponentBlockData structure with default values.
665 * @param blockData reference to data structure
666 */
667 static void FillBlockData( AliHLTComponentBlockData& blockData );
668
669 /**
670 * Fill AliHLTComponentShmData structure with default values.
671 * @param shmData reference to data structure
672 */
673 static void FillShmData( AliHLTComponentShmData& shmData );
674
675 /**
676 * Fill AliHLTComponentDataType structure with default values.
677 * @param dataType reference to data structure
678 */
679 static void FillDataType( AliHLTComponentDataType& dataType );
680
681 /**
682 * Copy data type structure
683 * Copies the value an AliHLTComponentDataType structure to another one
684 * @param[out] tgtdt target structure
685 * @param[in] srcdt source structure
686 */
687 static void CopyDataType(AliHLTComponentDataType& tgtdt, const AliHLTComponentDataType& srcdt);
688
689 /**
690 * Set the ID and Origin of an AliHLTComponentDataType structure.
691 * The function sets the fStructureSize member and copies the strings
692 * to the ID and Origin. Only characters from the valid part of the string
7e3efc8f 693 * are copied, the rest is filled with 0's. <br>
fbdb63fd 694 * Please note that the fID and fOrigin members are not strings, just arrays of
695 * chars of size @ref kAliHLTComponentDataTypefIDsize and
696 * @ref kAliHLTComponentDataTypefOriginSize respectively and not necessarily with
7e3efc8f 697 * a terminating zero. <br>
698 * It is possible to pass NULL pointers as id or origin argument, in that case they
699 * are just ignored.
fbdb63fd 700 * @param tgtdt target data type structure
701 * @param id ID string
702 * @param origin Origin string
703 */
704 static void SetDataType(AliHLTComponentDataType& tgtdt, const char* id, const char* origin);
705
18b56222 706 /**
707 * Set the ID and Origin of an AliHLTComponentDataType structure.
708 * Given the fact that the data type ID is 64bit wide and origin 32, this helper
709 * function sets the data type from those two parameters.
af2ed151 710 * @param dt target data type structure
18b56222 711 * @param id 64bit id
af2ed151 712 * @param orig 32bit origin
18b56222 713 */
714 static void SetDataType(AliHLTComponentDataType& dt, AliHLTUInt64_t id, AliHLTUInt32_t orig);
715
abb52c8f 716 /**
717 * Extract a component table entry from the payload buffer.
718 * The entry consists of the AliHLTComponentTableEntry structure, the array of
719 * parents and a description string of the format 'chain-id{component-id:component-args}'.
720 * The function fills all the variables after a consistency check.
721 */
722 static int ExtractComponentTableEntry(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size,
723 string& chainId, string& compId, string& compParam,
724 vector<AliHLTUInt32_t>& parents);
89413559 725
726 /**
727 * Extracts the different data parts from the trigger data structure.
728 * [in] @param trigData The trigger data as passed to the DoProcessing method.
729 * [out] @param attributes The data block attributes given by the HLT framework.
730 * [out] @param status The HLT status bits given by the HLT framework.
731 * [out] @param cdh The common data header received from DDL links.
732 * [out] @param readoutlist The readout list to fill with readout list bits
733 * passed on by the HLT framework.
734 * [in] @param printErrors If true then error messages are generated as necessary
735 * and suppressed otherwise.
736 * @note If any of the output parameters are set to NULL then the field is not set.
737 * For example, the following line will only fill the CDH pointer.
738 * \code
739 * AliRawDataHeader* cdh;
740 * ExtractTriggerData(trigData, NULL, NULL, &cdh, NULL);
741 * \endcode
742 * @return the zero on success and one of the following error codes on failure.
743 * if a non-zero error code is returned then none of the output parameters are
744 * modified.
745 * \li -ENOENT The <i>trigData</i> structure size is wrong.
746 * \li -EBADF The <i>trigData</i> data size is wrong.
747 * \li -EBADMSG The common data header (CDH) in the trigger data has the wrong
748 * number of words indicated.
749 * \li -EPROTO The readout list structure in the trigger data has the wrong
750 * number of words indicated.
751 */
752 static int ExtractTriggerData(
753 const AliHLTComponentTriggerData& trigData,
754 const AliHLTUInt8_t (**attributes)[gkAliHLTBlockDAttributeCount],
755 AliHLTUInt64_t* status,
756 const AliRawDataHeader** cdh,
757 AliHLTReadoutList* readoutlist,
758 bool printErrors = false
759 );
760
761 /**
762 * Extracts the readout list from a trigger data structure.
763 * [in] @param trigData The trigger data as passed to the DoProcessing method.
764 * [out] @param list The output readout list to fill.
765 * [in] @param printErrors If true then error messages are generated as necessary
766 * and suppressed otherwise.
767 * @return the zero on success or one of the error codes returned by ExtractTriggerData.
768 */
769 static int GetReadoutList(
770 const AliHLTComponentTriggerData& trigData, AliHLTReadoutList& list,
771 bool printErrors = false
772 )
773 {
774 return ExtractTriggerData(trigData, NULL, NULL, NULL, &list, printErrors);
775 }
776
90ebac25 777 /**
778 * Stopwatch type for benchmarking.
779 */
780 enum AliHLTStopwatchType {
781 /** total time for event processing */
782 kSWBase,
783 /** detector algorithm w/o interface callbacks */
784 kSWDA,
785 /** data sources */
786 kSWInput,
787 /** data sinks */
788 kSWOutput,
789 /** number of types */
790 kSWTypeCount
791 };
792
793 /**
794 * Helper class for starting and stopping a stopwatch.
795 * The guard can be used by instantiating an object in a function. The
796 * specified stopwatch is started and the previous stopwatch put on
797 * hold. When the function is terminated, the object is deleted automatically
798 * deleted, stopping the stopwatch and starting the one on hold.<br>
799 * \em IMPORTANT: never create dynamic objects from this guard as this violates
800 * the idea of a guard.
801 */
802 class AliHLTStopwatchGuard {
803 public:
804 /** standard constructor (not for use) */
805 AliHLTStopwatchGuard();
806 /** constructor */
807 AliHLTStopwatchGuard(TStopwatch* pStart);
808 /** copy constructor (not for use) */
e419b223 809 AliHLTStopwatchGuard(const AliHLTStopwatchGuard&);
810 /** assignment operator (not for use) */
811 AliHLTStopwatchGuard& operator=(const AliHLTStopwatchGuard&);
90ebac25 812 /** destructor */
813 ~AliHLTStopwatchGuard();
814
815 private:
816 /**
817 * Hold the previous guard for the existence of this guard.
818 * Checks whether this guard controls a new stopwatch. In that case, the
819 * previous guard and its stopwatch are put on hold.
820 * @param pSucc instance of the stopwatch of the new guard
821 * @return 1 if pSucc is a different stopwatch which should
822 * be started<br>
823 * 0 if it controls the same stopwatch
824 */
0007ed52 825 int Hold(const TStopwatch* pSucc);
90ebac25 826
827 /**
828 * Resume the previous guard.
829 * Checks whether the peceeding guard controls a different stopwatch. In that
830 * case, the its stopwatch is resumed.
831 * @param pSucc instance of the stopwatch of the new guard
832 * @return 1 if pSucc is a different stopwatch which should
833 * be stopped<br>
834 * 0 if it controls the same stopwatch
835 */
0007ed52 836 int Resume(const TStopwatch* pSucc);
90ebac25 837
838 /** the stopwatch controlled by this guard */
839 TStopwatch* fpStopwatch; //!transient
840
841 /** previous stopwatch guard, put on hold during existence of the guard */
842 AliHLTStopwatchGuard* fpPrec; //!transient
843
844 /** active stopwatch guard */
845 static AliHLTStopwatchGuard* fgpCurrent; //!transient
846 };
847
848 /**
849 * Set a stopwatch for a given purpose.
850 * @param pSW stopwatch object
851 * @param type type of the stopwatch
852 */
853 int SetStopwatch(TObject* pSW, AliHLTStopwatchType type=kSWBase);
854
855 /**
856 * Init a set of stopwatches.
857 * @param pStopwatches object array of stopwatches
858 */
859 int SetStopwatches(TObjArray* pStopwatches);
97d2b87a 860
861 /**
862 * Customized logging function.
863 * The chain id, component id and pointer is added at the beginning of each message.
864 */
865 int LoggingVarargs(AliHLTComponentLogSeverity severity,
866 const char* originClass, const char* originFunc,
867 const char* file, int line, ... ) const;
a655eae3 868
b3f4766b 869 /**
870 * Get size of last serialized object.
871 * During PushBack, TObjects are serialized in a separate buffer. The
872 * size of the last object can be retrieved by this function.
873 *
874 * This might be especially useful for PushBack failures caused by too
875 * small output buffer.
876 */
877 int GetLastObjectSize() const {return fLastObjectSize;}
878
f23a6e1a 879 protected:
71d7c760 880
bfccbf68 881 /**
882 * Default method for the internal initialization.
883 * The method is called by @ref Init
884 */
53feaef5 885 virtual int DoInit( int argc, const char** argv );
f23a6e1a 886
bfccbf68 887 /**
888 * Default method for the internal clean-up.
889 * The method is called by @ref Deinit
890 */
53feaef5 891 virtual int DoDeinit();
f23a6e1a 892
579d9eb7 893 /**
894 * Reconfigure the component.
895 * The method is called when an event of type @ref kAliHLTDataTypeComConf
896 * {COM_CONF:PRIV} is received by the component. If the event is sent as
897 * part of a normal event, the component configuration is called first.
898 *
899 * The CDB path parameter specifies the path in the CDB, i.e. without
18e3dbba 900 * leading absolute path of the CDB location. The framework might also
579d9eb7 901 * provide the id of the component in the analysis chain.
902 *
02bc7a5f 903 * The actual sequence of configuration depends on the component. As a
904 * general rule, the component should load the specific OCDB object if
905 * provided as parameter, and load the default objects if the parameter
906 * is NULL. However, other schemes are possible. See @ref
907 *
579d9eb7 908 * \b Note: The CDB will be initialized by the framework, either already set
909 * from AliRoot or from the wrapper interface during initialization.
910 *
911 * @param cdbEntry path of the cdbEntry
e63b561e 912 * @param chainId the id/name of the component in the current analysis
913 * chain. This is not necessarily the same as what is
914 * returned by the GetComponentID() method.
579d9eb7 915 * @note both parameters can be NULL, check before usage
916 */
917 virtual int Reconfigure(const char* cdbEntry, const char* chainId);
b543e186 918
919 /**
920 * Read the Preprocessor values.
921 * The function is invoked when the component is notified about available/
922 * updated data points from the detector Preprocessors. The 'modules'
923 * argument contains all detectors for which the Preprocessors have
924 * updated data points. The component has to implement the CDB access to
925 * get the desired data points.
926 * @param modules detectors for which the Preprocessors have updated
d6b69874 927 * data points: TPC, TRD, ITS, PHOS, MUON, or ALL if
928 * no argument was received.
b543e186 929 * @return neg. error code if failed
930 */
931 virtual int ReadPreprocessorValues(const char* modules);
579d9eb7 932
02bc7a5f 933 /**
934 * Child implementation to scan a number of configuration arguments.
935 * The method is invoked by the framework in conjunction with the
936 * common framework functions ConfigureFromArgumentString and
937 * ConfigureFromCDBTObjString.
938 * Function needs to scan the argument and optional additional
939 * parameters and returns the number of elements in the array which
940 * have been treated.
941 * @param argc
942 * @param argv
943 * @return number of arguments which have been scanned or neg error
944 * code if failed <br>
945 * \li -EINVAL unknown argument
946 * \li -EPROTO protocol error, e.g. missing parameter
947 */
948 virtual int ScanConfigurationArgument(int argc, const char** argv);
949
45c0a780 950 /**
951 * Custom handler for the SOR event.
952 * Is invoked from the base class if an SOR event is in the block list.
953 * The handler is called before the processing function. The processing
954 * function is skipped if there are no other data blocks available.
955 *
956 * The SOR event is generated by the PubSub framework in response to
957 * the DAQ start of data (SOD - has been renamed after HLT interface
958 * was designed). The SOD event consists of 3 blocks:
959 * - ::kAliHLTDataTypeEvent block: spec ::gkAliEventTypeStartOfRun
960 * - SOD block of type ::kAliHLTDataTypeSOR, payload: AliHLTRunDesc struct
961 * - run type block ::kAliHLTDataTypeRunType, payload: run type string
962 *
963 * Run properties can be retrieved by getters like GetRunNo().
964 * @return neg. error code if failed
965 */
966 virtual int StartOfRun();
967
968 /**
969 * Custom handler for the EOR event.
970 * Is invoked from the base class if an EOR event is in the block list.
971 * The handler is called before the processing function. The processing
972 * function is skipped if there are no other data blocks available.
973 *
18e3dbba 974 * See StartOfRun() for more comments of the sequence of steering events.
45c0a780 975 *
976 * @return neg. error code if failed
977 */
978 virtual int EndOfRun();
979
48abe484 980 /**
981 * Check whether a component requires all steering blocks.
982 * Childs can overload in order to indicate that they want to
983 * receive also the steering data blocks. There is also the
984 * possibility to add the required data types to the input
985 * data type list in GetInputDataTypes().
986 */
987 virtual bool RequireSteeringBlocks() const {return false;}
988
bfccbf68 989 /**
990 * General memory allocation method.
991 * All memory which is going to be used 'outside' of the interface must
992 * be provided by the framework (online or offline).
993 * The method is redirected to a function provided by the current
994 * framework. Function pointers are transferred via the @ref
a3c9b745 995 * AliHLTAnalysisEnvironment structure.
bfccbf68 996 */
85869391 997 void* AllocMemory( unsigned long size );
f23a6e1a 998
bfccbf68 999 /**
1000 * Helper function to create a monolithic BlockData description block out
1001 * of a list BlockData descriptors.
1002 * For convenience, inside the interface vector lists are used, to make the
1003 * interface pure C style, monilithic blocks must be exchanged.
1004 * The method is redirected to a function provided by the current
1005 * framework. Function pointers are transferred via the @ref
a3c9b745 1006 * AliHLTAnalysisEnvironment structure.
bfccbf68 1007 */
2be3f004 1008 int MakeOutputDataBlockList( const AliHLTComponentBlockDataList& blocks, AliHLTUInt32_t* blockCount,
8ede8717 1009 AliHLTComponentBlockData** outputBlocks );
f23a6e1a 1010
bfccbf68 1011 /**
1012 * Fill the EventDoneData structure.
1013 * The method is redirected to a function provided by the current
1014 * framework. Function pointers are transferred via the @ref
a3c9b745 1015 * AliHLTAnalysisEnvironment structure.
bfccbf68 1016 */
0007ed52 1017 int GetEventDoneData( unsigned long size, AliHLTComponentEventDoneData** edd ) const;
f23a6e1a 1018
eafbc306 1019 /**
1020 * Allocate an EventDoneData structure for the current event .
1021 * The method allocates the memory internally and does not interact with the current Framework.
1022 * The allocated data structure is empty initially and can be filled by calls to the
1023 * @ref PushEventDoneData method. The memory will be automatically released after the event has been processed.
1024 *
1025 */
1026 int ReserveEventDoneData( unsigned long size );
1027
1028 /**
1029 * Push a 32 bit word of data into event done data for the current event which
1030 * has previously been allocated by the @ref ReserveEventDoneData method.
1031 */
1032 int PushEventDoneData( AliHLTUInt32_t eddDataWord );
1033
1034 /**
1035 * Release event done data previously reserved by @ref ReserveEventDoneData
1036 */
1037 void ReleaseEventDoneData();
1038
1039 /**
1040 * Get the pointer to the event done data available/built so far for the current event via
1041 * @ref ReserveEventDoneData and @ref PushEventDoneData
1042 */
0007ed52 1043 AliHLTComponentEventDoneData* GetCurrentEventDoneData() const
eafbc306 1044 {
1045 return fEventDoneData;
1046 }
1047
bfccbf68 1048 /**
1049 * Helper function to convert the data type to a string.
1050 */
70ed7d01 1051 void DataType2Text(const AliHLTComponentDataType& type, char output[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2]) const;
fa2e9b7c 1052
02bc7a5f 1053 /**
1054 * Loop through a list of component arguments.
1055 * The list can be either an array of separated strings or one single
1056 * string containing blank separated arguments, or both mixed.
1057 * ScanConfigurationArgument() is called to allow the component to treat
1058 * the individual arguments.
1059 * @return neg. error code if failed
1060 */
1061 int ConfigureFromArgumentString(int argc, const char** argv);
1062
1063 /**
1064 * Read configuration objects from OCDB and configure from
1065 * the content of TObjString entries.
1066 * @param entries blank separated list of OCDB paths
1067 * @return neg. error code if failed
1068 */
1069 int ConfigureFromCDBTObjString(const char* entries);
1070
1071 /**
1072 * Load specified entry from the OCDB and extract the object.
1073 * The entry is explicitely unloaded from the cache before it is loaded.
1074 * @param path path of the entry under to root of the OCDB
1075 * @param version version of the entry
1076 * @param subVersion subversion of the entry
1077 */
1078 TObject* LoadAndExtractOCDBObject(const char* path, int version = -1, int subVersion = -1);
1079
1080
3cde846d 1081 /**
1082 * Get event number.
1083 * @return value of the internal event counter
1084 */
70ed7d01 1085 int GetEventCount() const;
3cde846d 1086
a655eae3 1087 /**
1088 * Get the number of input blocks.
1089 * @return number of input blocks
1090 */
66043029 1091 int GetNumberOfInputBlocks() const;
a655eae3 1092
4646c6e3 1093 /**
1094 * Get id of the current event
1095 * @return event id
1096 */
1097 AliHLTEventID_t GetEventId() const;
1098
a655eae3 1099 /**
1100 * Get the first object of a specific data type from the input data.
18e3dbba 1101 * The High-level methods provide functionality to transfer ROOT data
a655eae3 1102 * structures which inherit from TObject.
3dd8541e 1103 *
a655eae3 1104 * The method looks for the first ROOT object of type dt in the input stream.
1105 * If also the class name is provided, the object is checked for the right
1106 * class type. The input data block needs a certain structure, namely the
1107 * buffer size as first word. If the cross check fails, the retrieval is
18e3dbba 1108 * silently abandoned, unless the \em bForce parameter is set.<br>
3dd8541e 1109 * \b Note: THE OBJECT MUST NOT BE DELETED by the caller.
1110 *
1111 * If called without parameters, the function tries to create objects from
1112 * all available input blocks, also the ones of data type kAliHLTVoidDataType
1113 * which are not matched by kAliHLTAnyDataType.
1114 *
a655eae3 1115 * @param dt data type of the object
1116 * @param classname class name of the object
1117 * @param bForce force the retrieval of an object, error messages
1118 * are suppressed if \em bForce is not set
1119 * @return pointer to @ref TObject, NULL if no objects of specified type
1120 * available
1121 */
3dd8541e 1122 const TObject* GetFirstInputObject(const AliHLTComponentDataType& dt=kAliHLTAllDataTypes,
a655eae3 1123 const char* classname=NULL,
1124 int bForce=0);
1125
1126 /**
1127 * Get the first object of a specific data type from the input data.
18e3dbba 1128 * The High-level methods provide functionality to transfer ROOT data
a655eae3 1129 * structures which inherit from TObject.
1130 * The method looks for the first ROOT object of type specified by the ID and
1131 * Origin strings in the input stream.
1132 * If also the class name is provided, the object is checked for the right
1133 * class type. The input data block needs a certain structure, namely the
1134 * buffer size as first word. If the cross check fails, the retrieval is
18e3dbba 1135 * silently abandoned, unless the \em bForce parameter is set.<br>
8451168b 1136 * \em Note: THE OBJECT MUST NOT BE DELETED by the caller.
a655eae3 1137 * @param dtID data type ID of the object
1138 * @param dtOrigin data type origin of the object
1139 * @param classname class name of the object
1140 * @param bForce force the retrieval of an object, error messages
1141 * are suppressed if \em bForce is not set
1142 * @return pointer to @ref TObject, NULL if no objects of specified type
1143 * available
1144 */
1145 const TObject* GetFirstInputObject(const char* dtID,
1146 const char* dtOrigin,
1147 const char* classname=NULL,
1148 int bForce=0);
1149
1150 /**
1151 * Get the next object of a specific data type from the input data.
18e3dbba 1152 * The High-level methods provide functionality to transfer ROOT data
a655eae3 1153 * structures which inherit from TObject.
1154 * The method looks for the next ROOT object of type and class specified
8451168b 1155 * to the previous @ref GetFirstInputObject call.<br>
1156 * \em Note: THE OBJECT MUST NOT BE DELETED by the caller.
a655eae3 1157 * @param bForce force the retrieval of an object, error messages
1158 * are suppressed if \em bForce is not set
1159 * @return pointer to @ref TObject, NULL if no more objects available
1160 */
1161 const TObject* GetNextInputObject(int bForce=0);
1162
1163 /**
1164 * Get data type of an input block.
1165 * Get data type of the object previously fetched via
1166 * GetFirstInputObject/NextInputObject or the last one if no object
1167 * specified.
1168 * @param pObject pointer to TObject
1169 * @return data specification, kAliHLTVoidDataSpec if failed
1170 */
1171 AliHLTComponentDataType GetDataType(const TObject* pObject=NULL);
1172
1173 /**
1174 * Get data specification of an input block.
1175 * Get data specification of the object previously fetched via
1176 * GetFirstInputObject/NextInputObject or the last one if no object
1177 * specified.
1178 * @param pObject pointer to TObject
1179 * @return data specification, kAliHLTVoidDataSpec if failed
1180 */
1181 AliHLTUInt32_t GetSpecification(const TObject* pObject=NULL);
1182
1183 /**
1184 * Get the first block of a specific data type from the input data.
3dd8541e 1185 * The method looks for the first block of type dt in the input stream.
1186 * It is intended to be used within the high-level interface.<br>
8451168b 1187 * \em Note: THE BLOCK DESCRIPTOR MUST NOT BE DELETED by the caller.
3dd8541e 1188 *
1189 * If called without parameters, the function works on all input blocks,
1190 * also the ones of data type kAliHLTVoidDataType which are not matched by
1191 * kAliHLTAnyDataType.
1192 *
a655eae3 1193 * @param dt data type of the block
1194 * @return pointer to @ref AliHLTComponentBlockData
1195 */
3dd8541e 1196 const AliHLTComponentBlockData* GetFirstInputBlock(const AliHLTComponentDataType& dt=kAliHLTAllDataTypes);
a655eae3 1197
1198 /**
1199 * Get the first block of a specific data type from the input data.
1200 * The method looks for the first block of type specified by the ID and
1201 * Origin strings in the input stream. It is intended
8451168b 1202 * to be used within the high-level interface.<br>
1203 * \em Note: THE BLOCK DESCRIPTOR MUST NOT BE DELETED by the caller.
a655eae3 1204 * @param dtID data type ID of the block
1205 * @param dtOrigin data type origin of the block
1206 * @return pointer to @ref AliHLTComponentBlockData
1207 */
1208 const AliHLTComponentBlockData* GetFirstInputBlock(const char* dtID,
1209 const char* dtOrigin);
1210
1211 /**
8451168b 1212 * Get input block by index.<br>
1213 * \em Note: THE BLOCK DESCRIPTOR MUST NOT BE DELETED by the caller.
a655eae3 1214 * @return pointer to AliHLTComponentBlockData, NULL if index out of range
1215 */
10b9cbf9 1216 const AliHLTComponentBlockData* GetInputBlock(int index) const;
a655eae3 1217
1218 /**
1219 * Get the next block of a specific data type from the input data.
1220 * The method looks for the next block of type and class specified
1221 * to the previous @ref GetFirstInputBlock call.
8451168b 1222 * To be used within the high-level interface.<br>
1223 * \em Note: THE BLOCK DESCRIPTOR MUST NOT BE DELETED by the caller.
a655eae3 1224 */
1225 const AliHLTComponentBlockData* GetNextInputBlock();
1226
1227 /**
1228 * Get data specification of an input block.
18e3dbba 1229 * Get data specification of the input block previously fetched via
a655eae3 1230 * GetFirstInputObject/NextInputObject or the last one if no block
1231 * specified.
1232 * @param pBlock pointer to input block
1233 * @return data specification, kAliHLTVoidDataSpec if failed
1234 */
ed510d1b 1235 AliHLTUInt32_t GetSpecification(const AliHLTComponentBlockData* pBlock);
a655eae3 1236
c7e9e2f2 1237 /**
1238 * Forward an input object to the output.
1239 * Forward the input block of an object previously fetched via
1240 * GetFirstInputObject/NextInputObject or the last one if no object
1241 * specified.
1242 * The block descriptor of the input block is forwarded to the
1243 * output block list.
1244 * @param pObject pointer to TObject
1245 * @return neg. error code if failed
1246 */
1247 int Forward(const TObject* pObject);
1248
1249 /**
1250 * Forward an input block to the output.
1251 * Forward the input block fetched via GetFirstInputObject/
1252 * NextInputBlock or the last one if no block specified.
1253 * The block descriptor of the input block is forwarded to the
1254 * output block list.
1255 * @param pBlock pointer to input block
1256 * @return neg. error code if failed
1257 */
1258 int Forward(const AliHLTComponentBlockData* pBlock=NULL);
1259
a655eae3 1260 /**
1261 * Insert an object into the output.
79c114b5 1262 * If header is specified, it will be inserted before the root object,
1263 * default is no header.
9d4d4b02 1264 * The publishing can be downscaled by means of the -pushback-period
1265 * parameter. This is especially useful for histograms which do not
1266 * need to be sent for every event.
a655eae3 1267 * @param pObject pointer to root object
1268 * @param dt data type of the object
1269 * @param spec data specification
79c114b5 1270 * @param pHeader pointer to header
1271 * @param headerSize size of Header
a655eae3 1272 * @return neg. error code if failed
1273 */
1274 int PushBack(TObject* pObject, const AliHLTComponentDataType& dt,
79c114b5 1275 AliHLTUInt32_t spec=kAliHLTVoidDataSpec,
1276 void* pHeader=NULL, int headerSize=0);
a655eae3 1277
1278 /**
1279 * Insert an object into the output.
79c114b5 1280 * If header is specified, it will be inserted before the root object,
1281 * default is no header.
9d4d4b02 1282 * The publishing can be downscaled by means of the -pushback-period
1283 * parameter. This is especially useful for histograms which do not
1284 * need to be sent for every event.
a655eae3 1285 * @param pObject pointer to root object
1286 * @param dtID data type ID of the object
1287 * @param dtOrigin data type origin of the object
1288 * @param spec data specification
79c114b5 1289 * @param pHeader pointer to header
1290 * @param headerSize size of Header
a655eae3 1291 * @return neg. error code if failed
1292 */
1293 int PushBack(TObject* pObject, const char* dtID, const char* dtOrigin,
79c114b5 1294 AliHLTUInt32_t spec=kAliHLTVoidDataSpec,
1295 void* pHeader=NULL, int headerSize=0);
1296
a655eae3 1297 /**
1298 * Insert an object into the output.
1299 * @param pBuffer pointer to buffer
1300 * @param iSize size of the buffer
1301 * @param dt data type of the object
1302 * @param spec data specification
9d9ffd37 1303 * @param pHeader pointer to header
7c4091c1 1304 * @param headerSize size of Header
a655eae3 1305 * @return neg. error code if failed
1306 */
438635e3 1307 int PushBack(const void* pBuffer, int iSize, const AliHLTComponentDataType& dt,
9d9ffd37 1308 AliHLTUInt32_t spec=kAliHLTVoidDataSpec,
438635e3 1309 const void* pHeader=NULL, int headerSize=0);
a655eae3 1310
1311 /**
1312 * Insert an object into the output.
1313 * @param pBuffer pointer to buffer
1314 * @param iSize size of the buffer
1315 * @param dtID data type ID of the object
1316 * @param dtOrigin data type origin of the object
1317 * @param spec data specification
9d9ffd37 1318 * @param pHeader pointer to header
7c4091c1 1319 * @param headerSize size of Header
a655eae3 1320 * @return neg. error code if failed
1321 */
438635e3 1322 int PushBack(const void* pBuffer, int iSize, const char* dtID, const char* dtOrigin,
9d9ffd37 1323 AliHLTUInt32_t spec=kAliHLTVoidDataSpec,
438635e3 1324 const void* pHeader=NULL, int headerSize=0);
a655eae3 1325
8451168b 1326 /**
1327 * Estimate size of a TObject
1328 * @param pObject
1329 * @return buffer size in byte
1330 */
1331 int EstimateObjectSize(TObject* pObject) const;
1332
79c114b5 1333 /**
1334 * Create a memory file in the output stream.
1335 * This method creates a TFile object which stores all data in
1336 * memory instead of disk. The TFile object is published as binary data.
1337 * The instance can be used like a normal TFile object. The TFile::Close
1338 * or @ref CloseMemoryFile method has to be called in order to flush the
1339 * output stream.
1340 *
1341 * \b Note: The returned object is deleted by the framework.
1342 * @param capacity total size reserved for the memory file
1343 * @param dtID data type ID of the file
1344 * @param dtOrigin data type origin of the file
1345 * @param spec data specification
1346 * @return file handle, NULL if failed
1347 */
1348 AliHLTMemoryFile* CreateMemoryFile(int capacity, const char* dtID, const char* dtOrigin,
1349 AliHLTUInt32_t spec=kAliHLTVoidDataSpec);
1350
1351 /**
1352 * Create a memory file in the output stream.
1353 * This method creates a TFile object which stores all data in
1354 * memory instead of disk. The TFile object is published as binary data.
1355 * The instance can be used like a normal TFile object. The TFile::Close
1356 * or @ref CloseMemoryFile method has to be called in order to flush the
1357 * output stream.
1358 *
1359 * \b Note: The returned object is deleted by the framework.
1360 * @param capacity total size reserved for the memory file
1361 * @param dt data type of the file
1362 * @param spec data specification
1363 * @return file handle, NULL if failed
1364 */
1365 AliHLTMemoryFile* CreateMemoryFile(int capacity,
1366 const AliHLTComponentDataType& dt=kAliHLTAnyDataType,
1367 AliHLTUInt32_t spec=kAliHLTVoidDataSpec);
1368
1369 /**
1370 * Create a memory file in the output stream.
1371 * This method creates a TFile object which stores all data in
1372 * memory instead of disk. The TFile object is published as binary data.
1373 * The instance can be used like a normal TFile object. The TFile::Close
1374 * or @ref CloseMemoryFile method has to be called in order to flush the
1375 * output stream.
1376 *
1377 * \b Note: The returned object is deleted by the framework.
1378 * @param dtID data type ID of the file
1379 * @param dtOrigin data type origin of the file
1380 * @param spec data specification
1381 * @param capacity fraction of the available output buffer size
1382 * @return file handle, NULL if failed
1383 */
1384 AliHLTMemoryFile* CreateMemoryFile(const char* dtID, const char* dtOrigin,
1385 AliHLTUInt32_t spec=kAliHLTVoidDataSpec,
1386 float capacity=1.0);
1387
1388 /**
1389 * Create a memory file in the output stream.
1390 * This method creates a TFile object which stores all data in
1391 * memory instead of disk. The TFile object is published as binary data.
1392 * The instance can be used like a normal TFile object. The TFile::Close
1393 * or @ref CloseMemoryFile method has to be called in order to flush the
1394 * output stream.
1395 *
1396 * \b Note: The returned object is deleted by the framework.
1397 * @param dt data type of the file
1398 * @param spec data specification
1399 * @param capacity fraction of the available output buffer size
1400 * @return file handle, NULL if failed
1401 */
1402 AliHLTMemoryFile* CreateMemoryFile(const AliHLTComponentDataType& dt=kAliHLTAnyDataType,
1403 AliHLTUInt32_t spec=kAliHLTVoidDataSpec,
1404 float capacity=1.0);
1405
1406 /**
1407 * Write an object to memory file in the output stream.
1408 * @param pFile file handle
1409 * @param pObject pointer to root object
1410 * @param key key in ROOT file
1411 * @param option options, see TObject::Write
1412 * @return neg. error code if failed
1413 * - -ENOSPC no space left
1414 */
1415 int Write(AliHLTMemoryFile* pFile, const TObject* pObject, const char* key=NULL, int option=TObject::kOverwrite);
1416
1417 /**
1418 * Close object memory file.
1419 * @param pFile file handle
1420 * @return neg. error code if failed
1421 * - -ENOSPC buffer size too small
1422 */
1423 int CloseMemoryFile(AliHLTMemoryFile* pFile);
1424
a655eae3 1425 /**
1426 * Insert event-done data information into the output.
1427 * @param edd event-done data information
1428 */
1429 int CreateEventDoneData(AliHLTComponentEventDoneData edd);
1430
559631d5 1431 /**
1432 * Get current run number
1433 */
1434 AliHLTUInt32_t GetRunNo() const;
1435
1436 /**
1437 * Get the current run type.
1438 */
1439 AliHLTUInt32_t GetRunType() const;
1440
9a0ef890 1441 /**
1442 * Get the chain id of the component.
1443 */
1444 const char* GetChainId() const {return fChainId.c_str();}
1445
6700298e 1446 /**
1447 * Get a timestamp of the current event
1448 * Exact format needs to be documented.
1449 */
1450 AliHLTUInt32_t GetTimeStamp() const;
1451
1452 /**
1453 * Get the period number.
1454 * Upper 28 bits (36 to 63) of the 64-bit event id
1455 */
1456 AliHLTUInt32_t GetPeriodNumber() const;
1457
1458 /**
1459 * Get the period number.
1460 * 24 bits, 12 to 35 of the 64-bit event id
1461 */
1462 AliHLTUInt32_t GetOrbitNumber() const;
1463
1464 /**
1465 * Get the bunch crossing number.
1466 * 12 bits, 0 to 12 of the 64-bit event id
1467 */
1468 AliHLTUInt16_t GetBunchCrossNumber() const;
1469
adb91bc3 1470 /**
1471 * Setup the CTP accounting functionality of the base class.
1472 * The method can be invoked from DoInit() for componenets which want to
1473 * use the CTP functionality of the base class.
1474 *
1475 * The AliHLTCTPData is initialized with the trigger classes from the ECS
1476 * parameters. The base class automatically increments the counters according
1477 * to the trigger pattern in the CDH before the event processing.
1478 */
1479 int SetupCTPData();
1480
1481 /**
1482 * Get the instance of the CTP data.
1483 */
1484 const AliHLTCTPData* CTPData() const {return fpCTPData;}
1485
cf9cf07e 1486 /**
1487 * Check whether a combination of trigger classes is fired.
1488 * The expression can contain trigger class ids and logic operators
1489 * like &&, ||, !, and ^, and may be grouped by parentheses.
3fcb48b8 1490 * @note the function requires the setup of the CTP handling for the component by
1491 * invoking SetupCTPData() from DoInit()
cf9cf07e 1492 * @param expression a logic expression of trigger class ids
1493 * @param trigData the trigger data data
1494 */
1495 bool EvaluateCTPTriggerClass(const char* expression, AliHLTComponentTriggerData& trigData) const;
1496
3fcb48b8 1497 /**
1498 * Check state of a trigger class.
1499 * If the class name is not part of the current trigger setup (i.e. ECS parameter
1500 * does not contain a trigger definition for this class name) the function
1501 * returns -1
1502 * @note the function requires the setup of the CTP handling for the component by
1503 * invoking SetupCTPData() from DoInit()
1504 * @return -1 class name not initialized,
1505 * 0 trigger not active
1506 * 1 trigger active
1507 */
1508 int CheckCTPTrigger(const char* name) const;
1509
a5e775ec 1510 /**
1511 * Get the overall solenoid field.
1512 */
1513 Double_t GetBz();
1514 /**
1515 * Get the solenoid field at point r.
1516 */
1517 Double_t GetBz(const Double_t *r);
1518 /**
1519 * Get the solenoid field components at point r.
1520 */
1521 void GetBxByBz(const Double_t r[3], Double_t b[3]);
1522
48abe484 1523 /**
1524 * Check whether the current event is a valid data event.
1525 * @param pTgt optional pointer to get the event type
1526 * @return true if the current event is a real data event
1527 */
0007ed52 1528 bool IsDataEvent(AliHLTUInt32_t* pTgt=NULL) const;
48abe484 1529
559631d5 1530 /**
1531 * Copy a struct from block data.
1532 * The function checks for block size and struct size. The least common
1533 * size will be copied to the target struct, remaining fields are initialized
1534 * to zero.<br>
1535 * The target struct must have a 32bit struct size indicator as first member.
1536 * @param pStruct target struct
1537 * @param iStructSize size of the struct
559631d5 1538 * @param iBlockNo index of input block
1539 * @param structname name of the struct (log messages)
1540 * @param eventname name of the event (log messages)
1541 * @return size copied, neg. error if failed
1542 */
83fec083 1543 int CopyStruct(void* pStruct, unsigned int iStructSize, unsigned int iBlockNo,
559631d5 1544 const char* structname="", const char* eventname="");
1545
f23a6e1a 1546 private:
b426991e 1547 /** copy constructor prohibited */
559631d5 1548 AliHLTComponent(const AliHLTComponent&);
b426991e 1549 /** assignment operator prohibited */
559631d5 1550 AliHLTComponent& operator=(const AliHLTComponent&);
1551
3cde846d 1552 /**
1553 * Increment the internal event counter.
1554 * To be used by the friend classes AliHLTProcessor, AliHLTDataSource
1555 * and AliHLTDataSink.
1556 * @return new value of the internal event counter
a655eae3 1557 * @internal
3cde846d 1558 */
1559 int IncrementEventCounter();
1560
a655eae3 1561 /**
1562 * Find the first input block of specified data type beginning at index.
1edbbe49 1563 * Input blocks containing a TObject have the size of the object as an
1564 * unsigned 32 bit number in the first 4 bytes. This has to match the block
1565 * size minus 4.
3dd8541e 1566 *
1567 * kAliHLTAllDataTypes is a special data type which includes both
1568 * kAliHLTVoidDataType and kAliHLTAnyDataType.
1569 *
a655eae3 1570 * @param dt data type
1571 * @param startIdx index to start the search
1edbbe49 1572 * @param bObject check if this is an object
a655eae3 1573 * @return index of the block, -ENOENT if no block found
1574 *
1575 * @internal
1576 */
1edbbe49 1577 int FindInputBlock(const AliHLTComponentDataType& dt, int startIdx=-1, int bObject=0) const;
a655eae3 1578
1579 /**
1580 * Get index in the array of input bocks.
1581 * Calculate index and check integrety of a block data structure pointer.
1582 * @param pBlock pointer to block data
1583 * @return index of the block, -ENOENT if no block found
1584 *
1585 * @internal
1586 */
66043029 1587 int FindInputBlock(const AliHLTComponentBlockData* pBlock) const;
a655eae3 1588
1589 /**
1590 * Create an object from a specified input block.
1591 * @param idx index of the input block
1592 * @param bForce force the retrieval of an object, error messages
1593 * are suppressed if \em bForce is not set
1594 * @return pointer to TObject, caller must delete the object after use
1595 *
1596 * @internal
1597 */
1598 TObject* CreateInputObject(int idx, int bForce=0);
1599
1600 /**
1601 * Get input object
8451168b 1602 * Get object from the input block list. The methods first checks whether the
1603 * object was already created. If not, it is created by @ref CreateInputObject
1604 * and inserted into the list of objects.
a655eae3 1605 * @param idx index in the input block list
1606 * @param classname name of the class, object is checked for correct class
1607 * name if set
1608 * @param bForce force the retrieval of an object, error messages
1609 * are suppressed if \em bForce is not set
1610 * @return pointer to TObject
1611 *
1612 * @internal
1613 */
1614 TObject* GetInputObject(int idx, const char* classname=NULL, int bForce=0);
1615
8451168b 1616 /**
1617 * Clean the list of input objects.
1618 * Cleanup is done at the end of each event processing.
1619 */
1620 int CleanupInputObjects();
1621
a655eae3 1622 /**
1623 * Insert a buffer into the output block stream.
1624 * This is the only method to insert blocks into the output stream, called
1625 * from all types of the Pushback method. The actual data might have been
1626 * written to the output buffer already. In that case NULL can be provided
79c114b5 1627 * as buffer, only the block descriptor will be build. If a header is specified,
1628 * it will be inserted before the buffer, default is no header.
a655eae3 1629 * @param pBuffer pointer to buffer
32db4144 1630 * @param iBufferSize size of the buffer in byte
a655eae3 1631 * @param dt data type
1632 * @param spec data specification
79c114b5 1633 * @param pHeader pointer to header
1634 * @param iHeaderSize size of Header
b6800be0 1635 * @return neg. error code if failed
a655eae3 1636 */
438635e3 1637 int InsertOutputBlock(const void* pBuffer, int iBufferSize,
a655eae3 1638 const AliHLTComponentDataType& dt,
79c114b5 1639 AliHLTUInt32_t spec,
438635e3 1640 const void* pHeader=NULL, int iHeaderSize=0);
a655eae3 1641
a0aeb701 1642 /**
1643 * Add a component statistics block to the output.
438635e3 1644 * @return size of the added data
a0aeb701 1645 */
1646 int AddComponentStatistics(AliHLTComponentBlockDataList& blocks,
1647 AliHLTUInt8_t* buffer,
1648 AliHLTUInt32_t bufferSize,
1649 AliHLTUInt32_t offset,
1650 AliHLTComponentStatisticsList& stats) const;
1651
438635e3 1652 /**
1653 * Add a component table entry (descriptor) to the output
1654 * This is done at SOR/EOR. The component table is a list of chain ids
1655 * and 32bit ids calculated by a crc algorithm from the chian id. This
1656 * allows to tag data blocks with the id number rather than the string.
1657 *
1658 * The kAliHLTDataTypeComponentTable data block currently has the string
1659 * as payload and the crc id as specification.
1660 * @return size of the added data
1661 */
1662 int AddComponentTableEntry(AliHLTComponentBlockDataList& blocks,
1663 AliHLTUInt8_t* buffer,
1664 AliHLTUInt32_t bufferSize,
abb52c8f 1665 AliHLTUInt32_t offset,
1666 const vector<AliHLTUInt32_t>& parents) const;
438635e3 1667
cf9cf07e 1668 /**
1669 * Scan the ECS parameter string.
1670 * The framework provides both the parameters of CONFIGURE and ENGAGE
1671 * in one string in a special data block kAliHLTDataTypeECSParam
1672 * {ECSPARAM:PRIV}. The general format is
1673 * <command>;<parameterkey>=<parametervalue>;<parameterkey>=<parametervalue>;...
1674 */
1675 int ScanECSParam(const char* ecsParam);
1676
1677 /**
1678 * The trigger classes are determined from the trigger and propagated by
1679 * ECS as part of the ENGAGE command parameter which is sent through the
1680 * framework during the SOR event. This function treats the value of the
1681 * parameter key CTP_TRIGGER_CLASS.
1682 */
1683 int InitCTPTriggerClasses(const char* ctpString);
1684
78d29060 1685 enum {
1686 kRequireSteeringBlocks = 0x1,
1687 kDisableComponentStat = 0x2
1688 };
1689
bfccbf68 1690 /** The global component handler instance */
a655eae3 1691 static AliHLTComponentHandler* fgpComponentHandler; //! transient
70ed7d01 1692
bfccbf68 1693 /** The environment where the component is running in */
a3c9b745 1694 AliHLTAnalysisEnvironment fEnvironment; // see above
f23a6e1a 1695
a655eae3 1696 /** Set by ProcessEvent before the processing starts */
1697 AliHLTEventID_t fCurrentEvent; // see above
f23a6e1a 1698
3cde846d 1699 /** internal event no */
a655eae3 1700 int fEventCount; // see above
1701
1702 /** the number of failed events */
1703 int fFailedEvents; // see above
1704
1705 /** event data struct of the current event under processing */
1706 AliHLTComponentEventData fCurrentEventData; // see above
1707
1708 /** array of input data blocks of the current event */
1709 const AliHLTComponentBlockData* fpInputBlocks; //! transient
1710
1711 /** index of the current input block */
1712 int fCurrentInputBlock; // see above
1713
1714 /** data type of the last block search */
1715 AliHLTComponentDataType fSearchDataType; // see above
1716
1717 /** name of the class for the object to search for */
1718 string fClassName; // see above
1719
1720 /** array of generated input objects */
1721 TObjArray* fpInputObjects; //! transient
1722
1723 /** the output buffer */
1724 AliHLTUInt8_t* fpOutputBuffer; //! transient
1725
1726 /** size of the output buffer */
1727 AliHLTUInt32_t fOutputBufferSize; // see above
1728
1729 /** size of data written to output buffer */
1730 AliHLTUInt32_t fOutputBufferFilled; // see above
1731
1732 /** list of ouput block data descriptors */
2be3f004 1733 AliHLTComponentBlockDataList fOutputBlocks; // see above
3cde846d 1734
90ebac25 1735 /** stopwatch array */
1736 TObjArray* fpStopwatches; //! transient
1737
79c114b5 1738 /** array of memory files AliHLTMemoryFile */
2be3f004 1739 AliHLTMemoryFilePList fMemFiles; //! transient
79c114b5 1740
559631d5 1741 /** descriptor of the current run */
1742 AliHLTRunDesc* fpRunDesc; //! transient
1743
82c58a87 1744 /** external fct to set CDB run no, indicates external CDB initialization */
d93ec7ca 1745 void (*fCDBSetRunNoFunc)(); //! transient
579d9eb7 1746
1747 /** id of the component in the analysis chain */
1748 string fChainId; //! transient
1749
48abe484 1750 /** crc value of the chainid, used as a 32bit id */
1751 AliHLTUInt32_t fChainIdCrc; //! transient
1752
a0aeb701 1753 /** optional benchmarking for the component statistics */
1754 TStopwatch* fpBenchmark; //! transient
1755
78d29060 1756 /** component flags, cleared in Deinit */
1757 AliHLTUInt32_t fFlags; //! transient
a0aeb701 1758
48abe484 1759 /** current event type */
1760 AliHLTUInt32_t fEventType; //! transient
1761
abb52c8f 1762 /** component arguments */
1763 string fComponentArgs; //! transient
1764
eafbc306 1765
1766 /** event done data */
1767 AliHLTComponentEventDoneData* fEventDoneData; //! transient
1768
1769 /** Reserved size of the memory stored at fEventDoneData */
1770 unsigned long fEventDoneDataSize; //! transient
1771
9ace7282 1772 /** Comression level for ROOT objects */
1773 int fCompressionLevel; //! transient
1774
b3f4766b 1775 /** size of last PushBack-serialized object */
1776 int fLastObjectSize; //! transient
1777
cf9cf07e 1778 /** array of trigger class descriptors */
adb91bc3 1779 AliHLTCTPData* fpCTPData; //! transient
cf9cf07e 1780
9d4d4b02 1781 /// update period for PushBack calls
1782 int fPushbackPeriod; //! transient
1783 /// time of last executed PushBack
1784 int fLastPushBackTime; //! transient
1785
78d29060 1786 ClassDef(AliHLTComponent, 14)
f23a6e1a 1787};
1788#endif