CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoVertex/TertiaryTracksVertexFinder/src/VertexMass.cc

Go to the documentation of this file.
00001 #include "RecoVertex/TertiaryTracksVertexFinder/interface/VertexMass.h"
00002 
00003 #include "RecoVertex/VertexPrimitives/interface/TransientVertex.h"
00004 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00005 
00006 VertexMass::VertexMass() : thePionMass(0.13957) {}
00007 
00008 VertexMass::VertexMass(double pionMass) : thePionMass(pionMass) {}
00009 
00010 double VertexMass::operator()(const TransientVertex& vtx) const
00011 {
00012 
00013   std::vector<reco::TransientTrack> tracks = vtx.originalTracks();
00014 
00015   double esum=0., pxsum=0., pysum=0., pzsum=0.;
00016 
00017   for(std::vector<reco::TransientTrack>::const_iterator it=tracks.begin();
00018       it!=tracks.end();it++) {
00019     reco::TransientTrack track = *it;
00020 
00021     double px = track.impactPointState().globalMomentum().x();
00022     double py = track.impactPointState().globalMomentum().y();
00023     double pz = track.impactPointState().globalMomentum().z();
00024 
00025     pxsum += px;
00026     pysum += py;
00027     pzsum += pz;
00028     esum += sqrt(px*px + py*py + pz*pz + thePionMass*thePionMass);
00029   }
00030   
00031   return sqrt(esum*esum - (pxsum*pxsum + pysum*pysum + pzsum*pzsum));
00032 }