3 #ifndef ALIHLTDATATYPES_H
4 #define ALIHLTDATATYPES_H
5 /* This file is property of and copyright by the ALICE HLT Project *
6 * ALICE Experiment at CERN, All rights reserved. *
7 * See cxx source for full Copyright notice */
9 /** @file AliHLTDataTypes.h
10 @author Matthias Richter, Timm Steinbeck, Jochen Thaeder
12 @brief Data type declaration for the HLT module.
15 //////////////////////////////////////////////////////////////////////////
17 // version no of HLT data types
19 //////////////////////////////////////////////////////////////////////////
21 /* Version Description
22 * 1 first version until June 07; implicite, not tagged
23 * 2 introduced June 07, enhanced/cleaned/arranged structure
24 * 3 2007-11-15 RAW DDL data type added; some inconsistencies fixed
25 * ('void' and 'any' origins); added signed HLT basic data types
26 * 2007-11-23 origin defines have become variables in conjunction
27 * to be used with the operator| (AliHLTComponentDataType)
28 * 2007-11-24 added trigger structs and ESD tree data type
29 * 4 Component configuration and DCS update events added
30 * gkAliHLTDDLListSize set from 29 to 30 according to new PubSub
32 * 5 Data types for Run and Event summary, and for monitoring added
34 #define ALIHLT_DATA_TYPES_VERSION 5
36 //////////////////////////////////////////////////////////////////////////
38 // HLT data origin variables.
40 // By converting from defines to variables, the origins can be used with
43 // AliHLTComponentDataType dt;
44 // dt = kAliHLTDataTypeDDLRaw | gkAliHLTDataOriginTPC;
46 //////////////////////////////////////////////////////////////////////////
48 /** field size of datat type origin */
49 const int kAliHLTComponentDataTypefOriginSize=4;
52 /** invalid data origin */
53 # define kAliHLTDataOriginVoid "\0\0\0"
54 /** old invalid data origin, kept for backward compatibility */
55 # define kAliHLTVoidDataOrigin "\0\0\0"
57 /** wildcard data type origin */
58 # define kAliHLTDataOriginAny "***"
59 /** old wildcard data type origin, kept for backward compatibility */
60 # define kAliHLTAnyDataOrigin "***"
63 extern const char kAliHLTDataOriginOut[kAliHLTComponentDataTypefOriginSize];
65 /** HLT/PubSub private internal */
66 extern const char kAliHLTDataOriginPrivate[kAliHLTComponentDataTypefOriginSize];
69 extern const char kAliHLTDataOriginTPC[kAliHLTComponentDataTypefOriginSize];
72 extern const char kAliHLTDataOriginPHOS[kAliHLTComponentDataTypefOriginSize];
75 extern const char kAliHLTDataOriginMUON[kAliHLTComponentDataTypefOriginSize];
78 extern const char kAliHLTDataOriginTRD[kAliHLTComponentDataTypefOriginSize];
81 extern const char kAliHLTDataOriginITS[kAliHLTComponentDataTypefOriginSize];
83 //////////////////////////////////////////////////////////////////////////
85 // HLT common data type defines
87 //////////////////////////////////////////////////////////////////////////
89 /** field size of data type id */
90 const int kAliHLTComponentDataTypefIDsize=8;
93 /** invalid data type id */
94 # define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
96 /** special id for any data type id */
97 # define kAliHLTAnyDataTypeID "*******"
100 # define kAliHLTDDLRawDataTypeID {'D','D','L','_','R','A','W',' '}
102 /** calibration data for file exchange subscriber */
103 # define kAliHLTFXSCalibDataTypeID {'F','X','S','_','C','A','L',' '}
105 /** start of run (SOR) event
108 # define kAliHLTSORDataTypeID {'S','T','A','R','T','O','F','R'}
110 /** end of run (EOR) event
113 # define kAliHLTEORDataTypeID {'E','N','D','O','F','R','U','N'}
116 * @ref AliHLTEventDDL
118 # define kAliHLTDDLDataTypeID {'D','D','L','L','I','S','T',' '}
121 * - empty payload, specification gives eventType
123 # define kAliHLTEventDataTypeID {'E','V','E','N','T','T','Y','P'}
125 /** ComponentConfiguration event
126 * - payload contains the CDB path as string
128 # define kAliHLTComConfDataTypeID {'C','O','M','_','C','O','N','F'}
130 /** DCS value update event
131 * - payload contains string of relevant detectors
133 # define kAliHLTUpdtDCSDataTypeID {'U','P','D','T','_','D','C','S'}
136 * an AliESD object of varying origin
137 * The 'V0' at the end allows a versioning
139 # define kAliHLTESDObjectDataTypeID {'A','L','I','E','S','D','V','0'}
141 /** ESD tree data block
142 * TTree with an AliESD object of varying origin
144 # define kAliHLTESDTreeDataTypeID {'E','S','D','_','T','R','E','E'}
146 /** HW Address selection data block
147 * - a selection list for 16 bit HW addresses
150 # define kAliHLTHwAddr16DataTypeID {'H','W','A','D','D','R','1','6'}
153 * - event statistics for given detectors
156 # define kAliHLTEventStatisticsDataTypeID {'E','V','_','S','T','A','T','I'}
160 * - origin : kAliHLTDataOriginOut ( HLT )
162 # define kAliHLTEventSummaryDataTypeID {'E','V','_','S','U','M','M','A'}
165 * - run statistics for given detectors
168 # define kAliHLTRunStatisticsDataTypeID {'R','U','N','S','T','A','T','I'}
172 * - origin : kAliHLTDataOriginOut ( HLT )
174 # define kAliHLTRunSummaryDataTypeID {'R','U','N','S','U','M','M','A'}
176 /** general ROOT TObject
177 * - a general TObject exported from the HLT analysis
180 #define kAliHLTTObjectDataTypeID {'R','O','O','T','T','O','B','J'}
183 * - a TObjArray exported from the HLT analysis
186 #define kAliHLTTObjArrayDataTypeID {'R','O','O','T','O','B','A','R'}
189 * - a TTree object exported from the HLT analysis
192 #define kAliHLTTTreeDataTypeID {'R','O','O','T','T','R','E','E'}
195 * - a histogram object exported from the HLT analysis
196 * - class derives from TH1 (directly or indirectly) and inherits all common functionality
199 #define kAliHLTHistogramDataTypeID {'R','O','O','T','H','I','S','T'}
202 * - a TNtupl object exported from the HLT analysis
205 #define kAliHLTTNtupleDataTypeID {'R','O','O','T','T','U','P','L'}
210 //////////////////////////////////////////////////////////////////////////
212 // Basic HLT data types
214 //////////////////////////////////////////////////////////////////////////
216 typedef unsigned char AliHLTUInt8_t;
218 typedef signed char AliHLTInt8_t;
220 typedef unsigned short AliHLTUInt16_t;
222 typedef signed short AliHLTInt16_t;
224 typedef unsigned int AliHLTUInt32_t;
226 typedef signed int AliHLTInt32_t;
228 typedef unsigned long long AliHLTUInt64_t;
230 typedef signed long long AliHLTInt64_t;
232 typedef float AliHLTFloat32_t;
234 typedef double AliHLTFloat64_t;
236 typedef AliHLTUInt64_t AliHLTEventID_t;
238 //////////////////////////////////////////////////////////////////////////
240 // HLT logging levels
242 //////////////////////////////////////////////////////////////////////////
245 * Logging severities of the HLT
247 enum AliHLTComponentLogSeverity {
250 /** benchmark messages */
251 kHLTLogBenchmark = 0x1,
252 /** debug messages */
256 /** warning messages */
257 kHLTLogWarning = 0x8,
258 /** error messages */
260 /** fatal error messages */
262 /** few important messages not to be filtered out.
263 * redirected to kHLTLogInfo in AliRoot
265 kHLTLogImportant = 0x40,
266 /** special value to enable all messages */
268 /** the default logging filter */
269 kHLTLogDefault = 0x7d
272 //////////////////////////////////////////////////////////////////////////
274 // HLT data structures for data exchange and external interface
276 //////////////////////////////////////////////////////////////////////////
279 * @struct AliHLTComponentEventData
282 struct AliHLTComponentEventData
284 AliHLTUInt32_t fStructSize;
285 AliHLTEventID_t fEventID;
286 AliHLTUInt32_t fEventCreation_s;
287 AliHLTUInt32_t fEventCreation_us;
288 AliHLTUInt32_t fBlockCnt;
292 * @struct AliHLTComponentShmData
293 * Shared memory descriptor.
294 * Irrelevant for analysis components.
296 struct AliHLTComponentShmData
298 AliHLTUInt32_t fStructSize;
299 AliHLTUInt32_t fShmType;
300 AliHLTUInt64_t fShmID;
304 * @struct AliHLTComponentDataType
305 * Data type descriptor for data blocks transferred through the processing
308 struct AliHLTComponentDataType
310 AliHLTUInt32_t fStructSize;
311 char fID[kAliHLTComponentDataTypefIDsize]; //!
312 char fOrigin[kAliHLTComponentDataTypefOriginSize]; //!
316 * @struct AliHLTComponentBlockData
317 * This is the decription of data blocks exchanged between components.
318 * \b IMPORTANT: The validity of fPtr and fOffset is different for input and
320 * - input blocks: The \em fPtr member always points to the beginning of the data
321 * of size \em fSize. fOffset is ignored and should be in most
323 * - output blocks: The \em fPtr member is ignored by the framework. \em fOffset
324 * must specify the start of the data relative to the output
325 * buffer. The data block has size \em fSize.
327 struct AliHLTComponentBlockData
329 /* size and version of the struct */
330 AliHLTUInt32_t fStructSize;
331 /* shared memory key, ignored by processing components */
332 AliHLTComponentShmData fShmKey;
333 /* offset of output data relative to the output buffer */
334 AliHLTUInt32_t fOffset;
335 /* start of the data for input data blocks, fOffset to be ignored*/
337 /* size of the data block */
338 AliHLTUInt32_t fSize;
339 /* data type of the data block */
340 AliHLTComponentDataType fDataType;
341 /* data specification of the data block */
342 AliHLTUInt32_t fSpecification;
346 * @struct AliHLTComponentEventDoneData
349 struct AliHLTComponentEventDoneData
351 AliHLTUInt32_t fStructSize;
352 AliHLTUInt32_t fDataSize;
357 * @struct AliHLTRunDesc
359 * The struct is send with the SOR and EOR events.
363 AliHLTUInt32_t fStructSize;
364 AliHLTUInt32_t fRunNo;
365 AliHLTUInt32_t fRunType;
368 //////////////////////////////////////////////////////////////////////////
370 // Trigger meta information
372 //////////////////////////////////////////////////////////////////////////
374 /** field size of fAttribute */
375 const int gkAliHLTBlockDAttributeCount = 8;
377 /** field size of fCommonHeader */
378 const int gkAliHLTCommonHeaderCount = 8;
380 /** size of the DDL list */
381 const int gkAliHLTDDLListSize = 30;
383 /** Number of Trigger Classes of CTP in CDH */
384 const int gkNCTPTriggerClasses = 50;
387 * @struct AliHLTEventDDL
389 * The struct is send with the DDLLIST event.
390 * Used in the trigger structure for internal apperance of
391 * the DLLs as well as for the HLT readout list send to DAQ
392 * ( as DataType : kAliHLTDataTypeDDL )
394 struct AliHLTEventDDL
396 AliHLTUInt32_t fCount;
397 AliHLTUInt32_t fList[gkAliHLTDDLListSize];
401 * @struct AliHLTEventTriggerData
403 struct AliHLTEventTriggerData
405 AliHLTUInt8_t fAttributes[gkAliHLTBlockDAttributeCount];
406 AliHLTUInt64_t fHLTStatus; // Bit field
407 AliHLTUInt32_t fCommonHeaderWordCnt;
408 AliHLTUInt32_t fCommonHeader[gkAliHLTCommonHeaderCount];
409 AliHLTEventDDL fReadoutList;
413 * @struct AliHLTComponentTriggerData
416 struct AliHLTComponentTriggerData
418 AliHLTUInt32_t fStructSize;
419 AliHLTUInt32_t fDataSize;
423 //////////////////////////////////////////////////////////////////////////
425 // HLT Event Type Specification
427 //////////////////////////////////////////////////////////////////////////
429 /** Unknown eventType specification */
430 const AliHLTUInt32_t gkAliEventTypeUnknown = ~(AliHLTUInt32_t)0;
431 /** SOR eventType specification */
432 const AliHLTUInt32_t gkAliEventTypeStartOfRun=1;
433 /** Data eventType specification */
434 const AliHLTUInt32_t gkAliEventTypeData=2;
435 /** EOR eventType specification */
436 const AliHLTUInt32_t gkAliEventTypeEndOfRun=4;
437 /** Corrupt eventType specification */
438 const AliHLTUInt32_t gkAliEventTypeCorruptID=8;
439 /** Calibration eventType specification */
440 const AliHLTUInt32_t gkAliEventTypeCalibration=16;
441 /** DataReplay eventType specification */
442 const AliHLTUInt32_t gkAliEventTypeDataReplay=32;
443 /** Configuration eventType specification */
444 const AliHLTUInt32_t gkAliEventTypeConfiguration=34;
445 /** Update DCS eventType specification */
446 const AliHLTUInt32_t gkAliEventTypeReadPreprocessor=35;
447 /** Tick eventType specification */
448 const AliHLTUInt32_t gkAliEventTypeTick=64;
449 /** Max eventType specification */
450 const AliHLTUInt32_t gkAliEventTypeMax=64;
452 //////////////////////////////////////////////////////////////////////////
454 // HLT defines and defaults
456 //////////////////////////////////////////////////////////////////////////
458 /** invalid event id */
459 const AliHLTEventID_t kAliHLTVoidEventID=~(AliHLTEventID_t)0;
461 /** invalid data specification */
462 const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
464 /** invalid shared memory type */
465 const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
467 /** invalid shared memory id */
468 const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
470 /** invalid data type */
471 const AliHLTComponentDataType kAliHLTVoidDataType = {
472 sizeof(AliHLTComponentDataType),
473 kAliHLTVoidDataTypeID,
474 kAliHLTDataOriginVoid
477 // there is currently a problem with rootcint if the predefined ids
478 // (commented below) are used. rootcint does not find the id if they
479 // are char arrays defined with {} and individual chars. If strings
480 // are used it works fine
482 const AliHLTComponentDataType kAliHLTAnyDataType = {
483 sizeof(AliHLTComponentDataType),
484 kAliHLTAnyDataTypeID,
488 /** multiple output data types */
489 extern const AliHLTComponentDataType kAliHLTMultipleDataType;
491 /** data to file exchange subscriber */
492 extern const AliHLTComponentDataType kAliHLTDataTypeFXSCalib;
494 /** DDL list data type */
495 extern const AliHLTComponentDataType kAliHLTDataTypeDDL;
498 extern const AliHLTComponentDataType kAliHLTDataTypeSOR;
501 extern const AliHLTComponentDataType kAliHLTDataTypeEOR;
503 /** Event type specification */
504 extern const AliHLTComponentDataType kAliHLTDataTypeEvent;
506 /** Configuration event data type */
507 extern const AliHLTComponentDataType kAliHLTDataTypeComConf;
509 /** DCS value update event */
510 extern const AliHLTComponentDataType kAliHLTDataTypeUpdtDCS;
512 /** RAW DDL data specification, origin is 'any', data publisher origin correctly */
513 extern const AliHLTComponentDataType kAliHLTDataTypeDDLRaw;
515 /** ESD object data specification, origin is 'any' */
516 extern const AliHLTComponentDataType kAliHLTDataTypeESDObject;
518 /** ESD Tree data specification, origin is 'any' */
519 extern const AliHLTComponentDataType kAliHLTDataTypeESDTree;
521 /** 16 bit Hardware address selection data specification, origin is 'any' */
522 extern const AliHLTComponentDataType kAliHLTDataTypeHwAddr16;
524 /** Event statistics */
525 extern const AliHLTComponentDataType kAliHLTDataTypeEventStatistics;
528 extern const AliHLTComponentDataType kAliHLTDataTypeEventSummary;
530 /** Event statistics */
531 extern const AliHLTComponentDataType kAliHLTDataTypeRunStatistics;
534 extern const AliHLTComponentDataType kAliHLTDataTypeRunSummary;
536 //////////////////////////////////////////////////////////////////////////
538 // Data Types for Monitoring objects
540 //////////////////////////////////////////////////////////////////////////
542 /** general ROOT TObject */
543 extern const AliHLTComponentDataType kAliHLTDataTypeTObject; // {ROOTTOBJ,"***"}
545 /** ROOT TObjArray */
546 extern const AliHLTComponentDataType kAliHLTDataTypeTObjArray; // {ROOTOBAR,"***"}
549 extern const AliHLTComponentDataType kAliHLTDataTypeTTree; // {ROOTTREE,"***"}
551 /** ROOT TH1 (can be used for all histograms, they derive from TH1) */
552 extern const AliHLTComponentDataType kAliHLTDataTypeHistogram; // {ROOTHIST,"***"}
555 extern const AliHLTComponentDataType kAliHLTDataTypeTNtuple; // {ROOTTUPL,"***"}
557 //////////////////////////////////////////////////////////////////////////
559 // FXS subscriber meta information
561 //////////////////////////////////////////////////////////////////////////
563 const int gkAliHLTFXSHeaderfOriginSize = 4;
564 const int gkAliHLTFXSHeaderfFileIDSize = 128;
565 const int gkAliHLTFXSHeaderfDDLNumberSize = 64;
567 /** Header in front of the data payload, in order to sent data to the FXS. */
568 struct AliHLTFXSHeader
570 AliHLTUInt32_t fHeaderVersion;
571 AliHLTUInt32_t fRunNumber;
572 char fOrigin[gkAliHLTFXSHeaderfOriginSize];
573 char fFileID[gkAliHLTFXSHeaderfFileIDSize];
574 char fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];
577 //////////////////////////////////////////////////////////////////////////
579 // Component running environment
581 //////////////////////////////////////////////////////////////////////////
583 /** logging function */
584 typedef int (*AliHLTfctLogging)( void* param,
585 AliHLTComponentLogSeverity severity,
588 const char* message);
591 * @struct AliHLTComponentEnvironment
592 * Running environment for analysis components.
593 * The struct describes function callbacks for
595 struct AliHLTComponentEnvironment
597 AliHLTUInt32_t fStructSize;
599 void* (*fAllocMemoryFunc)( void* param, unsigned long size );
601 // future addition already foreseen/envisioned
602 // IMPORTANT: don not just remove the defines as this breaks the binary
604 int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
606 int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
607 AliHLTfctLogging fLoggingFunc;
611 //////////////////////////////////////////////////////////////////////////
613 // Data type helper functions
615 //////////////////////////////////////////////////////////////////////////
617 inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
619 bool any1=true, any2=true, void1=true, void2=true, match=true;
620 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ ) {
621 any1&=(dt1.fOrigin[i]==kAliHLTDataOriginAny[i]);
622 any2&=(dt2.fOrigin[i]==kAliHLTDataOriginAny[i]);
623 void1&=(dt1.fOrigin[i]==kAliHLTDataOriginVoid[i]);
624 void2&=(dt2.fOrigin[i]==kAliHLTDataOriginVoid[i]);
625 match&=dt1.fOrigin[i]==dt2.fOrigin[i];
626 if (!(match || (any2 && !void1) || (any1 && !void2)))
630 any1=true, any2=true, match=true;
631 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ ) {
632 any1&=(dt1.fID[i]==kAliHLTAnyDataTypeID[i]);
633 any2&=(dt2.fID[i]==kAliHLTAnyDataTypeID[i]);
634 void1&=(dt1.fID[i]==kAliHLTVoidDataTypeID[i]);
635 void2&=(dt2.fID[i]==kAliHLTVoidDataTypeID[i]);
636 match&=dt1.fID[i]==dt2.fID[i];
637 if (!(match || (any2 && !void1) || (any1 && !void2)))
643 inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
648 inline bool MatchExactly( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
650 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
651 if ( dt1.fID[i] != dt2.fID[i] )
653 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
654 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
659 inline AliHLTComponentDataType operator|(const AliHLTComponentDataType srcdt, const char origin[kAliHLTComponentDataTypefOriginSize])
661 AliHLTComponentDataType dt=srcdt;
662 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
663 dt.fOrigin[i]=origin[i];