CMS 3D CMS Logo

GenericPFCandidateSelectorDefinition.h
Go to the documentation of this file.
1 #ifndef CommonTools_ParticleFlow_GenericPFCandidateSelectorDefinition
2 #define CommonTools_ParticleFlow_GenericPFCandidateSelectorDefinition
3 
17 
18 namespace pf2pat {
19 
21 
23  selector_( cfg.getParameter< std::string >( "cut" ) ) { }
24 
25  void select( const HandleToCollection & hc,
26  const edm::Event & e,
27  const edm::EventSetup& s) {
28  selected_.clear();
29 
30  unsigned key=0;
31  for( collection::const_iterator pfc = hc->begin();
32  pfc != hc->end(); ++pfc, ++key) {
33 
34  if( selector_(*pfc) ) {
35  selected_.push_back( reco::PFCandidate(*pfc) );
36  reco::PFCandidatePtr ptrToMother( hc, key );
37  selected_.back().setSourceCandidatePtr( ptrToMother );
38 
39  }
40  }
41  }
42 
43  private:
45  };
46 }
47 
48 #endif
void select(const HandleToCollection &hc, const edm::Event &e, const edm::EventSetup &s)
Selects PFCandidates basing on cuts provided with string cut parser.
GenericPFCandidateSelectorDefinition(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
susybsm::HSCParticleCollection hc
Definition: classes.h:25
StringCutObjectSelector< reco::PFCandidate > selector_