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