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  PoolOutputModule(ps),
13  m_lastEvent(time(NULL)),
14  eventsWrittenInCurrentFile(0),
15  m_timeout(-1) // we want the first event right away
16  { }
17 
19  time_t now(time(NULL));
21  edm::LogVerbatim("TimeoutPoolOutputModule") <<" Closing file "<< currentFileName()<< " with "<< eventsWrittenInCurrentFile <<" events.";
23  m_lastEvent = now;
24  return true;
25  }
26  // std::cout <<" Events "<< eventsWrittenInCurrentFile<<" time "<< now - m_lastEvent<<std::endl;
27  if (eventsWrittenInCurrentFile==0) return false;
28  if ( now - m_lastEvent < m_timeout ) return false;
29  // next files are needed in 15, 30 and 60 sec
30  m_lastEvent = now;
31  if (m_timeout == 30) m_timeout = 60;
32  if (m_timeout == 15) m_timeout = 30;
33  if (m_timeout == -1) m_timeout = 15;
34 
35  edm::LogVerbatim("TimeoutPoolOutputModule") <<" Closing file "<< currentFileName()<< " with "<< eventsWrittenInCurrentFile <<" events.";
37  return true;
38  }
39 }
40 
#define NULL
Definition: scimark2.h:8
virtual void write(EventPrincipal const &e)
virtual bool shouldWeCloseFile() const
allow inheriting classes to override but still be able to call this method in the overridden version ...
std::string const & currentFileName() const
virtual bool shouldWeCloseFile() const
allow inheriting classes to override but still be able to call this method in the overridden version ...
TimeoutPoolOutputModule(ParameterSet const &ps)
virtual void write(EventPrincipal const &e)