CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoVertex/PrimaryVertexProducer/src/VertexHigherPtSquared.cc

Go to the documentation of this file.
00001 #include "RecoVertex/PrimaryVertexProducer/interface/VertexHigherPtSquared.h"
00002 
00003 using namespace reco;
00004 
00005 bool 
00006 VertexHigherPtSquared::operator() ( const TransientVertex & v1, 
00007                                     const TransientVertex & v2) const
00008 {
00009   return (sumPtSquared(v1) > sumPtSquared(v2));
00010 }
00011 
00012 
00013 bool 
00014 VertexHigherPtSquared::operator() ( const Vertex & v1, 
00015                                     const Vertex & v2) const
00016 {
00017   return (sumPtSquared(v1) > sumPtSquared(v2));
00018 }
00019 
00020 
00021 
00022 
00023 double VertexHigherPtSquared::sumPtSquared(const Vertex & v) const 
00024 {
00025   double sum = 0.;
00026   double pT;
00027   for (Vertex::trackRef_iterator it = v.tracks_begin(); it != v.tracks_end(); it++) {
00028     pT = (**it).pt();
00029     double epT=(**it).ptError(); pT=pT>epT ? pT-epT : 0;
00030 
00031     sum += pT*pT;
00032   }
00033   return sum;
00034 }