CMS 3D CMS Logo

PdgIdPFCandidateSelectorDefinition.h
Go to the documentation of this file.
1 #ifndef CommonTools_ParticleFlow_PdgIdPFCandidateSelectorDefinition
2 #define CommonTools_ParticleFlow_PdgIdPFCandidateSelectorDefinition
3 
11 
12 namespace pf2pat {
13 
15  public:
17  : pdgIds_(cfg.getParameter<std::vector<int> >("pdgId")) {}
18 
19  void select(const HandleToCollection& hc, const edm::EventBase& e, const edm::EventSetup& s) {
20  selected_.clear();
21 
22  unsigned key = 0;
23  for (collection::const_iterator pfc = hc->begin(); pfc != hc->end(); ++pfc, ++key) {
24  for (unsigned iId = 0; iId < pdgIds_.size(); iId++) {
25  if (pfc->pdgId() == pdgIds_[iId]) {
26  selected_.push_back(reco::PFCandidate(*pfc));
27  reco::PFCandidatePtr ptrToMother(hc, key);
28  selected_.back().setSourceCandidatePtr(ptrToMother);
29  break;
30  }
31  }
32  }
33  }
34 
35  private:
36  std::vector<int> pdgIds_;
37  };
38 
39 } // namespace pf2pat
40 
41 #endif
void select(const HandleToCollection &hc, const edm::EventBase &e, const edm::EventSetup &s)
PdgIdPFCandidateSelectorDefinition(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