CMS 3D CMS Logo

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

Selects PFCandidates basing on cuts provided with string cut parser. More...

#include "CommonTools/ParticleFlow/interface/MuonIDPFCandidateSelectorDefinition.h"

Inheritance diagram for pf2pat::MuonIDPFCandidateSelectorDefinition:
pf2pat::PFCandidateSelectorDefinition

Public Member Functions

 MuonIDPFCandidateSelectorDefinition (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 
void select (const HandleToCollection &hc, const edm::Event &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

StringCutObjectSelector< pat::MuonmuonCut_
 

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

Selects PFCandidates basing on cuts provided with string cut parser.

Author
Giovanni Petrucciani
Version
Id
MuonIDPFCandidateSelectorDefinition.h,v 1.1 2011/01/28 20:56:44 srappocc Exp

Definition at line 24 of file MuonIDPFCandidateSelectorDefinition.h.

Constructor & Destructor Documentation

◆ MuonIDPFCandidateSelectorDefinition()

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

Member Function Documentation

◆ select()

void pf2pat::MuonIDPFCandidateSelectorDefinition::select ( const HandleToCollection hc,
const edm::Event e,
const edm::EventSetup s 
)
inline

Definition at line 28 of file MuonIDPFCandidateSelectorDefinition.h.

References edm::Ref< C, T, F >::isNull(), crabWrapper::key, muonCut_, and pf2pat::PFCandidateSelectorDefinition::selected_.

28  {
29  selected_.clear();
30 
31  unsigned key = 0;
32  for (collection::const_iterator pfc = hc->begin(); pfc != hc->end(); ++pfc, ++key) {
33  reco::MuonRef muR = pfc->muonRef();
34 
35  // skip ones without a ref to a reco::Muon: they won't be matched anyway
36  if (muR.isNull())
37  continue;
38 
39  // convert into a pat::Muon, so that the 'muonID' method is available
40  pat::Muon patMu(*muR);
41 
42  // apply muon id
43  if (muonCut_(patMu)) {
44  selected_.push_back(reco::PFCandidate(*pfc));
45  reco::PFCandidatePtr ptrToMother(hc, key);
46  selected_.back().setSourceCandidatePtr(ptrToMother);
47  }
48  }
49  }
bool isNull() const
Checks for null.
Definition: Ref.h:235
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
Analysis-level muon class.
Definition: Muon.h:51

Member Data Documentation

◆ muonCut_

StringCutObjectSelector<pat::Muon> pf2pat::MuonIDPFCandidateSelectorDefinition::muonCut_
private

Definition at line 52 of file MuonIDPFCandidateSelectorDefinition.h.

Referenced by select().