fMemFiles(),
fpRunDesc(NULL),
fpDDLList(NULL),
- fCDBInitialized(false),
+ fCDBSetRunNoFunc(false),
fChainId()
{
// see header file for class documentation
int AliHLTComponent::Init( AliHLTComponentEnvironment* environ, void* environParam, int argc, const char** argv )
{
// see header file for function documentation
+ HLTLogKeyword(GetComponentID());
int iResult=0;
if (environ) {
memcpy(&fEnvironment, environ, sizeof(AliHLTComponentEnvironment));
int AliHLTComponent::Deinit()
{
// see header file for function documentation
+ HLTLogKeyword(GetComponentID());
int iResult=0;
iResult=DoDeinit();
if (fpRunDesc) {
return iResult;
}
-int AliHLTComponent::InitCDB(const char* cdbPath)
+int AliHLTComponent::InitCDB(const char* cdbPath, AliHLTComponentHandler* pHandler)
{
+ // see header file for function documentation
int iResult=0;
- // we presume the library already to be loaded
+ if (cdbPath && pHandler) {
+ // I have to think about separating the library handling from the
+ // component handler. Requiring the component hanlder here is not
+ // the cleanest solution.
+ // We presume the library already to be loaded
// find the symbol
- AliHLTComponentHandler cHandler;
- AliHLTMiscInitCDB_t pFunc=(AliHLTMiscInitCDB_t)cHandler.FindSymbol(ALIHLTMISC_LIBRARY, ALIHLTMISC_INIT_CDB);
+ AliHLTMiscInitCDB_t pFunc=(AliHLTMiscInitCDB_t)pHandler->FindSymbol(ALIHLTMISC_LIBRARY, ALIHLTMISC_INIT_CDB);
if (pFunc) {
- iResult=(*pFunc)(cdbPath);
- fCDBInitialized=iResult>=0;
+ TString path=cdbPath;
+ // very temporary fix, have to check for other formats
+ if (!path.BeginsWith("local://")) {
+ path="local://";
+ path+=cdbPath;
+ }
+ if ((iResult=(*pFunc)(path.Data()))>=0) {
+ if (!(fCDBSetRunNoFunc=pHandler->FindSymbol(ALIHLTMISC_LIBRARY, ALIHLTMISC_SET_CDB_RUNNO))) {
+ Message(NULL, kHLTLogWarning, "AliHLTComponent::InitCDB", "init CDB",
+ "can not find function to set CDB run no");
+ }
+ }
} else {
Message(NULL, kHLTLogError, "AliHLTComponent::InitCDB", "init CDB",
"can not find initialization function");
iResult=-ENOSYS;
}
+ } else {
+ iResult=-EINVAL;
+ }
return iResult;
}
int AliHLTComponent::SetCDBRunNo(int runNo)
{
- int iResult=0;
- if (!fCDBInitialized) return iResult;
- // we presume the library already to be loaded
- // find the symbol
- AliHLTComponentHandler cHandler;
- AliHLTMiscSetCDBRunNo_t pFunc=(AliHLTMiscSetCDBRunNo_t)cHandler.FindSymbol(ALIHLTMISC_LIBRARY, ALIHLTMISC_SET_CDB_RUNNO);
- if (pFunc) {
- iResult=(*pFunc)(runNo);
- } else {
- Message(NULL, kHLTLogError, "AliHLTComponent::SetCDBRunNo", "init CDB",
- "can not find initialization function");
- iResult=-ENOSYS;
- }
- return iResult;
+ // see header file for function documentation
+ if (!fCDBSetRunNoFunc) return 0;
+ return (*((AliHLTMiscSetCDBRunNo_t)fCDBSetRunNoFunc))(runNo);
}
int AliHLTComponent::DoInit( int /*argc*/, const char** /*argv*/)
{
// default implementation, childs can overload
+ HLTLogKeyword("dummy");
return 0;
}
int AliHLTComponent::DoDeinit()
{
// default implementation, childs can overload
+ HLTLogKeyword("dummy");
return 0;
}
int AliHLTComponent::Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/)
{
// default implementation, childs can overload
+ HLTLogKeyword("dummy");
+ return 0;
+}
+
+int AliHLTComponent::ReadPreprocessorValues(const char* /*modules*/)
+{
+ // default implementation, childs can overload
+ HLTLogKeyword("dummy");
return 0;
}
int AliHLTComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& /*tgtList*/)
{
+ // default implementation, childs can overload
HLTLogKeyword("dummy");
return 0;
}
return -ENOMEM;
for ( unsigned long i = 0; i < count; i++ ) {
(*outputBlocks)[i] = blocks[i];
- if (blocks[i].fDataType==kAliHLTAnyDataType) {
+ if (MatchExactly(blocks[i].fDataType, kAliHLTAnyDataType)) {
(*outputBlocks)[i].fDataType=GetOutputDataType();
/* data type was set to the output data type by the PubSub AliRoot
Wrapper component, if data type of the block was ********:****.
AliHLTComponentDataTypeList::iterator otype=otypes.begin();
while (otype!=otypes.end() && (*itype)!=(*otype)) otype++;
//if (otype!=otypes.end()) PrintDataTypeContent(*otype, "publisher \'%s\'");
- if (otype!=otypes.end() ||
- (*itype)==kAliHLTAnyDataType) {
+ if (otype!=otypes.end()) {
if (tgtList) tgtList->push_back(*itype);
iResult++;
}
return iResult;
}
-void AliHLTComponent::PrintDataTypeContent(AliHLTComponentDataType& dt, const char* format) const
+void AliHLTComponent::PrintDataTypeContent(AliHLTComponentDataType& dt, const char* format)
{
// see header file for function documentation
- const char* fmt="publisher \'%s\'";
+ const char* fmt="\'%s\'";
if (format) fmt=format;
- HLTMessage(fmt, (DataType2Text(dt)).c_str());
- HLTMessage("%x %x %x %x %x %x %x %x : %x %x %x %x",
- dt.fID[0],
- dt.fID[1],
- dt.fID[2],
- dt.fID[3],
- dt.fID[4],
- dt.fID[5],
- dt.fID[6],
- dt.fID[7],
- dt.fOrigin[0],
- dt.fOrigin[1],
- dt.fOrigin[2],
- dt.fOrigin[3]);
+ AliHLTLogging::Message(NULL, kHLTLogNone, NULL , NULL, Form(fmt, (DataType2Text(dt)).c_str()));
+ AliHLTLogging::Message(NULL, kHLTLogNone, NULL , NULL,
+ Form("%x %x %x %x %x %x %x %x : %x %x %x %x",
+ dt.fID[0],
+ dt.fID[1],
+ dt.fID[2],
+ dt.fID[3],
+ dt.fID[4],
+ dt.fID[5],
+ dt.fID[6],
+ dt.fID[7],
+ dt.fOrigin[0],
+ dt.fOrigin[1],
+ dt.fOrigin[2],
+ dt.fOrigin[3]));
}
void AliHLTComponent::FillBlockData( AliHLTComponentBlockData& blockData )
}
}
+void AliHLTComponent::SetDataType(AliHLTComponentDataType& dt, AliHLTUInt64_t id, AliHLTUInt32_t origin)
+{
+ // see header file for function documentation
+ dt.fStructSize=sizeof(AliHLTComponentDataType);
+ assert(kAliHLTComponentDataTypefIDsize==sizeof(id));
+ assert(kAliHLTComponentDataTypefOriginSize==sizeof(origin));
+ memcpy(&dt.fID, &id, kAliHLTComponentDataTypefIDsize);
+ memcpy(&dt.fOrigin, &origin, kAliHLTComponentDataTypefOriginSize);
+}
+
void AliHLTComponent::FillEventData(AliHLTComponentEventData& evtData)
{
// see header file for function documentation
AliHLTUInt32_t firstWord=*((AliHLTUInt32_t*)fpInputBlocks[idx].fPtr);
if (firstWord!=fpInputBlocks[idx].fSize-sizeof(AliHLTUInt32_t)) continue;
}
- if (dt == kAliHLTAnyDataType || fpInputBlocks[idx].fDataType == dt ||
- (memcmp(dt.fID, kAliHLTAnyDataTypeID, kAliHLTComponentDataTypefIDsize)==0 &&
- memcmp(dt.fOrigin, fpInputBlocks[idx].fDataType.fOrigin, kAliHLTComponentDataTypefOriginSize)==0) ||
- (memcmp(dt.fID, fpInputBlocks[idx].fDataType.fID, kAliHLTComponentDataTypefIDsize)==0) &&
- memcmp(dt.fOrigin, kAliHLTDataOriginAny, kAliHLTComponentDataTypefOriginSize)==0) {
+ if (dt==fpInputBlocks[idx].fDataType) {
iResult=idx;
}
}
}
//} else {
} else if (bForce!=0) {
- HLTError("size missmatch: block size %d, indicated %d", fpInputBlocks[idx].fSize, firstWord+sizeof(AliHLTUInt32_t));
+ HLTError("size mismatch: block size %d, indicated %d", fpInputBlocks[idx].fSize, firstWord+sizeof(AliHLTUInt32_t));
}
} else {
HLTFatal("block descriptor empty");
{
// see header file for function documentation
ALIHLTCOMPONENT_BASE_STOPWATCH();
- assert( 0 <= index and index < fCurrentEventData.fBlockCnt );
+ assert( 0 <= index and index < (int)fCurrentEventData.fBlockCnt );
return &fpInputBlocks[index];
}
AliHLTComponentEventDoneData*& edd )
{
// see header file for function documentation
+ HLTLogKeyword(GetComponentID());
ALIHLTCOMPONENT_BASE_STOPWATCH();
int iResult=0;
fCurrentEvent=evtData.fEventID;
fOutputBufferFilled=0;
fOutputBlocks.clear();
+ bool bSkipDataProcessing=false;
// find special events
if (fpInputBlocks) {
// first look for all special events and execute in the appropriate
// sequence afterwords
+ AliHLTUInt32_t eventType=gkAliEventTypeUnknown;
int indexComConfEvent=-1;
+ int indexUpdtDCSEvent=-1;
int indexSOREvent=-1;
int indexEOREvent=-1;
for (unsigned int i=0; i<evtData.fBlockCnt && iResult>=0; i++) {
// this event is most likely deprecated
} else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeComConf) {
indexComConfEvent=i;
+ } else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeUpdtDCS) {
+ indexUpdtDCSEvent=i;
+ } else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeEvent) {
+ eventType=fpInputBlocks[i].fSpecification;
+ bSkipDataProcessing|=(fpInputBlocks[i].fSpecification==gkAliEventTypeConfiguration);
+ bSkipDataProcessing|=(fpInputBlocks[i].fSpecification==gkAliEventTypeReadPreprocessor);
}
}
if (indexSOREvent>=0) {
AliHLTRunDesc rundesc;
if ((iResult=CopyStruct(&rundesc, sizeof(AliHLTRunDesc), indexEOREvent, "AliHLTRunDesc", "SOR"))>0) {
if (fpRunDesc->fRunNo!=rundesc.fRunNo) {
- HLTWarning("run no missmatch: SOR %d, EOR %d", fpRunDesc->fRunNo, rundesc.fRunNo);
+ HLTWarning("run no mismatch: SOR %d, EOR %d", fpRunDesc->fRunNo, rundesc.fRunNo);
} else {
HLTDebug("EOR run no %d", fpRunDesc->fRunNo);
}
HLTWarning("did not receive SOR, ignoring EOR");
}
}
- if (indexComConfEvent>=0) {
+ if (indexComConfEvent>=0 || eventType==gkAliEventTypeConfiguration) {
TString cdbEntry;
- if (fpInputBlocks[indexComConfEvent].fPtr!=NULL && fpInputBlocks[indexComConfEvent].fSize>0) {
+ if (indexComConfEvent>=0 && fpInputBlocks[indexComConfEvent].fPtr!=NULL && fpInputBlocks[indexComConfEvent].fSize>0) {
cdbEntry.Append(reinterpret_cast<const char*>(fpInputBlocks[indexComConfEvent].fPtr), fpInputBlocks[indexComConfEvent].fSize);
}
HLTDebug("received component configuration command: entry %s", cdbEntry.IsNull()?"none":cdbEntry.Data());
HLTWarning("reconfiguration of component %p (%s) failed with error code %d", this, GetComponentID(), tmpResult);
}
}
+ if (indexUpdtDCSEvent>=0 || eventType==gkAliEventTypeReadPreprocessor) {
+ TString modules;
+ if (fpInputBlocks[indexUpdtDCSEvent].fPtr!=NULL && fpInputBlocks[indexUpdtDCSEvent].fSize>0) {
+ modules.Append(reinterpret_cast<const char*>(fpInputBlocks[indexUpdtDCSEvent].fPtr), fpInputBlocks[indexUpdtDCSEvent].fSize);
+ }
+ HLTDebug("received preprocessor update command: detectors %s", modules.IsNull()?"ALL":modules.Data());
+ int tmpResult=ReadPreprocessorValues(modules[0]==0?"ALL":modules.Data());
+ if (tmpResult<0) {
+ HLTWarning("preprocessor update of component %p (%s) failed with error code %d", this, GetComponentID(), tmpResult);
+ }
+ }
}
AliHLTComponentBlockDataList blockData;
ALIHLTCOMPONENT_DA_STOPWATCH();
iResult=DoProcessing(evtData, blocks, trigData, outputPtr, size, blockData, edd);
} // end of the scope of the stopwatch guard
- if (iResult>=0) {
+ if (iResult>=0 && !bSkipDataProcessing) {
if (fOutputBlocks.size()>0) {
//HLTDebug("got %d block(s) via high level interface", fOutputBlocks.size());
HLTFatal("component %s (%p): can not convert output block descriptor list", GetComponentID(), this);
}
}
- if (iResult<0) {
+ if (iResult<0 || bSkipDataProcessing) {
outputBlockCnt=0;
outputBlocks=NULL;
}
CleanupInputObjects();
- if (iResult>=0) {
+ if (iResult>=0 && !bSkipDataProcessing) {
IncrementEventCounter();
}
return iResult;
if (fpInputBlocks[iBlockNo].fPtr && fpInputBlocks[iBlockNo].fSize) {
AliHLTUInt32_t copy=*((AliHLTUInt32_t*)fpInputBlocks[iBlockNo].fPtr);
if (fpInputBlocks[iBlockNo].fSize!=copy) {
- HLTWarning("%s event: missmatch of block size (%d) and structure size (%d)", eventname, fpInputBlocks[iBlockNo].fSize, copy);
+ HLTWarning("%s event: mismatch of block size (%d) and structure size (%d)", eventname, fpInputBlocks[iBlockNo].fSize, copy);
if (copy>fpInputBlocks[iBlockNo].fSize) copy=fpInputBlocks[iBlockNo].fSize;
}
if (copy!=iStructSize) {
- HLTWarning("%s event: missmatch in %s version (data type version %d)", eventname, structname, ALIHLT_DATA_TYPES_VERSION);
+ HLTWarning("%s event: mismatch in %s version (data type version %d)", eventname, structname, ALIHLT_DATA_TYPES_VERSION);
if (copy>iStructSize) {
copy=iStructSize;
} else {