]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTDataTypes.h
Bug fix related to reconstruction of simulated data in raw format (E. Fragiacomo)
[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 */
124# define kAliHLTESDTreeDataTypeID {'E','S','D','_','T','R','E','E'}
125
1843b457 126using namespace std;
f23a6e1a 127
128extern "C" {
32db4144 129 //////////////////////////////////////////////////////////////////////////
130 //
131 // Basic HLT data types
132 //
133 //////////////////////////////////////////////////////////////////////////
f23a6e1a 134
135 typedef unsigned char AliHLTUInt8_t;
136
eda89fe6 137 typedef signed char AliHLTInt8_t;
138
71d7c760 139 typedef unsigned short AliHLTUInt16_t;
140
eda89fe6 141 typedef signed short AliHLTInt16_t;
142
f23a6e1a 143 typedef unsigned int AliHLTUInt32_t;
144
eda89fe6 145 typedef signed int AliHLTInt32_t;
146
f23a6e1a 147 typedef unsigned long long AliHLTUInt64_t;
148
eda89fe6 149 typedef signed long long AliHLTInt64_t;
150
151 typedef float AliHLTFloat32_t;
152
153 typedef double AliHLTFloat64_t;
154
f23a6e1a 155 typedef AliHLTUInt64_t AliHLTEventID_t;
156
32db4144 157 //////////////////////////////////////////////////////////////////////////
158 //
159 // HLT logging levels
160 //
161 //////////////////////////////////////////////////////////////////////////
f23a6e1a 162
32db4144 163 enum AliHLTComponentLogSeverity {
164 kHLTLogNone = 0,
165 kHLTLogBenchmark = 0x1,
166 kHLTLogDebug = 0x2,
167 kHLTLogInfo = 0x4,
168 kHLTLogWarning = 0x8,
169 kHLTLogError = 0x10,
170 kHLTLogFatal = 0x20,
171 kHLTLogAll = 0x3f,
172 kHLTLogDefault = 0x3d
173};
174
175 //////////////////////////////////////////////////////////////////////////
176 //
177 // HLT data structures for data exchange and external interface
178 //
179 //////////////////////////////////////////////////////////////////////////
180
181 /**
182 * @struct AliHLTComponentEventData
183 * Event descriptor
184 */
8ede8717 185 struct AliHLTComponentEventData
f23a6e1a 186 {
187 AliHLTUInt32_t fStructSize;
188 AliHLTEventID_t fEventID;
189 AliHLTUInt32_t fEventCreation_s;
190 AliHLTUInt32_t fEventCreation_us;
191 AliHLTUInt32_t fBlockCnt;
192 };
193
32db4144 194 /**
195 * @struct AliHLTComponentShmData
196 * Shared memory descriptor.
197 * Irrelevant for analysis components.
198 */
8ede8717 199 struct AliHLTComponentShmData
f23a6e1a 200 {
201 AliHLTUInt32_t fStructSize;
202 AliHLTUInt32_t fShmType;
203 AliHLTUInt64_t fShmID;
204 };
71d7c760 205
32db4144 206 /**
207 * @struct AliHLTComponentDataType
559631d5 208 * Data type descriptor for data blocks transferred through the processing
32db4144 209 * chain.
210 */
8ede8717 211 struct AliHLTComponentDataType
f23a6e1a 212 {
213 AliHLTUInt32_t fStructSize;
32db4144 214 char fID[kAliHLTComponentDataTypefIDsize]; //!
215 char fOrigin[kAliHLTComponentDataTypefOriginSize]; //!
f23a6e1a 216 };
2d7ff710 217
32db4144 218 /**
219 * @struct AliHLTComponentBlockData
3294f81a 220 * This is the decription of data blocks exchanged between components.
221 * \b IMPORTANT: The validity of fPtr and fOffset is different for input and
222 * output blocks:
223 * - input blocks: The \em fPtr member always points to the beginning of the data
224 * of size \em fSize. fOffset is ignored and should be in most
225 * case 0.
226 * - output blocks: The \em fPtr member is ignored by the framework. \em fOffset
227 * must specify the start of the data relative to the output
228 * buffer. The data block has size \em fSize.
32db4144 229 */
8ede8717 230 struct AliHLTComponentBlockData
f23a6e1a 231 {
3294f81a 232 /* size and version of the struct */
f23a6e1a 233 AliHLTUInt32_t fStructSize;
3294f81a 234 /* shared memory key, ignored by processing components */
8ede8717 235 AliHLTComponentShmData fShmKey;
3294f81a 236 /* offset of output data relative to the output buffer */
f23a6e1a 237 AliHLTUInt32_t fOffset;
3294f81a 238 /* start of the data for input data blocks, fOffset to be ignored*/
f23a6e1a 239 void* fPtr;
3294f81a 240 /* size of the data block */
f23a6e1a 241 AliHLTUInt32_t fSize;
3294f81a 242 /* data type of the data block */
8ede8717 243 AliHLTComponentDataType fDataType;
3294f81a 244 /* data specification of the data block */
f23a6e1a 245 AliHLTUInt32_t fSpecification;
246 };
247
32db4144 248 /**
249 * @struct AliHLTComponentEventDoneData
250 *
251 */
8ede8717 252 struct AliHLTComponentEventDoneData
f23a6e1a 253 {
254 AliHLTUInt32_t fStructSize;
255 AliHLTUInt32_t fDataSize;
256 void* fData;
257 };
258
32db4144 259 /**
2cbdb37e 260 * @struct AliHLTRunDesc
32db4144 261 * Event descriptor.
262 * The struct is send with the SOR and EOR events.
263 */
2cbdb37e 264 struct AliHLTRunDesc
32db4144 265 {
266 AliHLTUInt32_t fStructSize;
267 AliHLTUInt32_t fRunNo;
268 AliHLTUInt32_t fRunType;
269 };
270
8f81abf4 271 //////////////////////////////////////////////////////////////////////////
272 //
273 // Trigger meta information
274 //
275 //////////////////////////////////////////////////////////////////////////
276
277 /** field size of fAttribute */
278 static const int gkAliHLTBlockDAttributeCount = 8;
279
280 /** field size of fCommonHeader */
281 static const int gkAliHLTCommonHeaderCount = 8;
282
32db4144 283 /** size of the DDL list */
284 static const int gkAliHLTDDLListSize = 29;
285
286 /**
287 * @struct AliHLTEventDDL
288 * DDL list event.
289 * The struct is send with the DDLLIST event.
8f81abf4 290 * Used in the trigger structure for internal apperance of
291 * the DLLs as well as for the HLT readout list send to DAQ
511b2509 292 * ( as DataType : kAliHLTDataTypeDDL )
32db4144 293 */
294 struct AliHLTEventDDL
295 {
296 AliHLTUInt32_t fCount;
297 AliHLTUInt32_t fList[gkAliHLTDDLListSize];
298 };
299
8f81abf4 300 /**
301 * @struct AliHLTEventTriggerData
8f81abf4 302 */
303 struct AliHLTEventTriggerData
304 {
8f81abf4 305 AliHLTUInt8_t fAttributes[gkAliHLTBlockDAttributeCount];
511b2509 306 AliHLTUInt64_t fHLTStatus; // Bit field
8f81abf4 307 AliHLTUInt32_t fCommonHeaderWordCnt;
308 AliHLTUInt32_t fCommonHeader[gkAliHLTCommonHeaderCount];
8f81abf4 309 AliHLTEventDDL fReadoutList;
310 };
311
312 /**
313 * @struct AliHLTComponentTriggerData
314 * Trigger data
315 */
316 struct AliHLTComponentTriggerData
317 {
318 AliHLTUInt32_t fStructSize;
319 AliHLTUInt32_t fDataSize;
320 void* fData;
321 };
322
9d9ffd37 323 //////////////////////////////////////////////////////////////////////////
324 //
325 // HLT Event Type Specification
326 //
327 //////////////////////////////////////////////////////////////////////////
328
329 /** Unknown eventType specification */
330 static const AliHLTUInt32_t gkAliEventTypeUnknown = ~(AliHLTUInt32_t)0;
331 /** SOR eventType specification */
332 static const AliHLTUInt32_t gkAliEventTypeStartOfRun=1;
333 /** Data eventType specification */
334 static const AliHLTUInt32_t gkAliEventTypeData=2;
335 /** EOR eventType specification */
336 static const AliHLTUInt32_t gkAliEventTypeEndOfRun=4;
337 /** Corrupt eventType specification */
338 static const AliHLTUInt32_t gkAliEventTypeCorruptID=8;
339 /** Calibration eventType specification */
340 static const AliHLTUInt32_t gkAliEventTypeCalibration=16;
341 /** DataReplay eventType specification */
342 static const AliHLTUInt32_t gkAliEventTypeDataReplay=32;
343 /** Tick eventType specification */
344 static const AliHLTUInt32_t gkAliEventTypeTick=64;
345 /** Max eventType specification */
346 static const AliHLTUInt32_t gkAliEventTypeMax=64;
347
32db4144 348 //////////////////////////////////////////////////////////////////////////
349 //
350 // HLT defines and defaults
351 //
352 //////////////////////////////////////////////////////////////////////////
353
354 /** invalid event id */
355 const AliHLTEventID_t kAliHLTVoidEventID=~(AliHLTEventID_t)0;
356
357 /** invalid data specification */
358 const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
359
360 /** invalid shared memory type */
361 const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
362
363 /** invalid shared memory id */
364 const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
365
366 /** invalid data type */
367 const AliHLTComponentDataType kAliHLTVoidDataType = {
368 sizeof(AliHLTComponentDataType),
369 kAliHLTVoidDataTypeID,
3f850585 370 kAliHLTDataOriginVoid
32db4144 371 };
372
373 // there is currently a problem with rootcint if the predefined ids
374 // (commented below) are used. rootcint does not find the id if they
375 // are char arrays defined with {} and individual chars. If strings
376 // are used it works fine
377 /** any data type */
378 const AliHLTComponentDataType kAliHLTAnyDataType = {
379 sizeof(AliHLTComponentDataType),
380 kAliHLTAnyDataTypeID,
3f850585 381 kAliHLTDataOriginAny
32db4144 382 };
383
de6593d0 384 /** multiple output data types */
385 extern const AliHLTComponentDataType kAliHLTMultipleDataType;
386
32db4144 387 /** data to file exchange subscriber */
388 extern const AliHLTComponentDataType kAliHLTDataTypeFXSCalib;
389
390 /** DDL list data type */
391 extern const AliHLTComponentDataType kAliHLTDataTypeDDL;
392
393 /** SOR data type */
394 extern const AliHLTComponentDataType kAliHLTDataTypeSOR;
395
396 /** EOR data type */
397 extern const AliHLTComponentDataType kAliHLTDataTypeEOR;
5ec8e281 398
77405890 399 /** Event type specification */
400 extern const AliHLTComponentDataType kAliHLTDataTypeEvent;
401
c704e290 402 /** RAW DDL data specification, origin is 'any', data publisher origin correctly */
3f850585 403 extern const AliHLTComponentDataType kAliHLTDataTypeDDLRaw;
404
c704e290 405 /** ESD Tree data specification, origin is 'any' */
406 extern const AliHLTComponentDataType kAliHLTDataTypeESDTree;
407
32db4144 408 //////////////////////////////////////////////////////////////////////////
409 //
410 // FXS subscriber meta information
411 //
412 //////////////////////////////////////////////////////////////////////////
413
414 static const int gkAliHLTFXSHeaderfOriginSize = 4;
415 static const int gkAliHLTFXSHeaderfFileIDSize = 128;
416 static const int gkAliHLTFXSHeaderfDDLNumberSize = 64;
417
418 /** Header in front of the data payload, in order to sent data to the FXS. */
419 struct AliHLTFXSHeader
420 {
421 AliHLTUInt32_t fHeaderVersion;
422 AliHLTUInt32_t fRunNumber;
423 char fOrigin[gkAliHLTFXSHeaderfOriginSize];
424 char fFileID[gkAliHLTFXSHeaderfFileIDSize];
425 char fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];
426 };
427
428 //////////////////////////////////////////////////////////////////////////
429 //
430 // Component running environment
431 //
432 //////////////////////////////////////////////////////////////////////////
433
434 /** logging function */
435 typedef int (*AliHLTfctLogging)( void* param,
436 AliHLTComponentLogSeverity severity,
437 const char* origin,
438 const char* keyword,
439 const char* message);
440
441 /**
442 * @struct AliHLTComponentEnvironment
443 * Running environment for analysis components.
444 * The struct describes function callbacks for
445 */
f23a6e1a 446 struct AliHLTComponentEnvironment
447 {
448 AliHLTUInt32_t fStructSize;
449 void* fParam;
450 void* (*fAllocMemoryFunc)( void* param, unsigned long size );
451#if 0
32db4144 452 // future addition already foreseen/envisioned
453 // IMPORTANT: don not just remove the defines as this breaks the binary
454 // compatibility
455 int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
f23a6e1a 456#endif
8ede8717 457 int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
5ec8e281 458 AliHLTfctLogging fLoggingFunc;
f23a6e1a 459 };
460}
461
32db4144 462//////////////////////////////////////////////////////////////////////////
463//
464// Data type helper functions
465//
466//////////////////////////////////////////////////////////////////////////
467
8ede8717 468inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
71d7c760 469 {
21745ddc 470 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
71d7c760 471 if ( dt1.fID[i] != dt2.fID[i] )
472 return false;
21745ddc 473 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
71d7c760 474 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
475 return false;
476 return true;
477 }
478
8ede8717 479inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
71d7c760 480 {
21745ddc 481 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
71d7c760 482 if ( dt1.fID[i] != dt2.fID[i] )
483 return true;
21745ddc 484 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
71d7c760 485 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
486 return true;
487 return false;
488 }
489
69347e0d 490inline AliHLTComponentDataType operator|(const AliHLTComponentDataType srcdt, const char origin[kAliHLTComponentDataTypefOriginSize])
491 {
492 AliHLTComponentDataType dt=srcdt;
493 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
494 dt.fOrigin[i]=origin[i];
495 return dt;
496 }
32db4144 497
f23a6e1a 498#endif