CMS 3D CMS Logo

MCMatchCandRefSelector.cc
Go to the documentation of this file.
11 
12 using namespace edm;
13 using namespace reco;
14 using namespace std;
15 
16 namespace reco {
17  namespace modules {
18 
20  public:
22  void newEvent(const Event& evt, const EventSetup&);
23  bool operator()(const CandidateBaseRef&) const;
24 
25  private:
27  const GenParticleMatch* match_ = nullptr;
28  };
29 
30  void MCMatchCandRefSelector::newEvent(const Event& evt, const EventSetup&) {
32  evt.getByToken(srcToken_, match);
33  match_ = match.product();
34  }
35 
36  bool MCMatchCandRefSelector::operator()(const CandidateBaseRef& c) const {
37  GenParticleRef m = (*match_)[c];
38  return m.isNonnull();
39  }
40 
41  template <>
44  return MCMatchCandRefSelector(iC.consumes<GenParticleMatch>(cfg.getParameter<InputTag>("match")));
45  }
46  };
47 
48  } // namespace modules
49 } // namespace reco
50 
52 
54 
MCMatchCandRefSelector
SingleObjectRefSelector< Candidate, reco::modules::MCMatchCandRefSelector > MCMatchCandRefSelector
Definition: MCMatchCandRefSelector.cc:51
EVENTSETUP_STD_INIT
#define EVENTSETUP_STD_INIT(SELECTOR)
Definition: EventSetupInitTrait.h:103
Handle.h
modules
Definition: ZHLTMatchFilter.cc:17
edm::EDGetTokenT< GenParticleMatch >
edm
HLT enums.
Definition: AlignableModifier.h:19
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
EventSetupInitTrait.h
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref< GenParticleCollection >
GenParticle.h
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
reco::modules::MCMatchCandRefSelector
Definition: MCMatchCandRefSelector.cc:19
L1Validator_cfi.srcToken
srcToken
Definition: L1Validator_cfi.py:8
SingleObjectRefSelector
Definition: SingleObjectRefSelector.h:22
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
edm::Association
Definition: Association.h:18
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
InputTag.h
looper.cfg
cfg
Definition: looper.py:297
std
Definition: JetResolutionObject.h:76
edm::match
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)
Definition: BranchDescription.cc:351
SingleObjectRefSelector.h
reco::modules::ParameterAdapter< MCMatchCandRefSelector >::make
static MCMatchCandRefSelector make(const ParameterSet &cfg, edm::ConsumesCollector &iC)
Definition: MCMatchCandRefSelector.cc:43
reco::modules::MCMatchCandRefSelector::srcToken_
EDGetTokenT< GenParticleMatch > srcToken_
Definition: MCMatchCandRefSelector.cc:26
reco::modules::MCMatchCandRefSelector::MCMatchCandRefSelector
MCMatchCandRefSelector(const EDGetTokenT< GenParticleMatch > &srcToken)
Definition: MCMatchCandRefSelector.cc:21
edm::RefToBase< Candidate >
ParameterAdapter.h
ConsumesCollector.h
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
reco::modules::ParameterAdapter
Definition: ParameterAdapter.h:12