CMS 3D CMS Logo

GenericPFCandidateSelectorDefinition.h
Go to the documentation of this file.
1 #ifndef CommonTools_ParticleFlow_GenericPFCandidateSelectorDefinition
2 #define CommonTools_ParticleFlow_GenericPFCandidateSelectorDefinition
3 
19 
20 namespace pf2pat {
21 
24  : selector_(cfg.getParameter<std::string>("cut")) {}
25 
26  void select(const HandleToCollection& hc, const edm::Event& e, const edm::EventSetup& s) {
27  selected_.clear();
28 
29  unsigned key = 0;
30  for (collection::const_iterator pfc = hc->begin(); pfc != hc->end(); ++pfc, ++key) {
31  if (selector_(*pfc)) {
32  selected_.push_back(reco::PFCandidate(*pfc));
33  reco::PFCandidatePtr ptrToMother(hc, key);
34  selected_.back().setSourceCandidatePtr(ptrToMother);
35  }
36  }
37  }
38 
39  private:
41  };
42 } // namespace pf2pat
43 
44 #endif
void select(const HandleToCollection &hc, const edm::Event &e, const edm::EventSetup &s)
Selects PFCandidates basing on cuts provided with string cut parser.
GenericPFCandidateSelectorDefinition(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
StringCutObjectSelector< reco::PFCandidate > selector_