Selects PFCandidates basing on their compatibility with vertex. More...
#include <CommonTools/ParticleFlow/interface/IPCutPFCandidateSelectorDefinition.h>
Public Member Functions | |
IPCutPFCandidateSelectorDefinition (const edm::ParameterSet &cfg) | |
void | select (const HandleToCollection &hc, const edm::Event &e, const edm::EventSetup &s) |
Private Attributes | |
double | d0Cut_ |
double | d0SigCut_ |
double | dzCut_ |
double | dzSigCut_ |
edm::InputTag | vertices_ |
Selects PFCandidates basing on their compatibility with vertex.
Definition at line 21 of file IPCutPFCandidateSelectorDefinition.h.
pf2pat::IPCutPFCandidateSelectorDefinition::IPCutPFCandidateSelectorDefinition | ( | const edm::ParameterSet & | cfg | ) | [inline] |
Definition at line 23 of file IPCutPFCandidateSelectorDefinition.h.
: vertices_( cfg.getParameter<edm::InputTag> ( "vertices" ) ), d0Cut_( cfg.getParameter<double>("d0Cut") ), dzCut_( cfg.getParameter<double>("dzCut") ), d0SigCut_( cfg.getParameter<double>("d0SigCut") ), dzSigCut_( cfg.getParameter<double>("dzSigCut") ) {}
void pf2pat::IPCutPFCandidateSelectorDefinition::select | ( | const HandleToCollection & | hc, |
const edm::Event & | e, | ||
const edm::EventSetup & | s | ||
) | [inline] |
Definition at line 30 of file IPCutPFCandidateSelectorDefinition.h.
References d0Cut_, d0SigCut_, reco::TrackBase::dxy(), reco::TrackBase::dxyError(), reco::TrackBase::dz(), dzCut_, reco::TrackBase::dzError(), dzSigCut_, edm::Event::getByLabel(), combine::key, reco::Vertex::position(), pf2pat::PFCandidateSelectorDefinition::selected_, vertices_, reco::Vertex::xError(), reco::Vertex::yError(), and reco::Vertex::zError().
{ selected_.clear(); edm::Handle<reco::VertexCollection> vertices; e.getByLabel(vertices_, vertices); if (vertices->empty()) return; const reco::Vertex &vtx = (*vertices)[0]; unsigned key=0; for( collection::const_iterator pfc = hc->begin(); pfc != hc->end(); ++pfc, ++key) { bool passing = true; const reco::Track *tk = 0; if (pfc->gsfTrackRef().isNonnull()) tk = pfc->gsfTrackRef().get(); else if (pfc->trackRef().isNonnull()) tk = pfc->trackRef().get(); if (tk != 0) { double d0 = fabs(tk->dxy(vtx.position())); double dz = fabs(tk->dz(vtx.position())); double d0e = hypot(tk->dxyError(), hypot(vtx.xError(), vtx.yError())); double dze = hypot(tk->dzError(), vtx.zError()); if (d0Cut_ > 0 && d0 > d0Cut_) passing = false; if (dzCut_ > 0 && dz > dzCut_) passing = false; if (d0SigCut_ > 0 && d0e > 0 && d0/d0e > d0SigCut_) passing = false; if (dzSigCut_ > 0 && dze > 0 && dz/dze > dzSigCut_) passing = false; } if( passing ) { selected_.push_back( reco::PFCandidate(*pfc) ); reco::PFCandidatePtr ptrToMother( hc, key ); selected_.back().setSourceCandidatePtr( ptrToMother ); } } }
double pf2pat::IPCutPFCandidateSelectorDefinition::d0Cut_ [private] |
Definition at line 70 of file IPCutPFCandidateSelectorDefinition.h.
Referenced by select().
double pf2pat::IPCutPFCandidateSelectorDefinition::d0SigCut_ [private] |
Definition at line 72 of file IPCutPFCandidateSelectorDefinition.h.
Referenced by select().
double pf2pat::IPCutPFCandidateSelectorDefinition::dzCut_ [private] |
Definition at line 71 of file IPCutPFCandidateSelectorDefinition.h.
Referenced by select().
double pf2pat::IPCutPFCandidateSelectorDefinition::dzSigCut_ [private] |
Definition at line 73 of file IPCutPFCandidateSelectorDefinition.h.
Referenced by select().
Definition at line 69 of file IPCutPFCandidateSelectorDefinition.h.
Referenced by select().