]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTDataTypes.h
New Component:
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDataTypes.h
1 // @(#) $Id$
2
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                               */
8
9 /** @file   AliHLTDataTypes.h
10     @author Matthias Richter, Timm Steinbeck, Jochen Thaeder
11     @date   
12     @brief  Data type declaration for the HLT module.
13 */
14
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  *   3       2007-11-15 RAW DDL data type added; some inconsistencies fixed
25  *           ('void' and 'any' origins); added signed HLT basic data types
26  *           2007-11-23 origin defines have become variables in conjunction
27  *           to be used with the operator| (AliHLTComponentDataType)
28  *           2007-11-24 added trigger structs and ESD tree data type
29  *   4       Component configuration and DCS update events added
30  *           gkAliHLTDDLListSize set from 29 to 30 according to new PubSub
31  *           specs
32  *   5       Data types for Run and Event summary, and for monitoring added
33  *   6       Common data types for TreeD and TreeR defined
34  *           kAliHLTAllDataTypes and kAliHLTDataOriginSample added
35  *           kAliHLTDataOriginEMCAL added
36  *           kAliHLTDataTypeRunType added
37  *   7       kAliHLTDataTypeComponentStatistics, kAliHLTDataTypeComponentTable,
38  *           and AliHLTComponentStatistics have been added for optional
39  *           component block statistics
40  *   8       new wrapper interface has been introduced, old wrapper interface
41  *           deprecated but kept for backward compatibility, the PubSub
42  *           interface is going to be compiled independently of AliHLT, new
43  *           interface provided by the libHLTinterface.so
44  *           AliHLTComponentEnvironment -> AliHLTAnalysisEnvironment
45  *   9       added data types for arrays of AliHLTExternalTrackParam sets and
46  *           TClonesArrays of AliExternalTrackParam objects.
47  *  10       Changes for information objects neededfor running with offline
48  *           chains and analysis tasks.
49  *           kAliHLTMCObjectDataType added
50  *           kAliHLTDataOriginOffline added
51  *           kAliHLTDataOriginHLT added
52  */
53 #define ALIHLT_DATA_TYPES_VERSION 10
54
55 //////////////////////////////////////////////////////////////////////////
56 //
57 // HLT data origin variables.
58 //
59 // By converting from defines to variables, the origins can be used with
60 // the operator|
61 //
62 // AliHLTComponentDataType dt;
63 // dt = kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC;
64 //
65 //////////////////////////////////////////////////////////////////////////
66
67 /** field size of datat type origin 
68  * @ingroup alihlt_component_datatypes
69  */
70 const int kAliHLTComponentDataTypefOriginSize=4;
71
72
73 /** invalid data origin 
74  * @ingroup alihlt_component_datatypes
75  */
76 # define kAliHLTDataOriginVoid "\0\0\0"
77 /** old invalid data origin, kept for backward compatibility */
78 # define kAliHLTVoidDataOrigin "\0\0\0"
79
80 /** wildcard data type origin 
81  * @ingroup alihlt_component_datatypes
82  */
83 # define kAliHLTDataOriginAny "***"
84 /** old wildcard data type origin, kept for backward compatibility */
85 # define kAliHLTAnyDataOrigin "***"
86
87 /** Data origin HLT out 
88  * @ingroup alihlt_component_datatypes
89  */
90 extern const char kAliHLTDataOriginOut[kAliHLTComponentDataTypefOriginSize];
91
92 /** Data origin HLT, used for HLT specifc data 
93  *  in offline chains. This not a bug!
94  * @ingroup alihlt_component_datatypes
95  */
96 extern const char kAliHLTDataOriginHLT[kAliHLTComponentDataTypefOriginSize];
97
98 /** Data origin Offline 
99  * @ingroup alihlt_component_datatypes
100  */
101 extern const char kAliHLTDataOriginOffline[kAliHLTComponentDataTypefOriginSize];
102
103 /** Data origin HLT/PubSub private internal 
104  * @ingroup alihlt_component_datatypes
105  */
106 extern const char kAliHLTDataOriginPrivate[kAliHLTComponentDataTypefOriginSize];
107
108 /** Data origin TPC 
109  * @ingroup alihlt_component_datatypes
110  */
111 extern const char kAliHLTDataOriginTPC[kAliHLTComponentDataTypefOriginSize];
112
113 /** Data origin PHOS 
114  * @ingroup alihlt_component_datatypes
115  */
116 extern const char kAliHLTDataOriginPHOS[kAliHLTComponentDataTypefOriginSize];
117
118 /** Data origin FMD
119  * @ingroup alihlt_component_datatypes
120  */
121 extern const char kAliHLTDataOriginFMD[kAliHLTComponentDataTypefOriginSize];
122
123 /** Data origin MUON 
124  * @ingroup alihlt_component_datatypes
125  */
126 extern const char kAliHLTDataOriginMUON[kAliHLTComponentDataTypefOriginSize];
127
128 /** Data origin TRD 
129  * @ingroup alihlt_component_datatypes
130  */
131 extern const char kAliHLTDataOriginTRD[kAliHLTComponentDataTypefOriginSize];
132
133 /** Data origin ITS 
134  * @ingroup alihlt_component_datatypes
135  */
136 extern const char kAliHLTDataOriginITS[kAliHLTComponentDataTypefOriginSize];
137
138 /** Data origin ITS SPD
139  * @ingroup alihlt_component_datatypes
140  */
141 extern const char kAliHLTDataOriginITSSPD[kAliHLTComponentDataTypefOriginSize];
142
143 /** Data origin ITS SDD
144  * @ingroup alihlt_component_datatypes
145  */
146 extern const char kAliHLTDataOriginITSSDD[kAliHLTComponentDataTypefOriginSize];
147
148 /** Data origin ITS SSD
149  * @ingroup alihlt_component_datatypes
150  */
151 extern const char kAliHLTDataOriginITSSSD[kAliHLTComponentDataTypefOriginSize];
152
153 /** Data origin for examples 
154  * @ingroup alihlt_component_datatypes
155  */
156 extern const char kAliHLTDataOriginSample[kAliHLTComponentDataTypefOriginSize];
157
158 /** Data origin EMCAL 
159  * @ingroup alihlt_component_datatypes
160  */
161 extern const char kAliHLTDataOriginEMCAL[kAliHLTComponentDataTypefOriginSize];
162
163 //////////////////////////////////////////////////////////////////////////
164 //
165 // HLT common data type defines
166 //
167 //////////////////////////////////////////////////////////////////////////
168
169 /** field size of data type id 
170  * @ingroup alihlt_component_datatypes
171  */
172 const int kAliHLTComponentDataTypefIDsize=8;
173
174
175 /** invalid data type id 
176  * @ingroup alihlt_component_datatypes
177  */
178 # define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
179
180 /** special id for all data types: any + void
181  * @ingroup alihlt_component_datatypes
182  */
183 # define kAliHLTAllDataTypesID "ALLDATA"
184
185 /** special id for any valid data type id
186  * @ingroup alihlt_component_datatypes
187  */
188 # define kAliHLTAnyDataTypeID "*******"
189
190 /** DDL RAW data 
191  * @ingroup alihlt_component_datatypes
192  */
193 # define kAliHLTDDLRawDataTypeID   {'D','D','L','_','R','A','W',' '}
194
195 /** calibration data for file exchange subscriber 
196  * @ingroup alihlt_component_datatypes
197  */
198 # define kAliHLTFXSCalibDataTypeID {'F','X','S','_','C','A','L',' '}
199
200 /** start of run (SOR) event 
201  * @ref AliHLTRunDesc
202  * @ingroup alihlt_component_datatypes
203  */
204 # define kAliHLTSORDataTypeID      {'S','T','A','R','T','O','F','R'}
205
206 /** end of run (EOR) event 
207  * @ref AliHLTRunDesc
208  * @ingroup alihlt_component_datatypes
209  */
210 # define kAliHLTEORDataTypeID      {'E','N','D','O','F','R','U','N'}
211
212 /** run type data block
213  * string with run type as payload
214  * @ingroup alihlt_component_datatypes
215  */
216 # define kAliHLTRunTypeDataTypeID  {'R','U','N','T','Y','P','E',' '}
217
218 /** DDL list event 
219  * @ref AliHLTEventDDL
220  * @ingroup alihlt_component_datatypes
221  */
222 # define kAliHLTDDLDataTypeID      {'D','D','L','L','I','S','T',' '}
223
224 /** EventType event 
225  * - empty payload, specification gives eventType
226  * @ingroup alihlt_component_datatypes
227  */
228 # define kAliHLTEventDataTypeID    {'E','V','E','N','T','T','Y','P'}
229
230 /** ComponentConfiguration event
231  * - payload contains the CDB path as string
232  * @ingroup alihlt_component_datatypes
233  */
234 # define kAliHLTComConfDataTypeID  {'C','O','M','_','C','O','N','F'}
235
236 /** DCS value update event
237  * - payload contains string of relevant detectors
238  * @ingroup alihlt_component_datatypes
239  */
240 # define kAliHLTUpdtDCSDataTypeID  {'U','P','D','T','_','D','C','S'}
241
242 /** MC data block
243  * an AliMCEvent object of varying origin
244  * The 'V0' at the end allows a versioning
245  * @ingroup alihlt_component_datatypes
246  */
247 # define kAliHLTMCObjectDataTypeID    {'A','L','I','M','C','_','V','0'}
248
249 /** ESD data block
250  * an AliESD object of varying origin
251  * The 'V0' at the end allows a versioning
252  * @ingroup alihlt_component_datatypes
253  */
254 # define kAliHLTESDObjectDataTypeID    {'A','L','I','E','S','D','V','0'}
255
256 /** ESD tree data block
257  * TTree with an AliESD object of varying origin
258  * @ingroup alihlt_component_datatypes
259  */
260 # define kAliHLTESDTreeDataTypeID      {'E','S','D','_','T','R','E','E'}
261
262 /** AliRoot TreeD
263  * - the digits tree of an AliRoot module
264  * @ingroup alihlt_component_datatypes
265  */
266 #define kAliHLTTreeDDataTypeID         {'A','L','I','T','R','E','E','D'}
267
268 /** AliRoot TreeR
269  * - the rec points tree of an AliRoot module
270  * @ingroup alihlt_component_datatypes
271  */
272 #define kAliHLTTreeRDataTypeID         {'A','L','I','T','R','E','E','R'}
273
274 /** HW Address selection data block
275  * - a selection list for 16 bit HW addresses
276  * - varying origin
277  * @ingroup alihlt_component_datatypes
278  */
279 # define kAliHLTHwAddr16DataTypeID     {'H','W','A','D','D','R','1','6'}
280
281 /** Event Statistics
282  * - event statistics for given detectors
283  * - varying origin
284  * @ingroup alihlt_component_datatypes
285  */
286 # define kAliHLTEventStatisticsDataTypeID     {'E','V','_','S','T','A','T','I'}
287
288 /** Event Summary
289  * - event summary
290  * - origin : kAliHLTDataOriginOut ( HLT )
291  * @ingroup alihlt_component_datatypes
292  */
293 # define kAliHLTEventSummaryDataTypeID        {'E','V','_','S','U','M','M','A'}
294
295 /** Run Statistics
296  * - run statistics for given detectors
297  * - varying origin
298  * @ingroup alihlt_component_datatypes
299  */
300 # define kAliHLTRunStatisticsDataTypeID       {'R','U','N','S','T','A','T','I'}
301
302 /** Run Summary
303  * - run summary
304  * - origin : kAliHLTDataOriginOut ( HLT )
305  * @ingroup alihlt_component_datatypes
306  */
307 # define kAliHLTRunSummaryDataTypeID          {'R','U','N','S','U','M','M','A'}
308
309 /** Block Statistics
310  * - small block statistics info added to the data stream by
311  *   the component base class
312  * - origin kAliHLTDataOriginPrivate
313  * @ingroup alihlt_component_datatypes
314  */
315 # define kAliHLTComponentStatisticsDataTypeID {'C','O','M','P','S','T','A','T'}
316
317 /** Component table
318  * - list of components in the chain to be percolated through the chain
319  * - each component adds it's chain id string and a generated 32bit id
320  * @ingroup alihlt_component_datatypes
321  */
322 # define kAliHLTComponentTableDataTypeID      {'C','O','M','P','T','A','B','L'}
323
324 /** general ROOT TObject
325  * - a general TObject exported from the HLT analysis
326  * - varying origin
327  * @ingroup alihlt_component_datatypes
328  */
329 #define kAliHLTTObjectDataTypeID              {'R','O','O','T','T','O','B','J'}
330
331 /** ROOT TObjArray
332  * - a TObjArray exported from the HLT analysis
333  * - varying origin
334  * @ingroup alihlt_component_datatypes
335  */
336 #define kAliHLTTObjArrayDataTypeID            {'R','O','O','T','O','B','A','R'}
337
338 /** ROOT TTree
339  * - a TTree object exported from the HLT analysis
340  * - varying origin
341  * @ingroup alihlt_component_datatypes
342  */
343 #define kAliHLTTTreeDataTypeID                {'R','O','O','T','T','R','E','E'}
344
345 /** ROOT histogram
346  * - a histogram object exported from the HLT analysis
347  * - class derives from TH1 (directly or indirectly) and inherits all common functionality
348  * - varying origin
349  * @ingroup alihlt_component_datatypes
350  */
351 #define kAliHLTHistogramDataTypeID            {'R','O','O','T','H','I','S','T'}
352
353 /** ROOT TNtuple
354  * - a TNtupl object exported from the HLT analysis
355  * - varying origin
356  * @ingroup alihlt_component_datatypes
357  */
358 #define kAliHLTTNtupleDataTypeID              {'R','O','O','T','T','U','P','L'}
359
360 /** HLT Track
361  * - Struct for Tracks based on AliExternalTrackParam
362  * - varying origin
363  * @ingroup alihlt_component_datatypes
364  */
365 #define kAliHLTTrackDataTypeID                {'H','L','T','T','R','A','C','K'}
366
367 /** TClonesArray of AliExternalTrackParam
368  * @ingroup alihlt_component_datatypes
369  */
370 #define kAliHLTExternalTrackParamDataTypeID   {'T','C','A','E','X','T','T','R'}
371
372 using namespace std;
373
374 extern "C" {
375   //////////////////////////////////////////////////////////////////////////
376   //
377   // Basic HLT data types
378   //
379   //////////////////////////////////////////////////////////////////////////
380
381   typedef unsigned char AliHLTUInt8_t;
382
383   typedef signed char AliHLTInt8_t;
384
385   typedef unsigned short AliHLTUInt16_t;
386
387   typedef signed short AliHLTInt16_t;
388
389   typedef unsigned int AliHLTUInt32_t;
390
391   typedef signed int AliHLTInt32_t;
392
393   typedef unsigned long long AliHLTUInt64_t;
394
395   typedef signed long long AliHLTInt64_t;
396
397   typedef float AliHLTFloat32_t;
398
399   typedef double AliHLTFloat64_t;
400
401   typedef AliHLTUInt64_t AliHLTEventID_t;
402
403   //////////////////////////////////////////////////////////////////////////
404   //
405   // HLT logging levels
406   //
407   //////////////////////////////////////////////////////////////////////////
408
409   /**
410    * Logging severities of the HLT
411    */
412   enum AliHLTComponentLogSeverity {
413     /** no logging */
414     kHLTLogNone      = 0,
415     /** benchmark messages */
416     kHLTLogBenchmark = 0x1,
417     /** debug messages */
418     kHLTLogDebug     = 0x2,
419     /** info messages */
420     kHLTLogInfo      = 0x4,
421     /** warning messages */
422     kHLTLogWarning   = 0x8,
423     /** error messages */
424     kHLTLogError     = 0x10,
425     /** fatal error messages */
426     kHLTLogFatal     = 0x20,
427     /** few important messages not to be filtered out.
428      * redirected to kHLTLogInfo in AliRoot
429      */
430     kHLTLogImportant = 0x40,
431     /** special value to enable all messages */
432     kHLTLogAll       = 0x7f,
433     /** the default logging filter */
434     kHLTLogDefault   = 0x79
435   };
436
437   //////////////////////////////////////////////////////////////////////////
438   //
439   // HLT data structures for data exchange and external interface
440   //
441   //////////////////////////////////////////////////////////////////////////
442
443   /**
444    * @struct AliHLTComponentEventData
445    * Event descriptor
446    */
447   struct AliHLTComponentEventData
448   {
449     AliHLTUInt32_t fStructSize;
450     AliHLTEventID_t fEventID;
451     AliHLTUInt32_t fEventCreation_s;
452     AliHLTUInt32_t fEventCreation_us;
453     AliHLTUInt32_t fBlockCnt;
454   };
455
456   /**
457    * @struct AliHLTComponentShmData
458    * Shared memory descriptor.
459    * Irrelevant for analysis components.
460    */
461   struct AliHLTComponentShmData
462   {
463     AliHLTUInt32_t fStructSize;
464     AliHLTUInt32_t fShmType;
465     AliHLTUInt64_t fShmID;
466   };
467
468   /**
469    * @defgroup alihlt_component_datatypes Common Component Data Types
470    * The analysis framework defines a number of common data types for
471    * usage in the detector modules, like e.g. ::kAliHLTAnyDataType
472    * and ::kAliHLTDataTypeDDLRaw. Those data types always have
473    * origin ::kAliHLTDataOriginAny. The correct detector origin can be
474    * set by using operator '|'
475    * <pre>
476    * AliHLTComponentDataType dt=kAliHLTDDLRawDataTypeID|kAliHLTDataOriginTPC
477    * </pre>
478    * @ingroup alihlt_component
479    */
480
481   /**
482    * @struct AliHLTComponentDataType
483    * Data type descriptor for data blocks transferred through the processing
484    * chain.
485    * @ingroup alihlt_component_datatypes
486    */
487   struct AliHLTComponentDataType
488   {
489     AliHLTUInt32_t fStructSize;
490     char fID[kAliHLTComponentDataTypefIDsize];                      //!
491     char fOrigin[kAliHLTComponentDataTypefOriginSize];              //!
492   };
493
494   /**
495    * @struct AliHLTComponentBlockData
496    * This is the decription of data blocks exchanged between components.
497    * \b IMPORTANT: The validity of fPtr and fOffset is different for input and
498    * output blocks:
499    * - input blocks: The \em fPtr member always points to the beginning of the data
500    *                 of size \em fSize. fOffset is ignored and should be in most
501    *                 case 0.
502    * - output blocks: The \em fPtr member is ignored by the framework. \em fOffset
503    *                  must specify the start of the data relative to the output
504    *                  buffer. The data block has size \em fSize.
505    */
506   struct AliHLTComponentBlockData
507   {
508     /* size and version of the struct */
509     AliHLTUInt32_t fStructSize;
510     /* shared memory key, ignored by processing components */
511     AliHLTComponentShmData fShmKey;
512     /* offset of output data relative to the output buffer */
513     AliHLTUInt32_t fOffset;
514     /* start of the data for input data blocks, fOffset to be ignored*/
515     void* fPtr;
516     /* size of the data block */
517     AliHLTUInt32_t fSize;
518     /* data type of the data block */
519     AliHLTComponentDataType fDataType;
520     /* data specification of the data block */
521     AliHLTUInt32_t fSpecification;
522   };
523
524   /**
525    * @struct AliHLTComponentEventDoneData
526    * 
527    */
528   struct AliHLTComponentEventDoneData
529   {
530     AliHLTUInt32_t fStructSize;
531     AliHLTUInt32_t fDataSize;
532     void* fData;
533   };
534
535   /**
536    * @struct AliHLTRunDesc
537    * Event descriptor.
538    * The struct is sent with the SOR and EOR events.
539    *
540    * @note
541    * The name of the member fRunType is a bit misleading. This is not
542    * the ALICE Run Type given by the ECS to the sub-system. The member
543    * is an internal HLT run type and a combination of the HLT running
544    * mode and the beam type.
545    * <pre>
546    * Bit 0-2:   beam type identifier
547    * Bit 3-31:  HLT mode
548    * </pre>
549    */
550   struct AliHLTRunDesc
551   {
552     AliHLTUInt32_t fStructSize;
553     AliHLTUInt32_t fRunNo;
554     AliHLTUInt32_t fRunType;
555   };
556
557   /**
558    * @struct AliHLTComponentStatistics
559    * Small block size summary added by the AliHLTComponent base class
560    * if component statistics are enabled (--enable-compstat).
561    *
562    * fLevel is retrieved from incoming block statistics and incremented. 
563    * Incoming block statistics are appended to the newly added one if
564    * --enable-compstat=full has been chosen.
565    */
566   struct AliHLTComponentStatistics
567   {
568     AliHLTUInt32_t fStructSize;
569     AliHLTUInt32_t fLevel;
570     AliHLTUInt32_t fId;
571     AliHLTUInt32_t fTime;
572     AliHLTUInt32_t fCTime;
573     AliHLTUInt32_t fInputBlockCount;
574     AliHLTUInt32_t fTotalInputSize;
575     AliHLTUInt32_t fOutputBlockCount;
576     AliHLTUInt32_t fTotalOutputSize;
577   };
578
579   /**
580    * @struct AliHLTComponentTableEntry
581    * Structure to be send on SOR event through the chain. Each component
582    * adds its chain id and component arguments to the list.
583    * The 'length' of the structure is variable and depends on the length
584    * of the strings in the buffer at the end.
585    *
586    * ComponentTableEntries are identified by a 32bit Id generated by a CRC
587    * algorithm from the chain Id of the component. This is not a 100% unique
588    * id but with a high probability. This approach accounts for the fact
589    * that all components are separated processes.
590    */
591   struct AliHLTComponentTableEntry
592   {
593     AliHLTUInt32_t fStructSize;
594     /** size of the array of parent ids */
595     AliHLTUInt16_t fNofParents;
596     /** size of the description string in the appended buffer */
597     AliHLTUInt8_t  fSizeDescription;
598     /** the strings: chain id, component args, reserved */
599     AliHLTUInt8_t  fBuffer[1];
600   };
601
602   //////////////////////////////////////////////////////////////////////////
603   //
604   // Trigger meta information
605   //
606   //////////////////////////////////////////////////////////////////////////
607
608   /** field size of fAttribute */
609   const int gkAliHLTBlockDAttributeCount = 8;
610
611   /** field size of fCommonHeader */
612   const int gkAliHLTCommonHeaderCount = 8;
613
614   /** size of the DDL list */
615   const int gkAliHLTDDLListSize = 30;
616
617   /** Number of Trigger Classes of CTP in CDH */
618   const int gkNCTPTriggerClasses = 50;
619
620   /**
621    * @struct AliHLTEventDDL
622    * DDL list event.
623    * The struct is send with the DDLLIST event.
624    * Used in the trigger structure for internal apperance of 
625    * the DLLs as well as for the HLT readout list send to DAQ 
626    * ( as DataType : kAliHLTDataTypeDDL )
627    */
628   struct AliHLTEventDDL
629   {
630     AliHLTUInt32_t fCount;
631     AliHLTUInt32_t fList[gkAliHLTDDLListSize];
632   };
633
634   /**
635    * @struct AliHLTEventTriggerData
636    */
637   struct AliHLTEventTriggerData
638   {
639     AliHLTUInt8_t  fAttributes[gkAliHLTBlockDAttributeCount]; 
640     AliHLTUInt64_t fHLTStatus; // Bit field 
641     AliHLTUInt32_t fCommonHeaderWordCnt;
642     AliHLTUInt32_t fCommonHeader[gkAliHLTCommonHeaderCount]; 
643     AliHLTEventDDL fReadoutList;
644   };
645
646   /**
647    * @struct AliHLTComponentTriggerData
648    * Trigger data
649    */
650   struct AliHLTComponentTriggerData
651   {
652     AliHLTUInt32_t fStructSize;
653     AliHLTUInt32_t fDataSize;
654     void* fData;
655   };
656
657   //////////////////////////////////////////////////////////////////////////
658   //
659   // HLT Event Type Specification
660   //
661   //////////////////////////////////////////////////////////////////////////
662
663   /** Unknown eventType specification */
664   const AliHLTUInt32_t gkAliEventTypeUnknown = ~(AliHLTUInt32_t)0;
665   /** SOR eventType specification */ 
666   const AliHLTUInt32_t gkAliEventTypeStartOfRun=1;
667   /** Data eventType specification */
668   const AliHLTUInt32_t gkAliEventTypeData=2;
669   /** EOR eventType specification */ 
670   const AliHLTUInt32_t gkAliEventTypeEndOfRun=4;
671   /** Corrupt eventType specification */
672   const AliHLTUInt32_t gkAliEventTypeCorruptID=8;
673   /** Calibration eventType specification */ 
674   const AliHLTUInt32_t gkAliEventTypeCalibration=16;
675   /** DataReplay eventType specification */
676   const AliHLTUInt32_t gkAliEventTypeDataReplay=32;
677   /** Configuration eventType specification */
678   const AliHLTUInt32_t gkAliEventTypeConfiguration=34;
679   /** Update DCS eventType specification */
680   const AliHLTUInt32_t gkAliEventTypeReadPreprocessor=35;
681   /** Tick eventType specification */ 
682   const AliHLTUInt32_t gkAliEventTypeTick=64;
683   /** Max eventType specification */ 
684   const AliHLTUInt32_t gkAliEventTypeMax=64;
685
686   //////////////////////////////////////////////////////////////////////////
687   //
688   // HLT defines and defaults
689   //
690   //////////////////////////////////////////////////////////////////////////
691
692   /** invalid event id 
693    * @ingroup alihlt_component_datatypes
694    */
695   const AliHLTEventID_t kAliHLTVoidEventID=~(AliHLTEventID_t)0;
696
697   /** invalid data specification 
698    * @ingroup alihlt_component_datatypes
699    */
700   const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
701
702   /** invalid run no
703    * @ingroup alihlt_component_datatypes
704    */
705   const AliHLTUInt32_t kAliHLTVoidRunNo = ~(AliHLTUInt32_t)0;
706
707   /** invalid run type
708    * @ingroup alihlt_component_datatypes
709    */
710   const AliHLTUInt32_t kAliHLTVoidRunType = ~(AliHLTUInt32_t)0;
711
712   /** invalid run descriptor
713    * @ingroup alihlt_component_datatypes
714    */
715   const AliHLTRunDesc kAliHLTVoidRunDesc={sizeof(AliHLTRunDesc), kAliHLTVoidRunNo, kAliHLTVoidRunType};
716
717   /** invalid shared memory type */
718   const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
719
720   /** invalid shared memory id */
721   const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
722
723   /** invalid data type 
724    * @ingroup alihlt_component_datatypes
725    */
726   const AliHLTComponentDataType kAliHLTVoidDataType = {
727     sizeof(AliHLTComponentDataType),
728     kAliHLTVoidDataTypeID,
729     kAliHLTDataOriginVoid
730   };
731
732   /** all data types, means any + void data type
733    * @ingroup alihlt_component_datatypes
734    */
735   const AliHLTComponentDataType kAliHLTAllDataTypes = {
736     sizeof(AliHLTComponentDataType),
737     kAliHLTAllDataTypesID,
738     kAliHLTDataOriginAny
739   };
740
741   // there is currently a problem with rootcint if the predefined ids
742   // (commented below) are used. rootcint does not find the id if they
743   // are char arrays defined with {} and individual chars. If strings
744   // are used it works fine
745   /** any data type 
746    * @ingroup alihlt_component_datatypes
747    */
748   const AliHLTComponentDataType kAliHLTAnyDataType = {
749     sizeof(AliHLTComponentDataType),
750     kAliHLTAnyDataTypeID,
751     kAliHLTDataOriginAny
752   };
753
754   /** multiple output data types 
755    * @ingroup alihlt_component_datatypes
756    */
757   extern const AliHLTComponentDataType kAliHLTMultipleDataType;
758
759   /** data to file exchange subscriber 
760    * @ingroup alihlt_component_datatypes
761    */
762   extern const AliHLTComponentDataType kAliHLTDataTypeFXSCalib;
763
764   /** DDL list data type 
765    * @ingroup alihlt_component_datatypes
766    */
767   extern const AliHLTComponentDataType kAliHLTDataTypeDDL;
768
769   /** SOR data type 
770    * @ingroup alihlt_component_datatypes
771    */
772   extern const AliHLTComponentDataType kAliHLTDataTypeSOR;
773
774   /** EOR data type 
775    * @ingroup alihlt_component_datatypes
776    */
777   extern const AliHLTComponentDataType kAliHLTDataTypeEOR;
778
779   /** Run type data block 
780    * @ingroup alihlt_component_datatypes
781    */
782   extern const AliHLTComponentDataType kAliHLTDataTypeRunType;
783
784   /** Event type specification 
785    * @ingroup alihlt_component_datatypes
786    */
787   extern const AliHLTComponentDataType kAliHLTDataTypeEvent;
788
789   /** Configuration event data type 
790    * @ingroup alihlt_component_datatypes
791    */
792   extern const AliHLTComponentDataType kAliHLTDataTypeComConf;
793
794   /** DCS value update event 
795    * @ingroup alihlt_component_datatypes
796    */
797   extern const AliHLTComponentDataType kAliHLTDataTypeUpdtDCS;
798
799   /** RAW DDL data specification, origin is 'any', data publisher origin correctly 
800    * @ingroup alihlt_component_datatypes
801    */
802   extern const AliHLTComponentDataType kAliHLTDataTypeDDLRaw;
803
804   /** AliMCEvent object data specification, origin is 'OFFL' 
805    * @ingroup alihlt_component_datatypes
806    */
807   extern const AliHLTComponentDataType kAliHLTDataTypeMCObject;
808
809   /** ESD object data specification, origin is 'any' 
810    * @ingroup alihlt_component_datatypes
811    */
812   extern const AliHLTComponentDataType kAliHLTDataTypeESDObject;
813
814   /** ESD Tree data specification, origin is 'any' 
815    * @ingroup alihlt_component_datatypes
816    */
817   extern const AliHLTComponentDataType kAliHLTDataTypeESDTree;
818
819   /** AliRoot TreeD data specification, origin is 'any' 
820    * @ingroup alihlt_component_datatypes
821    */
822   extern const AliHLTComponentDataType kAliHLTDataTypeAliTreeD;
823
824   /** AliRoot TreeR data specification, origin is 'any' 
825    * @ingroup alihlt_component_datatypes
826    */
827   extern const AliHLTComponentDataType kAliHLTDataTypeAliTreeR;
828
829   /** 16 bit Hardware address selection data specification, origin is 'any' 
830    * @ingroup alihlt_component_datatypes
831    */
832   extern const AliHLTComponentDataType kAliHLTDataTypeHwAddr16;
833
834   /** Event statistics 
835    * @ingroup alihlt_component_datatypes
836    */
837   extern const AliHLTComponentDataType kAliHLTDataTypeEventStatistics;
838
839   /** Event summary 
840    * @ingroup alihlt_component_datatypes
841    */
842   extern const AliHLTComponentDataType kAliHLTDataTypeEventSummary;
843
844   /** Event statistics 
845    * @ingroup alihlt_component_datatypes
846    */
847   extern const AliHLTComponentDataType kAliHLTDataTypeRunStatistics;
848
849   /** Event summary 
850    * @ingroup alihlt_component_datatypes
851    */
852   extern const AliHLTComponentDataType kAliHLTDataTypeRunSummary;
853
854   /** Component block statistics
855    * @ingroup alihlt_component_datatypes
856    */
857   extern const AliHLTComponentDataType kAliHLTDataTypeComponentStatistics;
858
859   /** Component table
860    * To be sent on SOR event, each component adds it's chain id string
861    * and a generated 32bit identifier to the table
862    * @ingroup alihlt_component_datatypes
863    */
864   extern const AliHLTComponentDataType kAliHLTDataTypeComponentTable;
865
866   //////////////////////////////////////////////////////////////////////////
867   //
868   // Data Types for Monitoring objects
869   //
870   //////////////////////////////////////////////////////////////////////////
871
872   /** general ROOT TObject 
873    * @ingroup alihlt_component_datatypes
874    */
875   extern const AliHLTComponentDataType kAliHLTDataTypeTObject;            // {ROOTTOBJ,"***"}
876                                                                                         
877   /** ROOT TObjArray 
878    * @ingroup alihlt_component_datatypes
879    */                                                                   
880   extern const AliHLTComponentDataType kAliHLTDataTypeTObjArray;          // {ROOTOBAR,"***"}
881                                                                                         
882   /** ROOT TTree 
883    * @ingroup alihlt_component_datatypes
884    */                                                                   
885   extern const AliHLTComponentDataType kAliHLTDataTypeTTree;              // {ROOTTREE,"***"}
886                                                                                         
887   /** ROOT TH1 (can be used for all histograms, they derive from TH1) 
888    * @ingroup alihlt_component_datatypes
889    */           
890   extern const AliHLTComponentDataType kAliHLTDataTypeHistogram;          // {ROOTHIST,"***"}
891                                                                                         
892   /** ROOT TNtuple 
893    * @ingroup alihlt_component_datatypes
894    */                                                                   
895   extern const AliHLTComponentDataType kAliHLTDataTypeTNtuple;            // {ROOTTUPL,"***"}
896
897   /** General track array for the barrel tracks based on AliExternalTrackParam
898    * Data format defined by AliHLTTracksData
899    *
900    * We follow the naming scheme of AliESDEvent where 'Tracks' denote the
901    * barrel tracks and detector tracks get names 'DETTracks'
902    * @ingroup alihlt_component_datatypes
903    */   
904   extern const AliHLTComponentDataType kAliHLTDataTypeTrack;             // {HLTTRACK,"***"}
905
906   /** TClonesArray of AliExternalTrackParam
907    * @ingroup alihlt_component_datatypes
908    */   
909   extern const AliHLTComponentDataType kAliHLTDataTypeExternalTrackParam;// {TCAEXTTR,"***"}
910
911   //////////////////////////////////////////////////////////////////////////
912   //
913   // FXS subscriber meta information
914   //
915   //////////////////////////////////////////////////////////////////////////
916
917   const int gkAliHLTFXSHeaderfOriginSize = 4;
918   const int gkAliHLTFXSHeaderfFileIDSize = 128;
919   const int gkAliHLTFXSHeaderfDDLNumberSize = 64;
920
921   /** Header in front of the data payload, in order to sent data to the FXS. */
922   struct AliHLTFXSHeader
923   {
924     AliHLTUInt32_t fHeaderVersion;
925     AliHLTUInt32_t fRunNumber;
926     char fOrigin[gkAliHLTFXSHeaderfOriginSize];
927     char fFileID[gkAliHLTFXSHeaderfFileIDSize];
928     char fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];
929   };  
930
931   //////////////////////////////////////////////////////////////////////////
932   //
933   // Component running environment
934   //
935   //////////////////////////////////////////////////////////////////////////
936
937   /** logging function */
938   typedef int (*AliHLTfctLogging)( void* param, 
939                                    AliHLTComponentLogSeverity severity,
940                                    const char* origin,
941                                    const char* keyword,
942                                    const char* message);
943
944   /**
945    * @struct AliHLTAnalysisEnvironment
946    * Running environment for analysis components.
947    * The struct describes function callbacks for actions to be
948    * carried out by the calling framework, like memory allocation,
949    * property callbecks, logging, etc.
950    *
951    * @ingroup alihlt_wrapper_interface
952    */
953   struct AliHLTAnalysisEnvironment
954   {
955     /** size of the structure */
956     AliHLTUInt32_t fStructSize;
957
958     /** the component parameter given by the framework on creation
959      */
960     void* fParam;
961
962     /** allocated memory
963      */
964     void* (*fAllocMemoryFunc)( void* param, unsigned long size );
965
966     /** allocate an EventDoneData structure.
967      */
968     int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
969
970     /** logging callback
971      */
972     AliHLTfctLogging fLoggingFunc;
973   };
974 #if 0
975   // I just keep this as a note pad. Has to be added to the end of the structure
976   // future addition already foreseen/envisioned
977   // IMPORTANT: don not just remove the defines as this breaks the binary
978   // compatibility
979   int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
980 #endif
981
982   /**
983    * @struct AliHLTComponentEnvironment
984    * This was the original definition of the running environment.
985    * Due to a bug in the AliRootWrapperSubscriber/SimpleComponentWrapper,
986    * this structure can not be used any longer but is kept for backward
987    * compatibility. 
988    * @note The external interface provided by the libHLTbase is now kept
989    * frozen but should not be used any more. Use the interface provided
990    * by the libHLTinterface library.
991    *
992    * @ingroup alihlt_wrapper_interface_deprecated
993    */
994   struct AliHLTComponentEnvironment
995   {
996     AliHLTUInt32_t fStructSize;
997     void* fParam;
998     void* (*fAllocMemoryFunc)( void* param, unsigned long size );
999     int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
1000     AliHLTfctLogging fLoggingFunc;
1001   };
1002
1003   //////////////////////////////////////////////////////////////////////////
1004   //
1005   // The external interface definition
1006   //
1007   //////////////////////////////////////////////////////////////////////////
1008
1009   /**
1010    * The component handle.
1011    * Used as indification in the outside world.
1012    * @ingroup alihlt_wrapper_interface
1013    */
1014   typedef void* AliHLTComponentHandle;
1015
1016   /** @ingroup alihlt_wrapper_interface */
1017   const AliHLTComponentHandle kEmptyHLTComponentHandle = 0;
1018
1019   /**
1020    * Get a system call of the interface.
1021    * @param function signature
1022    * @return pointer to system call
1023    * @ingroup alihlt_wrapper_interface
1024    */
1025   typedef void* (*AliHLTAnalysisFctGetInterfaceCall)(const char*);
1026
1027 # define ALIHLTANALYSIS_INTERFACE_LIBRARY  "libHLTinterface.so"
1028 # define ALIHLTANALYSIS_FCT_GETINTERFACECALL  "AliHLTAnalysisGetInterfaceCall"
1029
1030   /** @ingroup alihlt_wrapper_interface */
1031   typedef int (*AliHLTExtFctInitSystem)( unsigned long version, AliHLTAnalysisEnvironment* externalEnv, unsigned long runNo, const char* runType );
1032
1033   /** @ingroup alihlt_wrapper_interface */
1034   typedef int (*AliHLTExtFctDeinitSystem)();
1035
1036   /** @ingroup alihlt_wrapper_interface */
1037   typedef int (*AliHLTExtFctLoadLibrary)( const char* );
1038
1039   /** @ingroup alihlt_wrapper_interface */
1040   typedef int (*AliHLTExtFctUnloadLibrary)( const char* );
1041
1042   /** @ingroup alihlt_wrapper_interface */
1043   typedef int (*AliHLTExtFctCreateComponent)( const char*, void*, int, const char**, AliHLTComponentHandle*, const char* description );
1044
1045   /** @ingroup alihlt_wrapper_interface */
1046   typedef int (*AliHLTExtFctDestroyComponent)( AliHLTComponentHandle );
1047
1048   /** @ingroup alihlt_wrapper_interface */
1049   typedef int (*AliHLTExtFctProcessEvent)( AliHLTComponentHandle, const AliHLTComponentEventData*, const AliHLTComponentBlockData*, 
1050                                            AliHLTComponentTriggerData*, AliHLTUInt8_t*,
1051                                            AliHLTUInt32_t*, AliHLTUInt32_t*, 
1052                                            AliHLTComponentBlockData**,
1053                                            AliHLTComponentEventDoneData** );
1054
1055   /** @ingroup alihlt_wrapper_interface */
1056   typedef int (*AliHLTExtFctGetOutputDataType)( AliHLTComponentHandle, AliHLTComponentDataType* );
1057
1058   /** @ingroup alihlt_wrapper_interface */
1059   typedef int (*AliHLTExtFctGetOutputSize)( AliHLTComponentHandle, unsigned long*, double* );
1060
1061 }
1062
1063 //////////////////////////////////////////////////////////////////////////
1064 //
1065 // Data type helper functions
1066 //
1067 //////////////////////////////////////////////////////////////////////////
1068
1069 /** exact comparison of HLT component data types
1070  * @ingroup alihlt_component_datatypes
1071  */
1072 inline bool MatchExactly( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
1073 {
1074   for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
1075     if ( dt1.fID[i] != dt2.fID[i] )
1076       return false;
1077   for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
1078     if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
1079       return false;
1080   return true;
1081 }
1082
1083 /** Comparison operator for HLT component data types.
1084  * The operator takes wildcards into account, i.e. the ::kAliHLTAnyDataType,
1085  * ::kAliHLTAnyDataTypeID and ::kAliHLTDataOriginAny definitions.
1086  * @ingroup alihlt_component_datatypes
1087  */
1088 inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
1089 {
1090   if (MatchExactly(dt1, kAliHLTAllDataTypes)) return true;
1091   if (MatchExactly(dt2, kAliHLTAllDataTypes)) return true;
1092
1093   bool any1=true, any2=true, void1=true, void2=true, match=true;
1094   for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ ) {
1095     any1&=(dt1.fOrigin[i]==kAliHLTDataOriginAny[i]);
1096     any2&=(dt2.fOrigin[i]==kAliHLTDataOriginAny[i]);
1097     void1&=(dt1.fOrigin[i]==kAliHLTDataOriginVoid[i]);
1098     void2&=(dt2.fOrigin[i]==kAliHLTDataOriginVoid[i]);
1099     match&=dt1.fOrigin[i]==dt2.fOrigin[i];
1100     if (!(match || (any2 && !void1) || (any1 && !void2)))
1101       return false;
1102   }
1103
1104   any1=true, any2=true, match=true;
1105   for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ ) {
1106     any1&=(dt1.fID[i]==kAliHLTAnyDataTypeID[i]);
1107     any2&=(dt2.fID[i]==kAliHLTAnyDataTypeID[i]);
1108     void1&=(dt1.fID[i]==kAliHLTVoidDataTypeID[i]);
1109     void2&=(dt2.fID[i]==kAliHLTVoidDataTypeID[i]);
1110     match&=dt1.fID[i]==dt2.fID[i];
1111     if (!(match || (any2 && !void1) || (any1 && !void2)))
1112       return false;
1113   }
1114   return true;
1115 }
1116
1117 /** Comparison operator for HLT component data types
1118  * Invers of operator==
1119  * @ingroup alihlt_component_datatypes
1120  */
1121 inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
1122 {
1123   return !(dt1==dt2);
1124 }
1125
1126 /** merge operator for HLT component data types and origins
1127  * @ingroup alihlt_component_datatypes
1128  */
1129 inline AliHLTComponentDataType operator|(const AliHLTComponentDataType srcdt, const char origin[kAliHLTComponentDataTypefOriginSize])
1130 {
1131   AliHLTComponentDataType dt=srcdt;
1132   for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
1133     dt.fOrigin[i]=origin[i];
1134   return dt;
1135 }
1136
1137 /**
1138  * Helper function to initialize a data type from an id char array and origin string.
1139  * @return data type structure initialized with the specified id and origin
1140  * @ingroup alihlt_component_datatypes
1141  */
1142 inline AliHLTComponentDataType AliHLTComponentDataTypeInitializer(const char id[kAliHLTComponentDataTypefIDsize], const char* origin)
1143 {
1144   AliHLTComponentDataType dt=kAliHLTVoidDataType;
1145   int i=0;
1146   for (i = 0; i < kAliHLTComponentDataTypefIDsize; i++)
1147     dt.fID[i]=id[i];
1148   for (i = 0; i < kAliHLTComponentDataTypefOriginSize && origin[i]!=0; i++ )
1149     dt.fOrigin[i]=origin[i];
1150   return dt;
1151 }
1152
1153 /**
1154  * Helper function to initialize a data type from a default data type and
1155  * an origin string. Basically it merges the specified origin into the data
1156  * type.
1157  * @return data type structure initialized with the id from specified data type
1158  *         and origin
1159  * @ingroup alihlt_component_datatypes
1160  */
1161 inline AliHLTComponentDataType AliHLTComponentDataTypeInitializer(const AliHLTComponentDataType src, const char* origin)
1162 {
1163   return AliHLTComponentDataTypeInitializer(src.fID, origin);
1164 }
1165
1166 #endif