DPGAnalysis
Skims
src
NMaxPerLumi.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: NMaxPerLumi
4
// Class: NMaxPerLumi
5
//
13
//
14
// Original Author: Jean-Roch Vlimant,40 3-A28,+41227671209,
15
// Created: Fri Apr 9 18:54:59 CEST 2010
16
// $Id: NMaxPerLumi.cc,v 1.3 2010/10/03 10:15:07 elmer Exp $
17
//
18
//
19
20
// system include files
21
#include <memory>
22
23
// user include files
24
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
25
#include "
FWCore/Framework/interface/EDFilter.h
"
26
27
#include "
FWCore/Framework/interface/Event.h
"
28
#include "
FWCore/Framework/interface/MakerMacros.h
"
29
30
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
31
32
//
33
// class declaration
34
//
35
36
class
NMaxPerLumi
:
public
edm::EDFilter
{
37
public
:
38
explicit
NMaxPerLumi
(
const
edm::ParameterSet
&);
39
~NMaxPerLumi
()
override
;
40
41
private
:
42
void
beginJob
()
override
;
43
bool
filter
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
44
void
endJob
()
override
;
45
46
// ----------member data ---------------------------
47
std::map<unsigned int, std::map<unsigned int, unsigned int> >
counters
;
48
unsigned
int
nMaxPerLumi_
;
49
};
50
51
//
52
// constants, enums and typedefs
53
//
54
55
//
56
// static data member definitions
57
//
58
59
//
60
// constructors and destructor
61
//
62
NMaxPerLumi::NMaxPerLumi
(
const
edm::ParameterSet
& iConfig) {
63
//now do what ever initialization is needed
64
65
nMaxPerLumi_
= iConfig.
getParameter
<
unsigned
int
>(
"nMaxPerLumi"
);
66
}
67
68
NMaxPerLumi::~NMaxPerLumi
() {
69
// do anything here that needs to be done at desctruction time
70
// (e.g. close files, deallocate resources etc.)
71
}
72
73
//
74
// member functions
75
//
76
77
// ------------ method called on each new Event ------------
78
bool
NMaxPerLumi::filter
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
79
const
edm::EventID
&
id
=
iEvent
.id();
80
81
if
(
counters
[
id
.
run
()][
id
.luminosityBlock()] >=
nMaxPerLumi_
)
82
return
false
;
83
else
{
84
counters
[
id
.run()][
id
.luminosityBlock()]++;
85
return
true
;
86
}
87
}
88
89
// ------------ method called once each job just before starting event loop ------------
90
void
NMaxPerLumi::beginJob
() {}
91
92
// ------------ method called once each job just after ending the event loop ------------
93
void
NMaxPerLumi::endJob
() {}
94
95
//define this as a plug-in
96
DEFINE_FWK_MODULE
(
NMaxPerLumi
);
NMaxPerLumi::filter
bool filter(edm::Event &, const edm::EventSetup &) override
Definition:
NMaxPerLumi.cc:78
EDFilter.h
NMaxPerLumi::~NMaxPerLumi
~NMaxPerLumi() override
Definition:
NMaxPerLumi.cc:68
NMaxPerLumi::nMaxPerLumi_
unsigned int nMaxPerLumi_
Definition:
NMaxPerLumi.cc:48
NMaxPerLumi::counters
std::map< unsigned int, std::map< unsigned int, unsigned int > > counters
Definition:
NMaxPerLumi.cc:47
NMaxPerLumi::endJob
void endJob() override
Definition:
NMaxPerLumi.cc:93
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
NMaxPerLumi
Definition:
NMaxPerLumi.cc:36
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
NMaxPerLumi::beginJob
void beginJob() override
Definition:
NMaxPerLumi.cc:90
edm::EDFilter
Definition:
EDFilter.h:38
edm::EventSetup
Definition:
EventSetup.h:58
writedatasetfile.run
run
Definition:
writedatasetfile.py:27
Frameworkfwd.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
NMaxPerLumi::NMaxPerLumi
NMaxPerLumi(const edm::ParameterSet &)
Definition:
NMaxPerLumi.cc:62
ParameterSet.h
edm::EventID
Definition:
EventID.h:31
edm::Event
Definition:
Event.h:73
Generated for CMSSW Reference Manual by
1.8.16