Main Page
Namespaces
Classes
Package Documentation
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
funct::false
false
Definition:
Factorize.h:34
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
StopAfterNEvents::n_
int n_
Definition:
StopAfterNEvents.cc:11
MakerMacros.h
muonDTDigis_cfi.pset
pset
Definition:
muonDTDigis_cfi.py:27
std
Definition:
JetResolutionObject.h:76
StopAfterNEvents::nMax_
const int nMax_
Definition:
StopAfterNEvents.cc:10
ParameterSet.h
createfilelist.int
int
Definition:
createfilelist.py:10
EDFilter.h
StopAfterNEvents::filter
bool filter(edm::Event &, edm::EventSetup const &) override
Definition:
StopAfterNEvents.cc:28
edm::EventSetup
Definition:
EventSetup.h:45
edm::EDFilter
Definition:
EDFilter.h:38
StopAfterNEvents::verbose_
const bool verbose_
Definition:
StopAfterNEvents.cc:12
StopAfterNEvents
Definition:
StopAfterNEvents.cc:4
StopAfterNEvents::~StopAfterNEvents
~StopAfterNEvents()
Definition:
StopAfterNEvents.cc:25
edm
HLT enums.
Definition:
AlignableModifier.h:17
edm::ParameterSet
Definition:
ParameterSet.h:36
gather_cfg.cout
cout
Definition:
gather_cfg.py:145
edm::Event
Definition:
Event.h:66
Generated for CMSSW Reference Manual by
1.8.11