00001 #include <cmath> 00002 #include <vector> 00003 00004 #include <Math/GenVector/PxPyPzE4D.h> 00005 #include <Math/GenVector/PxPyPzM4D.h> 00006 00007 #include "DataFormats/Math/interface/LorentzVector.h" 00008 #include "DataFormats/TrackReco/interface/Track.h" 00009 #include "DataFormats/VertexReco/interface/Vertex.h" 00010 00011 #include "RecoBTag/SecondaryVertex/interface/ParticleMasses.h" 00012 #include "RecoBTag/SecondaryVertex/interface/TrackKinematics.h" 00013 00014 using namespace reco; 00015 00016 TrackKinematics::TrackKinematics() : 00017 n(0), sumWeights(0) 00018 { 00019 } 00020 00021 TrackKinematics::TrackKinematics(const std::vector<Track> &tracks) : 00022 n(0), sumWeights(0) 00023 { 00024 for(std::vector<Track>::const_iterator iter = tracks.begin(); 00025 iter != tracks.end(); iter++) 00026 add(*iter); 00027 } 00028 00029 TrackKinematics::TrackKinematics(const TrackRefVector &tracks) : 00030 n(0), sumWeights(0) 00031 { 00032 for(TrackRefVector::const_iterator iter = tracks.begin(); 00033 iter != tracks.end(); iter++) 00034 add(**iter); 00035 } 00036 00037 TrackKinematics::TrackKinematics(const Vertex &vertex) : 00038 n(0), sumWeights(0) 00039 { 00040 for(Vertex::trackRef_iterator iter = vertex.tracks_begin(); 00041 iter != vertex.tracks_end(); iter++) 00042 add(**iter, vertex.trackWeight(*iter)); 00043 } 00044 00045 void TrackKinematics::add(const Track &track, double weight) 00046 { 00047 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec; 00048 00049 vec.SetPx(track.px()); 00050 vec.SetPy(track.py()); 00051 vec.SetPz(track.pz()); 00052 vec.SetM(ParticleMasses::piPlus); 00053 00054 n++; 00055 sumWeights += weight; 00056 sum += vec; 00057 weightedSum += weight * vec; 00058 }