3 #ifndef ALIHLTDATATYPES_H
4 #define ALIHLTDATATYPES_H
5 /* This file is property of and copyright by the ALICE HLT Project *
6 * ALICE Experiment at CERN, All rights reserved. *
7 * See cxx source for full Copyright notice */
9 /** @file AliHLTDataTypes.h
10 @author Matthias Richter, Timm Steinbeck, Jochen Thaeder
12 @brief Data type declaration for the HLT module.
15 //////////////////////////////////////////////////////////////////////////
17 // HLT data origin defines
19 //////////////////////////////////////////////////////////////////////////
21 /** field size of datat type origin */
22 const int kAliHLTComponentDataTypefOriginSize=4;
25 /** invalid data origin */
26 # define kAliHLTVoidDataOrigin "\0\0\0"
28 /** special id for any data type origin */
29 # define kAliHLTAnyDataOrigin "***"
32 # define kAliHLTDataOriginOut {'H','L','T',' '}
34 /** HLT/PubSub private internal */
35 # define kAliHLTDataOriginPrivate {'P','R','I','V'}
38 # define kAliHLTDataOriginTPC {'T','P','C',' '}
41 # define kAliHLTDataOriginPHOS {'P','H','O','S'}
44 # define kAliHLTDataOriginMUON {'M','U','O','N'}
47 # define kAliHLTDataOriginTRD {'T','R','D',' '}
50 # define kAliHLTDataOriginITS {'I','T','S',' '}
52 //////////////////////////////////////////////////////////////////////////
54 // HLT common data type defines
56 //////////////////////////////////////////////////////////////////////////
58 /** field size of data type id */
59 const int kAliHLTComponentDataTypefIDsize=8;
62 /** invalid data type id */
63 # define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
65 /** special id for any data type id */
66 # define kAliHLTAnyDataTypeID "*******"
68 /** calibration data for file exchange subscriber */
69 # define kAliHLTFXSCalibDataTypeID {'F','X','S','_','C','A','L',' '}
71 /** start of run (SOR) event
72 * @ref AliHLTEventDesc
74 # define kAliHLTSORDataTypeID {'S','T','A','R','T','O','F','R'}
76 /** end of run (EOR) event
77 * @ref AliHLTEventDesc
79 # define kAliHLTEORDataTypeID {'E','N','D','O','F','R','U','N'}
84 # define kAliHLTDDLDataTypeID {'D','D','L','L','I','S','T',' '}
89 //////////////////////////////////////////////////////////////////////////
91 // Basic HLT data types
93 //////////////////////////////////////////////////////////////////////////
95 typedef unsigned char AliHLTUInt8_t;
97 typedef unsigned short AliHLTUInt16_t;
99 typedef unsigned int AliHLTUInt32_t;
101 typedef unsigned long long AliHLTUInt64_t;
103 typedef AliHLTUInt64_t AliHLTEventID_t;
105 //////////////////////////////////////////////////////////////////////////
107 // HLT logging levels
109 //////////////////////////////////////////////////////////////////////////
111 enum AliHLTComponentLogSeverity {
113 kHLTLogBenchmark = 0x1,
116 kHLTLogWarning = 0x8,
120 kHLTLogDefault = 0x3d
123 //////////////////////////////////////////////////////////////////////////
125 // HLT data structures for data exchange and external interface
127 //////////////////////////////////////////////////////////////////////////
130 * @struct AliHLTComponentEventData
133 struct AliHLTComponentEventData
135 AliHLTUInt32_t fStructSize;
136 AliHLTEventID_t fEventID;
137 AliHLTUInt32_t fEventCreation_s;
138 AliHLTUInt32_t fEventCreation_us;
139 AliHLTUInt32_t fBlockCnt;
143 * @struct AliHLTComponentShmData
144 * Shared memory descriptor.
145 * Irrelevant for analysis components.
147 struct AliHLTComponentShmData
149 AliHLTUInt32_t fStructSize;
150 AliHLTUInt32_t fShmType;
151 AliHLTUInt64_t fShmID;
155 * @struct AliHLTComponentDataType
156 * Data type decriptor for data blocks transferred through the processing
159 struct AliHLTComponentDataType
161 AliHLTUInt32_t fStructSize;
162 char fID[kAliHLTComponentDataTypefIDsize]; //!
163 char fOrigin[kAliHLTComponentDataTypefOriginSize]; //!
167 * @struct AliHLTComponentBlockData
168 * Descriptor for data blocks.
170 struct AliHLTComponentBlockData
172 AliHLTUInt32_t fStructSize;
173 AliHLTComponentShmData fShmKey;
174 AliHLTUInt32_t fOffset;
176 AliHLTUInt32_t fSize;
177 AliHLTComponentDataType fDataType;
178 AliHLTUInt32_t fSpecification;
182 * @struct AliHLTComponentTriggerData
183 * Trigger data, not yet defined
185 struct AliHLTComponentTriggerData
187 AliHLTUInt32_t fStructSize;
188 AliHLTUInt32_t fDataSize;
193 * @struct AliHLTComponentEventDoneData
196 struct AliHLTComponentEventDoneData
198 AliHLTUInt32_t fStructSize;
199 AliHLTUInt32_t fDataSize;
204 * @struct AliHLTEventDesc
206 * The struct is send with the SOR and EOR events.
208 struct AliHLTEventDesc
210 AliHLTUInt32_t fStructSize;
211 AliHLTUInt32_t fRunNo;
212 AliHLTUInt32_t fRunType;
215 /** size of the DDL list */
216 static const int gkAliHLTDDLListSize = 29;
219 * @struct AliHLTEventDDL
221 * The struct is send with the DDLLIST event.
223 struct AliHLTEventDDL
225 AliHLTUInt32_t fCount;
226 AliHLTUInt32_t fList[gkAliHLTDDLListSize];
229 //////////////////////////////////////////////////////////////////////////
231 // HLT defines and defaults
233 //////////////////////////////////////////////////////////////////////////
235 /** invalid event id */
236 const AliHLTEventID_t kAliHLTVoidEventID=~(AliHLTEventID_t)0;
238 /** invalid data specification */
239 const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
241 /** invalid shared memory type */
242 const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
244 /** invalid shared memory id */
245 const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
247 /** invalid data type */
248 const AliHLTComponentDataType kAliHLTVoidDataType = {
249 sizeof(AliHLTComponentDataType),
250 kAliHLTVoidDataTypeID,
251 kAliHLTVoidDataOrigin
254 // there is currently a problem with rootcint if the predefined ids
255 // (commented below) are used. rootcint does not find the id if they
256 // are char arrays defined with {} and individual chars. If strings
257 // are used it works fine
259 const AliHLTComponentDataType kAliHLTAnyDataType = {
260 sizeof(AliHLTComponentDataType),
261 kAliHLTAnyDataTypeID,
265 /** data to file exchange subscriber */
266 extern const AliHLTComponentDataType kAliHLTDataTypeFXSCalib;
268 /** DDL list data type */
269 extern const AliHLTComponentDataType kAliHLTDataTypeDDL;
272 extern const AliHLTComponentDataType kAliHLTDataTypeSOR;
275 extern const AliHLTComponentDataType kAliHLTDataTypeEOR;
277 //////////////////////////////////////////////////////////////////////////
279 // FXS subscriber meta information
281 //////////////////////////////////////////////////////////////////////////
283 static const int gkAliHLTFXSHeaderfOriginSize = 4;
284 static const int gkAliHLTFXSHeaderfFileIDSize = 128;
285 static const int gkAliHLTFXSHeaderfDDLNumberSize = 64;
287 /** Header in front of the data payload, in order to sent data to the FXS. */
288 struct AliHLTFXSHeader
290 AliHLTUInt32_t fHeaderVersion;
291 AliHLTUInt32_t fRunNumber;
292 char fOrigin[gkAliHLTFXSHeaderfOriginSize];
293 char fFileID[gkAliHLTFXSHeaderfFileIDSize];
294 char fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];
297 //////////////////////////////////////////////////////////////////////////
299 // Component running environment
301 //////////////////////////////////////////////////////////////////////////
303 /** logging function */
304 typedef int (*AliHLTfctLogging)( void* param,
305 AliHLTComponentLogSeverity severity,
308 const char* message);
311 * @struct AliHLTComponentEnvironment
312 * Running environment for analysis components.
313 * The struct describes function callbacks for
315 struct AliHLTComponentEnvironment
317 AliHLTUInt32_t fStructSize;
319 void* (*fAllocMemoryFunc)( void* param, unsigned long size );
321 // future addition already foreseen/envisioned
322 // IMPORTANT: don not just remove the defines as this breaks the binary
324 int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
326 int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
327 AliHLTfctLogging fLoggingFunc;
331 //////////////////////////////////////////////////////////////////////////
333 // Data type helper functions
335 //////////////////////////////////////////////////////////////////////////
337 inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
339 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
340 if ( dt1.fID[i] != dt2.fID[i] )
342 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
343 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
348 inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
350 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
351 if ( dt1.fID[i] != dt2.fID[i] )
353 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
354 if ( dt1.fOrigin[i] != dt2.fOrigin[i] )