using namespace std;
#include "hldrfiofilevt.h"
#include "hldsubevt.h"
#include "hldunpack.h"
ClassImp(HldRFIOFilEvt)
Bool_t HldRFIOFilEvt::setFile(const Text_t *name)
{
if(file)
delete file;
file=new HRFIOFile(name,ios::in);
if(file->good())
return kTRUE;
else
{
delete file;
file=NULL;
return kFALSE;
}
}
Bool_t HldRFIOFilEvt::read(void)
{
if(file)
{
if (file->eof())
{
return kFALSE;
}
if (pData)
{
delete[] pData;
pData = 0;
}
if (file->read((Char_t *)(pHdr), getHdrSize()))
{
if (isSwapped()) swapHdr();
if (getSize() > getHdrSize())
{
#warning "Hardcoded maximum event size is 1000000"
if ((getDataLen() > 1000000) && (getDataLen() == 0)) return kFALSE;
pData = new UInt4[getDataLen()];
if (file->read((Char_t*)(pData), getDataSize()))
{
if(getPaddedSize() - getSize() > 0)
file->ignore(getPaddedSize() - getSize());
}
else
return kFALSE;
}
}
else
return kFALSE;
return kTRUE;
}
return kFALSE;
}
Bool_t HldRFIOFilEvt::readSubEvt(size_t i)
{
UInt4* p;
if (i)
p = subEvt[i-1].getPaddedEnd();
else
p = pData;
if (p < getPaddedEnd())
subEvt[i] = HldSubEvt(p);
else
return kFALSE;
return kTRUE;
}
Bool_t HldRFIOFilEvt::execute()
{
if (read())
{
for (size_t idx = 0; idx < lastSubEvtIdx; idx++) *subEvtTable[idx].p = 0;
for (size_t i = 0; i < maxSubEvts ; i++) {
if(!readSubEvt(i)) break;
Bool_t unpacked=kFALSE;
for (size_t idx = 0; idx < lastSubEvtIdx; idx++) {
if (subEvt[i].getId() == subEvtTable[idx].id) {
subEvt[i].swapData();
*subEvtTable[idx].p = subEvt + i;
unpacked=kTRUE;
}
}
if (isWritable && !unpacked) subEvt[i].swapData();
}
return kTRUE;
}
else
{
return kFALSE;
}
}
Bool_t HldRFIOFilEvt::swap()
{
if (read())
{
return kTRUE;
}
else
{
return kFALSE;
}
}
Last change: Sat May 22 13:17:57 2010
Last generated: 2010-05-22 13:17
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.