CMS 3D CMS Logo

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