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