]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTDataSource.cxx
bugfix: correctly handle steering events in order to avoid warning 'Data source compo...
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDataSource.cxx
index bca288bfc4575e90dd3c0552147e2b850daa5fa6..3c2bc16d60ff6ab06b5618f952199ffefb7b7a15 100644 (file)
@@ -39,11 +39,6 @@ AliHLTDataSource::AliHLTDataSource()
   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
 }
 
-void* AliHLTDataSource::fgpSpecialEvent=NULL;
-int AliHLTDataSource::fgSpecialEventSize=0;
-AliHLTComponentDataType AliHLTDataSource::fgSpecialEventDataType=kAliHLTVoidDataType;
-AliHLTUInt32_t AliHLTDataSource::fgSpecialEventSpecification=kAliHLTVoidDataSpec;
-
 AliHLTDataSource::~AliHLTDataSource()
 { 
   // see header file for class documentation
@@ -57,7 +52,7 @@ void AliHLTDataSource::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
 
 
 int AliHLTDataSource::DoProcessing( const AliHLTComponentEventData& evtData,
-                                   const AliHLTComponentBlockData* /*blocks*/
+                                   const AliHLTComponentBlockData* blocks
                                    AliHLTComponentTriggerData& trigData,
                                    AliHLTUInt8_t* outputPtr, 
                                    AliHLTUInt32_t& size,
@@ -67,28 +62,23 @@ int AliHLTDataSource::DoProcessing( const AliHLTComponentEventData& evtData,
   // see header file for class documentation
   int iResult=0;
   if (evtData.fBlockCnt > 0) {
-    HLTWarning("Data source component skips input data blocks");
-  }
-  if (fgpSpecialEvent==NULL || fgSpecialEventSize==0) {
-    // normal event publishing
-    iResult=GetEvent(evtData, trigData, outputPtr, size, outputBlocks);
-    HLTDebug("component %s (%p) GetEvent finished (%d)", GetComponentID(), this, iResult);
-  } else {
-    // publish special event
-    if (size>=(unsigned)fgSpecialEventSize) {
-      memcpy(outputPtr, fgpSpecialEvent, fgSpecialEventSize);
-      AliHLTComponentBlockData bd;
-      FillBlockData(bd);
-      bd.fOffset=0;
-      bd.fSize=fgSpecialEventSize;
-      bd.fDataType=fgSpecialEventDataType;
-      bd.fSpecification=fgSpecialEventSpecification;
-      outputBlocks.push_back(bd);
-      size=bd.fSize;
-    } else {
-      iResult=-ENOSPC;
+    int unknown=-1;
+    for (unsigned int block; block<evtData.fBlockCnt; block++) {
+      if (blocks[block].fDataType==kAliHLTDataTypeSOR ||
+         blocks[block].fDataType==kAliHLTDataTypeEOR ||
+         blocks[block].fDataType==kAliHLTDataTypeEvent) {
+       continue;
+      }
+      unknown=block;
+      break;
+    }
+    if (unknown>=0) {
+      HLTWarning("Data source component skips input data blocks: first unknown block %s",
+                DataType2Text(blocks[unknown].fDataType).c_str());
     }
   }
+  iResult=GetEvent(evtData, trigData, outputPtr, size, outputBlocks);
+  HLTDebug("component %s (%p) GetEvent finished (%d)", GetComponentID(), this, iResult);
   edd = NULL;
   return iResult;
 }
@@ -96,11 +86,12 @@ int AliHLTDataSource::DoProcessing( const AliHLTComponentEventData& evtData,
 int AliHLTDataSource::GetEvent( const AliHLTComponentEventData& evtData,
                                AliHLTComponentTriggerData& trigData,
                                AliHLTUInt8_t* /*outputPtr*/, 
-                               AliHLTUInt32_t& /*size*/,
+                               AliHLTUInt32_t& size,
                                vector<AliHLTComponentBlockData>& /*outputBlocks*/ )
 {
   // we just forward to the high level method, all other parameters already
   // have been stored internally
+  size=0;
   return GetEvent(evtData, trigData);
 }
 
@@ -109,19 +100,3 @@ int AliHLTDataSource::GetEvent( const AliHLTComponentEventData& /*evtData*/, Ali
   HLTFatal("no processing method implemented");
   return -ENOSYS;
 }
-
-AliHLTDataSource::AliSpecialEventGuard::AliSpecialEventGuard(AliHLTRunDesc* pDesc, AliHLTComponentDataType dt, AliHLTUInt32_t spec)
-{
-  AliHLTDataSource::fgpSpecialEvent=pDesc; 
-  AliHLTDataSource::fgSpecialEventSize=sizeof(AliHLTRunDesc); 
-  AliHLTDataSource::fgSpecialEventDataType=dt; 
-  AliHLTDataSource::fgSpecialEventSpecification=spec;
-}
-
-AliHLTDataSource::AliSpecialEventGuard::~AliSpecialEventGuard()
-{
-  AliHLTDataSource::fgpSpecialEvent=NULL; 
-  AliHLTDataSource::fgSpecialEventSize=0; 
-  AliHLTDataSource::fgSpecialEventDataType=kAliHLTVoidDataType;
-  AliHLTDataSource::fgSpecialEventSpecification=kAliHLTVoidDataSpec;
-}