]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTDataSource.cxx
ALIROOT-5600 - skip non-participating detector modules
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDataSource.cxx
index bca288bfc4575e90dd3c0552147e2b850daa5fa6..229faba557b26c89dfff4d1ea6ee24e5cb2ac8e8 100644 (file)
@@ -1,29 +1,26 @@
 // $Id$
 
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project        * 
- * ALICE Experiment at CERN, All rights reserved.                         *
- *                                                                        *
- * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
- *                  for The ALICE HLT Project.                            *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
+//**************************************************************************
+//* This file is property of and copyright by the                          * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
 
-/** @file   AliHLTDataSource.cxx
-    @author Matthias Richter
-    @date   
-    @brief  Base class implementation for HLT data source components. */
-
-#if __GNUC__>= 3
-using namespace std;
-#endif
+/// @file   AliHLTDataSource.cxx
+/// @author Matthias Richter
+/// @date   
+/// @brief  Base class implementation for HLT data source components.
+///
 
 #include "AliHLTDataSource.h"
 
@@ -31,64 +28,59 @@ using namespace std;
 ClassImp(AliHLTDataSource)
 
 AliHLTDataSource::AliHLTDataSource()
-{ 
-  // see header file for class documentation
-  // or
-  // refer to README to build package
-  // or
-  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+{
+  // Base class of HLT data source components.
+  // The class provides a common interface for the implementation of HLT data
+  // source components.
+  // Source components do not consume any input consequently the processing
+  // function is called 'GetEvent'.
 }
 
-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
+  // destructor
 }
 
-void AliHLTDataSource::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
+void AliHLTDataSource::GetInputDataTypes( AliHLTComponentDataTypeList& list)
 {
-  // see header file for class documentation
+  // default method as source components do not consume input
   list.clear(); // there are no input data types
 }
 
 
 int AliHLTDataSource::DoProcessing( const AliHLTComponentEventData& evtData,
-                                   const AliHLTComponentBlockData* /*blocks*/
+                                   const AliHLTComponentBlockData* blocks
                                    AliHLTComponentTriggerData& trigData,
                                    AliHLTUInt8_t* outputPtr, 
                                    AliHLTUInt32_t& size,
-                                   vector<AliHLTComponentBlockData>& outputBlocks,
+                                   AliHLTComponentBlockDataList& outputBlocks,
                                    AliHLTComponentEventDoneData*& edd )
 {
-  // see header file for class documentation
+  // Processing method, calls child's GetEvent
   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=0; block<evtData.fBlockCnt; block++) {
+      if (blocks[block].fDataType==kAliHLTDataTypeSOR ||
+         blocks[block].fDataType==kAliHLTDataTypeEOR ||
+         blocks[block].fDataType==kAliHLTDataTypeEvent ||
+         blocks[block].fDataType==kAliHLTDataTypeRunType ||
+         blocks[block].fDataType==kAliHLTDataTypeComponentStatistics ||
+         blocks[block].fDataType==kAliHLTDataTypeComponentTable ||
+         blocks[block].fDataType==kAliHLTDataTypeECSParam) {
+       continue;
+      }
+      unknown=block;
+      break;
+    }
+    static int warningCount=0;
+    if (unknown>=0 && warningCount++<5) {
+      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,32 +88,18 @@ int AliHLTDataSource::DoProcessing( const AliHLTComponentEventData& evtData,
 int AliHLTDataSource::GetEvent( const AliHLTComponentEventData& evtData,
                                AliHLTComponentTriggerData& trigData,
                                AliHLTUInt8_t* /*outputPtr*/, 
-                               AliHLTUInt32_t& /*size*/,
-                               vector<AliHLTComponentBlockData>& /*outputBlocks*/ )
+                               AliHLTUInt32_t& size,
+                               AliHLTComponentBlockDataList& /*outputBlocks*/ )
 {
   // we just forward to the high level method, all other parameters already
   // have been stored internally
+  size=0;
   return GetEvent(evtData, trigData);
 }
 
 int AliHLTDataSource::GetEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
 {
+  // default method: one of GetEvent methods must be implemented
   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;
-}