Adding fClusterMap and fSharedMap of TPC clusters for the tracks
[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
1843b457 98using namespace std;
f23a6e1a 99
100extern "C" {
32db4144 101 //////////////////////////////////////////////////////////////////////////
102 //
103 // Basic HLT data types
104 //
105 //////////////////////////////////////////////////////////////////////////
f23a6e1a 106
107 typedef unsigned char AliHLTUInt8_t;
108
71d7c760 109 typedef unsigned short AliHLTUInt16_t;
110
f23a6e1a 111 typedef unsigned int AliHLTUInt32_t;
112
113 typedef unsigned long long AliHLTUInt64_t;
114
115 typedef AliHLTUInt64_t AliHLTEventID_t;
116
32db4144 117 //////////////////////////////////////////////////////////////////////////
118 //
119 // HLT logging levels
120 //
121 //////////////////////////////////////////////////////////////////////////
f23a6e1a 122
32db4144 123 enum AliHLTComponentLogSeverity {
124 kHLTLogNone = 0,
125 kHLTLogBenchmark = 0x1,
126 kHLTLogDebug = 0x2,
127 kHLTLogInfo = 0x4,
128 kHLTLogWarning = 0x8,
129 kHLTLogError = 0x10,
130 kHLTLogFatal = 0x20,
131 kHLTLogAll = 0x3f,
132 kHLTLogDefault = 0x3d
133};
134
135 //////////////////////////////////////////////////////////////////////////
136 //
137 // HLT data structures for data exchange and external interface
138 //
139 //////////////////////////////////////////////////////////////////////////
140
141 /**
142 * @struct AliHLTComponentEventData
143 * Event descriptor
144 */
8ede8717 145 struct AliHLTComponentEventData
f23a6e1a 146 {
147 AliHLTUInt32_t fStructSize;
148 AliHLTEventID_t fEventID;
149 AliHLTUInt32_t fEventCreation_s;
150 AliHLTUInt32_t fEventCreation_us;
151 AliHLTUInt32_t fBlockCnt;
152 };
153
32db4144 154 /**
155 * @struct AliHLTComponentShmData
156 * Shared memory descriptor.
157 * Irrelevant for analysis components.
158 */
8ede8717 159 struct AliHLTComponentShmData
f23a6e1a 160 {
161 AliHLTUInt32_t fStructSize;
162 AliHLTUInt32_t fShmType;
163 AliHLTUInt64_t fShmID;
164 };
71d7c760 165
32db4144 166 /**
167 * @struct AliHLTComponentDataType
559631d5 168 * Data type descriptor for data blocks transferred through the processing
32db4144 169 * chain.
170 */
8ede8717 171 struct AliHLTComponentDataType
f23a6e1a 172 {
173 AliHLTUInt32_t fStructSize;
32db4144 174 char fID[kAliHLTComponentDataTypefIDsize]; //!
175 char fOrigin[kAliHLTComponentDataTypefOriginSize]; //!
f23a6e1a 176 };
2d7ff710 177
32db4144 178 /**
179 * @struct AliHLTComponentBlockData
180 * Descriptor for data blocks.
181 */
8ede8717 182 struct AliHLTComponentBlockData
f23a6e1a 183 {
184 AliHLTUInt32_t fStructSize;
8ede8717 185 AliHLTComponentShmData fShmKey;
f23a6e1a 186 AliHLTUInt32_t fOffset;
187 void* fPtr;
188 AliHLTUInt32_t fSize;
8ede8717 189 AliHLTComponentDataType fDataType;
f23a6e1a 190 AliHLTUInt32_t fSpecification;
191 };
192
32db4144 193 /**
194 * @struct AliHLTComponentTriggerData
195 * Trigger data, not yet defined
196 */
8ede8717 197 struct AliHLTComponentTriggerData
f23a6e1a 198 {
199 AliHLTUInt32_t fStructSize;
200 AliHLTUInt32_t fDataSize;
201 void* fData;
202 };
32db4144 203
204 /**
205 * @struct AliHLTComponentEventDoneData
206 *
207 */
8ede8717 208 struct AliHLTComponentEventDoneData
f23a6e1a 209 {
210 AliHLTUInt32_t fStructSize;
211 AliHLTUInt32_t fDataSize;
212 void* fData;
213 };
214
32db4144 215 /**
2cbdb37e 216 * @struct AliHLTRunDesc
32db4144 217 * Event descriptor.
218 * The struct is send with the SOR and EOR events.
219 */
2cbdb37e 220 struct AliHLTRunDesc
32db4144 221 {
222 AliHLTUInt32_t fStructSize;
223 AliHLTUInt32_t fRunNo;
224 AliHLTUInt32_t fRunType;
225 };
226
227 /** size of the DDL list */
228 static const int gkAliHLTDDLListSize = 29;
229
230 /**
231 * @struct AliHLTEventDDL
232 * DDL list event.
233 * The struct is send with the DDLLIST event.
234 */
235 struct AliHLTEventDDL
236 {
237 AliHLTUInt32_t fCount;
238 AliHLTUInt32_t fList[gkAliHLTDDLListSize];
239 };
240
241 //////////////////////////////////////////////////////////////////////////
242 //
243 // HLT defines and defaults
244 //
245 //////////////////////////////////////////////////////////////////////////
246
247 /** invalid event id */
248 const AliHLTEventID_t kAliHLTVoidEventID=~(AliHLTEventID_t)0;
249
250 /** invalid data specification */
251 const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
252
253 /** invalid shared memory type */
254 const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
255
256 /** invalid shared memory id */
257 const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
258
259 /** invalid data type */
260 const AliHLTComponentDataType kAliHLTVoidDataType = {
261 sizeof(AliHLTComponentDataType),
262 kAliHLTVoidDataTypeID,
263 kAliHLTVoidDataOrigin
264 };
265
266 // there is currently a problem with rootcint if the predefined ids
267 // (commented below) are used. rootcint does not find the id if they
268 // are char arrays defined with {} and individual chars. If strings
269 // are used it works fine
270 /** any data type */
271 const AliHLTComponentDataType kAliHLTAnyDataType = {
272 sizeof(AliHLTComponentDataType),
273 kAliHLTAnyDataTypeID,
274 kAliHLTAnyDataOrigin
275 };
276
277 /** data to file exchange subscriber */
278 extern const AliHLTComponentDataType kAliHLTDataTypeFXSCalib;
279
280 /** DDL list data type */
281 extern const AliHLTComponentDataType kAliHLTDataTypeDDL;
282
283 /** SOR data type */
284 extern const AliHLTComponentDataType kAliHLTDataTypeSOR;
285
286 /** EOR data type */
287 extern const AliHLTComponentDataType kAliHLTDataTypeEOR;
5ec8e281 288
32db4144 289 //////////////////////////////////////////////////////////////////////////
290 //
291 // FXS subscriber meta information
292 //
293 //////////////////////////////////////////////////////////////////////////
294
295 static const int gkAliHLTFXSHeaderfOriginSize = 4;
296 static const int gkAliHLTFXSHeaderfFileIDSize = 128;
297 static const int gkAliHLTFXSHeaderfDDLNumberSize = 64;
298
299 /** Header in front of the data payload, in order to sent data to the FXS. */
300 struct AliHLTFXSHeader
301 {
302 AliHLTUInt32_t fHeaderVersion;
303 AliHLTUInt32_t fRunNumber;
304 char fOrigin[gkAliHLTFXSHeaderfOriginSize];
305 char fFileID[gkAliHLTFXSHeaderfFileIDSize];
306 char fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];
307 };
308
309 //////////////////////////////////////////////////////////////////////////
310 //
311 // Component running environment
312 //
313 //////////////////////////////////////////////////////////////////////////
314
315 /** logging function */
316 typedef int (*AliHLTfctLogging)( void* param,
317 AliHLTComponentLogSeverity severity,
318 const char* origin,
319 const char* keyword,
320 const char* message);
321
322 /**
323 * @struct AliHLTComponentEnvironment
324 * Running environment for analysis components.
325 * The struct describes function callbacks for
326 */
f23a6e1a 327 struct AliHLTComponentEnvironment
328 {
329 AliHLTUInt32_t fStructSize;
330 void* fParam;
331 void* (*fAllocMemoryFunc)( void* param, unsigned long size );
332#if 0
32db4144 333 // future addition already foreseen/envisioned
334 // IMPORTANT: don not just remove the defines as this breaks the binary
335 // compatibility
336 int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
f23a6e1a 337#endif
8ede8717 338 int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
5ec8e281 339 AliHLTfctLogging fLoggingFunc;
f23a6e1a 340 };
341}
342
32db4144 343//////////////////////////////////////////////////////////////////////////
344//
345// Data type helper functions
346//
347//////////////////////////////////////////////////////////////////////////
348
8ede8717 349inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
71d7c760 350 {
21745ddc 351 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
71d7c760 352 if ( dt1.fID[i] != dt2.fID[i] )
353 return false;
21745ddc 354 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
71d7c760 355 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
356 return false;
357 return true;
358 }
359
8ede8717 360inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
71d7c760 361 {
21745ddc 362 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
71d7c760 363 if ( dt1.fID[i] != dt2.fID[i] )
364 return true;
21745ddc 365 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
71d7c760 366 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
367 return true;
368 return false;
369 }
370
32db4144 371
f23a6e1a 372#endif