Moving AliMillepede from MUON to libSTEER
[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
24 */
25#define ALIHLT_DATA_TYPES_VERSION 2
26
32db4144 27//////////////////////////////////////////////////////////////////////////
28//
29// HLT data origin defines
30//
31//////////////////////////////////////////////////////////////////////////
32
33/** field size of datat type origin */
34const int kAliHLTComponentDataTypefOriginSize=4;
35
36
37/** invalid data origin */
38# define kAliHLTVoidDataOrigin "\0\0\0"
39
40/** special id for any data type origin */
41# define kAliHLTAnyDataOrigin "***"
42
43/** HLT out */
44# define kAliHLTDataOriginOut {'H','L','T',' '}
45
46/** HLT/PubSub private internal */
47# define kAliHLTDataOriginPrivate {'P','R','I','V'}
48
49/** TPC */
50# define kAliHLTDataOriginTPC {'T','P','C',' '}
51
52/** PHOS */
53# define kAliHLTDataOriginPHOS {'P','H','O','S'}
54
55/** MUON */
56# define kAliHLTDataOriginMUON {'M','U','O','N'}
57
58/** TRD */
59# define kAliHLTDataOriginTRD {'T','R','D',' '}
60
61/** ITS */
62# define kAliHLTDataOriginITS {'I','T','S',' '}
63
64//////////////////////////////////////////////////////////////////////////
65//
66// HLT common data type defines
67//
68//////////////////////////////////////////////////////////////////////////
69
70/** field size of data type id */
71const int kAliHLTComponentDataTypefIDsize=8;
72
73
74/** invalid data type id */
75# define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
76
77/** special id for any data type id */
78# define kAliHLTAnyDataTypeID "*******"
79
80/** calibration data for file exchange subscriber */
81# define kAliHLTFXSCalibDataTypeID {'F','X','S','_','C','A','L',' '}
82
83/** start of run (SOR) event
2cbdb37e 84 * @ref AliHLTRunDesc
32db4144 85 */
86# define kAliHLTSORDataTypeID {'S','T','A','R','T','O','F','R'}
87
88/** end of run (EOR) event
2cbdb37e 89 * @ref AliHLTRunDesc
32db4144 90 */
91# define kAliHLTEORDataTypeID {'E','N','D','O','F','R','U','N'}
92
93/** DDL list event
94 * @ref AliHLTEventDDL
95 */
96# define kAliHLTDDLDataTypeID {'D','D','L','L','I','S','T',' '}
97
9d9ffd37 98/** EventType event
99 * - empty payload, specification gives eventType
100 */
101# define kAliHLTEventDataTypeID {'E','V','E','N','T','T','Y','P'}
102
1843b457 103using namespace std;
f23a6e1a 104
105extern "C" {
32db4144 106 //////////////////////////////////////////////////////////////////////////
107 //
108 // Basic HLT data types
109 //
110 //////////////////////////////////////////////////////////////////////////
f23a6e1a 111
112 typedef unsigned char AliHLTUInt8_t;
113
71d7c760 114 typedef unsigned short AliHLTUInt16_t;
115
f23a6e1a 116 typedef unsigned int AliHLTUInt32_t;
117
118 typedef unsigned long long AliHLTUInt64_t;
119
120 typedef AliHLTUInt64_t AliHLTEventID_t;
121
32db4144 122 //////////////////////////////////////////////////////////////////////////
123 //
124 // HLT logging levels
125 //
126 //////////////////////////////////////////////////////////////////////////
f23a6e1a 127
32db4144 128 enum AliHLTComponentLogSeverity {
129 kHLTLogNone = 0,
130 kHLTLogBenchmark = 0x1,
131 kHLTLogDebug = 0x2,
132 kHLTLogInfo = 0x4,
133 kHLTLogWarning = 0x8,
134 kHLTLogError = 0x10,
135 kHLTLogFatal = 0x20,
136 kHLTLogAll = 0x3f,
137 kHLTLogDefault = 0x3d
138};
139
140 //////////////////////////////////////////////////////////////////////////
141 //
142 // HLT data structures for data exchange and external interface
143 //
144 //////////////////////////////////////////////////////////////////////////
145
146 /**
147 * @struct AliHLTComponentEventData
148 * Event descriptor
149 */
8ede8717 150 struct AliHLTComponentEventData
f23a6e1a 151 {
152 AliHLTUInt32_t fStructSize;
153 AliHLTEventID_t fEventID;
154 AliHLTUInt32_t fEventCreation_s;
155 AliHLTUInt32_t fEventCreation_us;
156 AliHLTUInt32_t fBlockCnt;
157 };
158
32db4144 159 /**
160 * @struct AliHLTComponentShmData
161 * Shared memory descriptor.
162 * Irrelevant for analysis components.
163 */
8ede8717 164 struct AliHLTComponentShmData
f23a6e1a 165 {
166 AliHLTUInt32_t fStructSize;
167 AliHLTUInt32_t fShmType;
168 AliHLTUInt64_t fShmID;
169 };
71d7c760 170
32db4144 171 /**
172 * @struct AliHLTComponentDataType
559631d5 173 * Data type descriptor for data blocks transferred through the processing
32db4144 174 * chain.
175 */
8ede8717 176 struct AliHLTComponentDataType
f23a6e1a 177 {
178 AliHLTUInt32_t fStructSize;
32db4144 179 char fID[kAliHLTComponentDataTypefIDsize]; //!
180 char fOrigin[kAliHLTComponentDataTypefOriginSize]; //!
f23a6e1a 181 };
2d7ff710 182
32db4144 183 /**
184 * @struct AliHLTComponentBlockData
185 * Descriptor for data blocks.
186 */
8ede8717 187 struct AliHLTComponentBlockData
f23a6e1a 188 {
189 AliHLTUInt32_t fStructSize;
8ede8717 190 AliHLTComponentShmData fShmKey;
f23a6e1a 191 AliHLTUInt32_t fOffset;
192 void* fPtr;
193 AliHLTUInt32_t fSize;
8ede8717 194 AliHLTComponentDataType fDataType;
f23a6e1a 195 AliHLTUInt32_t fSpecification;
196 };
197
32db4144 198 /**
199 * @struct AliHLTComponentTriggerData
200 * Trigger data, not yet defined
201 */
8ede8717 202 struct AliHLTComponentTriggerData
f23a6e1a 203 {
204 AliHLTUInt32_t fStructSize;
205 AliHLTUInt32_t fDataSize;
206 void* fData;
207 };
32db4144 208
209 /**
210 * @struct AliHLTComponentEventDoneData
211 *
212 */
8ede8717 213 struct AliHLTComponentEventDoneData
f23a6e1a 214 {
215 AliHLTUInt32_t fStructSize;
216 AliHLTUInt32_t fDataSize;
217 void* fData;
218 };
219
32db4144 220 /**
2cbdb37e 221 * @struct AliHLTRunDesc
32db4144 222 * Event descriptor.
223 * The struct is send with the SOR and EOR events.
224 */
2cbdb37e 225 struct AliHLTRunDesc
32db4144 226 {
227 AliHLTUInt32_t fStructSize;
228 AliHLTUInt32_t fRunNo;
229 AliHLTUInt32_t fRunType;
230 };
231
232 /** size of the DDL list */
233 static const int gkAliHLTDDLListSize = 29;
234
235 /**
236 * @struct AliHLTEventDDL
237 * DDL list event.
238 * The struct is send with the DDLLIST event.
239 */
240 struct AliHLTEventDDL
241 {
242 AliHLTUInt32_t fCount;
243 AliHLTUInt32_t fList[gkAliHLTDDLListSize];
244 };
245
9d9ffd37 246 //////////////////////////////////////////////////////////////////////////
247 //
248 // HLT Event Type Specification
249 //
250 //////////////////////////////////////////////////////////////////////////
251
252 /** Unknown eventType specification */
253 static const AliHLTUInt32_t gkAliEventTypeUnknown = ~(AliHLTUInt32_t)0;
254 /** SOR eventType specification */
255 static const AliHLTUInt32_t gkAliEventTypeStartOfRun=1;
256 /** Data eventType specification */
257 static const AliHLTUInt32_t gkAliEventTypeData=2;
258 /** EOR eventType specification */
259 static const AliHLTUInt32_t gkAliEventTypeEndOfRun=4;
260 /** Corrupt eventType specification */
261 static const AliHLTUInt32_t gkAliEventTypeCorruptID=8;
262 /** Calibration eventType specification */
263 static const AliHLTUInt32_t gkAliEventTypeCalibration=16;
264 /** DataReplay eventType specification */
265 static const AliHLTUInt32_t gkAliEventTypeDataReplay=32;
266 /** Tick eventType specification */
267 static const AliHLTUInt32_t gkAliEventTypeTick=64;
268 /** Max eventType specification */
269 static const AliHLTUInt32_t gkAliEventTypeMax=64;
270
32db4144 271 //////////////////////////////////////////////////////////////////////////
272 //
273 // HLT defines and defaults
274 //
275 //////////////////////////////////////////////////////////////////////////
276
277 /** invalid event id */
278 const AliHLTEventID_t kAliHLTVoidEventID=~(AliHLTEventID_t)0;
279
280 /** invalid data specification */
281 const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
282
283 /** invalid shared memory type */
284 const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
285
286 /** invalid shared memory id */
287 const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
288
289 /** invalid data type */
290 const AliHLTComponentDataType kAliHLTVoidDataType = {
291 sizeof(AliHLTComponentDataType),
292 kAliHLTVoidDataTypeID,
293 kAliHLTVoidDataOrigin
294 };
295
296 // there is currently a problem with rootcint if the predefined ids
297 // (commented below) are used. rootcint does not find the id if they
298 // are char arrays defined with {} and individual chars. If strings
299 // are used it works fine
300 /** any data type */
301 const AliHLTComponentDataType kAliHLTAnyDataType = {
302 sizeof(AliHLTComponentDataType),
303 kAliHLTAnyDataTypeID,
304 kAliHLTAnyDataOrigin
305 };
306
de6593d0 307 /** multiple output data types */
308 extern const AliHLTComponentDataType kAliHLTMultipleDataType;
309
32db4144 310 /** data to file exchange subscriber */
311 extern const AliHLTComponentDataType kAliHLTDataTypeFXSCalib;
312
313 /** DDL list data type */
314 extern const AliHLTComponentDataType kAliHLTDataTypeDDL;
315
316 /** SOR data type */
317 extern const AliHLTComponentDataType kAliHLTDataTypeSOR;
318
319 /** EOR data type */
320 extern const AliHLTComponentDataType kAliHLTDataTypeEOR;
5ec8e281 321
77405890 322 /** Event type specification */
323 extern const AliHLTComponentDataType kAliHLTDataTypeEvent;
324
32db4144 325 //////////////////////////////////////////////////////////////////////////
326 //
327 // FXS subscriber meta information
328 //
329 //////////////////////////////////////////////////////////////////////////
330
331 static const int gkAliHLTFXSHeaderfOriginSize = 4;
332 static const int gkAliHLTFXSHeaderfFileIDSize = 128;
333 static const int gkAliHLTFXSHeaderfDDLNumberSize = 64;
334
335 /** Header in front of the data payload, in order to sent data to the FXS. */
336 struct AliHLTFXSHeader
337 {
338 AliHLTUInt32_t fHeaderVersion;
339 AliHLTUInt32_t fRunNumber;
340 char fOrigin[gkAliHLTFXSHeaderfOriginSize];
341 char fFileID[gkAliHLTFXSHeaderfFileIDSize];
342 char fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];
343 };
344
345 //////////////////////////////////////////////////////////////////////////
346 //
347 // Component running environment
348 //
349 //////////////////////////////////////////////////////////////////////////
350
351 /** logging function */
352 typedef int (*AliHLTfctLogging)( void* param,
353 AliHLTComponentLogSeverity severity,
354 const char* origin,
355 const char* keyword,
356 const char* message);
357
358 /**
359 * @struct AliHLTComponentEnvironment
360 * Running environment for analysis components.
361 * The struct describes function callbacks for
362 */
f23a6e1a 363 struct AliHLTComponentEnvironment
364 {
365 AliHLTUInt32_t fStructSize;
366 void* fParam;
367 void* (*fAllocMemoryFunc)( void* param, unsigned long size );
368#if 0
32db4144 369 // future addition already foreseen/envisioned
370 // IMPORTANT: don not just remove the defines as this breaks the binary
371 // compatibility
372 int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
f23a6e1a 373#endif
8ede8717 374 int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
5ec8e281 375 AliHLTfctLogging fLoggingFunc;
f23a6e1a 376 };
377}
378
32db4144 379//////////////////////////////////////////////////////////////////////////
380//
381// Data type helper functions
382//
383//////////////////////////////////////////////////////////////////////////
384
8ede8717 385inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
71d7c760 386 {
21745ddc 387 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
71d7c760 388 if ( dt1.fID[i] != dt2.fID[i] )
389 return false;
21745ddc 390 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
71d7c760 391 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
392 return false;
393 return true;
394 }
395
8ede8717 396inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
71d7c760 397 {
21745ddc 398 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
71d7c760 399 if ( dt1.fID[i] != dt2.fID[i] )
400 return true;
21745ddc 401 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
71d7c760 402 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
403 return true;
404 return false;
405 }
406
32db4144 407
f23a6e1a 408#endif