CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PdgIdPFCandidateSelectorDefinition.h
Go to the documentation of this file.
1 #ifndef CommonTools_ParticleFlow_PdgIdPFCandidateSelectorDefinition
2 #define CommonTools_ParticleFlow_PdgIdPFCandidateSelectorDefinition
3 
7 
8 namespace pf2pat {
9 
11 
12  public:
14  pdgIds_( cfg.getParameter< std::vector<int> >( "pdgId" ) ) { }
15 
16  void select( const HandleToCollection & hc,
17  const edm::EventBase & e,
18  const edm::EventSetup& s) {
19  selected_.clear();
20 
21  unsigned key=0;
22  for( collection::const_iterator pfc = hc->begin();
23  pfc != hc->end(); ++pfc, ++key) {
24 
25  for(unsigned iId=0; iId<pdgIds_.size(); iId++) {
26  if ( pfc->pdgId() == pdgIds_[iId] ) {
27  selected_.push_back( reco::PFCandidate(*pfc) );
28  reco::PFCandidatePtr ptrToMother( hc, key );
29  selected_.back().setSourceCandidatePtr( ptrToMother );
30  break;
31  }
32  }
33  }
34  }
35 
36  private:
37  std::vector<int> pdgIds_;
38  };
39 
40 }
41 
42 #endif
void select(const HandleToCollection &hc, const edm::EventBase &e, const edm::EventSetup &s)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:35
list key
Definition: combine.py:13