CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::StreamerInputFile Class Reference

#include <StreamerInputFile.h>

Public Types

enum  Next { Next::kEvent, Next::kFile, Next::kStop }
 

Public Member Functions

void closeStreamerFile ()
 
EventMsgView const * currentRecord () const
 
bool newHeader ()
 
Next next ()
 
bool openNextFile ()
 
InitMsgView const * startMessage () const
 
 StreamerInputFile (std::string const &name, std::string const &LFN, std::shared_ptr< EventSkipperByID > eventSkipperByID=std::shared_ptr< EventSkipperByID >(), unsigned int prefetchMBytes=0)
 
 StreamerInputFile (std::string const &name, std::shared_ptr< EventSkipperByID > eventSkipperByID=std::shared_ptr< EventSkipperByID >(), unsigned int prefetchMBytes=0)
 
 StreamerInputFile (std::vector< FileCatalogItem > const &names, std::shared_ptr< EventSkipperByID > eventSkipperByID=std::shared_ptr< EventSkipperByID >(), unsigned int prefetchMBytes=0)
 
 ~StreamerInputFile ()
 

Private Member Functions

bool compareHeader ()
 
void logFileAction (char const *msg)
 
void openStreamerFile (std::string const &name, std::string const &LFN)
 
std::pair< storage::IOSize, char * > readBytes (char *buf, storage::IOSize nBytes, bool zeroCopy, unsigned int skippedHdr=0)
 
int readEventMessage ()
 
void readStartMessage ()
 
storage::IOOffset skipBytes (storage::IOSize nBytes)
 

Private Attributes

edm::propagate_const< std::shared_ptr< EventMsgView > > currentEvMsg_
 
unsigned int currentFile_
 
std::string currentFileName_
 
bool currentFileOpen_
 
uint32 currProto_
 
uint32 currRun_
 
bool endOfFile_
 
std::vector< char > eventBuf_
 
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
 
std::vector< char > headerBuf_
 
bool multiStreams_
 
bool newHeader_
 
edm::propagate_const< std::shared_ptr< InitMsgView > > startMsg_
 
edm::propagate_const< std::unique_ptr< edm::storage::Storage > > storage_
 
std::vector< FileCatalogItemstreamerNames_
 
std::vector< char > tempBuf_
 
unsigned int tempLen_ = 0
 
unsigned int tempPos_ = 0
 

Detailed Description

Definition at line 19 of file StreamerInputFile.h.

Member Enumeration Documentation

◆ Next

Enumerator
kEvent 
kFile 
kStop 

Definition at line 37 of file StreamerInputFile.h.

37 { kEvent, kFile, kStop };
constexpr char const *const kStop
Definition: channel_names.h:34

Constructor & Destructor Documentation

◆ StreamerInputFile() [1/3]

edm::StreamerInputFile::StreamerInputFile ( std::string const &  name,
std::string const &  LFN,
std::shared_ptr< EventSkipperByID eventSkipperByID = std::shared_ptr<EventSkipperByID>(),
unsigned int  prefetchMBytes = 0 
)
explicit

Reads a Streamer file

Definition at line 21 of file StreamerInputFile.cc.

References Skims_PA_cff::name, openStreamerFile(), and readStartMessage().

25  : startMsg_(),
26  currentEvMsg_(),
27  headerBuf_(1000 * 1000),
28  eventBuf_(1000 * 1000 * 7),
29  tempBuf_(1024 * 1024 * prefetchMBytes),
30  currentFile_(0),
32  multiStreams_(false),
34  currentFileOpen_(false),
35  eventSkipperByID_(eventSkipperByID),
36  currRun_(0),
37  currProto_(0),
38  newHeader_(false),
39  storage_(),
40  endOfFile_(false) {
41  openStreamerFile(name, LFN);
43  }
std::vector< char > eventBuf_
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
void openStreamerFile(std::string const &name, std::string const &LFN)
std::vector< char > headerBuf_
edm::propagate_const< std::shared_ptr< EventMsgView > > currentEvMsg_
std::vector< FileCatalogItem > streamerNames_
std::vector< char > tempBuf_
edm::propagate_const< std::shared_ptr< InitMsgView > > startMsg_
edm::propagate_const< std::unique_ptr< edm::storage::Storage > > storage_

◆ StreamerInputFile() [2/3]

