CMS 3D CMS Logo

Public Member Functions

VertexHigherPtSquared Class Reference

#include <VertexHigherPtSquared.h>

List of all members.

Public Member Functions

bool operator() (const TransientVertex &v1, const TransientVertex &v2) const
bool operator() (const reco::Vertex &v1, const reco::Vertex &v2) const
double sumPtSquared (const std::vector< reco::TransientTrack > &tks) const
double sumPtSquared (const reco::Vertex &v) const

Detailed Description

operator for sorting TransientVertex objects in decreasing order of the sum of the squared track pT's

Definition at line 13 of file VertexHigherPtSquared.h.


Member Function Documentation

bool VertexHigherPtSquared::operator() ( const TransientVertex v1,
const TransientVertex v2 
) const

Definition at line 6 of file VertexHigherPtSquared.cc.

References TransientVertex::originalTracks().

{
  std::vector<reco::TransientTrack> tks1 = v1.originalTracks();
  std::vector<reco::TransientTrack> tks2 = v2.originalTracks();
  return (sumPtSquared(tks1) > sumPtSquared(tks2));
}
bool VertexHigherPtSquared::operator() ( const reco::Vertex v1,
const reco::Vertex v2 
) const

Definition at line 15 of file VertexHigherPtSquared.cc.

{
  return (sumPtSquared(v1) > sumPtSquared(v2));
}
double VertexHigherPtSquared::sumPtSquared ( const std::vector< reco::TransientTrack > &  tks) const
double VertexHigherPtSquared::sumPtSquared ( const reco::Vertex v) const

Definition at line 36 of file VertexHigherPtSquared.cc.

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

{
  double sum = 0.;
  double pT;
  for (Vertex::trackRef_iterator it = v.tracks_begin(); it != v.tracks_end(); it++) {
    pT = (**it).pt();
    double epT=(**it).ptError(); pT=pT>epT ? pT-epT : 0;

    sum += pT*pT;
  }
  return sum;
}