]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTDataTypes.h
- added general data type for ESD objects
[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
2cbdb37e 29 */
d934f004 30#define ALIHLT_DATA_TYPES_VERSION 3
2cbdb37e 31
32db4144 32//////////////////////////////////////////////////////////////////////////
33//
69347e0d 34// HLT data origin variables.
35//
36// By converting from defines to variables, the origins can be used with
37// the operator|
38//
39// AliHLTComponentDataType dt;
40// dt = kAliHLTDataTypeDDLRaw | gkAliHLTDataOriginTPC;
32db4144 41//
42//////////////////////////////////////////////////////////////////////////
43
44/** field size of datat type origin */
45const int kAliHLTComponentDataTypefOriginSize=4;
46
47
48/** invalid data origin */
3f850585 49# define kAliHLTDataOriginVoid "\0\0\0"
50/** old invalid data origin, kept for backward compatibility */
32db4144 51# define kAliHLTVoidDataOrigin "\0\0\0"
52
3f850585 53/** wildcard data type origin */
54# define kAliHLTDataOriginAny "***"
55/** old wildcard data type origin, kept for backward compatibility */
32db4144 56# define kAliHLTAnyDataOrigin "***"
57
58/** HLT out */
69347e0d 59extern const char kAliHLTDataOriginOut[kAliHLTComponentDataTypefOriginSize];
32db4144 60
61/** HLT/PubSub private internal */
69347e0d 62extern const char kAliHLTDataOriginPrivate[kAliHLTComponentDataTypefOriginSize];
32db4144 63
64/** TPC */
69347e0d 65extern const char kAliHLTDataOriginTPC[kAliHLTComponentDataTypefOriginSize];
32db4144 66
67/** PHOS */
69347e0d 68extern const char kAliHLTDataOriginPHOS[kAliHLTComponentDataTypefOriginSize];
32db4144 69
70/** MUON */
69347e0d 71extern const char kAliHLTDataOriginMUON[kAliHLTComponentDataTypefOriginSize];
32db4144 72
73/** TRD */
69347e0d 74extern const char kAliHLTDataOriginTRD[kAliHLTComponentDataTypefOriginSize];
32db4144 75
76/** ITS */
69347e0d 77extern const char kAliHLTDataOriginITS[kAliHLTComponentDataTypefOriginSize];
32db4144 78
79//////////////////////////////////////////////////////////////////////////
80//
81// HLT common data type defines
82//
83//////////////////////////////////////////////////////////////////////////
84
85/** field size of data type id */
86const int kAliHLTComponentDataTypefIDsize=8;
87
88
89/** invalid data type id */
90# define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
91
92/** special id for any data type id */
93# define kAliHLTAnyDataTypeID "*******"
94
3f850585 95/** DDL RAW data */
96# define kAliHLTDDLRawDataTypeID {'D','D','L','_','R','A','W',' '}
97
32db4144 98/** calibration data for file exchange subscriber */
99# define kAliHLTFXSCalibDataTypeID {'F','X','S','_','C','A','L',' '}
100
101/** start of run (SOR) event
2cbdb37e 102 * @ref AliHLTRunDesc
32db4144 103 */
104# define kAliHLTSORDataTypeID {'S','T','A','R','T','O','F','R'}
105
106/** end of run (EOR) event
2cbdb37e 107 * @ref AliHLTRunDesc
32db4144 108 */
109# define kAliHLTEORDataTypeID {'E','N','D','O','F','R','U','N'}
110
111/** DDL list event
112 * @ref AliHLTEventDDL
113 */
114# define kAliHLTDDLDataTypeID {'D','D','L','L','I','S','T',' '}
115
9d9ffd37 116/** EventType event
117 * - empty payload, specification gives eventType
118 */
119# define kAliHLTEventDataTypeID {'E','V','E','N','T','T','Y','P'}
120
c704e290 121/** ESD data block
122 * an AliESD object of varying origin
123 */
a978c0d5 124# define kAliHLTESDObjectDataTypeID {'A','L','I','E','S','D','V','0'}
c704e290 125
a978c0d5 126/** ESD tree data block
127 * TTree with an AliESD object of varying origin
128 */
129# define kAliHLTESDTreeDataTypeID {'E','S','D','_','T','R','E','E'}
64defa03 130
131/** HW Address selection data block
132 * - a selection list for 16 bit HW addresses
133 * - varying origin
134 */
135# define kAliHLTHwAddr16DataTypeID {'H','W','A','D','D','R','1','6'}
136
1843b457 137using namespace std;
f23a6e1a 138
139extern "C" {
32db4144 140 //////////////////////////////////////////////////////////////////////////
141 //
142 // Basic HLT data types
143 //
144 //////////////////////////////////////////////////////////////////////////
f23a6e1a 145
146 typedef unsigned char AliHLTUInt8_t;
147
eda89fe6 148 typedef signed char AliHLTInt8_t;
149
71d7c760 150 typedef unsigned short AliHLTUInt16_t;
151
eda89fe6 152 typedef signed short AliHLTInt16_t;
153
f23a6e1a 154 typedef unsigned int AliHLTUInt32_t;
155
eda89fe6 156 typedef signed int AliHLTInt32_t;
157
f23a6e1a 158 typedef unsigned long long AliHLTUInt64_t;
159
eda89fe6 160 typedef signed long long AliHLTInt64_t;
161
162 typedef float AliHLTFloat32_t;
163
164 typedef double AliHLTFloat64_t;
165
f23a6e1a 166 typedef AliHLTUInt64_t AliHLTEventID_t;
167
32db4144 168 //////////////////////////////////////////////////////////////////////////
169 //
170 // HLT logging levels
171 //
172 //////////////////////////////////////////////////////////////////////////
f23a6e1a 173
32db4144 174 enum AliHLTComponentLogSeverity {
175 kHLTLogNone = 0,
176 kHLTLogBenchmark = 0x1,
177 kHLTLogDebug = 0x2,
178 kHLTLogInfo = 0x4,
179 kHLTLogWarning = 0x8,
180 kHLTLogError = 0x10,
181 kHLTLogFatal = 0x20,
182 kHLTLogAll = 0x3f,
183 kHLTLogDefault = 0x3d
184};
185
186 //////////////////////////////////////////////////////////////////////////
187 //
188 // HLT data structures for data exchange and external interface
189 //
190 //////////////////////////////////////////////////////////////////////////
191
192 /**
193 * @struct AliHLTComponentEventData
194 * Event descriptor
195 */
8ede8717 196 struct AliHLTComponentEventData
f23a6e1a 197 {
198 AliHLTUInt32_t fStructSize;
199 AliHLTEventID_t fEventID;
200 AliHLTUInt32_t fEventCreation_s;
201 AliHLTUInt32_t fEventCreation_us;
202 AliHLTUInt32_t fBlockCnt;
203 };
204
32db4144 205 /**
206 * @struct AliHLTComponentShmData
207 * Shared memory descriptor.
208 * Irrelevant for analysis components.
209 */
8ede8717 210 struct AliHLTComponentShmData
f23a6e1a 211 {
212 AliHLTUInt32_t fStructSize;
213 AliHLTUInt32_t fShmType;
214 AliHLTUInt64_t fShmID;
215 };
71d7c760 216
32db4144 217 /**
218 * @struct AliHLTComponentDataType
559631d5 219 * Data type descriptor for data blocks transferred through the processing
32db4144 220 * chain.
221 */
8ede8717 222 struct AliHLTComponentDataType
f23a6e1a 223 {
224 AliHLTUInt32_t fStructSize;
32db4144 225 char fID[kAliHLTComponentDataTypefIDsize]; //!
226 char fOrigin[kAliHLTComponentDataTypefOriginSize]; //!
f23a6e1a 227 };
2d7ff710 228
32db4144 229 /**
230 * @struct AliHLTComponentBlockData
3294f81a 231 * This is the decription of data blocks exchanged between components.
232 * \b IMPORTANT: The validity of fPtr and fOffset is different for input and
233 * output blocks:
234 * - input blocks: The \em fPtr member always points to the beginning of the data
235 * of size \em fSize. fOffset is ignored and should be in most
236 * case 0.
237 * - output blocks: The \em fPtr member is ignored by the framework. \em fOffset
238 * must specify the start of the data relative to the output
239 * buffer. The data block has size \em fSize.
32db4144 240 */
8ede8717 241 struct AliHLTComponentBlockData
f23a6e1a 242 {
3294f81a 243 /* size and version of the struct */
f23a6e1a 244 AliHLTUInt32_t fStructSize;
3294f81a 245 /* shared memory key, ignored by processing components */
8ede8717 246 AliHLTComponentShmData fShmKey;
3294f81a 247 /* offset of output data relative to the output buffer */
f23a6e1a 248 AliHLTUInt32_t fOffset;
3294f81a 249 /* start of the data for input data blocks, fOffset to be ignored*/
f23a6e1a 250 void* fPtr;
3294f81a 251 /* size of the data block */
f23a6e1a 252 AliHLTUInt32_t fSize;
3294f81a 253 /* data type of the data block */
8ede8717 254 AliHLTComponentDataType fDataType;
3294f81a 255 /* data specification of the data block */
f23a6e1a 256 AliHLTUInt32_t fSpecification;
257 };
258
32db4144 259 /**
260 * @struct AliHLTComponentEventDoneData
261 *
262 */
8ede8717 263 struct AliHLTComponentEventDoneData
f23a6e1a 264 {
265 AliHLTUInt32_t fStructSize;
266 AliHLTUInt32_t fDataSize;
267 void* fData;
268 };
269
32db4144 270 /**
2cbdb37e 271 * @struct AliHLTRunDesc
32db4144 272 * Event descriptor.
273 * The struct is send with the SOR and EOR events.
274 */
2cbdb37e 275 struct AliHLTRunDesc
32db4144 276 {
277 AliHLTUInt32_t fStructSize;
278 AliHLTUInt32_t fRunNo;
279 AliHLTUInt32_t fRunType;
280 };
281
8f81abf4 282 //////////////////////////////////////////////////////////////////////////
283 //
284 // Trigger meta information
285 //
286 //////////////////////////////////////////////////////////////////////////
287
288 /** field size of fAttribute */
289 static const int gkAliHLTBlockDAttributeCount = 8;
290
291 /** field size of fCommonHeader */
292 static const int gkAliHLTCommonHeaderCount = 8;
293
32db4144 294 /** size of the DDL list */
295 static const int gkAliHLTDDLListSize = 29;
296
297 /**
298 * @struct AliHLTEventDDL
299 * DDL list event.
300 * The struct is send with the DDLLIST event.
8f81abf4 301 * Used in the trigger structure for internal apperance of
302 * the DLLs as well as for the HLT readout list send to DAQ
511b2509 303 * ( as DataType : kAliHLTDataTypeDDL )
32db4144 304 */
305 struct AliHLTEventDDL
306 {
307 AliHLTUInt32_t fCount;
308 AliHLTUInt32_t fList[gkAliHLTDDLListSize];
309 };
310
8f81abf4 311 /**
312 * @struct AliHLTEventTriggerData
8f81abf4 313 */
314 struct AliHLTEventTriggerData
315 {
8f81abf4 316 AliHLTUInt8_t fAttributes[gkAliHLTBlockDAttributeCount];
511b2509 317 AliHLTUInt64_t fHLTStatus; // Bit field
8f81abf4 318 AliHLTUInt32_t fCommonHeaderWordCnt;
319 AliHLTUInt32_t fCommonHeader[gkAliHLTCommonHeaderCount];
8f81abf4 320 AliHLTEventDDL fReadoutList;
321 };
322
323 /**
324 * @struct AliHLTComponentTriggerData
325 * Trigger data
326 */
327 struct AliHLTComponentTriggerData
328 {
329 AliHLTUInt32_t fStructSize;
330 AliHLTUInt32_t fDataSize;
331 void* fData;
332 };
333
9d9ffd37 334 //////////////////////////////////////////////////////////////////////////
335 //
336 // HLT Event Type Specification
337 //
338 //////////////////////////////////////////////////////////////////////////
339
340 /** Unknown eventType specification */
341 static const AliHLTUInt32_t gkAliEventTypeUnknown = ~(AliHLTUInt32_t)0;
342 /** SOR eventType specification */
343 static const AliHLTUInt32_t gkAliEventTypeStartOfRun=1;
344 /** Data eventType specification */
345 static const AliHLTUInt32_t gkAliEventTypeData=2;
346 /** EOR eventType specification */
347 static const AliHLTUInt32_t gkAliEventTypeEndOfRun=4;
348 /** Corrupt eventType specification */
349 static const AliHLTUInt32_t gkAliEventTypeCorruptID=8;
350 /** Calibration eventType specification */
351 static const AliHLTUInt32_t gkAliEventTypeCalibration=16;
352 /** DataReplay eventType specification */
353 static const AliHLTUInt32_t gkAliEventTypeDataReplay=32;
354 /** Tick eventType specification */
355 static const AliHLTUInt32_t gkAliEventTypeTick=64;
356 /** Max eventType specification */
357 static const AliHLTUInt32_t gkAliEventTypeMax=64;
358
32db4144 359 //////////////////////////////////////////////////////////////////////////
360 //
361 // HLT defines and defaults
362 //
363 //////////////////////////////////////////////////////////////////////////
364
365 /** invalid event id */
366 const AliHLTEventID_t kAliHLTVoidEventID=~(AliHLTEventID_t)0;
367
368 /** invalid data specification */
369 const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
370
371 /** invalid shared memory type */
372 const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
373
374 /** invalid shared memory id */
375 const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
376
377 /** invalid data type */
378 const AliHLTComponentDataType kAliHLTVoidDataType = {
379 sizeof(AliHLTComponentDataType),
380 kAliHLTVoidDataTypeID,
3f850585 381 kAliHLTDataOriginVoid
32db4144 382 };
383
384 // there is currently a problem with rootcint if the predefined ids
385 // (commented below) are used. rootcint does not find the id if they
386 // are char arrays defined with {} and individual chars. If strings
387 // are used it works fine
388 /** any data type */
389 const AliHLTComponentDataType kAliHLTAnyDataType = {
390 sizeof(AliHLTComponentDataType),
391 kAliHLTAnyDataTypeID,
3f850585 392 kAliHLTDataOriginAny
32db4144 393 };
394
de6593d0 395 /** multiple output data types */
396 extern const AliHLTComponentDataType kAliHLTMultipleDataType;
397
32db4144 398 /** data to file exchange subscriber */
399 extern const AliHLTComponentDataType kAliHLTDataTypeFXSCalib;
400
401 /** DDL list data type */
402 extern const AliHLTComponentDataType kAliHLTDataTypeDDL;
403
404 /** SOR data type */
405 extern const AliHLTComponentDataType kAliHLTDataTypeSOR;
406
407 /** EOR data type */
408 extern const AliHLTComponentDataType kAliHLTDataTypeEOR;
5ec8e281 409
77405890 410 /** Event type specification */
411 extern const AliHLTComponentDataType kAliHLTDataTypeEvent;
412
c704e290 413 /** RAW DDL data specification, origin is 'any', data publisher origin correctly */
3f850585 414 extern const AliHLTComponentDataType kAliHLTDataTypeDDLRaw;
415
a978c0d5 416 /** ESD object data specification, origin is 'any' */
417 extern const AliHLTComponentDataType kAliHLTDataTypeESDObject;
418
c704e290 419 /** ESD Tree data specification, origin is 'any' */
420 extern const AliHLTComponentDataType kAliHLTDataTypeESDTree;
421
64defa03 422 /** 16 bit Hardware address selection data specification, origin is 'any' */
423 extern const AliHLTComponentDataType kAliHLTDataTypeHwAddr16;
424
32db4144 425 //////////////////////////////////////////////////////////////////////////
426 //
427 // FXS subscriber meta information
428 //
429 //////////////////////////////////////////////////////////////////////////
430
431 static const int gkAliHLTFXSHeaderfOriginSize = 4;
432 static const int gkAliHLTFXSHeaderfFileIDSize = 128;
433 static const int gkAliHLTFXSHeaderfDDLNumberSize = 64;
434
435 /** Header in front of the data payload, in order to sent data to the FXS. */
436 struct AliHLTFXSHeader
437 {
438 AliHLTUInt32_t fHeaderVersion;
439 AliHLTUInt32_t fRunNumber;
440 char fOrigin[gkAliHLTFXSHeaderfOriginSize];
441 char fFileID[gkAliHLTFXSHeaderfFileIDSize];
442 char fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];
443 };
444
445 //////////////////////////////////////////////////////////////////////////
446 //
447 // Component running environment
448 //
449 //////////////////////////////////////////////////////////////////////////
450
451 /** logging function */
452 typedef int (*AliHLTfctLogging)( void* param,
453 AliHLTComponentLogSeverity severity,
454 const char* origin,
455 const char* keyword,
456 const char* message);
457
458 /**
459 * @struct AliHLTComponentEnvironment
460 * Running environment for analysis components.
461 * The struct describes function callbacks for
462 */
f23a6e1a 463 struct AliHLTComponentEnvironment
464 {
465 AliHLTUInt32_t fStructSize;
466 void* fParam;
467 void* (*fAllocMemoryFunc)( void* param, unsigned long size );
468#if 0
32db4144 469 // future addition already foreseen/envisioned
470 // IMPORTANT: don not just remove the defines as this breaks the binary
471 // compatibility
472 int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
f23a6e1a 473#endif
8ede8717 474 int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
5ec8e281 475 AliHLTfctLogging fLoggingFunc;
f23a6e1a 476 };
477}
478
32db4144 479//////////////////////////////////////////////////////////////////////////
480//
481// Data type helper functions
482//
483//////////////////////////////////////////////////////////////////////////
484
8ede8717 485inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
71d7c760 486 {
21745ddc 487 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
71d7c760 488 if ( dt1.fID[i] != dt2.fID[i] )
489 return false;
21745ddc 490 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
71d7c760 491 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
492 return false;
493 return true;
494 }
495
8ede8717 496inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
71d7c760 497 {
21745ddc 498 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
71d7c760 499 if ( dt1.fID[i] != dt2.fID[i] )
500 return true;
21745ddc 501 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
71d7c760 502 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
503 return true;
504 return false;
505 }
506
69347e0d 507inline AliHLTComponentDataType operator|(const AliHLTComponentDataType srcdt, const char origin[kAliHLTComponentDataTypefOriginSize])
508 {
509 AliHLTComponentDataType dt=srcdt;
510 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
511 dt.fOrigin[i]=origin[i];
512 return dt;
513 }
32db4144 514
f23a6e1a 515#endif