]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
bugfix in high level interface: GetFirst/NextObject/Block
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 May 2007 13:48:19 +0000 (13:48 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 May 2007 13:48:19 +0000 (13:48 +0000)
HLT/BASE/AliHLTComponent.cxx
HLT/BASE/AliHLTComponent.h

index 06e62b512b182a33a15f13f73fd80d8b17723da6..3113f1fe872ec94966be1455552f47c367d2e477 100644 (file)
@@ -452,7 +452,7 @@ const TObject* AliHLTComponent::GetFirstInputObject(const AliHLTComponentDataTyp
   fSearchDataType=dt;
   if (classname) fClassName=classname;
   else fClassName.clear();
-  int idx=FindInputBlock(fSearchDataType, 0);
+  int idx=FindInputBlock(fSearchDataType, 0, 1);
   HLTDebug("found block %d when searching for data type %s", idx, DataType2Text(dt).c_str());
   TObject* pObj=NULL;
   if (idx>=0) {
@@ -480,7 +480,7 @@ const TObject* AliHLTComponent::GetNextInputObject(int bForce)
 {
   // see header file for function documentation
   ALIHLTCOMPONENT_BASE_STOPWATCH();
-  int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1);
+  int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1, 1);
   //HLTDebug("found block %d when searching for data type %s", idx, DataType2Text(fSearchDataType).c_str());
   TObject* pObj=NULL;
   if (idx>=0) {
@@ -491,13 +491,18 @@ const TObject* AliHLTComponent::GetNextInputObject(int bForce)
   return pObj;
 }
 
-int AliHLTComponent::FindInputBlock(const AliHLTComponentDataType& dt, int startIdx) const
+int AliHLTComponent::FindInputBlock(const AliHLTComponentDataType& dt, int startIdx, int bObject) const
 {
   // see header file for function documentation
   int iResult=-ENOENT;
   if (fpInputBlocks!=NULL) {
     int idx=startIdx<0?0:startIdx;
     for ( ; (UInt_t)idx<fCurrentEventData.fBlockCnt && iResult==-ENOENT; idx++) {
+      if (bObject!=0) {
+       if (fpInputBlocks[idx].fPtr==NULL) continue;
+       AliHLTUInt32_t firstWord=*((AliHLTUInt32_t*)fpInputBlocks[idx].fPtr);
+       if (firstWord!=fpInputBlocks[idx].fSize-sizeof(AliHLTUInt32_t)) continue;
+      }
       if (dt == kAliHLTAnyDataType || fpInputBlocks[idx].fDataType == dt) {
        iResult=idx;
       }
@@ -523,8 +528,8 @@ TObject* AliHLTComponent::CreateInputObject(int idx, int bForce)
            HLTDebug("object %p type %s created", pObj, objclass->GetName());
          } else {
          }
-       } else {
-         //    } else if (bForce!=0) {
+         //} else {
+               } else if (bForce!=0) {
          HLTError("size missmatch: block size %d, indicated %d", fpInputBlocks[idx].fSize, firstWord+sizeof(AliHLTUInt32_t));
        }
       } else {
@@ -630,6 +635,7 @@ const AliHLTComponentBlockData* AliHLTComponent::GetFirstInputBlock(const AliHLT
   if (idx>=0) {
     // check for fpInputBlocks pointer done in FindInputBlock
     pBlock=&fpInputBlocks[idx];
+    fCurrentInputBlock=idx;
   }
   return pBlock;
 }
@@ -653,6 +659,7 @@ const AliHLTComponentBlockData* AliHLTComponent::GetNextInputBlock()
   if (idx>=0) {
     // check for fpInputBlocks pointer done in FindInputBlock
     pBlock=&fpInputBlocks[idx];
+    fCurrentInputBlock=idx;
   }
   return pBlock;
 }
index c4a33945ae74b3a6665fd12df44d3f4391bc54ad..dbbdd31e77303851221ad3b27f797f650fcdf344 100644 (file)
@@ -754,13 +754,17 @@ class AliHLTComponent : public AliHLTLogging {
 
   /**
    * Find the first input block of specified data type beginning at index.
+   * Input blocks containing a TObject have the size of the object as an
+   * unsigned 32 bit number in the first 4 bytes. This has to match the block
+   * size minus 4.
    * @param dt          data type
    * @param startIdx    index to start the search
+   * @param bObject     check if this is an object
    * @return index of the block, -ENOENT if no block found
    *
    * @internal
    */
-  int FindInputBlock(const AliHLTComponentDataType& dt, int startIdx=-1) const;
+  int FindInputBlock(const AliHLTComponentDataType& dt, int startIdx=-1, int bObject=0) const;
 
   /**
    * Get index in the array of input bocks.