]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTDataTypes.h
Adding custom linkdef file so that dictionaries are correctly generated for AliHLTTri...
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDataTypes.h
index 573c9311cf7637e123d4d8e0095447bcfd7cd5f1..ef2410b8546d968a1ee334ad29dcafc69861ba90 100644 (file)
  *           specs
  *   5       Data types for Run and Event summary, and for monitoring added
  *   6       Common data types for TreeD and TreeR defined
- *           kAliHLTAllDataTypes added
+ *           kAliHLTAllDataTypes and kAliHLTDataOriginSample added
+ *           kAliHLTDataOriginEMCAL added
+ *           kAliHLTDataTypeRunType added
+ *   7       kAliHLTDataTypeComponentStatistics, kAliHLTDataTypeComponentTable,
+ *           and AliHLTComponentStatistics have been added for optional
+ *           component block statistics
+ *   8       new wrapper interface has been introduced, old wrapper interface
+ *           deprecated but kept for backward compatibility, the PubSub
+ *           interface is going to be compiled independently of AliHLT, new
+ *           interface provided by the libHLTinterface.so
+ *           AliHLTComponentEnvironment -> AliHLTAnalysisEnvironment
+ *   9       added data types for arrays of AliHLTExternalTrackParam sets and
+ *           TClonesArrays of AliExternalTrackParam objects.
+ *  10       Changes for information objects neededfor running with offline
+ *           chains and analysis tasks.
+ *           kAliHLTMCObjectDataType added
+ *           kAliHLTDataOriginOffline added
+ *           kAliHLTDataOriginHLT added
  */
-#define ALIHLT_DATA_TYPES_VERSION 6
+#define ALIHLT_DATA_TYPES_VERSION 10
 
 //////////////////////////////////////////////////////////////////////////
 //
@@ -43,7 +60,7 @@
 // the operator|
 //
 // AliHLTComponentDataType dt;
-// dt = kAliHLTDataTypeDDLRaw | gkAliHLTDataOriginTPC;
+// dt = kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC;
 //
 //////////////////////////////////////////////////////////////////////////
 
@@ -72,6 +89,17 @@ const int kAliHLTComponentDataTypefOriginSize=4;
  */
 extern const char kAliHLTDataOriginOut[kAliHLTComponentDataTypefOriginSize];
 
+/** Data origin HLT, used for HLT specifc data 
+ *  in offline chains. This not a bug!
+ * @ingroup alihlt_component_datatypes
+ */
+extern const char kAliHLTDataOriginHLT[kAliHLTComponentDataTypefOriginSize];
+
+/** Data origin Offline 
+ * @ingroup alihlt_component_datatypes
+ */
+extern const char kAliHLTDataOriginOffline[kAliHLTComponentDataTypefOriginSize];
+
 /** Data origin HLT/PubSub private internal 
  * @ingroup alihlt_component_datatypes
  */
@@ -87,6 +115,11 @@ extern const char kAliHLTDataOriginTPC[kAliHLTComponentDataTypefOriginSize];
  */
 extern const char kAliHLTDataOriginPHOS[kAliHLTComponentDataTypefOriginSize];
 
+/** Data origin FMD
+ * @ingroup alihlt_component_datatypes
+ */
+extern const char kAliHLTDataOriginFMD[kAliHLTComponentDataTypefOriginSize];
+
 /** Data origin MUON 
  * @ingroup alihlt_component_datatypes
  */
@@ -102,6 +135,31 @@ extern const char kAliHLTDataOriginTRD[kAliHLTComponentDataTypefOriginSize];
  */
 extern const char kAliHLTDataOriginITS[kAliHLTComponentDataTypefOriginSize];
 
+/** Data origin ITS SPD
+ * @ingroup alihlt_component_datatypes
+ */
+extern const char kAliHLTDataOriginITSSPD[kAliHLTComponentDataTypefOriginSize];
+
+/** Data origin ITS SDD
+ * @ingroup alihlt_component_datatypes
+ */
+extern const char kAliHLTDataOriginITSSDD[kAliHLTComponentDataTypefOriginSize];
+
+/** Data origin ITS SSD
+ * @ingroup alihlt_component_datatypes
+ */
+extern const char kAliHLTDataOriginITSSSD[kAliHLTComponentDataTypefOriginSize];
+
+/** Data origin for examples 
+ * @ingroup alihlt_component_datatypes
+ */
+extern const char kAliHLTDataOriginSample[kAliHLTComponentDataTypefOriginSize];
+
+/** Data origin EMCAL 
+ * @ingroup alihlt_component_datatypes
+ */
+extern const char kAliHLTDataOriginEMCAL[kAliHLTComponentDataTypefOriginSize];
+
 //////////////////////////////////////////////////////////////////////////
 //
 // HLT common data type defines
