CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GenericPFCandidateSelectorDefinition.h
Go to the documentation of this file.
1 #ifndef CommonTools_ParticleFlow_GenericPFCandidateSelectorDefinition
2 #define CommonTools_ParticleFlow_GenericPFCandidateSelectorDefinition
3 
16 
17 namespace pf2pat {
18 
20 
22  selector_( cfg.getParameter< std::string >( "cut" ) ) { }
23 
24  void select( const HandleToCollection & hc,
25  const edm::Event & e,
26  const edm::EventSetup& s) {
27  selected_.clear();
28 
29  unsigned key=0;
30  for( collection::const_iterator pfc = hc->begin();
31  pfc != hc->end(); ++pfc, ++key) {
32 
33  if( selector_(*pfc) ) {
34  selected_.push_back( reco::PFCandidate(*pfc) );
35  reco::PFCandidatePtr ptrToMother( hc, key );
36  selected_.back().setSourceCandidatePtr( ptrToMother );
37 
38  }
39  }
40  }
41 
42  private:
44  };
45 }
46 
47 #endif
void select(const HandleToCollection &hc, const edm::Event &e, const edm::EventSetup &s)
Selects PFCandidates basing on cuts provided with string cut parser.
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:35
list key
Definition: combine.py:13
StringCutObjectSelector< reco::PFCandidate > selector_