CMS 3D CMS Logo

PtMinPFCandidateSelectorDefinition.h
Go to the documentation of this file.
1 #ifndef CommonTools_ParticleFlow_PtMinPFCandidateSelectorDefinition
2 #define CommonTools_ParticleFlow_PtMinPFCandidateSelectorDefinition
3 
10 
11 namespace pf2pat {
12 
14  public:
16  : ptMin_(cfg.getParameter<double>("ptMin")) {}
17 
18  void select(const HandleToCollection& hc, const edm::EventBase& e, const edm::EventSetup& s) {
19  selected_.clear();
20 
21  assert(hc.isValid());
22 
23  unsigned key = 0;
24  for (collection::const_iterator pfc = hc->begin(); pfc != hc->end(); ++pfc, ++key) {
25  if (pfc->pt() > ptMin_) {
26  selected_.push_back(reco::PFCandidate(*pfc));
27  reco::PFCandidatePtr ptrToMother(hc, key);
28  selected_.back().setSourceCandidatePtr(ptrToMother);
29  }
30  }
31  }
32 
33  /* const container& selected() const {return selected_;} */
34 
35  private:
36  double ptMin_;
37  };
38 
39 } // namespace pf2pat
40 
41 #endif
void select(const HandleToCollection &hc, const edm::EventBase &e, const edm::EventSetup &s)
bool isValid() const
Definition: HandleBase.h:70
PtMinPFCandidateSelectorDefinition(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
susybsm::HSCParticleCollection hc
Definition: classes.h:25