edm::StreamerInputFile::StreamerInputFile ( std::string const &  name,
std::shared_ptr< EventSkipperByID eventSkipperByID = std::shared_ptr<EventSkipperByID>(),
unsigned int  prefetchMBytes = 0 
)
explicit

Definition at line 45 of file StreamerInputFile.cc.

48  : StreamerInputFile(name, name, eventSkipperByID, prefetchMBytes) {}
StreamerInputFile(std::string const &name, std::string const &LFN, std::shared_ptr< EventSkipperByID > eventSkipperByID=std::shared_ptr< EventSkipperByID >(), unsigned int prefetchMBytes=0)

◆ StreamerInputFile() [3/3]

edm::StreamerInputFile::StreamerInputFile ( std::vector< FileCatalogItem > const &  names,
std::shared_ptr< EventSkipperByID eventSkipperByID = std::shared_ptr<EventSkipperByID>(),
unsigned int  prefetchMBytes = 0 
)
explicit

Multiple Streamer files

Definition at line 50 of file StreamerInputFile.cc.

References currentFile_, currProto_, currRun_, names, openStreamerFile(), readStartMessage(), and startMsg_.

53  : startMsg_(),
54  currentEvMsg_(),
55  headerBuf_(1000 * 1000),
56  eventBuf_(1000 * 1000 * 7),
57  tempBuf_(1024 * 1024 * prefetchMBytes),
58  currentFile_(0),
60  multiStreams_(true),
62  currentFileOpen_(false),
63  eventSkipperByID_(eventSkipperByID),
64  currRun_(0),
65  currProto_(0),
66  newHeader_(false),
67  endOfFile_(false) {
68  openStreamerFile(names.at(0).fileName(0), names.at(0).logicalFileName());
69  ++currentFile_;
71  currRun_ = startMsg_->run();
72  currProto_ = startMsg_->protocolVersion();
73  }
std::vector< char > eventBuf_
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
const std::string names[nVars_]
void openStreamerFile(std::string const &name, std::string const &LFN)
std::vector< char > headerBuf_
edm::propagate_const< std::shared_ptr< EventMsgView > > currentEvMsg_
std::vector< FileCatalogItem > streamerNames_
std::vector< char > tempBuf_
edm::propagate_const< std::shared_ptr< InitMsgView > > startMsg_

◆ ~StreamerInputFile()

edm::StreamerInputFile::~StreamerInputFile ( )

Definition at line 19 of file StreamerInputFile.cc.

References closeStreamerFile().

Member Function Documentation

◆ closeStreamerFile()

void edm::StreamerInputFile::closeStreamerFile ( )

Test bit if a new header is encountered

Definition at line 112 of file StreamerInputFile.cc.

References currentFileOpen_, logFileAction(), and storage_.

Referenced by openStreamerFile(), and ~StreamerInputFile().

112  {
113  if (currentFileOpen_ && storage_) {
114  storage_->close();
115  logFileAction(" Closed file ");
116  }
117  currentFileOpen_ = false;
118  }
void logFileAction(char const *msg)
edm::propagate_const< std::unique_ptr< edm::storage::Storage > > storage_

◆ compareHeader()

bool edm::StreamerInputFile::compareHeader ( )
private

Compares current File header with the newly opened file header Returns false in case of mismatch

Definition at line 253 of file StreamerInputFile.cc.

References currentFile_, currProto_, currRun_, Exception, edm::errors::MismatchedInputFiles, readStartMessage(), startMsg_, and streamerNames_.

Referenced by openNextFile().

253  {
254  //Get the new header
256 
257  //Values from new Header should match up
258  if (currRun_ != startMsg_->run() || currProto_ != startMsg_->protocolVersion()) {
259  throw Exception(errors::MismatchedInputFiles, "StreamerInputFile::compareHeader")
260  << "File " << streamerNames_.at(currentFile_).fileNames()[0]
261  << "\nhas different run number or protocol version than previous\n";
262  return false;
263  }
264  return true;
265  }
std::vector< FileCatalogItem > streamerNames_
edm::propagate_const< std::shared_ptr< InitMsgView > > startMsg_

◆ currentRecord()

EventMsgView const* edm::StreamerInputFile::currentRecord ( ) const
inline

Points to File Start Header/Message

Definition at line 43 of file StreamerInputFile.h.

References currentEvMsg_, and edm::propagate_const< T >::get().

