#include "TString.h"
#include "TObjArray.h"
#include "TClass.h"
+#include "TStopwatch.h"
/** ROOT macro for the implementation of ROOT specific class methods */
-ClassImp(AliHLTComponent)
+ClassImp(AliHLTComponent);
+
+/** stopwatch macro using the stopwatch guard */
+#define ALIHLTCOMPONENT_STOPWATCH(type) AliHLTStopwatchGuard swguard(fpStopwatches!=NULL?reinterpret_cast<TStopwatch*>(fpStopwatches->At((int)type)):NULL)
+//#define ALIHLTCOMPONENT_STOPWATCH(type)
+
+/** stopwatch macro for operations of the base class */
+#define ALIHLTCOMPONENT_BASE_STOPWATCH() ALIHLTCOMPONENT_STOPWATCH(kSWBase)
+/** stopwatch macro for operations of the detector algorithm (DA) */
+#define ALIHLTCOMPONENT_DA_STOPWATCH() ALIHLTCOMPONENT_STOPWATCH(kSWDA)
AliHLTComponent::AliHLTComponent()
:
fpOutputBuffer(NULL),
fOutputBufferSize(0),
fOutputBufferFilled(0),
- fOutputBlocks()
+ fOutputBlocks(),
+ fpStopwatches(new TObjArray(kSWTypeCount))
{
// see header file for class documentation
// or
fpOutputBuffer(NULL),
fOutputBufferSize(0),
fOutputBufferFilled(0),
- fOutputBlocks()
+ fOutputBlocks(),
+ fpStopwatches(NULL)
{
// see header file for class documentation
HLTFatal("copy constructor untested");
int bForce)
{
// see header file for function documentation
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
fSearchDataType=dt;
if (classname) fClassName=classname;
else fClassName.clear();
int bForce)
{
// see header file for function documentation
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
AliHLTComponentDataType dt;
SetDataType(dt, dtID, dtOrigin);
return GetFirstInputObject(dt, classname, bForce);
const TObject* AliHLTComponent::GetNextInputObject(int bForce)
{
// see header file for function documentation
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
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 (pObj) delete pObj;
}
delete array;
+ return 0;
}
AliHLTComponentDataType AliHLTComponent::GetDataType(const TObject* pObject)
{
// see header file for function documentation
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
AliHLTComponentDataType dt=kAliHLTVoidDataType;
int idx=fCurrentInputBlock;
if (pObject) {
AliHLTUInt32_t AliHLTComponent::GetSpecification(const TObject* pObject)
{
// see header file for function documentation
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
AliHLTUInt32_t iSpec=kAliHLTVoidDataSpec;
int idx=fCurrentInputBlock;
if (pObject) {
const AliHLTComponentBlockData* AliHLTComponent::GetFirstInputBlock(const AliHLTComponentDataType& dt)
{
// see header file for function documentation
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
fSearchDataType=dt;
fClassName.clear();
int idx=FindInputBlock(fSearchDataType, 0);
const char* dtOrigin)
{
// see header file for function documentation
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
AliHLTComponentDataType dt;
SetDataType(dt, dtID, dtOrigin);
return GetFirstInputBlock(dt);
const AliHLTComponentBlockData* AliHLTComponent::GetNextInputBlock()
{
// see header file for function documentation
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1);
const AliHLTComponentBlockData* pBlock=NULL;
if (idx>=0) {
AliHLTUInt32_t AliHLTComponent::GetSpecification(const AliHLTComponentBlockData* pBlock)
{
// see header file for function documentation
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
AliHLTUInt32_t iSpec=kAliHLTVoidDataSpec;
int idx=fCurrentInputBlock;
if (pBlock) {
int AliHLTComponent::PushBack(TObject* pObject, const AliHLTComponentDataType& dt, AliHLTUInt32_t spec)
{
// see header file for function documentation
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
int iResult=0;
if (pObject) {
AliHLTMessage msg(kMESS_OBJECT);
int AliHLTComponent::PushBack(TObject* pObject, const char* dtID, const char* dtOrigin, AliHLTUInt32_t spec)
{
// see header file for function documentation
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
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
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
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
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
AliHLTComponentDataType dt;
SetDataType(dt, dtID, dtOrigin);
return PushBack(pBuffer, iSize, dt, spec);
AliHLTComponentEventDoneData*& edd )
{
// see header file for function documentation
+ ALIHLTCOMPONENT_BASE_STOPWATCH();
int iResult=0;
fCurrentEvent=evtData.fEventID;
fCurrentEventData=evtData;
fOutputBlocks.clear();
vector<AliHLTComponentBlockData> blockData;
- iResult=DoProcessing(evtData, blocks, trigData, outputPtr, size, blockData, edd);
+ { // dont delete, sets the scope for the stopwatch guard
+ ALIHLTCOMPONENT_DA_STOPWATCH();
+ iResult=DoProcessing(evtData, blocks, trigData, outputPtr, size, blockData, edd);
+ } // end of the scope of the stopwatch guard
if (iResult>=0) {
if (fOutputBlocks.size()>0) {
//HLTDebug("got %d block(s) via high level interface", fOutputBlocks.size());
return iResult;
}
+AliHLTComponent::AliHLTStopwatchGuard::AliHLTStopwatchGuard()
+ :
+ fpStopwatch(NULL),
+ fpPrec(NULL)
+{
+ // standard constructor (not for use)
+}
+
+AliHLTComponent::AliHLTStopwatchGuard::AliHLTStopwatchGuard(TStopwatch* pStopwatch)
+ :
+ fpStopwatch(pStopwatch),
+ fpPrec(NULL)
+{
+ // constructor
+
+ // check for already existing guard
+ if (fgpCurrent) fpPrec=fgpCurrent;
+ fgpCurrent=this;
+
+ // stop the preceeding guard if it controls a different stopwatch
+ int bStart=1;
+ if (fpPrec && fpPrec!=this) bStart=fpPrec->Hold(fpStopwatch);
+
+ // start the stopwatch if the current guard controls a different one
+ if (fpStopwatch && bStart==1) fpStopwatch->Start(kFALSE);
+}
+
+AliHLTComponent::AliHLTStopwatchGuard::AliHLTStopwatchGuard(AliHLTStopwatchGuard&)
+ :
+ fpStopwatch(NULL),
+ fpPrec(NULL)
+{
+ // copy constructor (not for use)
+}
+
+AliHLTComponent::AliHLTStopwatchGuard* AliHLTComponent::AliHLTStopwatchGuard::fgpCurrent=NULL;
+
+AliHLTComponent::AliHLTStopwatchGuard::~AliHLTStopwatchGuard()
+{
+ // destructor
+
+ // resume the preceeding guard if it controls a different stopwatch
+ int bStop=1;
+ if (fpPrec && fpPrec!=this) bStop=fpPrec->Resume(fpStopwatch);
+
+ // stop the stopwatch if the current guard controls a different one
+ if (fpStopwatch && bStop==1) fpStopwatch->Stop();
+
+ // resume to the preceeding guard
+ fgpCurrent=fpPrec;
+}
+
+int AliHLTComponent::AliHLTStopwatchGuard::Hold(TStopwatch* pSucc)
+{
+ // see header file for function documentation
+ if (fpStopwatch!=NULL && fpStopwatch!=pSucc) fpStopwatch->Stop();
+ return fpStopwatch!=pSucc?1:0;
+}
+
+int AliHLTComponent::AliHLTStopwatchGuard::Resume(TStopwatch* pSucc)
+{
+ // see header file for function documentation
+ if (fpStopwatch!=NULL && fpStopwatch!=pSucc) fpStopwatch->Start(kFALSE);
+ return fpStopwatch!=pSucc?1:0;
+}
+
+int AliHLTComponent::SetStopwatch(TObject* pSW, AliHLTStopwatchType type)
+{
+ // see header file for function documentation
+ int iResult=0;
+ if (pSW!=NULL && type<kSWTypeCount) {
+ if (fpStopwatches) {
+ TObject* pObj=fpStopwatches->At((int)type);
+ if (pSW==NULL // explicit reset
+ || pObj==NULL) { // explicit set
+ fpStopwatches->AddAt(pSW, (int)type);
+ } else if (pObj!=pSW) {
+ HLTWarning("stopwatch %d already set, reset first", (int)type);
+ iResult=-EBUSY;
+ }
+ }
+ } else {
+ iResult=-EINVAL;
+ }
+ return iResult;
+}
+
+int AliHLTComponent::SetStopwatches(TObjArray* pStopwatches)
+{
+ // see header file for function documentation
+ if (pStopwatches==NULL) return -EINVAL;
+
+ int iResult=0;
+ for (int i=0 ; i<(int)kSWTypeCount && pStopwatches->GetEntries(); i++)
+ SetStopwatch(pStopwatches->At(i), (AliHLTStopwatchType)i);
+ return iResult;
+}
class AliHLTComponentHandler;
class TObjArray;
+class TStopwatch;
/**
* @class AliHLTComponent
*
* @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
+ * - @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
*/
void PrintComponentDataTypeInfo(const AliHLTComponentDataType& dt);
+ /**
+ * Stopwatch type for benchmarking.
+ */
+ enum AliHLTStopwatchType {
+ /** total time for event processing */
+ kSWBase,
+ /** detector algorithm w/o interface callbacks */
+ kSWDA,
+ /** data sources */
+ kSWInput,
+ /** data sinks */
+ kSWOutput,
+ /** number of types */
+ kSWTypeCount
+ };
+
+ /**
+ * Helper class for starting and stopping a stopwatch.
+ * The guard can be used by instantiating an object in a function. The
+ * specified stopwatch is started and the previous stopwatch put on
+ * hold. When the function is terminated, the object is deleted automatically
+ * deleted, stopping the stopwatch and starting the one on hold.<br>
+ * \em IMPORTANT: never create dynamic objects from this guard as this violates
+ * the idea of a guard.
+ */
+ class AliHLTStopwatchGuard {
+ public:
+ /** standard constructor (not for use) */
+ AliHLTStopwatchGuard();
+ /** constructor */
+ AliHLTStopwatchGuard(TStopwatch* pStart);
+ /** copy constructor (not for use) */
+ AliHLTStopwatchGuard(AliHLTStopwatchGuard&);
+ /** destructor */
+ ~AliHLTStopwatchGuard();
+
+ private:
+ /**
+ * Hold the previous guard for the existence of this guard.
+ * Checks whether this guard controls a new stopwatch. In that case, the
+ * previous guard and its stopwatch are put on hold.
+ * @param pSucc instance of the stopwatch of the new guard
+ * @return 1 if pSucc is a different stopwatch which should
+ * be started<br>
+ * 0 if it controls the same stopwatch
+ */
+ int Hold(TStopwatch* pSucc);
+
+ /**
+ * Resume the previous guard.
+ * Checks whether the peceeding guard controls a different stopwatch. In that
+ * case, the its stopwatch is resumed.
+ * @param pSucc instance of the stopwatch of the new guard
+ * @return 1 if pSucc is a different stopwatch which should
+ * be stopped<br>
+ * 0 if it controls the same stopwatch
+ */
+ int Resume(TStopwatch* pSucc);
+
+ /** the stopwatch controlled by this guard */
+ TStopwatch* fpStopwatch; //!transient
+
+ /** previous stopwatch guard, put on hold during existence of the guard */
+ AliHLTStopwatchGuard* fpPrec; //!transient
+
+ /** active stopwatch guard */
+ static AliHLTStopwatchGuard* fgpCurrent; //!transient
+ };
+
+ /**
+ * Set a stopwatch for a given purpose.
+ * @param pSW stopwatch object
+ * @param type type of the stopwatch
+ */
+ int SetStopwatch(TObject* pSW, AliHLTStopwatchType type=kSWBase);
+
+ /**
+ * Init a set of stopwatches.
+ * @param pStopwatches object array of stopwatches
+ */
+ int SetStopwatches(TObjArray* pStopwatches);
protected:
/** list of ouput block data descriptors */
vector<AliHLTComponentBlockData> fOutputBlocks; // see above
- ClassDef(AliHLTComponent, 1)
+ /** stopwatch array */
+ TObjArray* fpStopwatches; //! transient
+
+ ClassDef(AliHLTComponent, 2)
};
#endif
* of the consumer, neg. error code if failed <br>
* -EINVAL invalid parameter <br>
*/
- int FindMatchingDataSegments(const AliHLTComponent* pConsumer, vector<AliHLTDataSegment>& tgtList);
+ int FindMatchingDataSegments(const AliHLTComponent* pConsumer,
+ vector<AliHLTDataBuffer::AliHLTDataSegment>& tgtList);
/**
* Reset the data buffer.
return 0;
}
-const char* AliHLTModuleAgent::GetTopConfigurations(AliRunLoader* runloader) const
+const char* AliHLTModuleAgent::GetLocalRecConfigurations(AliRunLoader* runloader) const
+{
+ // default method, nothing to be done, child classes can overload
+ if (runloader==NULL) {
+ // get rid of 'unused parameter' warning
+ }
+ return NULL;
+}
+
+const char* AliHLTModuleAgent::GetEventRecConfigurations(AliRunLoader* runloader) const
{
// default method, nothing to be done, child classes can overload
if (runloader==NULL) {
* @brief Agent helper class for HLT sub modules, e.g. PHOS, TPC, Trigger
*
* This class implements the agent base class for the HLT sub modules.
- * The agent of a library gives information on the features of the module,
- * like the configurations to run and other component libraries it depends
- * on.
- *
+ * The agent of a library gives information on the features of the library/
+ * components, like the configurations to run and other component libraries
+ * it depends on.
+ * @note There must not be more than one agent per module/library.
+ *
* All HLT component libraries are loaded on demand through the HLT steering
* instance (@ref AliHLTSystem). A library can implement an agent derived
* from this base class, and has to define one global object of this agent
* in the code. The agent will be registered automatically, and the features
* can be queried when required.
*
- * This is usually done during running the AliRoot Reconstruction (see
- * <tt>AliReconstruction</tt>. The HLT implemets the AliHLTReconstructor which
- * holds the HLT steering object. Several flags can be specified as options
- * via the SetOption method of AliReconstruction, including the component
- * libraries to be loaded.
+ * This is usually done during running the AliRoot reconstruction (see AliRoot
+ * documentation on <tt> AliReconstruction</tt>). The HLT implemets the @ref
+ * AliHLTReconstructor which holds the HLT steering object. Several flags can
+ * be specified as options via the <tt>SetOption</tt> method of
+ * <tt>AliReconstruction</tt>, including the component libraries to be loaded.
+ *
+ * @section alihltmoduleagent_interface Agent interface
+ * The child can implement the following functions:
+ * - @ref CreateConfigurations <br>
+ * create HLT configuration forming an HLT analysis chain.
+ *
+ * - @ref GetLocalRecConfigurations <br>
+ * configurations run during local event reconstruction.
+ * @note Local event reconstruction is the first step of the
+ * reconstruction chain. All events are processed at once.
+ * <br>
+ * - @ref GetEventRecConfigurations <br>
+ * configurations run during event reconstruction.
+ * @note This is the reconstruction on event by event basis.
+ * <br>
+ * - @ref GetRequiredComponentLibraries <br>
+ * can indicate further libraries which are required for running the
+ * chains (e.g. if components of another library are used).
*
- * There must be only one agent per module/library.
+ * - @ref RegisterComponents <br>
+ * register componens, this can be used to avoid the component
+ * registration via global objects
+ * @see @ref alihltcomponent-handling
+ * <br>
+ * @section alihltmoduleagent_references References
+ * @see @ref AliHLTReconstructor interface to the AliRoot reconstruction
+ * @see @ref AliHLTAgentSample agent for the libAliHLTSample library
*
* @ingroup alihlt_system
*/
/**
* Print status info.
- * Short summary on registered agents. This function acts globally on the list
- * of agents if no specific agent is specified.
+ * Short summary on registered agents. This function acts globally on the
+ * list of agents if no specific agent is specified.
*/
static void PrintStatus(const char* agent=NULL);
AliRunLoader* runloader=NULL) const;
/**
- * Get the top configurations belonging to this module.
+ * Get the top configurations for local event reconstruction.
* A top configuration describes a processing chain. It can simply be
* described by the last configuration(s) in the chain.
* The agent can adapt the configurations to be registered to the current
* @param runloader [in] AliRoot runloader
* @return string containing the top configurations separated by blanks
*/
- virtual const char* GetTopConfigurations(AliRunLoader* runloader=NULL) const;
+ virtual const char* GetLocalRecConfigurations(AliRunLoader* runloader=NULL) const;
+
+ /**
+ * Get the top configurations for event reconstruction.
+ * The same as for @ref GetLocalRecConfigurations, but for the reconstruction on
+ * event by event basis.
+ * @param runloader [in] AliRoot runloader
+ * @return string containing the top configurations separated by blanks
+ */
+ virtual const char* GetEventRecConfigurations(AliRunLoader* runloader=NULL) const;
/**
* Component libraries which the configurations of this agent depend on.
*/
virtual int RegisterComponents(AliRunLoader* runloader=NULL) const;
+ /**
+ * Old method kept for backward compatibility, redirected to @ref
+ * GetLocalRecConfigurations.
+ */
+ const char* GetTopConfigurations(AliRunLoader* runloader=NULL) const {
+ return GetLocalRecConfigurations(runloader);
+ }
+
protected:
private:
fgCurrentLnk=fgCurrentLnk->Next();
}
if (iResult>=0) {
- log.LoggingVarargs(kHLTLogInfo, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__,
- "parameters set to %d offline interface component(s)", count);
+// log.LoggingVarargs(kHLTLogInfo, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__,
+// "parameters set to %d offline interface component(s)", count);
}
return iResult;
}
#include <TObjArray.h>
#include <TObjString.h>
#include <TString.h>
+#include <TStopwatch.h>
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTSystem)
int iResult=0;
int iCount=0;
SetStatusFlags(kRunning);
- if ((iResult=InitTasks())>=0) {
+ TStopwatch StopwatchBase; StopwatchBase.Reset();
+ TStopwatch StopwatchDA; StopwatchDA.Reset();
+ TStopwatch StopwatchInput; StopwatchInput.Reset();
+ TStopwatch StopwatchOutput; StopwatchOutput.Reset();
+ TObjArray Stopwatches;
+ Stopwatches.AddAt(&StopwatchBase, (int)AliHLTComponent::kSWBase);
+ Stopwatches.AddAt(&StopwatchDA, (int)AliHLTComponent::kSWDA);
+ Stopwatches.AddAt(&StopwatchInput, (int)AliHLTComponent::kSWInput);
+ Stopwatches.AddAt(&StopwatchOutput, (int)AliHLTComponent::kSWOutput);
+ if ((iResult=InitTasks())>=0 && (iResult=InitBenchmarking(&Stopwatches))>=0) {
if ((iResult=StartTasks())>=0) {
for (int i=0; i<iNofEvents && iResult>=0; i++) {
iResult=ProcessTasks(i);
} else if (iResult!=-ENOENT) {
HLTError("can not initialize task list");
}
- if (iResult>=0) iResult=iCount;
+ if (iResult>=0) {
+ iResult=iCount;
+ HLTInfo("HLT statistics:\n"
+ " base: R:%.3fs C:%.3fs\n"
+ " input: R:%.3fs C:%.3fs\n"
+ " output: R:%.3fs C:%.3fs\n"
+ " event processing : R:%.3fs C:%.3fs"
+ , StopwatchBase.RealTime(),StopwatchBase.CpuTime()
+ , StopwatchInput.RealTime(),StopwatchInput.CpuTime()
+ , StopwatchOutput.RealTime(),StopwatchOutput.CpuTime()
+ , StopwatchDA.RealTime(),StopwatchDA.CpuTime());
+ }
ClearStatusFlags(kRunning);
return iResult;
}
return iResult;
}
+int AliHLTSystem::InitBenchmarking(TObjArray* pStopwatches)
+{
+ // see header file for class documentation
+ if (pStopwatches==NULL) return -EINVAL;
+
+ int iResult=0;
+ TObjLink *lnk=fTaskList.FirstLink();
+ while (lnk && iResult>=0) {
+ TObject* obj=lnk->GetObject();
+ if (obj) {
+ AliHLTTask* pTask=(AliHLTTask*)obj;
+ AliHLTComponent* pComp=NULL;
+ if (iResult>=0 && (pComp=pTask->GetComponent())!=NULL) {
+ switch (pComp->GetComponentType()) {
+ case AliHLTComponent::kProcessor:
+ pComp->SetStopwatches(pStopwatches);
+ break;
+ case AliHLTComponent::kSource:
+ {
+ // this switch determines whether the time consumption of the
+ // AliHLTComponent base methods should be counted to the input
+ // stopwatch or base stopwatch.
+ //int inputBase=(int)AliHLTComponent::kSWBase;
+ int inputBase=(int)AliHLTComponent::kSWInput;
+ pComp->SetStopwatch(pStopwatches->At(inputBase), AliHLTComponent::kSWBase);
+ pComp->SetStopwatch(pStopwatches->At((int)AliHLTComponent::kSWInput), AliHLTComponent::kSWDA);
+ }
+ break;
+ case AliHLTComponent::kSink:
+ {
+ // this switch determines whether the time consumption of the
+ // AliHLTComponent base methods should be counted to the output
+ // stopwatch or base stopwatch.
+ //int outputBase=(int)AliHLTComponent::kSWBase;
+ int outputBase=(int)AliHLTComponent::kSWOutput;
+ pComp->SetStopwatch(pStopwatches->At(outputBase), AliHLTComponent::kSWBase);
+ pComp->SetStopwatch(pStopwatches->At((int)AliHLTComponent::kSWOutput), AliHLTComponent::kSWDA);
+ }
+ break;
+ }
+ }
+ } else {
+ }
+ lnk = lnk->Next();
+ }
+ return iResult;
+}
+
int AliHLTSystem::StartTasks()
{
// see header file for class documentation
int iResult=0;
AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent();
while (pAgent && iResult>=0) {
- TString tops=pAgent->GetTopConfigurations(runloader);
+ TString tops=pAgent->GetLocalRecConfigurations(runloader);
HLTDebug("top configurations for agent %s (%p): %s", pAgent->GetName(), pAgent, tops.Data());
TObjArray* pTokens=tops.Tokenize(" ");
if (pTokens) {
class AliRunLoader;
class AliRawReader;
class AliESD;
+class TObjArray;
+class TStopwatch;
/**
* @class AliHLTSystem
*/
int InitTasks();
+ /**
+ * Init the stopwatches for all tasks.
+ * @param pStopwatches object array of stopwatches, for types
+ * @see AliHLTComponent::AliHLTStopwatchType
+ * @return neg error code if failed
+ */
+ int InitBenchmarking(TObjArray* pStopwatches);
+
/**
* Start task list.
* The @ref AliHLTTask::StartRun method is called for each task, the
lib_LTLIBRARIES = libHLTbase.la
# version info for the library
-LIBRARY_VERSION = '3:0:0'
+LIBRARY_VERSION = '3:1:1'
# 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
* of files.<br>
*
* Component ID: \b FilePublisher <br>
- * 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).
+ * Library: \b libAliHLTUtil.
*
* Mandatory arguments: <br>
* <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
--- /dev/null
+// @(#) $Id$
+
+/** @file AliHLTLoaderPublisherComponent.cxx
+ @author Matthias Richter
+ @date
+ @brief A general tree publisher component for the AliLoader.
+*/
+
+#include "AliHLTLoaderPublisherComponent.h"
+#include "AliRunLoader.h"
+#include "AliLoader.h"
+#include "AliLog.h"
+#include "TTree.h"
+
+/** global instance for agent registration */
+AliHLTLoaderPublisherComponent gAliHLTLoaderPublisherComponent;
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTLoaderPublisherComponent)
+
+AliHLTLoaderPublisherComponent::AliHLTLoaderPublisherComponent()
+ :
+ fMaxSize(0),
+ fLoaderType(),
+ fTreeType("digits"),
+ fVerbose(kFALSE),
+ fDataType(kAliHLTAnyDataType),
+ fSpecification(0),
+ fpLoader(NULL)
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTLoaderPublisherComponent::~AliHLTLoaderPublisherComponent()
+{
+ // see header file for class documentation
+}
+
+const char* AliHLTLoaderPublisherComponent::GetComponentID()
+{
+ // see header file for class documentation
+ return "AliLoaderPublisher";
+}
+
+AliHLTComponentDataType AliHLTLoaderPublisherComponent::GetOutputDataType()
+{
+ return fDataType;
+}
+
+void AliHLTLoaderPublisherComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+ constBase=fMaxSize;
+ inputMultiplier=1;
+}
+
+AliHLTComponent* AliHLTLoaderPublisherComponent::Spawn()
+{
+ // see header file for class documentation
+ return new AliHLTLoaderPublisherComponent;
+}
+
+int AliHLTLoaderPublisherComponent::DoInit( int argc, const char** argv )
+{
+ // see header file for class documentation
+ int iResult=0;
+
+ // scan arguments
+ TString argument="";
+ int bMissingParam=0;
+ for (int i=0; i<argc && iResult>=0; i++) {
+ argument=argv[i];
+ if (argument.IsNull()) continue;
+
+ // -loader
+ if (argument.CompareTo("-loader")==0) {
+ if ((bMissingParam=(++i>=argc))) break;
+ fLoaderType=argv[i];
+
+ // -tree
+ } else if (argument.CompareTo("-tree")==0) {
+ if ((bMissingParam=(++i>=argc))) break;
+ fTreeType=argv[i];
+
+ // -verbose
+ } else if (argument.CompareTo("-verbose")==0) {
+ fVerbose=kTRUE;
+
+ // -datatype
+ } else if (argument.CompareTo("-datatype")==0) {
+ if ((bMissingParam=(++i>=argc))) break;
+ memcpy(&fDataType.fID, argv[i], TMath::Min(kAliHLTComponentDataTypefIDsize, (Int_t)strlen(argv[i])));
+ if ((bMissingParam=(++i>=argc))) break;
+ memcpy(&fDataType.fOrigin, argv[i], TMath::Min(kAliHLTComponentDataTypefOriginSize, (Int_t)strlen(argv[i])));
+
+ // -dataspec
+ } else if (argument.CompareTo("-dataspec")==0) {
+ if ((bMissingParam=(++i>=argc))) break;
+ TString parameter(argv[i]);
+ parameter.Remove(TString::kLeading, ' '); // remove all blanks
+ if (parameter.IsDigit()) {
+ fSpecification=(AliHLTUInt32_t)parameter.Atoi();
+ } else if (parameter.BeginsWith("0x") &&
+ parameter.Replace(0,2,"",0).IsHex()) {
+ sscanf(parameter.Data(),"%x", &fSpecification);
+ } else {
+ HLTError("wrong parameter for argument %s, number expected", argument.Data());
+ iResult=-EINVAL;
+ }
+ } else {
+ HLTError("unknown argument %s", argument.Data());
+ iResult=-EINVAL;
+ }
+ }
+ if (bMissingParam) {
+ HLTError("missing parameter for argument %s", argument.Data());
+ iResult=-EINVAL;
+ }
+
+ if (iResult<0) return iResult;
+
+ if (fLoaderType.IsNull()) {
+ HLTError("loader type required, use \'-loader\' option");
+ return -EINVAL;
+ }
+
+ // fetch runLoader instance from interface
+ AliRunLoader* pRunLoader=GetRunLoader();
+ if (pRunLoader) {
+
+ // get the TPC loader
+ fpLoader=pRunLoader->GetLoader(fLoaderType.Data());
+ if (fpLoader) {
+ // prepare the loader
+ fpLoader->LoadDigits("read");
+
+ // scan trough all events and estimate the size of the digits
+ for (int i=0; i<pRunLoader->GetNumberOfEvents(); i++) {
+ pRunLoader->GetEvent(i);
+ TTree* pTree=GetTree();
+ if (pTree) {
+ int size=EstimateObjectSize(pTree);
+ if (size>fMaxSize) fMaxSize=size;
+ if (fVerbose) {
+ AliInfoStream() << "event " << i << " "
+ << fTreeType <<" size " << size
+ << " count " << pTree->GetEntries() << endl;
+ }
+ } else {
+ AliWarningStream() << "no " << fTreeType << " tree for event " << i << endl;
+ }
+ }
+ } else {
+ AliErrorStream() << "can not get loader of type " << fLoaderType << endl;
+ iResult=-EFAULT;
+ }
+ } else {
+ AliErrorStream() << "can not get runLoader" << endl;
+ iResult=-EFAULT;
+ }
+ return iResult;
+}
+
+int AliHLTLoaderPublisherComponent::DoDeinit()
+{
+ // see header file for class documentation
+ int iResult=0;
+ if (fpLoader) {
+ fpLoader->UnloadDigits();
+ }
+ fpLoader=NULL;
+ return iResult;
+}
+
+int AliHLTLoaderPublisherComponent::GetEvent(const AliHLTComponentEventData& evtData,
+ AliHLTComponentTriggerData& trigData)
+{
+ // see header file for class documentation
+ int iResult=0;
+ // fetch runLoader instance from interface
+ AliRunLoader* pRunLoader=GetRunLoader();
+ if (pRunLoader && fpLoader) {
+ pRunLoader->GetEvent(GetEventCount());
+ TTree* pTree=GetTree();
+ if (pTree) {
+ PushBack(pTree, fDataType);
+ } else {
+ AliWarningStream() << "no " << fTreeType << " tree for event " << GetEventCount() << endl;
+ }
+ } else {
+ AliErrorStream() << "component not initialized" << endl;
+ }
+ return iResult;
+}
+
+TTree* AliHLTLoaderPublisherComponent::GetTree()
+{
+ TTree* pTree=NULL;
+ if (fpLoader) {
+ if (fTreeType.CompareTo("digits")==0)
+ pTree=fpLoader->TreeD();
+ else if (fTreeType.CompareTo("clusters")==0) {
+ pTree=fpLoader->TreeR();
+ }
+ } else {
+ }
+ return pTree;
+}
--- /dev/null
+//-*- Mode: C++ -*-
+// @(#) $Id$
+
+#ifndef ALIHLTLOADERPUBLISHERCOMPONENT_H
+#define ALIHLTLOADERPUBLISHERCOMPONENT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/** @file AliHLTLoaderPublisherComponent.h
+ @author Matthias Richter
+ @date
+ @brief A general tree publisher component for the AliLoader.
+*/
+
+#include "AliHLTOfflineDataSource.h"
+
+class AliLoader;
+
+/**
+ * @class AliHLTLoaderPublisherComponent
+ * A general tree publisher component for the AliLoader.
+ *
+ * Component ID: \b AliLoaderPublisher <br>
+ * Library: \b libAliHLTUtil.
+ *
+ * Mandatory arguments: <br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
+ * \li -loader <i> loader name </i>
+ * e.g. <tt> -loader TPCLoader </tt>
+ * \li -tree <i> tree name </i> : digits (default), clusters
+ * e.g. <tt> -tree digits </tt>
+ * \li -verbose<br>
+ * print out some more info messages, mainly for the sake of tutorials
+ * \li -datatype <i> datatype dataorigin </i> <br>
+ * data type ID and origin, e.g. <tt>-datatype DIGITS TPC </tt>
+ * \li -dataspec <i> specification </i> <br>
+ * data specification treated as decimal number or hex number if
+ * prepended by '0x'
+ *
+ * Optional arguments:<br>
+ *
+ *
+ * @ingroup alihlt_system
+ */
+class AliHLTLoaderPublisherComponent : public AliHLTOfflineDataSource {
+ public:
+ /** standard constructor */
+ AliHLTLoaderPublisherComponent();
+ /** destructor */
+ virtual ~AliHLTLoaderPublisherComponent();
+
+ /**
+ * Get the id of the component.
+ * Each component is identified by a unique id.
+ * The function is pure virtual and must be implemented by the child class.
+ * @return component id (string)
+ */
+ const char* GetComponentID();
+
+ /**
+ * Get the output data type of the component.
+ * The function is pure virtual and must be implemented by the child class.
+ * @return output data type
+ */
+ AliHLTComponentDataType GetOutputDataType();
+
+ /**
+ * Get a ratio by how much the data volume is shrinked or enhanced.
+ * The function is pure virtual and must be implemented by the child class.
+ * @param constBase <i>return</i>: additive part, independent of the
+ * input data volume
+ * @param inputMultiplier <i>return</i>: multiplication ratio
+ * @return values in the reference variables
+ */
+ void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+
+ /**
+ * Spawn function.
+ * Each component must implement a spawn function to create a new instance of
+ * the class. Basically the function must return <i>new <b>my_class_name</b></i>.
+ * @return new class instance
+ */
+ virtual AliHLTComponent* Spawn();
+
+ protected:
+ /**
+ * Init method.
+ */
+ int DoInit( int argc, const char** argv );
+
+ /**
+ * Deinit method.
+ */
+ int DoDeinit();
+
+ /**
+ * Data source method.
+ * @param evtData event data structure
+ * @param trigData trigger data structure
+ * @return
+ */
+ int GetEvent(const AliHLTComponentEventData& evtData,
+ AliHLTComponentTriggerData& trigData);
+
+ private:
+ /**
+ * Get tree of type specified in fTreeType from loader.
+ */
+ TTree* GetTree();
+
+ /** max output block size, estimate during DoInit */
+ Int_t fMaxSize; //!transient
+
+ /** loader string */
+ TString fLoaderType; //!transient
+
+ /** tree string */
+ TString fTreeType; //!transient
+
+ /** be verbose: info printouts */
+ Bool_t fVerbose; //!transient
+
+ /** data type */
+ AliHLTComponentDataType fDataType; //!transient
+
+ /** data specification */
+ AliHLTUInt32_t fSpecification; //!transient
+
+ /** instance of the AliLoader */
+ AliLoader* fpLoader; //!transient
+
+ ClassDef(AliHLTLoaderPublisherComponent, 0);
+};
+
+#endif
+2007-04-17 HLT sample applications
+ - publisher for AliLoader trees added
+ - sample analysis chain added tp sample lib
+ - tutorial and documentation
+ - benchmark functionality added to AliHLTSystem
2007-03-14 aliroot integration
- AliHLTSystem interface methods to AliHLTReconstructor implemeted
- AliHLTModuleAgent introduced for each HLT module, sample
libAliHLTPHOS.pkg \
libAliHLTTPC.pkg \
libAliHLTTRD.pkg \
+ src/AliHLTReconstructor.h \
hlt.conf
DIST_SUBDIRS = $(SUBDIRS)
/** global instance for agent registration */
AliHLTAgentSample gAliHLTAgentSample;
-const char* gAliHLTAgentSampleData="/tmp/testdata";
-const char* gAliHLTAgentSampleOut="/tmp/hltout";
+const char* AliHLTAgentSample::fgkAliHLTAgentSampleData="/tmp/testdata";
+const char* AliHLTAgentSample::fgkAliHLTAgentSampleOut="/tmp/hltout";
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTAgentSample)
// see header file for class documentation
// delete the test data
- ofstream dump(gAliHLTAgentSampleData, ios::in);
+ ofstream dump(fgkAliHLTAgentSampleData, ios::in);
if (dump.good()) {
TString arg("rm -f ");
- arg+=gAliHLTAgentSampleData;
+ arg+=fgkAliHLTAgentSampleData;
gSystem->Exec(arg.Data());
}
}
int AliHLTAgentSample::CreateConfigurations(AliHLTConfigurationHandler* handler,
- AliRunLoader* runloader) const
+ AliRunLoader* runloader) const
{
// see header file for class documentation
// create some test data
- ofstream dump(gAliHLTAgentSampleData, (ios::openmode)0);
+ ofstream dump(fgkAliHLTAgentSampleData, (ios::openmode)0);
dump << "This is just some test data for the ALICE HLT analysis example";
dump << "---- not copied" << endl;
dump.close();
if (handler) {
// the publisher configuration for the test data
TString arg("-datafile ");
- arg+=gAliHLTAgentSampleData;
+ arg+=fgkAliHLTAgentSampleData;
HLTDebug(arg.Data());
- handler->CreateConfiguration("fp1" , "FilePublisher", NULL , arg.Data());
+ handler->CreateConfiguration("sample-fp1" , "FilePublisher", NULL , arg.Data());
// the configuration for the dummy component
- handler->CreateConfiguration("cp" , "Dummy" , "fp1", "output_percentage 80");
+ handler->CreateConfiguration("sample-cp" , "Dummy" , "sample-fp1", "output_percentage 80");
// the writer configuration
- arg="-datafile "; arg+=gAliHLTAgentSampleOut;
- handler->CreateConfiguration("sink1", "FileWriter" , "cp" , arg.Data());
+ arg="-datafile "; arg+=fgkAliHLTAgentSampleOut;
+ handler->CreateConfiguration("sample-sink1", "FileWriter" , "sample-cp" , arg.Data());
+
+ // sample offline source
+ handler->CreateConfiguration("sample-offsrc", "AliLoaderPublisher" , NULL , "-loader TPCLoader -tree digits -verbose");
+
+ // sample offline sink
+ handler->CreateConfiguration("sample-offsnk", "SampleOfflineDataSink" , "sample-offsrc" , NULL);
}
return 0;
}
-const char* AliHLTAgentSample::GetTopConfigurations(AliRunLoader* runloader) const
+const char* AliHLTAgentSample::GetLocalRecConfigurations(AliRunLoader* runloader) const
{
// see header file for class documentation
- return "sink1";
+ return "sample-sink1 sample-offsnk";
}
const char* AliHLTAgentSample::GetRequiredComponentLibraries() const
/**
* @class AliHLTAgentSample
- * This is the agent for the AliHLTSample library.
+ * This is the agent for the AliHLTSample library.<br>
+ * The AliHLTSample library illustrates usage of the HLT framework. The
+ * agent provides information on the features of the sample components
+ * and the configuration which should be run during AliRoot reconstruction.
*
+ * The sample agent implements all interface function provided by @ref
+ * AliHLTModuleAgent :
+ * - @ref CreateConfigurations <br>
+ * The method gets an instance of the AliHLTConfigurationHanler to add
+ * configurations, e.g.
+ * <pre>
+ * handler->CreateConfiguration("my-puplisher" , "FilePublisher", NULL , "data.bin");
+ * ...
+ * handler->CreateConfiguration("my-analysis-chain" , "FileWriter", "my-processor" , "my arguments");
+ * </pre>
+ * - @ref GetLocalRecConfigurations <br>
+ * returns a string of blank separated configurations to be run during
+ * local event reconstruction.
+ * <pre>
+ * return "my-data-sink my-analysis-chain";
+ * </pre>
+ * - @ref GetRequiredComponentLibraries <br>
+ * returns a string of blank separated libraries which have to be loaded
+ * in addition
+ * <pre>
+ * return "libAliHLTUtil.so";
+ * </pre>
+ * - not implemented are the in iterface methods
+ * - @ref AliHLTModuleAgent::GetEventRecConfigurations
+ * - @ref AliHLTModuleAgent::RegisterComponents
+ *
+ * In order to hook the sample library up to the HLT system on global object
+ * @ref gAliHLTAgentSample of the agent is defined in the source code.
+ *
* @ingroup alihlt_system
*/
class AliHLTAgentSample : public AliHLTModuleAgent {
virtual ~AliHLTAgentSample();
/**
- * Register all configurations belonging to this module with the
+ * Register all configurations belonging to the sample library with the
* AliHLTConfigurationHandler. The agent can adapt the configurations
* to be registered to the current AliRoot setup by checking the
* runloader.
AliRunLoader* runloader=NULL) const;
/**
- * Get the top configurations belonging to this module.
+ * Get the top configurations for local event reconstruction.
* A top configuration describes a processing chain. It can simply be
* described by the last configuration(s) in the chain.
* The agent can adapt the configurations to be registered to the current
* AliRoot setup by checking the runloader.
- * @param runloader AliRoot runloader
- * @return number of configurations, neg. error code if failed
+ * @param runloader [in] AliRoot runloader
+ * @return string containing the top configurations separated by blanks
*/
- const char* GetTopConfigurations(AliRunLoader* runloader=NULL) const;
+ const char* GetLocalRecConfigurations(AliRunLoader* runloader=NULL) const;
/**
* Component libraries which the configurations of this agent depend on.
protected:
private:
- ClassDef(AliHLTAgentSample, 0);
+ /** file name of the generated test data*/
+ static const char* fgkAliHLTAgentSampleData; //!transient
+
+ /** file name of the output file */
+ static const char* fgkAliHLTAgentSampleOut; //!transient
+
+ /** ROOT specific member definition */
+ ClassDef(AliHLTAgentSample, 1);
};
#endif
--- /dev/null
+// @(#) $Id$
+
+/** @file AliHLTSampleOfflineSinkComponent.cxx
+ @author Matthias Richter
+ @date
+ @brief A sample offline sink component.
+*/
+
+#include "AliHLTSampleOfflineSinkComponent.h"
+#include "AliRunLoader.h"
+#include "AliLoader.h"
+#include "AliLog.h"
+#include "TTree.h"
+
+/** global instance for agent registration */
+AliHLTSampleOfflineSinkComponent gAliHLTSampleOfflineSinkComponent;
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTSampleOfflineSinkComponent)
+
+AliHLTSampleOfflineSinkComponent::AliHLTSampleOfflineSinkComponent()
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTSampleOfflineSinkComponent::~AliHLTSampleOfflineSinkComponent()
+{
+ // see header file for class documentation
+}
+
+const char* AliHLTSampleOfflineSinkComponent::GetComponentID()
+{
+ // see header file for class documentation
+ return "SampleOfflineDataSink";
+}
+
+void AliHLTSampleOfflineSinkComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
+{
+ // see header file for class documentation
+ list.clear();
+ list.push_back(kAliHLTAnyDataType);
+}
+
+AliHLTComponent* AliHLTSampleOfflineSinkComponent::Spawn()
+{
+ // see header file for class documentation
+ return new AliHLTSampleOfflineSinkComponent;
+}
+
+int AliHLTSampleOfflineSinkComponent::DoInit( int argc, const char** argv )
+{
+ // see header file for class documentation
+ int iResult=0;
+ return iResult;
+}
+
+int AliHLTSampleOfflineSinkComponent::DoDeinit()
+{
+ // see header file for class documentation
+ int iResult=0;
+ return iResult;
+}
+
+int AliHLTSampleOfflineSinkComponent::DumpEvent(const AliHLTComponentEventData& evtData,
+ AliHLTComponentTriggerData& trigData)
+{
+ // see header file for class documentation
+ int iResult=0;
+ AliInfoStream() << "dump event " << GetEventCount() << endl;
+ TTree* pTree=(TTree*)GetFirstInputObject(kAliHLTAnyDataType, "TTree");
+ while (pTree) {
+ AliInfoStream() << " got TTree object with " << pTree->GetEntries() << " entries" << endl;
+ pTree=(TTree*)GetNextInputObject();
+ }
+ return iResult;
+}
+
+int AliHLTSampleOfflineSinkComponent::FillESD(int eventNo, AliRunLoader* runLoader, AliESD* esd)
+{
+ // see header file for class documentation
+ int iResult=0;
+ AliInfoStream() << "event " << eventNo << endl;
+ return iResult;
+}
--- /dev/null
+//-*- Mode: C++ -*-
+// @(#) $Id$
+
+#ifndef ALIHLTSAMPLEOFFLINESINKCOMPONENT_H
+#define ALIHLTSAMPLEOFFLINESINKCOMPONENT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx sink for full Copyright notice */
+
+/** @file AliHLTSampleOfflineSinkComponent.h
+ @author Matthias Richter
+ @date
+ @brief This is a sample offline interface component.
+*/
+
+#include "AliHLTOfflineDataSink.h"
+
+class AliLoader;
+
+/**
+ * @class AliHLTSampleOfflineSinkComponent
+ * This is a sample offline interface component.
+ *
+ * @ingroup alihlt_system
+ */
+class AliHLTSampleOfflineSinkComponent : public AliHLTOfflineDataSink {
+ public:
+ /**
+ * standard constructor. The agent is automatically registered in the
+ * global agent manager
+ */
+ AliHLTSampleOfflineSinkComponent();
+ /** destructor */
+ virtual ~AliHLTSampleOfflineSinkComponent();
+
+ /**
+ * Get the id of the component.
+ * Each component is identified by a unique id.
+ * The function is pure virtual and must be implemented by the child class.
+ * @return component id (string)
+ */
+ const char* GetComponentID();
+
+ /**
+ * Get the input data types of the component.
+ * The function is pure virtual and must be implemented by the child class.
+ * @return list of data types in the vector reference
+ */
+ virtual void GetInputDataTypes( vector<AliHLTComponentDataType>& );
+
+ /**
+ * Spawn function.
+ * Each component must implement a spawn function to create a new instance of
+ * the class. Basically the function must return <i>new <b>my_class_name</b></i>.
+ * @return new class instance
+ */
+ virtual AliHLTComponent* Spawn();
+
+ /**
+ * Fill ESD for one event.
+ * Fill the ESD with the previously reconstructed data. Interface method called by
+ * the AliHLTOfflineInterface framework.
+ * @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
+ */
+ int FillESD(int eventNo, AliRunLoader* runLoader, AliESD* esd);
+
+ protected:
+ /**
+ * Init method.
+ */
+ int DoInit( int argc, const char** argv );
+
+ /**
+ * Deinit method.
+ */
+ int DoDeinit();
+
+ /**
+ * Data sink method.
+ * @param evtData event data structure
+ * @param trigData trigger data structure
+ * @return
+ */
+ int DumpEvent(const AliHLTComponentEventData& evtData,
+ AliHLTComponentTriggerData& trigData);
+
+ private:
+ ClassDef(AliHLTSampleOfflineSinkComponent, 0);
+};
+
+#endif
$(DICTCPP): $(DICTHEADERS:%=$(srcdir)/%) $(DICTDEF)
if [ -x $(ROOTCINT) ]; then $(ROOTCINT) -f $@ -c $(CPPFLAGS) $(AM_CPPFLAGS) $(DEFS) $(foreach i, $(DICTINCLUDE), $(i)) $^ ; fi
-$(DICTDEF): Makefile.am
+$(DICTDEF): Makefile.am $(PKGDEF)
@echo '//automatically generated ROOT DICT definition' > $@
@echo '//!!! DO NOT EDIT THIS FILE !!!' >> $@
@echo '//add further class definitions to the CLASS_HDRS variable in Makefile.am' >> $@
@date
@brief HLT examples and tutorial. */
-/** @defgroup alihlt_tutorial HLT examples and tutorial
- @brief HLT examples and tutorial
+/**
+@defgroup alihlt_tutorial HLT examples and tutorial
- A description will follow ...
-*/
+-# @ref tut_hltsystem
+ -# @ref tut_load_libraries
+ -# @ref tut_dummy_chain
+ -# @ref tut_tpc_sector
+-# @ref tut_reconstruction
+ -# @ref tut_module_agent
+ -# @ref tut_reconstruction_sample
+
+<br>
+<br>
+@section tut_hltsystem Running Components in the HLT System
+
+@subsection tut_load_libraries Library setup
+Component libraries must be loader via the AliHLTComponentHandler
+or AliHLTSystem::LoadComponentLibraries. You can run the following
+macro from the AliRoot promt.
+<pre>
+{
+ AliHLTSystem gHLT;
+ gHLT.LoadComponentLibraries("libAliHLTUtil.so");
+}
+</pre>
+
+<br>
+@subsection tut_dummy_chain Example: Running a dummy chain
+The simplest chain consists of a publisher component, a processor
+and a data sink. The AliHLTDummyComponent is a sample component
+which just copies a fraction of the input data to the output.
+You can run the following macro from the AliRoot promt.
+<pre>
+{
+ AliHLTSystem gHLT;
+ gHLT.LoadComponentLibraries("libAliHLTUtil.so libAliHLTSample.so");
+ AliHLTConfiguration publisher("fp1", "FilePublisher", NULL, "-datafile some-data.dat");
+ AliHLTConfiguration copy("cp", "Dummy", "fp1", "output_percentage 80");
+ AliHLTConfiguration sink1("sink1", "FileWriter", "cp", NULL);
+ gHLT.BuildTaskList(&sink1);
+ gHLT.Run();
+}
+</pre>
+@note You have to specify a real file name instead of \em some-data.dat
+
+<br>
+@subsection tut_tpc_sector Example: One sector of the TPC
+This example builds an analysis chain for TPC sector 0. It works on
+simulated data and assumes the ddl files to be present in the current
+directory.
+<pre>
+{
+ AliHLTSystem gHLT;
+ // load the component library
+ gHLT.LoadComponentLibraries("libAliHLTUtil.so libAliHLTTPC.so");
+
+ // data source components
+ AliHLTConfiguration fp0("fp0", "FilePublisher", NULL, "-datafile TPC_768.ddl -datatype DDL_RWPK 'TPC '"
+ "-dataspec 0x00000000");
+ AliHLTConfiguration fp1("fp1", "FilePublisher", NULL, "-datafile TPC_769.ddl -datatype DDL_RWPK 'TPC '"
+ "-dataspec 0x00000101");
+ AliHLTConfiguration fp2("fp2", "FilePublisher", NULL, "-datafile TPC_840.ddl -datatype DDL_RWPK 'TPC '"
+ "-dataspec 0x00000202");
+ AliHLTConfiguration fp3("fp3", "FilePublisher", NULL, "-datafile TPC_841.ddl -datatype DDL_RWPK 'TPC '"
+ "-dataspec 0x00000303");
+ AliHLTConfiguration fp4("fp4", "FilePublisher", NULL, "-datafile TPC_842.ddl -datatype DDL_RWPK 'TPC '"
+ "-dataspec 0x00000404");
+ AliHLTConfiguration fp5("fp5", "FilePublisher", NULL, "-datafile TPC_843.ddl -datatype DDL_RWPK 'TPC '"
+ "-dataspec 0x00000505");
+
+ // cluster finders
+ AliHLTConfiguration cf0("cf0", "TPCClusterFinderPacked", "fp0", "pp-run rawreadermode 4 timebins 446");
+ AliHLTConfiguration cf1("cf1", "TPCClusterFinderPacked", "fp1", "pp-run rawreadermode 4 timebins 446");
+ AliHLTConfiguration cf2("cf2", "TPCClusterFinderPacked", "fp2", "pp-run rawreadermode 4 timebins 446");
+ AliHLTConfiguration cf3("cf3", "TPCClusterFinderPacked", "fp3", "pp-run rawreadermode 4 timebins 446");
+ AliHLTConfiguration cf4("cf4", "TPCClusterFinderPacked", "fp4", "pp-run rawreadermode 4 timebins 446");
+ AliHLTConfiguration cf5("cf5", "TPCClusterFinderPacked", "fp5", "pp-run rawreadermode 4 timebins 446");
+
+ // tracker
+ AliHLTConfiguration tracker("tracker", "TPCSliceTracker", "cf0 cf1 cf2 cf3 cf4 cf5", "pp-run bfield 0.5");
+
+ // the data sink component
+ AliHLTConfiguration writer("writer", "TPCEsdWriter", "tracker", "-datafile AliESDs.root");
+
+ gHLT.BuildTaskList(&writer);
+ gHLT.Run();
+}
+</pre>
+
+@section tut_reconstruction AliRoot reconstruction
+The HLT analysis components can be run either in the AliRoot
+reconstruction or the HLT online framework.
+The integration into the AliRoot reconstruction works via the
+@ref AliHLTReconstructor plugin. The intention is to run HLT analysis
+chains in AliRoot in the same way as in the online framework, i.e.
+the full components are run also from the offline framework rather
+than just the algorithm hooked on by a special interface class.
+By this one achieves the highest possible compatibility.
+
+We think of the HLT as a 'black box' with data input and output. In
+addition there is access to calibration data from OCDB (or the local
+HLT copy HCDB). All components can only work on the data they get as
+input. As the different detector algorithms/components will run in
+separated processes and even on different machines, no data exchange
+is possible via global data structures and variables possible.
+
+The AliRoot reconstruction consists mainly of three steps:
+-# local event reconstruction: this is usually the place for digit/raw
+data conversion to clusters/space points. All the events are processed
+at once. If HLT analysis chain are executed in the local event
+reconstruction, the chain must contain an output recorder as the ESD
+is filled on an event by event basis and the corresponding method called
+later.
+-# event reconstruction: this is the reconstruction on an event by event
+basis. Immediately after the reconstruction, the FillESD method is
+called.
+-# ESD fill: the reconstructed event is written to the ESD.
+
+@subsection tut_module_agent The Module Agent
+Each component library has to implement a module agent in order to be
+hooked up to the AliRoot reconstruction system. The agent defines the
+features of the libraries and the configurations to be run during the
+different steps of the reconstruction. The agent
+- can register all components of the library. This is an
+ alternative to the component registration via global objects (see
+ @ref alihltcomponent-handling).
+- registers HLT configurations (see @ref AliHLTConfiguration)
+- specifies the configurations to be run
+- specifies additional component libraries required to run the
+ configurations.
+
+Finally, one global object of the module agent has to be specified in
+the source code. All registration and integration into the HLT system
+is carried out automatically.
+
+@see
+ @ref AliHLTModuleAgent for the interface description <br>
+ @ref AliHLTAgentSample for a sample implementation
+
+@subsection tut_reconstruction_sample The sample library
+The libAliHLTSample library provides examples how to implement the
+library agent (@ref AliHLTAgentSample), how to add configurations and
+define HLT chains for reconstruction.
+
+The sample library is not part of the default libraries loaded by the
+HLT steering during reconstruction. The example can be run by the
+following macro in AliRoot (provided you have a simulated event in the
+current directory):
+<pre>
+{
+ AliReconstruction rec; // the reconstruction instance
+ rec.SetRunLocalReconstruction("HLT"); // run local rec only for HLT
+ rec.SetRunTracking(""); // switch off tracking
+ rec.SetOption("HLT", "libAliHLTSample.so");
+ rec.Run();
+}
+</pre>
+
+The agent defines the following chains:
+-# a simple data copying consisting of a
+ - @ref AliHLTFilePublisher publishes some data generated before in /tmp
+ - @ref AliHLTDummyComponent copies a fraction of the incoming data
+ - @ref AliHLTFileWriter writes the data input to a file
+-# digit publishing from the TPCloader <br>
+ This chain illustrates how data can be published from the AliRunLoader
+ in order to be processed by another component (not in the sample chain).
+ Finally, the @ref AliHLTSampleOfflineSinkComponent is component which is
+ the backend and has again the AliRoot structures.
+ - @ref AliHLTLoaderPublisherComponent
+ - @ref AliHLTSampleOfflineSinkComponent
+
+In the same way any other component library can be integrated into the
+AliRoot reconstruction.
+
+ */
/* note pad
AC_SUBST([HAVE_DOT])
AC_SUBST([DOT_PATH])
+dnl HAVE_SRC_SUBDIR=${abs_top_srcdir}/src
+dnl echo $HAVE_SRC_SUBDIR
+dnl if ! test -d $HAVE_SRC_SUBDIR; then
+dnl HAVE_SRC_SUBDIR=
+dnl fi
+dnl AC_SUBST([HAVE_SRC_SUBDIR])
+
dnl ------------------------------------------------------------------
dnl inatallation directory for libraries
dnl
INPUT = @top_srcdir@/doc \
@top_srcdir@/BASE \
@top_srcdir@/TPCLib \
- @top_srcdir@/SampleLib
+ @top_srcdir@/SampleLib \
+ @top_srcdir@/src
+
FILE_PATTERNS = *.h *.c *.cpp *.hpp *.cxx
RECURSIVE = YES
EXCLUDE = @top_srcdir@/BASE/HLTbaseLinkDef.h \
@top_srcdir@/TPCLib/AliHLTTPCLinkDef.h \
- @top_srcdir@/TPCLib/AliHLTTPCClustFinderNew.cxx
+ @top_srcdir@/TPCLib/AliHLTTPCClustFinderNew.cxx \
+ @top_srcdir@/src/AliHLTConfMapPoint.cxx \
+ @top_srcdir@/src/AliHLTFileHandler.cxx \
+ @top_srcdir@/src/AliHLTLogger.cxx \
+ @top_srcdir@/src/AliHLTTrackMerger.cxx \
+ @top_srcdir@/src/AliHLTTransform.cxx \
+ @top_srcdir@/src/AliLevel3.h \
+ @top_srcdir@/src/AliLevel3.cxx \
+ @top_srcdir@/src/AliHLTLogging.h \
+ @top_srcdir@/src/AliHLTDisplay.h \
+ @top_srcdir@/src/AliHLTDisplay.cxx \
+ @top_srcdir@/src/AliHLTBenchmark.h \
+ @top_srcdir@/src/AliHLTBenchmark.cxx \
+ @top_srcdir@/src/AliHLTRawDataFileHandler.h \
+ @top_srcdir@/src/AliHLTRawDataFileHandler.cxx \
+ @top_srcdir@/src/AliHLTClustFinderNew.h \
+ @top_srcdir@/src/AliHLTClustFinderNew.cxx \
+ @top_srcdir@/src/AliHLTFileHandler.h \
+ @top_srcdir@/src/AliHLTFileHandler.cxx
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
-SOURCE_BROWSER = NO
+SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
MODULE_SRCS= AliHLTSampleComponent1.cxx \
AliHLTSampleComponent2.cxx \
AliHLTAgentSample.cxx \
+ AliHLTSampleOfflineSinkComponent.cxx \
AliHLTDummyComponent.cxx
# class header files, the link definition for the root dictionary
CLASS_HDRS:= AliHLTSampleComponent1.h \
AliHLTSampleComponent2.h \
AliHLTAgentSample.h \
+ AliHLTSampleOfflineSinkComponent.h \
AliHLTDummyComponent.h
# library headers
MODULE_SRCS= AliHLTFilePublisher.cxx \
AliHLTRootFilePublisherComponent.cxx \
AliHLTRootFileWriterComponent.cxx \
+ AliHLTLoaderPublisherComponent.cxx \
AliHLTAgentUtil.cxx
CLASS_HDRS:= AliHLTFilePublisher.h \
AliHLTRootFilePublisherComponent.h \
AliHLTRootFileWriterComponent.h \
+ AliHLTLoaderPublisherComponent.h \
AliHLTAgentUtil.h
MODULE_HDRS:= $(CLASS_HDRS)
// <loizides@ikf.uni-frankfurt.de> //
///////////////////////////////////////////////////////////////////////////////
-// very ugly but it has to work fast
-#ifdef use_reconstruction
-
#include <Riostream.h>
#include <TSystem.h>
#include <TArrayF.h>
using namespace std;
#endif
+/** HLT default component libraries */
const char* kHLTDefaultLibs[]= {
"libAliHLTUtil.so",
"libAliHLTTPC.so",
}
-#endif
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-#ifdef use_reconstruction
#include "AliReconstructor.h"
class AliHLTSystem;
+/**
+ * @class AliHLTReconstructor
+ * AliHLTReconstructor AliRoot event reconstruction plugin for the HLT.
+ * The AliHLTReconstructor holds an instance of the @ref AliHLTSystem
+ * steering class. The actual reconstruction depends on the loaded component
+ * libraries. Each library must implement a module agent (@ref AliHLTModuleAgent)
+ * in order to provide information on the supported features and the
+ * configurations to be run.
+ *
+ * The default component libraries which are loaded through the initialization
+ * are determined by the @ref kHLTDefaultLibs array. The library loading can
+ * be overridden by an option to the AliHLTReconstructor through the
+ * <tt>SetOption</tt> method of <tt>AliReconstruction</tt>, e.g.
+ * <pre>
+ * AliReconstruction rec;
+ * rec.SetOption("HLT", "libAliHLTSample.so");
+ * </pre>
+ * will only load <tt>libAliHLTSample.so</tt>
+ *
+ * Optional arguments:<br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
+ * \li loglevel=<i>level</i><br>
+ * level can be a hex number encoding the @ref AliHLTComponentLogSeverity
+ * \li alilog=off <br>
+ * disables the logging of HLT log messages through <tt>AliLog</tt> <br>
+ *
+ * For further information on the AliRoot reconstruction refer to the AliRoot
+ * documentation, namely <tt>AliReconstruction</tt>.
+ */
class AliHLTReconstructor: public AliReconstructor {
public:
AliHLTReconstructor();
ClassDef(AliHLTReconstructor, 1) // class for the TPC reconstruction
};
-#endif
typedef AliHLTReconstructor AliL3Reconstructor; // for backward compatibility