HLTrigger
special
plugins
HLTDynamicPrescaler.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
2
#include "
FWCore/Framework/interface/EDFilter.h
"
3
#include "
FWCore/Framework/interface/EventSetup.h
"
4
#include "
FWCore/Framework/interface/Event.h
"
5
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
6
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
7
8
class
HLTDynamicPrescaler
:
public
edm::EDFilter
{
9
public
:
10
explicit
HLTDynamicPrescaler
(
edm::ParameterSet
const
&
configuration
);
11
~HLTDynamicPrescaler
()
override
;
12
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
13
bool
filter
(
edm::Event
&
event
,
edm::EventSetup
const
&
setup
)
override
;
14
15
private
:
16
unsigned
int
m_count
;
// event counter
17
unsigned
int
m_scale
;
// accept one event every m_scale, which will change dynamically
18
};
19
20
HLTDynamicPrescaler::HLTDynamicPrescaler
(
edm::ParameterSet
const
&
configuration
) : m_count(0), m_scale(1) {}
21
22
HLTDynamicPrescaler::~HLTDynamicPrescaler
() =
default
;
23
24
void
HLTDynamicPrescaler::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
25
edm::ParameterSetDescription
desc;
26
desc.
add
<
bool
>(
"saveTags"
,
false
);
27
descriptions.
add
(
"hltDynamicPrescaler"
, desc);
28
}
29
30
bool
HLTDynamicPrescaler::filter
(
edm::Event
&
event
,
edm::EventSetup
const
&
setup
) {
31
++
m_count
;
32
33
if
(
m_count
%
m_scale
)
34
return
false
;
35
36
if
(
m_count
==
m_scale
* 10)
37
m_scale
=
m_count
;
38
39
return
true
;
40
}
41
42
#include "
FWCore/Framework/interface/MakerMacros.h
"
43
DEFINE_FWK_MODULE
(
HLTDynamicPrescaler
);
ConfigurationDescriptions.h
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition:
ParameterSetDescription.h:95
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
EDFilter.h
singleTopDQM_cfi.setup
setup
Definition:
singleTopDQM_cfi.py:37
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
HLTDynamicPrescaler::HLTDynamicPrescaler
HLTDynamicPrescaler(edm::ParameterSet const &configuration)
Definition:
HLTDynamicPrescaler.cc:20
HLTDynamicPrescaler::m_count
unsigned int m_count
Definition:
HLTDynamicPrescaler.cc:16
HLTDynamicPrescaler
Definition:
HLTDynamicPrescaler.cc:8
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
HLTDynamicPrescaler::m_scale
unsigned int m_scale
Definition:
HLTDynamicPrescaler.cc:17
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
ctppsRawToDigi_cff.configuration
configuration
Definition:
ctppsRawToDigi_cff.py:11
edm::EDFilter
Definition:
EDFilter.h:39
edm::EventSetup
Definition:
EventSetup.h:57
HLTDynamicPrescaler::filter
bool filter(edm::Event &event, edm::EventSetup const &setup) override
Definition:
HLTDynamicPrescaler.cc:30
HLTDynamicPrescaler::~HLTDynamicPrescaler
~HLTDynamicPrescaler() override
HLTDynamicPrescaler::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
HLTDynamicPrescaler.cc:24
Frameworkfwd.h
EventSetup.h
ParameterSet.h
event
Definition:
event.py:1
edm::Event
Definition:
Event.h:73
Generated for CMSSW Reference Manual by
1.8.16