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