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 std::vector<reco::TransientTrack> tks1 = v1.originalTracks(); 00010 std::vector<reco::TransientTrack> tks2 = v2.originalTracks(); 00011 return (sumPtSquared(tks1) > sumPtSquared(tks2)); 00012 } 00013 00014 bool 00015 VertexHigherPtSquared::operator() ( const Vertex & v1, 00016 const Vertex & v2) const 00017 { 00018 return (sumPtSquared(v1) > sumPtSquared(v2)); 00019 } 00020 00021 00022 double 00023 VertexHigherPtSquared::sumPtSquared( 00024 const std::vector<reco::TransientTrack> & tks) const 00025 { 00026 double sum = 0.; 00027 for (std::vector<reco::TransientTrack>::const_iterator it = tks.begin(); 00028 it != tks.end(); it++) { 00029 double pT = (*it).impactPointState().globalMomentum().transverse(); 00030 sum += pT*pT; 00031 } 00032 return sum; 00033 } 00034 00035 double VertexHigherPtSquared::sumPtSquared(const Vertex & v) const 00036 { 00037 double sum = 0.; 00038 double pT; 00039 for (Vertex::trackRef_iterator it = v.tracks_begin(); it != v.tracks_end(); it++) { 00040 pT = (**it).pt(); 00041 sum += pT*pT; 00042 } 00043 return sum; 00044 }