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

1328  {
1329  //wait for chunk
1330 
1331  while (!waitForChunk(currentChunk_)) {
1333  usleep(100000);
1337  }
1338 
1339  dataPosition = chunks_[currentChunk_]->buf_ + chunkPosition_;
1340  size_t currentLeft = chunks_[currentChunk_]->size_ - chunkPosition_;
1341 
1342  if (currentLeft < size) {
1343  //we need next chunk
1344  assert(chunks_.size() > currentChunk_ + 1);
1345  while (!waitForChunk(currentChunk_ + 1)) {
1347  usleep(100000);
1351  }
1352  //copy everything to beginning of the first chunk
1353  dataPosition -= chunkPosition_;
1354  assert(dataPosition == chunks_[currentChunk_]->buf_);
1355  memmove(chunks_[currentChunk_]->buf_, chunks_[currentChunk_]->buf_ + chunkPosition_, currentLeft);
1356  memcpy(chunks_[currentChunk_]->buf_ + currentLeft, chunks_[currentChunk_ + 1]->buf_, size - currentLeft);
1357  //set pointers at the end of the old data position
1358  bufferPosition_ += size;
1359  chunkPosition_ = size - currentLeft;
1360  currentChunk_++;
1361  return true;
1362  } else {
1363  chunkPosition_ += size;
1364  bufferPosition_ += size;
1365  return false;
1366  }
1367 }
size
Write out results.
void threadError()
Definition: DAQSource.cc:1313
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:1318
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().