]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTProcessor.cxx
automatically added data sink components are now added directly to the internal insta...
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTProcessor.cxx
index 0221f56e25d7e7d5793e5b3e3c20009118546098..205c83ab4bbe99265f9fa96ebc23cfd34bb6e88c 100644 (file)
@@ -28,11 +28,15 @@ using namespace std;
 
 #include "AliHLTProcessor.h"
 #include <string.h>
+#include "TDatime.h"
+#include "TString.h"
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTProcessor)
 
 AliHLTProcessor::AliHLTProcessor()
+  : AliHLTComponent()
+  , fpDebugCounters(NULL)
 { 
   // see header file for class documentation
   // or
@@ -44,22 +48,8 @@ AliHLTProcessor::AliHLTProcessor()
 AliHLTProcessor::~AliHLTProcessor()
 { 
   // see header file for class documentation
-}
-
-int AliHLTProcessor::Init( AliHLTComponentEnvironment* environ, void* environParam, int argc, const char** argv )
-{
-  // see header file for class documentation
-  int iResult=0;
-  iResult=AliHLTComponent::Init(environ, environParam, argc, argv);
-  return iResult;
-}
-
-int AliHLTProcessor::Deinit()
-{
-  // see header file for class documentation
-  int iResult=0;
-  iResult=AliHLTComponent::Deinit();
-  return iResult;
+  if (fpDebugCounters) delete fpDebugCounters;
+  fpDebugCounters=NULL;
 }
 
 int AliHLTProcessor::DoProcessing( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
@@ -70,8 +60,73 @@ int AliHLTProcessor::DoProcessing( const AliHLTComponentEventData& evtData, cons
 {
   // see header file for class documentation
   int iResult=0;
+  ReleaseEventDoneData();
+
   iResult=DoEvent(evtData, blocks, trigData, outputPtr, size, outputBlocks);
+
   edd = NULL;
+  AliHLTComponentEventDoneData* eddTmp = GetCurrentEventDoneData();
+  if (eddTmp) {
+    int ret = GetEventDoneData(eddTmp->fDataSize, &edd);
+    if (ret) {
+      HLTError( "Cannot get event done data of %u bytes for event %lu: error (%d)", 
+               eddTmp->fDataSize, evtData.fEventID, ret );
+      return -ENOMEM;
+    }
+    edd->fStructSize = sizeof(AliHLTComponentEventDoneData);
+    edd->fDataSize = eddTmp->fDataSize;
+    edd->fData = reinterpret_cast<AliHLTUInt8_t*>(edd)+edd->fStructSize;
+    memcpy( edd->fData, eddTmp->fData, eddTmp->fDataSize );
+
+    // 2009-12-07 want to make this switchable, but this first needs some
+    // extension in the online framework to change the log level settings
+    // in the component while running
+    if (false/*CheckFilter(kHLTLogDebug)*/) {
+      if (!fpDebugCounters) {
+       fpDebugCounters=new AliHLTProcessorCounters;
+      }
+      if (fpDebugCounters) {
+       int wordCnt=edd->fDataSize/4;
+       AliHLTUInt32_t* buffer=reinterpret_cast<AliHLTUInt32_t*>(edd->fData);
+       int word=0;
+       while (word<wordCnt) {
+         switch (buffer[word]) {
+         case 3: 
+           fpDebugCounters->fReadoutFilter++; 
+           word+=1+buffer[word+1]*4;
+           break;
+         case 4:
+           fpDebugCounters->fMonitoringFilter++; 
+           word+=1+buffer[word+1]*4;
+           break;
+         case 5:
+           fpDebugCounters->fMonitoringEvent++; 
+           break;
+         default:
+           fpDebugCounters->fMismatch++;
+           break;
+         }
+         word++;
+       }
+
+       static UInt_t lastTime=0;
+       TDatime time;
+       if (time.Get()-lastTime>1) {
+         lastTime=time.Get();
+         HLTImportant("EventDoneData size %d: readout %d, monitoring filter %d, monitoring event %d, format error %d", 
+                      edd->fDataSize, fpDebugCounters->fReadoutFilter, fpDebugCounters->fMonitoringFilter, fpDebugCounters->fMonitoringEvent, fpDebugCounters->fMismatch);
+         for (int i=0; i< wordCnt; ) {
+           TString message;
+           for (int j=0; j<4 && i<wordCnt; j++) {
+             TString number; number.Form("0x%08x ", buffer[i++]);
+             message+=number;
+           }
+           HLTImportant("   %s", message.Data());
+         }
+       }
+      }
+    }
+  }
   return iResult;
 }
 
@@ -79,11 +134,12 @@ int AliHLTProcessor::DoEvent( const AliHLTComponentEventData& evtData,
                              const AliHLTComponentBlockData* /*blocks*/, 
                              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 DoEvent(evtData, trigData);
 }