]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTDataTypes.h
using common function for merging of streamer info
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDataTypes.h
1 // @(#) $Id$
2
3 #ifndef ALIHLTDATATYPES_H
4 #define ALIHLTDATATYPES_H
5 /* This file is property of and copyright by the ALICE HLT Project        * 
6  * ALICE Experiment at CERN, All rights reserved.                         *
7  * See cxx source for full Copyright notice                               */
8
9 /** @file   AliHLTDataTypes.h
10     @author Matthias Richter, Timm Steinbeck, Jochen Thaeder
11     @date   
12     @brief  Data type declaration for the HLT module.
13 */
14
15 //////////////////////////////////////////////////////////////////////////
16 //
17 // version no of HLT data types
18 //
19 //////////////////////////////////////////////////////////////////////////
20
21 /* Version   Description
22  *   1       first version until June 07; implicite, not tagged
23  *   2       introduced June 07, enhanced/cleaned/arranged structure
24  *   3       2007-11-15 RAW DDL data type added; some inconsistencies fixed
25  *           ('void' and 'any' origins); added signed HLT basic data types
26  *           2007-11-23 origin defines have become variables in conjunction
27  *           to be used with the operator| (AliHLTComponentDataType)
28  *           2007-11-24 added trigger structs and ESD tree data type
29  *   4       Component configuration and DCS update events added
30  *           gkAliHLTDDLListSize set from 29 to 30 according to new PubSub
31  *           specs
32  *   5       Data types for Run and Event summary, and for monitoring added
33  *   6       Common data types for TreeD and TreeR defined
34  *           kAliHLTAllDataTypes and kAliHLTDataOriginSample added
35  *           kAliHLTDataOriginEMCAL added
36  *           kAliHLTDataTypeRunType added
37  *   7       kAliHLTDataTypeComponentStatistics, kAliHLTDataTypeComponentTable,
38  *           and AliHLTComponentStatistics have been added for optional
39  *           component block statistics
40  *   8       new wrapper interface has been introduced, old wrapper interface
41  *           deprecated but kept for backward compatibility, the PubSub
42  *           interface is going to be compiled independently of AliHLT, new
43  *           interface provided by the libHLTinterface.so
44  *           AliHLTComponentEnvironment -> AliHLTAnalysisEnvironment
45  *   9       added data types for arrays of AliHLTExternalTrackParam sets and
46  *           TClonesArrays of AliExternalTrackParam objects.
47  *  10       Changes for information objects neededfor running with offline
48  *           chains and analysis tasks.
49  *           kAliHLTMCObjectDataType added
50  *           kAliHLTDataOriginOffline added
51  *           kAliHLTDataOriginHLT added
52  *  11       extended AliHLTComponentStatistics: one more member to store the
53  *           cycle time between events per component.
54  *  12       added common data type id 'CLUSTERS'
55  *           added data type 'ECSPARAM' for the full ECS parameter string to
56  *           be sebt during SOR
57  *           added kAliHLTDataTypeTrackMC (TRACK_MC) data type
58  *           added data types (note: interface version stays the same
59  *                 kAliHLTDataTypeDAQRDOUT (DAQRDOUT)
60  *                 kAliHLTDataTypeTriggerDecision (TRIG_DEC)
61  *                 kAliHLTDataTypeGlobalTrigger (GLOBTRIG)
62  *                 kAliHLTDataTypeStreamerInfo (ROOTSTRI)
63  *  13       Changed AliHLTEventDDL to now contain 31 words. The extra word is
64  *           for the EMCAL detector, which needs 46 DDLs after DCAL was added.
65  *  14       Adding new data block type for HLT global trigger counters.
66  *           Adding data block type for ESD content
67  *           Adding data block type for forwarded component table blocks
68  *           Adding new event type for software triggers.
69  *  15       Modifying data block types for trigger counter blocks.
70  *  16       Adding data type for the meta data block to be forwarded by the
71  *           TCPDumpSubscriber for the Common Data Header (CDH) and readout
72  *           list information.
73  */
74 #define ALIHLT_DATA_TYPES_VERSION 16
75
76 //////////////////////////////////////////////////////////////////////////
77 //
78 // HLT data origin variables.
79 //
80 // By converting from defines to variables, the origins can be used with
81 // the operator|
82 //
83 // AliHLTComponentDataType dt;
84 // dt = kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC;
85 //
86 //////////////////////////////////////////////////////////////////////////
87
88 /** field size of datat type origin 
89  * @ingroup alihlt_component_datatypes
90  */
91 const int kAliHLTComponentDataTypefOriginSize=4;
92
93
94 /** invalid data origin 
95  * @ingroup alihlt_component_datatypes
96  */
97 # define kAliHLTDataOriginVoid "\0\0\0"
98 /** old invalid data origin, kept for backward compatibility */
99 # define kAliHLTVoidDataOrigin "\0\0\0"
100
101 /** wildcard data type origin 
102  * @ingroup alihlt_component_datatypes
103  */
104 # define kAliHLTDataOriginAny "***"
105 /** old wildcard data type origin, kept for backward compatibility */
106 # define kAliHLTAnyDataOrigin "***"
107
108 /** Data origin HLT out 
109  * @ingroup alihlt_component_datatypes
110  */
111 extern const char kAliHLTDataOriginOut[kAliHLTComponentDataTypefOriginSize];
112
113 /** Data origin HLT, used for HLT specifc data 
114  *  in offline chains. This not a bug!
115  * @ingroup alihlt_component_datatypes
116  */
117 extern const char kAliHLTDataOriginHLT[kAliHLTComponentDataTypefOriginSize];
118
119 /** Data origin Offline 
120  * @ingroup alihlt_component_datatypes
121  */
122 extern const char kAliHLTDataOriginOffline[kAliHLTComponentDataTypefOriginSize];
123
124 /** Data origin HLT/PubSub private internal 
125  * @ingroup alihlt_component_datatypes
126  */
127 extern const char kAliHLTDataOriginPrivate[kAliHLTComponentDataTypefOriginSize];
128
129 /** Data origin TPC 
130  * @ingroup alihlt_component_datatypes
131  */
132 extern const char kAliHLTDataOriginTPC[kAliHLTComponentDataTypefOriginSize];
133
134 /** Data origin PHOS 
135  * @ingroup alihlt_component_datatypes
136  */
137 extern const char kAliHLTDataOriginPHOS[kAliHLTComponentDataTypefOriginSize];
138
139 /** Data origin FMD
140  * @ingroup alihlt_component_datatypes
141  */
142 extern const char kAliHLTDataOriginFMD[kAliHLTComponentDataTypefOriginSize];
143
144 /** Data origin MUON 
145  * @ingroup alihlt_component_datatypes
146  */
147 extern const char kAliHLTDataOriginMUON[kAliHLTComponentDataTypefOriginSize];
148
149 /** Data origin TRD 
150  * @ingroup alihlt_component_datatypes
151  */
152 extern const char kAliHLTDataOriginTRD[kAliHLTComponentDataTypefOriginSize];
153
154 /** Data origin ITS 
155  * @ingroup alihlt_component_datatypes
156  */
157 extern const char kAliHLTDataOriginITS[kAliHLTComponentDataTypefOriginSize];
158
159 /** Data origin ITSOut 
160  * @ingroup alihlt_component_datatypes
161  */
162 extern const char kAliHLTDataOriginITSOut[kAliHLTComponentDataTypefOriginSize];
163
164 /** Data origin ITS SPD
165  * @ingroup alihlt_component_datatypes
166  */
167 extern const char kAliHLTDataOriginITSSPD[kAliHLTComponentDataTypefOriginSize];
168
169 /** Data origin ITS SDD
170  * @ingroup alihlt_component_datatypes
171  */
172 extern const char kAliHLTDataOriginITSSDD[kAliHLTComponentDataTypefOriginSize];
173
174 /** Data origin ITS SSD
175  * @ingroup alihlt_component_datatypes
176  */
177 extern const char kAliHLTDataOriginITSSSD[kAliHLTComponentDataTypefOriginSize];
178
179 /** Data origin for examples 
180  * @ingroup alihlt_component_datatypes
181  */
182 extern const char kAliHLTDataOriginSample[kAliHLTComponentDataTypefOriginSize];
183
184 /** Data origin EMCAL 
185  * @ingroup alihlt_component_datatypes
186  */
187 extern const char kAliHLTDataOriginEMCAL[kAliHLTComponentDataTypefOriginSize];
188
189 /** Data origin TOF
190  * @ingroup alihlt_component_datatypes
191  */
192 extern const char kAliHLTDataOriginTOF[kAliHLTComponentDataTypefOriginSize];
193
194 /** Data origin HMPID
195  * @ingroup alihlt_component_datatypes
196  */
197 extern const char kAliHLTDataOriginHMPID[kAliHLTComponentDataTypefOriginSize];
198
199 /** Data origin CPV
200  * @ingroup alihlt_component_datatypes
201  */
202 extern const char kAliHLTDataOriginCPV[kAliHLTComponentDataTypefOriginSize];
203
204 /** Data origin PMD
205  * @ingroup alihlt_component_datatypes
206  */
207 extern const char kAliHLTDataOriginPMD[kAliHLTComponentDataTypefOriginSize];
208
209 /** Data origin T0
210  * @ingroup alihlt_component_datatypes
211  */
212 extern const char kAliHLTDataOriginT0[kAliHLTComponentDataTypefOriginSize];
213
214 /** Data origin VZERO
215  * @ingroup alihlt_component_datatypes
216  */
217 extern const char kAliHLTDataOriginVZERO[kAliHLTComponentDataTypefOriginSize];
218
219 /** Data origin ZDC
220  * @ingroup alihlt_component_datatypes
221  */
222 extern const char kAliHLTDataOriginZDC[kAliHLTComponentDataTypefOriginSize];
223
224 /** Data origin ACORDE
225  * @ingroup alihlt_component_datatypes
226  */
227
228 extern const char kAliHLTDataOriginACORDE[kAliHLTComponentDataTypefOriginSize];
229
230 /** Data origin TRG
231  * @ingroup alihlt_component_datatypes
232  */
233 extern const char kAliHLTDataOriginTRG[kAliHLTComponentDataTypefOriginSize];
234
235 //////////////////////////////////////////////////////////////////////////
236 //
237 // HLT common data type defines
238 //
239 //////////////////////////////////////////////////////////////////////////
240
241 /** field size of data type id 
242  * @ingroup alihlt_component_datatypes
243  */
244 const int kAliHLTComponentDataTypefIDsize=8;
245
246
247 /** invalid data type id 
248  * @ingroup alihlt_component_datatypes
249  */
250 # define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
251
252 /** special id for all data types: any + void
253  * @ingroup alihlt_component_datatypes
254  */
255 # define kAliHLTAllDataTypesID "ALLDATA"
256
257 /** special id for any valid data type id
258  * @ingroup alihlt_component_datatypes
259  */
260 # define kAliHLTAnyDataTypeID "*******"
261
262 /** DDL RAW data 
263  * @ingroup alihlt_component_datatypes
264  */
265 # define kAliHLTDDLRawDataTypeID   {'D','D','L','_','R','A','W',' '}
266
267 /** CLUSTERS data
268  * Common data type for the output of cluster finders, the exact
269  * format depends on the origin (detector)
270  * @ingroup alihlt_component_datatypes
271  */
272 # define kAliHLTClustersDataTypeID {'C','L','U','S','T','E','R','S'}
273
274 /** calibration data for file exchange subscriber 
275  * @ingroup alihlt_component_datatypes
276  */
277 # define kAliHLTFXSCalibDataTypeID {'F','X','S','_','C','A','L',' '}
278
279 /** start of run (SOR) event 
280  * @ref AliHLTRunDesc
281  * @ingroup alihlt_component_datatypes
282  */
283 # define kAliHLTSORDataTypeID      {'S','T','A','R','T','O','F','R'}
284
285 /** end of run (EOR) event 
286  * @ref AliHLTRunDesc
287  * @ingroup alihlt_component_datatypes
288  */
289 # define kAliHLTEORDataTypeID      {'E','N','D','O','F','R','U','N'}
290
291 /** run type data block
292  * string with run type as payload
293  * @ingroup alihlt_component_datatypes
294  */
295 # define kAliHLTRunTypeDataTypeID  {'R','U','N','T','Y','P','E',' '}
296
297 /** DDL list event 
298  * @ref AliHLTEventDDL
299  * @ingroup alihlt_component_datatypes
300  */
301 # define kAliHLTDDLDataTypeID      {'D','D','L','L','I','S','T',' '}
302
303 /** DAQ readout list 
304  * @ingroup alihlt_component_datatypes
305  */
306 # define kAliHLTDAQRDOUTDataTypeID "DAQRDOUT"
307
308 /** HLT readout list.
309  * @ingroup alihlt_component_datatypes
310  */
311 # define kAliHLTReadoutListDataTypeID {'H','L','T','R','D','L','S','T'}
312
313 /** EventType event 
314  * - empty payload, specification gives eventType
315  * @ingroup alihlt_component_datatypes
316  */
317 # define kAliHLTEventDataTypeID    {'E','V','E','N','T','T','Y','P'}
318
319 /** ECS parameter event 
320  * - sent during the SOR event by the framework
321  * - contains the full ECS parameter string
322  * @ingroup alihlt_component_datatypes
323  */
324 # define kAliHLTECSParamDataTypeID {'E','C','S','P','A','R','A','M'}
325
326 /** ComponentConfiguration event
327  * - payload contains the CDB path as string
328  * @ingroup alihlt_component_datatypes
329  */
330 # define kAliHLTComConfDataTypeID  {'C','O','M','_','C','O','N','F'}
331
332 /** DCS value update event
333  * - payload contains string of relevant detectors
334  * @ingroup alihlt_component_datatypes
335  */
336 # define kAliHLTUpdtDCSDataTypeID  {'U','P','D','T','_','D','C','S'}
337
338 /** MC data block
339  * an AliMCEvent object of varying origin
340  * The 'V0' at the end allows a versioning
341  * @ingroup alihlt_component_datatypes
342  */
343 # define kAliHLTMCObjectDataTypeID    {'A','L','I','M','C','_','V','0'}
344
345 /** ESDVertex data block
346  * an AliESDVertex object of varying origin
347  * The 'V0' at the end allows a versioning
348  * @ingroup alihlt_component_datatypes
349  */
350 # define kAliHLTESDVertexDataTypeID    {'E','S','D','V','T','X','V','0'}
351
352 /** KFVertex data block
353  * an AliKFVertex object of varying origin
354  * The 'V0' at the end allows a versioning
355  * @ingroup alihlt_component_datatypes
356  */
357 # define kAliHLTKFVertexDataTypeID    {'A','L','I','K','F','V','V','0'}
358
359
360 /** output of the GlobalVertexer data block
361  * The 'V0' at the end allows a versioning
362  * @ingroup alihlt_component_datatypes
363  */
364 # define kAliHLTDataTypeGlobalVertexerID    {'G','L','B','V','T','X','V','0'}
365
366 /** output of the PrimaryFinder data block
367  * The 'V0' at the end allows a versioning
368  * @ingroup alihlt_component_datatypes
369  */
370 # define kAliHLTDataTypePrimaryFinderID    {'P','R','I','V','T','X','V','0'}
371
372 /** output of the V0Finder data block
373  * The 'V0' at the end allows a versioning
374  * @ingroup alihlt_component_datatypes
375  */
376 # define kAliHLTDataTypeV0FinderID    {'V','0','S','V','T','X','V','0'}
377
378 /** ESD data block
379  * an AliESD object of varying origin
380  * The 'V0' at the end allows a versioning
381  * @ingroup alihlt_component_datatypes
382  */
383 # define kAliHLTESDObjectDataTypeID    {'A','L','I','E','S','D','V','0'}
384
385 /** ESD 
386  * data blocks designated for the ESD
387  * @ingroup alihlt_component_datatypes
388  */
389 # define kAliHLTESDContentDataTypeID   {'E','S','D','_','C','O','N','T'}
390
391 /** ESD tree data block
392  * TTree with an AliESD object of varying origin
393  * @ingroup alihlt_component_datatypes
394  */
395 # define kAliHLTESDTreeDataTypeID      {'E','S','D','_','T','R','E','E'}
396
397 /** AliRoot TreeD
398  * - the digits tree of an AliRoot module
399  * @ingroup alihlt_component_datatypes
400  */
401 #define kAliHLTTreeDDataTypeID         {'A','L','I','T','R','E','E','D'}
402
403 /** AliRoot TreeR
404  * - the rec points tree of an AliRoot module
405  * @ingroup alihlt_component_datatypes
406  */
407 #define kAliHLTTreeRDataTypeID         {'A','L','I','T','R','E','E','R'}
408
409 /** HW Address selection data block
410  * - a selection list for 16 bit HW addresses
411  * - varying origin
412  * @ingroup alihlt_component_datatypes
413  */
414 # define kAliHLTHwAddr16DataTypeID     {'H','W','A','D','D','R','1','6'}
415
416 /** Event Statistics
417  * - event statistics for given detectors
418  * - varying origin
419  * @ingroup alihlt_component_datatypes
420  */
421 # define kAliHLTEventStatisticsDataTypeID     {'E','V','_','S','T','A','T','I'}
422
423 /** Event Summary
424  * - event summary
425  * - origin : kAliHLTDataOriginOut ( HLT )
426  * @ingroup alihlt_component_datatypes
427  */
428 # define kAliHLTEventSummaryDataTypeID        {'E','V','_','S','U','M','M','A'}
429
430 /** Run Statistics
431  * - run statistics for given detectors
432  * - varying origin
433  * @ingroup alihlt_component_datatypes
434  */
435 # define kAliHLTRunStatisticsDataTypeID       {'R','U','N','S','T','A','T','I'}
436
437 /** Run Summary
438  * - run summary
439  * - origin : kAliHLTDataOriginOut ( HLT )
440  * @ingroup alihlt_component_datatypes
441  */
442 # define kAliHLTRunSummaryDataTypeID          {'R','U','N','S','U','M','M','A'}
443
444 /** Trigger decision
445  * - origin : kAliHLTDataOriginOut ( HLT )
446  * @ingroup alihlt_component_datatypes
447  */
448 # define kAliHLTTriggerDecisionDataTypeID     {'T','R','I','G','_','D','E','C'}
449
450 /** Global trigger decision
451  * - origin : kAliHLTDataOriginOut ( HLT )
452  * @ingroup alihlt_component_datatypes
453  */
454 # define kAliHLTGlobalTriggerDataTypeID       {'G','L','O','B','T','R','I','G'}
455
456 /** Block Statistics
457  * - small block statistics info added to the data stream by
458  *   the component base class
459  * - origin kAliHLTDataOriginPrivate
460  * @ingroup alihlt_component_datatypes
461  */
462 # define kAliHLTComponentStatisticsDataTypeID {'C','O','M','P','S','T','A','T'}
463
464 /** Component table
465  * - list of components in the chain to be percolated through the chain
466  * - each component adds it's chain id string and a generated 32bit id
467  * @ingroup alihlt_component_datatypes
468  */
469 # define kAliHLTComponentTableDataTypeID      {'C','O','M','P','T','A','B','L'}
470
471 /** Forwarded component table
472  * @ingroup alihlt_component_datatypes
473  */
474 # define kAliHLTComponentFwdTableDataTypeID   {'C','O','M','P','T','A','B','F'}
475
476 /** general ROOT TObject
477  * - a general TObject exported from the HLT analysis
478  * - varying origin
479  * @ingroup alihlt_component_datatypes
480  */
481 #define kAliHLTTObjectDataTypeID              {'R','O','O','T','T','O','B','J'}
482
483 /** ROOT streamer info
484  * - used for the transmission of streamer info for objects in the HLTOUT
485  * - origin kAliHLTDataOriginOut ( HLT )
486  * @ingroup alihlt_component_datatypes
487  */
488 #define kAliHLTStreamerInfoDataTypeID         {'R','O','O','T','S','T','R','I'}
489
490 /** ROOT TObjArray
491  * - a TObjArray exported from the HLT analysis
492  * - varying origin
493  * @ingroup alihlt_component_datatypes
494  */
495 #define kAliHLTTObjArrayDataTypeID            {'R','O','O','T','O','B','A','R'}
496
497 /** ROOT TTree
498  * - a TTree object exported from the HLT analysis
499  * - varying origin
500  * @ingroup alihlt_component_datatypes
501  */
502 #define kAliHLTTTreeDataTypeID                {'R','O','O','T','T','R','E','E'}
503
504 /** ROOT histogram
505  * - a histogram object exported from the HLT analysis
506  * - class derives from TH1 (directly or indirectly) and inherits all common functionality
507  * - varying origin
508  * @ingroup alihlt_component_datatypes
509  */
510 #define kAliHLTHistogramDataTypeID            {'R','O','O','T','H','I','S','T'}
511
512 /** ROOT TNtuple
513  * - a TNtupl object exported from the HLT analysis
514  * - varying origin
515  * @ingroup alihlt_component_datatypes
516  */
517 #define kAliHLTTNtupleDataTypeID              {'R','O','O','T','T','U','P','L'}
518
519 /** HLT Track
520  * - Struct for Tracks based on AliExternalTrackParam
521  * - varying origin
522  * @ingroup alihlt_component_datatypes
523  */
524 #define kAliHLTTrackDataTypeID                {'H','L','T','T','R','A','C','K'}
525
526 /** Track Monte Carlo information
527  * @ingroup alihlt_component_datatypes
528  */
529 #define kAliHLTTrackMCDataTypeID              {'T','R','A','C','K','_','M','C'}
530
531 /** TClonesArray of AliExternalTrackParam
532  * @ingroup alihlt_component_datatypes
533  */
534 #define kAliHLTExternalTrackParamDataTypeID   {'T','C','A','E','X','T','T','R'}
535
536 /** HLT Jet
537  * - Struct for jets based on AliHLTJETJets
538  * - varying origin
539  * @ingroup alihlt_component_datatypes
540  */
541 #define kAliHLTJetDataTypeID                  {'H','L','T','J','E','T','V','0'}
542
543 /** dEdx  data
544  * Common data type for the dEdx 
545  * format depends on the origin (detector)
546  * @ingroup alihlt_component_datatypes
547  */
548 # define kAliHLTdEdxDataTypeID {'D','E','D','X',' ',' ',' ',' '}
549
550 /** dNdPt  data
551  * Common data type for the dNdPt output object
552  * @ingroup alihlt_component_datatypes
553  */
554 # define kAliHLTdNdPtDataTypeID {'D','N','D','P','T',' ',' ',' '}
555
556 /** Global input trigger counters data block type.
557  * @ingroup alihlt_component_datatypes
558  */
559 # define kAliHLTInputTriggerCountersDataTypeID      {'I','N','T','R','G','C','N','T'}
560
561 /** Global output trigger counters data block type.
562  * @ingroup alihlt_component_datatypes
563  */
564 # define kAliHLTOutputTriggerCountersDataTypeID     {'O','T','T','R','G','C','N','T'}
565
566 /** Generic meta data block type ID.
567  * @ingroup alihlt_component_datatypes
568  */
569 # define kAliHLTMetaDataTypeID                      {'M','E','T','A','D','A','T','A'}
570
571 extern "C" {
572   //////////////////////////////////////////////////////////////////////////
573   //
574   // Basic HLT data types
575   //
576   //////////////////////////////////////////////////////////////////////////
577
578   typedef unsigned char AliHLTUInt8_t;
579
580   typedef signed char AliHLTInt8_t;
581
582   typedef unsigned short AliHLTUInt16_t;
583
584   typedef signed short AliHLTInt16_t;
585
586   typedef unsigned int AliHLTUInt32_t;
587
588   typedef signed int AliHLTInt32_t;
589
590   typedef unsigned long long AliHLTUInt64_t;
591
592   typedef signed long long AliHLTInt64_t;
593
594   typedef float AliHLTFloat32_t;
595
596   typedef double AliHLTFloat64_t;
597
598   typedef AliHLTUInt64_t AliHLTEventID_t;
599
600   //////////////////////////////////////////////////////////////////////////
601   //
602   // HLT logging levels
603   //
604   //////////////////////////////////////////////////////////////////////////
605
606   /**
607    * Logging severities of the HLT
608    */
609   enum AliHLTComponentLogSeverity {
610     /** no logging */
611     kHLTLogNone      = 0,
612     /** benchmark messages */
613     kHLTLogBenchmark = 0x1,
614     /** debug messages */
615     kHLTLogDebug     = 0x2,
616     /** info messages */
617     kHLTLogInfo      = 0x4,
618     /** warning messages */
619     kHLTLogWarning   = 0x8,
620     /** error messages */
621     kHLTLogError     = 0x10,
622     /** fatal error messages */
623     kHLTLogFatal     = 0x20,
624     /** few important messages not to be filtered out.
625      * redirected to kHLTLogInfo in AliRoot
626      */
627     kHLTLogImportant = 0x40,
628     /** special value to enable all messages */
629     kHLTLogAll       = 0x7f,
630     /** the default logging filter */
631     kHLTLogDefault   = 0x79
632   };
633
634   //////////////////////////////////////////////////////////////////////////
635   //
636   // HLT data structures for data exchange and external interface
637   //
638   //////////////////////////////////////////////////////////////////////////
639
640   /**
641    * @struct AliHLTComponentEventData
642    * Event descriptor
643    */
644   struct AliHLTComponentEventData
645   {
646     AliHLTUInt32_t fStructSize;        /// Size of this structure in bytes.
647     AliHLTEventID_t fEventID;          /// 64 bit event ID number.
648     AliHLTUInt32_t fEventCreation_s;   /// Event creation time in seconds (Should be added to fEventCreation_us*1e6).
649     AliHLTUInt32_t fEventCreation_us;  /// Fractional event creation time in micro seconds.
650     AliHLTUInt32_t fBlockCnt;          /// The number of raw data blocks received by the component.
651   };
652
653   /**
654    * @struct AliHLTComponentShmData
655    * Shared memory descriptor.
656    * Irrelevant for analysis components.
657    */
658   struct AliHLTComponentShmData
659   {
660     AliHLTUInt32_t fStructSize;  /// Size of this structure in bytes.
661     AliHLTUInt32_t fShmType;     /// The type code of the shared memory.
662     AliHLTUInt64_t fShmID;       /// The shared memory identifier.
663   };
664
665   /**
666    * @defgroup alihlt_component_datatypes Common Component Data Types
667    * The analysis framework defines a number of common data types for
668    * usage in the detector modules, like e.g. ::kAliHLTAnyDataType
669    * and ::kAliHLTDataTypeDDLRaw. Those data types always have
670    * origin ::kAliHLTDataOriginAny. The correct detector origin can be
671    * set by using operator '|'
672    * <pre>
673    * AliHLTComponentDataType dt=kAliHLTDDLRawDataTypeID|kAliHLTDataOriginTPC
674    * </pre>
675    * @ingroup alihlt_component
676    */
677
678   /**
679    * @struct AliHLTComponentDataType
680    * Data type descriptor for data blocks transferred through the processing
681    * chain.
682    * @ingroup alihlt_component_datatypes
683    */
684   struct AliHLTComponentDataType
685   {
686     AliHLTUInt32_t fStructSize;                            /// Size of this structure in bytes.
687     char fID[kAliHLTComponentDataTypefIDsize];             /// Data type identifier.
688     char fOrigin[kAliHLTComponentDataTypefOriginSize];     /// Subsystem or detector origin of the data.
689   };
690
691   /**
692    * @struct AliHLTComponentBlockData
693    * This is the decription of data blocks exchanged between components.
694    * \b IMPORTANT: The validity of fPtr and fOffset is different for input and
695    * output blocks:
696    * - input blocks: The \em fPtr member always points to the beginning of the data
697    *                 of size \em fSize. fOffset is ignored and should be in most
698    *                 case 0.
699    * - output blocks: The \em fPtr member is ignored by the framework. \em fOffset
700    *                  must specify the start of the data relative to the output
701    *                  buffer. The data block has size \em fSize.
702    */
703   struct AliHLTComponentBlockData
704   {
705     /** size and version of the struct */
706     AliHLTUInt32_t fStructSize;
707     /** shared memory key, ignored by processing components */
708     AliHLTComponentShmData fShmKey;
709     /** offset of output data relative to the output buffer */
710     AliHLTUInt32_t fOffset;
711     /** start of the data for input data blocks, fOffset to be ignored*/
712     void* fPtr;
713     /** size of the data block */
714     AliHLTUInt32_t fSize;
715     /** data type of the data block */
716     AliHLTComponentDataType fDataType;
717     /** data specification of the data block */
718     AliHLTUInt32_t fSpecification;
719
720     AliHLTComponentDataType GetDataType() const {return fDataType;}
721     AliHLTUInt32_t GetSpecification() const {return fSpecification;}
722   };
723
724   /**
725    * @struct AliHLTComponentEventDoneData
726    * 
727    */
728   struct AliHLTComponentEventDoneData
729   {
730     AliHLTUInt32_t fStructSize;   /// Size of this structure in bytes.
731     AliHLTUInt32_t fDataSize;     /// Size of the data section (following this data member) in bytes.
732     void* fData;                  /// Start of the data section.
733   };
734
735   /**
736    * @struct AliHLTRunDesc
737    * Event descriptor.
738    * The struct is sent with the SOR and EOR events.
739    *
740    * @note
741    * The name of the member fRunType is a bit misleading. This is not
742    * the ALICE Run Type given by the ECS to the sub-system. The member
743    * is an internal HLT run type and a combination of the HLT running
744    * mode and the beam type.
745    * <pre>
746    * Bit 0-2:   beam type identifier
747    * Bit 3-31:  HLT mode
748    * </pre>
749    */
750   struct AliHLTRunDesc
751   {
752     AliHLTUInt32_t fStructSize;   /// Size of this structure in bytes.
753     AliHLTUInt32_t fRunNo;        /// The run number for the current active run.
754     AliHLTUInt32_t fRunType;      /// The HLT run type.
755   };
756
757   /**
758    * @struct AliHLTComponentStatistics
759    * Small block size summary added by the AliHLTComponent base class
760    * if component statistics are enabled (--enable-compstat).
761    *
762    * fLevel is retrieved from incoming block statistics and incremented. 
763    * Incoming block statistics are appended to the newly added one if
764    * --enable-compstat=full has been chosen.
765    *
766    * ChangeLog:
767    *   2009-01-14 fComponentCycleTime added
768    */
769   struct AliHLTComponentStatistics
770   {
771     AliHLTUInt32_t fStructSize;           /// Size of this structure in bytes.
772     AliHLTUInt32_t fLevel;                /// Indicates from which processing stage this information is from.
773     AliHLTUInt32_t fId;                   /// Unique identifier for the chain based on CRC code.
774     AliHLTUInt32_t fTime;                 /// Real wall time used to process the data (micro seconds).
775     AliHLTUInt32_t fCTime;                /// CPU time used to process the data (micro seconds).
776     AliHLTUInt32_t fInputBlockCount;      /// Number of input data blocks.
777     AliHLTUInt32_t fTotalInputSize;       /// Total size in bytes of input data.
778     AliHLTUInt32_t fOutputBlockCount;     /// Number of output data blocks.
779     AliHLTUInt32_t fTotalOutputSize;      /// Total size in bytes of output data.
780     AliHLTUInt32_t fComponentCycleTime;   /// Real wall time indicating the start of the data processing (micro seconds).
781   };
782
783   /**
784    * @struct AliHLTComponentTableEntry
785    * Structure to be send on SOR event through the chain.
786    * The 'length' of the structure is variable and depends on the length
787    * of the buffer at the end.
788    *
789    * ComponentTableEntries are sent with data type @ref kAliHLTDataTypeComponentTable
790    * and are identified by a 32bit Id specification generated by a CRC
791    * algorithm from the chain Id of the component. This is not a 100% unique
792    * id but with a high probability. This approach accounts for the fact
793    * that all components are separated processes. 
794    *
795    * The buffer consists of an array of 32bit Ids containing the Ids of
796    * all direct parents taken from the specification of the data blocks.
797    * The number of parents is stored in fNofParents. Each component forwards the
798    * incoming component table entries with data type @ref kAliHLTDataTypeComponentFwdTable
799    * by that the direct parents can be identified.
800    *
801    * Following this array a description string contains the chain id, component args, and
802    * maybe more properties in the future. The current format is
803    * 'chain_id{component_id:component args}' e.g. TPC-CF_00_0{TPCClusterFinder32Bit:-deconvolute-time}
804    */
805   struct AliHLTComponentTableEntry
806   {
807     AliHLTUInt32_t fStructSize;           /// Size of this structure in bytes.
808     AliHLTUInt32_t fLevel;                /// Indicates from which processing stage this information is from.
809     AliHLTUInt16_t fNofParents;           /// size of the array of parent ids
810     AliHLTUInt8_t  fSizeDescription;      /// size of the description string in the appended buffer
811     AliHLTUInt8_t  fBuffer[1];            /// the strings: chain id, component args, reserved
812   };
813
814   //////////////////////////////////////////////////////////////////////////
815   //
816   // Trigger meta information
817   //
818   //////////////////////////////////////////////////////////////////////////
819
820   /** field size of fAttribute */
821   const int gkAliHLTBlockDAttributeCount = 8;
822
823   /** field size of fCommonHeader */
824   const int gkAliHLTCommonHeaderCount = 8;
825
826   /** size of the DDL list first version */
827   const int gkAliHLTDDLListSizeV0 = 30;
828
829   /** size of the DDL list after DCAL added to EMCAL */
830   const int gkAliHLTDDLListSizeV1 = 31;
831
832   /** size of the DDL list */
833   const int gkAliHLTDDLListSize = gkAliHLTDDLListSizeV1;
834
835   /** Number of Trigger Classes of CTP in CDH */
836   const int gkNCTPTriggerClasses = 50;
837
838   /**
839    * @struct AliHLTEventDDLV0
840    * First version of the DDL list event.
841    * The struct is send with the DDLLIST event.
842    * Used in the trigger structure for internal apperance of 
843    * the DLLs as well as for the HLT readout list send to DAQ 
844    * ( as DataType : kAliHLTDataTypeDDL )
845    */
846   struct AliHLTEventDDLV0
847   {
848     AliHLTUInt32_t fCount;                       /// Indicates the number of words in fList.
849     AliHLTUInt32_t fList[gkAliHLTDDLListSizeV0];   /// The list of DDL enable/disable bits.
850   };
851
852   /**
853    * @struct AliHLTEventDDLV1
854    * DDL list event structure with extra word for DCAL bits.
855    */
856   struct AliHLTEventDDLV1
857   {
858     AliHLTUInt32_t fCount;                       /// Indicates the number of words in fList.
859     AliHLTUInt32_t fList[gkAliHLTDDLListSizeV1];   /// The list of DDL enable/disable bits.
860   };
861   
862   /**
863    * @typedef AliHLTEventDDL
864    * Current used default version of the AliHLTEventDDL structure.
865    */
866   typedef AliHLTEventDDLV1 AliHLTEventDDL;
867
868   /**
869    * @struct AliHLTEventTriggerData
870    */
871   struct AliHLTEventTriggerData
872   {
873     AliHLTUInt8_t  fAttributes[gkAliHLTBlockDAttributeCount];  /// List of data block attibutes.
874     AliHLTUInt64_t fHLTStatus; /// Bit field 
875     AliHLTUInt32_t fCommonHeaderWordCnt;  /// Number of words in fCommonHeader.
876     AliHLTUInt32_t fCommonHeader[gkAliHLTCommonHeaderCount];  /// The common header words.
877     union
878     {
879       AliHLTEventDDL fReadoutList;   /// The default readout list structure.
880       AliHLTEventDDLV0 fReadoutListV0;   /// Access to the old version of the readout list structure.
881       AliHLTEventDDLV1 fReadoutListV1;   /// Access to the readout list structure with DCAL included.
882     };
883   };
884
885   /**
886    * @struct AliHLTComponentTriggerData
887    * Trigger data
888    */
889   struct AliHLTComponentTriggerData
890   {
891     AliHLTUInt32_t fStructSize;  /// Size of this structure in bytes.
892     AliHLTUInt32_t fDataSize;    /// Size of the data section (following this data member) in bytes.
893     void* fData;                 /// Start of the data section.
894   };
895
896   //////////////////////////////////////////////////////////////////////////
897   //
898   // HLT Event Type Specification
899   //
900   //////////////////////////////////////////////////////////////////////////
901
902   /** Unknown eventType specification */
903   const AliHLTUInt32_t gkAliEventTypeUnknown = ~(AliHLTUInt32_t)0;
904   /** SOR eventType specification */ 
905   const AliHLTUInt32_t gkAliEventTypeStartOfRun=1;
906   /** Data eventType specification */
907   const AliHLTUInt32_t gkAliEventTypeData=2;
908   /** EOR eventType specification */ 
909   const AliHLTUInt32_t gkAliEventTypeEndOfRun=4;
910   /** Corrupt eventType specification */
911   const AliHLTUInt32_t gkAliEventTypeCorruptID=8;
912   /** Calibration eventType specification */ 
913   const AliHLTUInt32_t gkAliEventTypeCalibration=16;
914   /** Software eventType specification */ 
915   const AliHLTUInt32_t gkAliEventTypeSoftware=24;
916   /** DataReplay eventType specification */
917   const AliHLTUInt32_t gkAliEventTypeDataReplay=32;
918   /** Configuration eventType specification */
919   const AliHLTUInt32_t gkAliEventTypeConfiguration=34;
920   /** Update DCS eventType specification */
921   const AliHLTUInt32_t gkAliEventTypeReadPreprocessor=35;
922   /** Tick eventType specification */ 
923   const AliHLTUInt32_t gkAliEventTypeTick=64;
924   /** Max eventType specification */ 
925   const AliHLTUInt32_t gkAliEventTypeMax=64;
926
927   //////////////////////////////////////////////////////////////////////////
928   //
929   // HLT defines and defaults
930   //
931   //////////////////////////////////////////////////////////////////////////
932
933   /** invalid event id 
934    * @ingroup alihlt_component_datatypes
935    */
936   const AliHLTEventID_t kAliHLTVoidEventID=~(AliHLTEventID_t)0;
937
938   /** invalid data specification 
939    * @ingroup alihlt_component_datatypes
940    */
941   const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
942
943   /** invalid run no
944    * @ingroup alihlt_component_datatypes
945    */
946   const AliHLTUInt32_t kAliHLTVoidRunNo = ~(AliHLTUInt32_t)0;
947
948   /** invalid run type
949    * @ingroup alihlt_component_datatypes
950    */
951   const AliHLTUInt32_t kAliHLTVoidRunType = ~(AliHLTUInt32_t)0;
952
953   /** invalid run descriptor
954    * @ingroup alihlt_component_datatypes
955    */
956   const AliHLTRunDesc kAliHLTVoidRunDesc={sizeof(AliHLTRunDesc), kAliHLTVoidRunNo, kAliHLTVoidRunType};
957
958   /** invalid shared memory type */
959   const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
960
961   /** invalid shared memory id */
962   const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
963
964   /** invalid data type 
965    * @ingroup alihlt_component_datatypes
966    */
967   const AliHLTComponentDataType kAliHLTVoidDataType = {
968     sizeof(AliHLTComponentDataType),
969     kAliHLTVoidDataTypeID,
970     kAliHLTDataOriginVoid
971   };
972
973   /** all data types, means any + void data type
974    * @ingroup alihlt_component_datatypes
975    */
976   const AliHLTComponentDataType kAliHLTAllDataTypes = {
977     sizeof(AliHLTComponentDataType),
978     kAliHLTAllDataTypesID,
979     kAliHLTDataOriginAny
980   };
981
982   // there is currently a problem with rootcint if the predefined ids
983   // (commented below) are used. rootcint does not find the id if they
984   // are char arrays defined with {} and individual chars. If strings
985   // are used it works fine
986   /** any data type 
987    * @ingroup alihlt_component_datatypes
988    */
989   const AliHLTComponentDataType kAliHLTAnyDataType = {
990     sizeof(AliHLTComponentDataType),
991     kAliHLTAnyDataTypeID,
992     kAliHLTDataOriginAny
993   };
994
995   /** multiple output data types 
996    * @ingroup alihlt_component_datatypes
997    */
998   extern const AliHLTComponentDataType kAliHLTMultipleDataType;
999
1000   /** data to file exchange subscriber 
1001    * @ingroup alihlt_component_datatypes
1002    */
1003   extern const AliHLTComponentDataType kAliHLTDataTypeFXSCalib;
1004
1005   /** DDL list data type 
1006    * @ingroup alihlt_component_datatypes
1007    */
1008   extern const AliHLTComponentDataType kAliHLTDataTypeDDL;
1009
1010   /** DAQ readout list 
1011    * @ingroup alihlt_component_datatypes
1012    */
1013   extern const AliHLTComponentDataType kAliHLTDataTypeDAQRDOUT;
1014
1015   /** CLUSTERS data
1016    * Common data type for the output of cluster finders, the exact
1017    * format depends on the origin (detector)
1018    * @ingroup alihlt_component_datatypes
1019    */
1020   extern const AliHLTComponentDataType kAliHLTDataTypeClusters;
1021
1022   /** SOR data type 
1023    * @ingroup alihlt_component_datatypes
1024    */
1025   extern const AliHLTComponentDataType kAliHLTDataTypeSOR;
1026
1027   /** EOR data type 
1028    * @ingroup alihlt_component_datatypes
1029    */
1030   extern const AliHLTComponentDataType kAliHLTDataTypeEOR;
1031
1032   /** Run type data block 
1033    * @ingroup alihlt_component_datatypes
1034    */
1035   extern const AliHLTComponentDataType kAliHLTDataTypeRunType;
1036
1037   /** Event type specification 
1038    * @ingroup alihlt_component_datatypes
1039    */
1040   extern const AliHLTComponentDataType kAliHLTDataTypeEvent;
1041
1042   /** ECS parameter event 
1043    * - sent during the SOR event by the framework
1044    * - contains the full ECS parameter string
1045    * @ingroup alihlt_component_datatypes
1046    */
1047   extern const AliHLTComponentDataType kAliHLTDataTypeECSParam; // {ECSPARAM:PRIV}
1048
1049   /** Configuration event data type 
1050    * @ingroup alihlt_component_datatypes
1051    */
1052   extern const AliHLTComponentDataType kAliHLTDataTypeComConf;
1053
1054   /** DCS value update event 
1055    * @ingroup alihlt_component_datatypes
1056    */
1057   extern const AliHLTComponentDataType kAliHLTDataTypeUpdtDCS;
1058
1059   /** RAW DDL data specification, origin is 'any', data publisher origin correctly 
1060    * @ingroup alihlt_component_datatypes
1061    */
1062   extern const AliHLTComponentDataType kAliHLTDataTypeDDLRaw;
1063
1064   /** AliMCEvent object data specification, origin is 'OFFL' 
1065    * @ingroup alihlt_component_datatypes
1066    */
1067   extern const AliHLTComponentDataType kAliHLTDataTypeMCObject;
1068
1069   /** ESD vertex object data specification, origin is 'any' 
1070    * @ingroup alihlt_component_datatypes
1071    */
1072   extern const AliHLTComponentDataType kAliHLTDataTypeESDVertex;
1073
1074    /** KF vertex object data specification, origin is 'any'
1075    * @ingroup alihlt_component_datatypes
1076    */
1077   extern const AliHLTComponentDataType kAliHLTDataTypeKFVertex;
1078
1079   /** global vertexer data specification, origin is 'any'
1080    * @ingroup alihlt_component_datatypes
1081    */
1082   extern const AliHLTComponentDataType kAliHLTDataTypeGlobalVertexer;
1083
1084   /** primary finder data specification, origin is 'any'
1085    * @ingroup alihlt_component_datatypes
1086    */
1087   extern const AliHLTComponentDataType kAliHLTDataTypePrimaryFinder;
1088
1089   /** primary finder data specification, origin is 'any'
1090    * @ingroup alihlt_component_datatypes
1091    */
1092   extern const AliHLTComponentDataType kAliHLTDataTypeV0Finder;
1093
1094   /** ESD object data specification, origin is 'any' 
1095    * @ingroup alihlt_component_datatypes
1096    */
1097   extern const AliHLTComponentDataType kAliHLTDataTypeESDObject;
1098
1099   /** ESD content data specification, origin is 'any' 
1100    * @ingroup alihlt_component_datatypes
1101    */
1102   extern const AliHLTComponentDataType kAliHLTDataTypeESDContent;
1103
1104   /** ESD Tree data specification, origin is 'any' 
1105    * @ingroup alihlt_component_datatypes
1106    */
1107   extern const AliHLTComponentDataType kAliHLTDataTypeESDTree;
1108
1109   /** AliRoot TreeD data specification, origin is 'any' 
1110    * @ingroup alihlt_component_datatypes
1111    */
1112   extern const AliHLTComponentDataType kAliHLTDataTypeAliTreeD;
1113
1114   /** AliRoot TreeR data specification, origin is 'any' 
1115    * @ingroup alihlt_component_datatypes
1116    */
1117   extern const AliHLTComponentDataType kAliHLTDataTypeAliTreeR;
1118
1119   /** 16 bit Hardware address selection data specification, origin is 'any' 
1120    * @ingroup alihlt_component_datatypes
1121    */
1122   extern const AliHLTComponentDataType kAliHLTDataTypeHwAddr16;
1123
1124   /** Event statistics 
1125    * @ingroup alihlt_component_datatypes
1126    */
1127   extern const AliHLTComponentDataType kAliHLTDataTypeEventStatistics;
1128
1129   /** Event summary 
1130    * @ingroup alihlt_component_datatypes
1131    */
1132   extern const AliHLTComponentDataType kAliHLTDataTypeEventSummary;
1133
1134   /** Event statistics 
1135    * @ingroup alihlt_component_datatypes
1136    */
1137   extern const AliHLTComponentDataType kAliHLTDataTypeRunStatistics;
1138
1139   /** Run summary 
1140    * @ingroup alihlt_component_datatypes
1141    */
1142   extern const AliHLTComponentDataType kAliHLTDataTypeRunSummary;
1143
1144   /** Trigger decision
1145    * - origin : kAliHLTDataOriginOut ( HLT )
1146    * @ingroup alihlt_component_datatypes
1147    */
1148   extern const AliHLTComponentDataType kAliHLTDataTypeTriggerDecision;   // {TRIG_DEC:HLT }
1149
1150   /** Trigger decision
1151    * - origin : kAliHLTDataOriginOut ( HLT )
1152    * @ingroup alihlt_component_datatypes
1153    */
1154   extern const AliHLTComponentDataType kAliHLTDataTypeReadoutList;   // {HLTRDLST:HLT }
1155
1156   /** Global trigger decision
1157    * - origin : kAliHLTDataOriginOut ( HLT )
1158    * @ingroup alihlt_component_datatypes
1159    */
1160   extern const AliHLTComponentDataType kAliHLTDataTypeGlobalTrigger;     // {GLOBTRIG:HLT }
1161
1162   /** Component block statistics
1163    * @ingroup alihlt_component_datatypes
1164    */
1165   extern const AliHLTComponentDataType kAliHLTDataTypeComponentStatistics;
1166
1167   /** Component table
1168    * To be sent on SOR event, each component adds it's chain id string
1169    * and a generated 32bit identifier to the table
1170    * @ingroup alihlt_component_datatypes
1171    */
1172   extern const AliHLTComponentDataType kAliHLTDataTypeComponentTable;
1173
1174   /** Forwarded component table
1175    * To be sent on SOR event, each component forwards blocks of type
1176    * @ref kAliHLTDataTypeComponentTable was kAliHLTDataTypeComponentFwdTable
1177    * after adding the parent ids to its own table struct.
1178    * @ingroup alihlt_component_datatypes
1179    */
1180   extern const AliHLTComponentDataType kAliHLTDataTypeComponentFwdTable;
1181
1182   /**
1183    * Data type for the Common Data Header and readout list information sent by TCPDumpSubscriber.
1184    * @ingroup alihlt_component_datatypes
1185    */
1186   extern const AliHLTComponentDataType kAliHLTDataTypeTriggerMetaBlock;     // {METADATA:PRIV}
1187
1188   //////////////////////////////////////////////////////////////////////////
1189   //
1190   // Data Types for Monitoring objects
1191   //
1192   //////////////////////////////////////////////////////////////////////////
1193
1194   /** general ROOT TObject 
1195    * @ingroup alihlt_component_datatypes
1196    */
1197   extern const AliHLTComponentDataType kAliHLTDataTypeTObject;            // {ROOTTOBJ,"***"}
1198
1199   /** ROOT streamer info
1200    * @ingroup alihlt_component_datatypes
1201    */
1202   extern const AliHLTComponentDataType kAliHLTDataTypeStreamerInfo;       // {ROOTSTRI,HLT }
1203                                                                                         
1204   /** ROOT TObjArray 
1205    * @ingroup alihlt_component_datatypes
1206    */                                                                   
1207   extern const AliHLTComponentDataType kAliHLTDataTypeTObjArray;          // {ROOTOBAR,"***"}
1208                                                                                         
1209   /** ROOT TTree 
1210    * @ingroup alihlt_component_datatypes
1211    */                                                                   
1212   extern const AliHLTComponentDataType kAliHLTDataTypeTTree;              // {ROOTTREE,"***"}
1213                                                                                         
1214   /** ROOT TH1 (can be used for all histograms, they derive from TH1) 
1215    * @ingroup alihlt_component_datatypes
1216    */           
1217   extern const AliHLTComponentDataType kAliHLTDataTypeHistogram;          // {ROOTHIST,"***"}
1218                                                                                         
1219   /** ROOT TNtuple 
1220    * @ingroup alihlt_component_datatypes
1221    */                                                                   
1222   extern const AliHLTComponentDataType kAliHLTDataTypeTNtuple;            // {ROOTTUPL,"***"}
1223
1224   /** Global input trigger counters.
1225    * - origin : kAliHLTDataOriginOut ( HLT )
1226    * @ingroup alihlt_component_datatypes
1227    */
1228   extern const AliHLTComponentDataType kAliHLTDataTypeInputTriggerCounters;     // {INTRGCNT:HLT }
1229
1230   /** Global output trigger counters.
1231    * - origin : kAliHLTDataOriginOut ( HLT )
1232    * @ingroup alihlt_component_datatypes
1233    */
1234   extern const AliHLTComponentDataType kAliHLTDataTypeOutputTriggerCounters;     // {OTTRGCNT:HLT }
1235
1236   /** General track array for the barrel tracks based on AliExternalTrackParam
1237    * Data format defined by AliHLTTracksData
1238    *
1239    * We follow the naming scheme of AliESDEvent where 'Tracks' denote the
1240    * barrel tracks and detector tracks get names 'DETTracks'
1241    * @ingroup alihlt_component_datatypes
1242    */   
1243   extern const AliHLTComponentDataType kAliHLTDataTypeTrack;              // {HLTTRACK,"***"}
1244
1245   /** Track Monte Carlo information
1246    */
1247   extern const AliHLTComponentDataType kAliHLTDataTypeTrackMC;            // {TRACK_MC,"***"}
1248
1249   /** TClonesArray of AliExternalTrackParam
1250    * @ingroup alihlt_component_datatypes
1251    */   
1252   extern const AliHLTComponentDataType kAliHLTDataTypeExternalTrackParam; // {TCAEXTTR,"***"}
1253
1254   /** Container containing jets (AliHLTJETJets)
1255    * Containing TClonesArray of AliAODJets 
1256    * @ingroup alihlt_component_datatypes
1257    */   
1258   extern const AliHLTComponentDataType kAliHLTDataTypeJet;                // {HLTJETV0,"***"}
1259   
1260   /** Container of ITS tracks
1261    * @ingroup alihlt_component_datatypes
1262    */   
1263   extern const AliHLTComponentDataType fgkITSTracksDataType;
1264
1265   /** Container of calorimeter clusters
1266    * @ingroup alihlt_component_datatypes
1267    */   
1268   extern const AliHLTComponentDataType kAliHLTDataTypeCaloCluster; 
1269
1270   /** Container of dEdx
1271    * @ingroup alihlt_component_datatypes
1272    */
1273   extern const AliHLTComponentDataType kAliHLTDataTypedEdx;
1274
1275   /** Container of dNdPt
1276    * @ingroup alihlt_component_datatypes
1277    */
1278   extern const AliHLTComponentDataType kAliHLTDataTypedNdPt;
1279
1280   //////////////////////////////////////////////////////////////////////////
1281   //
1282   // FXS subscriber meta information
1283   //
1284   //////////////////////////////////////////////////////////////////////////
1285
1286   const int gkAliHLTFXSHeaderfOriginSize = 4;
1287   const int gkAliHLTFXSHeaderfFileIDSize = 128;
1288   const int gkAliHLTFXSHeaderfDDLNumberSize = 64;
1289
1290   /** Header in front of the data payload, in order to sent data to the FXS. */
1291   struct AliHLTFXSHeader
1292   {
1293     AliHLTUInt32_t fHeaderVersion;   /// HLT software version number.
1294     AliHLTUInt32_t fRunNumber;       /// The current run number.
1295     char fOrigin[gkAliHLTFXSHeaderfOriginSize];   /// The detector from which the FXS data is received.
1296     char fFileID[gkAliHLTFXSHeaderfFileIDSize];   /// File identifier for the stored data.
1297     char fDDLNumber[gkAliHLTFXSHeaderfDDLNumberSize];  /// The DDL bits.
1298   };  
1299
1300   //////////////////////////////////////////////////////////////////////////
1301   //
1302   // Component running environment
1303   //
1304   //////////////////////////////////////////////////////////////////////////
1305
1306   /** definition of a void fct pointer */
1307   typedef void (*AliHLTfctVoid)();
1308
1309   /** logging function */
1310   typedef int (*AliHLTfctLogging)( void* param, 
1311                                    AliHLTComponentLogSeverity severity,
1312                                    const char* origin,
1313                                    const char* keyword,
1314                                    const char* message);
1315
1316   /**
1317    * @struct AliHLTAnalysisEnvironment
1318    * Running environment for analysis components.
1319    * The struct describes function callbacks for actions to be
1320    * carried out by the calling framework, like memory allocation,
1321    * property callbecks, logging, etc.
1322    *
1323    * @ingroup alihlt_wrapper_interface
1324    */
1325   struct AliHLTAnalysisEnvironment
1326   {
1327     /** size of the structure */
1328     AliHLTUInt32_t fStructSize;
1329
1330     /** the component parameter given by the framework on creation */
1331     void* fParam;
1332
1333     /** allocated memory */
1334     void* (*fAllocMemoryFunc)( void* param, unsigned long size );
1335
1336     /** allocate an EventDoneData structure. */
1337     int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
1338
1339     /** logging callback */
1340     AliHLTfctLogging fLoggingFunc;
1341   };
1342 #if 0
1343   // I just keep this as a note pad. Has to be added to the end of the structure
1344   // future addition already foreseen/envisioned
1345   // IMPORTANT: don not just remove the defines as this breaks the binary
1346   // compatibility
1347   int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
1348 #endif
1349
1350   /**
1351    * @struct AliHLTComponentEnvironment
1352    * This was the original definition of the running environment.
1353    * Due to a bug in the AliRootWrapperSubscriber/SimpleComponentWrapper,
1354    * this structure can not be used any longer but is kept for backward
1355    * compatibility. 
1356    * @note The external interface provided by the libHLTbase is now kept
1357    * frozen but should not be used any more. Use the interface provided
1358    * by the libHLTinterface library.
1359    *
1360    * @ingroup alihlt_wrapper_interface_deprecated
1361    */
1362   struct AliHLTComponentEnvironment
1363   {
1364     AliHLTUInt32_t fStructSize;
1365     void* fParam;
1366     void* (*fAllocMemoryFunc)( void* param, unsigned long size );
1367     int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
1368     AliHLTfctLogging fLoggingFunc;
1369   };
1370
1371   //////////////////////////////////////////////////////////////////////////
1372   //
1373   // The external interface definition
1374   //
1375   //////////////////////////////////////////////////////////////////////////
1376
1377   /**
1378    * The component handle.
1379    * Used as indification in the outside world.
1380    * @ingroup alihlt_wrapper_interface
1381    */
1382   typedef void* AliHLTComponentHandle;
1383
1384   /** @ingroup alihlt_wrapper_interface */
1385   const AliHLTComponentHandle kEmptyHLTComponentHandle = 0;
1386
1387   /**
1388    * Get a system call of the interface.
1389    * @param function signature
1390    * @return pointer to system call
1391    * @ingroup alihlt_wrapper_interface
1392    */
1393   typedef void* (*AliHLTAnalysisFctGetInterfaceCall)(const char*);
1394
1395 # define ALIHLTANALYSIS_INTERFACE_LIBRARY  "libHLTinterface.so"
1396 # define ALIHLTANALYSIS_FCT_GETINTERFACECALL  "AliHLTAnalysisGetInterfaceCall"
1397
1398   /** @ingroup alihlt_wrapper_interface */
1399   typedef int (*AliHLTExtFctInitSystem)( unsigned long version, AliHLTAnalysisEnvironment* externalEnv, unsigned long runNo, const char* runType );
1400
1401   /** @ingroup alihlt_wrapper_interface */
1402   typedef int (*AliHLTExtFctDeinitSystem)();
1403
1404   /** @ingroup alihlt_wrapper_interface */
1405   typedef int (*AliHLTExtFctLoadLibrary)( const char* );
1406
1407   /** @ingroup alihlt_wrapper_interface */
1408   typedef int (*AliHLTExtFctUnloadLibrary)( const char* );
1409
1410   /** @ingroup alihlt_wrapper_interface */
1411   typedef int (*AliHLTExtFctCreateComponent)( const char*, void*, int, const char**, AliHLTComponentHandle*, const char* description );
1412
1413   /** @ingroup alihlt_wrapper_interface */
1414   typedef int (*AliHLTExtFctDestroyComponent)( AliHLTComponentHandle );
1415
1416   /** @ingroup alihlt_wrapper_interface */
1417   typedef int (*AliHLTExtFctProcessEvent)( AliHLTComponentHandle, const AliHLTComponentEventData*, const AliHLTComponentBlockData*, 
1418                                            AliHLTComponentTriggerData*, AliHLTUInt8_t*,
1419                                            AliHLTUInt32_t*, AliHLTUInt32_t*, 
1420                                            AliHLTComponentBlockData**,
1421                                            AliHLTComponentEventDoneData** );
1422
1423   /** @ingroup alihlt_wrapper_interface */
1424   typedef int (*AliHLTExtFctGetOutputDataType)( AliHLTComponentHandle, AliHLTComponentDataType* );
1425
1426   /** @ingroup alihlt_wrapper_interface */
1427   typedef int (*AliHLTExtFctGetOutputSize)( AliHLTComponentHandle, unsigned long*, double* );
1428
1429 }
1430
1431 using namespace std;
1432
1433 //////////////////////////////////////////////////////////////////////////
1434 //
1435 // Data type helper functions
1436 //
1437 //////////////////////////////////////////////////////////////////////////
1438
1439 /** exact comparison of HLT component data types
1440  * @ingroup alihlt_component_datatypes
1441  */
1442 inline bool MatchExactly( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
1443 {
1444   for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
1445     if ( dt1.fID[i] != dt2.fID[i] )
1446       return false;
1447   for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
1448     if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
1449       return false;
1450   return true;
1451 }
1452
1453 /** Comparison operator for HLT component data types.
1454  * The operator takes wildcards into account, i.e. the ::kAliHLTAnyDataType,
1455  * ::kAliHLTAnyDataTypeID and ::kAliHLTDataOriginAny definitions.
1456  * @ingroup alihlt_component_datatypes
1457  */
1458 inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
1459 {
1460   if (MatchExactly(dt1, kAliHLTAllDataTypes)) return true;
1461   if (MatchExactly(dt2, kAliHLTAllDataTypes)) return true;
1462
1463   bool any1=true, any2=true, void1=true, void2=true, match=true;
1464   for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ ) {
1465     any1&=(dt1.fOrigin[i]==kAliHLTDataOriginAny[i]);
1466     any2&=(dt2.fOrigin[i]==kAliHLTDataOriginAny[i]);
1467     void1&=(dt1.fOrigin[i]==kAliHLTDataOriginVoid[i]);
1468     void2&=(dt2.fOrigin[i]==kAliHLTDataOriginVoid[i]);
1469     match&=dt1.fOrigin[i]==dt2.fOrigin[i];
1470     if (!(match || (any2 && !void1) || (any1 && !void2)))
1471       return false;
1472   }
1473
1474   any1=true, any2=true, match=true;
1475   for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ ) {
1476     any1&=(dt1.fID[i]==kAliHLTAnyDataTypeID[i]);
1477     any2&=(dt2.fID[i]==kAliHLTAnyDataTypeID[i]);
1478     void1&=(dt1.fID[i]==kAliHLTVoidDataTypeID[i]);
1479     void2&=(dt2.fID[i]==kAliHLTVoidDataTypeID[i]);
1480     match&=dt1.fID[i]==dt2.fID[i];
1481     if (!(match || (any2 && !void1) || (any1 && !void2)))
1482       return false;
1483   }
1484   return true;
1485 }
1486
1487 /** Comparison operator for HLT component data types
1488  * Invers of operator==
1489  * @ingroup alihlt_component_datatypes
1490  */
1491 inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
1492 {
1493   return !(dt1==dt2);
1494 }
1495
1496 /** merge operator for HLT component data types and origins
1497  * @ingroup alihlt_component_datatypes
1498  */
1499 inline AliHLTComponentDataType operator|(const AliHLTComponentDataType srcdt, const char origin[kAliHLTComponentDataTypefOriginSize])
1500 {
1501   AliHLTComponentDataType dt=srcdt;
1502   for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
1503     dt.fOrigin[i]=origin[i];
1504   return dt;
1505 }
1506
1507 /**
1508  * Helper function to initialize a data type from an id char array and origin string.
1509  * @return data type structure initialized with the specified id and origin
1510  * @ingroup alihlt_component_datatypes
1511  */
1512 inline AliHLTComponentDataType AliHLTComponentDataTypeInitializer(const char id[kAliHLTComponentDataTypefIDsize], const char* origin)
1513 {
1514   AliHLTComponentDataType dt=kAliHLTVoidDataType;
1515   int i=0;
1516   for (i = 0; i < kAliHLTComponentDataTypefIDsize && id[i]!=0; i++)
1517     dt.fID[i]=id[i];
1518   for (i = 0; i < kAliHLTComponentDataTypefOriginSize && origin[i]!=0; i++ )
1519     dt.fOrigin[i]=origin[i];
1520   return dt;
1521 }
1522
1523 /**
1524  * Helper function to initialize a data type from a default data type and
1525  * an origin string. Basically it merges the specified origin into the data
1526  * type.
1527  * @return data type structure initialized with the id from specified data type
1528  *         and origin
1529  * @ingroup alihlt_component_datatypes
1530  */
1531 inline AliHLTComponentDataType AliHLTComponentDataTypeInitializer(const AliHLTComponentDataType src, const char* origin)
1532 {
1533   return AliHLTComponentDataTypeInitializer(src.fID, origin);
1534 }
1535
1536 #endif