test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
PATPrimaryVertexSelector Class Reference

#include <PATPrimaryVertexSelector.h>

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 More...
 
const_iterator end () const
 needed for use with an ObjectSelector More...
 
bool operator() (const reco::Vertex *, const reco::Vertex *) const
 operator used in sorting the selected vertices More...
 
 PATPrimaryVertexSelector (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 
void select (const edm::Handle< collection > &, const edm::Event &, const edm::EventSetup &)
 needed for use with an ObjectSelector More...
 
size_t size () const
 needed for use with an ObjectSelector More...
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 23 of file PATPrimaryVertexSelector.h.

Member Typedef Documentation

Definition at line 25 of file PATPrimaryVertexSelector.h.

typedef container::const_iterator PATPrimaryVertexSelector::const_iterator

Definition at line 27 of file PATPrimaryVertexSelector.h.

Definition at line 26 of file PATPrimaryVertexSelector.h.

Constructor & Destructor Documentation

PATPrimaryVertexSelector::PATPrimaryVertexSelector ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)

Definition at line 6 of file PATPrimaryVertexSelector.cc.

References dr2Cut_.

6  :
7  multiplicityCut_(cfg.getParameter<unsigned int>("minMultiplicity")),
8  ptSumCut_(cfg.getParameter<double>("minPtSum")),
9  trackEtaCut_(cfg.getParameter<double>("maxTrackEta")),
10  chi2Cut_(cfg.getParameter<double>("maxNormChi2")),
11  dr2Cut_(cfg.getParameter<double>("maxDeltaR")),
12  dzCut_(cfg.getParameter<double>("maxDeltaZ")) {
13  // store squared cut (avoid using sqrt() for each vertex)
14  dr2Cut_ *= dr2Cut_;
15 }
float dr2Cut_
cut on the normalized chi2
T getParameter(std::string const &) const
unsigned int multiplicityCut_
container of selected vertices
float dzCut_
cut on the (squared) transverse position
float trackEtaCut_
minimum pt sum o (selected) associated tracks
float ptSumCut_
minimum multiplicity of (selected) associated tracks
float chi2Cut_
eta cut used for the track selection

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 30 of file PATPrimaryVertexSelector.h.

References selected_.

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

needed for use with an ObjectSelector

Definition at line 32 of file PATPrimaryVertexSelector.h.

References selected_.

32 { 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().

50  {
51  multiplicity = 0;
52  ptSum = 0.;
54  it!=vertex.tracks_end(); ++it) {
55  if(fabs((**it).eta())<trackEtaCut_) {
56  ++multiplicity;
57  ptSum += (**it).pt();
58  }
59  }
60 }
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:44
float trackEtaCut_
minimum pt sum o (selected) associated tracks
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:37
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39
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().

38  {
39  unsigned int mult1;
40  double ptSum1;
41  getVertexVariables(*v1,mult1,ptSum1);
42  unsigned int mult2;
43  double ptSum2;
44  getVertexVariables(*v2,mult2,ptSum2);
45  return ptSum1>ptSum2;
46 }
void getVertexVariables(const reco::Vertex &, unsigned int &, double &) const
access to track-related vertex quantities (multiplicity and pt-sum)
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 SiPixelRawToDigiRegional_cfi::beamSpot, chi2Cut_, dr2Cut_, dzCut_, getVertexVariables(), multiplicityCut_, ptSumCut_, and selected_.

20  {
21  selected_.clear();
22  // FIXME: the fixed reference point should be replaced with the measured beamspot
23  const math::XYZPoint beamSpot(0.,0.,0.);
24  unsigned int multiplicity;
25  double ptSum;
26  for ( collection::const_iterator iv=handle->begin(); iv!=handle->end(); ++iv ) {
27  math::XYZVector displacement(iv->position()-beamSpot);
28  if ( iv->normalizedChi2()<chi2Cut_ &&
29  fabs(displacement.z())<dzCut_ && displacement.perp2()<dr2Cut_ ) {
30  getVertexVariables(*iv,multiplicity,ptSum);
31  if ( multiplicity>=multiplicityCut_ && ptSum>ptSumCut_ ) selected_.push_back(&*iv);
32  }
33  }
34  sort(selected_.begin(),selected_.end(),*this);
35 }
float dr2Cut_
cut on the normalized chi2
unsigned int multiplicityCut_
container of selected vertices
void getVertexVariables(const reco::Vertex &, unsigned int &, double &) const
access to track-related vertex quantities (multiplicity and pt-sum)
float dzCut_
cut on the (squared) transverse position
float ptSumCut_
minimum multiplicity of (selected) associated tracks
float chi2Cut_
eta cut used for the track selection
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
size_t PATPrimaryVertexSelector::size ( void  ) const
inline

needed for use with an ObjectSelector

Definition at line 36 of file PATPrimaryVertexSelector.h.

References selected_.

36 { return selected_.size(); }

Member Data Documentation

float PATPrimaryVertexSelector::chi2Cut_
private

eta cut used for the track selection

Definition at line 50 of file PATPrimaryVertexSelector.h.

Referenced by select().

float PATPrimaryVertexSelector::dr2Cut_
private

cut on the normalized chi2

Definition at line 51 of file PATPrimaryVertexSelector.h.

Referenced by PATPrimaryVertexSelector(), and select().

float PATPrimaryVertexSelector::dzCut_
private

cut on the (squared) transverse position

Definition at line 52 of file PATPrimaryVertexSelector.h.

Referenced by select().

unsigned int PATPrimaryVertexSelector::multiplicityCut_
private

container of selected vertices

Definition at line 47 of file PATPrimaryVertexSelector.h.

Referenced by select().

float PATPrimaryVertexSelector::ptSumCut_
private

minimum multiplicity of (selected) associated tracks

Definition at line 48 of file PATPrimaryVertexSelector.h.

Referenced by select().

container PATPrimaryVertexSelector::selected_
private

Definition at line 46 of file PATPrimaryVertexSelector.h.

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

float PATPrimaryVertexSelector::trackEtaCut_
private

minimum pt sum o (selected) associated tracks

Definition at line 49 of file PATPrimaryVertexSelector.h.

Referenced by getVertexVariables().