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)
 
void advance (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
 
int64_t fileSizeLeft () 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 179 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 181 of file DAQSource.h.

191  : InputFile(status, lumi, name, deleteFile, rawFd, fileSize, rawHeaderSize, nChunks, nEvents, nullptr),
DAQSource * sourceParent_
Definition: DAQSource.h:200
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() [1/2]

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

Definition at line 1338 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().

1338  {
1339  //wait for chunk
1340 
1341  while (!waitForChunk(currentChunk_)) {
1343  usleep(100000);
1347  }
1348 
1349  dataPosition = chunks_[currentChunk_]->buf_ + chunkPosition_;
1350  size_t currentLeft = chunks_[currentChunk_]->size_ - chunkPosition_;
1351 
1352  if (currentLeft < size) {
1353  //we need next chunk
1354  assert(chunks_.size() > currentChunk_ + 1);
1355  while (!waitForChunk(currentChunk_ + 1)) {
1357  usleep(100000);
1361  }
1362  //copy everything to beginning of the first chunk
1363  dataPosition -= chunkPosition_;
1364  assert(dataPosition == chunks_[currentChunk_]->buf_);
1365  memmove(chunks_[currentChunk_]->buf_, chunks_[currentChunk_]->buf_ + chunkPosition_, currentLeft);
1366  memcpy(chunks_[currentChunk_]->buf_ + currentLeft, chunks_[currentChunk_ + 1]->buf_, size - currentLeft);
1367  //set pointers at the end of the old data position
1368  bufferPosition_ += size;
1369  chunkPosition_ = size - currentLeft;
1370  currentChunk_++;
1371  return true;
1372  } else {
1373  chunkPosition_ += size;
1374  bufferPosition_ += size;
1375  return false;
1376  }
1377 }
size
Write out results.
void threadError()
Definition: DAQSource.cc:1323
DAQSource * sourceParent_
Definition: DAQSource.h:200
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:1328
bool exceptionState()
Definition: DAQSource.h:78
uint32_t bufferPosition_

◆ advance() [2/2]

void RawInputFile::advance ( const size_t  size)
inline

Definition at line 194 of file DAQSource.h.

References InputFile::bufferPosition_, InputFile::chunkPosition_, and findQualityFiles::size.

194  {
195  chunkPosition_ += size;
197  }
size
Write out results.
uint32_t chunkPosition_
uint32_t bufferPosition_

Member Data Documentation

◆ sourceParent_

DAQSource* RawInputFile::sourceParent_
private

Definition at line 200 of file DAQSource.h.

Referenced by advance().