fListSrcElement(),
fArguments(""),
fArgc(-1),
- fArgv(NULL)
+ fArgv(NULL),
+ fBufferSize(-1)
{
// see header file for class documentation
// or
fListSrcElement=fListSources.begin();
}
-AliHLTConfiguration::AliHLTConfiguration(const char* id, const char* component, const char* sources, const char* arguments)
+AliHLTConfiguration::AliHLTConfiguration(const char* id, const char* component, const char* sources,
+ const char* arguments, const char* bufsize)
:
fID(id),
fComponent(component),
fListSrcElement(),
fArguments(arguments),
fArgc(-1),
- fArgv(NULL)
+ fArgv(NULL),
+ fBufferSize(-1)
{
// see header file for function documentation
+ if (bufsize) fBufferSize=ConvertSizeString(bufsize);
fListSrcElement=fListSources.begin();
if (id && component) {
if (fgConfigurationHandler) {
fListSrcElement(),
fArguments(src.fArguments),
fArgc(-1),
- fArgv(NULL)
+ fArgv(NULL),
+ fBufferSize(src.fBufferSize)
{
// see header file for function documentation
fListSrcElement=fListSources.begin();
fArguments=src.fArguments;
fArgc=-1;
fArgv=NULL;
+ fBufferSize=src.fBufferSize;
return *this;
}
return iResult;
}
-int AliHLTConfiguration::InterpreteString(const char* arg, vector<char*>& argList)
+int AliHLTConfiguration::InterpreteString(const char* arg, vector<char*>& argList) const
{
// see header file for function documentation
int iResult=0;
return iResult;
}
+int AliHLTConfiguration::ConvertSizeString(const char* strSize) const
+{
+ // see header file for function documentation
+ int size=0;
+ if (!strSize) return -1;
+
+ char* endptr=NULL;
+ size=strtol(strSize, &endptr, 10);
+ if (size>=0) {
+ if (endptr) {
+ if (endptr==strSize) {
+ HLTWarning("ignoring unrecognized buffer size '%s'", strSize);
+ size=-1;
+ } else if (*endptr==0) {
+ // no unit specifier
+ } else if (*endptr=='k') {
+ size*=1014;
+ } else if (*endptr=='M') {
+ size*=1024*1024;
+ } else {
+ HLTWarning("ignoring buffer size of unknown unit '%c'", endptr[0]);
+ }
+ } else {
+ HLTWarning("ignoring negative buffer size specifier '%s'", strSize);
+ size=-1;
+ }
+ }
+ return size;
+}
+
int AliHLTConfiguration::FollowDependency(const char* id, TList* pTgtList)
{
// see header file for function documentation
* @param component component id
* @param sources blank separated list of source configuration ids
* @param arguments argument string passed to the component at initialization
+ * @param bufsize size of the output buffer in byte, the string can contain a
+ * number prepended by a unit, e.g. 1M, allowed units 'k' and 'M'
*/
AliHLTConfiguration(const char* id, const char* component,
- const char* sources, const char* arguments);
+ const char* sources, const char* arguments,
+ const char* bufsize=NULL);
/** copy constructor */
AliHLTConfiguration(const AliHLTConfiguration& src);
/** assignment op */
*/
int GetArguments(const char*** pArgv);
+ /**
+ * Get output buffer size.
+ * @return size in byte or -1 if not specified
+ */
+ int GetOutputBufferSize() const {return fBufferSize;}
protected:
* @param arg pointer to argument string
* @param argList target to receive the argument list
*/
- int InterpreteString(const char* arg, vector<char*>& argList);
+ int InterpreteString(const char* arg, vector<char*>& argList) const;
+
+ /**
+ * Convert buffer size string to number
+ */
+ int ConvertSizeString(const char* strSize) const;
/** id of this configuration */
TString fID; // see above
/** argument array */
char** fArgv; // see above
+ /** size of the output buffer */
+ int fBufferSize; // see above
+
/** the instance of the global configuration handler */
static AliHLTConfigurationHandler* fgConfigurationHandler; //! transient
if (fEventCount==0) {
InitBenchmarking(fStopwatches);
} else {
- //ResumeBenchmarking(fStopwatches);
+ ResumeBenchmarking(fStopwatches);
}
for (int i=fEventCount; i<fEventCount+iNofEvents && iResult>=0; i++) {
if ((iResult=ProcessTasks(i))>=0) {
}
fEventCount+=iNofEvents;
if (bStop) StopTasks();
- //else PauseBenchmarking(fStopwatches);
+ else PauseBenchmarking(fStopwatches);
}
if (bStop) DeinitTasks();
}
return iResult;
}
-int AliHLTSystem::PrintBenchmarking(TObjArray* pStopwatches, int bClean)
+int AliHLTSystem::PauseBenchmarking(TObjArray* pStopwatches) const
+{
+ // see header file for class documentation
+ if (pStopwatches==NULL) return 0;
+
+ for (int i=0; i<(int)AliHLTComponent::kSWTypeCount; i++) {
+ if (!pStopwatches->At(i)) continue;
+ TStopwatch* pSw=dynamic_cast<TStopwatch*>(pStopwatches->At(i));
+ if (pSw) pSw->Stop();
+ }
+ return 0;
+}
+
+int AliHLTSystem::ResumeBenchmarking(TObjArray* pStopwatches) const
+{
+ // see header file for class documentation
+ if (pStopwatches==NULL) return 0;
+
+ for (int i=0; i<(int)AliHLTComponent::kSWTypeCount; i++) {
+ if (!pStopwatches->At(i)) continue;
+ TStopwatch* pSw=dynamic_cast<TStopwatch*>(pStopwatches->At(i));
+ if (pSw) pSw->Continue();
+ }
+ return 0;
+}
+
+int AliHLTSystem::PrintBenchmarking(TObjArray* pStopwatches, int bClean) const
{
// see header file for class documentation
int iInitialized=1;
}
if (iInitialized!=0) {
- HLTInfo("HLT statistics:\n"
+ HLTImportant("HLT statistics:\n"
" base: R:%.3fs C:%.3fs\n"
" input: R:%.3fs C:%.3fs\n"
" output: R:%.3fs C:%.3fs\n"
*/
int InitBenchmarking(TObjArray* pStopwatches);
+ /**
+ * Stop the stopwatches for all tasks.
+ * @param pStopwatches object array of stopwatches, for types
+ * @see AliHLTComponent::AliHLTStopwatchType
+ * @return neg error code if failed
+ */
+ int PauseBenchmarking(TObjArray* pStopwatches) const;
+
+ /**
+ * Continue the stopwatches for all tasks.
+ * @param pStopwatches object array of stopwatches, for types
+ * @see AliHLTComponent::AliHLTStopwatchType
+ * @return neg error code if failed
+ */
+ int ResumeBenchmarking(TObjArray* pStopwatches) const;
+
/**
* Print benchmarking summary.
* Optionak: clean up stop watches.
* @param bClean delete stop watches if 1
* @return neg error code if failed
*/
- int PrintBenchmarking(TObjArray* pStopwatches, int bClean=0);
+ int PrintBenchmarking(TObjArray* pStopwatches, int bClean=0) const;
/**
* Start task list.
AliHLTUInt32_t size=0;
if (iResult>=0) {
do {
+ long unsigned int iOutputDataSize=0;
+ AliHLTConfiguration* pConf=GetConf();
+ assert(pConf);
+ // check if there was a buffer size specified, query output size
+ // estimator from component otherwize
+ if (pConf && pConf->GetOutputBufferSize()>=0) {
+ iOutputDataSize=pConf->GetOutputBufferSize();
+ } else {
long unsigned int iConstBase=0;
double fInputMultiplier=0;
if (pComponent->GetComponentType()!=AliHLTComponent::kSink)
HLTWarning("ignoring negative input multiplier");
fInputMultiplier=0;
}
- long unsigned int iOutputDataSize=int(fInputMultiplier*iInputDataVolume) + iConstBase;
+ iOutputDataSize=int(fInputMultiplier*iInputDataVolume) + iConstBase;
//HLTDebug("task %s: reqired output size %d", GetName(), iOutputDataSize);
+ }
if (iNofTrial>0) {
// dont process again if the buffer size is the same
if (size==iOutputDataSize) break;
* The provided buffer is filled with the encoded data from the
* previous simulation.
* @param pBuffer target variable to receive the pointer
+ * @param size size of the target buffer
* @return size in byte, neg. error if failed
*/
int GetData(AliHLTUInt8_t* pBuffer, int size);
@top_srcdir@/BASE \
@top_srcdir@/TPCLib \
@top_srcdir@/SampleLib \
+ @top_srcdir@/RCU \
@top_srcdir@/rec \
@top_srcdir@/exa \
@top_srcdir@/sim \
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTOUTDigitReader)
-AliHLTOUTDigitReader::AliHLTOUTDigitReader(int event, AliHLTEsdManager* pEsdManager)
+AliHLTOUTDigitReader::AliHLTOUTDigitReader(int event, AliHLTEsdManager* pEsdManager, const char* digitFile)
:
AliHLTOUTHomerCollection(event, pEsdManager),
+ fDigitFileName(digitFile),
fpDigitFile(NULL),
fpDigitTree(NULL),
fMinDDL(-1),
}
if (!fpDigitFile) {
- fpDigitFile=new TFile("HLT.Digits.root");
+ fpDigitFile=new TFile(fDigitFileName);
}
if (!fpDigitFile) return false;
if (fpDigitFile->IsZombie()) return false;
*/
#include "AliHLTOUTHomerCollection.h"
+#include "TString.h"
class AliRawReader;
class AliHLTHOMERReader;
*/
class AliHLTOUTDigitReader : public AliHLTOUTHomerCollection {
public:
- /** standard constructor */
- AliHLTOUTDigitReader(int event=-1, AliHLTEsdManager* pEsdManager=NULL);
+ /** constructor */
+ AliHLTOUTDigitReader(int event=-1, AliHLTEsdManager* pEsdManager=NULL, const char* digitFile="HLT.Digits.root");
/** destructor */
virtual ~AliHLTOUTDigitReader();
*/
int CloseTree();
+ /** name of the digit file */
+ TString fDigitFileName; //! transient
+
/** the root file for the HLT 'digit' output */
TFile* fpDigitFile; //!transient
#include <TSystem.h>
#include <TObjString.h>
+#include "TFile.h"
+#include "TTree.h"
#include "AliHLTReconstructor.h"
#include "AliLog.h"
+#include "AliRawReader.h"
#include "AliESDEvent.h"
#include "AliHLTSystem.h"
#include "AliHLTOUTRawReader.h"
//constructor
}
+AliHLTReconstructor::AliHLTReconstructor(const char* options)
+ :
+ AliReconstructor(),
+ AliHLTReconstructorBase(),
+ fFctProcessHLTOUT(NULL),
+ fpEsdManager(NULL)
+{
+ //constructor
+ if (options) Init(options);
+}
+
AliHLTReconstructor::~AliHLTReconstructor()
{
//destructor
fpEsdManager=NULL;
}
+void AliHLTReconstructor::Init(const char* options)
+{
+ // init the reconstructor
+ SetOption(options);
+ Init();
+}
+
void AliHLTReconstructor::Init()
{
// init the reconstructor
// added to the existing HLTOUT data
// The HLTOUT data is finally processed in FillESD
AliHLTSystem* pSystem=GetInstance();
+ AliInfo("running raw data reconstruction");
}
void AliHLTReconstructor::FillESD(AliRawReader* rawReader, TTree* /*clustersTree*/,
// all reconstruction has been moved to FillESD
//AliReconstructor::Reconstruct(digitsTree,clustersTree);
+ AliInfo("running digit data reconstruction");
}
void AliHLTReconstructor::FillESD(TTree* /*digitsTree*/, TTree* /*clustersTree*/, AliESDEvent* esd) const
}
}
}
+
+void AliHLTReconstructor::ProcessHLTOUT(const char* digitFile, AliESDEvent* pEsd) const
+{
+ // debugging/helper function to examine simulated data
+ if (!digitFile) return;
+
+ // read the number of events
+ TFile f(digitFile);
+ if (f.IsZombie()) return;
+ TTree* pTree=NULL;
+ f.GetObject("rawhltout", pTree);
+ if (!pTree) {
+ AliWarning(Form("can not find tree rawhltout in file %s", digitFile));
+ return ;
+ }
+ int nofEvents=pTree->GetEntries();
+ f.Close();
+ //delete pTree; OF COURSE NOT! its an object in the file
+ pTree=NULL;
+
+ for (int event=0; event<nofEvents; event++) {
+ AliHLTOUTDigitReader* pHLTOUT=new AliHLTOUTDigitReader(event, fpEsdManager, digitFile);
+ if (pHLTOUT) {
+ AliInfo(Form("event %d", event));
+ ProcessHLTOUT(pHLTOUT, pEsd);
+ PrintHLTOUTContent(pHLTOUT);
+ delete pHLTOUT;
+ } else {
+ AliError("error creating HLTOUT handler");
+ }
+ }
+}
+
+void AliHLTReconstructor::ProcessHLTOUT(AliRawReader* pRawReader, AliESDEvent* pEsd) const
+{
+ // debugging/helper function to examine simulated or real HLTOUT data
+ if (!pRawReader) return;
+
+ pRawReader->RewindEvents();
+ for (int event=0; pRawReader->NextEvent(); event++) {
+ AliHLTOUTRawReader* pHLTOUT=new AliHLTOUTRawReader(pRawReader, event, fpEsdManager);
+ if (pHLTOUT) {
+ AliInfo(Form("event %d", event));
+ ProcessHLTOUT(pHLTOUT, pEsd);
+ PrintHLTOUTContent(pHLTOUT);
+ delete pHLTOUT;
+ } else {
+ AliError("error creating HLTOUT handler");
+ }
+ }
+}
+
+void AliHLTReconstructor::PrintHLTOUTContent(AliHLTOUT* pHLTOUT) const
+{
+ // print the block specifications of the HLTOUT data blocks
+ if (!pHLTOUT) return;
+ int iResult=0;
+
+ for (iResult=pHLTOUT->SelectFirstDataBlock();
+ iResult>=0;
+ iResult=pHLTOUT->SelectNextDataBlock()) {
+ AliHLTComponentDataType dt=kAliHLTVoidDataType;
+ AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
+ pHLTOUT->GetDataBlockDescription(dt, spec);
+ const AliHLTUInt8_t* pBuffer=NULL;
+ AliHLTUInt32_t size=0;
+ if (pHLTOUT->GetDataBuffer(pBuffer, size)>=0) {
+ pHLTOUT->ReleaseDataBuffer(pBuffer);
+ pBuffer=NULL; // just a dummy
+ }
+ AliInfo(Form(" %s 0x%x: size %d", AliHLTComponent::DataType2Text(dt).c_str(), spec, size));
+ }
+}
*/
class AliHLTReconstructor: public AliReconstructor, public AliHLTReconstructorBase {
public:
+ /** standard constructor */
AliHLTReconstructor();
+ /** constructor */
+ AliHLTReconstructor(const char* options);
/** destructor */
virtual ~AliHLTReconstructor();
/** init the reconstructor */
void Init();
+ /** init the reconstructor */
+ void Init(const char* options);
+
/**
* This Reconstructor function is not applicable for the AliHLTReconstructor
* as it gets a detector specific digits tree. But HLT processes all detectors.
*/
void ProcessHLTOUT(AliHLTOUT* pHLTOUT, AliESDEvent* esd) const;
+ /**
+ * Process HLTOUT data.
+ * Open digit file and process the HLTOUT digit data.
+ * This function is mostly intended for debugging purposes and stand-alone
+ * processing of the output from the simulation. Loops over all events.
+ * @param digitFile path of the digit file
+ * @param pEsd optional ESD to be filled
+ */
+ void ProcessHLTOUT(const char* digitFile="HLT.Digits.root", AliESDEvent* pEsd=NULL) const;
+
+ /**
+ * Process HLTOUT data.
+ * Process the HLTOUT from the raw reader.
+ * This function is mostly intended for debugging purposes and stand-alone
+ * processing of simulated or real raw data.
+ * \em Note: Loops over all events, i.e. the current event of the the raw
+ * reader will change. Not to be called inside the normal AliRoot processsing.
+ * @param pRawReader raw reader instance
+ * @param pEsd optional ESD to be filled
+ */
+ void ProcessHLTOUT(AliRawReader* pRawReader, AliESDEvent* pEsd=NULL) const;
+
+ /**
+ * Print a short info about the HLTOUT content.
+ */
+ void PrintHLTOUTContent(AliHLTOUT* pHLTOUT) const;
+
private:
/** copy constructor prohibited */
AliHLTReconstructor(const AliHLTReconstructor& src);