CMS 3D CMS Logo

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

List of all members.

Public Member Functions

 MuonIDPFCandidateSelectorDefinition (const edm::ParameterSet &cfg)
void select (const HandleToCollection &hc, const edm::Event &e, const edm::EventSetup &s)

Private Attributes

StringCutObjectSelector
< pat::Muon
muonCut_

Detailed Description

Selects PFCandidates basing on cuts provided with string cut parser.

Author:
Giovanni Petrucciani
Version:
Id:
MuonIDPFCandidateSelectorDefinition.h,v 1.2 2011/04/06 12:12:38 rwolf Exp

Definition at line 21 of file MuonIDPFCandidateSelectorDefinition.h.


Constructor & Destructor Documentation

pf2pat::MuonIDPFCandidateSelectorDefinition::MuonIDPFCandidateSelectorDefinition ( const edm::ParameterSet cfg) [inline]

Definition at line 23 of file MuonIDPFCandidateSelectorDefinition.h.

                                                                        :
      muonCut_( cfg.getParameter< std::string >( "cut" ) )
    { 
    }

Member Function Documentation

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(), combine::key, muonCut_, and pf2pat::PFCandidateSelectorDefinition::selected_.

                                         {
      selected_.clear();

      unsigned key=0;
      for( collection::const_iterator pfc = hc->begin(); 
           pfc != hc->end(); ++pfc, ++key) {

        reco::MuonRef muR = pfc->muonRef();

        // skip ones without a ref to a reco::Muon: they won't be matched anyway        
        if (muR.isNull()) continue;

        // convert into a pat::Muon, so that the 'muonID' method is available
        pat::Muon patMu(*muR);

        // apply muon id
        if (muonCut_(patMu)) {
            selected_.push_back( reco::PFCandidate(*pfc) );
            reco::PFCandidatePtr ptrToMother( hc, key );
            selected_.back().setSourceCandidatePtr( ptrToMother );
        }
      }
    }

Member Data Documentation

Definition at line 55 of file MuonIDPFCandidateSelectorDefinition.h.

Referenced by select().