CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/RecoPixelVertexing/PixelVertexFinding/src/PVClusterComparer.cc

Go to the documentation of this file.
00001 #include "RecoPixelVertexing/PixelVertexFinding/interface/PVClusterComparer.h"
00002 #include "DataFormats/TrackReco/interface/Track.h"
00003 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00004 
00005 PVClusterComparer::PVClusterComparer(){}
00006 
00007 double PVClusterComparer::pTSquaredSum(const PVCluster &v) const {
00008   double sum=0;
00009   for (unsigned int i=0; i<v.tracks().size(); ++i) {
00010     double pt = v.tracks()[i]->pt();
00011     if (pt > 2.5) { // Don't count tracks below 2.5 GeV
00012       if (pt > 10.0) pt = 10.0;
00013       sum += pt*pt;
00014     }
00015   }
00016   return sum;
00017 }
00018 double PVClusterComparer::pTSquaredSum(const reco::Vertex &v) const {
00019   double sum=0;
00020   for (reco::Vertex::trackRef_iterator i=v.tracks_begin(); i!=v.tracks_end(); ++i) {
00021     double pt = (*i)->pt();
00022     if (pt > 2.5) { // Don't count tracks below 2.5 GeV
00023       if (pt > 10.0) pt = 10.0;
00024       sum += pt*pt;
00025     }
00026   }
00027   return sum;
00028 }
00029 
00030 bool PVClusterComparer::operator() (const PVCluster &v1, const PVCluster &v2) const {
00031   return ( pTSquaredSum(v1) > pTSquaredSum(v2) );
00032 }
00033 bool PVClusterComparer::operator() (const reco::Vertex &v1, const reco::Vertex &v2) const {
00034   return ( pTSquaredSum(v1) > pTSquaredSum(v2) );
00035 }