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
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
4
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
5
6
namespace
edm
{
7
8
void
TimeoutPoolOutputModule::write
(
EventForOutput
const
&
e
) {
9
eventsWrittenInCurrentFile
++;
10
PoolOutputModule::write
(
e
);
11
}
12
13
TimeoutPoolOutputModule::TimeoutPoolOutputModule
(
ParameterSet
const
& ps)
14
:
edm
::one::
OutputModuleBase
::
OutputModuleBase
(ps),
15
PoolOutputModule
(ps),
16
m_lastEvent(
time
(nullptr)),
17
eventsWrittenInCurrentFile(0),
18
m_timeout(-1)
// we want the first event right away
19
{}
20
21
void
TimeoutPoolOutputModule::fillDescriptions
(
ConfigurationDescriptions
& descriptions) {
22
ParameterSetDescription
desc;
23
PoolOutputModule::fillDescription
(desc);
24
descriptions.
add
(
"TimeoutPoolOutputModule"
, desc);
25
}
26
27
bool
TimeoutPoolOutputModule::shouldWeCloseFile
()
const
{
28
time_t
now
(
time
(
nullptr
));
29
if
(
PoolOutputModule::shouldWeCloseFile
()) {
30
edm::LogVerbatim
(
"TimeoutPoolOutputModule"
)
31
<<
" Closing file "
<<
currentFileName
() <<
" with "
<<
eventsWrittenInCurrentFile
<<
" events."
;
32
eventsWrittenInCurrentFile
= 0;
33
m_lastEvent
=
now
;
34
return
true
;
35
}
36
// std::cout <<" Events "<< eventsWrittenInCurrentFile<<" time "<< now - m_lastEvent<<std::endl;
37
if
(
eventsWrittenInCurrentFile
== 0)
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."
;
52
eventsWrittenInCurrentFile
= 0;
53
return
true
;
54
}
55
}
// namespace edm
ConfigurationDescriptions.h
edm::TimeoutPoolOutputModule::TimeoutPoolOutputModule
TimeoutPoolOutputModule(ParameterSet const &ps)
Definition:
TimeoutPoolOutputModule.cc:13
TimeoutPoolOutputModule.h
MessageLogger.h
edm::TimeoutPoolOutputModule::m_timeout
int m_timeout
Definition:
TimeoutPoolOutputModule.h:39
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::PoolOutputModule::currentFileName
std::string const & currentFileName() const
Definition:
PoolOutputModule.cc:118
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
edm::TimeoutPoolOutputModule::write
void write(EventForOutput const &e) override
Definition:
TimeoutPoolOutputModule.cc:8
edm::PoolOutputModule
Definition:
PoolOutputModule.h:39
fileCollector.now
now
Definition:
fileCollector.py:207
edm::TimeoutPoolOutputModule::eventsWrittenInCurrentFile
unsigned int eventsWrittenInCurrentFile
Definition:
TimeoutPoolOutputModule.h:38
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
edm::TimeoutPoolOutputModule::shouldWeCloseFile
bool shouldWeCloseFile() const override
allow inheriting classes to override but still be able to call this method in the overridden version
Definition:
TimeoutPoolOutputModule.cc:27
OutputModuleBase
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::LogVerbatim
Definition:
MessageLogger.h:297
edm::TimeoutPoolOutputModule::fillDescriptions
static void fillDescriptions(ConfigurationDescriptions &descriptions)
Definition:
TimeoutPoolOutputModule.cc:21
edm::EventForOutput
Definition:
EventForOutput.h:50
edm::TimeoutPoolOutputModule::m_lastEvent
time_t m_lastEvent
Definition:
TimeoutPoolOutputModule.h:37
edm::PoolOutputModule::shouldWeCloseFile
bool shouldWeCloseFile() const override
allow inheriting classes to override but still be able to call this method in the overridden version
Definition:
PoolOutputModule.cc:330
ntuplemaker.time
time
Definition:
ntuplemaker.py:310
edm::PoolOutputModule::write
void write(EventForOutput const &e) override
Definition:
PoolOutputModule.cc:271
edm::PoolOutputModule::fillDescription
static void fillDescription(ParameterSetDescription &desc)
Definition:
PoolOutputModule.cc:428
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16