Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:17

0001 #include "RecoVertex/PrimaryVertexProducer/interface/VertexHigherPtSquared.h"
0002 
0003 using namespace reco;
0004 
0005 bool VertexHigherPtSquared::operator()(const TransientVertex& v1, const TransientVertex& v2) const {
0006   //  return (sumPtSquared(v1) > sumPtSquared(v2));  V-01-05-02
0007   const std::vector<reco::TransientTrack>& tks1 = v1.originalTracks();
0008   const std::vector<reco::TransientTrack>& tks2 = v2.originalTracks();
0009   return (sumPtSquared(tks1) > sumPtSquared(tks2));
0010 }
0011 
0012 bool VertexHigherPtSquared::operator()(const Vertex& v1, const Vertex& v2) const {
0013   return (sumPtSquared(v1) > sumPtSquared(v2));
0014 }
0015 
0016 double VertexHigherPtSquared::sumPtSquared(const Vertex& v) const {
0017   double sum = 0.;
0018   double pT;
0019   for (Vertex::trackRef_iterator it = v.tracks_begin(); it != v.tracks_end(); it++) {
0020     pT = (**it).pt();
0021     double epT = (**it).ptError();
0022     pT = pT > epT ? pT - epT : 0;
0023 
0024     sum += pT * pT;
0025   }
0026   return sum;
0027 }
0028 
0029 double VertexHigherPtSquared::sumPtSquared(const std::vector<reco::TransientTrack>& tks) const {
0030   double sum = 0.;
0031   for (std::vector<reco::TransientTrack>::const_iterator it = tks.begin(); it != tks.end(); it++) {
0032     double pT = (it->track()).pt();
0033     double epT = (it->track()).ptError();
0034     pT = pT > epT ? pT - epT : 0;
0035 
0036     sum += pT * pT;
0037   }
0038   return sum;
0039 }