CMS 3D CMS Logo

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

#include <VertexHigherPtSquared.h>

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 reco::Vertex &v) const
 
double sumPtSquared (const std::vector< reco::TransientTrack > &tks) 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().

8 {
9  // return (sumPtSquared(v1) > sumPtSquared(v2)); V-01-05-02
10  const std::vector<reco::TransientTrack> & tks1 = v1.originalTracks();
11  const std::vector<reco::TransientTrack> & tks2 = v2.originalTracks();
12  return (sumPtSquared(tks1) > sumPtSquared(tks2));
13 }
std::vector< reco::TransientTrack > originalTracks() const
double sumPtSquared(const reco::Vertex &v) const
bool VertexHigherPtSquared::operator() ( const reco::Vertex v1,
const reco::Vertex v2 
) const

Definition at line 17 of file VertexHigherPtSquared.cc.

19 {
20  return (sumPtSquared(v1) > sumPtSquared(v2));
21 }
double sumPtSquared(const reco::Vertex &v) const
double VertexHigherPtSquared::sumPtSquared ( const reco::Vertex v) const

Definition at line 26 of file VertexHigherPtSquared.cc.

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

Referenced by PrimaryVertexProducerAlgorithm::vertices().

27 {
28  double sum = 0.;
29  double pT;
30  for (Vertex::trackRef_iterator it = v.tracks_begin(); it != v.tracks_end(); it++) {
31  pT = (**it).pt();
32  double epT=(**it).ptError();
33  pT=pT>epT ? pT-epT : 0;
34 
35  sum += pT*pT;
36  }
37  return sum;
38 }
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:45
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:38
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:40
double VertexHigherPtSquared::sumPtSquared ( const std::vector< reco::TransientTrack > &  tks) const

Definition at line 41 of file VertexHigherPtSquared.cc.

42 {
43  double sum = 0.;
44  for (std::vector<reco::TransientTrack>::const_iterator it = tks.begin();
45  it != tks.end(); it++) {
46  double pT = (it->track()).pt();
47  double epT=(it->track()).ptError();
48  pT=pT>epT ? pT-epT : 0;
49 
50  sum += pT*pT;
51  }
52  return sum;
53 }