Main Page
Namespaces
Classes
Package Documentation
IOPool
Output
src
TimeoutPoolOutputModule.cc
Go to the documentation of this file.
1
#include "
IOPool/Output/interface/TimeoutPoolOutputModule.h
"
2
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
3
4
namespace
edm
{
5
6
void
TimeoutPoolOutputModule::write
(
EventForOutput
const
&
e
) {
7
eventsWrittenInCurrentFile
++;
8
PoolOutputModule::write
(e);
9
}
10
11
TimeoutPoolOutputModule::TimeoutPoolOutputModule
(
ParameterSet
const
& ps):
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
19
bool
TimeoutPoolOutputModule::shouldWeCloseFile
()
const
{
20
time_t
now
(
time
(
NULL
));
21
if
(
PoolOutputModule::shouldWeCloseFile
() ) {
22
edm::LogVerbatim
(
"TimeoutPoolOutputModule"
) <<
" Closing file "
<<
currentFileName
()<<
" with "
<<
eventsWrittenInCurrentFile
<<
" events."
;
23
eventsWrittenInCurrentFile
= 0;
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."
;
37
eventsWrittenInCurrentFile
= 0;
38
return
true
;
39
}
40
}
41
edm::PoolOutputModule::shouldWeCloseFile
virtual bool shouldWeCloseFile() const override
allow inheriting classes to override but still be able to call this method in the overridden version ...
Definition:
PoolOutputModule.cc:334
MessageLogger.h
edm::PoolOutputModule::write
virtual void write(EventForOutput const &e) override
Definition:
PoolOutputModule.cc:279
edm::TimeoutPoolOutputModule::shouldWeCloseFile
virtual bool shouldWeCloseFile() const override
allow inheriting classes to override but still be able to call this method in the overridden version ...
Definition:
TimeoutPoolOutputModule.cc:19
OutputModuleBase
one
NULL
#define NULL
Definition:
scimark2.h:8
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
edm::PoolOutputModule::currentFileName
std::string const & currentFileName() const
Definition:
PoolOutputModule.cc:114
TimeoutPoolOutputModule.h
edm::TimeoutPoolOutputModule::m_timeout
int m_timeout
Definition:
TimeoutPoolOutputModule.h:35
edm::PoolOutputModule
Definition:
PoolOutputModule.h:39
edm::LogVerbatim
Definition:
MessageLogger.h:242
ntuplemaker.time
time
Definition:
ntuplemaker.py:308
edm::TimeoutPoolOutputModule::write
virtual void write(EventForOutput const &e) override
Definition:
TimeoutPoolOutputModule.cc:6
edm::TimeoutPoolOutputModule::eventsWrittenInCurrentFile
unsigned int eventsWrittenInCurrentFile
Definition:
TimeoutPoolOutputModule.h:34
edm::EventForOutput
Definition:
EventForOutput.h:50
edm::TimeoutPoolOutputModule::TimeoutPoolOutputModule
TimeoutPoolOutputModule(ParameterSet const &ps)
Definition:
TimeoutPoolOutputModule.cc:11
edm
HLT enums.
Definition:
AlignableModifier.h:17
cmsPerfSuiteHarvest.now
now
Definition:
cmsPerfSuiteHarvest.py:590
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::TimeoutPoolOutputModule::m_lastEvent
time_t m_lastEvent
Definition:
TimeoutPoolOutputModule.h:33
Generated for CMSSW Reference Manual by
1.8.11