From: richterm Date: Wed, 11 Apr 2007 13:19:05 +0000 (+0000) Subject: - AliHLTComponent: bugfix in buffer handling; overwrite check added to X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=8451168baa6af631c91b76c3878de7249ed5f8ef - AliHLTComponent: bugfix in buffer handling; overwrite check added to AliHLTDataBuffer - AliHLTOfflineInterface integrated in to AliHLTSystem - AliHLTComponent: bugfix in object handling and cleanup (high-level interface) --- diff --git a/HLT/BASE/AliHLTComponent.cxx b/HLT/BASE/AliHLTComponent.cxx index 7bd52110018..9ab55b5c4b4 100644 --- a/HLT/BASE/AliHLTComponent.cxx +++ b/HLT/BASE/AliHLTComponent.cxx @@ -61,6 +61,7 @@ AliHLTComponent::AliHLTComponent() memset(&fEnvironment, 0, sizeof(AliHLTComponentEnvironment)); if (fgpComponentHandler) fgpComponentHandler->ScheduleRegister(this); + SetLocalLoggingLevel(kHLTLogDefault); } AliHLTComponent::AliHLTComponent(const AliHLTComponent&) @@ -95,6 +96,7 @@ AliHLTComponent& AliHLTComponent::operator=(const AliHLTComponent&) AliHLTComponent::~AliHLTComponent() { // see header file for function documentation + CleanupInputObjects(); } AliHLTComponentHandler* AliHLTComponent::fgpComponentHandler=NULL; @@ -124,8 +126,51 @@ int AliHLTComponent::Init( AliHLTComponentEnvironment* environ, void* environPar memcpy(&fEnvironment, environ, sizeof(AliHLTComponentEnvironment)); fEnvironment.fParam=environParam; } - iResult=DoInit(argc, argv); + const char** pArguments=NULL; + int iNofChildArgs=0; + TString argument=""; + int bMissingParam=0; + if (argc>0) { + pArguments=new const char*[argc]; + if (pArguments) { + for (int i=0; i=0; i++) { + argument=argv[i]; + if (argument.IsNull()) continue; + + // benchmark + if (argument.CompareTo("benchmark")==0) { + + // loglevel + } else if (argument.CompareTo("loglevel")==0) { + if ((bMissingParam=(++i>=argc))) break; + TString parameter(argv[i]); + parameter.Remove(TString::kLeading, ' '); // remove all blanks + if (parameter.BeginsWith("0x") && + parameter.Replace(0,2,"",0).IsHex()) { + AliHLTComponentLogSeverity loglevel=kHLTLogNone; + sscanf(parameter.Data(),"%x", &loglevel); + SetLocalLoggingLevel(loglevel); + } else { + HLTError("wrong parameter for argument %s, hex number expected", argument.Data()); + iResult=-EINVAL; + } + } else { + pArguments[iNofChildArgs++]=argv[i]; + } + } + } else { + iResult=-ENOMEM; + } + } + if (bMissingParam) { + HLTError("missing parameter for argument %s", argument.Data()); + iResult=-EINVAL; + } + if (iResult>=0) { + iResult=DoInit(iNofChildArgs, pArguments); + } if (iResult>=0) fEventCount=0; + if (pArguments) delete [] pArguments; return iResult; } @@ -390,7 +435,7 @@ const TObject* AliHLTComponent::GetFirstInputObject(const AliHLTComponentDataTyp 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()); + 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) { @@ -450,11 +495,11 @@ TObject* AliHLTComponent::CreateInputObject(int idx, int bForce) if (fpInputBlocks[idx].fPtr) { AliHLTUInt32_t firstWord=*((AliHLTUInt32_t*)fpInputBlocks[idx].fPtr); if (firstWord==fpInputBlocks[idx].fSize-sizeof(AliHLTUInt32_t)) { - //HLTDebug("create object from block %d size %d", idx, fpInputBlocks[idx].fSize); + HLTDebug("create object from block %d size %d", idx, fpInputBlocks[idx].fSize); AliHLTMessage msg(fpInputBlocks[idx].fPtr, fpInputBlocks[idx].fSize); pObj=msg.ReadObject(msg.GetClass()); if (pObj && msg.GetClass()) { - //HLTDebug("object %p type %s created", pObj, msg.GetClass()->GetName()); + HLTDebug("object %p type %s created", pObj, msg.GetClass()->GetName()); } else { } } else { @@ -495,6 +540,18 @@ TObject* AliHLTComponent::GetInputObject(int idx, const char* classname, int bFo return pObj; } +int AliHLTComponent::CleanupInputObjects() +{ + if (!fpInputObjects) return 0; + TObjArray* array=fpInputObjects; + fpInputObjects=NULL; + for (int i=0; iGetEntries(); i++) { + TObject* pObj=array->At(i); + if (pObj) delete pObj; + } + delete array; +} + AliHLTComponentDataType AliHLTComponent::GetDataType(const TObject* pObject) { // see header file for function documentation @@ -618,7 +675,7 @@ int AliHLTComponent::PushBack(TObject* pObject, const AliHLTComponentDataType& d 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); + HLTDebug("object %s (%p) size %d inserted to output", pObject->ClassName(), pObject, iMsgLength); } } else { HLTError("object serialization failed for object %p", pObject); @@ -657,7 +714,7 @@ int AliHLTComponent::InsertOutputBlock(void* pBuffer, int iSize, const AliHLTCom // see header file for function documentation int iResult=0; if (pBuffer) { - if (fpOutputBuffer && (fOutputBufferSize-fOutputBufferFilled)) { + if (fpOutputBuffer && iSize<=(fOutputBufferSize-fOutputBufferFilled)) { AliHLTUInt8_t* pTgt=fpOutputBuffer+fOutputBufferFilled; AliHLTComponentBlockData bd; FillBlockData( bd ); @@ -688,6 +745,14 @@ int AliHLTComponent::InsertOutputBlock(void* pBuffer, int iSize, const AliHLTCom return iResult; } +int AliHLTComponent::EstimateObjectSize(TObject* pObject) const +{ + if (!pObject) return -EINVAL; + AliHLTMessage msg(kMESS_OBJECT); + msg.WriteObject(pObject); + return msg.Length(); +} + int AliHLTComponent::CreateEventDoneData(AliHLTComponentEventDoneData edd) { // see header file for function documentation @@ -741,6 +806,7 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData, outputBlockCnt=0; outputBlocks=NULL; } + CleanupInputObjects(); IncrementEventCounter(); return iResult; } diff --git a/HLT/BASE/AliHLTComponent.h b/HLT/BASE/AliHLTComponent.h index e5cc0b6e81b..db1f6724d7d 100644 --- a/HLT/BASE/AliHLTComponent.h +++ b/HLT/BASE/AliHLTComponent.h @@ -143,6 +143,9 @@ class TObjArray; * the parameters. The component implementation * @see AliHLTProcessor AliHLTDataSource AliHLTDataSink * + * \em IMPORTANT: objects and block descriptors provided by the high-level interface + * MUST NOT BE DELETED by the caller. + * * @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. @@ -475,7 +478,8 @@ class AliHLTComponent : public AliHLTLogging { * 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. + * silently abondoned, unless the \em bForce parameter is set.
+ * \em Note: THE OBJECT MUST NOT BE DELETED by the caller. * @param dt data type of the object * @param classname class name of the object * @param bForce force the retrieval of an object, error messages @@ -496,7 +500,8 @@ class AliHLTComponent : public AliHLTLogging { * 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. + * silently abondoned, unless the \em bForce parameter is set.
+ * \em Note: THE OBJECT MUST NOT BE DELETED by the caller. * @param dtID data type ID of the object * @param dtOrigin data type origin of the object * @param classname class name of the object @@ -515,7 +520,8 @@ class AliHLTComponent : public AliHLTLogging { * 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. + * to the previous @ref GetFirstInputObject call.
+ * \em Note: THE OBJECT MUST NOT BE DELETED by the caller. * @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 @@ -545,7 +551,8 @@ class AliHLTComponent : public AliHLTLogging { /** * 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. + * to be used within the high-level interface.
+ * \em Note: THE BLOCK DESCRIPTOR MUST NOT BE DELETED by the caller. * @param dt data type of the block * @return pointer to @ref AliHLTComponentBlockData */ @@ -555,7 +562,8 @@ class AliHLTComponent : public AliHLTLogging { * 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. + * to be used within the high-level interface.
+ * \em Note: THE BLOCK DESCRIPTOR MUST NOT BE DELETED by the caller. * @param dtID data type ID of the block * @param dtOrigin data type origin of the block * @return pointer to @ref AliHLTComponentBlockData @@ -564,7 +572,8 @@ class AliHLTComponent : public AliHLTLogging { const char* dtOrigin); /** - * Get input block by index + * Get input block by index.
+ * \em Note: THE BLOCK DESCRIPTOR MUST NOT BE DELETED by the caller. * @return pointer to AliHLTComponentBlockData, NULL if index out of range */ const AliHLTComponentBlockData* GetInputBlock(int index); @@ -573,7 +582,8 @@ class AliHLTComponent : public AliHLTLogging { * 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. + * To be used within the high-level interface.
+ * \em Note: THE BLOCK DESCRIPTOR MUST NOT BE DELETED by the caller. */ const AliHLTComponentBlockData* GetNextInputBlock(); @@ -631,6 +641,13 @@ class AliHLTComponent : public AliHLTLogging { int PushBack(void* pBuffer, int iSize, const char* dtID, const char* dtOrigin, AliHLTUInt32_t spec=kAliHLTVoidDataSpec); + /** + * Estimate size of a TObject + * @param pObject + * @return buffer size in byte + */ + int EstimateObjectSize(TObject* pObject) const; + /** * Insert event-done data information into the output. * @param edd event-done data information @@ -680,7 +697,9 @@ class AliHLTComponent : public AliHLTLogging { /** * Get input object - * Get object from the input block list + * Get object from the input block list. The methods first checks whether the + * object was already created. If not, it is created by @ref CreateInputObject + * and inserted into the list of objects. * @param idx index in the input block list * @param classname name of the class, object is checked for correct class * name if set @@ -692,6 +711,12 @@ class AliHLTComponent : public AliHLTLogging { */ TObject* GetInputObject(int idx, const char* classname=NULL, int bForce=0); + /** + * Clean the list of input objects. + * Cleanup is done at the end of each event processing. + */ + int CleanupInputObjects(); + /** * Insert a buffer into the output block stream. * This is the only method to insert blocks into the output stream, called diff --git a/HLT/BASE/AliHLTDataBuffer.cxx b/HLT/BASE/AliHLTDataBuffer.cxx index 7dfba4ddcce..25bf21f6f86 100644 --- a/HLT/BASE/AliHLTDataBuffer.cxx +++ b/HLT/BASE/AliHLTDataBuffer.cxx @@ -82,6 +82,8 @@ vector AliHLTDataBuffer::fgFreeBuffers; vector AliHLTDataBuffer::fgActiveBuffers; AliHLTUInt32_t AliHLTDataBuffer::fgMargin=1024; AliHLTLogging AliHLTDataBuffer::fgLogging; +const Int_t AliHLTDataBuffer::fgkSafetyPatternSize=16; +const char AliHLTDataBuffer::fgkSafetyPattern[]={0x28, 0x63, 0x29, 0x4d, 0x52, 0x49, 0x43, 0x48, 0x54, 0x45, 0x52, 0x20, 0x32, 0x30, 0x30, 0x37}; AliHLTDataBuffer::~AliHLTDataBuffer() { @@ -297,10 +299,12 @@ int AliHLTDataBuffer::SetSegments(AliHLTUInt8_t* pTgt, AliHLTComponentBlockData* } else { HLTError("block data specification %#d (%s) exceeds size of data buffer", i, AliHLTComponent::DataType2Text(arrayBlockData[i].fDataType).data()); HLTError("block offset=%d, block size=%d, buffer size=%d", arrayBlockData[i].fOffset, arrayBlockData[i].fSize, fpBuffer->fSize); + iResult=-E2BIG; } } } else { HLTError("this data buffer (%p) does not match the internal data buffer %p of raw buffer %p", pTgt, fpBuffer->fPtr, fpBuffer); + iResult=-EINVAL; } } else { HLTFatal("internal data structur missmatch"); @@ -345,9 +349,10 @@ AliHLTDataBuffer::AliHLTRawBuffer* AliHLTDataBuffer::CreateRawBuffer(AliHLTUInt3 { // see header file for function documentation AliHLTRawBuffer* pRawBuffer=NULL; + int reqSize=size+fgkSafetyPatternSize; vector::iterator buffer=fgFreeBuffers.begin(); while (buffer!=fgFreeBuffers.end() && pRawBuffer==NULL) { - if ((*buffer)->fTotalSize>=size && ((*buffer)->fTotalSize-size)fTotalSize>=reqSize && ((*buffer)->fTotalSize-reqSize)fSize=size; @@ -363,12 +368,15 @@ AliHLTDataBuffer::AliHLTRawBuffer* AliHLTDataBuffer::CreateRawBuffer(AliHLTUInt3 pRawBuffer=new AliHLTRawBuffer; if (pRawBuffer) { memset(pRawBuffer, 0, sizeof(AliHLTRawBuffer)); - pRawBuffer->fPtr=malloc(size); + pRawBuffer->fPtr=malloc(reqSize); if (pRawBuffer->fPtr) { pRawBuffer->fSize=size; - pRawBuffer->fTotalSize=size; + pRawBuffer->fTotalSize=reqSize; fgActiveBuffers.push_back(pRawBuffer); fgLogging.Logging(kHLTLogDebug, "AliHLTDataBuffer::CreateRawBuffer", "data buffer handling", "new raw buffer %p of size %d created (container %p)", pRawBuffer->fPtr, pRawBuffer->fTotalSize, pRawBuffer); + if (fgkSafetyPatternSize>0) { + memcpy(((char*)pRawBuffer->fPtr)+pRawBuffer->fSize, fgkSafetyPattern, fgkSafetyPatternSize); + } } else { delete pRawBuffer; pRawBuffer=NULL; @@ -391,6 +399,11 @@ int AliHLTDataBuffer::ReleaseRawBuffer(AliHLTRawBuffer* pBuffer) buffer++; } if (buffer!=fgActiveBuffers.end()) { + if (fgkSafetyPatternSize>0) { + if (memcmp(((char*)(*buffer)->fPtr)+(*buffer)->fSize, fgkSafetyPattern, fgkSafetyPatternSize)!=0) { + fgLogging.Logging(kHLTLogFatal, "AliHLTDataBuffer::ReleaseRawBuffer", "data buffer handling", "component has written beyond end of data buffer %p size %d", (*buffer)->fPtr, (*buffer)->fSize); + } + } (*buffer)->fSize=0; fgFreeBuffers.push_back(*buffer); fgActiveBuffers.erase(buffer); diff --git a/HLT/BASE/AliHLTDataBuffer.h b/HLT/BASE/AliHLTDataBuffer.h index 50a0f5fa42d..7c032430135 100644 --- a/HLT/BASE/AliHLTDataBuffer.h +++ b/HLT/BASE/AliHLTDataBuffer.h @@ -323,6 +323,12 @@ class AliHLTDataBuffer : public TObject, public AliHLTLogging /** global instance to HLT logging class for static methods */ static AliHLTLogging fgLogging; // see above + /** size of the safety pattern */ + static const Int_t fgkSafetyPatternSize; // see above + + /** the safety pattern */ + static const char fgkSafetyPattern[]; //!transient + ////////////////////////////////////////////////////////////////////////////// // internal helper functions diff --git a/HLT/BASE/AliHLTModuleAgent.cxx b/HLT/BASE/AliHLTModuleAgent.cxx index 7957a1573de..333e751d2b8 100644 --- a/HLT/BASE/AliHLTModuleAgent.cxx +++ b/HLT/BASE/AliHLTModuleAgent.cxx @@ -75,17 +75,17 @@ void AliHLTModuleAgent::PrintStatus(const char* agent) } } else { TObjLink* lnk=fgAgentList.FirstLink(); - log.Logging(kHLTLogInfo, "", "", "-----------------------"); - log.Logging(kHLTLogInfo, "", "", "available module agents"); + log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------"); + log.Logging(kHLTLogInfo, "AliHLT", "", "available module agents"); if (lnk==NULL) - log.Logging(kHLTLogInfo, "", "", " none"); + log.Logging(kHLTLogInfo, "AliHLT", "", " none"); while (lnk) { TString msg; msg.Form(" %s : %p", ((AliHLTModuleAgent*)lnk->GetObject())->GetName(), lnk->GetObject()); - log.Logging(kHLTLogInfo, "", "", msg.Data()); + log.Logging(kHLTLogInfo, "AliHLT", "", msg.Data()); lnk=lnk->Next(); } - log.Logging(kHLTLogInfo, "", "", "-----------------------"); + log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------"); } } diff --git a/HLT/BASE/AliHLTOfflineDataSource.h b/HLT/BASE/AliHLTOfflineDataSource.h index 42b4ce04a53..7e0bcc767dd 100644 --- a/HLT/BASE/AliHLTOfflineDataSource.h +++ b/HLT/BASE/AliHLTOfflineDataSource.h @@ -48,7 +48,7 @@ class AliHLTOfflineDataSource /** * Default implementation as sources do not have a real FillESD method. */ - int FillESD(AliRunLoader* runLoader, AliESD* esd) { + int FillESD(int eventNo, AliRunLoader* runLoader, AliESD* esd) { if (esd==NULL && runLoader==NULL) { // get rid of 'unused parameter' warning } diff --git a/HLT/BASE/AliHLTOfflineInterface.cxx b/HLT/BASE/AliHLTOfflineInterface.cxx index f16196fefa7..0d1c3c6aee9 100644 --- a/HLT/BASE/AliHLTOfflineInterface.cxx +++ b/HLT/BASE/AliHLTOfflineInterface.cxx @@ -22,6 +22,7 @@ */ #include "AliHLTOfflineInterface.h" +#include "AliHLTLogging.h" /** ROOT macro for the implementation of ROOT specific class methods */ ClassImp(AliHLTOfflineInterface) @@ -41,6 +42,8 @@ AliHLTOfflineInterface::AliHLTOfflineInterface() TList AliHLTOfflineInterface::fgList; TObjLink* AliHLTOfflineInterface::fgCurrentLnk=NULL; +AliRunLoader* AliHLTOfflineInterface::fgpRunLoader=NULL; +AliRawReader* AliHLTOfflineInterface::fgpRawReader=NULL; AliHLTOfflineInterface::AliHLTOfflineInterface(AliRunLoader* pRunLoader, AliRawReader* pRawReader) : @@ -72,14 +75,14 @@ AliHLTOfflineInterface::~AliHLTOfflineInterface() { } -const AliRunLoader* AliHLTOfflineInterface::GetRunLoader() const +AliRunLoader* AliHLTOfflineInterface::GetRunLoader() const { - return fpRunLoader; + return fpRunLoader!=NULL?fpRunLoader:fgpRunLoader; } -const AliRawReader* AliHLTOfflineInterface::GetRawReader() const +AliRawReader* AliHLTOfflineInterface::GetRawReader() const { - return fpRawReader; + return fpRawReader!=NULL?fpRawReader:fgpRawReader; } int AliHLTOfflineInterface::SetESD(Int_t eventNo, AliESD* pESD) @@ -121,17 +124,28 @@ int AliHLTOfflineInterface::Reset() int AliHLTOfflineInterface::SetParamsToComponents(AliRunLoader* runLoader, AliRawReader* rawReader) { // see header file for class documentation + AliHLTLogging log; int iResult=0; + int count=0; + fgpRunLoader=runLoader; + fgpRawReader=rawReader; fgCurrentLnk=fgList.FirstLink(); while (fgCurrentLnk!=NULL) { AliHLTOfflineInterface* pComponent=reinterpret_cast(fgCurrentLnk->GetObject()); int iLocal=0; if (pComponent) iLocal=pComponent->SetParams(runLoader, rawReader); if (iLocal<0) { + log.LoggingVarargs(kHLTLogWarning, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__, + "parameter initialization failed for component %p with result %d", pComponent, iLocal); if (iResult>=0) iResult=iLocal; } + count++; fgCurrentLnk=fgCurrentLnk->Next(); } + if (iResult>=0) { + log.LoggingVarargs(kHLTLogInfo, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__, + "parameters set to %d offline interface component(s)", count); + } return iResult; } @@ -152,7 +166,7 @@ int AliHLTOfflineInterface::ResetComponents() return iResult; } -int AliHLTOfflineInterface::FillComponentESDs(AliRunLoader* runLoader, AliESD* esd) +int AliHLTOfflineInterface::FillComponentESDs(int eventNo, AliRunLoader* runLoader, AliESD* esd) { // see header file for class documentation int iResult=0; @@ -160,7 +174,13 @@ int AliHLTOfflineInterface::FillComponentESDs(AliRunLoader* runLoader, AliESD* e while (fgCurrentLnk!=NULL) { AliHLTOfflineInterface* pComponent=reinterpret_cast(fgCurrentLnk->GetObject()); int iLocal=0; - if (pComponent) iLocal=pComponent->FillESD(runLoader, esd); + if (pComponent) { + pComponent->SetESD(eventNo, esd); + if (pComponent->GetRunLoader()!=runLoader) { + //HLTWarning("runLoader missmatch: component %p was reconstructed with runLoader %p, but got %p now", pComponent, pComponent->GetRunLoader(), runLoader); + } + iLocal=pComponent->FillESD(eventNo, runLoader, esd); + } if (iLocal<0) { if (iResult>=0) iResult=iLocal; } diff --git a/HLT/BASE/AliHLTOfflineInterface.h b/HLT/BASE/AliHLTOfflineInterface.h index cac9ba89ff0..7e853bc3d22 100644 --- a/HLT/BASE/AliHLTOfflineInterface.h +++ b/HLT/BASE/AliHLTOfflineInterface.h @@ -56,12 +56,12 @@ class AliHLTOfflineInterface : public TObject { /** * Get the AliRoot run loader. */ - const AliRunLoader* GetRunLoader() const; + AliRunLoader* GetRunLoader() const; /** * Get the AliRoot raw reader */ - const AliRawReader* GetRawReader() const; + AliRawReader* GetRawReader() const; /** * Set AliRoot ESD for the current event. @@ -100,22 +100,26 @@ class AliHLTOfflineInterface : public TObject { * Fill ESD for one event. * Fill the ESD with the previously reconstructed data. It must be implmented * by the child class. + * @param eventNo event No. \em Note: this is an internal enumeration of the + * processed events. * @param runLoader the AliRoot runloader * @param esd an AliESD instance * @return neg. error code if failed */ - virtual int FillESD(AliRunLoader* runLoader, AliESD* esd)=0; + virtual int FillESD(int eventNo, AliRunLoader* runLoader, AliESD* esd)=0; /** * Fill ESD for one event. * The FillESD method of all active AliHLTOfflineDataSink's is called in * order to fill the ESD with the previously reconstructed data. This method * works on the global list. + * @param eventNo event No. \em Note: this is an internal enumeration of the + * processed events. * @param runLoader the AliRoot runloader * @param esd an AliESD instance * @return neg. error code if failed */ - static int FillComponentESDs(AliRunLoader* runLoader, AliESD* esd); + static int FillComponentESDs(int eventNo, AliRunLoader* runLoader, AliESD* esd); /** * Reset AliRoot internal params of all active components. @@ -145,9 +149,14 @@ protected: /** the current object link (list position) */ static TObjLink* fgCurrentLnk; // see above - /** AliRoot run loader instance */ + /** global AliRoot run loader instance (for all components) */ + static AliRunLoader* fgpRunLoader; //! transient + /** global AliRoot raw reader instance (for all components) */ + static AliRawReader* fgpRawReader; //! transient + + /** private AliRoot run loader instance */ AliRunLoader* fpRunLoader; //! transient - /** AliRoot raw reader instance */ + /** private AliRoot raw reader instance */ AliRawReader* fpRawReader; //! transient /** AliRoot HLT ESD instance */ AliESD* fpESD; //! transient diff --git a/HLT/BASE/AliHLTSystem.cxx b/HLT/BASE/AliHLTSystem.cxx index 6c72e428a9b..26ce765e535 100644 --- a/HLT/BASE/AliHLTSystem.cxx +++ b/HLT/BASE/AliHLTSystem.cxx @@ -33,6 +33,7 @@ using namespace std; #include "AliHLTConfigurationHandler.h" #include "AliHLTTask.h" #include "AliHLTModuleAgent.h" +#include "AliHLTOfflineInterface.h" #include #include #include @@ -439,7 +440,9 @@ int AliHLTSystem::Reconstruct(int nofEvents, AliRunLoader* runLoader, if (runLoader) { HLTInfo("Run Loader %p, Raw Reader %p , %d events", runLoader, rawReader, nofEvents); if (CheckStatus(kReady)) { - iResult=Run(nofEvents); + if ((iResult=AliHLTOfflineInterface::SetParamsToComponents(runLoader, rawReader))>=0) { + iResult=Run(nofEvents); + } } else { HLTError("wrong state %#x, required flags %#x", GetStatusFlags(), kReady); } @@ -456,6 +459,7 @@ int AliHLTSystem::FillESD(int eventNo, AliRunLoader* runLoader, AliESD* esd) int iResult=0; if (runLoader) { HLTInfo("Event %d: Run Loader %p, ESD %p", eventNo, runLoader, esd); + iResult=AliHLTOfflineInterface::FillComponentESDs(eventNo, runLoader, esd); } else { HLTError("missing run loader/ESD instance(s)"); iResult=-EINVAL;