]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTDataTypes.h
bugfix: digit publisher was crashing due to malfunction in SOR/EOR handling
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDataTypes.h
CommitLineData
f23a6e1a 1// @(#) $Id$
2
3#ifndef ALIHLTDATATYPES_H
4#define ALIHLTDATATYPES_H
32db4144 5/* This file is property of and copyright by the ALICE HLT Project *
6 * ALICE Experiment at CERN, All rights reserved. *
f23a6e1a 7 * See cxx source for full Copyright notice */
8
b22e91eb 9/** @file AliHLTDataTypes.h
32db4144 10 @author Matthias Richter, Timm Steinbeck, Jochen Thaeder
b22e91eb 11 @date
12 @brief Data type declaration for the HLT module.
13*/
14
2cbdb37e 15//////////////////////////////////////////////////////////////////////////
16//
17// version no of HLT data types
18//
19//////////////////////////////////////////////////////////////////////////
20
21/* Version Description
22 * 1 first version until June 07; implicite, not tagged
23 * 2 introduced June 07, enhanced/cleaned/arranged structure
eda89fe6 24 * 3 2007-11-15 RAW DDL data type added; some inconsistencies fixed
25 * ('void' and 'any' origins); added signed HLT basic data types
69347e0d 26 * 2007-11-23 origin defines have become variables in conjunction
c704e290 27 * to be used with the operator| (AliHLTComponentDataType)
28 * 2007-11-24 added trigger structs and ESD tree data type
b543e186 29 * 4 Component configuration and DCS update events added
2efb85be 30 * gkAliHLTDDLListSize set from 29 to 30 according to new PubSub
31 * specs
c736de25 32 * 5 Data types for Run and Event summary, and for monitoring added
1ac82ce6 33 * 6 Common data types for TreeD and TreeR defined
703bcca6 34 * kAliHLTAllDataTypes and kAliHLTDataOriginSample added
d9dd3bc8 35 * kAliHLTDataOriginEMCAL added
45c0a780 36 * kAliHLTDataTypeRunType added
a0aeb701 37 * 7 kAliHLTDataTypeComponentStatistics, kAliHLTDataTypeComponentTable,
38 * and AliHLTComponentStatistics have been added for optional
39 * component block statistics
a3c9b745 40 * 8 new wrapper interface has been introduced, old wrapper interface
41 * deprecated but kept for backward compatibility, the PubSub
42 * interface is going to be compiled independently of AliHLT, new
43 * interface provided by the libHLTinterface.so
44 * AliHLTComponentEnvironment -> AliHLTAnalysisEnvironment
2cbdb37e 45 */
a3c9b745 46#define ALIHLT_DATA_TYPES_VERSION 8
2cbdb37e 47
32db4144 48//////////////////////////////////////////////////////////////////////////
49//
69347e0d 50// HLT data origin variables.
51//
52// By converting from defines to variables, the origins can be used with
53// the operator|
54//
55// AliHLTComponentDataType dt;
56// dt = kAliHLTDataTypeDDLRaw | gkAliHLTDataOriginTPC;
32db4144 57//
58//////////////////////////////////////////////////////////////////////////
59
1ac82ce6 60/** field size of datat type origin
61 * @ingroup alihlt_component_datatypes
62 */
32db4144 63const int kAliHLTComponentDataTypefOriginSize=4;
64
65
1ac82ce6 66/** invalid data origin
67 * @ingroup alihlt_component_datatypes
68 */
3f850585 69# define kAliHLTDataOriginVoid "\0\0\0"
70/** old invalid data origin, kept for backward compatibility */
32db4144 71# define kAliHLTVoidDataOrigin "\0\0\0"
72
1ac82ce6 73/** wildcard data type origin
74 * @ingroup alihlt_component_datatypes
75 */
3f850585 76# define kAliHLTDataOriginAny "***"
77/** old wildcard data type origin, kept for backward compatibility */
32db4144 78# define kAliHLTAnyDataOrigin "***"
79
1ac82ce6 80/** Data origin HLT out
81 * @ingroup alihlt_component_datatypes
82 */
69347e0d 83extern const char kAliHLTDataOriginOut[kAliHLTComponentDataTypefOriginSize];
32db4144 84
1ac82ce6 85/** Data origin HLT/PubSub private internal
86 * @ingroup alihlt_component_datatypes
87 */
69347e0d 88extern const char kAliHLTDataOriginPrivate[kAliHLTComponentDataTypefOriginSize];
32db4144 89
1ac82ce6 90/** Data origin TPC
91 * @ingroup alihlt_component_datatypes
92 */
69347e0d 93extern const char kAliHLTDataOriginTPC[kAliHLTComponentDataTypefOriginSize];
32db4144 94
1ac82ce6 95/** Data origin PHOS
96 * @ingroup alihlt_component_datatypes
97 */
69347e0d 98extern const char kAliHLTDataOriginPHOS[kAliHLTComponentDataTypefOriginSize];
32db4144 99
1ac82ce6 100/** Data origin MUON
101 * @ingroup alihlt_component_datatypes
102 */
69347e0d 103extern const char kAliHLTDataOriginMUON[kAliHLTComponentDataTypefOriginSize];
32db4144 104
1ac82ce6 105/** Data origin TRD
106 * @ingroup alihlt_component_datatypes
107 */
69347e0d 108extern const char kAliHLTDataOriginTRD[kAliHLTComponentDataTypefOriginSize];
32db4144 109
1ac82ce6 110/** Data origin ITS
111 * @ingroup alihlt_component_datatypes
112 */
69347e0d 113extern const char kAliHLTDataOriginITS[kAliHLTComponentDataTypefOriginSize];
32db4144 114
703bcca6 115/** Data origin for examples
116 * @ingroup alihlt_component_datatypes
117 */
118extern const char kAliHLTDataOriginSample[kAliHLTComponentDataTypefOriginSize];
119
d9dd3bc8 120/** Data origin EMCAL
121 * @ingroup alihlt_component_datatypes
122 */
123extern const char kAliHLTDataOriginEMCAL[kAliHLTComponentDataTypefOriginSize];
124
32db4144 125//////////////////////////////////////////////////////////////////////////
126//
127// HLT common data type defines
128//
129//////////////////////////////////////////////////////////////////////////
130
1ac82ce6 131/** field size of data type id
132 * @ingroup alihlt_component_datatypes
133 */
32db4144 134const int kAliHLTComponentDataTypefIDsize=8;
135
136
1ac82ce6 137/** invalid data type id
138 * @ingroup alihlt_component_datatypes
139 */
32db4144 140# define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
141
3dd8541e 142/** special id for all data types: any + void
143 * @ingroup alihlt_component_datatypes
144 */
145# define kAliHLTAllDataTypesID "ALLDATA"
146
147/** special id for any valid data type id
1ac82ce6 148 * @ingroup alihlt_component_datatypes
149 */
32db4144 150# define kAliHLTAnyDataTypeID "*******"
151
1ac82ce6 152/** DDL RAW data
153 * @ingroup alihlt_component_datatypes
154 */
3f850585 155# define kAliHLTDDLRawDataTypeID {'D','D','L','_','R','A','W',' '}
156
1ac82ce6 157/** calibration data for file exchange subscriber
158 * @ingroup alihlt_component_datatypes
159 */
32db4144 160# define kAliHLTFXSCalibDataTypeID {'F','X','S','_','C','A','L',' '}
161
162/** start of run (SOR) event
2cbdb37e 163 * @ref AliHLTRunDesc
1ac82ce6 164 * @ingroup alihlt_component_datatypes
32db4144 165 */
166# define kAliHLTSORDataTypeID {'S','T','A','R','T','O','F','R'}
167
168/** end of run (EOR) event
2cbdb37e 169 * @ref AliHLTRunDesc
1ac82ce6 170 * @ingroup alihlt_component_datatypes
32db4144 171 */
172# define kAliHLTEORDataTypeID {'E','N','D','O','F','R','U','N'}
173
45c0a780 174/** run type data block
175 * string with run type as payload
176 * @ingroup alihlt_component_datatypes
177 */
178# define kAliHLTRunTypeDataTypeID {'R','U','N','T','Y','P','E',' '}
179
32db4144 180/** DDL list event
181 * @ref AliHLTEventDDL
1ac82ce6 182 * @ingroup alihlt_component_datatypes
32db4144 183 */
184# define kAliHLTDDLDataTypeID {'D','D','L','L','I','S','T',' '}
185
9d9ffd37 186/** EventType event
187 * - empty payload, specification gives eventType
1ac82ce6 188 * @ingroup alihlt_component_datatypes
9d9ffd37 189 */
190# define kAliHLTEventDataTypeID {'E','V','E','N','T','T','Y','P'}
191
853121af 192/** ComponentConfiguration event
b543e186 193 * - payload contains the CDB path as string
1ac82ce6 194 * @ingroup alihlt_component_datatypes
853121af 195 */
196# define kAliHLTComConfDataTypeID {'C','O','M','_','C','O','N','F'}
197
b543e186 198/** DCS value update event
199 * - payload contains string of relevant detectors
1ac82ce6 200 * @ingroup alihlt_component_datatypes
b543e186 201 */
202# define kAliHLTUpdtDCSDataTypeID {'U','P','D','T','_','D','C','S'}
203
c704e290 204/** ESD data block
205 * an AliESD object of varying origin
853121af 206 * The 'V0' at the end allows a versioning
1ac82ce6 207 * @ingroup alihlt_component_datatypes
c704e290 208 */
a978c0d5 209# define kAliHLTESDObjectDataTypeID {'A','L','I','E','S','D','V','0'}
c704e290 210
a978c0d5 211/** ESD tree data block
212 * TTree with an AliESD object of varying origin
1ac82ce6 213 * @ingroup alihlt_component_datatypes
a978c0d5 214 */
215# define kAliHLTESDTreeDataTypeID {'E','S','D','_','T','R','E','E'}
64defa03 216
1ac82ce6 217/** AliRoot TreeD
218 * - the digits tree of an AliRoot module
219 * @ingroup alihlt_component_datatypes
220 */
221#define kAliHLTTreeDDataTypeID {'A','L','I','T','R','E','E','D'}
222
223/** AliRoot TreeR
224 * - the rec points tree of an AliRoot module
225 * @ingroup alihlt_component_datatypes
226 */
ad2fa36b 227#define kAliHLTTreeRDataTypeID {'A','L','I','T','R','E','E','R'}
1ac82ce6 228
64defa03 229/** HW Address selection data block
230 * - a selection list for 16 bit HW addresses
231 * - varying origin
1ac82ce6 232 * @ingroup alihlt_component_datatypes
64defa03 233 */
234# define kAliHLTHwAddr16DataTypeID {'H','W','A','D','D','R','1','6'}
235
2ff24e4c 236/** Event Statistics
237 * - event statistics for given detectors
238 * - varying origin
1ac82ce6 239 * @ingroup alihlt_component_datatypes
2ff24e4c 240 */
241# define kAliHLTEventStatisticsDataTypeID {'E','V','_','S','T','A','T','I'}
242
243/** Event Summary
244 * - event summary
245 * - origin : kAliHLTDataOriginOut ( HLT )
1ac82ce6 246 * @ingroup alihlt_component_datatypes
2ff24e4c 247 */
248# define kAliHLTEventSummaryDataTypeID {'E','V','_','S','U','M','M','A'}
249
250/** Run Statistics
251 * - run statistics for given detectors
252 * - varying origin
1ac82ce6 253 * @ingroup alihlt_component_datatypes
2ff24e4c 254 */
255# define kAliHLTRunStatisticsDataTypeID {'R','U','N','S','T','A','T','I'}
256
257/** Run Summary
258 * - run summary
259 * - origin : kAliHLTDataOriginOut ( HLT )
1ac82ce6 260 * @ingroup alihlt_component_datatypes
2ff24e4c 261 */
262# define kAliHLTRunSummaryDataTypeID {'R','U','N','S','U','M','M','A'}
263
a0aeb701 264/** Block Statistics
265 * - small block statistics info added to the data stream by
266 * the component base class
267 * - origin kAliHLTDataOriginPrivate
268 * @ingroup alihlt_component_datatypes
269 */
270# define kAliHLTComponentStatisticsDataTypeID {'C','O','M','P','S','T','A','T'}
271
272/** Component table
273 * - list of components in the chain to be percolated through the chain
274 * - each component adds it's chain id string and a generated 32bit id
275 * @ingroup alihlt_component_datatypes
276 */
277# define kAliHLTComponentTableDataTypeID {'C','O','M','P','T','A','B','L'}
278
c736de25 279/** general ROOT TObject
280 * - a general TObject exported from the HLT analysis
281 * - varying origin
1ac82ce6 282 * @ingroup alihlt_component_datatypes
c736de25 283 */
284#define kAliHLTTObjectDataTypeID {'R','O','O','T','T','O','B','J'}
285
286/** ROOT TObjArray
287 * - a TObjArray exported from the HLT analysis
288 * - varying origin
1ac82ce6 289 * @ingroup alihlt_component_datatypes
c736de25 290 */
291#define kAliHLTTObjArrayDataTypeID {'R','O','O','T','O','B','A','R'}
292
293/** ROOT TTree
294 * - a TTree object exported from the HLT analysis
295 * - varying origin
1ac82ce6 296 * @ingroup alihlt_component_datatypes
c736de25 297 */
298#define kAliHLTTTreeDataTypeID {'R','O','O','T','T','R','E','E'}
299
300/** ROOT histogram
301 * - a histogram object exported from the HLT analysis
302 * - class derives from TH1 (directly or indirectly) and inherits all common functionality
303 * - varying origin
1ac82ce6 304 * @ingroup alihlt_component_datatypes
c736de25 305 */
306#define kAliHLTHistogramDataTypeID {'R','O','O','T','H','I','S','T'}
307
308/** ROOT TNtuple
309 * - a TNtupl object exported from the HLT analysis
310 * - varying origin
1ac82ce6 311 * @ingroup alihlt_component_datatypes
c736de25 312 */
313#define kAliHLTTNtupleDataTypeID {'R','O','O','T','T','U','P','L'}
314
1843b457 315using namespace std;
f23a6e1a 316
317extern "C" {
32db4144 318 //////////////////////////////////////////////////////////////////////////
319 //
320 // Basic HLT data types
321 //
322 //////////////////////////////////////////////////////////////////////////
f23a6e1a 323
324 typedef unsigned char AliHLTUInt8_t;
325
eda89fe6 326 typedef signed char AliHLTInt8_t;
327
71d7c760 328 typedef unsigned short AliHLTUInt16_t;
329
eda89fe6 330 typedef signed short AliHLTInt16_t;
331
f23a6e1a 332 typedef unsigned int AliHLTUInt32_t;
333
eda89fe6 334 typedef signed int AliHLTInt32_t;
335
f23a6e1a 336 typedef unsigned long long AliHLTUInt64_t;
337
eda89fe6 338 typedef signed long long AliHLTInt64_t;
339
340 typedef float AliHLTFloat32_t;
341
342 typedef double AliHLTFloat64_t;
343
f23a6e1a 344 typedef AliHLTUInt64_t AliHLTEventID_t;
345
32db4144 346 //////////////////////////////////////////////////////////////////////////
347 //
348 // HLT logging levels
349 //
350 //////////////////////////////////////////////////////////////////////////
f23a6e1a 351
2efb85be 352 /**
353 * Logging severities of the HLT
354 */
355 enum AliHLTComponentLogSeverity {
356 /** no logging */
32db4144 357 kHLTLogNone = 0,
2efb85be 358 /** benchmark messages */
32db4144 359 kHLTLogBenchmark = 0x1,
2efb85be 360 /** debug messages */
32db4144 361 kHLTLogDebug = 0x2,
2efb85be 362 /** info messages */
32db4144 363 kHLTLogInfo = 0x4,
2efb85be 364 /** warning messages */
32db4144 365 kHLTLogWarning = 0x8,
2efb85be 366 /** error messages */
32db4144 367 kHLTLogError = 0x10,
b2065764 368 /** fatal error messages */
32db4144 369 kHLTLogFatal = 0x20,
b2065764 370 /** few important messages not to be filtered out.
371 * redirected to kHLTLogInfo in AliRoot
372 */
373 kHLTLogImportant = 0x40,
2efb85be 374 /** special value to enable all messages */
b2065764 375 kHLTLogAll = 0x7f,
2efb85be 376 /** the default logging filter */
7233bc62 377 kHLTLogDefault = 0x79
a3c9b745 378 };
32db4144 379
380 //////////////////////////////////////////////////////////////////////////
381 //
382 // HLT data structures for data exchange and external interface
383 //
384 //////////////////////////////////////////////////////////////////////////
385
386 /**
387 * @struct AliHLTComponentEventData
388 * Event descriptor
389 */
8ede8717 390 struct AliHLTComponentEventData
f23a6e1a 391 {
392 AliHLTUInt32_t fStructSize;
393 AliHLTEventID_t fEventID;
394 AliHLTUInt32_t fEventCreation_s;
395 AliHLTUInt32_t fEventCreation_us;
396 AliHLTUInt32_t fBlockCnt;
397 };
398
32db4144 399 /**
400 * @struct AliHLTComponentShmData
401 * Shared memory descriptor.
402 * Irrelevant for analysis components.
403 */
8ede8717 404 struct AliHLTComponentShmData
f23a6e1a 405 {
406 AliHLTUInt32_t fStructSize;
407 AliHLTUInt32_t fShmType;
408 AliHLTUInt64_t fShmID;
409 };
71d7c760 410
1ac82ce6 411 /**
412 * @defgroup alihlt_component_datatypes Common Component Data Types
413 * The analysis framework defines a number of common data types for
414 * usage in the detector modules, like e.g. ::kAliHLTAnyDataType
415 * and ::kAliHLTDataTypeDDLRaw. Those data types always have
416 * origin ::kAliHLTDataOriginAny. The correct detector origin can be
417 * set by using operator '|'
418 * <pre>
419 * AliHLTComponentDataType dt=kAliHLTDDLRawDataTypeID|kAliHLTDataOriginTPC
420 * </pre>
421 * @ingroup alihlt_component
422 */
423
32db4144 424 /**
425 * @struct AliHLTComponentDataType
559631d5 426 * Data type descriptor for data blocks transferred through the processing
32db4144 427 * chain.
1ac82ce6 428 * @ingroup alihlt_component_datatypes
32db4144 429 */
8ede8717 430 struct AliHLTComponentDataType
f23a6e1a 431 {
432 AliHLTUInt32_t fStructSize;
32db4144 433 char fID[kAliHLTComponentDataTypefIDsize]; //!
434 char fOrigin[kAliHLTComponentDataTypefOriginSize]; //!
f23a6e1a 435 };
2d7ff710 436
32db4144 437 /**
438 * @struct AliHLTComponentBlockData
3294f81a 439 * This is the decription of data blocks exchanged between components.
440 * \b IMPORTANT: The validity of fPtr and fOffset is different for input and
441 * output blocks:
442 * - input blocks: The \em fPtr member always points to the beginning of the data
443 * of size \em fSize. fOffset is ignored and should be in most
444 * case 0.
445 * - output blocks: The \em fPtr member is ignored by the framework. \em fOffset
446 * must specify the start of the data relative to the output
447 * buffer. The data block has size \em fSize.
32db4144 448 */
8ede8717 449 struct AliHLTComponentBlockData
f23a6e1a 450 {
3294f81a 451 /* size and version of the struct */
f23a6e1a 452 AliHLTUInt32_t fStructSize;
3294f81a 453 /* shared memory key, ignored by processing components */
8ede8717 454 AliHLTComponentShmData fShmKey;
3294f81a 455 /* offset of output data relative to the output buffer */
f23a6e1a 456 AliHLTUInt32_t fOffset;
3294f81a 457 /* start of the data for input data blocks, fOffset to be ignored*/
f23a6e1a 458 void* fPtr;
3294f81a 459 /* size of the data block */
f23a6e1a 460 AliHLTUInt32_t fSize;
3294f81a 461 /* data type of the data block */
8ede8717 462 AliHLTComponentDataType fDataType;
3294f81a 463 /* data specification of the data block */
f23a6e1a 464 AliHLTUInt32_t fSpecification;
465 };
466
32db4144 467 /**
468 * @struct AliHLTComponentEventDoneData
469 *
470 */
8ede8717 471 struct AliHLTComponentEventDoneData
f23a6e1a 472 {
473 AliHLTUInt32_t fStructSize;
474 AliHLTUInt32_t fDataSize;
475 void* fData;
476 };
477
32db4144 478 /**
2cbdb37e 479 * @struct AliHLTRunDesc
32db4144 480 * Event descriptor.
45c0a780 481 * The struct is sent with the SOR and EOR events.
482 *
483 * @note
a3c9b745 484 * The name of the member fRunType is a bit misleading. This is not
485 * the ALICE Run Type given by the ECS to the sub-system. The member
486 * is an internal HLT run type and a combination of the HLT running
487 * mode and the beam type.
488 * <pre>
489 * Bit 0-2: beam type identifier
490 * Bit 3-31: HLT mode
491 * </pre>
32db4144 492 */
2cbdb37e 493 struct AliHLTRunDesc
32db4144 494 {
495 AliHLTUInt32_t fStructSize;
496 AliHLTUInt32_t fRunNo;
497 AliHLTUInt32_t fRunType;
498 };
499
a0aeb701 500 /**
501 * @struct AliHLTComponentStatistics
502 * Small block size summary added by the AliHLTComponent base class
503 * if component statistics are enabled (--enable-compstat).
504 *
505 * fLevel is retrieved from incoming block statistics and incremented.
506 * Incoming block statistics are appended to the newly added one if
507 * --enable-compstat=full has been chosen.
508 */
509 struct AliHLTComponentStatistics
510 {
511 AliHLTUInt32_t fStructSize;
512 AliHLTUInt32_t fLevel;
513 AliHLTUInt32_t fId;
514 AliHLTUInt32_t fTime;
515 AliHLTUInt32_t fCTime;
516 AliHLTUInt32_t fInputBlockCount;
517 AliHLTUInt32_t fTotalInputSize;
518 AliHLTUInt32_t fOutputBlockCount;
519 AliHLTUInt32_t fTotalOutputSize;
520 };
521
522 /**
523 * @struct AliHLTComponentTableEntry
524 * Structure to be send on SOR event through the chain. Each component
525 * adds its chain id and component arguments to the list.
526 * The 'length' of the structure is variable and depends on the length
527 * of the strings in the buffer at the end.
528 */
529 struct AliHLTComponentTableEntry
530 {
531 AliHLTUInt32_t fStructSize;
532 /** the 32bit Id is generated by a CRC algorithm from the
533 chain Id of the component. This is not a 100% unique id
534 but with a high probability */
535 AliHLTUInt32_t fId;
536 /** size of the chain id string in the appended buffer */
537 AliHLTUInt8_t fSizeChainId;
538 /** size of the comp argument string in the appended buffer */
539 AliHLTUInt8_t fSizeCompArgs;
540 /** some reserved size */
541 AliHLTUInt8_t fSizeReserved;
542 /** the strings: chain id, component args, reserved */
543 AliHLTUInt8_t fBuffer[1];
544 };
545
8f81abf4 546 //////////////////////////////////////////////////////////////////////////
547 //
548 // Trigger meta information
549 //
550 //////////////////////////////////////////////////////////////////////////
551
552 /** field size of fAttribute */
2ff24e4c 553 const int gkAliHLTBlockDAttributeCount = 8;
8f81abf4 554
555 /** field size of fCommonHeader */
a3c9b745 556 const int gkAliHLTCommonHeaderCount = 8;
8f81abf4 557
32db4144 558 /** size of the DDL list */
2ff24e4c 559 const int gkAliHLTDDLListSize = 30;
560
561 /** Number of Trigger Classes of CTP in CDH */
562 const int gkNCTPTriggerClasses = 50;
32db4144 563
564 /**
565 * @struct AliHLTEventDDL
566 * DDL list event.
567 * The struct is send with the DDLLIST event.
8f81abf4 568 * Used in the trigger structure for internal apperance of
569 * the DLLs as well as for the HLT readout list send to DAQ
511b2509 570 * ( as DataType : kAliHLTDataTypeDDL )
32db4144 571 */
572 struct AliHLTEventDDL
573 {
574 AliHLTUInt32_t fCount;
575 AliHLTUInt32_t fList[gkAliHLTDDLListSize];
576 };
577
8f81abf4 578 /**
579 * @struct AliHLTEventTriggerData
8f81abf4 580 */
581 struct AliHLTEventTriggerData
582 {
8f81abf4 583 AliHLTUInt8_t fAttributes[gkAliHLTBlockDAttributeCount];
511b2509 584 AliHLTUInt64_t fHLTStatus; // Bit field
8f81abf4 585 AliHLTUInt32_t fCommonHeaderWordCnt;
586 AliHLTUInt32_t fCommonHeader[gkAliHLTCommonHeaderCount];
8f81abf4 587 AliHLTEventDDL fReadoutList;
588 };
589
590 /**
591 * @struct AliHLTComponentTriggerData
592 * Trigger data
593 */
594 struct AliHLTComponentTriggerData
595 {
596 AliHLTUInt32_t fStructSize;
597 AliHLTUInt32_t fDataSize;
598 void* fData;
599 };
600
9d9ffd37 601 //////////////////////////////////////////////////////////////////////////
602 //
603 // HLT Event Type Specification
604 //
605 //////////////////////////////////////////////////////////////////////////
606
607 /** Unknown eventType specification */
2ff24e4c 608 const AliHLTUInt32_t gkAliEventTypeUnknown = ~(AliHLTUInt32_t)0;
9d9ffd37 609 /** SOR eventType specification */
2ff24e4c 610 const AliHLTUInt32_t gkAliEventTypeStartOfRun=1;
9d9ffd37 611 /** Data eventType specification */
2ff24e4c 612 const AliHLTUInt32_t gkAliEventTypeData=2;
9d9ffd37 613 /** EOR eventType specification */
2ff24e4c 614 const AliHLTUInt32_t gkAliEventTypeEndOfRun=4;
9d9ffd37 615 /** Corrupt eventType specification */
2ff24e4c 616 const AliHLTUInt32_t gkAliEventTypeCorruptID=8;
9d9ffd37 617 /** Calibration eventType specification */
2ff24e4c 618 const AliHLTUInt32_t gkAliEventTypeCalibration=16;
9d9ffd37 619 /** DataReplay eventType specification */
2ff24e4c 620 const AliHLTUInt32_t gkAliEventTypeDataReplay=32;
b543e186 621 /** Configuration eventType specification */
2ff24e4c 622 const AliHLTUInt32_t gkAliEventTypeConfiguration=34;
d6b69874 623 /** Update DCS eventType specification */
2ff24e4c 624 const AliHLTUInt32_t gkAliEventTypeReadPreprocessor=35;
9d9ffd37 625 /** Tick eventType specification */
2ff24e4c 626 const AliHLTUInt32_t gkAliEventTypeTick=64;
9d9ffd37 627 /** Max eventType specification */
2ff24e4c 628 const AliHLTUInt32_t gkAliEventTypeMax=64;
9d9ffd37 629
32db4144 630 //////////////////////////////////////////////////////////////////////////
631 //
632 // HLT defines and defaults
633 //
634 //////////////////////////////////////////////////////////////////////////
635
1ac82ce6 636 /** invalid event id
637 * @ingroup alihlt_component_datatypes
638 */
32db4144 639 const AliHLTEventID_t kAliHLTVoidEventID=~(AliHLTEventID_t)0;
640
1ac82ce6 641 /** invalid data specification
642 * @ingroup alihlt_component_datatypes
643 */
32db4144 644 const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
645
45c0a780 646 /** invalid run no
647 * @ingroup alihlt_component_datatypes
648 */
649 const AliHLTUInt32_t kAliHLTVoidRunNo = ~(AliHLTUInt32_t)0;
650
651 /** invalid run type
652 * @ingroup alihlt_component_datatypes
653 */
654 const AliHLTUInt32_t kAliHLTVoidRunType = ~(AliHLTUInt32_t)0;
655
656 /** invalid run descriptor
657 * @ingroup alihlt_component_datatypes
658 */
659 const AliHLTRunDesc kAliHLTVoidRunDesc={sizeof(AliHLTRunDesc), kAliHLTVoidRunNo, kAliHLTVoidRunType};
660
32db4144 661 /** invalid shared memory type */
662 const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
663
664 /** invalid shared memory id */
665 const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
666
1ac82ce6 667 /** invalid data type
668 * @ingroup alihlt_component_datatypes
669 */
32db4144 670 const AliHLTComponentDataType kAliHLTVoidDataType = {
671 sizeof(AliHLTComponentDataType),
672 kAliHLTVoidDataTypeID,
3f850585 673 kAliHLTDataOriginVoid
32db4144 674 };
675
3dd8541e 676 /** all data types, means any + void data type
677 * @ingroup alihlt_component_datatypes
678 */
679 const AliHLTComponentDataType kAliHLTAllDataTypes = {
680 sizeof(AliHLTComponentDataType),
681 kAliHLTAllDataTypesID,
682 kAliHLTDataOriginAny
683 };
684
32db4144 685 // there is currently a problem with rootcint if the predefined ids
686 // (commented below) are used. rootcint does not find the id if they
687 // are char arrays defined with {} and individual chars. If strings
688 // are used it works fine
1ac82ce6 689 /** any data type
690 * @ingroup alihlt_component_datatypes
691 */
32db4144 692 const AliHLTComponentDataType kAliHLTAnyDataType = {
693 sizeof(AliHLTComponentDataType),
694 kAliHLTAnyDataTypeID,
3f850585 695 kAliHLTDataOriginAny
32db4144 696 };
697
1ac82ce6 698 /** multiple output data types
699 * @ingroup alihlt_component_datatypes
700 */
de6593d0 701 extern const AliHLTComponentDataType kAliHLTMultipleDataType;
702
1ac82ce6 703 /** data to file exchange subscriber
704 * @ingroup alihlt_component_datatypes
705 */
32db4144 706 extern const AliHLTComponentDataType kAliHLTDataTypeFXSCalib;
707
1ac82ce6 708 /** DDL list data type
709 * @ingroup alihlt_component_datatypes
710 */
32db4144 711 extern const AliHLTComponentDataType kAliHLTDataTypeDDL;
712
1ac82ce6 713 /** SOR data type
714 * @ingroup alihlt_component_datatypes
715 */
32db4144 716 extern const AliHLTComponentDataType kAliHLTDataTypeSOR;
717
1ac82ce6 718 /** EOR data type
719 * @ingroup alihlt_component_datatypes
720 */
32db4144 721 extern const AliHLTComponentDataType kAliHLTDataTypeEOR;
5ec8e281 722
45c0a780 723 /** Run type data block
724 * @ingroup alihlt_component_datatypes
725 */
726 extern const AliHLTComponentDataType kAliHLTDataTypeRunType;
727
1ac82ce6 728 /** Event type specification
729 * @ingroup alihlt_component_datatypes
730 */
77405890 731 extern const AliHLTComponentDataType kAliHLTDataTypeEvent;
732
1ac82ce6 733 /** Configuration event data type
734 * @ingroup alihlt_component_datatypes
735 */
853121af 736 extern const AliHLTComponentDataType kAliHLTDataTypeComConf;
737
1ac82ce6 738 /** DCS value update event
739 * @ingroup alihlt_component_datatypes
740 */
b543e186 741 extern const AliHLTComponentDataType kAliHLTDataTypeUpdtDCS;
742
1ac82ce6 743 /** RAW DDL data specification, origin is 'any', data publisher origin correctly
744 * @ingroup alihlt_component_datatypes
745 */
3f850585 746 extern const AliHLTComponentDataType kAliHLTDataTypeDDLRaw;
747
1ac82ce6 748 /** ESD object data specification, origin is 'any'
749 * @ingroup alihlt_component_datatypes
750 */
a978c0d5 751 extern const AliHLTComponentDataType kAliHLTDataTypeESDObject;
752
1ac82ce6 753 /** ESD Tree data specification, origin is 'any'
754
a3c9b745 755 * @ingroup alihlt_component_datatypes
756 */
c704e290 757 extern const AliHLTComponentDataType kAliHLTDataTypeESDTree;
758
1ac82ce6 759 /** AliRoot TreeD data specification, origin is 'any'
760 * @ingroup alihlt_component_datatypes
761 */
762 extern const AliHLTComponentDataType kAliHLTDataTypeAliTreeD;
763
764 /** AliRoot TreeR data specification, origin is 'any'
765 * @ingroup alihlt_component_datatypes
766 */
767 extern const AliHLTComponentDataType kAliHLTDataTypeAliTreeR;
768
769 /** 16 bit Hardware address selection data specification, origin is 'any'
770 * @ingroup alihlt_component_datatypes
771 */
64defa03 772 extern const AliHLTComponentDataType kAliHLTDataTypeHwAddr16;
773
1ac82ce6 774 /** Event statistics
775 * @ingroup alihlt_component_datatypes
776 */
2ff24e4c 777 extern const AliHLTComponentDataType kAliHLTDataTypeEventStatistics;
778
1ac82ce6 779 /** Event summary
780 * @ingroup alihlt_component_datatypes
781 */
2ff24e4c 782 extern const AliHLTComponentDataType kAliHLTDataTypeEventSummary;
783
1ac82ce6 784 /** Event statistics
785 * @ingroup alihlt_component_datatypes
786 */
2ff24e4c 787 extern const AliHLTComponentDataType kAliHLTDataTypeRunStatistics;
788
1ac82ce6 789 /** Event summary
790 * @ingroup alihlt_component_datatypes
791 */
2ff24e4c 792 extern const AliHLTComponentDataType kAliHLTDataTypeRunSummary;
793
a0aeb701 794 /** Component block statistics
795 * @ingroup alihlt_component_datatypes
796 */
797 extern const AliHLTComponentDataType kAliHLTDataTypeComponentStatistics;
798
799 /** Component table
800 * To be sent on SOR event, each component adds it's chain id string
801 * and a generated 32bit identifier to the table
802 * @ingroup alihlt_component_datatypes
803 */
804 extern const AliHLTComponentDataType kAliHLTDataTypeComponentTable;
805
c736de25 806 //////////////////////////////////////////////////////////////////////////
807 //
808 // Data Types for Monitoring objects
809 //
810 //////////////////////////////////////////////////////////////////////////
811
1ac82ce6 812 /** general ROOT TObject
813 * @ingroup alihlt_component_datatypes
814 */
c736de25 815 extern const AliHLTComponentDataType kAliHLTDataTypeTObject; // {ROOTTOBJ,"***"}
816
1ac82ce6 817 /** ROOT TObjArray
818 * @ingroup alihlt_component_datatypes
819 */
c736de25 820 extern const AliHLTComponentDataType kAliHLTDataTypeTObjArray; // {ROOTOBAR,"***"}
821
1ac82ce6 822 /** ROOT TTree
823 * @ingroup alihlt_component_datatypes
824 */
c736de25 825 extern const AliHLTComponentDataType kAliHLTDataTypeTTree; // {ROOTTREE,"***"}
826
1ac82ce6 827 /** ROOT TH1 (can be used for all histograms, they derive from TH1)
828 * @ingroup alihlt_component_datatypes
829 */
c736de25 830 extern const AliHLTComponentDataType kAliHLTDataTypeHistogram; // {ROOTHIST,"***"}
831
1ac82ce6 832 /** ROOT TNtuple
833 * @ingroup alihlt_component_datatypes
834 */
c736de25 835 extern const AliHLTComponentDataType kAliHLTDataTypeTNtuple; // {ROOTTUPL,"***"}
836
32db4144 837 //////////////////////////////////////////////////////////////////////////
838 //
839 // FXS subscriber meta information
840 //
841 //////////////////////////////////////////////////////////////////////////
842
2ff24e4c 843 const int gkAliHLTFXSHeaderfOriginSize = 4;
844 const int gkAliHLTFXSHeaderfFileIDSize = 128;
845 const int gkAliHLTFXSHeaderfDDLNumberSize = 64;
32db4144 846
847 /** Header in front of the data payload, in order to sent data to the FXS. */
848 struct AliHLTFXSHeader
849 {
850 AliHLTUInt32_t fHeaderVersion;
851 AliHLTUInt32_t fRunNumber;
852 char fOrigin[gkAliHLTFXSHeaderfOriginSize];
853 char fFileID[gkAliHLTFXSHeaderfFileIDSize];
854 char fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];
855 };
856
857 //////////////////////////////////////////////////////////////////////////
858 //
859 // Component running environment
860 //
861 //////////////////////////////////////////////////////////////////////////
862
863 /** logging function */
864 typedef int (*AliHLTfctLogging)( void* param,
865 AliHLTComponentLogSeverity severity,
866 const char* origin,
867 const char* keyword,
868 const char* message);
869
870 /**
a3c9b745 871 * @struct AliHLTAnalysisEnvironment
32db4144 872 * Running environment for analysis components.
a3c9b745 873 * The struct describes function callbacks for actions to be
874 * carried out by the calling framework, like memory allocation,
875 * property callbecks, logging, etc.
876 *
877 * @ingroup alihlt_wrapper_interface
32db4144 878 */
a3c9b745 879 struct AliHLTAnalysisEnvironment
f23a6e1a 880 {
a3c9b745 881 /** size of the structure */
f23a6e1a 882 AliHLTUInt32_t fStructSize;
a3c9b745 883
884 /** the component parameter given by the framework on creation
885 */
f23a6e1a 886 void* fParam;
a3c9b745 887
888 /** allocated memory
889 */
f23a6e1a 890 void* (*fAllocMemoryFunc)( void* param, unsigned long size );
a3c9b745 891
892 /** allocate an EventDoneData structure.
893 */
894 int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
895
896 /** logging callback
897 */
898 AliHLTfctLogging fLoggingFunc;
899 };
f23a6e1a 900#if 0
a3c9b745 901 // I just keep this as a note pad. Has to be added to the end of the structure
902 // future addition already foreseen/envisioned
903 // IMPORTANT: don not just remove the defines as this breaks the binary
904 // compatibility
905 int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
f23a6e1a 906#endif
a3c9b745 907
908 /**
909 * @struct AliHLTComponentEnvironment
910 * This was the original definition of the running environment.
911 * Due to a bug in the AliRootWrapperSubscriber/SimpleComponentWrapper,
912 * this structure can not be used any longer but is kept for backward
913 * compatibility.
914 * @note The external interface provided by the libHLTbase is now kept
915 * frozen but should not be used any more. Use the interface provided
916 * by the libHLTinterface library.
917 *
918 * @ingroup alihlt_wrapper_interface_deprecated
919 */
920 struct AliHLTComponentEnvironment
921 {
922 AliHLTUInt32_t fStructSize;
923 void* fParam;
924 void* (*fAllocMemoryFunc)( void* param, unsigned long size );
8ede8717 925 int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
5ec8e281 926 AliHLTfctLogging fLoggingFunc;
f23a6e1a 927 };
a3c9b745 928
929 //////////////////////////////////////////////////////////////////////////
930 //
931 // The external interface definition
932 //
933 //////////////////////////////////////////////////////////////////////////
934
935 /**
936 * The component handle.
937 * Used as indification in the outside world.
938 * @ingroup alihlt_wrapper_interface
939 */
940 typedef void* AliHLTComponentHandle;
941
942 /** @ingroup alihlt_wrapper_interface */
943 const AliHLTComponentHandle kEmptyHLTComponentHandle = 0;
944
945 /**
946 * Get a system call of the interface.
947 * @param function signature
948 * @return pointer to system call
949 * @ingroup alihlt_wrapper_interface
950 */
951 typedef void* (*AliHLTAnalysisFctGetInterfaceCall)(const char*);
952
953# define ALIHLTANALYSIS_INTERFACE_LIBRARY "libHLTinterface.so"
954# define ALIHLTANALYSIS_FCT_GETINTERFACECALL "AliHLTAnalysisGetInterfaceCall"
955
956 /** @ingroup alihlt_wrapper_interface */
957 typedef int (*AliHLTExtFctInitSystem)( unsigned long version, AliHLTAnalysisEnvironment* externalEnv, unsigned long runNo, const char* runType );
958
959 /** @ingroup alihlt_wrapper_interface */
960 typedef int (*AliHLTExtFctDeinitSystem)();
961
962 /** @ingroup alihlt_wrapper_interface */
963 typedef int (*AliHLTExtFctLoadLibrary)( const char* );
964
965 /** @ingroup alihlt_wrapper_interface */
966 typedef int (*AliHLTExtFctUnloadLibrary)( const char* );
967
968 /** @ingroup alihlt_wrapper_interface */
969 typedef int (*AliHLTExtFctCreateComponent)( const char*, void*, int, const char**, AliHLTComponentHandle*, const char* description );
970
971 /** @ingroup alihlt_wrapper_interface */
972 typedef int (*AliHLTExtFctDestroyComponent)( AliHLTComponentHandle );
973
974 /** @ingroup alihlt_wrapper_interface */
975 typedef int (*AliHLTExtFctProcessEvent)( AliHLTComponentHandle, const AliHLTComponentEventData*, const AliHLTComponentBlockData*,
976 AliHLTComponentTriggerData*, AliHLTUInt8_t*,
977 AliHLTUInt32_t*, AliHLTUInt32_t*,
978 AliHLTComponentBlockData**,
979 AliHLTComponentEventDoneData** );
980
981 /** @ingroup alihlt_wrapper_interface */
982 typedef int (*AliHLTExtFctGetOutputDataType)( AliHLTComponentHandle, AliHLTComponentDataType* );
983
984 /** @ingroup alihlt_wrapper_interface */
985 typedef int (*AliHLTExtFctGetOutputSize)( AliHLTComponentHandle, unsigned long*, double* );
986
f23a6e1a 987}
988
32db4144 989//////////////////////////////////////////////////////////////////////////
990//
991// Data type helper functions
992//
993//////////////////////////////////////////////////////////////////////////
994
3dd8541e 995/** exact comparison of HLT component data types
996 * @ingroup alihlt_component_datatypes
997 */
998inline bool MatchExactly( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
999{
1000 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
1001 if ( dt1.fID[i] != dt2.fID[i] )
1002 return false;
1003 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
1004 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
1005 return false;
1006 return true;
1007}
1008
1ac82ce6 1009/** Comparison operator for HLT component data types.
1010 * The operator takes wildcards into account, i.e. the ::kAliHLTAnyDataType,
1011 * ::kAliHLTAnyDataTypeID and ::kAliHLTDataOriginAny definitions.
1012 * @ingroup alihlt_component_datatypes
1013 */
8ede8717 1014inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
853121af 1015{
3dd8541e 1016 if (MatchExactly(dt1, kAliHLTAllDataTypes)) return true;
1017 if (MatchExactly(dt2, kAliHLTAllDataTypes)) return true;
1018
853121af 1019 bool any1=true, any2=true, void1=true, void2=true, match=true;
1020 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ ) {
1021 any1&=(dt1.fOrigin[i]==kAliHLTDataOriginAny[i]);
1022 any2&=(dt2.fOrigin[i]==kAliHLTDataOriginAny[i]);
1023 void1&=(dt1.fOrigin[i]==kAliHLTDataOriginVoid[i]);
1024 void2&=(dt2.fOrigin[i]==kAliHLTDataOriginVoid[i]);
1025 match&=dt1.fOrigin[i]==dt2.fOrigin[i];
1026 if (!(match || (any2 && !void1) || (any1 && !void2)))
1027 return false;
1028 }
1029
1030 any1=true, any2=true, match=true;
1031 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ ) {
1032 any1&=(dt1.fID[i]==kAliHLTAnyDataTypeID[i]);
1033 any2&=(dt2.fID[i]==kAliHLTAnyDataTypeID[i]);
1034 void1&=(dt1.fID[i]==kAliHLTVoidDataTypeID[i]);
1035 void2&=(dt2.fID[i]==kAliHLTVoidDataTypeID[i]);
1036 match&=dt1.fID[i]==dt2.fID[i];
1037 if (!(match || (any2 && !void1) || (any1 && !void2)))
1038 return false;
1039 }
1040 return true;
1041}
71d7c760 1042
1ac82ce6 1043/** Comparison operator for HLT component data types
297174de 1044 * Invers of operator==
1ac82ce6 1045 * @ingroup alihlt_component_datatypes
1046 */
8ede8717 1047inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
853121af 1048{
1049 return !(dt1==dt2);
1050}
71d7c760 1051
1ac82ce6 1052/** merge operator for HLT component data types and origins
1053 * @ingroup alihlt_component_datatypes
1054 */
69347e0d 1055inline AliHLTComponentDataType operator|(const AliHLTComponentDataType srcdt, const char origin[kAliHLTComponentDataTypefOriginSize])
853121af 1056{
1057 AliHLTComponentDataType dt=srcdt;
1058 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
1059 dt.fOrigin[i]=origin[i];
1060 return dt;
1061}
32db4144 1062
e5c0542d 1063/**
1064 * Helper function to initialize a data type from an id char array and origin string.
1065 * @return data type structure initialized with the specified id and origin
1066 * @ingroup alihlt_component_datatypes
1067 */
1068inline AliHLTComponentDataType AliHLTComponentDataTypeInitializer(const char id[kAliHLTComponentDataTypefIDsize], const char* origin)
1069{
1070 AliHLTComponentDataType dt=kAliHLTVoidDataType;
1071 int i=0;
1072 for (i = 0; i < kAliHLTComponentDataTypefIDsize; i++)
1073 dt.fID[i]=id[i];
1074 for (i = 0; i < kAliHLTComponentDataTypefOriginSize && origin[i]!=0; i++ )
1075 dt.fOrigin[i]=origin[i];
1076 return dt;
1077}
1078
1079/**
1080 * Helper function to initialize a data type from a default data type and
1081 * an origin string. Basically it merges the specified origin into the data
1082 * type.
1083 * @return data type structure initialized with the id from specified data type
1084 * and origin
1085 * @ingroup alihlt_component_datatypes
1086 */
1087inline AliHLTComponentDataType AliHLTComponentDataTypeInitializer(const AliHLTComponentDataType src, const char* origin)
1088{
1089 return AliHLTComponentDataTypeInitializer(src.fID, origin);
1090}
1091
f23a6e1a 1092#endif