CMS 3D CMS Logo

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) {
59  }
60 
61 } // namespace vertexTools
reco::CompositePtrCandidate::daughterPtrVector
virtual const daughters & daughterPtrVector() const
references to daughtes
Definition: CompositePtrCandidate.h:63
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
reco::VertexCompositePtrCandidate
Definition: VertexCompositePtrCandidate.h:16
vertexTools::computeSharedTracks
double computeSharedTracks(const reco::Vertex &pv, const std::vector< reco::TrackRef > &svTracks, double minTrackWeight=0.5, float unused=0)
Definition: SharedTracks.cc:4
edm::Ref< TrackCollection >
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:226
KineDebug3::count
void count()
Definition: KinematicConstrainedVertexUpdatorT.h:21
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
SharedTracks.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::Vertex
Definition: Vertex.h:35
vertexTools
Definition: SharedTracks.h:9