CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
RawInputFile Class Reference

#include <DAQSource.h>

Inheritance diagram for RawInputFile:
InputFile

Public Member Functions

bool advance (unsigned char *&dataPosition, const size_t size)
 
 RawInputFile (evf::EvFDaqDirector::FileStatus status, unsigned int lumi=0, std::string const &name=std::string(), bool deleteFile=true, int rawFd=-1, uint64_t fileSize=0, uint16_t rawHeaderSize=0, uint32_t nChunks=0, int nEvents=0, DAQSource *parent=nullptr)
 
- Public Member Functions inherited from InputFile
bool advance (unsigned char *&dataPosition, const size_t size)
 
void appendFile (std::string const &name, uint64_t size)
 
uint64_t currentChunkSize () const
 
 InputFile (evf::EvFDaqDirector::FileStatus status, unsigned int lumi=0, std::string const &name=std::string(), bool deleteFile=true, int rawFd=-1, uint64_t fileSize=0, uint16_t rawHeaderSize=0, uint16_t nChunks=0, int nEvents=0, FedRawDataInputSource *parent=nullptr)
 
void moveToPreviousChunk (const size_t size, const size_t offset)
 
void randomizeOrder (std::default_random_engine &rng)
 
void rewindChunk (const size_t size)
 
void setChunks (uint16_t nChunks)
 
void unsetDeleteFile ()
 
bool waitForChunk (unsigned int chunkid)
 
virtual ~InputFile ()
 

Private Attributes

DAQSourcesourceParent_
 

Additional Inherited Members

- Public Attributes inherited from InputFile
std::vector< uint64_t > bufferOffsets_
 
uint32_t bufferPosition_ = 0
 
uint32_t chunkPosition_ = 0
 
tbb::concurrent_vector< InputChunk * > chunks_
 
unsigned int currentChunk_ = 0
 
bool deleteFile_
 
std::vector< uint64_t > diskFileSizes_
 
std::string fileName_
 
std::vector< std::string > fileNames_
 
std::vector< unsigned int > fileOrder_
 
uint64_t fileSize_
 
std::vector< uint64_t > fileSizes_
 
unsigned int lumi_
 
uint16_t nChunks_
 
int nEvents_
 
unsigned int nProcessed_
 
uint16_t numFiles_
 
FedRawDataInputSourceparent_
 
int rawFd_
 
uint16_t rawHeaderSize_
 
evf::EvFDaqDirector::FileStatus status_
 

Detailed Description

Definition at line 180 of file DAQSource.h.

Constructor & Destructor Documentation

◆ RawInputFile()

RawInputFile::RawInputFile ( evf::EvFDaqDirector::FileStatus  status,
unsigned int  lumi = 0,
std::string const &  name = std::string(),
bool  deleteFile = true,
int  rawFd = -1,
uint64_t  fileSize = 0,
uint16_t  rawHeaderSize = 0,
uint32_t  nChunks = 0,
int  nEvents = 0,
DAQSource parent = nullptr 
)
inline

Definition at line 182 of file DAQSource.h.

192  : InputFile(status, lumi, name, deleteFile, rawFd, fileSize, rawHeaderSize, nChunks, nEvents, nullptr),
DAQSource * sourceParent_
Definition: DAQSource.h:197
InputFile(evf::EvFDaqDirector::FileStatus status, unsigned int lumi=0, std::string const &name=std::string(), bool deleteFile=true, int rawFd=-1, uint64_t fileSize=0, uint16_t rawHeaderSize=0, uint16_t nChunks=0, int nEvents=0, FedRawDataInputSource *parent=nullptr)

Member Function Documentation

◆ advance()

bool RawInputFile::advance ( unsigned char *&  dataPosition,
const size_t  size 
)

Definition at line 1321 of file DAQSource.cc.

References cms::cuda::assert(), InputFile::bufferPosition_, InputFile::chunkPosition_, InputFile::chunks_, InputFile::currentChunk_, DAQSource::exceptionState(), evf::FastMonState::inChunkReceived, evf::FastMonState::inWaitChunk, DAQSource::setMonState(), findQualityFiles::size, sourceParent_, DAQSource::threadError(), and InputFile::waitForChunk().

1321  {
1322  //wait for chunk
1323 
1324  while (!waitForChunk(currentChunk_)) {
1326  usleep(100000);
1330  }
1331 
1332  dataPosition = chunks_[currentChunk_]->buf_ + chunkPosition_;
1333  size_t currentLeft = chunks_[currentChunk_]->size_ - chunkPosition_;
1334 
1335  if (currentLeft < size) {
1336  //we need next chunk
1337  while (!waitForChunk(currentChunk_ + 1)) {
1339  usleep(100000);
1343  }
1344  //copy everything to beginning of the first chunk
1345  dataPosition -= chunkPosition_;
1346  assert(dataPosition == chunks_[currentChunk_]->buf_);
1347  memmove(chunks_[currentChunk_]->buf_, chunks_[currentChunk_]->buf_ + chunkPosition_, currentLeft);
1348  memcpy(chunks_[currentChunk_]->buf_ + currentLeft, chunks_[currentChunk_ + 1]->buf_, size - currentLeft);
1349  //set pointers at the end of the old data position
1350  bufferPosition_ += size;
1351  chunkPosition_ = size - currentLeft;
1352  currentChunk_++;
1353  return true;
1354  } else {
1355  chunkPosition_ += size;
1356  bufferPosition_ += size;
1357  return false;
1358  }
1359 }
size
Write out results.
void threadError()
Definition: DAQSource.cc:1306
DAQSource * sourceParent_
Definition: DAQSource.h:197
assert(be >=bs)
bool waitForChunk(unsigned int chunkid)
tbb::concurrent_vector< InputChunk * > chunks_
uint32_t chunkPosition_
unsigned int currentChunk_
void setMonState(evf::FastMonState::InputState state)
Definition: DAQSource.cc:1311
bool exceptionState()
Definition: DAQSource.h:78
uint32_t bufferPosition_

Member Data Documentation

◆ sourceParent_

DAQSource* RawInputFile::sourceParent_
private

Definition at line 197 of file DAQSource.h.

Referenced by advance().