CMS 3D CMS Logo

Public Member Functions | Private Attributes

PVSelector Class Reference

#include <PVSelector.h>

Inheritance diagram for PVSelector:
Selector< edm::EventBase > binary_function

List of all members.

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 &params)
 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_

Detailed Description

Definition at line 12 of file PVSelector.h.


Constructor & Destructor Documentation

PVSelector::PVSelector ( ) [inline]

Definition at line 15 of file PVSelector.h.

{}
PVSelector::PVSelector ( edm::ParameterSet const &  params) [inline]

Member Function Documentation

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]

Definition at line 61 of file PVSelector.h.

References h_primVtx.

{ return h_primVtx; }

Member Data Documentation

Definition at line 66 of file PVSelector.h.

Referenced by operator()(), and vertices().

Definition at line 67 of file PVSelector.h.

Referenced by operator()(), and PVSelector().

Definition at line 65 of file PVSelector.h.

Referenced by operator()().

Definition at line 64 of file PVSelector.h.

Referenced by operator()().