43 { return currentEvMsg_.get(); }
constexpr element_type const * get() const
edm::propagate_const< std::shared_ptr< EventMsgView > > currentEvMsg_

◆ logFileAction()

void edm::StreamerInputFile::logFileAction ( char const *  msg)
private

Definition at line 379 of file StreamerInputFile.cc.

References currentFileName_, edm::FlushMessageLog(), and mps_check::msg.

Referenced by closeStreamerFile(), and openStreamerFile().

379  {
380  LogAbsolute("fileAction") << std::setprecision(0) << TimeOfDay() << msg << currentFileName_;
381  FlushMessageLog();
382  }
void FlushMessageLog()
tuple msg
Definition: mps_check.py:286
Log< level::System, true > LogAbsolute

◆ newHeader()

bool edm::StreamerInputFile::newHeader ( )
inline

Points to current Record

Definition at line 46 of file StreamerInputFile.h.

References newHeader_, and createJobs::tmp.

46  {
47  bool tmp = newHeader_;
48  newHeader_ = false;
49  return tmp;
50  }
tmp
align.sh
Definition: createJobs.py:716

◆ next()

StreamerInputFile::Next edm::StreamerInputFile::next ( void  )

Definition at line 219 of file StreamerInputFile.cc.

References currentFile_, kEvent, kFile, kStop, multiStreams_, newHeader_, readEventMessage(), and streamerNames_.

219  {
220  if (this->readEventMessage()) {
221  return Next::kEvent;
222  }
223  if (multiStreams_) {
224  //Try opening next file
225  if (currentFile_ <= streamerNames_.size() - 1) {
226  newHeader_ = true;
227  return Next::kFile;
228  }
229  }
230  return Next::kStop;
231  }
std::vector< FileCatalogItem > streamerNames_

◆ openNextFile()

bool edm::StreamerInputFile::openNextFile ( )

Definition at line 233 of file StreamerInputFile.cc.

References compareHeader(), currentFile_, endOfFile_, FDEBUG, openStreamerFile(), startMsg_, and streamerNames_.

233  {
234  if (currentFile_ <= streamerNames_.size() - 1) {
235  FDEBUG(10) << "Opening file " << streamerNames_.at(currentFile_).fileNames()[0].c_str() << std::endl;
236 
237  openStreamerFile(streamerNames_.at(currentFile_).fileNames()[0],
238  streamerNames_.at(currentFile_).logicalFileName());
239 
240  // If start message was already there, then compare the
241  // previous and new headers
242  if (startMsg_) {
243  FDEBUG(10) << "Comparing Header" << std::endl;
244  compareHeader();
245  }
246  ++currentFile_;
247  endOfFile_ = false;
248  return true;
249  }
250  return false;
251  }
#define FDEBUG(lev)
Definition: DebugMacros.h:19
void openStreamerFile(std::string const &name, std::string const &LFN)
std::vector< FileCatalogItem > streamerNames_
edm::propagate_const< std::shared_ptr< InitMsgView > > startMsg_

◆ openStreamerFile()

void edm::StreamerInputFile::openStreamerFile ( std::string const &  name,
std::string const &  LFN 
)
private

Definition at line 75 of file StreamerInputFile.cc.

References cms::Exception::addContext(), edm::check(), cms::Exception::clearMessage(), closeStreamerFile(), currentFileName_, currentFileOpen_, MillePedeFileConverter_cfg::e, Exception, edm::errors::FileOpenError, get, logFileAction(), Skims_PA_cff::name, edm::storage::IOFlags::OpenRead, findQualityFiles::size, and storage_.

Referenced by openNextFile(), and StreamerInputFile().

