// context
-#if __GNUC__>= 3
-using namespace std;
-#endif
-
//#include "AliHLTStdIncludes.h"
#include "AliHLTComponent.h"
#include "AliHLTComponentHandler.h"
#include "AliHLTMessage.h"
#include "AliHLTCTPData.h"
-#include "AliRawDataHeader.h"
+#include "AliHLTErrorGuard.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);
// see header file for function documentation
memset( output, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
strncat( output, type.fOrigin, kAliHLTComponentDataTypefOriginSize );
- strcat( output, ":" );
+ strncat( output, ":", 1 );
strncat( output, type.fID, kAliHLTComponentDataTypefIDsize );
}
memset(&evtData, 0, sizeof(AliHLTComponentEventData));
evtData.fStructSize=sizeof(AliHLTComponentEventData);
evtData.fEventID=kAliHLTVoidEventID;
+ evtData.fEventCreation_s = kMaxUInt;
}
void AliHLTComponent::PrintComponentDataTypeInfo(const AliHLTComponentDataType& dt)
return iSpec;
}
-int AliHLTComponent::PushBack(TObject* pObject, const AliHLTComponentDataType& dt, AliHLTUInt32_t spec,
+int AliHLTComponent::PushBack(const TObject* pObject, const AliHLTComponentDataType& dt, AliHLTUInt32_t spec,
void* pHeader, int headerSize)
{
// see header file for function documentation
return iResult;
}
-int AliHLTComponent::PushBack(TObject* pObject, const char* dtID, const char* dtOrigin, AliHLTUInt32_t spec,
+int AliHLTComponent::PushBack(const TObject* pObject, const char* dtID, const char* dtOrigin, AliHLTUInt32_t spec,
void* pHeader, int headerSize)
{
// see header file for function documentation
return iResult;
}
-int AliHLTComponent::EstimateObjectSize(TObject* pObject) const
+int AliHLTComponent::EstimateObjectSize(const TObject* pObject) const
{
// see header file for function documentation
if (!pObject) return 0;
fEventDoneData = newEDD;
fEventDoneDataSize = newSize;
}
- else {
+ else if (fEventDoneData) {
memcpy( reinterpret_cast<AliHLTUInt8_t*>(fEventDoneData->fData)+fEventDoneData->fDataSize, edd.fData, edd.fDataSize );
fEventDoneData->fDataSize += edd.fDataSize;
}
+ else {
+ HLTError("internal mismatch, fEventDoneData=%d but buffer is NULL", fEventDoneDataSize);
+ iResult=-EFAULT;
+ }
return iResult;
}
+namespace
+{
+ // helper function for std:sort, implements an operator<
+ bool SortComponentStatisticsById(const AliHLTComponentStatistics& a, const AliHLTComponentStatistics& b)
+ {
+ return a.fId<b.fId;
+ }
+
+ // helper function for std:sort
+ bool SortComponentStatisticsDescendingByLevel(const AliHLTComponentStatistics& a, const AliHLTComponentStatistics& b)
+ {
+ return a.fId>b.fId;
+ }
+
+ // helper class to define operator== between AliHLTComponentStatistics and AliHLTComponentStatistics.fId
+ class AliHLTComponentStatisticsId {
+ 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();
+ AliHLTUInt32_t fId;
+ };
+
+ // operator for std::find of AliHLTComponentStatistics by id
+ bool operator==(const AliHLTComponentStatistics& a, const AliHLTComponentStatisticsId& b)
+ {
+ return b==a;
+ }
+
+ bool AliHLTComponentStatisticsCompareIds(const AliHLTComponentStatistics& a, const AliHLTComponentStatistics& b)
+ {
+ return a.fId==b.fId;
+ }
+
+ // helper class to define operator== between AliHLTComponentBlockData and AliHLTComponentBlockData.fSpecification
+ class AliHLTComponentBlockDataSpecification {
+ 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();
+ AliHLTUInt32_t fSpecification;
+ };
+
+ // operator for std::find of AliHLTComponentBlockData by specification
+ bool operator==(const AliHLTComponentBlockData& bd, const AliHLTComponentBlockDataSpecification& spec)
+ {
+ return spec==bd;
+ }
+
+ // operator for std::find
+ bool operator==(const AliHLTComponentBlockData& a, const AliHLTComponentBlockData& b)
+ {
+ if (!MatchExactly(a.fDataType,b.fDataType)) return false;
+ return a.fSpecification==b.fSpecification;
+ }
+
+} // end of namespace
+
int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
const AliHLTComponentBlockData* blocks,
AliHLTComponentTriggerData& trigData,
AliHLTComponentStatisticsList compStats;
bool bAddComponentTableEntry=false;
vector<AliHLTUInt32_t> parentComponentTables;
+ int processingLevel=-1;
#if defined(HLT_COMPONENT_STATISTICS)
if ((fFlags&kDisableComponentStat)==0) {
AliHLTComponentStatistics outputStat;
{
// 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);
}
}
if (pStat && compStats[0].fLevel<=pStat->fLevel) {
compStats[0].fLevel=pStat->fLevel+1;
}
- compStats.push_back(*pStat);
+ if (find(compStats.begin(), compStats.end(), AliHLTComponentStatisticsId(pStat->fId))==compStats.end()) {
+ compStats.push_back(*pStat);
+ }
}
}
} else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeComponentTable) {
- forwardedBlocks.push_back(fpInputBlocks[i]);
+ AliHLTComponentBlockDataList::iterator element=forwardedBlocks.begin();
+ while ((element=find(element, forwardedBlocks.end(), AliHLTComponentBlockDataSpecification(fpInputBlocks[i].fSpecification)))!=forwardedBlocks.end()) {
+ if (element->fDataType==fpInputBlocks[i].fDataType) break;
+ // TODO: think about some more checks inclusing also the actual data buffers
+ // this has to handle multiplicity>1 in the online system, where all components
+ // send the information on SOR, because this event is broadcasted
+ }
+ if (element==forwardedBlocks.end()) {
+ forwardedBlocks.push_back(fpInputBlocks[i]);
+ }
parentComponentTables.push_back(fpInputBlocks[i].fSpecification);
+ if (fpInputBlocks[i].fSize>=sizeof(AliHLTComponentTableEntry)) {
+ const AliHLTComponentTableEntry* entry=reinterpret_cast<AliHLTComponentTableEntry*>(fpInputBlocks[i].fPtr);
+ if (entry->fStructSize==sizeof(AliHLTComponentTableEntry)) {
+ if (processingLevel<0 || processingLevel<=(int)entry->fLevel)
+ processingLevel=entry->fLevel+1;
+ }
+ }
} else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeECSParam) {
indexECSParamBlock=i;
} else {
if (indexSOREvent>=0) {
// start of run
bAddComponentTableEntry=true;
+ compStats.clear(); // no component statistics for SOR
if (fpRunDesc==NULL) {
fpRunDesc=new AliHLTRunDesc;
if (fpRunDesc) *fpRunDesc=kAliHLTVoidRunDesc;
if (indexEOREvent>=0) {
fLastPushBackTime=0; // always send at EOR
bAddComponentTableEntry=true;
+ compStats.clear(); // no component statistics for EOR
if (fpRunDesc!=NULL) {
if (fpRunDesc) {
AliHLTRunDesc rundesc;
HLTWarning("did not receive SOR, ignoring EOR");
}
}
- if (indexComConfEvent>=0 || fEventType==gkAliEventTypeConfiguration) {
+ if (fEventType==gkAliEventTypeConfiguration) {
+ if (indexComConfEvent>=0) {
TString cdbEntry;
if (indexComConfEvent>=0 && fpInputBlocks[indexComConfEvent].fPtr!=NULL && fpInputBlocks[indexComConfEvent].fSize>0) {
cdbEntry.Append(reinterpret_cast<const char*>(fpInputBlocks[indexComConfEvent].fPtr), fpInputBlocks[indexComConfEvent].fSize);
if (tmpResult<0) {
HLTWarning("reconfiguration of component %p (%s) failed with error code %d", this, GetComponentID(), tmpResult);
}
+ } else {
+ ALIHLTERRORGUARD(1, "incomplete Configure event, missing parameter data block");
+ }
}
- if (indexUpdtDCSEvent>=0 || fEventType==gkAliEventTypeReadPreprocessor) {
+ if (fEventType==gkAliEventTypeReadPreprocessor) {
+ if (indexUpdtDCSEvent>=0) {
TString modules;
if (fpInputBlocks[indexUpdtDCSEvent].fPtr!=NULL && fpInputBlocks[indexUpdtDCSEvent].fSize>0) {
modules.Append(reinterpret_cast<const char*>(fpInputBlocks[indexUpdtDCSEvent].fPtr), fpInputBlocks[indexUpdtDCSEvent].fSize);
if (tmpResult<0) {
HLTWarning("preprocessor update of component %p (%s) failed with error code %d", this, GetComponentID(), tmpResult);
}
+ } else {
+ ALIHLTERRORGUARD(1, "incomplete ReadPreprocessor event, missing parameter data block");
+ }
}
} else {
// processing function needs to be called if there are no input data
// for the private blocks
if ((fFlags&kRequireSteeringBlocks)!=0) bSkipDataProcessing=0;
+ // data processing is not skipped for data sources
+ if (GetComponentType()==AliHLTComponent::kSource) bSkipDataProcessing=0;
+
if (fpCTPData) {
// set the active triggers for this event
fpCTPData->SetTriggers(trigData);
// 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) {
if (offset>0) fOutputBufferFilled+=offset;
}
if (bAddComponentTableEntry) {
- int offset=AddComponentTableEntry(fOutputBlocks, fpOutputBuffer, fOutputBufferSize, fOutputBufferFilled, parentComponentTables);
+ int offset=AddComponentTableEntry(fOutputBlocks, fpOutputBuffer, fOutputBufferSize, fOutputBufferFilled, parentComponentTables, processingLevel);
if (offset>0) size+=offset;
}
if (forwardedBlocks.size()>0) {
}
} else {
// Low Level interface
+ if (blockData.empty() && size!=0) {
+ // set the size to zero because there is no announced data
+ //HLTWarning("no output blocks added by component but output buffer filled %d of %d", size, fOutputBufferSize);
+ size=0;
+ }
+
if (compStats.size()>0) {
int offset=AddComponentStatistics(blockData, fpOutputBuffer, fOutputBufferSize, size, compStats);
if (offset>0) size+=offset;
}
if (bAddComponentTableEntry) {
- int offset=AddComponentTableEntry(blockData, fpOutputBuffer, fOutputBufferSize, size, parentComponentTables);
+ int offset=AddComponentTableEntry(blockData, fpOutputBuffer, fOutputBufferSize, size, parentComponentTables, processingLevel);
if (offset>0) size+=offset;
}
if (forwardedBlocks.size()>0) {
if (fPushbackPeriod>0) {
// suppress the output
TDatime time;
- if (fLastPushBackTime<0 || (int)time.Get()-fLastPushBackTime>=fPushbackPeriod) {
+ if (fLastPushBackTime<0) {
+ // choose a random offset at beginning to equalize traffic for multiple instances
+ // of the component
+ gRandom->SetSeed(fChainIdCrc);
+ fLastPushBackTime=time.Get();
+ fLastPushBackTime-=gRandom->Integer(fPushbackPeriod);
+ } else if ((int)time.Get()-fLastPushBackTime>=fPushbackPeriod) {
fLastPushBackTime=time.Get();
}
}
stats[0].fCTime=(AliHLTUInt32_t)(fpBenchmark->CpuTime()*ALIHLTCOMPONENT_STATTIME_SCALER);
fpBenchmark->Continue();
}
+
+ sort(stats.begin(), stats.end(), SortComponentStatisticsDescendingByLevel);
+
+ // shrink the number of entries if the buffer is too small
if (offset+stats.size()*sizeof(AliHLTComponentStatistics)>bufferSize) {
+ unsigned originalSize=stats.size();
AliHLTUInt32_t removedLevel=0;
do {
// remove all entries of the level of the last entry
}
} while (stats.size()>1 &&
(offset+stats.size()*sizeof(AliHLTComponentStatistics)>bufferSize));
+ HLTWarning("too little space in output buffer to add block of %d statistics entries (size %d), available %d, removed %d entries",
+ originalSize, sizeof(AliHLTComponentStatistics), bufferSize-offset, originalSize-stats.size());
+ } else {
+ HLTDebug("adding block of %d statistics entries", stats.size());
}
assert(stats.size()>0);
if (stats.size()==0) return 0;
bd.fOffset = offset;
bd.fSize = stats.size()*sizeof(AliHLTComponentStatistics);
bd.fDataType = kAliHLTDataTypeComponentStatistics;
- bd.fSpecification = kAliHLTVoidDataSpec;
- unsigned int master=0;
- for (unsigned int i=1; i<blocks.size(); i++) {
- if (blocks[i].fSize>blocks[master].fSize &&
- !MatchExactly(blocks[i].fDataType, kAliHLTVoidDataType|kAliHLTDataOriginPrivate))
- master=i;
- }
- if (blocks.size()>0 && !MatchExactly(blocks[master].fDataType, kAliHLTVoidDataType|kAliHLTDataOriginPrivate)) {
- // take the data origin of the biggest block as specification
- // this is similar to the treatment in the HOMER interface. For traditional
- // reasons, the bytes are swapped there on a little endian architecture, so
- // we do it as well.
- memcpy(&bd.fSpecification, &blocks[master].fDataType.fOrigin, sizeof(bd.fSpecification));
-#ifdef R__BYTESWAP // set on little endian architectures
- bd.fSpecification=((bd.fSpecification & 0xFFULL) << 24) |
- ((bd.fSpecification & 0xFF00ULL) << 8) |
- ((bd.fSpecification & 0xFF0000ULL) >> 8) |
- ((bd.fSpecification & 0xFF000000ULL) >> 24);
-#endif
- }
+ bd.fSpecification = fChainIdCrc;
memcpy(buffer+offset, &(stats[0]), bd.fSize);
blocks.push_back(bd);
iResult=bd.fSize;
AliHLTUInt8_t* buffer,
AliHLTUInt32_t bufferSize,
AliHLTUInt32_t offset,
- const vector<AliHLTUInt32_t>& parents) const
+ const vector<AliHLTUInt32_t>& parents,
+ int processingLevel) const
{
// see header file for function documentation
int iResult=0;
// write entry
AliHLTComponentTableEntry* pEntry=reinterpret_cast<AliHLTComponentTableEntry*>(pTgt);
pEntry->fStructSize=sizeof(AliHLTComponentTableEntry);
+ pEntry->fLevel=processingLevel>=0?processingLevel:0;
pEntry->fNofParents=parents.size();
pEntry->fSizeDescription=descriptionSize;
pTgt=pEntry->fBuffer;
iResult=bd.fSize;
}
#else
- if (blocks.size() && buffer && bufferSize && offset && parents.size()) {
+ if (blocks.size() && buffer && bufferSize && offset && parents.size() && processingLevel) {
// get rid of warning
}
#endif // HLT_COMPONENT_STATISTICS
//
}
-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
int AliHLTComponent::ExtractComponentTableEntry(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size,
string& retChainId, string& retCompId, string& retCompArgs,
- vector<AliHLTUInt32_t>& parents)
+ vector<AliHLTUInt32_t>& parents, int& level)
{
// see header file for function documentation
retChainId.clear();
retCompId.clear();
retCompArgs.clear();
parents.clear();
+ level=-1;
if (!pBuffer || size==0) return 0;
const AliHLTComponentTableEntry* pEntry=reinterpret_cast<const AliHLTComponentTableEntry*>(pBuffer);
if (size<8/* the initial size of the structure*/ ||
pEntry==NULL || pEntry->fStructSize<8) return -ENOMSG;
+
+ if (pEntry->fStructSize!=sizeof(AliHLTComponentTableEntry)) return -EBADF;
+ level=pEntry->fLevel;
const AliHLTUInt32_t* pParents=reinterpret_cast<const AliHLTUInt32_t*>(pEntry->fBuffer);
const AliHLTUInt8_t* pEnd=pBuffer+size;
const AliHLTComponentTriggerData& trigData,
const AliHLTUInt8_t (**attributes)[gkAliHLTBlockDAttributeCount],
AliHLTUInt64_t* status,
- const AliRawDataHeader** cdh,
+ AliHLTCDHWrapper* const cdh,
AliHLTReadoutList* readoutlist,
bool printErrors
)
// Check that the trigger data pointer points to data of a size we can handle.
// Either it is the size of AliHLTEventTriggerData or the size of the old
- // version of AliHLTEventTriggerData using AliHLTEventDDLV0.
+ // version of AliHLTEventTriggerData using AliHLTEventDDLV0 or V1.
if (trigData.fDataSize != sizeof(AliHLTEventTriggerData) and
- trigData.fDataSize != sizeWithoutReadout + sizeof(AliHLTEventDDLV0)
+ trigData.fDataSize != sizeWithoutReadout + sizeof(AliHLTEventDDLV0) and
+ trigData.fDataSize != sizeWithoutReadout + sizeof(AliHLTEventDDLV1)
)
{
if (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 and
+ evtData->fCommonHeaderWordCnt != gkAliHLTCommonHeaderCountV2
+ )
{
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);
- *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.