]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTDataTypes.h
code documantation and minor cleanup
[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  */
35 #define ALIHLT_DATA_TYPES_VERSION 6
36
37 //////////////////////////////////////////////////////////////////////////
38 //
39 // HLT data origin variables.
40 //
41 // By converting from defines to variables, the origins can be used with
42 // the operator|
43 //
44 // AliHLTComponentDataType dt;
45 // dt = kAliHLTDataTypeDDLRaw | gkAliHLTDataOriginTPC;
46 //
47 //////////////////////////////////////////////////////////////////////////
48
49 /** field size of datat type origin 
50  * @ingroup alihlt_component_datatypes
51  */
52 const int kAliHLTComponentDataTypefOriginSize=4;
53
54
55 /** invalid data origin 
56  * @ingroup alihlt_component_datatypes
57  */
58 # define kAliHLTDataOriginVoid "\0\0\0"
59 /** old invalid data origin, kept for backward compatibility */
60 # define kAliHLTVoidDataOrigin "\0\0\0"
61
62 /** wildcard data type origin 
63  * @ingroup alihlt_component_datatypes
64  */
65 # define kAliHLTDataOriginAny "***"
66 /** old wildcard data type origin, kept for backward compatibility */
67 # define kAliHLTAnyDataOrigin "***"
68
69 /** Data origin HLT out 
70  * @ingroup alihlt_component_datatypes
71  */
72 extern const char kAliHLTDataOriginOut[kAliHLTComponentDataTypefOriginSize];
73
74 /** Data origin HLT/PubSub private internal 
75  * @ingroup alihlt_component_datatypes
76  */
77 extern const char kAliHLTDataOriginPrivate[kAliHLTComponentDataTypefOriginSize];
78
79 /** Data origin TPC 
80  * @ingroup alihlt_component_datatypes
81  */
82 extern const char kAliHLTDataOriginTPC[kAliHLTComponentDataTypefOriginSize];
83
84 /** Data origin PHOS 
85  * @ingroup alihlt_component_datatypes
86  */
87 extern const char kAliHLTDataOriginPHOS[kAliHLTComponentDataTypefOriginSize];
88
89 /** Data origin MUON 
90  * @ingroup alihlt_component_datatypes
91  */
92 extern const char kAliHLTDataOriginMUON[kAliHLTComponentDataTypefOriginSize];
93
94 /** Data origin TRD 
95  * @ingroup alihlt_component_datatypes
96  */
97 extern const char kAliHLTDataOriginTRD[kAliHLTComponentDataTypefOriginSize];
98
99 /** Data origin ITS 
100  * @ingroup alihlt_component_datatypes
101  */
102 extern const char kAliHLTDataOriginITS[kAliHLTComponentDataTypefOriginSize];
103
104 //////////////////////////////////////////////////////////////////////////
105 //
106 // HLT common data type defines
107 //
108 //////////////////////////////////////////////////////////////////////////
109
110 /** field size of data type id 
111  * @ingroup alihlt_component_datatypes
112  */
113 const int kAliHLTComponentDataTypefIDsize=8;
114
115
116 /** invalid data type id 
117  * @ingroup alihlt_component_datatypes
118  */
119 # define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
120
121 /** special id for any data type id 
122  * @ingroup alihlt_component_datatypes
123  */
124 # define kAliHLTAnyDataTypeID "*******"
125
126 /** DDL RAW data 
127  * @ingroup alihlt_component_datatypes
128  */
129 # define kAliHLTDDLRawDataTypeID   {'D','D','L','_','R','A','W',' '}
130
131 /** calibration data for file exchange subscriber 
132  * @ingroup alihlt_component_datatypes
133  */
134 # define kAliHLTFXSCalibDataTypeID {'F','X','S','_','C','A','L',' '}
135
136 /** start of run (SOR) event 
137  * @ref AliHLTRunDesc
138  * @ingroup alihlt_component_datatypes
139  */
140 # define kAliHLTSORDataTypeID      {'S','T','A','R','T','O','F','R'}
141
142 /** end of run (EOR) event 
143  * @ref AliHLTRunDesc
144  * @ingroup alihlt_component_datatypes
145  */
146 # define kAliHLTEORDataTypeID      {'E','N','D','O','F','R','U','N'}
147
148 /** DDL list event 
149  * @ref AliHLTEventDDL
150  * @ingroup alihlt_component_datatypes
151  */
152 # define kAliHLTDDLDataTypeID      {'D','D','L','L','I','S','T',' '}
153
154 /** EventType event 
155  * - empty payload, specification gives eventType
156  * @ingroup alihlt_component_datatypes
157  */
158 # define kAliHLTEventDataTypeID    {'E','V','E','N','T','T','Y','P'}
159
160 /** ComponentConfiguration event
161  * - payload contains the CDB path as string
162  * @ingroup alihlt_component_datatypes
163  */
164 # define kAliHLTComConfDataTypeID  {'C','O','M','_','C','O','N','F'}
165
166 /** DCS value update event
167  * - payload contains string of relevant detectors
168  * @ingroup alihlt_component_datatypes
169  */
170 # define kAliHLTUpdtDCSDataTypeID  {'U','P','D','T','_','D','C','S'}
171
172 /** ESD data block
173  * an AliESD object of varying origin
174  * The 'V0' at the end allows a versioning
175  * @ingroup alihlt_component_datatypes
176  */
177 # define kAliHLTESDObjectDataTypeID    {'A','L','I','E','S','D','V','0'}
178
179 /** ESD tree data block
180  * TTree with an AliESD object of varying origin
181  * @ingroup alihlt_component_datatypes
182  */
183 # define kAliHLTESDTreeDataTypeID      {'E','S','D','_','T','R','E','E'}
184
185 /** AliRoot TreeD
186  * - the digits tree of an AliRoot module
187  * @ingroup alihlt_component_datatypes
188  */
189 #define kAliHLTTreeDDataTypeID         {'A','L','I','T','R','E','E','D'}
190
191 /** AliRoot TreeR
192  * - the rec points tree of an AliRoot module
193  * @ingroup alihlt_component_datatypes
194  */
195 #define kAliHLTTreeRDataTypeID         {'A','L','I','T','R','E','E','D'}
196
197 /** HW Address selection data block
198  * - a selection list for 16 bit HW addresses
199  * - varying origin
200  * @ingroup alihlt_component_datatypes
201  */
202 # define kAliHLTHwAddr16DataTypeID     {'H','W','A','D','D','R','1','6'}
203
204 /** Event Statistics
205  * - event statistics for given detectors
206  * - varying origin
207  * @ingroup alihlt_component_datatypes
208  */
209 # define kAliHLTEventStatisticsDataTypeID     {'E','V','_','S','T','A','T','I'}
210
211 /** Event Summary
212  * - event summary
213  * - origin : kAliHLTDataOriginOut ( HLT )
214  * @ingroup alihlt_component_datatypes
215  */
216 # define kAliHLTEventSummaryDataTypeID        {'E','V','_','S','U','M','M','A'}
217
218 /** Run Statistics
219  * - run statistics for given detectors
220  * - varying origin
221  * @ingroup alihlt_component_datatypes
222  */
223 # define kAliHLTRunStatisticsDataTypeID       {'R','U','N','S','T','A','T','I'}
224
225 /** Run Summary
226  * - run summary
227  * - origin : kAliHLTDataOriginOut ( HLT )
228  * @ingroup alihlt_component_datatypes
229  */
230 # define kAliHLTRunSummaryDataTypeID          {'R','U','N','S','U','M','M','A'}
231
232 /** general ROOT TObject
233  * - a general TObject exported from the HLT analysis
234  * - varying origin
235  * @ingroup alihlt_component_datatypes
236  */
237 #define kAliHLTTObjectDataTypeID              {'R','O','O','T','T','O','B','J'}
238
239 /** ROOT TObjArray
240  * - a TObjArray exported from the HLT analysis
241  * - varying origin
242  * @ingroup alihlt_component_datatypes
243  */
244 #define kAliHLTTObjArrayDataTypeID            {'R','O','O','T','O','B','A','R'}
245
246 /** ROOT TTree
247  * - a TTree object exported from the HLT analysis
248  * - varying origin
249  * @ingroup alihlt_component_datatypes
250  */
251 #define kAliHLTTTreeDataTypeID                {'R','O','O','T','T','R','E','E'}
252
253 /** ROOT histogram
254  * - a histogram object exported from the HLT analysis
255  * - class derives from TH1 (directly or indirectly) and inherits all common functionality
256  * - varying origin
257  * @ingroup alihlt_component_datatypes
258  */
259 #define kAliHLTHistogramDataTypeID            {'R','O','O','T','H','I','S','T'}
260
261 /** ROOT TNtuple
262  * - a TNtupl object exported from the HLT analysis
263  * - varying origin
264  * @ingroup alihlt_component_datatypes
265  */
266 #define kAliHLTTNtupleDataTypeID              {'R','O','O','T','T','U','P','L'}
267
268 using namespace std;
269
270 extern "C" {
271   //////////////////////////////////////////////////////////////////////////
272   //
273   // Basic HLT data types
274   //
275   //////////////////////////////////////////////////////////////////////////
276
277   typedef unsigned char AliHLTUInt8_t;
278
279   typedef signed char AliHLTInt8_t;
280
281   typedef unsigned short AliHLTUInt16_t;
282
283   typedef signed short AliHLTInt16_t;
284
285   typedef unsigned int AliHLTUInt32_t;
286
287   typedef signed int AliHLTInt32_t;
288
289   typedef unsigned long long AliHLTUInt64_t;
290
291   typedef signed long long AliHLTInt64_t;
292
293   typedef float AliHLTFloat32_t;
294
295   typedef double AliHLTFloat64_t;
296
297   typedef AliHLTUInt64_t AliHLTEventID_t;
298
299   //////////////////////////////////////////////////////////////////////////
300   //
301   // HLT logging levels
302   //
303   //////////////////////////////////////////////////////////////////////////
304
305   /**
306    * Logging severities of the HLT
307    */
308   enum AliHLTComponentLogSeverity {
309     /** no logging */
310     kHLTLogNone      = 0,
311     /** benchmark messages */
312     kHLTLogBenchmark = 0x1,
313     /** debug messages */
314     kHLTLogDebug     = 0x2,
315     /** info messages */
316     kHLTLogInfo      = 0x4,
317     /** warning messages */
318     kHLTLogWarning   = 0x8,
319     /** error messages */
320     kHLTLogError     = 0x10,
321     /** fatal error messages */
322     kHLTLogFatal     = 0x20,
323     /** few important messages not to be filtered out.
324      * redirected to kHLTLogInfo in AliRoot
325      */
326     kHLTLogImportant = 0x40,
327     /** special value to enable all messages */
328     kHLTLogAll       = 0x7f,
329     /** the default logging filter */
330     kHLTLogDefault   = 0x79
331 };
332
333   //////////////////////////////////////////////////////////////////////////
334   //
335   // HLT data structures for data exchange and external interface
336   //
337   //////////////////////////////////////////////////////////////////////////
338
339   /**
340    * @struct AliHLTComponentEventData
341    * Event descriptor
342    */
343   struct AliHLTComponentEventData
344   {
345     AliHLTUInt32_t fStructSize;
346     AliHLTEventID_t fEventID;
347     AliHLTUInt32_t fEventCreation_s;
348     AliHLTUInt32_t fEventCreation_us;
349     AliHLTUInt32_t fBlockCnt;
350   };
351
352   /**
353    * @struct AliHLTComponentShmData
354    * Shared memory descriptor.
355    * Irrelevant for analysis components.
356    */
357   struct AliHLTComponentShmData
358   {
359     AliHLTUInt32_t fStructSize;
360     AliHLTUInt32_t fShmType;
361     AliHLTUInt64_t fShmID;
362   };
363
364   /**
365    * @defgroup alihlt_component_datatypes Common Component Data Types
366    * The analysis framework defines a number of common data types for
367    * usage in the detector modules, like e.g. ::kAliHLTAnyDataType
368    * and ::kAliHLTDataTypeDDLRaw. Those data types always have
369    * origin ::kAliHLTDataOriginAny. The correct detector origin can be
370    * set by using operator '|'
371    * <pre>
372    * AliHLTComponentDataType dt=kAliHLTDDLRawDataTypeID|kAliHLTDataOriginTPC
373    * </pre>
374    * @ingroup alihlt_component
375    */
376
377   /**
378    * @struct AliHLTComponentDataType
379    * Data type descriptor for data blocks transferred through the processing
380    * chain.
381    * @ingroup alihlt_component_datatypes
382    */
383   struct AliHLTComponentDataType
384   {
385     AliHLTUInt32_t fStructSize;
386     char fID[kAliHLTComponentDataTypefIDsize];                      //!
387     char fOrigin[kAliHLTComponentDataTypefOriginSize];              //!
388   };
389
390   /**
391    * @struct AliHLTComponentBlockData
392    * This is the decription of data blocks exchanged between components.
393    * \b IMPORTANT: The validity of fPtr and fOffset is different for input and
394    * output blocks:
395    * - input blocks: The \em fPtr member always points to the beginning of the data
396    *                 of size \em fSize. fOffset is ignored and should be in most
397    *                 case 0.
398    * - output blocks: The \em fPtr member is ignored by the framework. \em fOffset
399    *                  must specify the start of the data relative to the output
400    *                  buffer. The data block has size \em fSize.
401    */
402   struct AliHLTComponentBlockData
403   {
404     /* size and version of the struct */
405     AliHLTUInt32_t fStructSize;
406     /* shared memory key, ignored by processing components */
407     AliHLTComponentShmData fShmKey;
408     /* offset of output data relative to the output buffer */
409     AliHLTUInt32_t fOffset;
410     /* start of the data for input data blocks, fOffset to be ignored*/
411     void* fPtr;
412     /* size of the data block */
413     AliHLTUInt32_t fSize;
414     /* data type of the data block */
415     AliHLTComponentDataType fDataType;
416     /* data specification of the data block */
417     AliHLTUInt32_t fSpecification;
418   };
419
420   /**
421    * @struct AliHLTComponentEventDoneData
422    * 
423    */
424   struct AliHLTComponentEventDoneData
425   {
426     AliHLTUInt32_t fStructSize;
427     AliHLTUInt32_t fDataSize;
428     void* fData;
429   };
430
431   /**
432    * @struct AliHLTRunDesc
433    * Event descriptor.
434    * The struct is send with the SOR and EOR events.
435    */
436   struct AliHLTRunDesc
437   {
438     AliHLTUInt32_t fStructSize;
439     AliHLTUInt32_t fRunNo;
440     AliHLTUInt32_t fRunType;
441   };
442
443   //////////////////////////////////////////////////////////////////////////
444   //
445   // Trigger meta information
446   //
447   //////////////////////////////////////////////////////////////////////////
448
449   /** field size of fAttribute */
450   const int gkAliHLTBlockDAttributeCount = 8;
451
452   /** field size of fCommonHeader */
453    const int gkAliHLTCommonHeaderCount = 8;
454
455   /** size of the DDL list */
456   const int gkAliHLTDDLListSize = 30;
457
458   /** Number of Trigger Classes of CTP in CDH */
459   const int gkNCTPTriggerClasses = 50;
460
461   /**
462    * @struct AliHLTEventDDL
463    * DDL list event.
464    * The struct is send with the DDLLIST event.
465    * Used in the trigger structure for internal apperance of 
466    * the DLLs as well as for the HLT readout list send to DAQ 
467    * ( as DataType : kAliHLTDataTypeDDL )
468    */
469   struct AliHLTEventDDL
470   {
471     AliHLTUInt32_t fCount;
472     AliHLTUInt32_t fList[gkAliHLTDDLListSize];
473   };
474
475   /**
476    * @struct AliHLTEventTriggerData
477    */
478   struct AliHLTEventTriggerData
479   {
480     AliHLTUInt8_t  fAttributes[gkAliHLTBlockDAttributeCount]; 
481     AliHLTUInt64_t fHLTStatus; // Bit field 
482     AliHLTUInt32_t fCommonHeaderWordCnt;
483     AliHLTUInt32_t fCommonHeader[gkAliHLTCommonHeaderCount]; 
484     AliHLTEventDDL fReadoutList;
485   };
486
487   /**
488    * @struct AliHLTComponentTriggerData
489    * Trigger data
490    */
491   struct AliHLTComponentTriggerData
492   {
493     AliHLTUInt32_t fStructSize;
494     AliHLTUInt32_t fDataSize;
495     void* fData;
496   };
497
498   //////////////////////////////////////////////////////////////////////////
499   //
500   // HLT Event Type Specification
501   //
502   //////////////////////////////////////////////////////////////////////////
503
504   /** Unknown eventType specification */
505   const AliHLTUInt32_t gkAliEventTypeUnknown = ~(AliHLTUInt32_t)0;
506   /** SOR eventType specification */ 
507   const AliHLTUInt32_t gkAliEventTypeStartOfRun=1;
508   /** Data eventType specification */
509   const AliHLTUInt32_t gkAliEventTypeData=2;
510   /** EOR eventType specification */ 
511   const AliHLTUInt32_t gkAliEventTypeEndOfRun=4;
512   /** Corrupt eventType specification */
513   const AliHLTUInt32_t gkAliEventTypeCorruptID=8;
514   /** Calibration eventType specification */ 
515   const AliHLTUInt32_t gkAliEventTypeCalibration=16;
516   /** DataReplay eventType specification */
517   const AliHLTUInt32_t gkAliEventTypeDataReplay=32;
518   /** Configuration eventType specification */
519   const AliHLTUInt32_t gkAliEventTypeConfiguration=34;
520   /** Update DCS eventType specification */
521   const AliHLTUInt32_t gkAliEventTypeReadPreprocessor=35;
522   /** Tick eventType specification */ 
523   const AliHLTUInt32_t gkAliEventTypeTick=64;
524   /** Max eventType specification */ 
525   const AliHLTUInt32_t gkAliEventTypeMax=64;
526
527   //////////////////////////////////////////////////////////////////////////
528   //
529   // HLT defines and defaults
530   //
531   //////////////////////////////////////////////////////////////////////////
532
533   /** invalid event id 
534    * @ingroup alihlt_component_datatypes
535    */
536   const AliHLTEventID_t kAliHLTVoidEventID=~(AliHLTEventID_t)0;
537
538   /** invalid data specification 
539    * @ingroup alihlt_component_datatypes
540    */
541   const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
542
543   /** invalid shared memory type */
544   const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
545
546   /** invalid shared memory id */
547   const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
548
549   /** invalid data type 
550    * @ingroup alihlt_component_datatypes
551    */
552   const AliHLTComponentDataType kAliHLTVoidDataType = {
553     sizeof(AliHLTComponentDataType),
554     kAliHLTVoidDataTypeID,
555     kAliHLTDataOriginVoid
556   };
557
558   // there is currently a problem with rootcint if the predefined ids
559   // (commented below) are used. rootcint does not find the id if they
560   // are char arrays defined with {} and individual chars. If strings
561   // are used it works fine
562   /** any data type 
563    * @ingroup alihlt_component_datatypes
564    */
565   const AliHLTComponentDataType kAliHLTAnyDataType = {
566     sizeof(AliHLTComponentDataType),
567     kAliHLTAnyDataTypeID,
568     kAliHLTDataOriginAny
569   };
570
571   /** multiple output data types 
572    * @ingroup alihlt_component_datatypes
573    */
574   extern const AliHLTComponentDataType kAliHLTMultipleDataType;
575
576   /** data to file exchange subscriber 
577    * @ingroup alihlt_component_datatypes
578    */
579   extern const AliHLTComponentDataType kAliHLTDataTypeFXSCalib;
580
581   /** DDL list data type 
582    * @ingroup alihlt_component_datatypes
583    */
584   extern const AliHLTComponentDataType kAliHLTDataTypeDDL;
585
586   /** SOR data type 
587    * @ingroup alihlt_component_datatypes
588    */
589   extern const AliHLTComponentDataType kAliHLTDataTypeSOR;
590
591   /** EOR data type 
592    * @ingroup alihlt_component_datatypes
593    */
594   extern const AliHLTComponentDataType kAliHLTDataTypeEOR;
595
596   /** Event type specification 
597    * @ingroup alihlt_component_datatypes
598    */
599   extern const AliHLTComponentDataType kAliHLTDataTypeEvent;
600
601   /** Configuration event data type 
602    * @ingroup alihlt_component_datatypes
603    */
604   extern const AliHLTComponentDataType kAliHLTDataTypeComConf;
605
606   /** DCS value update event 
607    * @ingroup alihlt_component_datatypes
608    */
609   extern const AliHLTComponentDataType kAliHLTDataTypeUpdtDCS;
610
611   /** RAW DDL data specification, origin is 'any', data publisher origin correctly 
612    * @ingroup alihlt_component_datatypes
613    */
614   extern const AliHLTComponentDataType kAliHLTDataTypeDDLRaw;
615
616   /** ESD object data specification, origin is 'any' 
617    * @ingroup alihlt_component_datatypes
618    */
619   extern const AliHLTComponentDataType kAliHLTDataTypeESDObject;
620
621   /** ESD Tree data specification, origin is 'any' 
622    
623    * @ingroup alihlt_component_datatypes
624    */
625   extern const AliHLTComponentDataType kAliHLTDataTypeESDTree;
626
627   /** AliRoot TreeD data specification, origin is 'any' 
628    * @ingroup alihlt_component_datatypes
629    */
630   extern const AliHLTComponentDataType kAliHLTDataTypeAliTreeD;
631
632   /** AliRoot TreeR data specification, origin is 'any' 
633    * @ingroup alihlt_component_datatypes
634    */
635   extern const AliHLTComponentDataType kAliHLTDataTypeAliTreeR;
636
637   /** 16 bit Hardware address selection data specification, origin is 'any' 
638    * @ingroup alihlt_component_datatypes
639    */
640   extern const AliHLTComponentDataType kAliHLTDataTypeHwAddr16;
641
642   /** Event statistics 
643    * @ingroup alihlt_component_datatypes
644    */
645   extern const AliHLTComponentDataType kAliHLTDataTypeEventStatistics;
646
647   /** Event summary 
648    * @ingroup alihlt_component_datatypes
649    */
650   extern const AliHLTComponentDataType kAliHLTDataTypeEventSummary;
651
652   /** Event statistics 
653    * @ingroup alihlt_component_datatypes
654    */
655   extern const AliHLTComponentDataType kAliHLTDataTypeRunStatistics;
656
657   /** Event summary 
658    * @ingroup alihlt_component_datatypes
659    */
660   extern const AliHLTComponentDataType kAliHLTDataTypeRunSummary;
661
662   //////////////////////////////////////////////////////////////////////////
663   //
664   // Data Types for Monitoring objects
665   //
666   //////////////////////////////////////////////////////////////////////////
667
668   /** general ROOT TObject 
669    * @ingroup alihlt_component_datatypes
670    */
671   extern const AliHLTComponentDataType kAliHLTDataTypeTObject;            // {ROOTTOBJ,"***"}
672                                                                                         
673   /** ROOT TObjArray 
674    * @ingroup alihlt_component_datatypes
675    */                                                                   
676   extern const AliHLTComponentDataType kAliHLTDataTypeTObjArray;          // {ROOTOBAR,"***"}
677                                                                                         
678   /** ROOT TTree 
679    * @ingroup alihlt_component_datatypes
680    */                                                                   
681   extern const AliHLTComponentDataType kAliHLTDataTypeTTree;              // {ROOTTREE,"***"}
682                                                                                         
683   /** ROOT TH1 (can be used for all histograms, they derive from TH1) 
684    * @ingroup alihlt_component_datatypes
685    */           
686   extern const AliHLTComponentDataType kAliHLTDataTypeHistogram;          // {ROOTHIST,"***"}
687                                                                                         
688   /** ROOT TNtuple 
689    * @ingroup alihlt_component_datatypes
690    */                                                                   
691   extern const AliHLTComponentDataType kAliHLTDataTypeTNtuple;            // {ROOTTUPL,"***"}
692
693   //////////////////////////////////////////////////////////////////////////
694   //
695   // FXS subscriber meta information
696   //
697   //////////////////////////////////////////////////////////////////////////
698
699   const int gkAliHLTFXSHeaderfOriginSize = 4;
700   const int gkAliHLTFXSHeaderfFileIDSize = 128;
701   const int gkAliHLTFXSHeaderfDDLNumberSize = 64;
702
703   /** Header in front of the data payload, in order to sent data to the FXS. */
704   struct AliHLTFXSHeader
705   {
706     AliHLTUInt32_t fHeaderVersion;
707     AliHLTUInt32_t fRunNumber;
708     char fOrigin[gkAliHLTFXSHeaderfOriginSize];
709     char fFileID[gkAliHLTFXSHeaderfFileIDSize];
710     char fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];
711   };  
712
713   //////////////////////////////////////////////////////////////////////////
714   //
715   // Component running environment
716   //
717   //////////////////////////////////////////////////////////////////////////
718
719   /** logging function */
720   typedef int (*AliHLTfctLogging)( void* param, 
721                                    AliHLTComponentLogSeverity severity,
722                                    const char* origin,
723                                    const char* keyword,
724                                    const char* message);
725
726   /**
727    * @struct AliHLTComponentEnvironment
728    * Running environment for analysis components.
729    * The struct describes function callbacks for 
730    */
731   struct AliHLTComponentEnvironment
732   {
733     AliHLTUInt32_t fStructSize;
734     void* fParam;
735     void* (*fAllocMemoryFunc)( void* param, unsigned long size );
736 #if 0
737     // future addition already foreseen/envisioned
738     // IMPORTANT: don not just remove the defines as this breaks the binary
739     // compatibility
740     int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
741 #endif
742     int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
743     AliHLTfctLogging fLoggingFunc;
744   };
745 }
746
747 //////////////////////////////////////////////////////////////////////////
748 //
749 // Data type helper functions
750 //
751 //////////////////////////////////////////////////////////////////////////
752
753 /** Comparison operator for HLT component data types.
754  * The operator takes wildcards into account, i.e. the ::kAliHLTAnyDataType,
755  * ::kAliHLTAnyDataTypeID and ::kAliHLTDataOriginAny definitions.
756  * @ingroup alihlt_component_datatypes
757  */
758 inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
759 {
760   bool any1=true, any2=true, void1=true, void2=true, match=true;
761   for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ ) {
762     any1&=(dt1.fOrigin[i]==kAliHLTDataOriginAny[i]);
763     any2&=(dt2.fOrigin[i]==kAliHLTDataOriginAny[i]);
764     void1&=(dt1.fOrigin[i]==kAliHLTDataOriginVoid[i]);
765     void2&=(dt2.fOrigin[i]==kAliHLTDataOriginVoid[i]);
766     match&=dt1.fOrigin[i]==dt2.fOrigin[i];
767     if (!(match || (any2 && !void1) || (any1 && !void2)))
768       return false;
769   }
770
771   any1=true, any2=true, match=true;
772   for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ ) {
773     any1&=(dt1.fID[i]==kAliHLTAnyDataTypeID[i]);
774     any2&=(dt2.fID[i]==kAliHLTAnyDataTypeID[i]);
775     void1&=(dt1.fID[i]==kAliHLTVoidDataTypeID[i]);
776     void2&=(dt2.fID[i]==kAliHLTVoidDataTypeID[i]);
777     match&=dt1.fID[i]==dt2.fID[i];
778     if (!(match || (any2 && !void1) || (any1 && !void2)))
779       return false;
780   }
781   return true;
782 }
783
784 /** Comparison operator for HLT component data types
785  * Invers of operator==
786  * @ingroup alihlt_component_datatypes
787  */
788 inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
789 {
790   return !(dt1==dt2);
791 }
792
793 /** exact comparison of HLT component data types
794  * @ingroup alihlt_component_datatypes
795  */
796 inline bool MatchExactly( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
797 {
798   for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
799     if ( dt1.fID[i] != dt2.fID[i] )
800       return false;
801   for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
802     if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
803       return false;
804   return true;
805 }
806
807 /** merge operator for HLT component data types and origins
808  * @ingroup alihlt_component_datatypes
809  */
810 inline AliHLTComponentDataType operator|(const AliHLTComponentDataType srcdt, const char origin[kAliHLTComponentDataTypefOriginSize])
811 {
812   AliHLTComponentDataType dt=srcdt;
813   for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
814     dt.fOrigin[i]=origin[i];
815   return dt;
816 }
817
818 #endif