* analysis publish new data for the subsequent components. Only the
* input data blocks and entries from CDB are available for the analysis.
*
- * @section alihlt_component_intro Component implementation
+ * @section alihlt_component_implementation Component implementation
* AliHLTComponent provides the interface for all components, see there
* for details. Three types are provided:
* - AliHLTProcessor
* also implements a standard method for @ref GetInputDataTypes.
*
* - AliHLTProcessor for components of type @ref kProcessor <br>
- * All types of data processors can inherit from AliHLTDataSource and must
+ * All types of data processors can inherit from AliHLTProcessor and must
* implement the @ref AliHLTProcessor::DoEvent method.
*
* - AliHLTDataSink for components of type @ref kSink <br>
- * All types of data processors can inherit from AliHLTDataSource and must
+ * All types of data processors can inherit from AliHLTDataSink and must
* implement the @ref AliHLTDataSink::DumpEvent method. The class
* also implements a standard method for @ref GetOutputDataType and @ref
* GetOutputDataSize.
* and AliHLTDataSink provides it's own processing method (see
* @ref alihltcomponent-type-std), which splits into a high and a low-level
* method. For the @ref alihltcomponent-low-level-interface, all parameters are
- * shipped as function arguments, the component is supposed to dump data to the
+ * shipped as function arguments, the component is supposed to write data to the
* output buffer and handle all block descriptors.
* The @ref alihltcomponent-high-level-interface is the standard processing
* method and will be used whenever the low-level method is not overloaded.
* For that reason the @ref GetOutputDataSize function should return a rough
* estimatian of the data to be produced by the component. The component is
* responsible for checking the memory size and must return -ENOSPC if the
- * available buffer is to small, and update the estimator respectively. The
+ * available buffer is too small, and update the estimator respectively. The
* framework will allocate a buffer of appropriate size and call the processing
* again.
*
* Further rules:
* - avoid big static arrays in the component, allocate the memory at runtime
*
+ * @section alihlt_component_arguments Default arguments
+ * The component base class provides some default arguments:
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ * \li -object-compression=level <br>
+ * compression level for ROOT objects, default is defined by
+ * @ref ALIHLTCOMPONENT_DEFAULT_OBJECT_COMPRESSION
+ *
* @ingroup alihlt_component
* @section alihltcomponent-members Class members
*/
* @param argc size of the argument array
* @param argv agument array for component initialization
*/
- virtual int Init( AliHLTComponentEnvironment* environ, void* environParam, int argc, const char** argv );
+ virtual int Init( const AliHLTAnalysisEnvironment* environ, void* environParam, int argc, const char** argv );
/**
* Clean-up function to terminate data processing.
*/
int SetRunDescription(const AliHLTRunDesc* desc, const char* runType);
+ /**
+ * Set the component description.
+ * The description string can contain tokens separated by blanks, a token
+ * consists of a key and an optional value separated by '='.
+ * Possible keys:
+ * \li -chainid=id string id within the chain of the instance
+ *
+ * @param desc component description
+ */
+ int SetComponentDescription(const char* desc);
+
// Information member functions for registration.
/**
*/
static string DataType2Text( const AliHLTComponentDataType& type, int mode=0);
+ /**
+ * Calculate a CRC checksum of a data buffer.
+ * Polynomial for the calculation is 0xD8.
+ */
+ static AliHLTUInt32_t CalculateChecksum(const AliHLTUInt8_t* buffer, int size);
+
/**
* Helper function to print content of data type.
*/
*/
static void SetDataType(AliHLTComponentDataType& dt, AliHLTUInt64_t id, AliHLTUInt32_t orig);
+ /**
+ * Extract a component table entry from the payload buffer.
+ * The entry consists of the AliHLTComponentTableEntry structure, the array of
+ * parents and a description string of the format 'chain-id{component-id:component-args}'.
+ * The function fills all the variables after a consistency check.
+ */
+ static int ExtractComponentTableEntry(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size,
+ string& chainId, string& compId, string& compParam,
+ vector<AliHLTUInt32_t>& parents);
/**
* Stopwatch type for benchmarking.
*/
* from AliRoot or from the wrapper interface during initialization.
*
* @param cdbEntry path of the cdbEntry
- * @param chainId the id of the component in the analysis chain
+ * @param chainId the id/name of the component in the current analysis
+ * chain. This is not necessarily the same as what is
+ * returned by the GetComponentID() method.
* @note both parameters can be NULL, check before usage
*/
virtual int Reconfigure(const char* cdbEntry, const char* chainId);
*/
virtual int EndOfRun();
+ /**
+ * Check whether a component requires all steering blocks.
+ * Childs can overload in order to indicate that they want to
+ * receive also the steering data blocks. There is also the
+ * possibility to add the required data types to the input
+ * data type list in GetInputDataTypes().
+ */
+ virtual bool RequireSteeringBlocks() const {return false;}
+
/**
* General memory allocation method.
* All memory which is going to be used 'outside' of the interface must
* be provided by the framework (online or offline).
* The method is redirected to a function provided by the current
* framework. Function pointers are transferred via the @ref
- * AliHLTComponentEnvironment structure.
+ * AliHLTAnalysisEnvironment structure.
*/
void* AllocMemory( unsigned long size );
* interface pure C style, monilithic blocks must be exchanged.
* The method is redirected to a function provided by the current
* framework. Function pointers are transferred via the @ref
- * AliHLTComponentEnvironment structure.
+ * AliHLTAnalysisEnvironment structure.
*/
int MakeOutputDataBlockList( const AliHLTComponentBlockDataList& blocks, AliHLTUInt32_t* blockCount,
AliHLTComponentBlockData** outputBlocks );
* Fill the EventDoneData structure.
* The method is redirected to a function provided by the current
* framework. Function pointers are transferred via the @ref
- * AliHLTComponentEnvironment structure.
+ * AliHLTAnalysisEnvironment structure.
*/
int GetEventDoneData( unsigned long size, AliHLTComponentEventDoneData** edd );
+ /**
+ * Allocate an EventDoneData structure for the current event .
+ * The method allocates the memory internally and does not interact with the current Framework.
+ * The allocated data structure is empty initially and can be filled by calls to the
+ * @ref PushEventDoneData method. The memory will be automatically released after the event has been processed.
+ *
+ */
+ int ReserveEventDoneData( unsigned long size );
+
+ /**
+ * Push a 32 bit word of data into event done data for the current event which
+ * has previously been allocated by the @ref ReserveEventDoneData method.
+ */
+ int PushEventDoneData( AliHLTUInt32_t eddDataWord );
+
+ /**
+ * Release event done data previously reserved by @ref ReserveEventDoneData
+ */
+ void ReleaseEventDoneData();
+
+ /**
+ * Get the pointer to the event done data available/built so far for the current event via
+ * @ref ReserveEventDoneData and @ref PushEventDoneData
+ */
+ AliHLTComponentEventDoneData* GetCurrentEventDoneData()
+ {
+ return fEventDoneData;
+ }
+
/**
* Helper function to convert the data type to a string.
*/
* \em Note: THE BLOCK DESCRIPTOR MUST NOT BE DELETED by the caller.
* @return pointer to AliHLTComponentBlockData, NULL if index out of range
*/
- const AliHLTComponentBlockData* GetInputBlock(int index);
+ const AliHLTComponentBlockData* GetInputBlock(int index) const;
/**
* Get the next block of a specific data type from the input data.
* @param headerSize size of Header
* @return neg. error code if failed
*/
- int PushBack(void* pBuffer, int iSize, const AliHLTComponentDataType& dt,
+ int PushBack(const void* pBuffer, int iSize, const AliHLTComponentDataType& dt,
AliHLTUInt32_t spec=kAliHLTVoidDataSpec,
- void* pHeader=NULL, int headerSize=0);
+ const void* pHeader=NULL, int headerSize=0);
/**
* Insert an object into the output.
* @param headerSize size of Header
* @return neg. error code if failed
*/
- int PushBack(void* pBuffer, int iSize, const char* dtID, const char* dtOrigin,
+ int PushBack(const void* pBuffer, int iSize, const char* dtID, const char* dtOrigin,
AliHLTUInt32_t spec=kAliHLTVoidDataSpec,
- void* pHeader=NULL, int headerSize=0);
+ const void* pHeader=NULL, int headerSize=0);
/**
* Estimate size of a TObject
*/
AliHLTUInt32_t GetRunType() const;
+ /**
+ * Get the chain id of the component.
+ */
+ const char* GetChainId() const {return fChainId.c_str();}
+
+ /**
+ * Check whether the current event is a valid data event.
+ * @param pTgt optional pointer to get the event type
+ * @return true if the current event is a real data event
+ */
+ bool IsDataEvent(AliHLTUInt32_t* pTgt=NULL);
+
/**
* Set a bit to 1 in a readout list ( = AliHLTEventDDL )
* -> enable DDL for readout
* @param iHeaderSize size of Header
* @return neg. error code if failed
*/
- int InsertOutputBlock(void* pBuffer, int iBufferSize,
+ int InsertOutputBlock(const void* pBuffer, int iBufferSize,
const AliHLTComponentDataType& dt,
AliHLTUInt32_t spec,
- void* pHeader=NULL, int iHeaderSize=0);
+ const void* pHeader=NULL, int iHeaderSize=0);
/**
* Add a component statistics block to the output.
+ * @return size of the added data
*/
int AddComponentStatistics(AliHLTComponentBlockDataList& blocks,
AliHLTUInt8_t* buffer,
AliHLTUInt32_t offset,
AliHLTComponentStatisticsList& stats) const;
+ /**
+ * Add a component table entry (descriptor) to the output
+ * This is done at SOR/EOR. The component table is a list of chain ids
+ * and 32bit ids calculated by a crc algorithm from the chian id. This
+ * allows to tag data blocks with the id number rather than the string.
+ *
+ * The kAliHLTDataTypeComponentTable data block currently has the string
+ * as payload and the crc id as specification.
+ * @return size of the added data
+ */
+ int AddComponentTableEntry(AliHLTComponentBlockDataList& blocks,
+ AliHLTUInt8_t* buffer,
+ AliHLTUInt32_t bufferSize,
+ AliHLTUInt32_t offset,
+ const vector<AliHLTUInt32_t>& parents) const;
+
/** The global component handler instance */
static AliHLTComponentHandler* fgpComponentHandler; //! transient
/** The environment where the component is running in */
- AliHLTComponentEnvironment fEnvironment; // see above
+ AliHLTAnalysisEnvironment fEnvironment; // see above
/** Set by ProcessEvent before the processing starts */
AliHLTEventID_t fCurrentEvent; // see above
/** id of the component in the analysis chain */
string fChainId; //! transient
+ /** crc value of the chainid, used as a 32bit id */
+ AliHLTUInt32_t fChainIdCrc; //! transient
+
/** optional benchmarking for the component statistics */
TStopwatch* fpBenchmark; //! transient
/** component requires steering data blocks */
bool fRequireSteeringBlocks; //! transient
- ClassDef(AliHLTComponent, 7)
+ /** current event type */
+ AliHLTUInt32_t fEventType; //! transient
+
+ /** component arguments */
+ string fComponentArgs; //! transient
+
+
+ /** event done data */
+ AliHLTComponentEventDoneData* fEventDoneData; //! transient
+
+ /** Reserved size of the memory stored at fEventDoneData */
+ unsigned long fEventDoneDataSize; //! transient
+
+ /** Comression level for ROOT objects */
+ int fCompressionLevel; //! transient
+
+ ClassDef(AliHLTComponent, 9)
};
#endif