added input block forwarding to the High Level component interface
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 18 Jan 2008 12:45:35 +0000 (12:45 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 18 Jan 2008 12:45:35 +0000 (12:45 +0000)
HLT/BASE/AliHLTComponent.cxx
HLT/BASE/AliHLTComponent.h
HLT/BASE/util/AliHLTBlockFilterComponent.cxx

index ba0c77ad270a6d6b0e2820cbd61504596b69e7ab..0e999b9c73d9ec472b0baf77e42bef6c33407374 100644 (file)
@@ -685,6 +685,43 @@ AliHLTUInt32_t AliHLTComponent::GetSpecification(const TObject* pObject)
   return iSpec;
 }
 
+int AliHLTComponent::Forward(const TObject* pObject)
+{
+  // see header file for function documentation
+  int iResult=0;
+  int idx=fCurrentInputBlock;
+  if (pObject) {
+    if (fpInputObjects==NULL || (idx=fpInputObjects->IndexOf(pObject))>=0) {
+    } else {
+      HLTError("unknown object %p", pObject);
+      iResult=-ENOENT;
+    }
+  }
+  if (idx>=0) {
+    fOutputBlocks.push_back(fpInputBlocks[idx]);
+  }
+  return iResult;
+}
+
+int AliHLTComponent::Forward(const AliHLTComponentBlockData* pBlock)
+{
+  // see header file for function documentation
+  int iResult=0;
+  int idx=fCurrentInputBlock;
+  if (pBlock) {
+    if (fpInputObjects==NULL || (idx=FindInputBlock(pBlock))>=0) {
+    } else {
+      HLTError("unknown Block %p", pBlock);
+      iResult=-ENOENT;      
+    }
+  }
+  if (idx>=0) {
+    // check for fpInputBlocks pointer done in FindInputBlock
+    fOutputBlocks.push_back(fpInputBlocks[idx]);
+  }
+  return iResult;
+}
+
 const AliHLTComponentBlockData* AliHLTComponent::GetFirstInputBlock(const AliHLTComponentDataType& dt)
 {
   // see header file for function documentation
index 8946e4c3866ec66a6cf19f8f13ae4c64f08a4584..91e00268f96613cd6ade69d04ba57b81ce91c43b 100644 (file)
@@ -746,6 +746,29 @@ class AliHLTComponent : public AliHLTLogging {
    */
   AliHLTUInt32_t GetSpecification(const AliHLTComponentBlockData* pBlock=NULL);
 
+  /**
+   * Forward an input object to the output.
+   * Forward the input block of an object previously fetched via
+   * GetFirstInputObject/NextInputObject or the last one if no object
+   * specified.
+   * The block descriptor of the input block is forwarded to the
+   * output block list.
+   * @param pObject     pointer to TObject
+   * @return neg. error code if failed
+   */
+  int Forward(const TObject* pObject);
+
+  /**
+   * Forward an input block to the output.
+   * Forward the input block fetched via GetFirstInputObject/
+   * NextInputBlock or the last one if no block specified.
+   * The block descriptor of the input block is forwarded to the
+   * output block list.
+   * @param pBlock     pointer to input block
+   * @return neg. error code if failed
+   */
+  int Forward(const AliHLTComponentBlockData* pBlock=NULL);
+
   /**
    * Insert an object into the output.
    * If header is specified, it will be inserted before the root object,
index faf8afbd406c6c07fd2c3bd7bd7c77f00f879cbb..1366fab7a626777cf4db3469d5f9b08904f32f69 100644 (file)
@@ -164,16 +164,28 @@ int AliHLTBlockFilterComponent::DoEvent( const AliHLTComponentEventData& evtData
 {
   // see header file for class documentation
   int iResult=0;
-  for (int n=0; n<(int)evtData.fBlockCnt; n++ ) {
-    if (IsSelected(blocks[n])) {
-      HLTDebug("block %d type %s %#x (ptr=%p offset=%d size=%d) selected by filter rules", 
-              n, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fSpecification, 
-              blocks[n].fPtr, blocks[n].fOffset, blocks[n].fSize);
-      outputBlocks.push_back(blocks[n]);
+  for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock();
+       pBlock!=NULL; 
+       pBlock=GetNextInputBlock()) {
+    if (IsSelected(*pBlock)) {
+      HLTDebug("block type %s %#x (ptr=%p offset=%d size=%d) selected by filter rules", 
+              DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification, 
+              pBlock->fPtr, pBlock->fOffset, pBlock->fSize);
+      Forward();
     } else {
-      HLTDebug("block %d type %s %#x discarded by filter rules", n, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fSpecification);
+      HLTDebug("block type %s %#x discarded by filter rules", DataType2Text(pBlock->fDataType).c_str(), pBlock->fSpecification);
     }
   }
+//   for (int n=0; n<(int)evtData.fBlockCnt; n++ ) {
+//     if (IsSelected(blocks[n])) {
+//       HLTDebug("block %d type %s %#x (ptr=%p offset=%d size=%d) selected by filter rules", 
+//            n, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fSpecification, 
+//            blocks[n].fPtr, blocks[n].fOffset, blocks[n].fSize);
+//       outputBlocks.push_back(blocks[n]);
+//     } else {
+//       HLTDebug("block %d type %s %#x discarded by filter rules", n, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fSpecification);
+//     }
+//   }
   size=0;
   return iResult;
 }