CMS 3D CMS Logo

GsfVertexTrackCompatibilityEstimator.cc
Go to the documentation of this file.
3 #include <algorithm>
4 using namespace reco;
5 
6 // template <unsigned int N>
7 // struct vT_find
8 // {
9 // typedef typename CachingVertex<N>::RefCountedVertexTrack RefCountedVertexTrack;
10 // bool operator()(const CachingVertex<5> & v, const RefCountedVertexTrack t)
11 // {
12 // //initial tracks
13 // vector<RefCountedVertexTrack> tracks = v.tracks();
14 // vector<RefCountedVertexTrack>::iterator pos
15 // = find_if(tracks.begin(), tracks.end(), VertexTrackEqual(t));
16 // return (pos != tracks.end());
17 // }
18 // };
19 
21  const RefCountedVertexTrack tr,
22  unsigned int hint) const {
23  //checking if the track passed really belongs to the vertex
24  std::vector<RefCountedVertexTrack> tracks = vertex.tracks();
25  std::vector<RefCountedVertexTrack>::iterator pos = find_if(tracks.begin(), tracks.end(), VertexTrackEqual<5>(tr));
26  if (pos != tracks.end()) {
27  return estimateFittedTrack(vertex, *pos);
28  } else {
29  return estimateNFittedTrack(vertex, tr);
30  }
31 }
32 
35  unsigned int hint) const {
36  RefCountedVertexTrack vertexTrack = vTrackFactory.vertexTrack(track, vertex.vertexState());
37  return estimate(vertex, vertexTrack);
38 }
39 
41  const reco::TransientTrack& track) const {
42  // GlobalPoint linP(vertex.position().x(), vertex.position().z(),vertex.position().z());
43  GlobalPoint linP(Basic3DVector<float>(vertex.position()));
44 
45  RefCountedLinearizedTrackState linTrack = lTrackFactory.linearizedTrackState(linP, track);
46  GlobalError err(vertex.covariance());
47  VertexState vState(linP, err);
48  RefCountedVertexTrack vertexTrack = vTrackFactory.vertexTrack(linTrack, vState);
49 
50  std::vector<RefCountedVertexTrack> initialTracks(1, vertexTrack);
51  CachingVertex<5> cachingVertex(linP, err, initialTracks, vertex.chi2());
52  // FIXME: this should work also for tracks without a persistent ref.
53  // const TrackTransientTrack* ttt = dynamic_cast<const TrackTransientTrack*>(track.basicTransientTrack());
54  // if ((ttt!=0) &&
55  if (find(vertex.tracks_begin(), vertex.tracks_end(), track.trackBaseRef()) != vertex.tracks_end()) {
56  return estimateFittedTrack(cachingVertex, vertexTrack);
57  } else {
58  return estimateNFittedTrack(cachingVertex, vertexTrack);
59  }
60 }
61 
62 // methods to calculate track<-->vertex compatibility
63 // with the track belonging to the vertex
64 
66  const CachingVertex<5>& v, const RefCountedVertexTrack track) const {
67  //remove track from the vertex using the vertex updator
68  // Using the update instead of the remove methode, we can specify a weight which
69  // is different than then one which the vertex track has been defined with.
70  if (track->refittedStateAvailable())
71  return BDpair(true, track->smoothedChi2());
72  throw VertexException("GsfVertexTrackCompatibilityEstimator::vertex has to be smoothed.");
73 
74  // CachingVertex rVert = updator.remove(v, track);
75  // RefCountedVertexTrack newSmoothedTrack = trackUpdator.update(v, track);
76  // return estimateDifference(v,rVert,newSmoothedTrack);
77 }
78 
79 // method calculating track<-->vertex compatibility
80 //with the track not belonging to vertex
82  const CachingVertex<5>& v, const RefCountedVertexTrack track) const {
83  // Using the update instead of the add methode, we can specify a weight which
84  // is different than then one which the vertex track has been defined with.
85  CachingVertex<5> rVert = updator.add(v, track);
86  if (!rVert.isValid())
87  return BDpair(false, -1.);
88  return BDpair(true, rVert.totalChiSquared() - v.totalChiSquared());
89 }
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
VertexException
Common base class.
Definition: VertexException.h:12
CachingVertex< 5 >
pos
Definition: PixelAliasList.h:18
GsfVertexTrackCompatibilityEstimator::RefCountedVertexTrack
CachingVertex< 5 >::RefCountedVertexTrack RefCountedVertexTrack
Definition: GsfVertexTrackCompatibilityEstimator.h:26
ReferenceCountingPointer< LinearizedTrackState< N > >
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
findQualityFiles.v
v
Definition: findQualityFiles.py:179
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
GsfVertexTrackCompatibilityEstimator::estimateNFittedTrack
BDpair estimateNFittedTrack(const CachingVertex< 5 > &v, const RefCountedVertexTrack track) const
Definition: GsfVertexTrackCompatibilityEstimator.cc:81
Point3DBase< float, GlobalTag >
CachingVertex::totalChiSquared
float totalChiSquared() const
Definition: CachingVertex.h:159
GsfVertexTrackCompatibilityEstimator::estimate
BDpair estimate(const CachingVertex< 5 > &vrt, const RefCountedVertexTrack track, unsigned int hint=UINT_MAX) const override
Definition: GsfVertexTrackCompatibilityEstimator.cc:20
HLT_FULL_cff.updator
updator
Definition: HLT_FULL_cff.py:123
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
GsfVertexTrackCompatibilityEstimator.h
VertexTrackCompatibilityEstimator< 5 >::BDpair
std::pair< bool, double > BDpair
Definition: VertexTrackCompatibilityEstimator.h:19
TrackTransientTrack.h
GlobalErrorBase< double, ErrorMatrixTag >
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
reco::TransientTrack
Definition: TransientTrack.h:19
VertexState
Definition: VertexState.h:13
CachingVertex::isValid
bool isValid() const
Definition: CachingVertex.h:154
VertexTrackEqual
Definition: VertexTrack.h:114
GsfVertexTrackCompatibilityEstimator::estimateFittedTrack
BDpair estimateFittedTrack(const CachingVertex< 5 > &v, const RefCountedVertexTrack track) const
Definition: GsfVertexTrackCompatibilityEstimator.cc:65
Basic3DVector< float >
reco::Vertex
Definition: Vertex.h:35