CommonTools
ParticleFlow
interface
MuonIDPFCandidateSelectorDefinition.h
Go to the documentation of this file.
1
#ifndef CommonTools_ParticleFlow_MuonIDPFCandidateSelectorDefinition
2
#define CommonTools_ParticleFlow_MuonIDPFCandidateSelectorDefinition
3
12
#include "
FWCore/Framework/interface/Event.h
"
13
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
14
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
15
#include "
DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h
"
16
#include "
DataFormats/ParticleFlowCandidate/interface/PFCandidate.h
"
17
#include "
DataFormats/Common/interface/ValueMap.h
"
18
#include "
DataFormats/PatCandidates/interface/Muon.h
"
19
#include "
CommonTools/Utils/interface/StringCutObjectSelector.h
"
20
#include "
CommonTools/ParticleFlow/interface/PFCandidateSelectorDefinition.h
"
21
22
namespace
pf2pat
{
23
24
struct
MuonIDPFCandidateSelectorDefinition
:
public
PFCandidateSelectorDefinition
{
25
MuonIDPFCandidateSelectorDefinition
(
const
edm::ParameterSet
&
cfg
,
edm::ConsumesCollector
&& iC)
26
:
muonCut_
(
cfg
.getParameter<
std
::
string
>(
"cut"
)) {}
27
28
void
select
(
const
HandleToCollection
& hc,
const
edm::Event
&
e
,
const
edm::EventSetup
&
s
) {
29
selected_
.clear();
30
31
unsigned
key
= 0;
32
for
(collection::const_iterator pfc = hc->begin(); pfc != hc->end(); ++pfc, ++
key
) {
33
reco::MuonRef
muR = pfc->muonRef();
34
35
// skip ones without a ref to a reco::Muon: they won't be matched anyway
36
if
(muR.
isNull
())
37
continue
;
38
39
// convert into a pat::Muon, so that the 'muonID' method is available
40
pat::Muon
patMu(*muR);
41
42
// apply muon id
43
if
(
muonCut_
(patMu)) {
44
selected_
.push_back(
reco::PFCandidate
(*pfc));
45
reco::PFCandidatePtr
ptrToMother(hc,
key
);
46
selected_
.back().setSourceCandidatePtr(ptrToMother);
47
}
48
}
49
}
50
51
private
:
52
StringCutObjectSelector<pat::Muon>
muonCut_
;
53
};
54
}
// namespace pf2pat
55
56
#endif
PFCandidate.h
pf2pat
Definition:
ElectronIDPFCandidateSelectorDefinition.h:22
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition:
Ref.h:235
Muon.h
pat::Muon
Analysis-level muon class.
Definition:
Muon.h:51
edm::Handle
Definition:
AssociativeIterator.h:50
edm::Ref< MuonCollection >
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
pf2pat::MuonIDPFCandidateSelectorDefinition::muonCut_
StringCutObjectSelector< pat::Muon > muonCut_
Definition:
MuonIDPFCandidateSelectorDefinition.h:52
pf2pat::PFCandidateSelectorDefinition::selected_
container selected_
Definition:
PFCandidateSelectorDefinition.h:33
PFCandidateSelectorDefinition.h
pf2pat::MuonIDPFCandidateSelectorDefinition::MuonIDPFCandidateSelectorDefinition
MuonIDPFCandidateSelectorDefinition(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Definition:
MuonIDPFCandidateSelectorDefinition.h:25
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
pf2pat::MuonIDPFCandidateSelectorDefinition
Selects PFCandidates basing on cuts provided with string cut parser.
Definition:
MuonIDPFCandidateSelectorDefinition.h:24
edm::EventSetup
Definition:
EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::Ptr< PFCandidate >
looper.cfg
cfg
Definition:
looper.py:296
ValueMap.h
std
Definition:
JetResolutionObject.h:76
StringCutObjectSelector.h
StringCutObjectSelector< pat::Muon >
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition:
PFCandidate.h:41
ConsumesCollector.h
pf2pat::PFCandidateSelectorDefinition
Definition:
PFCandidateSelectorDefinition.h:10
ParameterSet.h
pf2pat::MuonIDPFCandidateSelectorDefinition::select
void select(const HandleToCollection &hc, const edm::Event &e, const edm::EventSetup &s)
Definition:
MuonIDPFCandidateSelectorDefinition.h:28
edm::Event
Definition:
Event.h:73
crabWrapper.key
key
Definition:
crabWrapper.py:19
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
PFCandidateFwd.h
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
Generated for CMSSW Reference Manual by
1.8.16