75  {
77 
79 
80  // Check if the logical file name was found.
81  if (currentFileName_.empty()) {
82  // LFN not found in catalog.
83  throw cms::Exception("LogicalFileNameNotFound", "StreamerInputFile::openStreamerFile()\n")
84  << "Logical file name '" << LFN << "' was not found in the file catalog.\n"
85  << "If you wanted a local file, you forgot the 'file:' prefix\n"
86  << "before the file name in your configuration file.\n";
87  return;
88  }
89 
90  logFileAction(" Initiating request to open file ");
91 
92  using namespace edm::storage;
93  IOOffset size = -1;
94  if (StorageFactory::get()->check(name, &size)) {
95  try {
97  } catch (cms::Exception& e) {
99  ex.addContext("Calling StreamerInputFile::openStreamerFile()");
100  ex.clearMessage();
101  ex << "Error Opening Streamer Input File: " << name << "\n";
102  throw ex;
103  }
104  } else {
105  throw Exception(errors::FileOpenError, "StreamerInputFile::openStreamerFile")
106  << "Error Opening Streamer Input File, file does not exist: " << name << "\n";
107  }
108  currentFileOpen_ = true;
109  logFileAction(" Successfully opened file ");
110  }
size
Write out results.
int64_t IOOffset
Definition: IOTypes.h:20
void logFileAction(char const *msg)
static void check(T const &p, std::string const &id, SelectedProducts const &iProducts, bool iVerbose)
#define get
edm::propagate_const< std::unique_ptr< edm::storage::Storage > > storage_

◆ readBytes()

std::pair< storage::IOSize, char * > edm::StreamerInputFile::readBytes ( char *  buf,
storage::IOSize  nBytes,
bool  zeroCopy,
unsigned int  skippedHdr = 0 
)
private

Definition at line 120 of file StreamerInputFile.cc.

References cms::Exception::addContext(), visDQMUpload::buf, edm::errors::FileReadError, dqmiodumpmetadata::n, storage_, tempBuf_, tempLen_, and tempPos_.

Referenced by readEventMessage(), and readStartMessage().

123  {
124  storage::IOSize n = 0;
125  //returned pointer should point to the beginning of the header
126  //even if we read event payload that comes afterwards
127  char* ptr = buf - skippedHdr;
128  try {
129  if (!tempBuf_.empty()) {
130  if (tempPos_ == tempLen_) {
131  n = storage_->read(&tempBuf_[0], tempBuf_.size());
132  tempPos_ = 0;
133  tempLen_ = n;
134  if (n == 0)
135  return std::pair<storage::IOSize, char*>(0, ptr);
136  }
137  if (nBytes <= tempLen_ - tempPos_) {
138  //zero-copy can't done when header start address is in the previous buffer
139  if (!zeroCopy || skippedHdr > tempPos_) {
140  memcpy(buf, &tempBuf_[0] + tempPos_, nBytes);
141  tempPos_ += nBytes;
142  } else {
143  //pass pointer to the prebuffer address (zero copy) at the beginning of the header
144  ptr = &tempBuf_[0] + tempPos_ - skippedHdr;
145  tempPos_ += nBytes;
146  }
147  n = nBytes;
148  } else {
149  //crossing buffer boundary
150  auto len = tempLen_ - tempPos_;
151  memcpy(buf, &tempBuf_[0] + tempPos_, len);
152  tempPos_ += len;
153  char* tmpPtr = buf + len;
154  n = len + readBytes(tmpPtr, nBytes - len, false).first;
155  }
156  } else
157  n = storage_->read(buf, nBytes);
158  } catch (cms::Exception& ce) {
159  Exception ex(errors::FileReadError, "", ce);
160  ex.addContext("Calling StreamerInputFile::readBytes()");
161  throw ex;
162  }
163  return std::pair<storage::IOSize, char*>(n, ptr);
164  }
std::pair< storage::IOSize, char * > readBytes(char *buf, storage::IOSize nBytes, bool zeroCopy, unsigned int skippedHdr=0)
size_t IOSize
Definition: IOTypes.h:15
std::vector< char > tempBuf_
edm::propagate_const< std::unique_ptr< edm::storage::Storage > > storage_

◆ readEventMessage()

int edm::StreamerInputFile::readEventMessage ( )
private

Definition at line 267 of file StreamerInputFile.cc.

References HeaderView::code(), convert32(), convert64(), currentEvMsg_, endOfFile_, Header::EVENT, EventHeader::event_, eventBuf_, eventSkipperByID_, Exception, edm::errors::FileReadError, headerBuf_, mps_fire::i, Header::INIT, EventHeader::lumi_, Header::PADDING, readBytes(), EventHeader::run_, HeaderView::size(), and skipBytes().

Referenced by next().

