CMS 3D CMS Logo

GhostTrackVertexFinder.cc
Go to the documentation of this file.
1 #include <algorithm>
2 #include <iterator>
3 #include <memory>
4 
5 #include <map>
6 #include <set>
7 #include <vector>
8 
9 #include <Math/SVector.h>
10 #include <Math/SMatrix.h>
11 #include <Math/MatrixFunctions.h>
12 
16 
18 
25 
39 
46 
48 
49 // #define DEBUG
50 
51 #ifdef DEBUG
53 #endif
54 
55 using namespace reco;
56 
57 namespace {
58  using namespace ROOT::Math;
59 
60  typedef SVector<double, 3> Vector3;
61 
62  typedef SMatrix<double, 3, 3, MatRepSym<double, 3> > Matrix3S;
63  typedef SMatrix<double, 2, 2, MatRepSym<double, 2> > Matrix2S;
64  typedef SMatrix<double, 2, 3> Matrix23;
65 
66  typedef ReferenceCountingPointer<VertexTrack<5> > RefCountedVertexTrack;
67  typedef ReferenceCountingPointer<LinearizedTrackState<5> > RefCountedLinearizedTrackState;
68 
69  struct VtxTrackIs {
70  VtxTrackIs(const TransientTrack &track) : track(track) {}
71  bool operator()(const RefCountedVertexTrack &vtxTrack) const {
72  return vtxTrack->linearizedTrack()->track() == track;
73  }
74 
75  const TransientTrack &track;
76  };
77 
78  inline Vector3 conv(const GlobalVector &vec) {
79  Vector3 result;
80  result[0] = vec.x();
81  result[1] = vec.y();
82  result[2] = vec.z();
83  return result;
84  }
85 
86  inline double sqr(double arg) { return arg * arg; }
87 } // namespace
88 
91  const GhostTrack &ghostTrack,
92  const BeamSpot &beamSpot,
93  bool hasBeamSpot,
94  bool hasPrimaries)
96  pred(ghostTrack.prediction()),
102  field(nullptr) {}
103 
107  std::vector<GhostTrackState> states;
113 };
114 
116  return TransientTrackFromFTSFactory().build(pred.fts(field));
117 }
118 
119 static double vtxErrorLong(const GlobalError &error, const GlobalVector &dir) {
120  return ROOT::Math::Similarity(conv(dir), error.matrix());
121 }
122 
123 static GlobalPoint vtxMean(const GlobalPoint &p1, const GlobalError &e1, const GlobalPoint &p2, const GlobalError &e2) {
124  GlobalVector diff = p2 - p1;
125 
126  double err1 = vtxErrorLong(e1, diff);
127  double err2 = vtxErrorLong(e2, diff);
128 
129  double weight = err1 / (err1 + err2);
130 
131  return p1 + weight * diff;
132 }
133 
134 static VertexState stateMean(const VertexState &v1, const VertexState &v2) {
135  return VertexState(vtxMean(v1.position(), v1.error(), v2.position(), v2.error()), v1.error() + v2.error());
136 }
137 
138 static bool covarianceUpdate(
139  Matrix3S &cov, const Vector3 &residual, const Matrix3S &error, double &chi2, double theta, double phi) {
140  using namespace ROOT::Math;
141 
142  Matrix23 jacobian;
143  jacobian(0, 0) = std::cos(phi) * std::cos(theta);
144  jacobian(0, 1) = std::sin(phi) * std::cos(theta);
145  jacobian(0, 2) = -std::sin(theta);
146  jacobian(1, 0) = -std::sin(phi);
147  jacobian(1, 1) = std::cos(phi);
148 
149  Matrix2S measErr = Similarity(jacobian, error);
150  Matrix2S combErr = Similarity(jacobian, cov) + measErr;
151  if (!measErr.Invert() || !combErr.Invert())
152  return false;
153 
154  cov -= SimilarityT(jacobian * cov, combErr);
155  chi2 += Similarity(jacobian * residual, measErr);
156 
157  return true;
158 }
159 
161  const GhostTrackPrediction &pred,
162  const GhostTrackState &state) {
163  LinearizedTrackStateFactory linTrackFactory;
164  VertexTrackFactory<5> vertexTrackFactory;
165 
166  if (!state.isValid())
167  return CachingVertex<5>();
168 
169  GlobalPoint pca1 = pred.position(state.lambda());
170  GlobalError err1 = pred.positionError(state.lambda());
171 
172  GlobalPoint pca2 = state.globalPosition();
173  GlobalError err2 = state.cartesianError();
174 
175  GlobalPoint point = vtxMean(pca1, err1, pca2, err2);
176 
177  const TransientTrack &recTrack = state.track();
178 
179  RefCountedLinearizedTrackState linState[2] = {linTrackFactory.linearizedTrackState(point, ghostTrack),
180  linTrackFactory.linearizedTrackState(point, recTrack)};
181  if (!linState[0]->isValid() || !linState[1]->isValid())
182  return CachingVertex<5>();
183 
184  Matrix3S cov = SMatrixIdentity();
185  cov *= 10000;
186  double chi2 = 0.;
187  if (!covarianceUpdate(cov,
188  conv(pca1 - point),
189  err1.matrix(),
190  chi2,
191  linState[0]->predictedStateParameters()[1],
192  linState[0]->predictedStateParameters()[2]) ||
193  !covarianceUpdate(cov,
194  conv(pca2 - point),
195  err2.matrix(),
196  chi2,
197  linState[1]->predictedStateParameters()[1],
198  linState[1]->predictedStateParameters()[2]))
199  return CachingVertex<5>();
200 
201  GlobalError error(cov);
202  VertexState vtxState(point, error);
203 
204  std::vector<RefCountedVertexTrack> linTracks(2);
205  linTracks[0] = vertexTrackFactory.vertexTrack(linState[0], vtxState);
206  linTracks[1] = vertexTrackFactory.vertexTrack(linState[1], vtxState);
207 
208  return CachingVertex<5>(point, error, linTracks, chi2);
209 }
210 
211 static RefCountedVertexTrack relinearizeTrack(const RefCountedVertexTrack &track,
212  const VertexState &state,
213  const VertexTrackFactory<5> factory) {
214  RefCountedLinearizedTrackState linTrack = track->linearizedTrack();
215  linTrack = linTrack->stateWithNewLinearizationPoint(state.position());
216  return factory.vertexTrack(linTrack, state);
217 }
218 
219 static std::vector<RefCountedVertexTrack> relinearizeTracks(const std::vector<RefCountedVertexTrack> &tracks,
220  const VertexState &state) {
221  VertexTrackFactory<5> vertexTrackFactory;
222 
223  std::vector<RefCountedVertexTrack> finalTracks;
224  finalTracks.reserve(tracks.size());
225 
226  for (std::vector<RefCountedVertexTrack>::const_iterator iter = tracks.begin(); iter != tracks.end(); ++iter)
227  finalTracks.push_back(relinearizeTrack(*iter, state, vertexTrackFactory));
228 
229  return finalTracks;
230 }
231 
233  const CachingVertex<5> &vtx1, const CachingVertex<5> &vtx2, const FinderInfo &info, double scale1, double scale2) {
234  Vector3 diff = conv(vtx2.position() - vtx1.position());
235  Matrix3S cov = scale1 * vtx1.error().matrix() + scale2 * vtx2.error().matrix();
236 
237  return sqr(ROOT::Math::Dot(diff, diff)) / ROOT::Math::Similarity(cov, diff);
238 }
239 
240 static double trackVertexCompat(const CachingVertex<5> &vtx, const RefCountedVertexTrack &vertexTrack) {
241  using namespace ROOT::Math;
242 
243  TransientTrack track = vertexTrack->linearizedTrack()->track();
244  GlobalPoint point = vtx.position();
246  TrajectoryStateOnSurface tsos = extrap.extrapolate(track.impactPointState(), point);
247 
248  if (!tsos.isValid())
249  return 1.0e6;
250 
251  GlobalPoint point1 = vtx.position();
252  GlobalPoint point2 = tsos.globalPosition();
253  Vector3 dir = conv(point2 - point1);
254  Matrix3S error = vtx.error().matrix() + tsos.cartesianError().matrix().Sub<Matrix3S>(0, 0);
255  if (!error.Invert())
256  return 1.0e6;
257 
258  return ROOT::Math::Similarity(error, dir);
259 }
260 
262  : maxFitChi2_(10.0), mergeThreshold_(3.0), primcut_(2.0), seccut_(5.0), fitType_(kAlwaysWithGhostTrack) {}
263 
265  double maxFitChi2, double mergeThreshold, double primcut, double seccut, FitType fitType)
266  : maxFitChi2_(maxFitChi2), mergeThreshold_(mergeThreshold), primcut_(primcut), seccut_(seccut), fitType_(fitType) {}
267 
269 
271  if (!ghostTrackFitter_.get())
272  ghostTrackFitter_ = std::make_unique<GhostTrackFitter>();
273 
274  return *ghostTrackFitter_;
275 }
276 
278  std::unique_ptr<VertexFitter<5> > *ptr = primary ? &primVertexFitter_ : &secVertexFitter_;
279  if (!ptr->get())
280  *ptr = std::make_unique<AdaptiveVertexFitter>(GeometricAnnealing(primary ? primcut_ : seccut_));
281 
282  return **ptr;
283 }
284 
285 #ifdef DEBUG
286 static void debugTrack(const TransientTrack &track, const TransientVertex *vtx = 0) {
287  const FreeTrajectoryState &fts = track.initialFreeState();
288  GlobalVector mom = fts.momentum();
289  std::cout << "\tpt = " << mom.perp() << ", eta = " << mom.eta() << ", phi = " << mom.phi()
290  << ", charge = " << fts.charge();
291  if (vtx && vtx->hasTrackWeight())
292  std::cout << ", w = " << vtx->trackWeight(track) << std::endl;
293  else
294  std::cout << std::endl;
295 }
296 
297 static void debugTracks(const std::vector<TransientTrack> &tracks, const TransientVertex *vtx = 0) {
298  TrackKinematics kin;
299  for (std::vector<TransientTrack>::const_iterator iter = tracks.begin(); iter != tracks.end(); ++iter) {
300  debugTrack(*iter, vtx);
301  try {
302  TrackBaseRef track = iter->trackBaseRef();
303  kin.add(*track);
304  } catch (exception const &e) {
305  // ignore, yeah this is debugging, so shut up ^^
306  }
307  }
308 
309  std::cout << "mass = " << kin.vectorSum().M() << std::endl;
310 }
311 
312 static void debugTracks(const std::vector<RefCountedVertexTrack> &tracks) {
313  std::vector<TransientTrack> tracks_;
314  for (std::vector<RefCountedVertexTrack>::const_iterator iter = tracks.begin(); iter != tracks.end(); ++iter) {
315  std::cout << "+ " << (*iter)->linearizedTrack()->linearizationPoint() << std::endl;
316  tracks_.push_back((*iter)->linearizedTrack()->track());
317  }
318  debugTracks(tracks_);
319 }
320 
321 static void debugVertex(const TransientVertex &vtx, const GhostTrackPrediction &pred) {
322  double origin = 0.;
323  std::cout << vtx.position() << "-> " << vtx.totalChiSquared() << " with " << vtx.degreesOfFreedom() << std::endl;
324 
325  double err = std::sqrt(vtxErrorLong(vtx.positionError(), pred.direction()) / pred.rho2());
326  std::cout << "* " << (pred.lambda(vtx.position()) * pred.rho() - origin) << " +-" << err << " => "
327  << ((pred.lambda(vtx.position()) * pred.rho() - origin) / err) << std::endl;
328 
329  std::vector<TransientTrack> tracks = vtx.originalTracks();
330  debugTracks(tracks, &vtx);
331 }
332 #endif
333 
334 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const Vertex &primaryVertex,
335  const GlobalVector &direction,
336  double coneRadius,
337  const std::vector<TransientTrack> &tracks) const {
338  return vertices(RecoVertex::convertPos(primaryVertex.position()),
340  direction,
341  coneRadius,
342  tracks);
343 }
344 
345 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const Vertex &primaryVertex,
346  const GlobalVector &direction,
347  double coneRadius,
348  const reco::BeamSpot &beamSpot,
349  const std::vector<TransientTrack> &tracks) const {
350  return vertices(RecoVertex::convertPos(primaryVertex.position()),
352  direction,
353  coneRadius,
354  beamSpot,
355  tracks);
356 }
357 
358 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const Vertex &primaryVertex,
359  const GlobalVector &direction,
360  double coneRadius,
361  const reco::BeamSpot &beamSpot,
362  const std::vector<TransientTrack> &primaries,
363  const std::vector<TransientTrack> &tracks) const {
364  return vertices(RecoVertex::convertPos(primaryVertex.position()),
366  direction,
367  coneRadius,
368  beamSpot,
369  primaries,
370  tracks);
371 }
372 
373 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const GlobalPoint &primaryPosition,
374  const GlobalError &primaryError,
375  const GlobalVector &direction,
376  double coneRadius,
377  const std::vector<TransientTrack> &tracks) const {
378  GhostTrack ghostTrack = ghostTrackFitter().fit(primaryPosition, primaryError, direction, coneRadius, tracks);
379 
380  CachingVertex<5> primary(primaryPosition, primaryError, std::vector<RefCountedVertexTrack>(), 0.);
381 
382  std::vector<TransientVertex> result = vertices(ghostTrack, primary);
383 
384 #ifdef DEBUG
385  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
386  debugVertex(*iter, ghostTrack.prediction());
387 #endif
388 
389  return result;
390 }
391 
392 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const GlobalPoint &primaryPosition,
393  const GlobalError &primaryError,
394  const GlobalVector &direction,
395  double coneRadius,
396  const BeamSpot &beamSpot,
397  const std::vector<TransientTrack> &tracks) const {
398  GhostTrack ghostTrack = ghostTrackFitter().fit(primaryPosition, primaryError, direction, coneRadius, tracks);
399 
400  CachingVertex<5> primary(primaryPosition, primaryError, std::vector<RefCountedVertexTrack>(), 0.);
401 
402  std::vector<TransientVertex> result = vertices(ghostTrack, primary, beamSpot, true);
403 
404 #ifdef DEBUG
405  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
406  debugVertex(*iter, ghostTrack.prediction());
407 #endif
408 
409  return result;
410 }
411 
412 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const GlobalPoint &primaryPosition,
413  const GlobalError &primaryError,
414  const GlobalVector &direction,
415  double coneRadius,
416  const BeamSpot &beamSpot,
417  const std::vector<TransientTrack> &primaries,
418  const std::vector<TransientTrack> &tracks) const {
419  GhostTrack ghostTrack = ghostTrackFitter().fit(primaryPosition, primaryError, direction, coneRadius, tracks);
420 
421  std::vector<RefCountedVertexTrack> primaryVertexTracks;
422  if (!primaries.empty()) {
423  LinearizedTrackStateFactory linTrackFactory;
424  VertexTrackFactory<5> vertexTrackFactory;
425 
426  VertexState state(primaryPosition, primaryError);
427 
428  for (std::vector<TransientTrack>::const_iterator iter = primaries.begin(); iter != primaries.end(); ++iter) {
429  RefCountedLinearizedTrackState linState = linTrackFactory.linearizedTrackState(primaryPosition, *iter);
430 
431  primaryVertexTracks.push_back(vertexTrackFactory.vertexTrack(linState, state));
432  }
433  }
434 
435  CachingVertex<5> primary(primaryPosition, primaryError, primaryVertexTracks, 0.);
436 
437  std::vector<TransientVertex> result = vertices(ghostTrack, primary, beamSpot, true, true);
438 
439 #ifdef DEBUG
440  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
441  debugVertex(*iter, ghostTrack.prediction());
442 #endif
443 
444  return result;
445 }
446 
447 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const GlobalPoint &primaryPosition,
448  const GlobalError &primaryError,
449  const GhostTrack &ghostTrack) const {
450  CachingVertex<5> primary(primaryPosition, primaryError, std::vector<RefCountedVertexTrack>(), 0.);
451 
452  std::vector<TransientVertex> result = vertices(ghostTrack, primary);
453 
454 #ifdef DEBUG
455  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
456  debugVertex(*iter, ghostTrack.prediction());
457 #endif
458 
459  return result;
460 }
461 
462 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const GlobalPoint &primaryPosition,
463  const GlobalError &primaryError,
464  const BeamSpot &beamSpot,
465  const GhostTrack &ghostTrack) const {
466  CachingVertex<5> primary(primaryPosition, primaryError, std::vector<RefCountedVertexTrack>(), 0.);
467 
468  std::vector<TransientVertex> result = vertices(ghostTrack, primary, beamSpot, true);
469 
470 #ifdef DEBUG
471  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
472  debugVertex(*iter, ghostTrack.prediction());
473 #endif
474 
475  return result;
476 }
477 
478 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const GlobalPoint &primaryPosition,
479  const GlobalError &primaryError,
480  const BeamSpot &beamSpot,
481  const std::vector<TransientTrack> &primaries,
482  const GhostTrack &ghostTrack) const {
483  std::vector<RefCountedVertexTrack> primaryVertexTracks;
484  if (!primaries.empty()) {
485  LinearizedTrackStateFactory linTrackFactory;
486  VertexTrackFactory<5> vertexTrackFactory;
487 
488  VertexState state(primaryPosition, primaryError);
489 
490  for (std::vector<TransientTrack>::const_iterator iter = primaries.begin(); iter != primaries.end(); ++iter) {
491  RefCountedLinearizedTrackState linState = linTrackFactory.linearizedTrackState(primaryPosition, *iter);
492 
493  primaryVertexTracks.push_back(vertexTrackFactory.vertexTrack(linState, state));
494  }
495  }
496 
497  CachingVertex<5> primary(primaryPosition, primaryError, primaryVertexTracks, 0.);
498 
499  std::vector<TransientVertex> result = vertices(ghostTrack, primary, beamSpot, true, true);
500 
501 #ifdef DEBUG
502  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
503  debugVertex(*iter, ghostTrack.prediction());
504 #endif
505 
506  return result;
507 }
508 
509 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const Vertex &primaryVertex,
510  const GhostTrack &ghostTrack) const {
511  return vertices(
513 }
514 
515 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const Vertex &primaryVertex,
516  const BeamSpot &beamSpot,
517  const GhostTrack &ghostTrack) const {
518  return vertices(RecoVertex::convertPos(primaryVertex.position()),
520  beamSpot,
521  ghostTrack);
522 }
523 
524 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const Vertex &primaryVertex,
525  const BeamSpot &beamSpot,
526  const std::vector<TransientTrack> &primaries,
527  const GhostTrack &ghostTrack) const {
528  return vertices(RecoVertex::convertPos(primaryVertex.position()),
530  beamSpot,
531  primaries,
532  ghostTrack);
533 }
534 
535 static GhostTrackPrediction dummyPrediction(const Vertex &primaryVertex, const Track &ghostTrack) {
538  GlobalVector(ghostTrack.px(), ghostTrack.py(), ghostTrack.pz()),
539  0.05);
540 }
541 
542 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const Vertex &primaryVertex,
543  const Track &ghostTrack,
544  const std::vector<TransientTrack> &tracks,
545  const std::vector<float> &weights) const {
546  GhostTrack ghostTrack_(ghostTrack,
547  tracks,
548  weights,
549  dummyPrediction(primaryVertex, ghostTrack),
551  true);
552 
555  std::vector<RefCountedVertexTrack>(),
556  0.);
557 
558  std::vector<TransientVertex> result = vertices(ghostTrack_, primary);
559 
560 #ifdef DEBUG
561  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
562  debugVertex(*iter, ghostTrack_.prediction());
563 #endif
564 
565  return result;
566 }
567 
568 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const Vertex &primaryVertex,
569  const Track &ghostTrack,
570  const BeamSpot &beamSpot,
571  const std::vector<TransientTrack> &tracks,
572  const std::vector<float> &weights) const {
573  GhostTrack ghostTrack_(ghostTrack,
574  tracks,
575  weights,
576  dummyPrediction(primaryVertex, ghostTrack),
578  true);
579 
582  std::vector<RefCountedVertexTrack>(),
583  0.);
584 
585  std::vector<TransientVertex> result = vertices(ghostTrack_, primary, beamSpot, true);
586 
587 #ifdef DEBUG
588  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
589  debugVertex(*iter, ghostTrack_.prediction());
590 #endif
591 
592  return result;
593 }
594 
595 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const Vertex &primaryVertex,
596  const Track &ghostTrack,
597  const BeamSpot &beamSpot,
598  const std::vector<TransientTrack> &primaries,
599  const std::vector<TransientTrack> &tracks,
600  const std::vector<float> &weights) const {
601  GhostTrack ghostTrack_(ghostTrack,
602  tracks,
603  weights,
604  dummyPrediction(primaryVertex, ghostTrack),
606  true);
607 
608  std::vector<RefCountedVertexTrack> primaryVertexTracks;
609  if (!primaries.empty()) {
610  LinearizedTrackStateFactory linTrackFactory;
611  VertexTrackFactory<5> vertexTrackFactory;
612 
615 
616  for (std::vector<TransientTrack>::const_iterator iter = primaries.begin(); iter != primaries.end(); ++iter) {
617  RefCountedLinearizedTrackState linState = linTrackFactory.linearizedTrackState(state.position(), *iter);
618 
619  primaryVertexTracks.push_back(vertexTrackFactory.vertexTrack(linState, state));
620  }
621  }
622 
625  primaryVertexTracks,
626  0.);
627 
628  std::vector<TransientVertex> result = vertices(ghostTrack_, primary, beamSpot, true, true);
629 
630 #ifdef DEBUG
631  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
632  debugVertex(*iter, ghostTrack_.prediction());
633 #endif
634 
635  return result;
636 }
637 
638 static double fitChi2(const CachingVertex<5> &vtx) { return vtx.totalChiSquared() / vtx.degreesOfFreedom(); }
639 
640 std::vector<CachingVertex<5> > GhostTrackVertexFinder::initialVertices(const FinderInfo &info) const {
641  std::vector<CachingVertex<5> > vertices;
642  for (std::vector<GhostTrackState>::const_iterator iter = info.states.begin(); iter != info.states.end(); ++iter) {
643  if (!iter->isValid())
644  continue;
645 
646  GhostTrackState state(*iter);
647  state.linearize(info.pred);
648 
649  if (!state.isValid())
650  continue;
651 
652  CachingVertex<5> vtx = vertexAtState(info.ghostTrack, info.pred, state);
653 
654  if (vtx.isValid()) // && fitChi2(vtx) < maxFitChi2_)
655  vertices.push_back(vtx);
656  }
657 
658  return vertices;
659 }
660 
661 static void mergeTrackHelper(const std::vector<RefCountedVertexTrack> &tracks,
662  std::vector<RefCountedVertexTrack> &newTracks,
663  const VertexState &state,
664  const VtxTrackIs &ghostTrackFinder,
665  RefCountedVertexTrack &ghostTrack,
666  const VertexTrackFactory<5> &factory) {
667  for (std::vector<RefCountedVertexTrack>::const_iterator iter = tracks.begin(); iter != tracks.end(); ++iter) {
668  bool gt = ghostTrackFinder(*iter);
669  if (gt && ghostTrack)
670  continue;
671 
672  RefCountedVertexTrack track = relinearizeTrack(*iter, state, factory);
673 
674  if (gt)
675  ghostTrack = *iter;
676  else
677  newTracks.push_back(*iter);
678  }
679 }
680 
682  const CachingVertex<5> &vertex2,
683  const FinderInfo &info,
684  bool isPrimary) const {
685  VertexTrackFactory<5> vertexTrackFactory;
686 
687  VertexState state = stateMean(vertex1.vertexState(), vertex2.vertexState());
688  std::vector<RefCountedVertexTrack> linTracks;
689  VtxTrackIs isGhostTrack(info.ghostTrack);
690  RefCountedVertexTrack vtxGhostTrack;
691 
692  mergeTrackHelper(vertex1.tracks(), linTracks, state, isGhostTrack, vtxGhostTrack, vertexTrackFactory);
693  mergeTrackHelper(vertex2.tracks(), linTracks, state, isGhostTrack, vtxGhostTrack, vertexTrackFactory);
694 
695  if (vtxGhostTrack && (fitType_ == kAlwaysWithGhostTrack || linTracks.size() < 2))
696  linTracks.push_back(vertexTrackFactory.vertexTrack(vtxGhostTrack->linearizedTrack(), vtxGhostTrack->vertexState()));
697 
698  try {
700  if (info.hasBeamSpot && isPrimary)
701  vtx = vertexFitter(true).vertex(linTracks, info.beamSpot.position(), info.beamSpot.error());
702  else
703  vtx = vertexFitter(isPrimary).vertex(linTracks);
704  if (vtx.isValid())
705  return vtx;
706  } catch (const VertexException &e) {
707  // fit failed
708  }
709 
710  return CachingVertex<5>();
711 }
712 
714  typedef std::pair<unsigned int, unsigned int> Indices;
715 
716  std::multimap<float, Indices> compatMap;
717  unsigned int n = vertices.size();
718  for (unsigned int i = 0; i < n; i++) {
719  const CachingVertex<5> &v1 = vertices[i];
720  for (unsigned int j = i + 1; j < n; j++) {
721  const CachingVertex<5> &v2 = vertices[j];
722 
723  float compat = vertexCompat(v1, v2, info, i == 0 ? primcut_ : seccut_, seccut_);
724 
725  if (compat > mergeThreshold_)
726  continue;
727 
728  compatMap.insert(std::make_pair(compat, Indices(i, j)));
729  }
730  }
731 
732  bool changesMade = false;
733  bool repeat = true;
734  while (repeat) {
735  repeat = false;
736  for (std::multimap<float, Indices>::const_iterator iter = compatMap.begin(); iter != compatMap.end(); ++iter) {
737  unsigned int v1 = iter->second.first;
738  unsigned int v2 = iter->second.second;
739 
741  if (!newVtx.isValid() || (v1 != 0 && fitChi2(newVtx) > maxFitChi2_))
742  continue;
743 
744  std::swap(vertices[v1], newVtx);
745  vertices.erase(vertices.begin() + v2);
746  n--;
747 
748  std::multimap<float, Indices> newCompatMap;
749  for (++iter; iter != compatMap.end(); ++iter) {
750  if (iter->second.first == v1 || iter->second.first == v2 || iter->second.second == v1 ||
751  iter->second.second == v2)
752  continue;
753 
754  Indices indices = iter->second;
755  indices.first -= indices.first > v2;
756  indices.second -= indices.second > v2;
757 
758  newCompatMap.insert(std::make_pair(iter->first, indices));
759  }
760  std::swap(compatMap, newCompatMap);
761 
762  for (unsigned int i = 0; i < n; i++) {
763  if (i == v1)
764  continue;
765 
766  const CachingVertex<5> &other = vertices[i];
767  float compat =
768  vertexCompat(vertices[v1], other, info, v1 == 0 ? primcut_ : seccut_, i == 0 ? primcut_ : seccut_);
769 
770  if (compat > mergeThreshold_)
771  continue;
772 
773  compatMap.insert(std::make_pair(compat, Indices(std::min(i, v1), std::max(i, v1))));
774  }
775 
776  changesMade = true;
777  repeat = true;
778  break;
779  }
780  }
781 
782  return changesMade;
783 }
784 
786  std::vector<std::pair<RefCountedVertexTrack, std::vector<RefCountedVertexTrack> > > trackBundles(vertices_.size());
787 
788  VtxTrackIs isGhostTrack(info.ghostTrack);
789 
790  bool assignmentChanged = false;
791  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices_.begin(); iter != vertices_.end(); ++iter) {
792  std::vector<RefCountedVertexTrack> vtxTracks = iter->tracks();
793 
794  if (vtxTracks.empty()) {
795  LinearizedTrackStateFactory linTrackFactory;
796  VertexTrackFactory<5> vertexTrackFactory;
797 
798  RefCountedLinearizedTrackState linState = linTrackFactory.linearizedTrackState(iter->position(), info.ghostTrack);
799 
800  trackBundles[iter - vertices_.begin()].first = vertexTrackFactory.vertexTrack(linState, iter->vertexState());
801  }
802 
803  for (std::vector<RefCountedVertexTrack>::const_iterator track = vtxTracks.begin(); track != vtxTracks.end();
804  ++track) {
805  if (isGhostTrack(*track)) {
806  trackBundles[iter - vertices_.begin()].first = *track;
807  continue;
808  }
809 
810  if ((*track)->weight() < 1e-3) {
811  trackBundles[iter - vertices_.begin()].second.push_back(*track);
812  continue;
813  }
814 
815  unsigned int idx = iter - vertices_.begin();
816  double best = 1.0e9;
817  for (std::vector<CachingVertex<5> >::const_iterator vtx = vertices_.begin(); vtx != vertices_.end(); ++vtx) {
818  if (info.pred.lambda(vtx->position()) < info.pred.lambda(vertices_[0].position()))
819  continue;
820 
821  double compat = sqr(trackVertexCompat(*vtx, *track));
822 
823  compat /= (vtx == vertices_.begin()) ? primcut_ : seccut_;
824 
825  if (compat < best) {
826  best = compat;
827  idx = vtx - vertices_.begin();
828  }
829  }
830 
831  if ((int)idx != iter - vertices_.begin())
832  assignmentChanged = true;
833 
834  trackBundles[idx].second.push_back(*track);
835  }
836  }
837 
838  if (!assignmentChanged)
839  return false;
840 
841  VertexTrackFactory<5> vertexTrackFactory;
842  std::vector<CachingVertex<5> > vertices;
843  vertices.reserve(vertices_.size());
844 
845  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices_.begin(); iter != vertices_.end(); ++iter) {
846  const std::vector<RefCountedVertexTrack> &tracks = trackBundles[iter - vertices_.begin()].second;
847  if (tracks.empty())
848  continue;
849 
851 
852  if (tracks.size() == 1) {
853  const TransientTrack &track = tracks[0]->linearizedTrack()->track();
854 
855  int idx = -1;
856  for (std::vector<GhostTrackState>::const_iterator iter = info.states.begin(); iter != info.states.end(); ++iter) {
857  if (iter->isTrack() && iter->track() == track) {
858  idx = iter - info.states.begin();
859  break;
860  }
861  }
862  if (idx < 0)
863  continue;
864 
865  vtx = vertexAtState(info.ghostTrack, info.pred, info.states[idx]);
866  if (!vtx.isValid())
867  continue;
868  } else {
869  std::vector<RefCountedVertexTrack> linTracks = relinearizeTracks(tracks, iter->vertexState());
870 
872  linTracks.push_back(
873  relinearizeTrack(trackBundles[iter - vertices_.begin()].first, iter->vertexState(), vertexTrackFactory));
874 
875  bool primary = iter == vertices_.begin();
876  try {
877  if (primary && info.hasBeamSpot)
878  vtx = vertexFitter(true).vertex(linTracks, info.beamSpot.position(), info.beamSpot.error());
879  else
880  vtx = vertexFitter(primary).vertex(linTracks);
881  } catch (const VertexException &e) {
882  // fit failed;
883  }
884  if (!vtx.isValid())
885  return false;
886  }
887 
888  vertices.push_back(vtx);
889  };
890 
891  std::swap(vertices_, vertices);
892  return true;
893 }
894 
896  VtxTrackIs isGhostTrack(info.ghostTrack);
897 
898  std::vector<GhostTrackState> states;
899  std::vector<unsigned int> oldStates;
900  oldStates.reserve(info.states.size());
901 
902  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices.begin(); iter != vertices.end(); ++iter) {
903  std::vector<RefCountedVertexTrack> vtxTracks = iter->tracks();
904 
905  oldStates.clear();
906  for (std::vector<RefCountedVertexTrack>::const_iterator track = vtxTracks.begin(); track != vtxTracks.end();
907  ++track) {
908  if (isGhostTrack(*track) || (*track)->weight() < 1e-3)
909  continue;
910 
911  const TransientTrack &tt = (*track)->linearizedTrack()->track();
912 
913  int idx = -1;
914  for (std::vector<GhostTrackState>::const_iterator iter = info.states.begin(); iter != info.states.end(); ++iter) {
915  if (iter->isTrack() && iter->track() == tt) {
916  idx = iter - info.states.begin();
917  break;
918  }
919  }
920 
921  if (idx >= 0)
922  oldStates.push_back(idx);
923  }
924 
925  if (oldStates.size() == 1)
926  states.push_back(info.states[oldStates[0]]);
927  else
928  states.push_back(GhostTrackState(iter->vertexState()));
929  }
930 
931  KalmanGhostTrackUpdater updater;
933  double ndof, chi2;
934  info.pred = fitter.fit(updater, info.prior, states, ndof, chi2);
935  TransientTrack ghostTrack = transientGhostTrack(info.pred, info.field);
936 
937  std::swap(info.states, states);
938  states.clear();
939 
940  std::vector<CachingVertex<5> > newVertices;
941  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices.begin(); iter != vertices.end(); ++iter) {
942  std::vector<RefCountedVertexTrack> vtxTracks = iter->tracks();
943 
944  int idx = -1;
945  bool redo = false;
946  for (std::vector<RefCountedVertexTrack>::iterator track = vtxTracks.begin(); track != vtxTracks.end(); ++track) {
947  if (isGhostTrack(*track)) {
948  LinearizedTrackStateFactory linTrackFactory;
949  VertexTrackFactory<5> vertexTrackFactory;
950 
951  *track = vertexTrackFactory.vertexTrack(linTrackFactory.linearizedTrackState(iter->position(), ghostTrack),
952  iter->vertexState());
953  redo = true;
954  continue;
955  }
956 
957  const TransientTrack &tt = (*track)->linearizedTrack()->track();
958 
959  if (idx >= 0) {
960  idx = -1;
961  break;
962  }
963 
964  for (std::vector<GhostTrackState>::const_iterator it = info.states.begin(); it != info.states.end(); ++it) {
965  if (!it->isTrack())
966  continue;
967 
968  if (it->track() == tt) {
969  idx = it - info.states.begin();
970  break;
971  }
972  }
973  }
974 
975  if (idx >= 0) {
976  CachingVertex<5> vtx = vertexAtState(ghostTrack, info.pred, info.states[idx]);
977  if (vtx.isValid())
978  newVertices.push_back(vtx);
979  } else if (redo) {
980  bool primary = iter == vertices.begin();
982  if (primary && info.hasBeamSpot)
983  vtx = vertexFitter(true).vertex(vtxTracks, info.beamSpot.position(), info.beamSpot.error());
984  else
985  vtx = vertexFitter(primary).vertex(vtxTracks);
986  if (vtx.isValid())
987  newVertices.push_back(vtx);
988  } else
989  newVertices.push_back(*iter);
990  }
991 
992  std::swap(newVertices, vertices);
993  info.ghostTrack = ghostTrack;
994 }
995 
996 // implementation
997 
998 std::vector<TransientVertex> GhostTrackVertexFinder::vertices(const GhostTrack &ghostTrack,
999  const CachingVertex<5> &primary,
1000  const BeamSpot &beamSpot,
1001  bool hasBeamSpot,
1002  bool hasPrimaries) const {
1003  FinderInfo info(primary, ghostTrack, beamSpot, hasBeamSpot, hasPrimaries);
1004 
1005  std::vector<TransientVertex> result;
1006  if (info.states.empty())
1007  return result;
1008 
1009  info.field = info.states[0].track().field();
1010  info.ghostTrack = transientGhostTrack(info.pred, info.field);
1011 
1012  std::vector<CachingVertex<5> > vertices = initialVertices(info);
1013  if (primary.isValid()) {
1014  vertices.push_back(primary);
1015  if (vertices.size() > 1)
1016  std::swap(vertices.front(), vertices.back());
1017  }
1018 
1019  unsigned int reassigned = 0;
1020  while (reassigned < 3) {
1021  if (vertices.size() < 2)
1022  break;
1023 
1024 #ifdef DEBUG
1025  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices.begin(); iter != vertices.end(); ++iter)
1026 
1027  debugVertex(*iter, ghostTrack.prediction());
1028 
1029  std::cout << "----- recursive merging: ---------" << std::endl;
1030 #endif
1031 
1032  bool changed = recursiveMerge(vertices, info);
1033  if ((!changed && !reassigned) || vertices.size() < 2)
1034  break;
1035  if (changed)
1036  reassigned = 0;
1037 
1040  changed = true;
1041  }
1042 
1043  try {
1044 #ifdef DEBUG
1045  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices.begin(); iter != vertices.end(); ++iter)
1046  debugVertex(*iter, ghostTrack.prediction());
1047  std::cout << "----- reassignment: ---------" << std::endl;
1048 #endif
1049  if (reassignTracks(vertices, info)) {
1050  reassigned++;
1051  changed = true;
1052  } else
1053  reassigned = 0;
1054  } catch (const VertexException &e) {
1055  // just keep vertices as they are
1056  }
1057 
1058  if (!changed)
1059  break;
1060  }
1061 
1062  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices.begin(); iter != vertices.end(); ++iter) {
1063  std::vector<RefCountedVertexTrack> tracks = iter->tracks();
1064  std::vector<RefCountedVertexTrack> newTracks;
1065  newTracks.reserve(tracks.size());
1066 
1067  std::remove_copy_if(tracks.begin(), tracks.end(), std::back_inserter(newTracks), VtxTrackIs(info.ghostTrack));
1068 
1069  if (newTracks.empty())
1070  continue;
1071 
1072  CachingVertex<5> vtx(iter->vertexState(), newTracks, iter->totalChiSquared());
1073  result.push_back(vtx);
1074  }
1075 
1076  return result;
1077 }
Vector3DBase
Definition: Vector3DBase.h:8
bTagCombinedSVVariables_cff.indices
indices
Definition: bTagCombinedSVVariables_cff.py:67
GhostTrackPrediction.h
change_name.diff
diff
Definition: change_name.py:13
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
relinearizeTrack
static RefCountedVertexTrack relinearizeTrack(const RefCountedVertexTrack &track, const VertexState &state, const VertexTrackFactory< 5 > factory)
Definition: GhostTrackVertexFinder.cc:211
reco::TrackKinematics
Definition: TrackKinematics.h:16
TrajectoryStateOnSurface.h
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:428
FreeTrajectoryState.h
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
GlobalTrajectoryParameters.h
reco::GhostTrackVertexFinder::ghostTrackFitter_
std::unique_ptr< GhostTrackFitter > ghostTrackFitter_
Definition: GhostTrackVertexFinder.h:157
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
AnalyticalImpactPointExtrapolator.h
reco::GhostTrackPrediction::positionError
GlobalError positionError(double lambda=0.) const
Definition: GhostTrackPrediction.cc:131
KalmanVertexFitter.h
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
VertexException
Common base class.
Definition: VertexException.h:12
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
conv
static HepMC::IO_HEPEVT conv
Definition: BeamHaloProducer.cc:48
reco::GhostTrackVertexFinder::FinderInfo::field
const MagneticField * field
Definition: GhostTrackVertexFinder.cc:111
min
T min(T a, T b)
Definition: MathUtil.h:58
LinearizedTrackStateFactory.h
CachingVertex< 5 >
reco::GhostTrackVertexFinder::seccut_
double seccut_
Definition: GhostTrackVertexFinder.h:154
reco::GhostTrackVertexFinder::refitGhostTrack
void refitGhostTrack(std::vector< CachingVertex< 5 > > &vertices, FinderInfo &info) const
Definition: GhostTrackVertexFinder.cc:895
reco::GhostTrackPrediction::rho
double rho() const
Definition: GhostTrackPrediction.h:54
GhostTrackFitter.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
reco::GhostTrackVertexFinder::FinderInfo::FinderInfo
FinderInfo(const CachingVertex< 5 > &primaryVertex, const GhostTrack &ghostTrack, const BeamSpot &beamSpot, bool hasBeamSpot, bool hasPrimaries)
Definition: GhostTrackVertexFinder.cc:90
FreeTrajectoryState::charge
TrackCharge charge() const
Definition: FreeTrajectoryState.h:69
dummyPrediction
static GhostTrackPrediction dummyPrediction(const Vertex &primaryVertex, const Track &ghostTrack)
Definition: GhostTrackVertexFinder.cc:535
ConvertError.h
reco::KalmanGhostTrackUpdater
Definition: KalmanGhostTrackUpdater.h:11
sqr
int sqr(const T &t)
Definition: pfalgo_common_ref.h:9
CachingVertex::vertexState
const VertexState & vertexState() const
Definition: CachingVertex.h:137
VertexFitter.h
mergeTrackHelper
static void mergeTrackHelper(const std::vector< RefCountedVertexTrack > &tracks, std::vector< RefCountedVertexTrack > &newTracks, const VertexState &state, const VtxTrackIs &ghostTrackFinder, RefCountedVertexTrack &ghostTrack, const VertexTrackFactory< 5 > &factory)
Definition: GhostTrackVertexFinder.cc:661
reco::GhostTrackVertexFinder::fitType_
FitType fitType_
Definition: GhostTrackVertexFinder.h:155
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
KalmanGhostTrackUpdater.h
reco::TrackBase::px
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:640
ConvertToFromReco.h
reco::GhostTrackVertexFinder::~GhostTrackVertexFinder
~GhostTrackVertexFinder()
Definition: GhostTrackVertexFinder.cc:268
reco::GhostTrackVertexFinder::secVertexFitter_
std::unique_ptr< VertexFitter< 5 > > secVertexFitter_
Definition: GhostTrackVertexFinder.h:159
relinearizeTracks
static std::vector< RefCountedVertexTrack > relinearizeTracks(const std::vector< RefCountedVertexTrack > &tracks, const VertexState &state)
Definition: GhostTrackVertexFinder.cc:219
GlobalErrorBase::matrix
const AlgebraicSymMatrix33 matrix() const
Definition: GlobalErrorBase.h:121
Indices
Indices
Definition: EdmEventSize.cc:28
ReferenceCountingPointer
Definition: ReferenceCounted.h:60
reco::GhostTrackVertexFinder::FinderInfo::states
std::vector< GhostTrackState > states
Definition: GhostTrackVertexFinder.cc:107
VertexDistance3D.h
GhostTrackState.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
TransientTrack.h
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
relativeConstraints.error
error
Definition: relativeConstraints.py:53
reco::SequentialGhostTrackFitter::fit
GhostTrackPrediction fit(const GhostTrackFitter::PredictionUpdater &updater, const GhostTrackPrediction &prior, std::vector< GhostTrackState > &states, double &ndof, double &chi2) override
Definition: SequentialGhostTrackFitter.cc:22
ghostTrackVertexReco_cff.fitType
fitType
Definition: ghostTrackVertexReco_cff.py:10
LinearizedTrackStateFactory::linearizedTrackState
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
Definition: LinearizedTrackStateFactory.cc:9
reco::GhostTrackState
Definition: GhostTrackState.h:21
VertexFitter< 5 >
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
HLT_FULL_cff.primcut
primcut
Definition: HLT_FULL_cff.py:51988
VertexTrackFactory.h
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
ndof
Definition: HIMultiTrackSelector.h:49
BeamMonitor_cff.primaryVertex
primaryVertex
hltOfflineBeamSpot for HLTMON
Definition: BeamMonitor_cff.py:7
CachingVertex.h
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
reco::GhostTrackVertexFinder::mergeThreshold_
double mergeThreshold_
Definition: GhostTrackVertexFinder.h:152
LinearizedTrackStateFactory
Definition: LinearizedTrackStateFactory.h:14
reco::GhostTrackVertexFinder::vertexFitter
VertexFitter< 5 > & vertexFitter(bool primary) const
Definition: GhostTrackVertexFinder.cc:277
transientGhostTrack
static TransientTrack transientGhostTrack(const GhostTrackPrediction &pred, const MagneticField *field)
Definition: GhostTrackVertexFinder.cc:115
TransientTrackFromFTSFactory.h
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
trackVertexCompat
static double trackVertexCompat(const CachingVertex< 5 > &vtx, const RefCountedVertexTrack &vertexTrack)
Definition: GhostTrackVertexFinder.cc:240
submitPVValidationJobs.gt
list gt
Definition: submitPVValidationJobs.py:663
reco::GhostTrack::prediction
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
BeamSpot.h
reco::TrackBase::py
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:643
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
CachingVertex::error
GlobalError error() const
Definition: CachingVertex.cc:318
stateMean
static VertexState stateMean(const VertexState &v1, const VertexState &v2)
Definition: GhostTrackVertexFinder.cc:134
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99244
reco::GhostTrackVertexFinder::FinderInfo::ghostTrack
TransientTrack ghostTrack
Definition: GhostTrackVertexFinder.cc:112
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::BeamSpot
Definition: BeamSpot.h:21
reco::Track
Definition: Track.h:27
reco::GhostTrackVertexFinder::FinderInfo::prior
GhostTrackPrediction prior
Definition: GhostTrackVertexFinder.cc:106
p2
double p2[4]
Definition: TauolaWrapper.h:90
VertexState::error
GlobalError error() const
Definition: VertexState.h:64
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
trackingPlots.other
other
Definition: trackingPlots.py:1467
VertexState.h
SequentialGhostTrackFitter.h
reco::TrackKinematics::vectorSum
const math::XYZTLorentzVector & vectorSum() const
Definition: TrackKinematics.h:47
Point3DBase< float, GlobalTag >
ghostTrackVertexReco_cff.maxFitChi2
maxFitChi2
Definition: ghostTrackVertexReco_cff.py:6
covarianceUpdate
static bool covarianceUpdate(Matrix3S &cov, const Vector3 &residual, const Matrix3S &error, double &chi2, double theta, double phi)
Definition: GhostTrackVertexFinder.cc:138
ROOT::Math
Definition: Transform3DPJ.h:41
reco::GhostTrackVertexFinder::ghostTrackFitter
GhostTrackFitter & ghostTrackFitter() const
Definition: GhostTrackVertexFinder.cc:270
GeometricAnnealing.h
reco::GhostTrackFitter::fit
GhostTrack fit(const GlobalPoint &priorPosition, const GlobalError &priorError, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
Definition: GhostTrackFitter.cc:30
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
VertexFitter::vertex
virtual CachingVertex< N > vertex(const std::vector< reco::TransientTrack > &tracks) const =0
AnalyticalImpactPointExtrapolator
Definition: AnalyticalImpactPointExtrapolator.h:26
VertexTrackFactory< 5 >
RecoVertex::convertError
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
reco::GhostTrackPrediction::direction
const GlobalVector direction() const
Definition: GhostTrackPrediction.h:63
reco::GhostTrackPrediction::fts
FreeTrajectoryState fts(const MagneticField *fieldProvider) const
Definition: GhostTrackPrediction.cc:185
reco::SequentialGhostTrackFitter
Definition: SequentialGhostTrackFitter.h:13
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
reco::GhostTrackPrediction::position
GlobalPoint position(double lambda=0.) const
Definition: GhostTrackPrediction.h:67
reco::GhostTrackPrediction::rho2
double rho2() const
Definition: GhostTrackPrediction.h:53
phase2tkutil::isPrimary
bool isPrimary(const SimTrack &simTrk, const PSimHit *simHit)
Definition: TrackerPhase2ValidationUtil.cc:2
CachingVertex::position
GlobalPoint position() const
Definition: CachingVertex.cc:308
math::GlobalVector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalVector
vector in glovbal coordinate system
Definition: Vector3D.h:28
reco::GhostTrackVertexFinder::primVertexFitter_
std::unique_ptr< VertexFitter< 5 > > primVertexFitter_
Definition: GhostTrackVertexFinder.h:158
reco::GhostTrackVertexFinder::FinderInfo::beamSpot
VertexState beamSpot
Definition: GhostTrackVertexFinder.cc:108
TransientTrackFromFTSFactory::build
reco::TransientTrack build(const FreeTrajectoryState &fts) const
Definition: TransientTrackFromFTSFactory.cc:7
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
reco::GhostTrack
Definition: GhostTrack.h:16
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
reco::GhostTrackVertexFinder::vertices
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
Definition: GhostTrackVertexFinder.cc:334
GeometricAnnealing
Definition: GeometricAnnealing.h:7
reco::GhostTrackVertexFinder::initialVertices
std::vector< CachingVertex< 5 > > initialVertices(const FinderInfo &info) const
Definition: GhostTrackVertexFinder.cc:640
TrackKinematics.h
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
GlobalError.h
p1
double p1[4]
Definition: TauolaWrapper.h:89
GlobalErrorBase< double, ErrorMatrixTag >
CachingVertex::tracks
std::vector< RefCountedVertexTrack > tracks() const
Definition: CachingVertex.h:147
TransientVertex
Definition: TransientVertex.h:18
reco::GhostTrackVertexFinder::recursiveMerge
bool recursiveMerge(std::vector< CachingVertex< 5 > > &vertices, const FinderInfo &info) const
Definition: GhostTrackVertexFinder.cc:713
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
vtxErrorLong
static double vtxErrorLong(const GlobalError &error, const GlobalVector &dir)
Definition: GhostTrackVertexFinder.cc:119
GhostTrackVertexFinder.h
reco::GhostTrackVertexFinder::maxFitChi2_
double maxFitChi2_
Definition: GhostTrackVertexFinder.h:151
reco::GhostTrackFitter
Definition: GhostTrackFitter.h:19
reco::GhostTrackVertexFinder::FinderInfo::primaryVertex
const CachingVertex< 5 > & primaryVertex
Definition: GhostTrackVertexFinder.cc:104
reco::GhostTrackVertexFinder::kRefitGhostTrackWithVertices
Definition: GhostTrackVertexFinder.h:31
VertexTrackFactory::vertexTrack
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
Definition: VertexTrackFactory.h:27
vertexAtState
static CachingVertex< 5 > vertexAtState(const TransientTrack &ghostTrack, const GhostTrackPrediction &pred, const GhostTrackState &state)
Definition: GhostTrackVertexFinder.cc:160
TransientVertex.h
reco::GhostTrackVertexFinder::mergeVertices
CachingVertex< 5 > mergeVertices(const CachingVertex< 5 > &vertex1, const CachingVertex< 5 > &vertex2, const FinderInfo &info, bool isPrimary) const
Definition: GhostTrackVertexFinder.cc:681
reco::GhostTrackVertexFinder::GhostTrackVertexFinder
GhostTrackVertexFinder()
Definition: GhostTrackVertexFinder.cc:261
reco::TransientTrack
Definition: TransientTrack.h:19
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
VertexState
Definition: VertexState.h:13
reco::GhostTrackVertexFinder::FinderInfo::pred
GhostTrackPrediction pred
Definition: GhostTrackVertexFinder.cc:105
reco::GhostTrackVertexFinder::vertexCompat
static double vertexCompat(const CachingVertex< 5 > &vtx1, const CachingVertex< 5 > &vtx2, const FinderInfo &info, double scale1=1.0, double scale2=1.0)
Definition: GhostTrackVertexFinder.cc:232
CachingVertex::isValid
bool isValid() const
Definition: CachingVertex.h:154
TransientTrackFromFTSFactory
Definition: TransientTrackFromFTSFactory.h:10
GlobalVector.h
edm::RefToBase< reco::Track >
VertexState::position
GlobalPoint position() const
Definition: VertexState.h:62
reco::GhostTrackVertexFinder::FitType
FitType
Definition: GhostTrackVertexFinder.h:31
reco::GhostTrackVertexFinder::reassignTracks
bool reassignTracks(std::vector< CachingVertex< 5 > > &vertices, const FinderInfo &info) const
Definition: GhostTrackVertexFinder.cc:785
math::GlobalPoint
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:18
GhostTrack.h
RecoVertex::convertPos
reco::Vertex::Point convertPos(const GlobalPoint &p)
Definition: ConvertToFromReco.h:7
funct::arg
A arg
Definition: Factorize.h:31
reco::GhostTrackPrediction
Definition: GhostTrackPrediction.h:21
reco::TrackBase::pz
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:646
mps_fire.result
result
Definition: mps_fire.py:311
fitChi2
static double fitChi2(const CachingVertex< 5 > &vtx)
Definition: GhostTrackVertexFinder.cc:638
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
UEAnalysisJets_cfi.coneRadius
coneRadius
Definition: UEAnalysisJets_cfi.py:7
HLT_FULL_cff.seccut
seccut
Definition: HLT_FULL_cff.py:51989
LinearizedTrackState.h
reco::GhostTrackVertexFinder::kAlwaysWithGhostTrack
Definition: GhostTrackVertexFinder.h:31
AdaptiveVertexFitter.h
MagneticField
Definition: MagneticField.h:19
reco::GhostTrackVertexFinder::FinderInfo::hasPrimaries
bool hasPrimaries
Definition: GhostTrackVertexFinder.cc:110
vtxMean
static GlobalPoint vtxMean(const GlobalPoint &p1, const GlobalError &e1, const GlobalPoint &p2, const GlobalError &e2)
Definition: GhostTrackVertexFinder.cc:123
ghostTrackVertexReco_cff.mergeThreshold
mergeThreshold
Definition: ghostTrackVertexReco_cff.py:7
BeamSpotFilterParameters_cfi.newVtx
newVtx
Definition: BeamSpotFilterParameters_cfi.py:6
GlobalPoint.h
reco::GhostTrackVertexFinder::primcut_
double primcut_
Definition: GhostTrackVertexFinder.h:153
weight
Definition: weight.py:1
reco::Vertex
Definition: Vertex.h:35
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
reco::GhostTrackVertexFinder::FinderInfo::hasBeamSpot
bool hasBeamSpot
Definition: GhostTrackVertexFinder.cc:109
reco::GhostTrackVertexFinder::FinderInfo
Definition: GhostTrackVertexFinder.cc:89
reco::GhostTrackPrediction::lambda
double lambda(const GlobalPoint &point) const
Definition: GhostTrackPrediction.h:65
reco::TrackKinematics::add
void add(const reco::Track &track, double weight=1.0)
Definition: TrackKinematics.cc:57