CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PVClusterComparer.cc
Go to the documentation of this file.
4 
6 
8  double sum=0;
9  for (unsigned int i=0; i<v.tracks().size(); ++i) {
10  double pt = v.tracks()[i]->pt();
11  if (pt > 2.5) { // Don't count tracks below 2.5 GeV
12  if (pt > 10.0) pt = 10.0;
13  sum += pt*pt;
14  }
15  }
16  return sum;
17 }
19  double sum=0;
21  double pt = (*i)->pt();
22  if (pt > 2.5) { // Don't count tracks below 2.5 GeV
23  if (pt > 10.0) pt = 10.0;
24  sum += pt*pt;
25  }
26  }
27  return sum;
28 }
29 
30 bool PVClusterComparer::operator() (const PVCluster &v1, const PVCluster &v2) const {
31  return ( pTSquaredSum(v1) > pTSquaredSum(v2) );
32 }
33 bool PVClusterComparer::operator() (const reco::Vertex &v1, const reco::Vertex &v2) const {
34  return ( pTSquaredSum(v1) > pTSquaredSum(v2) );
35 }
int i
Definition: DBlmapReader.cc:9
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:44
bool operator()(const PVCluster &v1, const PVCluster &v2) const
Use this operator in a std::sort to sort them in decreasing sumPt.
double pTSquaredSum(const PVCluster &v) const
Calculate sum of square of the pT&#39;s of the tracks in the vertex.
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:37
PVClusterComparer()
Constructor does nothing, no data members.
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39