CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TimeoutPoolOutputModule.cc
Go to the documentation of this file.
3 
4 namespace edm {
5 
9  }
10 
12  edm::one::OutputModuleBase::OutputModuleBase(ps),
13  PoolOutputModule(ps),
14  m_lastEvent(time(NULL)),
15  eventsWrittenInCurrentFile(0),
16  m_timeout(-1) // we want the first event right away
17  { }
18 
20  time_t now(time(NULL));
22  edm::LogVerbatim("TimeoutPoolOutputModule") <<" Closing file "<< currentFileName()<< " with "<< eventsWrittenInCurrentFile <<" events.";
24  m_lastEvent = now;
25  return true;
26  }
27  // std::cout <<" Events "<< eventsWrittenInCurrentFile<<" time "<< now - m_lastEvent<<std::endl;
28  if (eventsWrittenInCurrentFile==0) return false;
29  if ( now - m_lastEvent < m_timeout ) return false;
30  // next files are needed in 15, 30 and 60 sec
31  m_lastEvent = now;
32  if (m_timeout == 30) m_timeout = 60;
33  if (m_timeout == 15) m_timeout = 30;
34  if (m_timeout == -1) m_timeout = 15;
35 
36  edm::LogVerbatim("TimeoutPoolOutputModule") <<" Closing file "<< currentFileName()<< " with "<< eventsWrittenInCurrentFile <<" events.";
38  return true;
39  }
40 }
41 
virtual void write(EventForOutput const &e) override
virtual bool shouldWeCloseFile() const override
allow inheriting classes to override but still be able to call this method in the overridden version ...
#define NULL
Definition: scimark2.h:8
std::string const & currentFileName() const
virtual void write(EventForOutput const &e) override
virtual bool shouldWeCloseFile() const override
allow inheriting classes to override but still be able to call this method in the overridden version ...
TimeoutPoolOutputModule(ParameterSet const &ps)