X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HLT%2FBASE%2FAliHLTComponent.h;h=ed63b4e5d794a3aa72eb077908adfd0d3fe358dd;hb=b8313826332befd153c7b87765a7c0a693d059e4;hp=6d8dc18a6a2f5a4b49f4293fb0155256c6d46848;hpb=3fcb48b8a14aba42b12d07f284c942ecd308b009;p=u%2Fmrichter%2FAliRoot.git diff --git a/HLT/BASE/AliHLTComponent.h b/HLT/BASE/AliHLTComponent.h index 6d8dc18a6a2..ed63b4e5d79 100644 --- a/HLT/BASE/AliHLTComponent.h +++ b/HLT/BASE/AliHLTComponent.h @@ -80,10 +80,14 @@ typedef AliHLTComponentEventDoneData AliHLTComponent_EventDoneData; 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 AliHLTComponentDataTypeList; @@ -313,7 +317,8 @@ typedef vector AliHLTMemoryFilePList; * * 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 * @@ -328,9 +333,13 @@ typedef vector AliHLTMemoryFilePList; * 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. @@ -373,6 +382,10 @@ typedef vector AliHLTMemoryFilePList; * \li -pushback-period=period
* scale down for PushBack of objects, shipped only for one event * every period seconds + * \li -event-module=number
+ * This option reduces the event processing rate by processing only n'th event + * based on the modulo number number. The scale down should be about + * 1/number, where number is a positive integer. * * @ingroup alihlt_component * @section alihltcomponent-members Class members @@ -572,6 +585,18 @@ class AliHLTComponent : public AliHLTLogging { */ 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 @@ -580,6 +605,17 @@ class AliHLTComponent : public AliHLTLogging { */ 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 @@ -607,7 +643,8 @@ class AliHLTComponent : public AliHLTLogging { * @param type data type structure * @param mode 0 print string origin:type
* 1 print chars
- * 2 print numbers + * 2 print numbers
+ * 3 print 'type' 'origin' */ static string DataType2Text( const AliHLTComponentDataType& type, int mode=0); @@ -655,8 +692,8 @@ class AliHLTComponent : public AliHLTLogging { /** * 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); @@ -695,7 +732,73 @@ class AliHLTComponent : public AliHLTLogging { */ static int ExtractComponentTableEntry(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size, string& chainId, string& compId, string& compParam, - vector& parents); + vector& 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& 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 trigData structure size is wrong. + * \li -EBADF The trigData 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. */ @@ -798,6 +901,18 @@ class AliHLTComponent : public AliHLTLogging { */ 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: /** @@ -986,19 +1101,22 @@ class AliHLTComponent : public AliHLTLogging { * 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. @@ -1193,7 +1311,7 @@ class AliHLTComponent : public AliHLTLogging { * @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); @@ -1212,7 +1330,7 @@ class AliHLTComponent : public AliHLTLogging { * @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); @@ -1250,7 +1368,7 @@ class AliHLTComponent : public AliHLTLogging { * @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. @@ -1449,46 +1567,6 @@ class AliHLTComponent : public AliHLTLogging { */ 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 @@ -1625,7 +1703,8 @@ class AliHLTComponent : public AliHLTLogging { AliHLTUInt8_t* buffer, AliHLTUInt32_t bufferSize, AliHLTUInt32_t offset, - const vector& parents) const; + const vector& parents, + int processingLevel) const; /** * Scan the ECS parameter string. @@ -1703,9 +1782,6 @@ class AliHLTComponent : public AliHLTLogging { /** 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 @@ -1747,7 +1823,10 @@ class AliHLTComponent : public AliHLTLogging { 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