CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SharedTracks.cc
Go to the documentation of this file.
2 namespace vertexTools {
3  using namespace reco;
4  double computeSharedTracks(const Vertex &pv, const std::vector<TrackRef> &svTracks, double minTrackWeight, float) {
5  std::set<TrackRef> pvTracks;
6  for (std::vector<TrackBaseRef>::const_iterator iter = pv.tracks_begin(); iter != pv.tracks_end(); iter++)
7  if (pv.trackWeight(*iter) >= minTrackWeight)
8  pvTracks.insert(iter->castTo<TrackRef>());
9 
10  unsigned int count = 0;
11  for (std::vector<TrackRef>::const_iterator iter = svTracks.begin(); iter != svTracks.end(); iter++)
12  count += pvTracks.count(*iter);
13 
14  return (double)count / (double)svTracks.size();
15  }
16  double computeSharedTracks(const Vertex &pv,
17  const std::vector<CandidatePtr> &svTracks,
18  double minTrackWeight,
19  float maxsigma) {
20  unsigned int count = 0;
21  for (std::vector<CandidatePtr>::const_iterator iter = svTracks.begin(); iter != svTracks.end(); iter++) {
22  if (std::abs((*iter)->bestTrack()->dz() - pv.z()) / (*iter)->bestTrack()->dzError() < maxsigma &&
23  std::abs((*iter)->bestTrack()->dxy(pv.position()) / (*iter)->bestTrack()->dxyError()) < maxsigma)
24  count++;
25  }
26  return (double)count / (double)svTracks.size();
27  }
29  const std::vector<CandidatePtr> &svTracks,
30  double,
31  float) {
32  unsigned int count = 0;
33  for (std::vector<CandidatePtr>::const_iterator iter = svTracks.begin(); iter != svTracks.end(); iter++) {
34  if (std::find(sv2.daughterPtrVector().begin(), sv2.daughterPtrVector().end(), *iter) !=
35  sv2.daughterPtrVector().end())
36  count++;
37  }
38  return (double)count / (double)svTracks.size();
39  }
40 
43  double minTrackWeight,
44  float mindist) {
45  return computeSharedTracks(pv, sv.daughterPtrVector(), minTrackWeight, mindist);
46  }
47  double computeSharedTracks(const reco::Vertex &pv, const reco::Vertex &sv, double minTrackWeight, float) {
48  std::vector<TrackRef> svTracks;
49  for (std::vector<TrackBaseRef>::const_iterator iter = sv.tracks_begin(); iter != sv.tracks_end(); iter++)
50  if (sv.trackWeight(*iter) >= minTrackWeight)
51  svTracks.push_back(iter->castTo<TrackRef>());
52  return computeSharedTracks(pv, svTracks, minTrackWeight);
53  }
56  double,
57  float) {
58  return computeSharedTracks(sv, sv2.daughterPtrVector());
59  }
60 
61 } // namespace vertexTools
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const Point & position() const
position
Definition: Vertex.h:127
double computeSharedTracks(const reco::Vertex &pv, const std::vector< reco::TrackRef > &svTracks, double minTrackWeight=0.5, float unused=0)
Definition: SharedTracks.cc:4
virtual const daughters & daughterPtrVector() const
references to daughtes
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.h:110
double z() const
z coordinate
Definition: Vertex.h:133
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Definition: Vertex.h:96
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.h:108