#include <PVSelector.h>
Public Member Functions | |
bool | operator() (edm::EventBase const &event, pat::strbitset &ret) |
This provides the interface for base classes to select objects. | |
PVSelector (edm::ParameterSet const ¶ms) | |
PVSelector () | |
edm::Handle< std::vector < reco::Vertex > > const & | vertices () const |
Private Attributes | |
edm::Handle< std::vector < reco::Vertex > > | h_primVtx |
index_type | indexNPV_ |
PVObjectSelector | pvSel_ |
edm::InputTag | pvSrc_ |
Definition at line 12 of file PVSelector.h.
PVSelector::PVSelector | ( | ) | [inline] |
Definition at line 15 of file PVSelector.h.
{}
PVSelector::PVSelector | ( | edm::ParameterSet const & | params | ) | [inline] |
Definition at line 17 of file PVSelector.h.
References Selector< edm::EventBase >::bits_, Selector< edm::EventBase >::getBitTemplate(), edm::ParameterSet::getParameter(), indexNPV_, Selector< edm::EventBase >::push_back(), and Selector< edm::EventBase >::retInternal_.
: pvSrc_ (params.getParameter<edm::InputTag>("pvSrc") ), pvSel_ (params) { push_back("NPV", params.getParameter<int>("NPV") ); set("NPV"); retInternal_ = getBitTemplate(); indexNPV_ = index_type(&bits_, "NPV"); }
bool PVSelector::operator() | ( | edm::EventBase const & | t, |
pat::strbitset & | ret | ||
) | [inline, virtual] |
This provides the interface for base classes to select objects.
Implements Selector< edm::EventBase >.
Definition at line 27 of file PVSelector.h.
References Selector< edm::EventBase >::cut(), h_primVtx, i, Selector< edm::EventBase >::ignoreCut(), indexNPV_, Selector< edm::EventBase >::passCut(), pvSel_, pvSrc_, pat::strbitset::set(), and Selector< edm::EventBase >::setIgnored().
{ ret.set(false); event.getByLabel(pvSrc_, h_primVtx); // check if there is a good primary vertex if ( h_primVtx->size() < 1 ) return false; // Loop over PV's and count those that pass int npv = 0; for ( std::vector<reco::Vertex>::const_iterator ibegin = h_primVtx->begin(), iend = h_primVtx->end(), i = ibegin; i != iend; ++i ) { reco::Vertex const & pv = *i; bool ipass = pvSel_(pv); if ( ipass ) { ++npv; } } // Set the strbitset if ( npv >= cut(indexNPV_, int() ) || ignoreCut(indexNPV_) ) { passCut(ret, indexNPV_); } // Check if there is anything to ignore setIgnored(ret); // Return status bool pass = (bool)ret; return pass; }
edm::Handle<std::vector<reco::Vertex> > const& PVSelector::vertices | ( | ) | const [inline] |
edm::Handle<std::vector<reco::Vertex> > PVSelector::h_primVtx [private] |
Definition at line 66 of file PVSelector.h.
Referenced by operator()(), and vertices().
index_type PVSelector::indexNPV_ [private] |
Definition at line 67 of file PVSelector.h.
Referenced by operator()(), and PVSelector().
PVObjectSelector PVSelector::pvSel_ [private] |
Definition at line 65 of file PVSelector.h.
Referenced by operator()().
edm::InputTag PVSelector::pvSrc_ [private] |
Definition at line 64 of file PVSelector.h.
Referenced by operator()().