RecoEgamma
ElectronIdentification
plugins
cuts
GsfEleConversionVetoCut.cc
Go to the documentation of this file.
1
#include "
PhysicsTools/SelectorUtils/interface/CutApplicatorWithEventContentBase.h
"
2
#include "
DataFormats/EgammaCandidates/interface/GsfElectron.h
"
3
#include "
DataFormats/EgammaCandidates/interface/ConversionFwd.h
"
4
#include "
DataFormats/EgammaCandidates/interface/Conversion.h
"
5
#include "
RecoEgamma/EgammaTools/interface/ConversionTools.h
"
6
7
class
GsfEleConversionVetoCut
:
public
CutApplicatorWithEventContentBase
{
8
public
:
9
GsfEleConversionVetoCut
(
const
edm::ParameterSet
&
c
);
10
11
result_type
operator()
(
const
reco::GsfElectronPtr
&)
const
final
;
12
13
void
setConsumes
(
edm::ConsumesCollector
&)
final
;
14
void
getEventContent
(
const
edm::EventBase
&)
final
;
15
16
double
value
(
const
reco::CandidatePtr
&
cand
)
const
final
;
17
18
CandidateType
candidateType
()
const
final {
return
ELECTRON
; }
19
20
private
:
21
edm::Handle<reco::ConversionCollection>
_convs
;
22
edm::Handle<reco::BeamSpot>
_thebs
;
23
};
24
25
DEFINE_EDM_PLUGIN
(
CutApplicatorFactory
,
GsfEleConversionVetoCut
,
"GsfEleConversionVetoCut"
);
26
27
GsfEleConversionVetoCut::GsfEleConversionVetoCut
(
const
edm::ParameterSet
&
c
) :
CutApplicatorWithEventContentBase
(
c
) {
28
edm::InputTag
conversiontag =
c
.getParameter<
edm::InputTag
>(
"conversionSrc"
);
29
contentTags_
.emplace(
"conversions"
, conversiontag);
30
31
edm::InputTag
conversiontagMiniAOD =
c
.getParameter<
edm::InputTag
>(
"conversionSrcMiniAOD"
);
32
contentTags_
.emplace(
"conversionsMiniAOD"
, conversiontagMiniAOD);
33
34
edm::InputTag
beamspottag =
c
.getParameter<
edm::InputTag
>(
"beamspotSrc"
);
35
contentTags_
.emplace(
"beamspot"
, beamspottag);
36
}
37
38
void
GsfEleConversionVetoCut::setConsumes
(
edm::ConsumesCollector
&
cc
) {
39
auto
convs =
cc
.mayConsume<
reco::ConversionCollection
>(
contentTags_
[
"conversions"
]);
40
auto
convsMiniAOD =
cc
.mayConsume<
reco::ConversionCollection
>(
contentTags_
[
"conversionsMiniAOD"
]);
41
auto
thebs =
cc
.consumes<
reco::BeamSpot
>(
contentTags_
[
"beamspot"
]);
42
contentTokens_
.emplace(
"conversions"
, convs);
43
contentTokens_
.emplace(
"conversionsMiniAOD"
, convsMiniAOD);
44
contentTokens_
.emplace(
"beamspot"
, thebs);
45
}
46
47
void
GsfEleConversionVetoCut::getEventContent
(
const
edm::EventBase
&
ev
) {
48
// First try AOD, then go to miniAOD. Use the same Handle since collection class is the same.
49
ev
.getByLabel(
contentTags_
[
"conversions"
],
_convs
);
50
if
(!
_convs
.
isValid
())
51
ev
.getByLabel(
contentTags_
[
"conversionsMiniAOD"
],
_convs
);
52
53
ev
.getByLabel(
contentTags_
[
"beamspot"
],
_thebs
);
54
}
55
56
CutApplicatorBase::result_type
GsfEleConversionVetoCut::operator()
(
const
reco::GsfElectronPtr
&
cand
)
const
{
57
if
(
_thebs
.
isValid
() &&
_convs
.
isValid
()) {
58
return
!
ConversionTools::hasMatchedConversion
(*
cand
, *
_convs
,
_thebs
->
position
());
59
}
else
{
60
edm::LogWarning
(
"GsfEleConversionVetoCut"
) <<
"Couldn't find a necessary collection, returning true!"
;
61
}
62
return
true
;
63
}
64
65
double
GsfEleConversionVetoCut::value
(
const
reco::CandidatePtr
&
cand
)
const
{
66
reco::GsfElectronPtr
ele(
cand
);
67
if
(
_thebs
.
isValid
() &&
_convs
.
isValid
()) {
68
return
!
ConversionTools::hasMatchedConversion
(*ele, *
_convs
,
_thebs
->
position
());
69
}
else
{
70
edm::LogWarning
(
"GsfEleConversionVetoCut"
) <<
"Couldn't find a necessary collection, returning true!"
;
71
return
true
;
72
}
73
}
ConversionTools.h
GsfEleConversionVetoCut::operator()
result_type operator()(const reco::GsfElectronPtr &) const final
Definition:
GsfEleConversionVetoCut.cc:56
ConversionFwd.h
watchdog.const
const
Definition:
watchdog.py:83
edm::Handle< reco::ConversionCollection >
GsfEleConversionVetoCut::_thebs
edm::Handle< reco::BeamSpot > _thebs
Definition:
GsfEleConversionVetoCut.cc:22
GsfEleConversionVetoCut::_convs
edm::Handle< reco::ConversionCollection > _convs
Definition:
GsfEleConversionVetoCut.cc:21
reco::ConversionCollection
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition:
ConversionFwd.h:9
CutApplicatorWithEventContentBase::contentTags_
std::unordered_map< std::string, edm::InputTag > contentTags_
Definition:
CutApplicatorWithEventContentBase.h:35
GsfEleConversionVetoCut::getEventContent
void getEventContent(const edm::EventBase &) final
Definition:
GsfEleConversionVetoCut.cc:47
candidate_functions::CandidateCut::result_type
bool result_type
Definition:
CandidateCut.h:11
GsfEleConversionVetoCut::candidateType
CandidateType candidateType() const final
Definition:
GsfEleConversionVetoCut.cc:18
ConversionTools::hasMatchedConversion
static bool hasMatchedConversion(const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
Definition:
ConversionTools.cc:184
reco::BeamSpot
Definition:
BeamSpot.h:21
GsfEleConversionVetoCut::setConsumes
void setConsumes(edm::ConsumesCollector &) final
Definition:
GsfEleConversionVetoCut.cc:38
CutApplicatorWithEventContentBase.h
GsfEleConversionVetoCut::value
double value(const reco::CandidatePtr &cand) const final
Definition:
GsfEleConversionVetoCut.cc:65
reco::BeamSpot::position
const Point & position() const
position
Definition:
BeamSpot.h:59
GsfElectron.h
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition:
PluginFactory.h:124
edm::LogWarning
Definition:
MessageLogger.h:141
edm::ParameterSet
Definition:
ParameterSet.h:36
CutApplicatorBase::CandidateType
CandidateType
Definition:
CutApplicatorBase.h:47
edmplugin::PluginFactory
Definition:
PluginFactory.h:34
cand
Definition:
decayParser.h:34
GsfEleConversionVetoCut::GsfEleConversionVetoCut
GsfEleConversionVetoCut(const edm::ParameterSet &c)
Definition:
GsfEleConversionVetoCut.cc:27
HltBtagPostValidation_cff.c
c
Definition:
HltBtagPostValidation_cff.py:31
cc
edm::Ptr< reco::GsfElectron >
GsfEleConversionVetoCut
Definition:
GsfEleConversionVetoCut.cc:7
ev
bool ev
Definition:
Hydjet2Hadronizer.cc:95
CutApplicatorWithEventContentBase::contentTokens_
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
Definition:
CutApplicatorWithEventContentBase.h:40
edm::EventBase
Definition:
EventBase.h:46
edm::HandleBase::isValid
bool isValid() const
Definition:
HandleBase.h:70
CutApplicatorBase::ELECTRON
Definition:
CutApplicatorBase.h:47
edm::InputTag
Definition:
InputTag.h:15
edm::ConsumesCollector
Definition:
ConsumesCollector.h:39
CutApplicatorWithEventContentBase
Definition:
CutApplicatorWithEventContentBase.h:19
Conversion.h
Generated for CMSSW Reference Manual by
1.8.16