CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PtMinPFCandidateSelectorDefinition.h
Go to the documentation of this file.
1 #ifndef CommonTools_ParticleFlow_PtMinPFCandidateSelectorDefinition
2 #define CommonTools_ParticleFlow_PtMinPFCandidateSelectorDefinition
3 
7 
8 namespace pf2pat {
9 
11 
12  public:
14  ptMin_( cfg.getParameter< double >( "ptMin" ) ) { }
15 
16 
17  void select( const HandleToCollection & hc,
18  const edm::EventBase & e,
19  const edm::EventSetup& s
20  ) {
21  selected_.clear();
22 
23  assert( hc.isValid() );
24 
25 
26  unsigned key=0;
27  for( collection::const_iterator pfc = hc->begin();
28  pfc != hc->end(); ++pfc, ++key) {
29 
30  if( pfc->pt() > ptMin_ ) {
31  selected_.push_back( reco::PFCandidate(*pfc) );
32  reco::PFCandidatePtr ptrToMother( hc, key );
33  selected_.back().setSourceCandidatePtr( ptrToMother );
34 
35  }
36  }
37  }
38 
39 /* const container& selected() const {return selected_;} */
40 
41  private:
42  double ptMin_;
43  };
44 
45 }
46 
47 #endif
void select(const HandleToCollection &hc, const edm::EventBase &e, const edm::EventSetup &s)
bool isValid() const
Definition: HandleBase.h:76
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:33
list key
Definition: combine.py:13