CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
VertexHigherPtSquared.cc
Go to the documentation of this file.
2 
3 using namespace reco;
4 
6  // return (sumPtSquared(v1) > sumPtSquared(v2)); V-01-05-02
7  const std::vector<reco::TransientTrack>& tks1 = v1.originalTracks();
8  const std::vector<reco::TransientTrack>& tks2 = v2.originalTracks();
9  return (sumPtSquared(tks1) > sumPtSquared(tks2));
10 }
11 
12 bool VertexHigherPtSquared::operator()(const Vertex& v1, const Vertex& v2) const {
13  return (sumPtSquared(v1) > sumPtSquared(v2));
14 }
15 
17  double sum = 0.;
18  double pT;
19  for (Vertex::trackRef_iterator it = v.tracks_begin(); it != v.tracks_end(); it++) {
20  pT = (**it).pt();
21  double epT = (**it).ptError();
22  pT = pT > epT ? pT - epT : 0;
23 
24  sum += pT * pT;
25  }
26  return sum;
27 }
28 
29 double VertexHigherPtSquared::sumPtSquared(const std::vector<reco::TransientTrack>& tks) const {
30  double sum = 0.;
31  for (std::vector<reco::TransientTrack>::const_iterator it = tks.begin(); it != tks.end(); it++) {
32  double pT = (it->track()).pt();
33  double epT = (it->track()).ptError();
34  pT = pT > epT ? pT - epT : 0;
35 
36  sum += pT * pT;
37  }
38  return sum;
39 }
std::vector< reco::TransientTrack > const & originalTracks() const
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:110
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:108
double sumPtSquared(const reco::Vertex &v) const
bool operator()(const TransientVertex &v1, const TransientVertex &v2) const
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:38