CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MCMatchCandRefSelector.cc
Go to the documentation of this file.
10 
11 using namespace edm;
12 using namespace reco;
13 using namespace std;
14 
15 namespace reco {
16  namespace modules {
17 
19  public:
20  explicit MCMatchCandRefSelector(const InputTag& src) :
21  src_(src) { }
22  void newEvent(const Event& evt, const EventSetup&);
23  bool operator()(const CandidateBaseRef &) const;
24  private:
27  };
28 
29  void MCMatchCandRefSelector::newEvent(const Event& evt, const EventSetup&) {
31  evt.getByLabel(src_, match);
32  match_ = match.product();
33  }
34 
35  bool MCMatchCandRefSelector::operator()(const CandidateBaseRef & c) const {
36  GenParticleRef m = (*match_)[c];
37  return m.isNonnull();
38  }
39 
40  template<>
43  return MCMatchCandRefSelector(cfg.getParameter<InputTag>("match"));
44  }
45  };
46 
47  }
48 }
49 
51 
53 
T getParameter(std::string const &) const
#define EVENTSETUP_STD_INIT(SELECTOR)
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName, BranchDescription::MatchMode m)
DEFINE_FWK_MODULE(HiMixingModule)
SingleObjectRefSelector< Candidate, reco::modules::MCMatchCandRefSelector > MCMatchCandRefSelector
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
static MCMatchCandRefSelector make(const ParameterSet &cfg)
T const * product() const
Definition: Handle.h:74