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