CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

PATPrimaryVertexSelector Class Reference

#include <PATPrimaryVertexSelector.h>

List of all members.

Public Types

typedef reco::VertexCollection collection
typedef container::const_iterator const_iterator
typedef std::vector< const
reco::Vertex * > 
container

Public Member Functions

const_iterator begin () const
 needed for use with an ObjectSelector
const_iterator end () const
 needed for use with an ObjectSelector
bool operator() (const reco::Vertex *, const reco::Vertex *) const
 operator used in sorting the selected vertices
 PATPrimaryVertexSelector (const edm::ParameterSet &cfg)
void select (const edm::Handle< collection > &, const edm::Event &, const edm::EventSetup &)
 needed for use with an ObjectSelector
size_t size () const
 needed for use with an ObjectSelector

Private Member Functions

bool acceptTrack (const reco::Track &) const
 track selection
void getVertexVariables (const reco::Vertex &, unsigned int &, double &) const
 access to track-related vertex quantities (multiplicity and pt-sum)

Private Attributes

float chi2Cut_
 eta cut used for the track selection
float dr2Cut_
 cut on the normalized chi2
float dzCut_
 cut on the (squared) transverse position
unsigned int multiplicityCut_
 container of selected vertices
float ptSumCut_
 minimum multiplicity of (selected) associated tracks
container selected_
float trackEtaCut_
 minimum pt sum o (selected) associated tracks

Detailed Description

Definition at line 22 of file PATPrimaryVertexSelector.h.


Member Typedef Documentation

Definition at line 24 of file PATPrimaryVertexSelector.h.

typedef container::const_iterator PATPrimaryVertexSelector::const_iterator

Definition at line 26 of file PATPrimaryVertexSelector.h.

Definition at line 25 of file PATPrimaryVertexSelector.h.


Constructor & Destructor Documentation

PATPrimaryVertexSelector::PATPrimaryVertexSelector ( const edm::ParameterSet cfg)

Definition at line 6 of file PATPrimaryVertexSelector.cc.

References dr2Cut_.

                                                                              :
  multiplicityCut_(cfg.getParameter<unsigned int>("minMultiplicity")),
  ptSumCut_(cfg.getParameter<double>("minPtSum")),
  trackEtaCut_(cfg.getParameter<double>("maxTrackEta")),
  chi2Cut_(cfg.getParameter<double>("maxNormChi2")),
  dr2Cut_(cfg.getParameter<double>("maxDeltaR")),
  dzCut_(cfg.getParameter<double>("maxDeltaZ")) {
  // store squared cut (avoid using sqrt() for each vertex)
  dr2Cut_ *= dr2Cut_;
}

Member Function Documentation

bool PATPrimaryVertexSelector::acceptTrack ( const reco::Track ) const [private]

track selection

const_iterator PATPrimaryVertexSelector::begin ( void  ) const [inline]

needed for use with an ObjectSelector

Definition at line 29 of file PATPrimaryVertexSelector.h.

References selected_.

{ return selected_.begin(); }
const_iterator PATPrimaryVertexSelector::end ( void  ) const [inline]

needed for use with an ObjectSelector

Definition at line 31 of file PATPrimaryVertexSelector.h.

References selected_.

{ return selected_.end(); }
void PATPrimaryVertexSelector::getVertexVariables ( const reco::Vertex vertex,
unsigned int &  multiplicity,
double &  ptSum 
) const [private]

access to track-related vertex quantities (multiplicity and pt-sum)

Definition at line 49 of file PATPrimaryVertexSelector.cc.

References trackEtaCut_, reco::Vertex::tracks_begin(), and reco::Vertex::tracks_end().

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

                                                                                               {
  multiplicity = 0;
  ptSum = 0.;
  for(reco::Vertex::trackRef_iterator it=vertex.tracks_begin();
      it!=vertex.tracks_end(); ++it) {
    if(fabs((**it).eta())<trackEtaCut_) {
      ++multiplicity;
      ptSum += (**it).pt();
    }
  }
}
bool PATPrimaryVertexSelector::operator() ( const reco::Vertex v1,
const reco::Vertex v2 
) const

operator used in sorting the selected vertices

Definition at line 38 of file PATPrimaryVertexSelector.cc.

References getVertexVariables().

                                                                                      {
  unsigned int mult1;
  double ptSum1;
  getVertexVariables(*v1,mult1,ptSum1);
  unsigned int mult2;
  double ptSum2;
  getVertexVariables(*v2,mult2,ptSum2);
  return ptSum1>ptSum2;
}
void PATPrimaryVertexSelector::select ( const edm::Handle< collection > &  handle,
const edm::Event event,
const edm::EventSetup setup 
)

needed for use with an ObjectSelector

Definition at line 18 of file PATPrimaryVertexSelector.cc.

References chi2Cut_, dr2Cut_, dzCut_, getVertexVariables(), multiplicityCut_, ptSumCut_, selected_, and python::multivaluedict::sort().

                                                              {
  selected_.clear();
  // FIXME: the fixed reference point should be replaced with the measured beamspot
  const math::XYZPoint beamSpot(0.,0.,0.);
  unsigned int multiplicity;
  double ptSum;
  for ( collection::const_iterator iv=handle->begin(); iv!=handle->end(); ++iv ) {
    math::XYZVector displacement(iv->position()-beamSpot);
    if ( iv->normalizedChi2()<chi2Cut_ &&
         fabs(displacement.z())<dzCut_ && displacement.perp2()<dr2Cut_ ) {
      getVertexVariables(*iv,multiplicity,ptSum);
      if ( multiplicity>=multiplicityCut_ && ptSum>ptSumCut_ ) selected_.push_back(&*iv);
    }
  }
  sort(selected_.begin(),selected_.end(),*this);
}
size_t PATPrimaryVertexSelector::size ( void  ) const [inline]

needed for use with an ObjectSelector

Definition at line 35 of file PATPrimaryVertexSelector.h.

References selected_.

{ return selected_.size(); }

Member Data Documentation

eta cut used for the track selection

Definition at line 49 of file PATPrimaryVertexSelector.h.

Referenced by select().

cut on the normalized chi2

Definition at line 50 of file PATPrimaryVertexSelector.h.

Referenced by PATPrimaryVertexSelector(), and select().

cut on the (squared) transverse position

Definition at line 51 of file PATPrimaryVertexSelector.h.

Referenced by select().

container of selected vertices

Definition at line 46 of file PATPrimaryVertexSelector.h.

Referenced by select().

minimum multiplicity of (selected) associated tracks

Definition at line 47 of file PATPrimaryVertexSelector.h.

Referenced by select().

Definition at line 45 of file PATPrimaryVertexSelector.h.

Referenced by begin(), end(), select(), and size().

minimum pt sum o (selected) associated tracks

Definition at line 48 of file PATPrimaryVertexSelector.h.

Referenced by getVertexVariables().