CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pf2pat::PdgIdPFCandidateSelectorDefinition Class Reference

#include <PdgIdPFCandidateSelectorDefinition.h>

Inheritance diagram for pf2pat::PdgIdPFCandidateSelectorDefinition:
pf2pat::PFCandidateSelectorDefinition

Public Member Functions

 PdgIdPFCandidateSelectorDefinition (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 
void select (const HandleToCollection &hc, const edm::EventBase &e, const edm::EventSetup &s)
 
- Public Member Functions inherited from pf2pat::PFCandidateSelectorDefinition
const_iterator begin () const
 
const_iterator end () const
 
 PFCandidateSelectorDefinition ()
 
const containerselected () const
 
size_t size () const
 

Private Attributes

std::vector< int > pdgIds_
 

Additional Inherited Members

- Public Types inherited from pf2pat::PFCandidateSelectorDefinition
typedef reco::PFCandidateCollection collection
 
typedef boost::transform_iterator< Pointer, container::const_iterator > const_iterator
 
typedef std::vector< reco::PFCandidatecontainer
 
typedef edm::Handle< collectionHandleToCollection
 
- Protected Attributes inherited from pf2pat::PFCandidateSelectorDefinition
container selected_
 

Detailed Description

Definition at line 14 of file PdgIdPFCandidateSelectorDefinition.h.

Constructor & Destructor Documentation

◆ PdgIdPFCandidateSelectorDefinition()

pf2pat::PdgIdPFCandidateSelectorDefinition::PdgIdPFCandidateSelectorDefinition ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 16 of file PdgIdPFCandidateSelectorDefinition.h.

17  : pdgIds_(cfg.getParameter<std::vector<int> >("pdgId")) {}

Member Function Documentation

◆ select()

void pf2pat::PdgIdPFCandidateSelectorDefinition::select ( const HandleToCollection hc,
const edm::EventBase e,
const edm::EventSetup s 
)
inline

Definition at line 19 of file PdgIdPFCandidateSelectorDefinition.h.

19  {
20  selected_.clear();
21 
22  unsigned key = 0;
23  for (collection::const_iterator pfc = hc->begin(); pfc != hc->end(); ++pfc, ++key) {
24  for (unsigned iId = 0; iId < pdgIds_.size(); iId++) {
25  if (pfc->pdgId() == pdgIds_[iId]) {
26  selected_.push_back(reco::PFCandidate(*pfc));
27  reco::PFCandidatePtr ptrToMother(hc, key);
28  selected_.back().setSourceCandidatePtr(ptrToMother);
29  break;
30  }
31  }
32  }
33  }

References crabWrapper::key, pdgIds_, and pf2pat::PFCandidateSelectorDefinition::selected_.

Member Data Documentation

◆ pdgIds_

std::vector<int> pf2pat::PdgIdPFCandidateSelectorDefinition::pdgIds_
private

Definition at line 36 of file PdgIdPFCandidateSelectorDefinition.h.

Referenced by select().

pf2pat::PdgIdPFCandidateSelectorDefinition::pdgIds_
std::vector< int > pdgIds_
Definition: PdgIdPFCandidateSelectorDefinition.h:36
pf2pat::PFCandidateSelectorDefinition::selected_
container selected_
Definition: PFCandidateSelectorDefinition.h:33
edm::Ptr< PFCandidate >
looper.cfg
cfg
Definition: looper.py:296
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
crabWrapper.key
key
Definition: crabWrapper.py:19