CMS 3D CMS Logo

GenericPFCandidateSelectorDefinition.h
Go to the documentation of this file.
1 #ifndef CommonTools_ParticleFlow_GenericPFCandidateSelectorDefinition
2 #define CommonTools_ParticleFlow_GenericPFCandidateSelectorDefinition
3 
19 
20 namespace pf2pat {
21 
23 
25  selector_( cfg.getParameter< std::string >( "cut" ) ) { }
26 
27  void select( const HandleToCollection & hc,
28  const edm::Event & e,
29  const edm::EventSetup& s) {
30  selected_.clear();
31 
32  unsigned key=0;
33  for( collection::const_iterator pfc = hc->begin();
34  pfc != hc->end(); ++pfc, ++key) {
35 
36  if( selector_(*pfc) ) {
37  selected_.push_back( reco::PFCandidate(*pfc) );
38  reco::PFCandidatePtr ptrToMother( hc, key );
39  selected_.back().setSourceCandidatePtr( ptrToMother );
40 
41  }
42  }
43  }
44 
45  private:
47  };
48 }
49 
50 #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:40
susybsm::HSCParticleCollection hc
Definition: classes.h:25
StringCutObjectSelector< reco::PFCandidate > selector_