267  {
268  if (endOfFile_)
269  return 0;
270 
271  using namespace edm::storage;
272  bool eventRead = false;
273  unsigned hdrSkipped = 0;
274  while (!eventRead) {
275  IOSize nWant = sizeof(EventHeader);
276  IOSize nGot = readBytes(&eventBuf_[hdrSkipped], nWant - hdrSkipped, false).first + hdrSkipped;
277  while (nGot == nWant) {
278  //allow padding before next event or end of file.
279  //event header starts with code 0 - 17, so 0xff (Header:PADDING) uniquely represents padding
280  bool headerFetched = false;
281  for (size_t i = 0; i < nGot; i++) {
282  if ((unsigned char)eventBuf_[i] != Header::PADDING) {
283  //no padding 0xff
284  if (i != 0) {
285  memmove(&eventBuf_[0], &eventBuf_[i], nGot - i);
286  //read remainder of the header
287  nGot = nGot - i + readBytes(&eventBuf_[nGot - i], i, false).first;
288  }
289  headerFetched = true;
290  break;
291  }
292  }
293  if (headerFetched)
294  break;
295  //read another block
296  nGot = readBytes(&eventBuf_[0], nWant, false).first;
297  }
298  if (nGot == 0) {
299  // no more data available
300  endOfFile_ = true;
301  return 0;
302  }
303  if (nGot != nWant) {
304  for (size_t i = 0; i < nGot; i++) {
305  if ((unsigned char)eventBuf_[i] != Header::PADDING)
306  throw edm::Exception(errors::FileReadError, "StreamerInputFile::readEventMessage")
307  << "Failed reading streamer file, first read in readEventMessage\n"
308  << "Requested " << nWant << " bytes, read function returned " << nGot
309  << " bytes, non-padding at offset " << i;
310  }
311  //padded 0xff only
312  endOfFile_ = true;
313  return 0;
314  }
315  uint32 eventSize;
316  {
317  HeaderView head(&eventBuf_[0]);
318  uint32 code = head.code();
319 
320  // If it is not an event then something is wrong.
321  eventSize = head.size();
322  if (code != Header::EVENT) {
323  if (code == Header::INIT) {
324  edm::LogWarning("StreamerInputFile") << "Found another INIT header in the file. It will be skipped";
325  if (eventSize < sizeof(EventHeader)) {
326  //very unlikely case that EventHeader is larger than total INIT size inserted in the middle of the file
327  hdrSkipped = nGot - eventSize;
328  memmove(&eventBuf_[0], &eventBuf_[eventSize], hdrSkipped);
329  continue;
330  }
331  if (headerBuf_.size() < eventSize)
332  headerBuf_.resize(eventSize);
333  memcpy(&headerBuf_[0], &eventBuf_[0], nGot);
334  readBytes(&headerBuf_[nGot], eventSize, true, nGot);
335  //do not parse this header and proceed to the next event
336  continue;
337  }
338  throw Exception(errors::FileReadError, "StreamerInputFile::readEventMessage")
339  << "Failed reading streamer file, unknown code in event header\n"
340  << "code = " << code << "\n";
341  }
342  }
343  if (eventSize <= sizeof(EventHeader)) {
344  throw edm::Exception(errors::FileReadError, "StreamerInputFile::readEventMessage")
345  << "Failed reading streamer file, event header size from data too small\n";
346  }
347  eventRead = true;
348  if (eventSkipperByID_) {
349  EventHeader* evh = (EventHeader*)(&eventBuf_[0]);
350  if (eventSkipperByID_->skipIt(convert32(evh->run_), convert32(evh->lumi_), convert64(evh->event_))) {
351  eventRead = false;
352  }
353  }
354  nWant = eventSize - sizeof(EventHeader);
355  if (eventRead) {
356  if (eventBuf_.size() < eventSize)
357  eventBuf_.resize(eventSize);
358 
359  auto res = readBytes(&eventBuf_[sizeof(EventHeader)], nWant, true, sizeof(EventHeader));
360  if (res.first != nWant) {
361  throw Exception(errors::FileReadError, "StreamerInputFile::readEventMessage")
362  << "Failed reading streamer file, second read in readEventMessage\n"
363  << "Requested " << nWant << " bytes, read function returned " << res.first << " bytes\n";
364  }
365  currentEvMsg_ =
366  std::make_shared<EventMsgView>((void*)res.second); // propagate_const<T> has no reset() function
367  } else {
368  nGot = skipBytes(nWant);
369  if (nGot != nWant) {
370  throw Exception(errors::FileReadError, "StreamerInputFile::readEventMessage")
371  << "Failed reading streamer file, skip event in readEventMessage\n"
372  << "Requested " << nWant << " bytes skipped, seek function returned " << nGot << " bytes\n";
373  }
374  }
375  }
376  return 1;
377  }
uint64 convert64(char_uint64 v)
Definition: MsgTools.h:20
std::vector< char > eventBuf_
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
char_uint32 lumi_
Definition: EventMessage.h:66
Definition: Electron.h:6
std::pair< storage::IOSize, char * > readBytes(char *buf, storage::IOSize nBytes, bool zeroCopy, unsigned int skippedHdr=0)
storage::IOOffset skipBytes(storage::IOSize nBytes)
unsigned int uint32
Definition: MsgTools.h:13
char_uint32 run_
Definition: EventMessage.h:64
size_t IOSize
Definition: IOTypes.h:15
char_uint64 event_
Definition: EventMessage.h:65
uint32 convert32(char_uint32 v)
Definition: MsgTools.h:28
std::vector< char > headerBuf_
edm::propagate_const< std::shared_ptr< EventMsgView > > currentEvMsg_
Log< level::Warning, false > LogWarning

