#include "AliHLTOUTHandler.h"
#include "AliHLTOUTHandlerEquId.h"
#include "AliHLTSystem.h"
+#include "AliHLTPluginBase.h"
#include "AliLog.h"
#include "AliDAQ.h" // RAW, for detector names and equipment ids
#include "TObjString.h"
AliRawReaderHLT::AliRawReaderHLT(AliRawReader* pRawreader, const char* options)
:
AliRawReader(),
- AliHLTReconstructorBase(),
fpParentReader(pRawreader),
fOptions(),
fSystemOptions(),
fDetectors(),
fpHLTOUT(NULL),
fbReadFirst(true),
- fpDataHandler(NULL)
+ fpDataHandler(NULL),
+ fpPluginBase(new AliHLTPluginBase)
{
// see header file for class documentation
// or
{
// see header file for class documentation
ReleaseHLTData();
+ if (fpPluginBase) delete fpPluginBase;
+ fpPluginBase=NULL;
}
UInt_t AliRawReaderHLT::GetType() const
// see header file for class documentation
Bool_t result=kFALSE;
Bool_t firstParentCycle=fbHaveHLTData;
- while (fbHaveHLTData=(fbHaveHLTData && ReadNextHLTData())) {
+ while ((fbHaveHLTData=(fbHaveHLTData && ReadNextHLTData()))) {
// all internal data variables set
assert(fpData!=NULL);
fHeader=reinterpret_cast<AliRawDataHeader*>(const_cast<AliHLTUInt8_t*>(fpData));
fOffset=sizeof(AliRawDataHeader);
fPosition=fOffset;
- if (result=IsSelected()) break;
+ if ((result=IsSelected())) break;
}
firstParentCycle&=!fbHaveHLTData; // true if it just changed from true to false
while (!result) {
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();
- if (result=!IsHLTInput(id)) break;
+ if ((result=!IsHLTInput(id))) break;
}
return result;
}
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
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;
fOffset+=iCopy;
return kTRUE;
}
- } while (ReadNextData(dummy));
+ } while (ReadNextData(dummy, kTRUE));
return kFALSE;
}
fOffset+=iCopy;
return kTRUE;
}
- } while (ReadNextData(dummy));
+ } while (ReadNextData(dummy, kTRUE));
return kFALSE;
}
fOffset+=iCopy;
return kTRUE;
}
- } while (ReadNextData(dummy));
+ } while (ReadNextData(dummy, kTRUE));
return kFALSE;
}
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;
}
fpParentReader->SkipInvalid(skip);
}
+/*
void AliRawReaderHLT::SelectEvents(Int_t type)
{
// see header file for class documentation
AliRawReader::SelectEvents(type);
fpParentReader->SelectEvents(type);
}
+*/
int AliRawReaderHLT::ScanOptions(const char* options)
{
if (fbReadFirst || !fpHLTOUT) {
if (!fpHLTOUT) {
fpHLTOUT=new AliHLTOUTRawReader(fpParentReader);
- if (result=(fpHLTOUT!=NULL)) {
- AliHLTSystem* pSystem=GetInstance();
+ if ((result=(fpHLTOUT!=NULL))) {
+ if (!fpPluginBase) {
+ AliFatal("internal data error: can not get AliHLTSystem instance from plugin");
+ return false;
+ }
+ AliHLTSystem* pSystem=fpPluginBase->GetInstance();
if (pSystem) {
pSystem->ScanOptions(fSystemOptions.Data());
}
- if (result=(fpHLTOUT->Init()>=0)) {
+ if ((result=(fpHLTOUT->Init())>=0)) {
}
}
}
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);
{
// see header file for class documentation
Bool_t bHaveHLTData=kFALSE;
- if (bHaveHLTData=(fDetectors.size()>0)) {
+ if ((bHaveHLTData=(fDetectors.size())>0)) {
vector<int>::iterator detector=fDetectors.begin();
for (; detector!=fDetectors.end(); detector++) {
int ddlOffset=AliDAQ::DdlIDOffset(*detector);