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 1340 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().

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