@@ -151,6 +209,12 @@ const int kAliHLTComponentDataTypefIDsize=8;
  */
 # define kAliHLTEORDataTypeID      {'E','N','D','O','F','R','U','N'}
 
+/** run type data block
+ * string with run type as payload
+ * @ingroup alihlt_component_datatypes
+ */
+# define kAliHLTRunTypeDataTypeID  {'R','U','N','T','Y','P','E',' '}
+
 /** DDL list event 
  * @ref AliHLTEventDDL
  * @ingroup alihlt_component_datatypes
@@ -175,6 +239,13 @@ const int kAliHLTComponentDataTypefIDsize=8;
  */
 # define kAliHLTUpdtDCSDataTypeID  {'U','P','D','T','_','D','C','S'}
 
+/** MC data block
+ * an AliMCEvent object of varying origin
+ * The 'V0' at the end allows a versioning
+ * @ingroup alihlt_component_datatypes
+ */
+# define kAliHLTMCObjectDataTypeID    {'A','L','I','M','C','_','V','0'}
+
 /** ESD data block
  * an AliESD object of varying origin
  * The 'V0' at the end allows a versioning
@@ -198,7 +269,7 @@ const int kAliHLTComponentDataTypefIDsize=8;
  * - the rec points tree of an AliRoot module
  * @ingroup alihlt_component_datatypes
  */
-#define kAliHLTTreeRDataTypeID         {'A','L','I','T','R','E','E','D'}
+#define kAliHLTTreeRDataTypeID         {'A','L','I','T','R','E','E','R'}
 
 /** HW Address selection data block
  * - a selection list for 16 bit HW addresses
@@ -235,6 +306,21 @@ const int kAliHLTComponentDataTypefIDsize=8;
  */
 # define kAliHLTRunSummaryDataTypeID          {'R','U','N','S','U','M','M','A'}
 
+/** Block Statistics
+ * - small block statistics info added to the data stream by
+ *   the component base class
+ * - origin kAliHLTDataOriginPrivate
+ * @ingroup alihlt_component_datatypes
+ */
+# define kAliHLTComponentStatisticsDataTypeID {'C','O','M','P','S','T','A','T'}
+
+/** Component table
+ * - list of components in the chain to be percolated through the chain
+ * - each component adds it's chain id string and a generated 32bit id
+ * @ingroup alihlt_component_datatypes
+ */
+# define kAliHLTComponentTableDataTypeID      {'C','O','M','P','T','A','B','L'}
+
 /** general ROOT TObject
  * - a general TObject exported from the HLT analysis
  * - varying origin
@@ -271,6 +357,18 @@ const int kAliHLTComponentDataTypefIDsize=8;
  */
 #define kAliHLTTNtupleDataTypeID              {'R','O','O','T','T','U','P','L'}
 
+/** HLT Track
+ * - Struct for Tracks based on AliExternalTrackParam
+ * - varying origin
+ * @ingroup alihlt_component_datatypes
+ */
+#define kAliHLTTrackDataTypeID                {'H','L','T','T','R','A','C','K'}
+
+/** TClonesArray of AliExternalTrackParam
+ * @ingroup alihlt_component_datatypes
+ */
+#define kAliHLTExternalTrackParamDataTypeID   {'T','C','A','E','X','T','T','R'}
+
 using namespace std;
 
 extern "C" {
@@ -334,7 +432,7 @@ extern "C" {
     kHLTLogAll       = 0x7f,
     /** the default logging filter */
     kHLTLogDefault   = 0x79
-};
+  };
 
   //////////////////////////////////////////////////////////////////////////
   //
