From a655eae3a07131392c47712172bcdf9e3ea968bf Mon Sep 17 00:00:00 2001 From: richterm Date: Thu, 22 Feb 2007 12:03:34 +0000 Subject: [PATCH] high-level component interface added --- HLT/BASE/AliHLTComponent.cxx | 390 +++++++++++++++- HLT/BASE/AliHLTComponent.h | 432 +++++++++++++++++- HLT/BASE/AliHLTComponentHandler.cxx | 2 + HLT/BASE/AliHLTConfiguration.cxx | 4 +- HLT/BASE/AliHLTDataSink.cxx | 32 +- HLT/BASE/AliHLTDataSink.h | 27 +- HLT/BASE/AliHLTDataSource.cxx | 29 +- HLT/BASE/AliHLTDataSource.h | 31 +- HLT/BASE/AliHLTDataTypes.h | 1 + HLT/BASE/AliHLTFilePublisher.cxx | 12 +- HLT/BASE/AliHLTFilePublisher.h | 11 + HLT/BASE/AliHLTMessage.cxx | 316 +++++++++++++ HLT/BASE/AliHLTMessage.h | 89 ++++ HLT/BASE/AliHLTProcessor.cxx | 28 +- HLT/BASE/AliHLTProcessor.h | 23 +- HLT/BASE/AliHLTRootFilePublisherComponent.cxx | 139 ++++++ HLT/BASE/AliHLTRootFilePublisherComponent.h | 96 ++++ HLT/BASE/AliHLTRootFileWriterComponent.cxx | 17 +- HLT/BASE/AliHLTRootFileWriterComponent.h | 11 +- HLT/BASE/HLTbaseLinkDef.h | 1 + HLT/BASE/Makefile.am | 2 +- HLT/ChangeLog | 4 + HLT/TPCLib/AliHLTTPCClusterFinderComponent.h | 2 +- HLT/TPCLib/AliHLTTPCGlobalMergerComponent.h | 2 +- HLT/TPCLib/AliHLTTPCPad.h | 2 +- .../AliHLTTPCRawDataUnpackerComponent.h | 2 +- HLT/TPCLib/AliHLTTPCSliceTrackerComponent.h | 2 +- HLT/TPCLib/AliHLTTPCVertexFinderComponent.h | 2 +- HLT/libHLTbase.pkg | 8 +- 29 files changed, 1631 insertions(+), 86 deletions(-) create mode 100644 HLT/BASE/AliHLTMessage.cxx create mode 100644 HLT/BASE/AliHLTMessage.h create mode 100644 HLT/BASE/AliHLTRootFilePublisherComponent.cxx create mode 100644 HLT/BASE/AliHLTRootFilePublisherComponent.h diff --git a/HLT/BASE/AliHLTComponent.cxx b/HLT/BASE/AliHLTComponent.cxx index 4af4d8fff2e..8595190c5da 100644 --- a/HLT/BASE/AliHLTComponent.cxx +++ b/HLT/BASE/AliHLTComponent.cxx @@ -28,7 +28,10 @@ using namespace std; #include "AliHLTStdIncludes.h" #include "AliHLTComponent.h" #include "AliHLTComponentHandler.h" +#include "AliHLTMessage.h" #include "TString.h" +#include "TObjArray.h" +#include "TClass.h" /** ROOT macro for the implementation of ROOT specific class methods */ ClassImp(AliHLTComponent) @@ -37,7 +40,18 @@ AliHLTComponent::AliHLTComponent() : fEnvironment(), fCurrentEvent(0), - fEventCount(-1) + fEventCount(-1), + fFailedEvents(0), + fCurrentEventData(), + fpInputBlocks(NULL), + fCurrentInputBlock(-1), + fSearchDataType(kAliHLTVoidDataType), + fClassName(), + fpInputObjects(NULL), + fpOutputBuffer(NULL), + fOutputBufferSize(0), + fOutputBufferFilled(0), + fOutputBlocks() { // see header file for class documentation // or @@ -53,7 +67,18 @@ AliHLTComponent::AliHLTComponent(const AliHLTComponent&) : fEnvironment(), fCurrentEvent(0), - fEventCount(-1) + fEventCount(-1), + fFailedEvents(0), + fCurrentEventData(), + fpInputBlocks(NULL), + fCurrentInputBlock(-1), + fSearchDataType(kAliHLTVoidDataType), + fClassName(), + fpInputObjects(NULL), + fpOutputBuffer(NULL), + fOutputBufferSize(0), + fOutputBufferFilled(0), + fOutputBlocks() { // see header file for class documentation HLTFatal("copy constructor untested"); @@ -237,7 +262,7 @@ void AliHLTComponent::FillBlockData( AliHLTComponentBlockData& blockData ) const blockData.fPtr = NULL; blockData.fSize = 0; FillDataType( blockData.fDataType ); - blockData.fSpecification = ~(AliHLTUInt32_t)0; + blockData.fSpecification = kAliHLTVoidDataSpec; } void AliHLTComponent::FillShmData( AliHLTComponentShmData& shmData ) const @@ -317,6 +342,331 @@ int AliHLTComponent::IncrementEventCounter() return fEventCount; } +int AliHLTComponent::GetNumberOfInputBlocks() +{ + // see header file for function documentation + if (fpInputBlocks!=NULL) { + return fCurrentEventData.fBlockCnt; + } + return 0; +} + +const TObject* AliHLTComponent::GetFirstInputObject(const AliHLTComponentDataType& dt, + const char* classname, + int bForce) +{ + // see header file for function documentation + fSearchDataType=dt; + if (classname) fClassName=classname; + else fClassName.clear(); + int idx=FindInputBlock(fSearchDataType, 0); + //HLTDebug("found block %d when searching for data type %s", idx, DataType2Text(dt).c_str()); + TObject* pObj=NULL; + if (idx>=0) { + if ((pObj=GetInputObject(idx, fClassName.c_str(), bForce))!=NULL) { + fCurrentInputBlock=idx; + } else { + } + } + return pObj; +} + +const TObject* AliHLTComponent::GetFirstInputObject(const char* dtID, + const char* dtOrigin, + const char* classname, + int bForce) +{ + // see header file for function documentation + AliHLTComponentDataType dt; + SetDataType(dt, dtID, dtOrigin); + return GetFirstInputObject(dt, classname, bForce); +} + +const TObject* AliHLTComponent::GetNextInputObject(int bForce) +{ + // see header file for function documentation + int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1); + //HLTDebug("found block %d when searching for data type %s", idx, DataType2Text(fSearchDataType).c_str()); + TObject* pObj=NULL; + if (idx>=0) { + if ((pObj=GetInputObject(idx, fClassName.c_str(), bForce))!=NULL) { + fCurrentInputBlock=idx; + } + } + return pObj; +} + +int AliHLTComponent::FindInputBlock(const AliHLTComponentDataType& dt, int startIdx) +{ + // see header file for function documentation + int iResult=-ENOENT; + if (fpInputBlocks!=NULL) { + int idx=startIdx<0?0:startIdx; + for ( ; idxGetName()); + } else { + } + } else { + // } else if (bForce!=0) { + HLTError("size missmatch: block size %d, indicated %d", fpInputBlocks[idx].fSize, firstWord+sizeof(AliHLTUInt32_t)); + } + } else { + HLTFatal("block descriptor empty"); + } + } else { + HLTError("index %d out of range %d", idx, fCurrentEventData.fBlockCnt); + } + } else { + HLTError("no input blocks available"); + } + + return pObj; +} + +TObject* AliHLTComponent::GetInputObject(int idx, const char* classname, int bForce) +{ + // see header file for function documentation + if (fpInputObjects==NULL) { + fpInputObjects=new TObjArray(fCurrentEventData.fBlockCnt); + } + TObject* pObj=NULL; + if (fpInputObjects) { + pObj=fpInputObjects->At(idx); + if (pObj==NULL) { + pObj=CreateInputObject(idx, bForce); + if (pObj) { + fpInputObjects->AddAt(pObj, idx); + } + } + } else { + HLTFatal("memory allocation failed: TObjArray of size %d", fCurrentEventData.fBlockCnt); + } + return pObj; +} + +AliHLTComponentDataType AliHLTComponent::GetDataType(const TObject* pObject) +{ + // see header file for function documentation + AliHLTComponentDataType dt=kAliHLTVoidDataType; + int idx=fCurrentInputBlock; + if (pObject) { + if (fpInputObjects==NULL || (idx=fpInputObjects->IndexOf(pObject))>=0) { + } else { + HLTError("unknown object %p", pObject); + } + } + if (idx>=0) { + if (idxIndexOf(pObject))>=0) { + } else { + HLTError("unknown object %p", pObject); + } + } + if (idx>=0) { + if (idx=0) { + // check for fpInputBlocks pointer done in FindInputBlock + pBlock=&fpInputBlocks[idx]; + } + return pBlock; +} + +const AliHLTComponentBlockData* AliHLTComponent::GetFirstInputBlock(const char* dtID, + const char* dtOrigin) +{ + // see header file for function documentation + AliHLTComponentDataType dt; + SetDataType(dt, dtID, dtOrigin); + return GetFirstInputBlock(dt); +} + +const AliHLTComponentBlockData* AliHLTComponent::GetNextInputBlock() +{ + // see header file for function documentation + int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1); + const AliHLTComponentBlockData* pBlock=NULL; + if (idx>=0) { + // check for fpInputBlocks pointer done in FindInputBlock + pBlock=&fpInputBlocks[idx]; + } + return pBlock; +} + +int AliHLTComponent::FindInputBlock(const AliHLTComponentBlockData* pBlock) +{ + // see header file for function documentation + int iResult=-ENOENT; + if (fpInputBlocks!=NULL) { + if (pBlock) { + if (pBlock>=fpInputBlocks && pBlock(pBlock-fpInputBlocks); + } + } else { + iResult=-EINVAL; + } + } + return iResult; +} + +AliHLTUInt32_t AliHLTComponent::GetSpecification(const AliHLTComponentBlockData* pBlock) +{ + // see header file for function documentation + AliHLTUInt32_t iSpec=kAliHLTVoidDataSpec; + int idx=fCurrentInputBlock; + if (pBlock) { + if (fpInputObjects==NULL || (idx=FindInputBlock(pBlock))>=0) { + } else { + HLTError("unknown Block %p", pBlock); + } + } + if (idx>=0) { + // check for fpInputBlocks pointer done in FindInputBlock + iSpec=fpInputBlocks[idx].fSpecification; + } + return iSpec; +} + +int AliHLTComponent::PushBack(TObject* pObject, const AliHLTComponentDataType& dt, AliHLTUInt32_t spec) +{ + // see header file for function documentation + int iResult=0; + if (pObject) { + AliHLTMessage msg(kMESS_OBJECT); + msg.WriteObject(pObject); + Int_t iMsgLength=msg.Length(); + if (iMsgLength>0) { + msg.SetLength(); // sets the length to the first (reserved) word + iResult=InsertOutputBlock(msg.Buffer(), iMsgLength, dt, spec); + if (iResult>=0) { + //HLTDebug("object %s (%p) inserted to output", pObject->ClassName(), pObject); + } + } else { + HLTError("object serialization failed for object %p", pObject); + iResult=-ENOMSG; + } + } else { + iResult=-EINVAL; + } + return iResult; +} + +int AliHLTComponent::PushBack(TObject* pObject, const char* dtID, const char* dtOrigin, AliHLTUInt32_t spec) +{ + // see header file for function documentation + AliHLTComponentDataType dt; + SetDataType(dt, dtID, dtOrigin); + return PushBack(pObject, dt, spec); +} + +int AliHLTComponent::PushBack(void* pBuffer, int iSize, const AliHLTComponentDataType& dt, AliHLTUInt32_t spec) +{ + // see header file for function documentation + return InsertOutputBlock(pBuffer, iSize, dt, spec); +} + +int AliHLTComponent::PushBack(void* pBuffer, int iSize, const char* dtID, const char* dtOrigin, AliHLTUInt32_t spec) +{ + // see header file for function documentation + AliHLTComponentDataType dt; + SetDataType(dt, dtID, dtOrigin); + return PushBack(pBuffer, iSize, dt, spec); +} + +int AliHLTComponent::InsertOutputBlock(void* pBuffer, int iSize, const AliHLTComponentDataType& dt, AliHLTUInt32_t spec) +{ + // see header file for function documentation + int iResult=0; + if (pBuffer) { + if (fpOutputBuffer && (fOutputBufferSize-fOutputBufferFilled)) { + AliHLTUInt8_t* pTgt=fpOutputBuffer+fOutputBufferFilled; + AliHLTComponentBlockData bd; + FillBlockData( bd ); + bd.fOffset = fOutputBufferFilled; + bd.fPtr = pTgt; + bd.fSize = iSize; + bd.fDataType = dt; + bd.fSpecification = spec; + if (pBuffer!=NULL && pBuffer!=pTgt) { + memcpy(pTgt, pBuffer, iSize); + AliHLTUInt32_t firstWord=*((AliHLTUInt32_t*)pBuffer); + //HLTDebug("copy %d bytes from %p to output buffer %p, first word %#x", iSize, pBuffer, pTgt, firstWord); + } + fOutputBufferFilled+=bd.fSize; + fOutputBlocks.push_back( bd ); + //HLTDebug("buffer inserted to output: size %d data type %s spec %#x", iSize, DataType2Text(dt).c_str(), spec); + } else { + if (fpOutputBuffer) { + HLTError("too little space in output buffer: %d, required %d", fOutputBufferSize-fOutputBufferFilled, iSize); + } else { + HLTError("output buffer not available"); + } + iResult=-ENOSPC; + } + } else { + iResult=-EINVAL; + } + return iResult; +} + +int AliHLTComponent::CreateEventDoneData(AliHLTComponentEventDoneData edd) +{ + // see header file for function documentation + int iResult=-ENOSYS; + //#warning function not yet implemented + HLTWarning("function not yet implemented"); + return iResult; +} + int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& trigData, @@ -329,7 +679,39 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData, // see header file for function documentation int iResult=0; fCurrentEvent=evtData.fEventID; - iResult=DoProcessing(evtData, blocks, trigData, outputPtr, size, outputBlockCnt, outputBlocks, edd); + fCurrentEventData=evtData; + fpInputBlocks=blocks; + fCurrentInputBlock=-1; + fSearchDataType=kAliHLTAnyDataType; + fpOutputBuffer=outputPtr; + fOutputBufferSize=size; + fOutputBufferFilled=0; + fOutputBlocks.clear(); + + vector blockData; + iResult=DoProcessing(evtData, blocks, trigData, outputPtr, size, blockData, edd); + if (iResult>=0) { + if (fOutputBlocks.size()>0) { + //HLTDebug("got %d block(s) via high level interface", fOutputBlocks.size()); + if (blockData.size()>0) { + HLTError("low level and high interface must not be mixed; use PushBack methods to insert data blocks"); + iResult=-EFAULT; + } else { + iResult=MakeOutputDataBlockList(fOutputBlocks, &outputBlockCnt, &outputBlocks); + size=fOutputBufferFilled; + } + } else { + iResult=MakeOutputDataBlockList(blockData, &outputBlockCnt, &outputBlocks); + } + if (iResult<0) { + HLTFatal("component %s (%p): can not convert output block descriptor list", GetComponentID(), this); + } + } + if (iResult<0) { + outputBlockCnt=0; + outputBlocks=NULL; + } IncrementEventCounter(); return iResult; } + diff --git a/HLT/BASE/AliHLTComponent.h b/HLT/BASE/AliHLTComponent.h index a653444ef74..2f14c322ed9 100644 --- a/HLT/BASE/AliHLTComponent.h +++ b/HLT/BASE/AliHLTComponent.h @@ -1,3 +1,4 @@ +//-*- Mode: C++ -*- // @(#) $Id$ #ifndef ALIHLTCOMPONENT_H @@ -37,6 +38,7 @@ typedef AliHLTComponentTriggerData AliHLTComponent_TriggerData; typedef AliHLTComponentEventDoneData AliHLTComponent_EventDoneData; class AliHLTComponentHandler; +class TObjArray; /** * @class AliHLTComponent @@ -44,19 +46,149 @@ class AliHLTComponentHandler; * The class provides a common interface for HLT data processing components. * The interface can be accessed from the online HLT framework or the AliRoot * offline analysis framework. - * Components can be of type - * - @ref AliHLTComponent::kSource: components which only produce data - * - @ref AliHLTComponent::kProcessor: components which consume and produce data - * - @ref AliHLTComponent::kSink: components which only consume data + * @section alihltcomponent-properties Component identification and properties + * Each component must provide a unique ID, input and output data type indications, + * and a spawn function. + * @subsection alihltcomponent-req-methods Required property methods + * - @ref GetComponentID + * - @ref GetInputDataTypes (see @ref alihltcomponent-type for default + * implementations.) + * - @ref GetOutputDataType (see @ref alihltcomponent-type for default + * implementations.) + * - @ref GetOutputDataSize (see @ref alihltcomponent-type for default + * implementations.) + * - @ref Spawn * - * where data production and consumption refer to the analysis data stream.
+ * @subsection alihltcomponent-opt-mehods Optional handlers + * - @ref DoInit + * - @ref DoDeinit + * + * @subsection alihltcomponent-processing-mehods Data processing + * + * + * @subsection alihltcomponent-type Component type + * Components can be of type + * - @ref kSource: components which only produce data + * - @ref kProcessor: components which consume and produce data + * - @ref kSink: components which only consume data + * + * where data production and consumption refer to the analysis data stream. In + * order to indicate the type, a child component can overload the + * @ref GetComponentType function. + * @subsubsection alihltcomponent-type-std Standard implementations + * Components in general do not need to implement this function, standard + * implementations of the 3 types are available: + * - AliHLTDataSource for components of type @ref kSource
+ * All types of data sources can inherit from AliHLTDataSource and must + * implement the @ref AliHLTDataSource::GetEvent method. The class + * also implements a standard method for @ref GetInputDataTypes. + * + * - AliHLTProcessor for components of type @ref kProcessor
+ * All types of data processors can inherit from AliHLTDataSource and must + * implement the @ref AliHLTProcessor::DoEvent method. + * + * - AliHLTDataSink for components of type @ref kSink
+ * All types of data processors can inherit from AliHLTDataSource and must + * implement the @ref AliHLTDataSink::DumpEvent method. The class + * also implements a standard method for @ref GetOutputDataType and @ref + * GetOutputDataSize. + * + * @subsection alihltcomponent-environment Running environment * * In order to adapt to different environments (on-line/off-line), the component * gets an environment structure with function pointers. The base class provides * member functions for those environment dependend functions. The member * functions are used by the component implementation and are re-mapped to the * corresponding functions. + * @section alihltcomponent-interfaces Component interfaces + * Each of the 3 standard component base classes AliHLTProcessor, AliHLTDataSource + * 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 + * 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. + * + * @subsection alihltcomponent-high-level-interface High-level interface + * The high-level component interface provides functionality to exchange ROOT + * structures between components. In contrast to the + * @ref alihltcomponent-low-level-interface, a couple of functions can be used + * to access data blocks of the input stream + * and send data blocks or ROOT TObject's to the output stream. The functionality + * is hidden from the user and is implemented by using ROOT's TMessage class. + * + * @subsubsection alihltcomponent-high-level-int-methods Interface methods + * The interface provides a couple of methods in order to get objects from the + * input, data blocks (non TObject) from the input, and to push back objects and + * data blocks to the output. For convenience there are several functions of + * identical name (and similar behavior) with different parameters defined. + * Please refer to the function documentation. + * - @ref GetNumberOfInputBlocks
+ * return the number of data blocks in the input stream + * - @ref GetFirstInputObject
+ * get the first object of a specific data type + * - @ref GetNextInputObject
+ * get the next object of same data type as last GetFirstInputObject/Block call + * - @ref GetFirstInputBlock
+ * get the first block of a specific data type + * - @ref GetNextInputBlock
+ * get the next block of same data type as last GetFirstInputBlock/Block call + * - @ref PushBack
+ * insert an object or data buffer into the output + * - @ref CreateEventDoneData
+ * add event information to the output + * + * In addition, the processing methods are simplified a bit by cutting out most of + * the parameters. The component implementation + * @see AliHLTProcessor AliHLTDataSource AliHLTDataSink + * + * @subsubsection alihltcomponent-high-level-int-guidelines High-level interface guidelines + * - Structures must inherit from the ROOT object base class TObject in order be + * transported by the transportation framework. + * - all pointer members must be transient (marked //! behind the member + * definition), i.e. will not be stored/transported, or properly marked + * (//->) in order to call the streamer of the object the member is pointing + * to. The latter is not recomended. Structures to be transported between components + * should be streamlined. + * - no use of stl vectors/strings, use appropriate ROOT classes instead + * + * @subsection alihltcomponent-low-level-interface Low-level interface + * The low-level component interface consists of the specific data processing + * methods for @ref AliHLTProcessor, @ref AliHLTDataSource, and @ref AliHLTDataSink. + * - @ref AliHLTProcessor::DoEvent + * - @ref AliHLTDataSource::GetEvent + * - @ref AliHLTDataSink::DumpEvent + * + * + * @section alihltcomponent-handling Component handling + * The handling of HLT analysis components is carried out by the AliHLTComponentHandler. + * Component are registered automatically at load-time of the component shared library + * under the following suppositions: + * - the component library has to be loaded from the AliHLTComponentHandler using the + * @ref AliHLTComponentHandler::LoadLibrary method. + * - the component implementation defines one global object (which is generated + * when the library is loaded) + * + * @subsection alihltcomponent-design-rules General design considerations + * The analysis code should be implemented in one or more destict class(es). A + * \em component should be implemented which interface the destict analysis code to the + * component interface. This component generates the analysis object dynamically.
+ * + * Assume you have an implemetation AliHLTDetMyAnalysis , another class + * AliHLTDetMyAnalysisComponent contains: + *
+ * private:
+ *   AliHLTDetMyAnalysis* fMyAnalysis;  //!
+ * 
+ * The object should then be instantiated in the DoInit handler of + * AliHLTDetMyAnalysisComponent , and cleaned in the DoDeinit handler. + * + * Further rules: + * - avoid big static arrays in the component, allocate the memory at runtime + * * @ingroup alihlt_component + * @section alihltcomponent-members Class members */ class AliHLTComponent : public AliHLTLogging { public: @@ -129,15 +261,14 @@ class AliHLTComponent : public AliHLTLogging { * @param trigData * @param outputPtr * @param size - * @param outputBlockCnt out: size of the output block array, set by the component * @param outputBlocks out: the output block array is allocated internally * @param edd * @return neg. error code if failed */ virtual int DoProcessing( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, - AliHLTUInt32_t& size, AliHLTUInt32_t& outputBlockCnt, - AliHLTComponentBlockData*& outputBlocks, + AliHLTUInt32_t& size, + vector& outputBlocks, AliHLTComponentEventDoneData*& edd ) = 0; // Information member functions for registration. @@ -228,6 +359,7 @@ class AliHLTComponent : public AliHLTLogging { */ void PrintComponentDataTypeInfo(const AliHLTComponentDataType& dt); + protected: /** @@ -324,29 +456,297 @@ class AliHLTComponent : public AliHLTLogging { */ int GetEventCount() const; + /** + * Get the number of input blocks. + * @return number of input blocks + */ + int GetNumberOfInputBlocks(); + + /** + * Get the first object of a specific data type from the input data. + * The hight-level methods provide functionality to transfer ROOT data + * structures which inherit from TObject. + * The method looks for the first ROOT object of type dt in the input stream. + * If also the class name is provided, the object is checked for the right + * class type. The input data block needs a certain structure, namely the + * buffer size as first word. If the cross check fails, the retrieval is + * silently abondoned, unless the \em bForce parameter is set. + * @param dt data type of the object + * @param classname class name of the object + * @param bForce force the retrieval of an object, error messages + * are suppressed if \em bForce is not set + * @return pointer to @ref TObject, NULL if no objects of specified type + * available + */ + const TObject* GetFirstInputObject(const AliHLTComponentDataType& dt=kAliHLTAnyDataType, + const char* classname=NULL, + int bForce=0); + + /** + * Get the first object of a specific data type from the input data. + * The hight-level methods provide functionality to transfer ROOT data + * structures which inherit from TObject. + * The method looks for the first ROOT object of type specified by the ID and + * Origin strings in the input stream. + * If also the class name is provided, the object is checked for the right + * class type. The input data block needs a certain structure, namely the + * buffer size as first word. If the cross check fails, the retrieval is + * silently abondoned, unless the \em bForce parameter is set. + * @param dtID data type ID of the object + * @param dtOrigin data type origin of the object + * @param classname class name of the object + * @param bForce force the retrieval of an object, error messages + * are suppressed if \em bForce is not set + * @return pointer to @ref TObject, NULL if no objects of specified type + * available + */ + const TObject* GetFirstInputObject(const char* dtID, + const char* dtOrigin, + const char* classname=NULL, + int bForce=0); + + /** + * Get the next object of a specific data type from the input data. + * The hight-level methods provide functionality to transfer ROOT data + * structures which inherit from TObject. + * The method looks for the next ROOT object of type and class specified + * to the previous @ref GetFirstInputObject call. + * @param bForce force the retrieval of an object, error messages + * are suppressed if \em bForce is not set + * @return pointer to @ref TObject, NULL if no more objects available + */ + const TObject* GetNextInputObject(int bForce=0); + + /** + * Get data type of an input block. + * Get data type of the object previously fetched via + * GetFirstInputObject/NextInputObject or the last one if no object + * specified. + * @param pObject pointer to TObject + * @return data specification, kAliHLTVoidDataSpec if failed + */ + AliHLTComponentDataType GetDataType(const TObject* pObject=NULL); + + /** + * Get data specification of an input block. + * Get data specification of the object previously fetched via + * GetFirstInputObject/NextInputObject or the last one if no object + * specified. + * @param pObject pointer to TObject + * @return data specification, kAliHLTVoidDataSpec if failed + */ + AliHLTUInt32_t GetSpecification(const TObject* pObject=NULL); + + /** + * Get the first block of a specific data type from the input data. + * The method looks for the first block of type dt in the input stream. It is intended + * to be used within the high-level interface. + * @param dt data type of the block + * @return pointer to @ref AliHLTComponentBlockData + */ + const AliHLTComponentBlockData* GetFirstInputBlock(const AliHLTComponentDataType& dt=kAliHLTAnyDataType); + + /** + * Get the first block of a specific data type from the input data. + * The method looks for the first block of type specified by the ID and + * Origin strings in the input stream. It is intended + * to be used within the high-level interface. + * @param dtID data type ID of the block + * @param dtOrigin data type origin of the block + * @return pointer to @ref AliHLTComponentBlockData + */ + const AliHLTComponentBlockData* GetFirstInputBlock(const char* dtID, + const char* dtOrigin); + + /** + * Get input block by index + * @return pointer to AliHLTComponentBlockData, NULL if index out of range + */ + const AliHLTComponentBlockData* GetInputBlock(int index); + + /** + * Get the next block of a specific data type from the input data. + * The method looks for the next block of type and class specified + * to the previous @ref GetFirstInputBlock call. + * To be used within the high-level interface. + */ + const AliHLTComponentBlockData* GetNextInputBlock(); + + /** + * Get data specification of an input block. + * Get data specification of the input bblock previously fetched via + * GetFirstInputObject/NextInputObject or the last one if no block + * specified. + * @param pBlock pointer to input block + * @return data specification, kAliHLTVoidDataSpec if failed + */ + AliHLTUInt32_t GetSpecification(const AliHLTComponentBlockData* pBlock=NULL); + + /** + * Insert an object into the output. + * @param pObject pointer to root object + * @param dt data type of the object + * @param spec data specification + * @return neg. error code if failed + */ + int PushBack(TObject* pObject, const AliHLTComponentDataType& dt, + AliHLTUInt32_t spec=kAliHLTVoidDataSpec); + + /** + * Insert an object into the output. + * @param pObject pointer to root object + * @param dtID data type ID of the object + * @param dtOrigin data type origin of the object + * @param spec data specification + * @return neg. error code if failed + */ + int PushBack(TObject* pObject, const char* dtID, const char* dtOrigin, + AliHLTUInt32_t spec=kAliHLTVoidDataSpec); + + /** + * Insert an object into the output. + * @param pBuffer pointer to buffer + * @param iSize size of the buffer + * @param dt data type of the object + * @param spec data specification + * @return neg. error code if failed + */ + int PushBack(void* pBuffer, int iSize, const AliHLTComponentDataType& dt, + AliHLTUInt32_t spec=kAliHLTVoidDataSpec); + + /** + * Insert an object into the output. + * @param pBuffer pointer to buffer + * @param iSize size of the buffer + * @param dtID data type ID of the object + * @param dtOrigin data type origin of the object + * @param spec data specification + * @return neg. error code if failed + */ + int PushBack(void* pBuffer, int iSize, const char* dtID, const char* dtOrigin, + AliHLTUInt32_t spec=kAliHLTVoidDataSpec); + + /** + * Insert event-done data information into the output. + * @param edd event-done data information + */ + int CreateEventDoneData(AliHLTComponentEventDoneData edd); + private: /** * Increment the internal event counter. * To be used by the friend classes AliHLTProcessor, AliHLTDataSource * and AliHLTDataSink. * @return new value of the internal event counter + * @internal */ int IncrementEventCounter(); + /** + * Find the first input block of specified data type beginning at index. + * @param dt data type + * @param startIdx index to start the search + * @return index of the block, -ENOENT if no block found + * + * @internal + */ + int FindInputBlock(const AliHLTComponentDataType& dt, int startIdx=-1); + + /** + * Get index in the array of input bocks. + * Calculate index and check integrety of a block data structure pointer. + * @param pBlock pointer to block data + * @return index of the block, -ENOENT if no block found + * + * @internal + */ + int FindInputBlock(const AliHLTComponentBlockData* pBlock); + + /** + * Create an object from a specified input block. + * @param idx index of the input block + * @param bForce force the retrieval of an object, error messages + * are suppressed if \em bForce is not set + * @return pointer to TObject, caller must delete the object after use + * + * @internal + */ + TObject* CreateInputObject(int idx, int bForce=0); + + /** + * Get input object + * Get object from the input block list + * @param idx index in the input block list + * @param classname name of the class, object is checked for correct class + * name if set + * @param bForce force the retrieval of an object, error messages + * are suppressed if \em bForce is not set + * @return pointer to TObject + * + * @internal + */ + TObject* GetInputObject(int idx, const char* classname=NULL, int bForce=0); + + /** + * Insert a buffer into the output block stream. + * This is the only method to insert blocks into the output stream, called + * from all types of the Pushback method. The actual data might have been + * written to the output buffer already. In that case NULL can be provided + * as buffer, only the block descriptor will be build. + * @param pBuffer pointer to buffer + * @param iSize size of the buffer in byte + * @param dt data type + * @param spec data specification + */ + int InsertOutputBlock(void* pBuffer, int iSize, + const AliHLTComponentDataType& dt, + AliHLTUInt32_t spec); + + /** The global component handler instance */ - static AliHLTComponentHandler* fgpComponentHandler; //! transient + static AliHLTComponentHandler* fgpComponentHandler; //! transient /** The environment where the component is running in */ - AliHLTComponentEnvironment fEnvironment; // see above + AliHLTComponentEnvironment fEnvironment; // see above - /** - * Set by ProcessEvent before the processing starts (e.g. before calling - * @ref AliHLTProcessor::DoEvent) - */ - AliHLTEventID_t fCurrentEvent; // see above + /** Set by ProcessEvent before the processing starts */ + AliHLTEventID_t fCurrentEvent; // see above /** internal event no */ - int fEventCount; // see above + int fEventCount; // see above + + /** the number of failed events */ + int fFailedEvents; // see above + + /** event data struct of the current event under processing */ + AliHLTComponentEventData fCurrentEventData; // see above + + /** array of input data blocks of the current event */ + const AliHLTComponentBlockData* fpInputBlocks; //! transient + + /** index of the current input block */ + int fCurrentInputBlock; // see above + + /** data type of the last block search */ + AliHLTComponentDataType fSearchDataType; // see above + + /** name of the class for the object to search for */ + string fClassName; // see above + + /** array of generated input objects */ + TObjArray* fpInputObjects; //! transient + + /** the output buffer */ + AliHLTUInt8_t* fpOutputBuffer; //! transient + + /** size of the output buffer */ + AliHLTUInt32_t fOutputBufferSize; // see above + + /** size of data written to output buffer */ + AliHLTUInt32_t fOutputBufferFilled; // see above + + /** list of ouput block data descriptors */ + vector fOutputBlocks; // see above ClassDef(AliHLTComponent, 1) }; diff --git a/HLT/BASE/AliHLTComponentHandler.cxx b/HLT/BASE/AliHLTComponentHandler.cxx index 48350854c06..2e98397ca46 100644 --- a/HLT/BASE/AliHLTComponentHandler.cxx +++ b/HLT/BASE/AliHLTComponentHandler.cxx @@ -40,6 +40,7 @@ using namespace std; // the standard components #include "AliHLTFilePublisher.h" #include "AliHLTFileWriter.h" +#include "AliHLTRootFilePublisherComponent.h" #include "AliHLTRootFileWriterComponent.h" /** ROOT macro for the implementation of ROOT specific class methods */ @@ -314,6 +315,7 @@ int AliHLTComponentHandler::AddStandardComponents() AliHLTComponent::SetGlobalComponentHandler(this); fStandardList.push_back(new AliHLTFilePublisher); fStandardList.push_back(new AliHLTFileWriter); + fStandardList.push_back(new AliHLTRootFilePublisherComponent); fStandardList.push_back(new AliHLTRootFileWriterComponent); AliHLTComponent::UnsetGlobalComponentHandler(); iResult=RegisterScheduledComponents(); diff --git a/HLT/BASE/AliHLTConfiguration.cxx b/HLT/BASE/AliHLTConfiguration.cxx index e3cf2285ee0..2bcc4614323 100644 --- a/HLT/BASE/AliHLTConfiguration.cxx +++ b/HLT/BASE/AliHLTConfiguration.cxx @@ -925,7 +925,9 @@ int AliHLTTask::GetNofMatchingDataTypes(const AliHLTTask* pConsumerTask) const if (pConsumerTask) { AliHLTComponent* pComponent=GetComponent(); if (!pComponent) { - // init + // init ? + HLTError("component not initialized"); + iResult=-EFAULT; } if (pComponent) { iResult=pComponent->FindMatchingDataTypes(pConsumerTask->GetComponent(), NULL); diff --git a/HLT/BASE/AliHLTDataSink.cxx b/HLT/BASE/AliHLTDataSink.cxx index 26cbe746c7e..d616fea666b 100644 --- a/HLT/BASE/AliHLTDataSink.cxx +++ b/HLT/BASE/AliHLTDataSink.cxx @@ -61,24 +61,36 @@ void AliHLTDataSink::GetOutputDataSize( unsigned long& constBase, double& inputM } int AliHLTDataSink::DoProcessing( const AliHLTComponentEventData& evtData, - const AliHLTComponentBlockData* blocks, - AliHLTComponentTriggerData& trigData, - AliHLTUInt8_t* outputPtr, - AliHLTUInt32_t& size, - AliHLTUInt32_t& outputBlockCnt, - AliHLTComponentBlockData*& outputBlocks, - AliHLTComponentEventDoneData*& edd ) + const AliHLTComponentBlockData* blocks, + AliHLTComponentTriggerData& trigData, + AliHLTUInt8_t* outputPtr, + AliHLTUInt32_t& size, + vector& outputBlocks, + AliHLTComponentEventDoneData*& edd ) { // see header file for class documentation int iResult=0; if (outputPtr==NULL && size==0 - && outputBlockCnt==0 - && outputBlocks==NULL && edd==NULL) { // this is currently just to get rid of the warning "unused parameter" } - vector blockData; + outputBlocks.clear(); iResult=DumpEvent(evtData, blocks, trigData); return iResult; } + +int AliHLTDataSink::DumpEvent( const AliHLTComponentEventData& evtData, + const AliHLTComponentBlockData* blocks, + AliHLTComponentTriggerData& trigData ) +{ + // we just forward to the high level method, all other parameters already + // have been stored internally + return DumpEvent(evtData, trigData); +} + +int AliHLTDataSink::DumpEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData) +{ + HLTFatal("no processing method implemented"); + return -ENOSYS; +} diff --git a/HLT/BASE/AliHLTDataSink.h b/HLT/BASE/AliHLTDataSink.h index e5ebad5bb05..0141869f18b 100644 --- a/HLT/BASE/AliHLTDataSink.h +++ b/HLT/BASE/AliHLTDataSink.h @@ -1,3 +1,4 @@ +//-*- Mode: C++ -*- // @(#) $Id$ #ifndef ALIHLTDATASINK_H @@ -24,8 +25,6 @@ * - @ref DumpEvent * - @ref GetComponentID * - @ref GetInputDataTypes - * - @ref GetOutputDataType - * - @ref GetOutputDataSize * - @ref Spawn * * @ingroup alihlt_component @@ -48,8 +47,7 @@ class AliHLTDataSink : public AliHLTComponent { AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, - AliHLTUInt32_t& outputBlockCnt, - AliHLTComponentBlockData*& outputBlocks, + vector& outputBlocks, AliHLTComponentEventDoneData*& edd ); // Information member functions for registration. @@ -73,16 +71,29 @@ class AliHLTDataSink : public AliHLTComponent { void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); private: + /** - * Data processing method for the component. + * The low-level data processing method for the component. + * This is the custom processing method and can be overloaded by + * the component. * @param evtData event data structure * @param blocks input data block descriptors * @param trigData trigger data structure */ virtual int DumpEvent( const AliHLTComponentEventData& evtData, - const AliHLTComponentBlockData* blocks, - AliHLTComponentTriggerData& trigData ) = 0; + const AliHLTComponentBlockData* blocks, + AliHLTComponentTriggerData& trigData ); + + /** + * The high-level data processing method. + * This is the default processing method; the method is called + * if no low level @ref DumpEvent method is overloaded by the component. + * @param evtData event data structure + * @param trigData trigger data structure + */ + virtual int DumpEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData); + - ClassDef(AliHLTDataSink, 0) + ClassDef(AliHLTDataSink, 1) }; #endif diff --git a/HLT/BASE/AliHLTDataSource.cxx b/HLT/BASE/AliHLTDataSource.cxx index 9f6292f3391..8ead67e3e56 100644 --- a/HLT/BASE/AliHLTDataSource.cxx +++ b/HLT/BASE/AliHLTDataSource.cxx @@ -55,8 +55,7 @@ int AliHLTDataSource::DoProcessing( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, - AliHLTUInt32_t& outputBlockCnt, - AliHLTComponentBlockData*& outputBlocks, + vector& outputBlocks, AliHLTComponentEventDoneData*& edd ) { // see header file for class documentation @@ -64,18 +63,28 @@ int AliHLTDataSource::DoProcessing( const AliHLTComponentEventData& evtData, if (blocks) { // this is currently just to get rid of the warning "unused parameter" } - vector blockData; if (evtData.fBlockCnt > 0) { HLTWarning("Data source component skips input data blocks"); } - iResult=GetEvent(evtData, trigData, outputPtr, size, blockData); + iResult=GetEvent(evtData, trigData, outputPtr, size, outputBlocks); HLTDebug("component %s (%p) GetEvent finished (%d)", GetComponentID(), this, iResult); - if (iResult>=0) { - iResult=MakeOutputDataBlockList(blockData, &outputBlockCnt, &outputBlocks); - if (iResult<0) { - HLTFatal("component %s (%p): can not convert output block descriptor list", GetComponentID(), this); - } - } edd = NULL; return iResult; } + +int AliHLTDataSource::GetEvent( const AliHLTComponentEventData& evtData, + AliHLTComponentTriggerData& trigData, + AliHLTUInt8_t* outputPtr, + AliHLTUInt32_t& size, + vector& outputBlocks ) +{ + // we just forward to the high level method, all other parameters already + // have been stored internally + return GetEvent(evtData, trigData); +} + +int AliHLTDataSource::GetEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData) +{ + HLTFatal("no processing method implemented"); + return -ENOSYS; +} diff --git a/HLT/BASE/AliHLTDataSource.h b/HLT/BASE/AliHLTDataSource.h index 70e0d23cd5c..07726bdeb94 100644 --- a/HLT/BASE/AliHLTDataSource.h +++ b/HLT/BASE/AliHLTDataSource.h @@ -1,3 +1,4 @@ +//-*- Mode: C++ -*- // @(#) $Id$ #ifndef ALIHLTDATASOURCE_H @@ -47,8 +48,7 @@ class AliHLTDataSource : public AliHLTComponent { AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, - AliHLTUInt32_t& outputBlockCnt, - AliHLTComponentBlockData*& outputBlocks, + vector& outputBlocks, AliHLTComponentEventDoneData*& edd ); // Information member functions for registration. @@ -66,22 +66,35 @@ class AliHLTDataSource : public AliHLTComponent { void GetInputDataTypes( vector& list); private: + /** - * Data processing method for the component. + * The low-level data processing method for the component. + * This is the custom processing method and can be overloaded by + * the component. * @param evtData event data structure * @param trigData trigger data structure * @param outputPtr pointer to target buffer * @param size input: size of target buffer * output:size of produced data * @param outputBlocks list to receive output block descriptors - * @return + * @return neg. error code if failed */ virtual int GetEvent( const AliHLTComponentEventData& evtData, - AliHLTComponentTriggerData& trigData, - AliHLTUInt8_t* outputPtr, - AliHLTUInt32_t& size, - vector& outputBlocks ) = 0; + AliHLTComponentTriggerData& trigData, + AliHLTUInt8_t* outputPtr, + AliHLTUInt32_t& size, + vector& outputBlocks ); + + /** + * The high-level data processing method. + * This is the default processing method; the method is called + * if no low level @ref GetEvent method is overloaded by the component. + * @param evtData event data structure + * @param trigData trigger data structure + * @return neg. error code if failed + */ + virtual int GetEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData); - ClassDef(AliHLTDataSource, 0) + ClassDef(AliHLTDataSource, 1) }; #endif diff --git a/HLT/BASE/AliHLTDataTypes.h b/HLT/BASE/AliHLTDataTypes.h index 99ad43ca5c8..80ff66ccecc 100644 --- a/HLT/BASE/AliHLTDataTypes.h +++ b/HLT/BASE/AliHLTDataTypes.h @@ -62,6 +62,7 @@ extern "C" { # define kAliHLTAnyDataOrigin "***" const AliHLTComponentDataType kAliHLTVoidDataType = {sizeof(AliHLTComponentDataType), kAliHLTVoidDataTypeID, kAliHLTVoidDataOrigin}; const AliHLTComponentDataType kAliHLTAnyDataType = {sizeof(AliHLTComponentDataType), kAliHLTAnyDataTypeID, kAliHLTAnyDataOrigin}; + const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0; struct AliHLTComponentBlockData { diff --git a/HLT/BASE/AliHLTFilePublisher.cxx b/HLT/BASE/AliHLTFilePublisher.cxx index 7a740dd5be9..20f707fc4da 100644 --- a/HLT/BASE/AliHLTFilePublisher.cxx +++ b/HLT/BASE/AliHLTFilePublisher.cxx @@ -196,7 +196,7 @@ int AliHLTFilePublisher::ScanArgument(int argc, const char** argv) if (argc==0 && argv==NULL) { // this is just to get rid of the warning "unused parameter" } - return -EINVAL; + return -EPROTO; } int AliHLTFilePublisher::OpenFiles() @@ -281,3 +281,13 @@ int AliHLTFilePublisher::GetEvent( const AliHLTComponentEventData& evtData, } return iResult; } + +AliHLTComponentDataType AliHLTFilePublisher::GetCurrentDataType() const +{ + return fDataType; +} + +AliHLTUInt32_t AliHLTFilePublisher::GetCurrentSpecification() const +{ + return fSpecification; +} diff --git a/HLT/BASE/AliHLTFilePublisher.h b/HLT/BASE/AliHLTFilePublisher.h index 2d61e0b528d..ee2a4b28518 100644 --- a/HLT/BASE/AliHLTFilePublisher.h +++ b/HLT/BASE/AliHLTFilePublisher.h @@ -107,6 +107,17 @@ class AliHLTFilePublisher : public AliHLTDataSource { */ virtual int ScanArgument(int argc, const char** argv); + protected: + /** + * Get the data type which is set for the current file + */ + AliHLTComponentDataType GetCurrentDataType() const; + + /** + * Get the data specification which is set for the current file + */ + AliHLTUInt32_t GetCurrentSpecification() const; + private: /** list of file names */ TList fFileNames; // see above diff --git a/HLT/BASE/AliHLTMessage.cxx b/HLT/BASE/AliHLTMessage.cxx new file mode 100644 index 00000000000..4dccc808e5e --- /dev/null +++ b/HLT/BASE/AliHLTMessage.cxx @@ -0,0 +1,316 @@ +// $Id$ + +/** @file AliHLTMessage.cxx + @author Matthias Richter (customization of Root TMessage ) + @date + @brief Serialization of Root objects in the ALICE HLT. */ + +// This is the original Root TMessage implementation with a few minor +// modifications, original revision: +// root/net: v5-14-00 $: TMessage.cxx,v 1.6 2004/05/07 09:51:58 brun +// Author: Fons Rademakers 19/12/96 + +/************************************************************************* + * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +////////////////////////////////////////////////////////////////////////// +// // +// TMessage // +// // +// Message buffer class used for serializing objects and sending them // +// over a network. This class inherits from TBuffer the basic I/O // +// serializer. // +// // +////////////////////////////////////////////////////////////////////////// + +#include "AliHLTMessage.h" +#include "Bytes.h" +#include "TFile.h" + +extern "C" void R__zip (Int_t cxlevel, Int_t *nin, char *bufin, Int_t *lout, char *bufout, Int_t *nout); +extern "C" void R__unzip(Int_t *nin, UChar_t *bufin, Int_t *lout, char *bufout, Int_t *nout); +const Int_t kMAXBUF = 0xffffff; + + +ClassImp(AliHLTMessage) + +//______________________________________________________________________________ +AliHLTMessage::AliHLTMessage(UInt_t what) : TBuffer(kWrite) +{ + // Create a AliHLTMessage object for storing objects. The "what" integer + // describes the type of message. Predifined ROOT system message types + // can be found in MessageTypes.h. Make sure your own message types are + // unique from the ROOT defined message types (i.e. 0 - 10000 are + // reserved by ROOT). In case you OR "what" with kMESS_ACK, the message + // will wait for an acknowledgement from the remote side. This makes + // the sending process synchronous. In case you OR "what" with kMESS_ZIP, + // the message will be compressed in TSocket using the zip algorithm + // (only if message is > 256 bytes). + + // space at the beginning of the message reserved for the message length + UInt_t reserved = 0; + *this << reserved; + + fWhat = what; + *this << what; + + fClass = 0; + fCompress = 0; + fBufComp = 0; + fBufCompCur = 0; + fCompPos = 0; +} + +//______________________________________________________________________________ +AliHLTMessage::AliHLTMessage(void *buf, Int_t bufsize) : TBuffer(kRead, bufsize, buf, 0) +{ + // Create a AliHLTMessage object for reading objects. The objects will be + // read from buf. Use the What() method to get the message type. + + // skip space at the beginning of the message reserved for the message length + fBufCur += sizeof(UInt_t); + + *this >> fWhat; + + fCompress = 0; + fBufComp = 0; + fBufCompCur = 0; + fCompPos = 0; + + if (fWhat & kMESS_ZIP) { + // if buffer has kMESS_ZIP set, move it to fBufComp and uncompress + fBufComp = fBuffer; + fBufCompCur = fBuffer + bufsize; + fBuffer = 0; + Uncompress(); + } + + if (fWhat == kMESS_OBJECT) { + InitMap(); + fClass = ReadClass(); // get first the class stored in message + SetBufferOffset(sizeof(UInt_t) + sizeof(fWhat)); + ResetMap(); + } else { + fClass = 0; + } +} + +//______________________________________________________________________________ +AliHLTMessage::~AliHLTMessage() +{ + // Clean up compression buffer. + delete [] fBufComp; +} + +//______________________________________________________________________________ +void AliHLTMessage::Forward() +{ + // Change a buffer that was received into one that can be send, i.e. + // forward a just received message. + + if (IsReading()) { + SetWriteMode(); + SetBufferOffset(fBufSize); + + if (fBufComp) { + fCompPos = fBufCur; + } + } +} + +//______________________________________________________________________________ +void AliHLTMessage::Reset() +{ + // Reset the message buffer so we can use (i.e. fill) it again. + + SetBufferOffset(sizeof(UInt_t) + sizeof(fWhat)); + ResetMap(); + + if (fBufComp) { + delete [] fBufComp; + fBufComp = 0; + fBufCompCur = 0; + fCompPos = 0; + } +} + +//______________________________________________________________________________ +void AliHLTMessage::SetLength() const +{ + // Set the message length at the beginning of the message buffer. + + if (IsWriting()) { + char *buf = Buffer(); + *((UInt_t*)buf) = (UInt_t)(Length() - sizeof(UInt_t)); + + if (fBufComp) { + buf = fBufComp; + *((UInt_t*)buf) = (UInt_t)(Length() - sizeof(UInt_t)); + } + } +} + +//______________________________________________________________________________ +void AliHLTMessage::SetWhat(UInt_t what) +{ + // Using this method one can change the message type a-posteriory. + // In case you OR "what" with kMESS_ACK, the message will wait for + // an acknowledgement from the remote side. This makes the sending + // process synchronous. + + fWhat = what; + + char *buf = Buffer(); + buf += sizeof(UInt_t); // skip reserved length space + tobuf(buf, what); + + if (fBufComp) { + buf = fBufComp; + buf += sizeof(UInt_t); // skip reserved length space + tobuf(buf, what | kMESS_ZIP); + } +} + +//______________________________________________________________________________ +void AliHLTMessage::SetCompressionLevel(Int_t level) +{ + // Set the message compression level. Can be between 0 and 9 with 0 + // being no compression and 9 maximum compression. In general the default + // level of 1 is the best compromise between achieved compression and + // cpu time. Compression will only happen when the message is > 256 bytes. + + if (level < 0) level = 0; + if (level > 9) level = 9; + + if (level != fCompress && fBufComp) { + delete [] fBufComp; + fBufComp = 0; + fBufCompCur = 0; + fCompPos = 0; + } + fCompress = level; +} + +//______________________________________________________________________________ +Int_t AliHLTMessage::Compress() +{ + // Compress the message. The message will only be compressed if the + // compression level > 0 and the if the message is > 256 bytes. + // Returns -1 in case of error (when compression fails or + // when the message increases in size in some pathological cases), + // otherwise returns 0. + + if (fCompress == 0) { + // no compression specified + if (fBufComp) { + delete [] fBufComp; + fBufComp = 0; + fBufCompCur = 0; + fCompPos = 0; + } + return 0; + } + + if (fBufComp && fCompPos == fBufCur) { + // the message was already compressed + return 0; + } + + // remove any existing compressed buffer before compressing modified message + if (fBufComp) { + delete [] fBufComp; + fBufComp = 0; + fBufCompCur = 0; + fCompPos = 0; + } + + if (Length() <= (Int_t)(256 + 2*sizeof(UInt_t))) { + // this message is too small to be compressed + return 0; + } + + Int_t hdrlen = 2*sizeof(UInt_t); + Int_t messlen = Length() - hdrlen; + Int_t nbuffers = messlen / kMAXBUF; + Int_t chdrlen = 3*sizeof(UInt_t); // compressed buffer header length + Int_t buflen = TMath::Max(512, chdrlen + messlen + 9*nbuffers); + fBufComp = new char[buflen]; + char *messbuf = Buffer() + hdrlen; + char *bufcur = fBufComp + chdrlen; + Int_t noutot = 0; + Int_t nzip = 0; + Int_t nout, bufmax; + for (Int_t i = 0; i <= nbuffers; i++) { + if (i == nbuffers) + bufmax = messlen - nzip; + else + bufmax = kMAXBUF; + R__zip(fCompress, &bufmax, messbuf, &bufmax, bufcur, &nout); + if (nout == 0 || nout >= messlen) { + //this happens when the buffer cannot be compressed + delete [] fBufComp; + fBufComp = 0; + fBufCompCur = 0; + fCompPos = 0; + return -1; + } + bufcur += nout; + noutot += nout; + messbuf += kMAXBUF; + nzip += kMAXBUF; + } + fBufCompCur = bufcur; + fCompPos = fBufCur; + + bufcur = fBufComp; + tobuf(bufcur, (UInt_t)(CompLength() - sizeof(UInt_t))); + Int_t what = fWhat | kMESS_ZIP; + tobuf(bufcur, what); + tobuf(bufcur, Length()); // original uncompressed buffer length + + return 0; +} + +//______________________________________________________________________________ +Int_t AliHLTMessage::Uncompress() +{ + // Uncompress the message. The message will only be uncompressed when + // kMESS_ZIP is set. Returns -1 in case of error, 0 otherwise. + + if (!fBufComp || !(fWhat & kMESS_ZIP)) + return -1; + + Int_t buflen; + Int_t hdrlen = 2*sizeof(UInt_t); + UChar_t *bufcur = (UChar_t*)fBufComp + hdrlen; + frombuf((char *&)bufcur, &buflen); + fBuffer = new char[buflen]; + fBufSize = buflen; + fBufCur = fBuffer + sizeof(UInt_t) + sizeof(fWhat); + fBufMax = fBuffer + fBufSize; + char *messbuf = fBuffer + hdrlen; + + Int_t nin, nout, nbuf; + Int_t noutot = 0; + while (1) { + nin = 9 + ((Int_t)bufcur[3] | ((Int_t)bufcur[4] << 8) | ((Int_t)bufcur[5] << 16)); + nbuf = (Int_t)bufcur[6] | ((Int_t)bufcur[7] << 8) | ((Int_t)bufcur[8] << 16); + R__unzip(&nin, bufcur, &nbuf, messbuf, &nout); + if (!nout) break; + noutot += nout; + if (noutot >= buflen - hdrlen) break; + bufcur += nin; + messbuf += nout; + } + + fWhat &= ~kMESS_ZIP; + fCompress = 1; + + return 0; +} + diff --git a/HLT/BASE/AliHLTMessage.h b/HLT/BASE/AliHLTMessage.h new file mode 100644 index 00000000000..df3314b833e --- /dev/null +++ b/HLT/BASE/AliHLTMessage.h @@ -0,0 +1,89 @@ +// $Id$ + +/** @file AliHLTMessage.h + @author Matthias Richter (customization of Root TMessage ) + @date + @brief Serialization of Root objects in the ALICE HLT. */ + +// This is the original Root TMessage implementation with a few minor +// modifications, original revision: +// root/net: v5-14-00 $: TMessage.h,v 1.9 2005/12/09 15:12:19 rdm +// Author: Fons Rademakers 19/12/96 + +/************************************************************************* + * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifndef ALIHLTMESSAGE_H +#define ALIHLTMESSAGE_H + + +////////////////////////////////////////////////////////////////////////// +// // +// TMessage // +// // +// Message buffer class used for serializing objects and sending them // +// over the network. // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef ROOT_TBuffer +#include "TBuffer.h" +#endif +#ifndef ROOT_MessageTypes +#include "MessageTypes.h" +#endif + +#include "AliHLTLogging.h" +/** + * @class AliHLTMessage + * Serialization of Root objects for transport in the Alice HLT analysis + * chain. + * This is the original Root TMessage implementation with a few minor + * modifications. + * - the AliHLTMessage(void *buf, Int_t bufsize) constructor has been made + * public in order to be used externally. + */ +class AliHLTMessage : public TBuffer, public AliHLTLogging { + +public: + AliHLTMessage(UInt_t what = kMESS_ANY); + AliHLTMessage(void *buf, Int_t bufsize); + virtual ~AliHLTMessage(); + + void SetLength() const; + + void Forward(); + TClass *GetClass() const { return fClass; } + void Reset(); + void Reset(UInt_t what) { SetWhat(what); Reset(); } + UInt_t What() const { return fWhat; } + void SetWhat(UInt_t what); + + void SetCompressionLevel(Int_t level = 1); + Int_t GetCompressionLevel() const { return fCompress; } + Int_t Compress(); + Int_t Uncompress(); + char *CompBuffer() const { return fBufComp; } + Int_t CompLength() const { return (Int_t)(fBufCompCur - fBufComp); } + +private: + UInt_t fWhat; //Message type + TClass *fClass; //If message is kMESS_OBJECT pointer to object's class + Int_t fCompress; //Compression level from 0 (not compressed) to 9 (max compression) + char *fBufComp; //Compressed buffer + char *fBufCompCur; //Current position in compressed buffer + char *fCompPos; //Position of fBufCur when message was compressed + + // AliHLTMessage objects cannot be copied or assigned + AliHLTMessage(const AliHLTMessage &); // not implemented + void operator=(const AliHLTMessage &); // not implemented + + ClassDef(AliHLTMessage,0) // Message buffer class +}; + +#endif // ALIHLTMESSAGE_H diff --git a/HLT/BASE/AliHLTProcessor.cxx b/HLT/BASE/AliHLTProcessor.cxx index a8d2bded0b1..9460bb714c4 100644 --- a/HLT/BASE/AliHLTProcessor.cxx +++ b/HLT/BASE/AliHLTProcessor.cxx @@ -63,17 +63,31 @@ int AliHLTProcessor::Deinit() int AliHLTProcessor::DoProcessing( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, - AliHLTUInt32_t& size, AliHLTUInt32_t& outputBlockCnt, - AliHLTComponentBlockData*& outputBlocks, + AliHLTUInt32_t& size, + vector& outputBlocks, AliHLTComponentEventDoneData*& edd ) { // see header file for class documentation int iResult=0; - vector blockData; - iResult=DoEvent(evtData, blocks, trigData, outputPtr, size, blockData); - if (iResult>=0) { - iResult=MakeOutputDataBlockList(blockData, &outputBlockCnt, &outputBlocks); - } + iResult=DoEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks); edd = NULL; return iResult; } + +int AliHLTProcessor::DoEvent( const AliHLTComponentEventData& evtData, + const AliHLTComponentBlockData* blocks, + AliHLTComponentTriggerData& trigData, + AliHLTUInt8_t* outputPtr, + AliHLTUInt32_t& size, + vector& outputBlocks ) +{ + // we just forward to the high level method, all other parameters already + // have been stored internally + return DoEvent(evtData, trigData); +} + +int AliHLTProcessor::DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData) +{ + HLTFatal("no processing method implemented"); + return -ENOSYS; +} diff --git a/HLT/BASE/AliHLTProcessor.h b/HLT/BASE/AliHLTProcessor.h index be6494cc15a..1d74711dbf9 100644 --- a/HLT/BASE/AliHLTProcessor.h +++ b/HLT/BASE/AliHLTProcessor.h @@ -1,3 +1,4 @@ +//-*- Mode: C++ -*- // @(#) $Id$ #ifndef ALIHLTPROCESSOR_H @@ -51,8 +52,7 @@ class AliHLTProcessor : public AliHLTComponent { AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, - AliHLTUInt32_t& outputBlockCnt, - AliHLTComponentBlockData*& outputBlocks, + vector& outputBlocks, AliHLTComponentEventDoneData*& edd ); // Information member functions for registration. @@ -65,7 +65,9 @@ class AliHLTProcessor : public AliHLTComponent { private: /** - * Data processing method for the component. + * The low-level data processing method for the component. + * This is the custom processing method and can be overloaded by + * the component. * @param evtData event data structure * @param blocks input data block descriptors * @param trigData trigger data structure @@ -73,14 +75,25 @@ class AliHLTProcessor : public AliHLTComponent { * @param size input: size of target buffer * output:size of produced data * @param outputBlocks list to receive output block descriptors + * @return neg. error code if failed */ virtual int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, AliHLTUInt32_t& size, - vector& outputBlocks ) = 0; + vector& outputBlocks ); - ClassDef(AliHLTProcessor, 0) + /** + * The high-level data processing method. + * This is the default processing method; the method is called + * if no low level @ref DoEvent method is overloaded by the component. + * @param evtData event data structure + * @param trigData trigger data structure + * @return neg. error code if failed + */ + virtual int DoEvent( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData); + + ClassDef(AliHLTProcessor, 1) }; #endif diff --git a/HLT/BASE/AliHLTRootFilePublisherComponent.cxx b/HLT/BASE/AliHLTRootFilePublisherComponent.cxx new file mode 100644 index 00000000000..4192249862d --- /dev/null +++ b/HLT/BASE/AliHLTRootFilePublisherComponent.cxx @@ -0,0 +1,139 @@ +// $Id$ + +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Authors: Matthias Richter * + * for The ALICE Off-line Project. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/** @file AliHLTRootFilePublisherComponent.cxx + @author Matthias Richter + @date + @brief HLT file publisher component implementation. */ + +#if __GNUC__>= 3 +using namespace std; +#endif + +#include "AliHLTRootFilePublisherComponent.h" +//#include +//#include +//#include + +// temporary +#include "TH1F.h" + +/** ROOT macro for the implementation of ROOT specific class methods */ +ClassImp(AliHLTRootFilePublisherComponent) + +AliHLTRootFilePublisherComponent::AliHLTRootFilePublisherComponent() + : + AliHLTFilePublisher() +{ + // see header file for class documentation + // or + // refer to README to build package + // or + // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt + +} + +AliHLTRootFilePublisherComponent::AliHLTRootFilePublisherComponent(const AliHLTRootFilePublisherComponent&) + : + AliHLTFilePublisher() +{ + // see header file for class documentation + HLTFatal("copy constructor untested"); +} + +AliHLTRootFilePublisherComponent& AliHLTRootFilePublisherComponent::operator=(const AliHLTRootFilePublisherComponent&) +{ + // see header file for class documentation + HLTFatal("assignment operator untested"); + return *this; +} + +AliHLTRootFilePublisherComponent::~AliHLTRootFilePublisherComponent() +{ + // see header file for class documentation + + // file list and file name list are owner of their objects and + // delete all the objects +} + +const char* AliHLTRootFilePublisherComponent::GetComponentID() +{ + // see header file for class documentation + return "ROOTFilePublisher"; +} + +AliHLTComponentDataType AliHLTRootFilePublisherComponent::GetOutputDataType() +{ + // see header file for class documentation + AliHLTComponentDataType dt = + {sizeof(AliHLTComponentDataType), + kAliHLTVoidDataTypeID, + kAliHLTVoidDataOrigin}; + return dt; +} + +void AliHLTRootFilePublisherComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) +{ + // see header file for class documentation + constBase=10000; + inputMultiplier=1.0; +} + +AliHLTComponent* AliHLTRootFilePublisherComponent::Spawn() +{ + // see header file for class documentation + return new AliHLTRootFilePublisherComponent; +} + +int AliHLTRootFilePublisherComponent::ScanArgument(int argc, const char** argv) +{ + // see header file for class documentation + + // there are no other arguments than the standard ones + if (argc==0 && argv==NULL) { + // this is just to get rid of the warning "unused parameter" + } + int iResult=-EPROTO; + return iResult; +} + +int AliHLTRootFilePublisherComponent::OpenFiles() +{ + // see header file for class documentation + int iResult=0; + return iResult; +} + +int AliHLTRootFilePublisherComponent::GetEvent( const AliHLTComponentEventData& evtData, + AliHLTComponentTriggerData& trigData, + AliHLTUInt8_t* outputPtr, + AliHLTUInt32_t& size, + vector& outputBlocks ) +{ + int iResult=0; + if (GetCurrentSpecification()==0) { + TH1F *hpx = new TH1F("hpx","px distribution",100,-4,4); + hpx->FillRandom("gaus",1000); + PushBack(hpx, "TH1F", "ROOT"); + } else { + TH1F *hpy = new TH1F("hpy","py distribution",100,-10,10); + hpy->FillRandom("gaus",10000); + PushBack(hpy, "TH1F", "ROOT"); + } + + return iResult; +} diff --git a/HLT/BASE/AliHLTRootFilePublisherComponent.h b/HLT/BASE/AliHLTRootFilePublisherComponent.h new file mode 100644 index 00000000000..94241978a54 --- /dev/null +++ b/HLT/BASE/AliHLTRootFilePublisherComponent.h @@ -0,0 +1,96 @@ +// @(#) $Id$ + +#ifndef ALIHLTROOTFILEPUBLISHERCOMPONENT_H +#define ALIHLTROOTFILEPUBLISHERCOMPONENT_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/** @file AliHLTRootFilePublisherComponent.h + @author Matthias Richter + @date + @brief component for publishing of Root objects from a root file. + @note The class is used in Offline (AliRoot) context +*/ + +#include "AliHLTFilePublisher.h" +#include + +/** + * @class AliHLTRootFilePublisherComponent + * An HLT data source component which publishes data from one or a sequence + * of files.
+ * + * Component ID: \b RootFilePublisherComponent
+ * Library: \b libHLTBase (in order to use the component from the external + * interface, it might be necessary to specify a dummy library with the + * \em -componentlibrary argument). + * + * Mandatory arguments:
+ * + * Optional arguments:
+ * + * @see AliHLTFilePublisher for default arguments + * @ingroup alihlt_component + */ +class AliHLTRootFilePublisherComponent : public AliHLTFilePublisher { + public: + /** standard constructor */ + AliHLTRootFilePublisherComponent(); + /** not a valid copy constructor, defined according to effective C++ style */ + AliHLTRootFilePublisherComponent(const AliHLTRootFilePublisherComponent&); + /** not a valid assignment op, but defined according to effective C++ style */ + AliHLTRootFilePublisherComponent& operator=(const AliHLTRootFilePublisherComponent&); + /** destructor */ + virtual ~AliHLTRootFilePublisherComponent(); + + const char* GetComponentID(); + AliHLTComponentDataType GetOutputDataType(); + void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); + AliHLTComponent* Spawn(); + + /** + * Open all files. + * Opens all files from the file name list @ref fFileNames and adds TFile + * opjects to the TFiles list. + */ + int OpenFiles(); + + protected: + /** + * Data processing method for the component. + * The component uses the @ref alihltcomponent-high-level-interface + * to put serialized Root object into the output stream. Despite of that it + * implements the lox-level DumpEvent method in order to allow child classes + * to use the low-level method. + * @param evtData event data structure + * @param trigData trigger data structure + * @param outputPtr pointer to target buffer + * @param size input: size of target buffer + * output:size of produced data + * @param outputBlocks list to receive output block descriptors + * @return + */ + int GetEvent( const AliHLTComponentEventData& evtData, + AliHLTComponentTriggerData& trigData, + AliHLTUInt8_t* outputPtr, + AliHLTUInt32_t& size, + vector& outputBlocks ); + + /** + * Scan one argument and adjacent parameters. + * Can be overloaded by child classes in order to add additional arguments + * beyond the standard arguments of the file publisher. The method is called + * whenever a non-standard argument is recognized. + * @param argc size of the argument array + * @param argv agument array for component initialization + * @return number of processed members of the argv
+ * -EINVAL unknown argument
+ * -EPROTO parameter for argument missing
+ */ + virtual int ScanArgument(int argc, const char** argv); + + private: + + ClassDef(AliHLTRootFilePublisherComponent, 0) +}; +#endif diff --git a/HLT/BASE/AliHLTRootFileWriterComponent.cxx b/HLT/BASE/AliHLTRootFileWriterComponent.cxx index e65bc3fceb8..55db5bdc6a8 100644 --- a/HLT/BASE/AliHLTRootFileWriterComponent.cxx +++ b/HLT/BASE/AliHLTRootFileWriterComponent.cxx @@ -58,12 +58,21 @@ int AliHLTRootFileWriterComponent::DumpEvent( const AliHLTComponentEventData& ev { // see header file for class documentation int iResult=0; - // this function will be implemented in conjunction with the high-level - // component interface - HLTWarning("not yet implemented"); if (evtData.fStructSize==0 && blocks==NULL && trigData.fStructSize==0) { // this is just to get rid of the warning "unused parameter" } + const TObject* pObj=GetFirstInputObject(kAliHLTAnyDataType); + HLTDebug("got first object %p", pObj); + int count=0; + while (pObj && iResult>=0) { + iResult=WriteObject(evtData.fEventID, pObj); + if (iResult) { + count++; + HLTDebug("wrote object of class %s, data type %s", pObj->ClassName(), (DataType2Text(GetDataType(pObj)).c_str())); + } + pObj=GetNextInputObject(); + } + HLTDebug("wrote %d of %d object(s) to file", count, GetNumberOfInputBlocks()); return iResult; } @@ -78,7 +87,7 @@ int AliHLTRootFileWriterComponent::ScanArgument(int argc, const char** argv) return iResult; } -int AliHLTRootFileWriterComponent::WriteObject(const AliHLTEventID_t eventID, TObject *pOb) +int AliHLTRootFileWriterComponent::WriteObject(const AliHLTEventID_t eventID, const TObject *pOb) { // see header file for class documentation int iResult=0; diff --git a/HLT/BASE/AliHLTRootFileWriterComponent.h b/HLT/BASE/AliHLTRootFileWriterComponent.h index dc74d47b418..05eb08f5610 100644 --- a/HLT/BASE/AliHLTRootFileWriterComponent.h +++ b/HLT/BASE/AliHLTRootFileWriterComponent.h @@ -18,6 +18,9 @@ class TFile; /** * @class AliHLTRootFileWriterComponent + * The RootFileWriter provides a stand alone component to write incoming + * TObject like structures into a Root file. Furthermore it functions as + * base class for customized writers. * @see AliHLTFileWriter for parameters */ class AliHLTRootFileWriterComponent : public AliHLTFileWriter @@ -48,7 +51,11 @@ class AliHLTRootFileWriterComponent : public AliHLTFileWriter /** * Data processing method for the component. * The function can be overloaded by specific ROOT file writer - * components. + * components. The RootFileWriter processes only TObject like data + * structures of the input blocks and uses the + * @ref alihltcomponent-high-level-interface. Despite of that it implements + * the lox-level DumpEvent method in order to allow child classes to use the + * low-level method. * @param evtData event data structure * @param blocks input data block descriptors * @param trigData trigger data structure @@ -77,7 +84,7 @@ class AliHLTRootFileWriterComponent : public AliHLTFileWriter * @param pOb pointer to ROOT object * @return neg. error code if failed */ - int WriteObject(const AliHLTEventID_t eventID, TObject *pOb); + int WriteObject(const AliHLTEventID_t eventID, const TObject *pOb); /** * Open a ROOT file. diff --git a/HLT/BASE/HLTbaseLinkDef.h b/HLT/BASE/HLTbaseLinkDef.h index fef323bff31..011906fc6e5 100644 --- a/HLT/BASE/HLTbaseLinkDef.h +++ b/HLT/BASE/HLTbaseLinkDef.h @@ -20,6 +20,7 @@ #pragma link C++ class AliHLTFilePublisher; #pragma link C++ class AliHLTFileWriter; #pragma link C++ class AliHLTRootFileWriterComponent; +#pragma link C++ class AliHLTRootFilePublisherComponent; #endif diff --git a/HLT/BASE/Makefile.am b/HLT/BASE/Makefile.am index fdb6fe65888..59f6ed1039f 100644 --- a/HLT/BASE/Makefile.am +++ b/HLT/BASE/Makefile.am @@ -18,7 +18,7 @@ bin_SCRIPTS = setenv.sh setenv.csh lib_LTLIBRARIES = libHLTbase.la # version info for the library -LIBRARY_VERSION = '1:1:0' +LIBRARY_VERSION = '2:0:0' # MODDIR is set by the AliRoot build system and denotes the topdir # of the module, we must set it since the package definition libHLTbase.pkg diff --git a/HLT/ChangeLog b/HLT/ChangeLog index 7194c08fbd0..33c42ad5f41 100644 --- a/HLT/ChangeLog +++ b/HLT/ChangeLog @@ -1,3 +1,7 @@ +2007-02-21 + - high-level component interface added + - libHLTbase version 2:0:0 + 2007-02-20 version HLT-v0-5 tagged 2007-02-20 diff --git a/HLT/TPCLib/AliHLTTPCClusterFinderComponent.h b/HLT/TPCLib/AliHLTTPCClusterFinderComponent.h index 8d0d51d7b08..f0dd2317014 100644 --- a/HLT/TPCLib/AliHLTTPCClusterFinderComponent.h +++ b/HLT/TPCLib/AliHLTTPCClusterFinderComponent.h @@ -55,7 +55,7 @@ class AliHLTTPCClusterFinderComponent : public AliHLTProcessor AliHLTComponentDataType GetOutputDataType(); virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); AliHLTComponent* Spawn(); - + protected: // Protected functions to implement AliHLTComponent's interface. diff --git a/HLT/TPCLib/AliHLTTPCGlobalMergerComponent.h b/HLT/TPCLib/AliHLTTPCGlobalMergerComponent.h index f855cf6e87c..efb81daa989 100644 --- a/HLT/TPCLib/AliHLTTPCGlobalMergerComponent.h +++ b/HLT/TPCLib/AliHLTTPCGlobalMergerComponent.h @@ -29,7 +29,7 @@ class AliHLTTPCGlobalMergerComponent : public AliHLTProcessor AliHLTComponentDataType GetOutputDataType(); virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); AliHLTComponent* Spawn(); - + protected: void SetMergerParameters(Double_t maxy=2.0,Double_t maxz=3.0,Double_t maxkappa=0.003, diff --git a/HLT/TPCLib/AliHLTTPCPad.h b/HLT/TPCLib/AliHLTTPCPad.h index 5f1867c938a..a1ecf2f1d5d 100644 --- a/HLT/TPCLib/AliHLTTPCPad.h +++ b/HLT/TPCLib/AliHLTTPCPad.h @@ -86,7 +86,7 @@ class AliHLTTPCPad : public AliHLTLogging { * Calculate the base line from the current event data. * Only available within an event cycle.
* The calculation requires a minimum number of bins which contribute - * to the sum, which can be specified by @param reqMinCount. The base line + * to the sum, which can be specified by \e reqMinCount. The base line * calculation will also be skipped if the number of contributing bins is * less than half of the total number of time bins. * @param reqMinCount the minimum number of bins contributing to the sum diff --git a/HLT/TPCLib/AliHLTTPCRawDataUnpackerComponent.h b/HLT/TPCLib/AliHLTTPCRawDataUnpackerComponent.h index 4e08c1ffab0..6f91a51c0f0 100644 --- a/HLT/TPCLib/AliHLTTPCRawDataUnpackerComponent.h +++ b/HLT/TPCLib/AliHLTTPCRawDataUnpackerComponent.h @@ -29,7 +29,7 @@ class AliHLTTPCRawDataUnpackerComponent : public AliHLTProcessor AliHLTComponentDataType GetOutputDataType(); virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); AliHLTComponent* Spawn(); - + protected: // Protected functions to implement AliHLTComponent's interface. diff --git a/HLT/TPCLib/AliHLTTPCSliceTrackerComponent.h b/HLT/TPCLib/AliHLTTPCSliceTrackerComponent.h index eec35f5c30d..be2368b2366 100644 --- a/HLT/TPCLib/AliHLTTPCSliceTrackerComponent.h +++ b/HLT/TPCLib/AliHLTTPCSliceTrackerComponent.h @@ -29,7 +29,7 @@ class AliHLTTPCSliceTrackerComponent : public AliHLTProcessor AliHLTComponentDataType GetOutputDataType(); virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); AliHLTComponent* Spawn(); - + protected: void SetTrackerParam(Int_t phi_segments=50,Int_t eta_segments=100, diff --git a/HLT/TPCLib/AliHLTTPCVertexFinderComponent.h b/HLT/TPCLib/AliHLTTPCVertexFinderComponent.h index 4a17f08c1e9..6af5532d5e3 100644 --- a/HLT/TPCLib/AliHLTTPCVertexFinderComponent.h +++ b/HLT/TPCLib/AliHLTTPCVertexFinderComponent.h @@ -28,7 +28,7 @@ class AliHLTTPCVertexFinderComponent : public AliHLTProcessor AliHLTComponentDataType GetOutputDataType(); virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); AliHLTComponent* Spawn(); - + protected: // Protected functions to implement AliHLTComponent's interface. diff --git a/HLT/libHLTbase.pkg b/HLT/libHLTbase.pkg index 19fc15db511..5bdf3b435be 100644 --- a/HLT/libHLTbase.pkg +++ b/HLT/libHLTbase.pkg @@ -14,8 +14,10 @@ MODULE_SRCS= AliHLTComponent.cxx \ AliHLTDataSource.cxx \ AliHLTDataSink.cxx \ AliHLTFilePublisher.cxx \ + AliHLTRootFilePublisherComponent.cxx \ AliHLTRootFileWriterComponent.cxx \ - AliHLTFileWriter.cxx + AliHLTFileWriter.cxx \ + AliHLTMessage.cxx CLASS_HDRS:= AliHLTComponent.h \ AliHLTComponentHandler.h \ @@ -29,8 +31,10 @@ CLASS_HDRS:= AliHLTComponent.h \ AliHLTDataSource.h \ AliHLTDataSink.h \ AliHLTFilePublisher.h \ + AliHLTRootFilePublisherComponent.h \ AliHLTRootFileWriterComponent.h \ - AliHLTFileWriter.h + AliHLTFileWriter.h \ + AliHLTMessage.h MODULE_HDRS:= $(CLASS_HDRS) \ AliHLTDataTypes.h \ -- 2.43.5