23 std::shared_ptr<EventSkipperByID> eventSkipperByID,
24 unsigned int prefetchMBytes)
27 headerBuf_(1000 * 1000),
28 eventBuf_(1000 * 1000 * 7),
29 tempBuf_(1024 * 1024 * prefetchMBytes),
34 currentFileOpen_(
false),
35 eventSkipperByID_(eventSkipperByID),
46 std::shared_ptr<EventSkipperByID> eventSkipperByID,
47 unsigned int prefetchMBytes)
51 std::shared_ptr<EventSkipperByID> eventSkipperByID,
52 unsigned int prefetchMBytes)
55 headerBuf_(1000 * 1000),
56 eventBuf_(1000 * 1000 * 7),
57 tempBuf_(1024 * 1024 * prefetchMBytes),
59 streamerNames_(
names),
62 currentFileOpen_(
false),
63 eventSkipperByID_(eventSkipperByID),
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";
99 ex.
addContext(
"Calling StreamerInputFile::openStreamerFile()");
101 ex <<
"Error Opening Streamer Input File: " <<
name <<
"\n";
106 <<
"Error Opening Streamer Input File, file does not exist: " <<
name <<
"\n";
123 unsigned int skippedHdr) {
127 char* ptr =
buf - skippedHdr;
135 return std::pair<storage::IOSize, char*>(0, ptr);
139 if (!zeroCopy || skippedHdr >
tempPos_) {
153 char* tmpPtr =
buf + len;
154 n = len +
readBytes(tmpPtr, nBytes - len,
false).first;
160 ex.
addContext(
"Calling StreamerInputFile::readBytes()");
163 return std::pair<storage::IOSize, char*>(
n, ptr);
174 ex.
addContext(
"Calling StreamerInputFile::skipBytes()");
186 <<
"Failed reading streamer file, first read in readStartMessage\n";
196 <<
"Expecting an init Message at start of file\n";
199 headerSize = head.
size();
208 if (
res.first != nWant) {
210 <<
"Failed reading streamer file, second read in readStartMessage\n";
215 <<
"Failed reading streamer file, init header size from data too small\n";
243 FDEBUG(10) <<
"Comparing Header" << std::endl;
261 <<
"\nhas different run number or protocol version than previous\n";
272 bool eventRead =
false;
273 unsigned hdrSkipped = 0;
277 while (nGot == nWant) {
280 bool headerFetched =
false;
281 for (
size_t i = 0;
i < nGot;
i++) {
289 headerFetched =
true;
304 for (
size_t i = 0;
i < nGot;
i++) {
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;
321 eventSize = head.
size();
324 edm::LogWarning(
"StreamerInputFile") <<
"Found another INIT header in the file. It will be skipped";
327 hdrSkipped = nGot - eventSize;
339 <<
"Failed reading streamer file, unknown code in event header\n" 340 <<
"code = " << code <<
"\n";
345 <<
"Failed reading streamer file, event header size from data too small\n";
360 if (
res.first != nWant) {
362 <<
"Failed reading streamer file, second read in readEventMessage\n" 363 <<
"Requested " << nWant <<
" bytes, read function returned " <<
res.first <<
" bytes\n";
366 std::make_shared<EventMsgView>((
void*)
res.second);
371 <<
"Failed reading streamer file, skip event in readEventMessage\n" 372 <<
"Requested " << nWant <<
" bytes skipped, seek function returned " << nGot <<
" bytes\n";
uint64 convert64(char_uint64 v)
uint32 convert32(char_uint32 v)
const std::string names[nVars_]
void addContext(std::string const &context)
static void check(T const &p, std::string const &id, SelectedProducts const &iProducts, bool iVerbose)
Log< level::System, true > LogAbsolute
Log< level::Warning, false > LogWarning