◆ readStartMessage()

void edm::StreamerInputFile::readStartMessage ( )
private

Not an init message should return

Definition at line 180 of file StreamerInputFile.cc.

References HeaderView::code(), Exception, edm::errors::FileReadError, headerBuf_, Header::INIT, readBytes(), HeaderView::size(), and startMsg_.

Referenced by compareHeader(), and StreamerInputFile().

180  {
181  using namespace edm::storage;
182  IOSize nWant = sizeof(InitHeader);
183  IOSize nGot = readBytes(&headerBuf_[0], nWant, false).first;
184  if (nGot != nWant) {
185  throw Exception(errors::FileReadError, "StreamerInputFile::readStartMessage")
186  << "Failed reading streamer file, first read in readStartMessage\n";
187  }
188 
189  uint32 headerSize;
190  {
191  HeaderView head(&headerBuf_[0]);
192  uint32 code = head.code();
193  if (code != Header::INIT)
194  {
195  throw Exception(errors::FileReadError, "StreamerInputFile::readStartMessage")
196  << "Expecting an init Message at start of file\n";
197  return;
198  }
199  headerSize = head.size();
200  }
201 
202  if (headerBuf_.size() < headerSize)
203  headerBuf_.resize(headerSize);
204 
205  if (headerSize > sizeof(InitHeader)) {
206  nWant = headerSize - sizeof(InitHeader);
207  auto res = readBytes(&headerBuf_[sizeof(InitHeader)], nWant, true, sizeof(InitHeader));
208  if (res.first != nWant) {
209  throw Exception(errors::FileReadError, "StreamerInputFile::readStartMessage")
210  << "Failed reading streamer file, second read in readStartMessage\n";
211  }
212  startMsg_ = std::make_shared<InitMsgView>(res.second); // propagate_const<T> has no reset() function
213  } else {
214  throw Exception(errors::FileReadError, "StreamerInputFile::readStartMessage")
215  << "Failed reading streamer file, init header size from data too small\n";
216  }
217  }
Definition: Electron.h:6
std::pair< storage::IOSize, char * > readBytes(char *buf, storage::IOSize nBytes, bool zeroCopy, unsigned int skippedHdr=0)
unsigned int uint32
Definition: MsgTools.h:13
size_t IOSize
Definition: IOTypes.h:15
std::vector< char > headerBuf_
edm::propagate_const< std::shared_ptr< InitMsgView > > startMsg_

◆ skipBytes()

storage::IOOffset edm::StreamerInputFile::skipBytes ( storage::IOSize  nBytes)
private

Definition at line 166 of file StreamerInputFile.cc.

References cms::Exception::addContext(), edm::storage::Storage::CURRENT, edm::errors::FileReadError, dqmiodumpmetadata::n, and storage_.

Referenced by readEventMessage().

166  {
167  storage::IOOffset n = 0;
168  try {
169  // We wish to return the number of bytes skipped, not the final offset.
170  n = storage_->position(0, storage::Storage::CURRENT);
171  n = storage_->position(nBytes, storage::Storage::CURRENT) - n;
172  } catch (cms::Exception& ce) {
173  Exception ex(errors::FileReadError, "", ce);
174  ex.addContext("Calling StreamerInputFile::skipBytes()");
175  throw ex;
176  }
177  return n;
178  }
int64_t IOOffset
Definition: IOTypes.h:20
edm::propagate_const< std::unique_ptr< edm::storage::Storage > > storage_

