CMS 3D CMS Logo

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

◆ operator()() [1/2]

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

Definition at line 5 of file VertexHigherPtSquared.cc.

References TransientVertex::originalTracks().

5  {
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 }
double sumPtSquared(const reco::Vertex &v) const
std::vector< reco::TransientTrack > const & originalTracks() const

◆ operator()() [2/2]

bool VertexHigherPtSquared::operator() ( const reco::Vertex v1,
const reco::Vertex v2 
) const

Definition at line 12 of file VertexHigherPtSquared.cc.

12  {
13  return (sumPtSquared(v1) > sumPtSquared(v2));
14 }
double sumPtSquared(const reco::Vertex &v) const

◆ sumPtSquared() [1/2]

double VertexHigherPtSquared::sumPtSquared ( const reco::Vertex v) const

Definition at line 16 of file VertexHigherPtSquared.cc.

References pv::pT, and findQualityFiles::v.

16  {
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 }
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38

◆ sumPtSquared() [2/2]

double VertexHigherPtSquared::sumPtSquared ( const std::vector< reco::TransientTrack > &  tks) const

Definition at line 29 of file VertexHigherPtSquared.cc.

References DiDispStaMuonMonitor_cfi::pt, and pv::pT.

29  {
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 }