]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/rec/AliRawReaderHLT.cxx
Possibility to specify event selection criteria within the raw-data input URI. The...
[u/mrichter/AliRoot.git] / HLT / rec / AliRawReaderHLT.cxx
index bd11a1ebcfe0e0e7f0789f5f78c6c88b91e68bc2..95323077590d4f73ae40961de02e6ffb79897a8d 100644 (file)
@@ -212,6 +212,9 @@ Bool_t   AliRawReaderHLT::ReadHeader()
       break;
     }
     fHeader=const_cast<AliRawDataHeader*>(fpParentReader->GetDataHeader());
+    fDataSize=fpParentReader->GetDataSize();
+    fPosition=0;
+    fpData=NULL;
 
     // filter out all equipment ids which should be taken from the HLT stream
     int id=fpParentReader->GetEquipmentId();
@@ -221,6 +224,12 @@ Bool_t   AliRawReaderHLT::ReadHeader()
 }
 
 Bool_t   AliRawReaderHLT::ReadNextData(UChar_t*& data)
+{
+  // see header file for class documentation
+  return ReadNextData(data, kTRUE);
+}
+
+Bool_t   AliRawReaderHLT::ReadNextData(UChar_t*& data, Bool_t readHeader)
 {
   // see header file for class documentation
 
@@ -230,11 +239,13 @@ Bool_t   AliRawReaderHLT::ReadNextData(UChar_t*& data)
   Bool_t result=kTRUE;
 
   // read new header if data already read
-  if (fPosition<fDataSize || (result=ReadHeader())) {
+  if (fPosition<fDataSize || (result=(readHeader && ReadHeader()))) {
     if (fbHaveHLTData && fpHLTOUT!=NULL) {
       // all internal data variables set
       result=kTRUE;
       data=const_cast<AliHLTUInt8_t*>(fpData+sizeof(AliRawDataHeader));
+      // fpData includes the CDH, set offset behind CDH
+      fOffset=sizeof(AliRawDataHeader);
     } else {
       // no data in the HLT stream, read real data
       //AliInfo(Form("read from parent reader: min=%d max=%d", fSelectMinEquipmentId, fSelectMaxEquipmentId));
@@ -244,6 +255,8 @@ Bool_t   AliRawReaderHLT::ReadNextData(UChar_t*& data)
       if (result) {
        fpData=data;
        fDataSize=fpParentReader->GetDataSize();
+       // fpData is without CDH
+       fOffset=0;
       } else {
        fpData=NULL;
        fDataSize=0;
@@ -251,7 +264,6 @@ Bool_t   AliRawReaderHLT::ReadNextData(UChar_t*& data)
 
       fEquipmentId=-1;
     }
-    fOffset=sizeof(AliRawDataHeader);
     fPosition=fDataSize;
   }
   return result;
@@ -268,7 +280,7 @@ Bool_t   AliRawReaderHLT::ReadNextInt(UInt_t& data)
       fOffset+=iCopy;
       return kTRUE;
     }
-  } while (ReadNextData(dummy));
+  } while (ReadNextData(dummy, kTRUE));
   return kFALSE;
 }
 
@@ -283,7 +295,7 @@ Bool_t   AliRawReaderHLT::ReadNextShort(UShort_t& data)
       fOffset+=iCopy;
       return kTRUE;
     }
-  } while (ReadNextData(dummy));
+  } while (ReadNextData(dummy, kTRUE));
   return kFALSE;
 }
 
@@ -298,7 +310,7 @@ Bool_t   AliRawReaderHLT::ReadNextChar(UChar_t& data)
       fOffset+=iCopy;
       return kTRUE;
     }
-  } while (ReadNextData(dummy));
+  } while (ReadNextData(dummy, kTRUE));
   return kFALSE;
 }
 
@@ -315,7 +327,10 @@ Bool_t   AliRawReaderHLT::ReadNext(UChar_t* data, Int_t size)
       fOffset+=iCopy;
       return kTRUE;
     }
-  } while (ReadNextData(dummy));
+    // By convention, the ReadNextData function stays in the
+    // current block and does not switch to the next one
+    // automatically -> kFALSE
+  } while (ReadNextData(dummy, kFALSE));
   return kFALSE;
 }
 
@@ -392,6 +407,7 @@ void AliRawReaderHLT::SkipInvalid(Bool_t skip)
   fpParentReader->SkipInvalid(skip);
 }
 
+/*
 void AliRawReaderHLT::SelectEvents(Int_t type)
 {
   // see header file for class documentation
@@ -400,6 +416,7 @@ void AliRawReaderHLT::SelectEvents(Int_t type)
   AliRawReader::SelectEvents(type);
   fpParentReader->SelectEvents(type);
 }
+*/
 
 int AliRawReaderHLT::ScanOptions(const char* options)
 {
@@ -408,6 +425,7 @@ int AliRawReaderHLT::ScanOptions(const char* options)
   TString optString(options);
   TString argument;
   TString parameter;
+  TString detectors;
   TObjArray* pTokens=optString.Tokenize(" ");
   if (pTokens) {
     int iEntries=pTokens->GetEntries();
@@ -420,6 +438,8 @@ int AliRawReaderHLT::ScanOptions(const char* options)
       int detId=AliDAQ::DetectorID(argument.Data());
       if (detId>=0) {
        fDetectors.push_back(detId);
+       if (!detectors.IsNull()) detectors+=" ";
+       detectors+=argument;
       } else {
        if (!fSystemOptions.IsNull()) fSystemOptions+=" ";
        fSystemOptions+=argument;
@@ -428,6 +448,9 @@ int AliRawReaderHLT::ScanOptions(const char* options)
     delete pTokens;
   }
 
+  if (iResult>=0 && !detectors.IsNull()) {
+    AliInfo(Form("running reconstruction from HLT data: %s", detectors.Data()));
+  }
   return iResult;
 }
 
@@ -465,7 +488,7 @@ Bool_t   AliRawReaderHLT::ReadNextHLTData()
     AliHLTOUTHandler* pHandler=fpHLTOUT->GetHandler();
     if (pHandler) {
       if (dynamic_cast<AliHLTOUTHandlerEquId*>(pHandler)!=NULL) {
-       AliHLTOUT::AliHLTOUTLockGuard g(fpHLTOUT);
+       AliHLTOUT::AliHLTOUTSelectionGuard g(fpHLTOUT);
        fEquipmentId=pHandler->ProcessData(fpHLTOUT);
        fpData=NULL;
        fDataSize=pHandler->GetProcessedData(fpData);