// context
-#if __GNUC__>= 3
-using namespace std;
-#endif
-
//#include "AliHLTStdIncludes.h"
#include "AliHLTComponent.h"
#include "AliHLTComponentHandler.h"
#include "AliHLTMessage.h"
#include "AliHLTCTPData.h"
#include "AliHLTErrorGuard.h"
-#include "AliRawDataHeader.h"
+#include "AliHLTCDHWrapper.h"
#include "TString.h"
#include "TMath.h"
#include "TObjArray.h"
fpStopwatches(new TObjArray(kSWTypeCount)),
fMemFiles(),
fpRunDesc(NULL),
- fCDBSetRunNoFunc(false),
+ fCDBSetRunNoFunc(NULL),
fChainId(),
fChainIdCrc(0),
fpBenchmark(NULL),
, fLastObjectSize(0)
, fpCTPData(NULL)
, fPushbackPeriod(0)
- , fLastPushBackTime(-1)
+ , fLastPushBackTime(-1),
+ fEventModulo(-1)
{
// see header file for class documentation
// or
} else {
HLTError("wrong parameter for argument -pushback-period, number expected");
}
+ // -event-modulo
+ } else if (argument.BeginsWith("-event-modulo=")) {
+ argument.ReplaceAll("-event-modulo=", "");
+ if (argument.IsDigit()) {
+ fEventModulo=argument.Atoi();
+ if (fEventModulo < 1)
+ {
+ fEventModulo = -1;
+ HLTError("number passed in -event-modulo must be a positive integer greater or equal to 1.");
+ }
+ } else {
+ HLTError("wrong parameter for argument -event-modulo, integer number expected");
+ }
// -disable-component-stat
} else if (argument.CompareTo("-disable-component-stat")==0) {
fFlags|=kDisableComponentStat;
// the argument is a single argument, just having whitespaces at the end.
argument.Remove(0, argument.First(' '));
if (argument.IsWhitespace()) {
- ptrarray.push_back(argv[i]);
+ stringarray.push_back(argv[i]);
continue;
}
// every second entry is enclosed by quotes and thus
// one single argument
stringarray.push_back(argument.Data());
- ptrarray.push_back(stringarray.back().c_str());
} else {
TObjArray* pTokens=argument.Tokenize(" ");
if (pTokens) {
TString data=pTokens->At(n)->GetName();
if (!data.IsNull() && !data.IsWhitespace()) {
stringarray.push_back(data.Data());
- ptrarray.push_back(stringarray.back().c_str());
}
}
}
}
}
+ // fill ptrarray; should be safe at this point
+ // since stringarray isn't modified any further
+ unsigned int idx;
+ for(idx=0; idx<stringarray.size(); ++idx) {
+ ptrarray.push_back(stringarray.at(idx).c_str());
+ }
+
for (i=0; (unsigned)i<ptrarray.size() && iResult>=0;) {
int result=ScanConfigurationArgument(ptrarray.size()-i, &ptrarray[i]);
if (result==0) {
}
if (pString) {
- HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
- arguments+=pString->GetString().Data();
+ HLTInfo("received configuration object string: \'%s\'", pString->GetName());
+ arguments+=pString->GetName();
arguments+=" ";
} else {
HLTError("configuration object \"%s\"%s%s has wrong type, required TObjString", path, key?" key ":"",key?key:"");
return iResult;
}
-TObject* AliHLTComponent::LoadAndExtractOCDBObject(const char* path, int version, int subVersion, const char* key)
+TObject* AliHLTComponent::LoadAndExtractOCDBObject(const char* path, const char* key) const
{
// see header file for function documentation
- AliCDBEntry* pEntry=AliHLTMisc::Instance().LoadOCDBEntry(path, GetRunNo(), version, subVersion);
+ AliCDBEntry* pEntry=AliHLTMisc::Instance().LoadOCDBEntry(path, GetRunNo());
if (!pEntry) return NULL;
TObject* pObject=AliHLTMisc::Instance().ExtractObject(pEntry);
TMap* pMap=dynamic_cast<TMap*>(pObject);
memset(&evtData, 0, sizeof(AliHLTComponentEventData));
evtData.fStructSize=sizeof(AliHLTComponentEventData);
evtData.fEventID=kAliHLTVoidEventID;
+ evtData.fEventCreation_s = kMaxUInt;
}
void AliHLTComponent::PrintComponentDataTypeInfo(const AliHLTComponentDataType& dt)
public:
AliHLTComponentStatisticsId(AliHLTUInt32_t id) : fId(id) {}
AliHLTComponentStatisticsId(const AliHLTComponentStatisticsId& src) : fId(src.fId) {}
+ AliHLTComponentStatisticsId& operator=(const AliHLTComponentStatisticsId& src) {
+ if (this==&src) return *this;
+ fId=src.fId; return *this;
+ }
bool operator==(const AliHLTComponentStatistics& a) const {return a.fId==fId;}
private:
AliHLTComponentStatisticsId();
public:
AliHLTComponentBlockDataSpecification(AliHLTUInt32_t specification) : fSpecification(specification) {}
AliHLTComponentBlockDataSpecification(const AliHLTComponentBlockDataSpecification& src) : fSpecification(src.fSpecification) {}
+ AliHLTComponentBlockDataSpecification& operator=(const AliHLTComponentBlockDataSpecification& src) {
+ if (this==&src) return *this;
+ fSpecification=src.fSpecification; return *this;
+ }
bool operator==(const AliHLTComponentBlockData& bd) const {return bd.fSpecification==fSpecification;}
private:
AliHLTComponentBlockDataSpecification();
{
// We can actually get the event type from the CDH if it is valid.
// Otherwise just use the specification of the input block.
- const AliRawDataHeader* cdh;
+ AliHLTCDHWrapper cdh;
if (ExtractTriggerData(trigData, NULL, NULL, &cdh, NULL) == 0)
{
- fEventType = ExtractEventTypeFromCDH(cdh);
+ fEventType = ExtractEventTypeFromCDH(&cdh);
}
}
// increment CTP trigger counters if available
if (IsDataEvent()) fpCTPData->Increment(trigData);
}
+
+ // Check if the event processing should be skipped because of the
+ // down scaling from the event modulo argument. Using a prime number
+ // as pre divisor to pseudo-randomise the event number to get a more
+ // uniform distribution.
+ if (fEventModulo > 1)
+ {
+ bSkipDataProcessing |= ( ((AliHLTUInt64_t(fCurrentEvent) / AliHLTUInt64_t(4789)) % AliHLTUInt64_t(fEventModulo)) != 0 );
+ }
AliHLTComponentBlockDataList blockData;
if (iResult>=0 && !bSkipDataProcessing)
// do not use ALIHLTCOMPONENT_DA_STOPWATCH(); macro
// in order to avoid 'shadowed variable' warning
AliHLTStopwatchGuard swguard2(fpStopwatches!=NULL?reinterpret_cast<TStopwatch*>(fpStopwatches->At((int)kSWDA)):NULL);
+ AliHLTMisc::AliOnlineGuard onlineGuard;
iResult=DoProcessing(evtData, blocks, trigData, outputPtr, size, blockData, edd);
} // end of the scope of the stopwatch guard
if (iResult>=0 && !bSkipDataProcessing) {
//
}
-AliHLTComponent::AliHLTStopwatchGuard& AliHLTComponent::AliHLTStopwatchGuard::operator=(const AliHLTStopwatchGuard&)
+AliHLTComponent::AliHLTStopwatchGuard& AliHLTComponent::AliHLTStopwatchGuard::operator=(const AliHLTStopwatchGuard& other)
{
//
// assignment operator not for use
//
+ if (this==&other) return *this;
fpStopwatch=NULL;
fpPrec=NULL;
return *this;
return fpRunDesc->fRunType;
}
+
AliHLTUInt32_t AliHLTComponent::GetTimeStamp() const
{
// see header file for function documentation
- if (fCurrentEventData.fEventCreation_s) {
+ if (fCurrentEventData.fEventCreation_s < kMaxUInt ) {
return fCurrentEventData.fEventCreation_s;
}
// using the actual UTC if the time stamp was not set by the framework
const AliHLTComponentTriggerData& trigData,
const AliHLTUInt8_t (**attributes)[gkAliHLTBlockDAttributeCount],
AliHLTUInt64_t* status,
- const AliRawDataHeader** cdh,
+ AliHLTCDHWrapper* const cdh,
AliHLTReadoutList* readoutlist,
bool printErrors
)
AliHLTEventTriggerData* evtData = reinterpret_cast<AliHLTEventTriggerData*>(trigData.fData);
assert(evtData != NULL);
- // Check that the CDH has 8 words.
- if (cdh != NULL and evtData->fCommonHeaderWordCnt != 8)
+ // Check that the CDH has the right number of words.
+ if (cdh != NULL and evtData->fCommonHeaderWordCnt != gkAliHLTCommonHeaderCount)
{
if (printErrors)
{
AliHLTLogging log;
log.LoggingVarargs(kHLTLogError, Class_Name(), FUNCTIONNAME(), __FILE__, __LINE__,
"Common Data Header (CDH) has wrong number of data words: %d but expected %d",
- evtData->fCommonHeaderWordCnt, sizeof(AliRawDataHeader)/sizeof(AliHLTUInt32_t)
+ evtData->fCommonHeaderWordCnt, gkAliHLTCommonHeaderCount
);
}
return -EBADMSG;
}
if (cdh != NULL)
{
- const AliRawDataHeader* cdhptr = reinterpret_cast<const AliRawDataHeader*>(&evtData->fCommonHeader[0]);
- *cdh = cdhptr;
+ *cdh = &(evtData->fCommonHeader[0]);
}
if (readoutlist != NULL)
{
return 0;
}
-AliHLTUInt32_t AliHLTComponent::ExtractEventTypeFromCDH(const AliRawDataHeader* cdh)
+AliHLTUInt32_t AliHLTComponent::ExtractEventTypeFromCDH(const AliHLTCDHWrapper* const cdh)
{
// see header file for function documentation
-
UChar_t l1msg = cdh->GetL1TriggerMessage();
if ((l1msg & 0x1) == 0x0) return gkAliEventTypeData;
// The L2SwC bit must be one if we got here, i.e. l1msg & 0x1 == 0x1.