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)
27 #define ALIHLT_DATA_TYPES_VERSION 2
29 //////////////////////////////////////////////////////////////////////////
31 // HLT data origin defines
33 //////////////////////////////////////////////////////////////////////////
35 /** field size of datat type origin */
36 const int kAliHLTComponentDataTypefOriginSize=4;
39 /** invalid data origin */
40 # define kAliHLTDataOriginVoid "\0\0\0"
41 /** old invalid data origin, kept for backward compatibility */
42 # define kAliHLTVoidDataOrigin "\0\0\0"
44 /** wildcard data type origin */
45 # define kAliHLTDataOriginAny "***"
46 /** old wildcard data type origin, kept for backward compatibility */
47 # define kAliHLTAnyDataOrigin "***"
50 # define kAliHLTDataOriginOut {'H','L','T',' '}
52 /** HLT/PubSub private internal */
53 # define kAliHLTDataOriginPrivate {'P','R','I','V'}
56 # define kAliHLTDataOriginTPC {'T','P','C',' '}
59 # define kAliHLTDataOriginPHOS {'P','H','O','S'}
62 # define kAliHLTDataOriginMUON {'M','U','O','N'}
65 # define kAliHLTDataOriginTRD {'T','R','D',' '}
68 # define kAliHLTDataOriginITS {'I','T','S',' '}
70 //////////////////////////////////////////////////////////////////////////
72 // HLT common data type defines
74 //////////////////////////////////////////////////////////////////////////
76 /** field size of data type id */
77 const int kAliHLTComponentDataTypefIDsize=8;
80 /** invalid data type id */
81 # define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
83 /** special id for any data type id */
84 # define kAliHLTAnyDataTypeID "*******"
87 # define kAliHLTDDLRawDataTypeID {'D','D','L','_','R','A','W',' '}
89 /** calibration data for file exchange subscriber */
90 # define kAliHLTFXSCalibDataTypeID {'F','X','S','_','C','A','L',' '}
92 /** start of run (SOR) event
95 # define kAliHLTSORDataTypeID {'S','T','A','R','T','O','F','R'}
97 /** end of run (EOR) event
100 # define kAliHLTEORDataTypeID {'E','N','D','O','F','R','U','N'}
103 * @ref AliHLTEventDDL
105 # define kAliHLTDDLDataTypeID {'D','D','L','L','I','S','T',' '}
108 * - empty payload, specification gives eventType
110 # define kAliHLTEventDataTypeID {'E','V','E','N','T','T','Y','P'}
115 //////////////////////////////////////////////////////////////////////////
117 // Basic HLT data types
119 //////////////////////////////////////////////////////////////////////////
121 typedef unsigned char AliHLTUInt8_t;
123 typedef unsigned short AliHLTUInt16_t;
125 typedef unsigned int AliHLTUInt32_t;
127 typedef unsigned long long AliHLTUInt64_t;
129 typedef AliHLTUInt64_t AliHLTEventID_t;
131 //////////////////////////////////////////////////////////////////////////
133 // HLT logging levels
135 //////////////////////////////////////////////////////////////////////////
137 enum AliHLTComponentLogSeverity {
139 kHLTLogBenchmark = 0x1,
142 kHLTLogWarning = 0x8,
146 kHLTLogDefault = 0x3d
149 //////////////////////////////////////////////////////////////////////////
151 // HLT data structures for data exchange and external interface
153 //////////////////////////////////////////////////////////////////////////
156 * @struct AliHLTComponentEventData
159 struct AliHLTComponentEventData
161 AliHLTUInt32_t fStructSize;
162 AliHLTEventID_t fEventID;
163 AliHLTUInt32_t fEventCreation_s;
164 AliHLTUInt32_t fEventCreation_us;
165 AliHLTUInt32_t fBlockCnt;
169 * @struct AliHLTComponentShmData
170 * Shared memory descriptor.
171 * Irrelevant for analysis components.
173 struct AliHLTComponentShmData
175 AliHLTUInt32_t fStructSize;
176 AliHLTUInt32_t fShmType;
177 AliHLTUInt64_t fShmID;
181 * @struct AliHLTComponentDataType
182 * Data type descriptor for data blocks transferred through the processing
185 struct AliHLTComponentDataType
187 AliHLTUInt32_t fStructSize;
188 char fID[kAliHLTComponentDataTypefIDsize]; //!
189 char fOrigin[kAliHLTComponentDataTypefOriginSize]; //!
193 * @struct AliHLTComponentBlockData
194 * This is the decription of data blocks exchanged between components.
195 * \b IMPORTANT: The validity of fPtr and fOffset is different for input and
197 * - input blocks: The \em fPtr member always points to the beginning of the data
198 * of size \em fSize. fOffset is ignored and should be in most
200 * - output blocks: The \em fPtr member is ignored by the framework. \em fOffset
201 * must specify the start of the data relative to the output
202 * buffer. The data block has size \em fSize.
204 struct AliHLTComponentBlockData
206 /* size and version of the struct */
207 AliHLTUInt32_t fStructSize;
208 /* shared memory key, ignored by processing components */
209 AliHLTComponentShmData fShmKey;
210 /* offset of output data relative to the output buffer */
211 AliHLTUInt32_t fOffset;
212 /* start of the data for input data blocks, fOffset to be ignored*/
214 /* size of the data block */
215 AliHLTUInt32_t fSize;
216 /* data type of the data block */
217 AliHLTComponentDataType fDataType;
218 /* data specification of the data block */
219 AliHLTUInt32_t fSpecification;
223 * @struct AliHLTComponentTriggerData
224 * Trigger data, not yet defined
226 struct AliHLTComponentTriggerData
228 AliHLTUInt32_t fStructSize;
229 AliHLTUInt32_t fDataSize;
234 * @struct AliHLTComponentEventDoneData
237 struct AliHLTComponentEventDoneData
239 AliHLTUInt32_t fStructSize;
240 AliHLTUInt32_t fDataSize;
245 * @struct AliHLTRunDesc
247 * The struct is send with the SOR and EOR events.
251 AliHLTUInt32_t fStructSize;
252 AliHLTUInt32_t fRunNo;
253 AliHLTUInt32_t fRunType;
256 /** size of the DDL list */
257 static const int gkAliHLTDDLListSize = 29;
260 * @struct AliHLTEventDDL
262 * The struct is send with the DDLLIST event.
264 struct AliHLTEventDDL
266 AliHLTUInt32_t fCount;
267 AliHLTUInt32_t fList[gkAliHLTDDLListSize];
270 //////////////////////////////////////////////////////////////////////////
272 // HLT Event Type Specification
274 //////////////////////////////////////////////////////////////////////////
276 /** Unknown eventType specification */
277 static const AliHLTUInt32_t gkAliEventTypeUnknown = ~(AliHLTUInt32_t)0;
278 /** SOR eventType specification */
279 static const AliHLTUInt32_t gkAliEventTypeStartOfRun=1;
280 /** Data eventType specification */
281 static const AliHLTUInt32_t gkAliEventTypeData=2;
282 /** EOR eventType specification */
283 static const AliHLTUInt32_t gkAliEventTypeEndOfRun=4;
284 /** Corrupt eventType specification */
285 static const AliHLTUInt32_t gkAliEventTypeCorruptID=8;
286 /** Calibration eventType specification */
287 static const AliHLTUInt32_t gkAliEventTypeCalibration=16;
288 /** DataReplay eventType specification */
289 static const AliHLTUInt32_t gkAliEventTypeDataReplay=32;
290 /** Tick eventType specification */
291 static const AliHLTUInt32_t gkAliEventTypeTick=64;
292 /** Max eventType specification */
293 static const AliHLTUInt32_t gkAliEventTypeMax=64;
295 //////////////////////////////////////////////////////////////////////////
297 // HLT defines and defaults
299 //////////////////////////////////////////////////////////////////////////
301 /** invalid event id */
302 const AliHLTEventID_t kAliHLTVoidEventID=~(AliHLTEventID_t)0;
304 /** invalid data specification */
305 const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
307 /** invalid shared memory type */
308 const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
310 /** invalid shared memory id */
311 const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
313 /** invalid data type */
314 const AliHLTComponentDataType kAliHLTVoidDataType = {
315 sizeof(AliHLTComponentDataType),
316 kAliHLTVoidDataTypeID,
317 kAliHLTDataOriginVoid
320 // there is currently a problem with rootcint if the predefined ids
321 // (commented below) are used. rootcint does not find the id if they
322 // are char arrays defined with {} and individual chars. If strings
323 // are used it works fine
325 const AliHLTComponentDataType kAliHLTAnyDataType = {
326 sizeof(AliHLTComponentDataType),
327 kAliHLTAnyDataTypeID,
331 /** multiple output data types */
332 extern const AliHLTComponentDataType kAliHLTMultipleDataType;
334 /** data to file exchange subscriber */
335 extern const AliHLTComponentDataType kAliHLTDataTypeFXSCalib;
337 /** DDL list data type */
338 extern const AliHLTComponentDataType kAliHLTDataTypeDDL;
341 extern const AliHLTComponentDataType kAliHLTDataTypeSOR;
344 extern const AliHLTComponentDataType kAliHLTDataTypeEOR;
346 /** Event type specification */
347 extern const AliHLTComponentDataType kAliHLTDataTypeEvent;
349 /** RAW DDL data specification, data publisher will set type id and origin correctly */
350 extern const AliHLTComponentDataType kAliHLTDataTypeDDLRaw;
352 //////////////////////////////////////////////////////////////////////////
354 // FXS subscriber meta information
356 //////////////////////////////////////////////////////////////////////////
358 static const int gkAliHLTFXSHeaderfOriginSize = 4;
359 static const int gkAliHLTFXSHeaderfFileIDSize = 128;
360 static const int gkAliHLTFXSHeaderfDDLNumberSize = 64;
362 /** Header in front of the data payload, in order to sent data to the FXS. */
363 struct AliHLTFXSHeader
365 AliHLTUInt32_t fHeaderVersion;
366 AliHLTUInt32_t fRunNumber;
367 char fOrigin[gkAliHLTFXSHeaderfOriginSize];
368 char fFileID[gkAliHLTFXSHeaderfFileIDSize];
369 char fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];
372 //////////////////////////////////////////////////////////////////////////
374 // Component running environment
376 //////////////////////////////////////////////////////////////////////////
378 /** logging function */
379 typedef int (*AliHLTfctLogging)( void* param,
380 AliHLTComponentLogSeverity severity,
383 const char* message);
386 * @struct AliHLTComponentEnvironment
387 * Running environment for analysis components.
388 * The struct describes function callbacks for
390 struct AliHLTComponentEnvironment
392 AliHLTUInt32_t fStructSize;
394 void* (*fAllocMemoryFunc)( void* param, unsigned long size );
396 // future addition already foreseen/envisioned
397 // IMPORTANT: don not just remove the defines as this breaks the binary
399 int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
401 int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
402 AliHLTfctLogging fLoggingFunc;
406 //////////////////////////////////////////////////////////////////////////
408 // Data type helper functions
410 //////////////////////////////////////////////////////////////////////////
412 inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
414 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
415 if ( dt1.fID[i] != dt2.fID[i] )
417 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
418 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
423 inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
425 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
426 if ( dt1.fID[i] != dt2.fID[i] )
428 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
429 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )