X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HLT%2Frec%2FAliRawReaderHLT.cxx;h=5982f97fa773e0ef2b131cbbbd802285cb9155b0;hb=03ed6463b5267b974da6df1fbb3a4f32bd37984e;hp=4a6caa1cac5114b31ce7fecf390193f42b93c099;hpb=9d5f00add5d1143240093c4c2fa1db3cdfd5b26b;p=u%2Fmrichter%2FAliRoot.git diff --git a/HLT/rec/AliRawReaderHLT.cxx b/HLT/rec/AliRawReaderHLT.cxx index 4a6caa1cac5..5982f97fa77 100644 --- a/HLT/rec/AliRawReaderHLT.cxx +++ b/HLT/rec/AliRawReaderHLT.cxx @@ -16,17 +16,11 @@ * 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" @@ -34,6 +28,8 @@ #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" @@ -45,7 +41,6 @@ ClassImp(AliRawReaderHLT) AliRawReaderHLT::AliRawReaderHLT(AliRawReader* pRawreader, const char* options) : AliRawReader(), - AliHLTReconstructorBase(), fpParentReader(pRawreader), fOptions(), fSystemOptions(), @@ -58,7 +53,8 @@ AliRawReaderHLT::AliRawReaderHLT(AliRawReader* pRawreader, const char* options) fDetectors(), fpHLTOUT(NULL), fbReadFirst(true), - fpDataHandler(NULL) + fpDataHandler(NULL), + fpPluginBase(new AliHLTPluginBase) { // see header file for class documentation // or @@ -73,6 +69,8 @@ AliRawReaderHLT::~AliRawReaderHLT() { // see header file for class documentation ReleaseHLTData(); + if (fpPluginBase) delete fpPluginBase; + fpPluginBase=NULL; } UInt_t AliRawReaderHLT::GetType() const @@ -143,7 +141,6 @@ const UInt_t* AliRawReaderHLT::GetEquipmentAttributes() 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 @@ -154,8 +151,6 @@ Int_t AliRawReaderHLT::GetEquipmentElementSize() const 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 @@ -165,8 +160,11 @@ Int_t AliRawReaderHLT::GetEquipmentHeaderSize() const 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(); } @@ -178,7 +176,7 @@ Int_t AliRawReaderHLT::GetEquipmentType() const 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(); @@ -187,14 +185,23 @@ Int_t AliRawReaderHLT::GetEquipmentId() const 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(const_cast(fpData)); - fOffset=sizeof(AliRawDataHeader); + AliHLTCDHWrapper cdh((void*)fpData); + if(cdh.GetVersion()==2){ + fHeader=reinterpret_cast(const_cast(fpData)); + fHeaderV3=NULL; + } else { + fHeader=NULL; + fHeaderV3=reinterpret_cast(const_cast(fpData)); + } + fOffset=cdh.GetHeaderSize(); fPosition=fOffset; if ((result=IsSelected())) break; } @@ -209,9 +216,11 @@ Bool_t AliRawReaderHLT::ReadHeader() if (!(result=fpParentReader->ReadHeader())) { fHeader=NULL; + fHeaderV3=NULL; break; } fHeader=const_cast(fpParentReader->GetDataHeader()); + fHeaderV3=const_cast(fpParentReader->GetDataHeaderV3()); fDataSize=fpParentReader->GetDataSize(); fPosition=0; fpData=NULL; @@ -225,14 +234,13 @@ Bool_t AliRawReaderHLT::ReadHeader() 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. @@ -243,9 +251,10 @@ Bool_t AliRawReaderHLT::ReadNextData(UChar_t*& data, Bool_t readHeader) if (fbHaveHLTData && fpHLTOUT!=NULL) { // all internal data variables set result=kTRUE; - data=const_cast(fpData+sizeof(AliRawDataHeader)); + AliHLTCDHWrapper cdh((void*) fpData); + data=const_cast(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)); @@ -462,7 +471,11 @@ Bool_t AliRawReaderHLT::ReadNextHLTData() 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()); }