PhysicsTools
SelectorUtils
plugins
EtaMultiRangeCut.cc
Go to the documentation of this file.
1
#include "
PhysicsTools/SelectorUtils/interface/CutApplicatorBase.h
"
2
3
class
EtaMultiRangeCut
:
public
CutApplicatorBase
{
4
public
:
5
EtaMultiRangeCut
(
const
edm::ParameterSet
&
c
) :
CutApplicatorBase
(
c
),
_absEta
(
c
.getParameter<
bool
>(
"useAbsEta"
)) {
6
const
std::vector<edm::ParameterSet>&
ranges
=
c
.getParameterSetVector(
"allowedEtaRanges"
);
7
for
(
const
auto
&
range
:
ranges
) {
8
const
double
min
=
range
.getParameter<
double
>(
"minEta"
);
9
const
double
max
=
range
.getParameter<
double
>(
"maxEta"
);
10
_ranges
.emplace_back(
min
,
max
);
11
}
12
}
13
14
double
value
(
const
reco::CandidatePtr
&
cand
)
const
final
{
return
(
_absEta
?
std::abs
(
cand
->eta()) :
cand
->eta()); }
15
16
result_type
asCandidate
(
const
argument_type
&)
const
final
;
17
18
private
:
19
const
bool
_absEta
;
20
std::vector<std::pair<double, double> >
_ranges
;
21
};
22
23
DEFINE_EDM_PLUGIN
(
CutApplicatorFactory
,
EtaMultiRangeCut
,
"EtaMultiRangeCut"
);
24
25
CutApplicatorBase::result_type
EtaMultiRangeCut::asCandidate
(
const
argument_type
&
cand
)
const
{
26
const
double
the_eta = (
_absEta
?
std::abs
(
cand
->eta()) :
cand
->eta());
27
bool
result
=
false
;
28
for
(
const
auto
&
range
:
_ranges
) {
29
if
(the_eta >=
range
.first && the_eta <
range
.second) {
30
result
=
true
;
31
break
;
32
}
33
}
34
return
result
;
35
}
EtaMultiRangeCut::value
double value(const reco::CandidatePtr &cand) const final
Definition:
EtaMultiRangeCut.cc:14
EtaMultiRangeCut
Definition:
EtaMultiRangeCut.cc:3
diffTwoXMLs.ranges
string ranges
Definition:
diffTwoXMLs.py:79
FastTimerService_cff.range
range
Definition:
FastTimerService_cff.py:34
electrons_cff.bool
bool
Definition:
electrons_cff.py:366
min
T min(T a, T b)
Definition:
MathUtil.h:58
EtaMultiRangeCut::EtaMultiRangeCut
EtaMultiRangeCut(const edm::ParameterSet &c)
Definition:
EtaMultiRangeCut.cc:5
candidate_functions::CandidateCut::result_type
bool result_type
Definition:
CandidateCut.h:11
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:124
EtaMultiRangeCut::asCandidate
result_type asCandidate(const argument_type &) const final
Definition:
EtaMultiRangeCut.cc:25
edm::ParameterSet
Definition:
ParameterSet.h:47
SiStripPI::max
Definition:
SiStripPayloadInspectorHelper.h:169
EtaMultiRangeCut::_absEta
const bool _absEta
Definition:
EtaMultiRangeCut.cc:19
edmplugin::PluginFactory
Definition:
PluginFactory.h:34
cand
Definition:
decayParser.h:32
edm::Ptr< Candidate >
CutApplicatorBase
Definition:
CutApplicatorBase.h:45
candidate_functions::CandidateCut::argument_type
reco::CandidatePtr argument_type
Definition:
CandidateCut.h:10
mps_fire.result
result
Definition:
mps_fire.py:311
EtaMultiRangeCut::_ranges
std::vector< std::pair< double, double > > _ranges
Definition:
EtaMultiRangeCut.cc:20
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
CutApplicatorBase.h
c
auto & c
Definition:
CAHitNtupletGeneratorKernelsImpl.h:46
Generated for CMSSW Reference Manual by
1.8.16