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 
16  public:
18  pdgIds_( cfg.getParameter< std::vector<int> >( "pdgId" ) ) { }
19 
20  void select( const HandleToCollection & hc,
21  const edm::EventBase & e,
22  const edm::EventSetup& s) {
23  selected_.clear();
24 
25  unsigned key=0;
26  for( collection::const_iterator pfc = hc->begin();
27  pfc != hc->end(); ++pfc, ++key) {
28 
29  for(unsigned iId=0; iId<pdgIds_.size(); iId++) {
30  if ( pfc->pdgId() == pdgIds_[iId] ) {
31  selected_.push_back( reco::PFCandidate(*pfc) );
32  reco::PFCandidatePtr ptrToMother( hc, key );
33  selected_.back().setSourceCandidatePtr( ptrToMother );
34  break;
35  }
36  }
37  }
38  }
39 
40  private:
41  std::vector<int> pdgIds_;
42  };
43 
44 }
45 
46 #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