@@ -389,8 +487,8 @@ extern "C" {
   struct AliHLTComponentDataType
   {
     AliHLTUInt32_t fStructSize;
-    char fID[kAliHLTComponentDataTypefIDsize];                      //!
-    char fOrigin[kAliHLTComponentDataTypefOriginSize];              //!
+    char fID[kAliHLTComponentDataTypefIDsize];                      ///
+    char fOrigin[kAliHLTComponentDataTypefOriginSize];              ///
   };
 
   /**
@@ -437,7 +535,17 @@ extern "C" {
   /**
    * @struct AliHLTRunDesc
    * Event descriptor.
-   * The struct is send with the SOR and EOR events.
+   * The struct is sent with the SOR and EOR events.
+   *
+   * @note
+   * The name of the member fRunType is a bit misleading. This is not
+   * the ALICE Run Type given by the ECS to the sub-system. The member
+   * is an internal HLT run type and a combination of the HLT running
+   * mode and the beam type.
+   * <pre>
+   * Bit 0-2:   beam type identifier
+   * Bit 3-31:  HLT mode
+   * </pre>
    */
   struct AliHLTRunDesc
   {
@@ -446,6 +554,51 @@ extern "C" {
     AliHLTUInt32_t fRunType;
   };
 
+  /**
+   * @struct AliHLTComponentStatistics
+   * Small block size summary added by the AliHLTComponent base class
+   * if component statistics are enabled (--enable-compstat).
+   *
+   * fLevel is retrieved from incoming block statistics and incremented. 
+   * Incoming block statistics are appended to the newly added one if
+   * --enable-compstat=full has been chosen.
+   */
+  struct AliHLTComponentStatistics
+  {
+    AliHLTUInt32_t fStructSize;
+    AliHLTUInt32_t fLevel;
+    AliHLTUInt32_t fId;
+    AliHLTUInt32_t fTime;
+    AliHLTUInt32_t fCTime;
+    AliHLTUInt32_t fInputBlockCount;
+    AliHLTUInt32_t fTotalInputSize;
+    AliHLTUInt32_t fOutputBlockCount;
+    AliHLTUInt32_t fTotalOutputSize;
+  };
+
+  /**
+   * @struct AliHLTComponentTableEntry
+   * Structure to be send on SOR event through the chain. Each component
+   * adds its chain id and component arguments to the list.
+   * The 'length' of the structure is variable and depends on the length
+   * of the strings in the buffer at the end.
+   *
+   * ComponentTableEntries are identified by a 32bit Id generated by a CRC
+   * algorithm from the chain Id of the component. This is not a 100% unique
+   * id but with a high probability. This approach accounts for the fact
+   * that all components are separated processes.
+   */
+  struct AliHLTComponentTableEntry
+  {
+    AliHLTUInt32_t fStructSize;
+    /** size of the array of parent ids */
+    AliHLTUInt16_t fNofParents;
+    /** size of the description string in the appended buffer */
+    AliHLTUInt8_t  fSizeDescription;
+    /** the strings: chain id, component args, reserved */
+    AliHLTUInt8_t  fBuffer[1];
+  };
+
   //////////////////////////////////////////////////////////////////////////
   //
   // Trigger meta information
@@ -456,7 +609,7 @@ extern "C" {
   const int gkAliHLTBlockDAttributeCount = 8;
 
   /** field size of fCommonHeader */
-   const int gkAliHLTCommonHeaderCount = 8;
+  const int gkAliHLTCommonHeaderCount = 8;
 
   /** size of the DDL list */
   const int gkAliHLTDDLListSize = 30;
@@ -546,6 +699,21 @@ extern "C" {
    */
   const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
 
+  /** invalid run no
+   * @ingroup alihlt_component_datatypes
+   */
+  const AliHLTUInt32_t kAliHLTVoidRunNo = ~(AliHLTUInt32_t)0;
+
+  /** invalid run type
+   * @ingroup alihlt_component_datatypes
+   */
+  const AliHLTUInt32_t kAliHLTVoidRunType = ~(AliHLTUInt32_t)0;
+
+  /** invalid run descriptor
+   * @ingroup alihlt_component_datatypes
+   */
+  const AliHLTRunDesc kAliHLTVoidRunDesc={sizeof(AliHLTRunDesc), kAliHLTVoidRunNo, kAliHLTVoidRunType};
+
   /** invalid shared memory type */
   const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
 
@@ -608,6 +776,11 @@ extern "C" {
    */
   extern const AliHLTComponentDataType kAliHLTDataTypeEOR;
 
+  /** Run type data block 
+   * @ingroup alihlt_component_datatypes
+   */
+  extern const AliHLTComponentDataType kAliHLTDataTypeRunType;
+
   /** Event type specification 
    * @ingroup alihlt_component_datatypes
    */
@@ -628,13 +801,17 @@ extern "C" {
    */
   extern const AliHLTComponentDataType kAliHLTDataTypeDDLRaw;
 
+  /** AliMCEvent object data specification, origin is 'OFFL' 
+   * @ingroup alihlt_component_datatypes
+   */
+  extern const AliHLTComponentDataType kAliHLTDataTypeMCObject;
+
   /** ESD object data specification, origin is 'any' 
    * @ingroup alihlt_component_datatypes
    */
   extern const AliHLTComponentDataType kAliHLTDataTypeESDObject;
 
   /** ESD Tree data specification, origin is 'any' 
-   
    * @ingroup alihlt_component_datatypes
    */
   extern const AliHLTComponentDataType kAliHLTDataTypeESDTree;
@@ -674,6 +851,18 @@ extern "C" {
    */
   extern const AliHLTComponentDataType kAliHLTDataTypeRunSummary;
 
+  /** Component block statistics
+   * @ingroup alihlt_component_datatypes
+   */
+  extern const AliHLTComponentDataType kAliHLTDataTypeComponentStatistics;
+
+  /** Component table
+   * To be sent on SOR event, each component adds it's chain id string
+   * and a generated 32bit identifier to the table
+   * @ingroup alihlt_component_datatypes
+   */
+  extern const AliHLTComponentDataType kAliHLTDataTypeComponentTable;
+
   //////////////////////////////////////////////////////////////////////////
   //
   // Data Types for Monitoring objects
@@ -705,6 +894,20 @@ extern "C" {
    */                                                                  
   extern const AliHLTComponentDataType kAliHLTDataTypeTNtuple;           // {ROOTTUPL,"***"}
 
+  /** General track array for the barrel tracks based on AliExternalTrackParam
+   * Data format defined by AliHLTTracksData
+   *
+   * We follow the naming scheme of AliESDEvent where 'Tracks' denote the
+   * barrel tracks and detector tracks get names 'DETTracks'
+   * @ingroup alihlt_component_datatypes
+   */  
+  extern const AliHLTComponentDataType kAliHLTDataTypeTrack;             // {HLTTRACK,"***"}
+
+  /** TClonesArray of AliExternalTrackParam
+   * @ingroup alihlt_component_datatypes
+   */  
+  extern const AliHLTComponentDataType kAliHLTDataTypeExternalTrackParam;// {TCAEXTTR,"***"}
+
   //////////////////////////////////////////////////////////////////////////
   //
   // FXS subscriber meta information
@@ -739,24 +942,122 @@ extern "C" {
                                   const char* message);
 
   /**
-   * @struct AliHLTComponentEnvironment
+   * @struct AliHLTAnalysisEnvironment
    * Running environment for analysis components.
-   * The struct describes function callbacks for 
+   * The struct describes function callbacks for actions to be
+   * carried out by the calling framework, like memory allocation,
+   * property callbecks, logging, etc.
+   *
+   * @ingroup alihlt_wrapper_interface
    */
-  struct AliHLTComponentEnvironment
+  struct AliHLTAnalysisEnvironment
   {
+    /** size of the structure */
     AliHLTUInt32_t fStructSize;
+
+    /** the component parameter given by the framework on creation
+     */
     void* fParam;
+
+    /** allocated memory
+     */
     void* (*fAllocMemoryFunc)( void* param, unsigned long size );
+
+    /** allocate an EventDoneData structure.
+     */
+    int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
+
+    /** logging callback
+     */
+    AliHLTfctLogging fLoggingFunc;
+  };
 #if 0
-    // future addition already foreseen/envisioned
-    // IMPORTANT: don not just remove the defines as this breaks the binary
-    // compatibility
-    int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
+  // I just keep this as a note pad. Has to be added to the end of the structure
+  // future addition already foreseen/envisioned
+  // IMPORTANT: don not just remove the defines as this breaks the binary
+  // compatibility
+  int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation );
 #endif
+
+  /**
+   * @struct AliHLTComponentEnvironment
+   * This was the original definition of the running environment.
+   * Due to a bug in the AliRootWrapperSubscriber/SimpleComponentWrapper,
+   * this structure can not be used any longer but is kept for backward
+   * compatibility. 
+   * @note The external interface provided by the libHLTbase is now kept
+   * frozen but should not be used any more. Use the interface provided
+   * by the libHLTinterface library.
+   *
+   * @ingroup alihlt_wrapper_interface_deprecated
+   */
+  struct AliHLTComponentEnvironment
+  {
+    AliHLTUInt32_t fStructSize;
+    void* fParam;
+    void* (*fAllocMemoryFunc)( void* param, unsigned long size );
     int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
     AliHLTfctLogging fLoggingFunc;
   };
+
+  //////////////////////////////////////////////////////////////////////////
+  //
+  // The external interface definition
+  //
+  //////////////////////////////////////////////////////////////////////////
+
+  /**
+   * The component handle.
+   * Used as indification in the outside world.
+   * @ingroup alihlt_wrapper_interface
+   */
+  typedef void* AliHLTComponentHandle;
+
+  /** @ingroup alihlt_wrapper_interface */
+  const AliHLTComponentHandle kEmptyHLTComponentHandle = 0;
+
+  /**
+   * Get a system call of the interface.
+   * @param function signature
+   * @return pointer to system call
+   * @ingroup alihlt_wrapper_interface
+   */
+  typedef void* (*AliHLTAnalysisFctGetInterfaceCall)(const char*);
+
+# define ALIHLTANALYSIS_INTERFACE_LIBRARY  "libHLTinterface.so"
+# define ALIHLTANALYSIS_FCT_GETINTERFACECALL  "AliHLTAnalysisGetInterfaceCall"
+
+  /** @ingroup alihlt_wrapper_interface */
+  typedef int (*AliHLTExtFctInitSystem)( unsigned long version, AliHLTAnalysisEnvironment* externalEnv, unsigned long runNo, const char* runType );
+
+  /** @ingroup alihlt_wrapper_interface */
+  typedef int (*AliHLTExtFctDeinitSystem)();
+
+  /** @ingroup alihlt_wrapper_interface */
+  typedef int (*AliHLTExtFctLoadLibrary)( const char* );
+
+  /** @ingroup alihlt_wrapper_interface */
+  typedef int (*AliHLTExtFctUnloadLibrary)( const char* );
+
+  /** @ingroup alihlt_wrapper_interface */
+  typedef int (*AliHLTExtFctCreateComponent)( const char*, void*, int, const char**, AliHLTComponentHandle*, const char* description );
+
+  /** @ingroup alihlt_wrapper_interface */
+  typedef int (*AliHLTExtFctDestroyComponent)( AliHLTComponentHandle );
+
+  /** @ingroup alihlt_wrapper_interface */
+  typedef int (*AliHLTExtFctProcessEvent)( AliHLTComponentHandle, const AliHLTComponentEventData*, const AliHLTComponentBlockData*, 
+                                          AliHLTComponentTriggerData*, AliHLTUInt8_t*,
+                                          AliHLTUInt32_t*, AliHLTUInt32_t*, 
+                                          AliHLTComponentBlockData**,
+                                          AliHLTComponentEventDoneData** );
+
+  /** @ingroup alihlt_wrapper_interface */
+  typedef int (*AliHLTExtFctGetOutputDataType)( AliHLTComponentHandle, AliHLTComponentDataType* );
+
+  /** @ingroup alihlt_wrapper_interface */
+  typedef int (*AliHLTExtFctGetOutputSize)( AliHLTComponentHandle, unsigned long*, double* );
+
 }
 
 //////////////////////////////////////////////////////////////////////////
@@ -833,4 +1134,33 @@ inline AliHLTComponentDataType operator|(const AliHLTComponentDataType srcdt, co
   return dt;
 }
 
+/**
+ * Helper function to initialize a data type from an id char array and origin string.
+ * @return data type structure initialized with the specified id and origin
+ * @ingroup alihlt_component_datatypes
+ */
+inline AliHLTComponentDataType AliHLTComponentDataTypeInitializer(const char id[kAliHLTComponentDataTypefIDsize], const char* origin)
+{
+  AliHLTComponentDataType dt=kAliHLTVoidDataType;
+  int i=0;
+  for (i = 0; i < kAliHLTComponentDataTypefIDsize; i++)
+    dt.fID[i]=id[i];
+  for (i = 0; i < kAliHLTComponentDataTypefOriginSize && origin[i]!=0; i++ )
+    dt.fOrigin[i]=origin[i];
+  return dt;
+}
+
+/**
+ * Helper function to initialize a data type from a default data type and
+ * an origin string. Basically it merges the specified origin into the data
+ * type.
+ * @return data type structure initialized with the id from specified data type
+ *         and origin
+ * @ingroup alihlt_component_datatypes
+ */
+inline AliHLTComponentDataType AliHLTComponentDataTypeInitializer(const AliHLTComponentDataType src, const char* origin)
+{
+  return AliHLTComponentDataTypeInitializer(src.fID, origin);
+}
+
 #endif