* provided "as is" without express or implied warranty. *
**************************************************************************/
-/** @file AliRawReaderHLT.cxx
- @author Matthias Richter
- @date
- @brief AliRawReader implementation which replaces original input of
- detectors with the appropriate HLT output. */
-
-// see header file for class documentation
-// or
-// refer to README to build package
-// or
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+/// @file AliRawReaderHLT.cxx
+/// @author Matthias Richter
+/// @date
+/// @brief AliRawReader implementation which replaces original input of
+/// detectors with the appropriate HLT output.
#include "AliRawReaderHLT.h"
#include "AliHLTOUTRawReader.h"
#include "AliHLTOUTHandler.h"
#include "AliHLTOUTHandlerEquId.h"
#include "AliHLTSystem.h"
+#include "AliHLTPluginBase.h"
+#include "AliHLTCDHWrapper.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
Int_t AliRawReaderHLT::GetEquipmentElementSize() const
{
- // see header file for class documentation
// don't know what it really means, bu the AliRawReaderFile
// just sets it to 0
// do the same if we have a valid equipment data set from
Int_t AliRawReaderHLT::GetEquipmentHeaderSize() const
{
- // see header file for class documentation
-
// equipment header means the additional data header?
// if we have a valid equipment data set from the HLT stream
// there is no additional header
Int_t AliRawReaderHLT::GetEquipmentSize() const
{
- // see header file for class documentation
- if (fEquipmentId>=0) return fDataSize+sizeof(AliRawDataHeader);
+ // return the equipment size, that's including the CDH
+ // fDataSize has been set to the full size of the block if it is from HLTOUT
+ // if the data block is from the parent rawreader it is only the pointer
+ // to the payload and the size of the CDH must be added
+ if (fEquipmentId>=0) return fDataSize + (fbHaveHLTData?0:GetEquipmentHeaderSize());
return fpParentReader->GetEquipmentSize();
}
Int_t AliRawReaderHLT::GetEquipmentId() const
{
- // see header file for class documentation
+ // id of current equipment
Int_t id=-1;
if (fEquipmentId>=0) id=fEquipmentId;
else id=fpParentReader->GetEquipmentId();
Bool_t AliRawReaderHLT::ReadHeader()
{
- // see header file for class documentation
+ // read the header of the next equipment
+ // depending on whether there is data redirected from HLT for the current event
+ // first the data in the HLTOUT is tried
Bool_t result=kFALSE;
Bool_t firstParentCycle=fbHaveHLTData;
while ((fbHaveHLTData=(fbHaveHLTData && ReadNextHLTData()))) {
// all internal data variables set
assert(fpData!=NULL);
- fHeader=reinterpret_cast<AliRawDataHeader*>(const_cast<AliHLTUInt8_t*>(fpData));
- fOffset=sizeof(AliRawDataHeader);
+ AliHLTCDHWrapper cdh((void*)fpData);
+ if(cdh.GetVersion()==2){
+ fHeader=reinterpret_cast<AliRawDataHeader*>(const_cast<AliHLTUInt8_t*>(fpData));
+ fHeaderV3=NULL;
+ } else {
+ fHeader=NULL;
+ fHeaderV3=reinterpret_cast<AliRawDataHeaderV3*>(const_cast<AliHLTUInt8_t*>(fpData));
+ }
+ fOffset=cdh.GetHeaderSize();
fPosition=fOffset;
if ((result=IsSelected())) break;
}
if (!(result=fpParentReader->ReadHeader())) {
fHeader=NULL;
+ fHeaderV3=NULL;
break;
}
fHeader=const_cast<AliRawDataHeader*>(fpParentReader->GetDataHeader());
+ fHeaderV3=const_cast<AliRawDataHeaderV3*>(fpParentReader->GetDataHeaderV3());
fDataSize=fpParentReader->GetDataSize();
fPosition=0;
fpData=NULL;
Bool_t AliRawReaderHLT::ReadNextData(UChar_t*& data)
{
- // see header file for class documentation
+ // read data from equipment, return pointer to data, GetDataSize
+ // provides the data size
return ReadNextData(data, kTRUE);
}
Bool_t AliRawReaderHLT::ReadNextData(UChar_t*& data, Bool_t readHeader)
{
- // see header file for class documentation
-
// this function is the backbone of the ReadNext functions, it gets the
// whole data block either from the HLT stream or the parent raw reader.
// Each call of ReadNextData directly jumps to the next data set.
if (fbHaveHLTData && fpHLTOUT!=NULL) {
// all internal data variables set
result=kTRUE;
- data=const_cast<AliHLTUInt8_t*>(fpData+sizeof(AliRawDataHeader));
+ AliHLTCDHWrapper cdh((void*) fpData);
+ data=const_cast<AliHLTUInt8_t*>(fpData+cdh.GetHeaderSize());
// fpData includes the CDH, set offset behind CDH
- fOffset=sizeof(AliRawDataHeader);
+ fOffset=cdh.GetHeaderSize();
} else {
// no data in the HLT stream, read real data
//AliInfo(Form("read from parent reader: min=%d max=%d", fSelectMinEquipmentId, fSelectMaxEquipmentId));
if (!fpHLTOUT) {
fpHLTOUT=new AliHLTOUTRawReader(fpParentReader);
if ((result=(fpHLTOUT!=NULL))) {
- AliHLTSystem* pSystem=GetInstance();
+ 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());
}