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 
8 
9 namespace pf2pat {
10 
12 
13  public:
15  pdgIds_( cfg.getParameter< std::vector<int> >( "pdgId" ) ) { }
16 
17  void select( const HandleToCollection & hc,
18  const edm::EventBase & e,
19  const edm::EventSetup& s) {
20  selected_.clear();
21 
22  unsigned key=0;
23  for( collection::const_iterator pfc = hc->begin();
24  pfc != hc->end(); ++pfc, ++key) {
25 
26  for(unsigned iId=0; iId<pdgIds_.size(); iId++) {
27  if ( pfc->pdgId() == pdgIds_[iId] ) {
28  selected_.push_back( reco::PFCandidate(*pfc) );
29  reco::PFCandidatePtr ptrToMother( hc, key );
30  selected_.back().setSourceCandidatePtr( ptrToMother );
31  break;
32  }
33  }
34  }
35  }
36 
37  private:
38  std::vector<int> pdgIds_;
39  };
40 
41 }
42 
43 #endif
tuple cfg
Definition: looper.py:293
void select(const HandleToCollection &hc, const edm::EventBase &e, const edm::EventSetup &s)
PdgIdPFCandidateSelectorDefinition(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
susybsm::HSCParticleCollection hc
Definition: classes.h:25