CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TimeoutPoolOutputModule.cc
Go to the documentation of this file.
5 
6 namespace edm {
7 
11  }
12 
15  PoolOutputModule(ps),
16  m_lastEvent(time(nullptr)),
17  eventsWrittenInCurrentFile(0),
18  m_timeout(-1) // we want the first event right away
19  {}
20 
24  descriptions.add("TimeoutPoolOutputModule", desc);
25  }
26 
28  time_t now(time(nullptr));
30  edm::LogVerbatim("TimeoutPoolOutputModule")
31  << " Closing file " << currentFileName() << " with " << eventsWrittenInCurrentFile << " events.";
33  m_lastEvent = now;
34  return true;
35  }
36  // std::cout <<" Events "<< eventsWrittenInCurrentFile<<" time "<< now - m_lastEvent<<std::endl;
38  return false;
39  if (now - m_lastEvent < m_timeout)
40  return false;
41  // next files are needed in 15, 30 and 60 sec
42  m_lastEvent = now;
43  if (m_timeout == 30)
44  m_timeout = 60;
45  if (m_timeout == 15)
46  m_timeout = 30;
47  if (m_timeout == -1)
48  m_timeout = 15;
49 
50  edm::LogVerbatim("TimeoutPoolOutputModule")
51  << " Closing file " << currentFileName() << " with " << eventsWrittenInCurrentFile << " events.";
53  return true;
54  }
55 } // namespace edm
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Log< level::Info, true > LogVerbatim
void write(EventForOutput const &e) override
bool shouldWeCloseFile() const override
allow inheriting classes to override but still be able to call this method in the overridden version ...
std::string const & currentFileName() const
void write(EventForOutput const &e) override
bool shouldWeCloseFile() const override
allow inheriting classes to override but still be able to call this method in the overridden version ...
void add(std::string const &label, ParameterSetDescription const &psetDescription)
TimeoutPoolOutputModule(ParameterSet const &ps)
static void fillDescription(ParameterSetDescription &desc)