Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
CommonTools
UtilAlgos
plugins
StopAfterNEvents.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/EDFilter.h
"
2
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
3
4
class
StopAfterNEvents
:
public
edm::EDFilter
{
5
public
:
6
StopAfterNEvents
(
const
edm::ParameterSet
& );
7
~StopAfterNEvents
();
8
private
:
9
bool
filter
(
edm::Event
&,
edm::EventSetup
const
& )
override
;
10
const
int
nMax_
;
11
int
n_
;
12
const
bool
verbose_
;
13
};
14
15
#include <iostream>
16
17
using namespace
std;
18
using namespace
edm;
19
20
StopAfterNEvents::StopAfterNEvents
(
const
ParameterSet
& pset ) :
21
nMax_( pset.getParameter<int>(
"maxEvents"
) ), n_( 0 ),
22
verbose_( pset.getUntrackedParameter<bool>(
"verbose"
,
false
) ) {
23
}
24
25
StopAfterNEvents::~StopAfterNEvents
() {
26
}
27
28
bool
StopAfterNEvents::filter
(
Event
&,
EventSetup
const
&) {
29
if
(
n_
< 0 )
return
true
;
30
n_
++ ;
31
bool
ret
=
n_
<=
nMax_
;
32
if
(
verbose_
)
33
cout
<<
">>> filtering event"
<<
n_
<<
"/"
<<
nMax_
34
<<
"("
<< ( ret ?
"true"
:
"false"
) <<
")"
<< endl;
35
return
ret
;
36
}
37
38
#include "
FWCore/Framework/interface/MakerMacros.h
"
39
40
DEFINE_FWK_MODULE
(
StopAfterNEvents
);
StopAfterNEvents::StopAfterNEvents
StopAfterNEvents(const edm::ParameterSet &)
Definition:
StopAfterNEvents.cc:20
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
run_regression.ret
int ret
Definition:
run_regression.py:388
StopAfterNEvents::n_
int n_
Definition:
StopAfterNEvents.cc:11
MakerMacros.h
StopAfterNEvents::nMax_
const int nMax_
Definition:
StopAfterNEvents.cc:10
ParameterSet.h
EDFilter.h
StopAfterNEvents::filter
bool filter(edm::Event &, edm::EventSetup const &) override
Definition:
StopAfterNEvents.cc:28
edm::EventSetup
Definition:
EventSetup.h:44
edm::EDFilter
Definition:
EDFilter.h:35
StopAfterNEvents::verbose_
const bool verbose_
Definition:
StopAfterNEvents.cc:12
StopAfterNEvents
Definition:
StopAfterNEvents.cc:4
StopAfterNEvents::~StopAfterNEvents
~StopAfterNEvents()
Definition:
StopAfterNEvents.cc:25
edm::ParameterSet
Definition:
ParameterSet.h:35
gather_cfg.cout
tuple cout
Definition:
gather_cfg.py:121
edm::false
volatile std::atomic< bool > shutdown_flag false
Definition:
UnixSignalHandlers.cc:22
edm::Event
Definition:
Event.h:62
Generated for CMSSW Reference Manual by
1.8.5