◆ startMessage()

InitMsgView const* edm::StreamerInputFile::startMessage ( ) const
inline

Moves the handler to next Event Record

Definition at line 40 of file StreamerInputFile.h.

References edm::propagate_const< T >::get(), and startMsg_.

40 { return startMsg_.get(); }
constexpr element_type const * get() const
edm::propagate_const< std::shared_ptr< InitMsgView > > startMsg_

Member Data Documentation

◆ currentEvMsg_

edm::propagate_const<std::shared_ptr<EventMsgView> > edm::StreamerInputFile::currentEvMsg_
private

Definition at line 73 of file StreamerInputFile.h.

Referenced by currentRecord(), and readEventMessage().

◆ currentFile_

unsigned int edm::StreamerInputFile::currentFile_
private

Definition at line 82 of file StreamerInputFile.h.

Referenced by compareHeader(), next(), openNextFile(), and StreamerInputFile().

◆ currentFileName_

std::string edm::StreamerInputFile::currentFileName_
private

True if Multiple Streams are Read

Definition at line 85 of file StreamerInputFile.h.

Referenced by logFileAction(), and openStreamerFile().

◆ currentFileOpen_

bool edm::StreamerInputFile::currentFileOpen_
private

Definition at line 86 of file StreamerInputFile.h.

Referenced by closeStreamerFile(), and openStreamerFile().

◆ currProto_

uint32 edm::StreamerInputFile::currProto_
private

Definition at line 91 of file StreamerInputFile.h.

Referenced by compareHeader(), and StreamerInputFile().

◆ currRun_

uint32 edm::StreamerInputFile::currRun_
private

Definition at line 90 of file StreamerInputFile.h.

Referenced by compareHeader(), and StreamerInputFile().

◆ endOfFile_

bool edm::StreamerInputFile::endOfFile_
private

Definition at line 97 of file StreamerInputFile.h.

Referenced by openNextFile(), and readEventMessage().

◆ eventBuf_

std::vector<char> edm::StreamerInputFile::eventBuf_
private

Buffer to store file Header

Definition at line 76 of file StreamerInputFile.h.

Referenced by readEventMessage().

◆ eventSkipperByID_

edm::propagate_const<std::shared_ptr<EventSkipperByID> > edm::StreamerInputFile::eventSkipperByID_
private

Definition at line 88 of file StreamerInputFile.h.

Referenced by readEventMessage().

◆ headerBuf_

std::vector<char> edm::StreamerInputFile::headerBuf_
private

Definition at line 75 of file StreamerInputFile.h.

Referenced by readEventMessage(), and readStartMessage().

◆ multiStreams_

bool edm::StreamerInputFile::multiStreams_
private

names of Streamer files

Definition at line 84 of file StreamerInputFile.h.

Referenced by next().

◆ newHeader_

bool edm::StreamerInputFile::newHeader_
private

Definition at line 93 of file StreamerInputFile.h.

Referenced by newHeader(), and next().

◆ startMsg_

edm::propagate_const<std::shared_ptr<InitMsgView> > edm::StreamerInputFile::startMsg_
private

◆ storage_

edm::propagate_const<std::unique_ptr<edm::storage::Storage> > edm::StreamerInputFile::storage_
private

Definition at line 95 of file StreamerInputFile.h.

Referenced by closeStreamerFile(), openStreamerFile(), readBytes(), and skipBytes().

◆ streamerNames_

std::vector<FileCatalogItem> edm::StreamerInputFile::streamerNames_
private

keeps track of which file is in use at the moment

Definition at line 83 of file StreamerInputFile.h.

Referenced by compareHeader(), next(), and openNextFile().

◆ tempBuf_

std::vector<char> edm::StreamerInputFile::tempBuf_
private

Buffer to store Event Data

Definition at line 78 of file StreamerInputFile.h.

Referenced by readBytes().

◆ tempLen_

unsigned int edm::StreamerInputFile::tempLen_ = 0
private

Buffer to store prefetched bytes

Definition at line 79 of file StreamerInputFile.h.

Referenced by readBytes().

◆ tempPos_

unsigned int edm::StreamerInputFile::tempPos_ = 0
private

Definition at line 80 of file StreamerInputFile.h.

Referenced by readBytes().