class AliHLTComponentHandler;
class TObjArray;
+class TMap;
class TStopwatch;
+class TUUID;
+class AliRawDataHeader;
class AliHLTComponent;
class AliHLTMemoryFile;
class AliHLTCTPData;
+class AliHLTReadoutList;
/** list of component data type structures */
typedef vector<AliHLTComponentDataType> AliHLTComponentDataTypeList;
*
* The base class provides two functions regarding OCDB objects:
* - LoadAndExtractOCDBObject() loads the OCDB entry for the specified path and extracts
- * the TObject from it.
+ * the TObject from it. An optional key allows to access
+ * a TObject within a TMap
* - ConfigureFromCDBTObjString() can load a number of OCDB objects and calls the
* argument parsing ConfigureFromArgumentString
*
* ConfigureFromArgumentString() can treat both arrays of arguments and arguments in
* one single string separated by blanks. The two options can be mixed.
*
- * A second bas class function ConfigureFromCDBTObjString() allows to configure
+ * A second base class function ConfigureFromCDBTObjString() allows to configure
* directly from a number of OCDB objects. This requires the entries to be of
* type TObjString and the child implementation of ScanConfigurationArgument().
+ * The object can also be of type TMap with TObjStrings as key-value pairs. The
+ * key identifier can be chosen by the component implementation. Normally it will
+ * be the run type ("p","A-A", "p-A", ...) or e.g. the trigger code secified by
+ * ECS.
*
* @section alihltcomponent-handling Component handling
* The handling of HLT analysis components is carried out by the AliHLTComponentHandler.
* \li -pushback-period=period <br>
* scale down for PushBack of objects, shipped only for one event
* every <i>period</i> seconds
+ * \li -event-module=number <br>
+ * This option reduces the event processing rate by processing only n'th event
+ * based on the modulo number <i>number</i>. The scale down should be about
+ * 1/<i>number</i>, where <i>number</i> is a positive integer.
*
* @ingroup alihlt_component
* @section alihltcomponent-members Class members
*/
virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) = 0;
+ /**
+ * Get a list of OCDB object description.
+ * The list of objects is provided in a TMap
+ * - key: complete OCDB path, e.g. GRP/GRP/Data
+ * - value: short description why the object is needed
+ * Key and value objects created inside this class go into ownership of
+ * target TMap.
+ * @param targetMap TMap instance receiving the list
+ * @return void
+ */
+ virtual void GetOCDBObjectDescription( TMap* const targetArray);
+
/**
* Spawn function.
* Each component must implement a spawn function to create a new instance of
*/
virtual AliHLTComponent* Spawn() = 0;
+ /**
+ * check the availability of the OCDB entry descriptions in the TMap
+ * key : complete OCDB path of the entry
+ * value : auxiliary object - short description
+ * if the external map was not provided the function invokes
+ * interface function GetOCDBObjectDescription() to retrieve the list.
+ * @param externList map of entries to be tested
+ * @result 0 if all found, -ENOENT if objects not found
+ */
+ int CheckOCDBEntries(const TMap* const externList=NULL);
+
/**
* Find matching data types between this component and a consumer component.
* Currently, a component can produce only one type of data. This restriction is most
* @param type data type structure
* @param mode 0 print string origin:type <br>
* 1 print chars <br>
- * 2 print numbers
+ * 2 print numbers <br>
+ * 3 print 'type' 'origin'
*/
static string DataType2Text( const AliHLTComponentDataType& type, int mode=0);
/**
* Copy data type structure
* Copies the value an AliHLTComponentDataType structure to another one
- * @param[out] tgtdt target structure
- * @param[in] srcdt source structure
+ * @param [out] tgtdt target structure
+ * @param [in] srcdt source structure
*/
static void CopyDataType(AliHLTComponentDataType& tgtdt, const AliHLTComponentDataType& srcdt);
*/
static int ExtractComponentTableEntry(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size,
string& chainId, string& compId, string& compParam,
- vector<AliHLTUInt32_t>& parents);
+ vector<AliHLTUInt32_t>& parents) {
+ int dummy=0;
+ return ExtractComponentTableEntry(pBuffer, size, chainId, compId, compParam, parents, dummy);
+ }
+
+ static int ExtractComponentTableEntry(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size,
+ string& chainId, string& compId, string& compParam,
+ vector<AliHLTUInt32_t>& parents, int& level);
+
+ /**
+ * Extracts the different data parts from the trigger data structure.
+ * @param [in] trigData The trigger data as passed to the DoProcessing method.
+ * @param [out] attributes The data block attributes given by the HLT framework.
+ * @param [out] status The HLT status bits given by the HLT framework.
+ * @param [out] cdh The common data header received from DDL links.
+ * @param [out] readoutlist The readout list to fill with readout list bits
+ * passed on by the HLT framework.
+ * @param [in] printErrors If true then error messages are generated as necessary
+ * and suppressed otherwise.
+ * @note If any of the output parameters are set to NULL then the field is not set.
+ * For example, the following line will only fill the CDH pointer.
+ * \code
+ * AliRawDataHeader* cdh;
+ * ExtractTriggerData(trigData, NULL, NULL, &cdh, NULL);
+ * \endcode
+ * @return zero on success or one of the following error codes on failure.
+ * if a non-zero error code is returned then none of the output parameters are
+ * modified.
+ * \li -ENOENT The <i>trigData</i> structure size is wrong.
+ * \li -EBADF The <i>trigData</i> data size is wrong.
+ * \li -EBADMSG The common data header (CDH) in the trigger data has the wrong
+ * number of words indicated.
+ * \li -EPROTO The readout list structure in the trigger data has the wrong
+ * number of words indicated.
+ */
+ static int ExtractTriggerData(
+ const AliHLTComponentTriggerData& trigData,
+ const AliHLTUInt8_t (**attributes)[gkAliHLTBlockDAttributeCount],
+ AliHLTUInt64_t* status,
+ const AliRawDataHeader** cdh,
+ AliHLTReadoutList* readoutlist,
+ bool printErrors = false
+ );
+
+ /**
+ * Extracts the readout list from a trigger data structure.
+ * @param [in] trigData The trigger data as passed to the DoProcessing method.
+ * @param [out] list The output readout list to fill.
+ * @param [in] printErrors If true then error messages are generated as necessary
+ * and suppressed otherwise.
+ * @return zero on success or one of the error codes returned by ExtractTriggerData.
+ */
+ static int GetReadoutList(
+ const AliHLTComponentTriggerData& trigData, AliHLTReadoutList& list,
+ bool printErrors = false
+ )
+ {
+ return ExtractTriggerData(trigData, NULL, NULL, NULL, &list, printErrors);
+ }
+
+ /**
+ * Extracts the event type from the given Common Data Header.
+ * @param [in] cdh The Common Data Header to extract the event type from.
+ * @return the event type code from the CDH.
+ */
+ static AliHLTUInt32_t ExtractEventTypeFromCDH(const AliRawDataHeader* cdh);
+
/**
* Stopwatch type for benchmarking.
*/
*/
int GetLastObjectSize() const {return fLastObjectSize;}
+ /**
+ * This method generates a V4 Globally Unique Identifier (GUID) using the
+ * ROOT TRandom3 pseudo-random number generator with the process' UID, GID
+ * PID and host address as seeds. For good measure MD5 sum hashing is also
+ * applied.
+ * @return the newly generated GUID structure.
+ */
+ static TUUID GenerateGUID();
+
+ /// get the compression level for TObjects
+ int GetCompressionLevel() const {return fCompressionLevel;}
+
protected:
/**
* Read configuration objects from OCDB and configure from
* the content of TObjString entries.
* @param entries blank separated list of OCDB paths
+ * @param key if the entry is a TMap, search for the corresponding object
* @return neg. error code if failed
*/
- int ConfigureFromCDBTObjString(const char* entries);
+ int ConfigureFromCDBTObjString(const char* entries, const char* key=NULL);
/**
* Load specified entry from the OCDB and extract the object.
* The entry is explicitely unloaded from the cache before it is loaded.
+ * If parameter key is specified the OCDB object is treated as TMap
+ * and the TObject associated with 'key' is loaded.
* @param path path of the entry under to root of the OCDB
* @param version version of the entry
* @param subVersion subversion of the entry
+ * @param key key of the object within TMap
*/
- TObject* LoadAndExtractOCDBObject(const char* path, int version = -1, int subVersion = -1);
-
+ TObject* LoadAndExtractOCDBObject(const char* path, const char* key=NULL) const;
/**
* Get event number.
* @param headerSize size of Header
* @return neg. error code if failed
*/
- int PushBack(TObject* pObject, const AliHLTComponentDataType& dt,
+ int PushBack(const TObject* pObject, const AliHLTComponentDataType& dt,
AliHLTUInt32_t spec=kAliHLTVoidDataSpec,
void* pHeader=NULL, int headerSize=0);
* @param headerSize size of Header
* @return neg. error code if failed
*/
- int PushBack(TObject* pObject, const char* dtID, const char* dtOrigin,
+ int PushBack(const TObject* pObject, const char* dtID, const char* dtOrigin,
AliHLTUInt32_t spec=kAliHLTVoidDataSpec,
void* pHeader=NULL, int headerSize=0);
* @param pObject
* @return buffer size in byte
*/
- int EstimateObjectSize(TObject* pObject) const;
+ int EstimateObjectSize(const TObject* pObject) const;
/**
* Create a memory file in the output stream.
*/
bool IsDataEvent(AliHLTUInt32_t* pTgt=NULL) const;
- /**
- * Set a bit to 1 in a readout list ( = AliHLTEventDDL )
- * -> enable DDL for readout
- * @param list readout list
- * @param ddlId DDL Id to be turned on ( Decimal )
- */
- void EnableDDLBit(AliHLTEventDDL &list, Int_t ddlId ) const {
- SetDDLBit( list, ddlId, kTRUE );
- }
-
- /**
- * Set a bit to 0 in a readout list ( = AliHLTEventDDL )
- * -> disable DDL for readout
- * @param list readout list
- * @param ddlId DDL Id to be turned on ( Decimal )
- */
- void DisableDDLBit(AliHLTEventDDL &list, Int_t ddlId ) const {
- SetDDLBit( list, ddlId, kFALSE );
- }
-
- /**
- * Set or unset bit a readout list ( = AliHLTEventDDL )
- * -> enable or disable DDL for readout
- * @param list readout list
- * @param ddlId DDL Id to be turned on ( Decimal )
- * @param state kTRUE sets it, kFALSE unsets it
- */
- void SetDDLBit(AliHLTEventDDL &list, Int_t ddlId, Bool_t state ) const;
-
- /**
- * Get the first word of a detector, which has a set DDL bit.
- * Beware, this only works if DDLs of 1 detector are set. In the
- * case of the TPC and TOF, which use 8 and 3 words, the first
- * word is returned.
- * @param list readout list
- * @return returns the detector index, -1 if no bit is set
- * at all or several detectors (=error)
- */
- Int_t GetFirstUsedDDLWord(AliHLTEventDDL &list) const;
-
/**
* Copy a struct from block data.
* The function checks for block size and struct size. The least common
AliHLTUInt8_t* buffer,
AliHLTUInt32_t bufferSize,
AliHLTUInt32_t offset,
- const vector<AliHLTUInt32_t>& parents) const;
+ const vector<AliHLTUInt32_t>& parents,
+ int processingLevel) const;
/**
* Scan the ECS parameter string.
/** descriptor of the current run */
AliHLTRunDesc* fpRunDesc; //! transient
- /** the current DDL list */
- AliHLTEventDDL* fpDDLList; //! transient
-
/** external fct to set CDB run no, indicates external CDB initialization */
void (*fCDBSetRunNoFunc)(); //! transient
int fPushbackPeriod; //! transient
/// time of last executed PushBack
int fLastPushBackTime; //! transient
+
+ /// Event modulo for down scaling the processing rate.
+ int fEventModulo; //! transient
- ClassDef(AliHLTComponent, 14)
+ ClassDef(AliHLTComponent, 0)
};
#endif