CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
reco::GhostTrackVertexFinder Class Reference

#include <GhostTrackVertexFinder.h>

Classes

struct  FinderInfo
 

Public Types

enum  FitType { kAlwaysWithGhostTrack, kSingleTracksWithGhostTrack, kRefitGhostTrackWithVertices }
 

Public Member Functions

 GhostTrackVertexFinder ()
 
 GhostTrackVertexFinder (double maxFitChi2, double mergeThreshold, double primcut, double seccut, FitType fitType)
 
std::vector< TransientVertexvertices (const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
 
std::vector< TransientVertexvertices (const GlobalPoint &primaryPosition, const GlobalError &primaryError, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
 
std::vector< TransientVertexvertices (const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const reco::BeamSpot &beamSpot, const std::vector< TransientTrack > &tracks) const
 
std::vector< TransientVertexvertices (const GlobalPoint &primaryPosition, const GlobalError &primaryError, const GlobalVector &direction, double coneRadius, const reco::BeamSpot &beamSpot, const std::vector< TransientTrack > &tracks) const
 
std::vector< TransientVertexvertices (const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const reco::BeamSpot &beamSpot, const std::vector< TransientTrack > &primaries, const std::vector< TransientTrack > &tracks) const
 
std::vector< TransientVertexvertices (const GlobalPoint &primaryPosition, const GlobalError &primaryError, const GlobalVector &direction, double coneRadius, const reco::BeamSpot &beamSpot, const std::vector< TransientTrack > &primaries, const std::vector< TransientTrack > &tracks) const
 
std::vector< TransientVertexvertices (const reco::Vertex &primaryVertex, const reco::Track &ghostTrack, const std::vector< TransientTrack > &tracks, const std::vector< float > &weights=std::vector< float >()) const
 
std::vector< TransientVertexvertices (const reco::Vertex &primaryVertex, const reco::Track &ghostTrack, const reco::BeamSpot &beamSpot, const std::vector< TransientTrack > &tracks, const std::vector< float > &weights=std::vector< float >()) const
 
std::vector< TransientVertexvertices (const reco::Vertex &primaryVertex, const reco::Track &ghostTrack, const reco::BeamSpot &beamSpot, const std::vector< TransientTrack > &primaries, const std::vector< TransientTrack > &tracks, const std::vector< float > &weights=std::vector< float >()) const
 
std::vector< TransientVertexvertices (const GlobalPoint &primaryPosition, const GlobalError &primaryError, const GhostTrack &ghostTrack) const
 
std::vector< TransientVertexvertices (const GlobalPoint &primaryPosition, const GlobalError &primaryError, const reco::BeamSpot &beamSpot, const GhostTrack &ghostTrack) const
 
std::vector< TransientVertexvertices (const GlobalPoint &primaryPosition, const GlobalError &primaryError, const reco::BeamSpot &beamSpot, const std::vector< TransientTrack > &primaries, const GhostTrack &ghostTrack) const
 
std::vector< TransientVertexvertices (const reco::Vertex &primaryVertex, const GhostTrack &ghostTrack) const
 
std::vector< TransientVertexvertices (const reco::Vertex &primaryVertex, const reco::BeamSpot &beamSpot, const GhostTrack &ghostTrack) const
 
std::vector< TransientVertexvertices (const reco::Vertex &primaryVertex, const reco::BeamSpot &beamSpot, const std::vector< TransientTrack > &primaries, const GhostTrack &ghostTrack) const
 
std::vector< TransientVertexvertices (const GhostTrack &ghostTrack, const CachingVertex< 5 > &primary=CachingVertex< 5 >(), const reco::BeamSpot &beamSpot=reco::BeamSpot(), bool hasBeamSpot=false, bool hasPrimaries=false) const
 
 ~GhostTrackVertexFinder ()
 

Private Member Functions

GhostTrackFitterghostTrackFitter () const
 
std::vector< CachingVertex< 5 > > initialVertices (const FinderInfo &info) const
 
CachingVertex< 5 > mergeVertices (const CachingVertex< 5 > &vertex1, const CachingVertex< 5 > &vertex2, const FinderInfo &info, bool isPrimary) const
 
bool reassignTracks (std::vector< CachingVertex< 5 > > &vertices, const FinderInfo &info) const
 
bool recursiveMerge (std::vector< CachingVertex< 5 > > &vertices, const FinderInfo &info) const
 
void refitGhostTrack (std::vector< CachingVertex< 5 > > &vertices, FinderInfo &info) const
 
VertexFitter< 5 > & vertexFitter (bool primary) const
 

Static Private Member Functions

static double vertexCompat (const CachingVertex< 5 > &vtx1, const CachingVertex< 5 > &vtx2, const FinderInfo &info, double scale1=1.0, double scale2=1.0)
 

Private Attributes

FitType fitType_
 
std::unique_ptr< GhostTrackFitterghostTrackFitter_
 
double maxFitChi2_
 
double mergeThreshold_
 
double primcut_
 
std::unique_ptr< VertexFitter< 5 > > primVertexFitter_
 
double seccut_
 
std::unique_ptr< VertexFitter< 5 > > secVertexFitter_
 

Detailed Description

Definition at line 29 of file GhostTrackVertexFinder.h.

Member Enumeration Documentation

◆ FitType

Constructor & Destructor Documentation

◆ GhostTrackVertexFinder() [1/2]

GhostTrackVertexFinder::GhostTrackVertexFinder ( )

◆ GhostTrackVertexFinder() [2/2]

GhostTrackVertexFinder::GhostTrackVertexFinder ( double  maxFitChi2,
double  mergeThreshold,
double  primcut,
double  seccut,
FitType  fitType 
)

◆ ~GhostTrackVertexFinder()

GhostTrackVertexFinder::~GhostTrackVertexFinder ( )

Definition at line 275 of file GhostTrackVertexFinder.cc.

275 {}

Member Function Documentation

◆ ghostTrackFitter()

GhostTrackFitter & GhostTrackVertexFinder::ghostTrackFitter ( ) const
private

Definition at line 277 of file GhostTrackVertexFinder.cc.

References ghostTrackFitter_.

Referenced by vertices().

277  {
278  if (!ghostTrackFitter_.get())
279  ghostTrackFitter_ = std::make_unique<GhostTrackFitter>();
280 
281  return *ghostTrackFitter_;
282 }
std::unique_ptr< GhostTrackFitter > ghostTrackFitter_

◆ initialVertices()

std::vector< CachingVertex< 5 > > GhostTrackVertexFinder::initialVertices ( const FinderInfo info) const
private

Definition at line 647 of file GhostTrackVertexFinder.cc.

References info(), vertexAtState(), vertices(), and L1BJetProducer_cff::vtx.

Referenced by vertices().

647  {
648  std::vector<CachingVertex<5> > vertices;
649  for (std::vector<GhostTrackState>::const_iterator iter = info.states.begin(); iter != info.states.end(); ++iter) {
650  if (!iter->isValid())
651  continue;
652 
653  GhostTrackState state(*iter);
654  state.linearize(info.pred);
655 
656  if (!state.isValid())
657  continue;
658 
659  CachingVertex<5> vtx = vertexAtState(info.ghostTrack, info.pred, state);
660 
661  if (vtx.isValid()) // && fitChi2(vtx) < maxFitChi2_)
662  vertices.push_back(vtx);
663  }
664 
665  return vertices;
666 }
static const TGPicture * info(bool iBackgroundIsBlack)
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
static CachingVertex< 5 > vertexAtState(const TransientTrack &ghostTrack, const GhostTrackPrediction &pred, const GhostTrackState &state)

◆ mergeVertices()

CachingVertex< 5 > GhostTrackVertexFinder::mergeVertices ( const CachingVertex< 5 > &  vertex1,
const CachingVertex< 5 > &  vertex2,
const FinderInfo info,
bool  isPrimary 
) const
private

Definition at line 688 of file GhostTrackVertexFinder.cc.

References MillePedeFileConverter_cfg::e, fitType_, info(), phase2tkutil::isPrimary(), kAlwaysWithGhostTrack, mergeTrackHelper(), stateMean(), CachingVertex< N >::tracks(), VertexFitter< N >::vertex(), vertexFitter(), CachingVertex< N >::vertexState(), VertexTrackFactory< N >::vertexTrack(), and L1BJetProducer_cff::vtx.

Referenced by recursiveMerge().

691  {
692  VertexTrackFactory<5> vertexTrackFactory;
693 
694  VertexState state = stateMean(vertex1.vertexState(), vertex2.vertexState());
695  std::vector<RefCountedVertexTrack> linTracks;
696  VtxTrackIs isGhostTrack(info.ghostTrack);
697  RefCountedVertexTrack vtxGhostTrack;
698 
699  mergeTrackHelper(vertex1.tracks(), linTracks, state, isGhostTrack, vtxGhostTrack, vertexTrackFactory);
700  mergeTrackHelper(vertex2.tracks(), linTracks, state, isGhostTrack, vtxGhostTrack, vertexTrackFactory);
701 
702  if (vtxGhostTrack && (fitType_ == kAlwaysWithGhostTrack || linTracks.size() < 2))
703  linTracks.push_back(vertexTrackFactory.vertexTrack(vtxGhostTrack->linearizedTrack(), vtxGhostTrack->vertexState()));
704 
705  try {
707  if (info.hasBeamSpot && isPrimary)
708  vtx = vertexFitter(true).vertex(linTracks, info.beamSpot.position(), info.beamSpot.error());
709  else
710  vtx = vertexFitter(isPrimary).vertex(linTracks);
711  if (vtx.isValid())
712  return vtx;
713  } catch (const VertexException &e) {
714  // fit failed
715  }
716 
717  return CachingVertex<5>();
718 }
static const TGPicture * info(bool iBackgroundIsBlack)
bool isPrimary(const SimTrack &simTrk, const PSimHit *simHit)
Common base class.
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
VertexState const & vertexState() const
static VertexState stateMean(const VertexState &v1, const VertexState &v2)
std::vector< RefCountedVertexTrack > tracks() const
virtual CachingVertex< N > vertex(const std::vector< reco::TransientTrack > &tracks) const =0
VertexFitter< 5 > & vertexFitter(bool primary) const
static void mergeTrackHelper(const std::vector< RefCountedVertexTrack > &tracks, std::vector< RefCountedVertexTrack > &newTracks, const VertexState &state, const VtxTrackIs &ghostTrackFinder, RefCountedVertexTrack &ghostTrack, const VertexTrackFactory< 5 > &factory)

◆ reassignTracks()

bool GhostTrackVertexFinder::reassignTracks ( std::vector< CachingVertex< 5 > > &  vertices,
const FinderInfo info 
) const
private

Definition at line 792 of file GhostTrackVertexFinder.cc.

References MillePedeFileConverter_cfg::e, fitType_, heavyIonCSV_trainingSettings::idx, info(), kAlwaysWithGhostTrack, LinearizedTrackStateFactory::linearizedTrackState(), primcut_, relinearizeTrack(), relinearizeTracks(), seccut_, funct::sqr(), edm::swap(), HLT_2023v12_cff::track, DiMuonV_cfg::tracks, trackVertexCompat(), trackerHitRTTI::vector, VertexFitter< N >::vertex(), vertexAtState(), vertexFitter(), VertexTrackFactory< N >::vertexTrack(), vertices(), and L1BJetProducer_cff::vtx.

Referenced by vertices().

792  {
793  std::vector<std::pair<RefCountedVertexTrack, std::vector<RefCountedVertexTrack> > > trackBundles(vertices_.size());
794 
795  VtxTrackIs isGhostTrack(info.ghostTrack);
796 
797  bool assignmentChanged = false;
798  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices_.begin(); iter != vertices_.end(); ++iter) {
799  std::vector<RefCountedVertexTrack> vtxTracks = iter->tracks();
800 
801  if (vtxTracks.empty()) {
802  LinearizedTrackStateFactory linTrackFactory;
803  VertexTrackFactory<5> vertexTrackFactory;
804 
805  RefCountedLinearizedTrackState linState = linTrackFactory.linearizedTrackState(iter->position(), info.ghostTrack);
806 
807  trackBundles[iter - vertices_.begin()].first = vertexTrackFactory.vertexTrack(linState, iter->vertexState());
808  }
809 
810  for (std::vector<RefCountedVertexTrack>::const_iterator track = vtxTracks.begin(); track != vtxTracks.end();
811  ++track) {
812  if (isGhostTrack(*track)) {
813  trackBundles[iter - vertices_.begin()].first = *track;
814  continue;
815  }
816 
817  if ((*track)->weight() < 1e-3) {
818  trackBundles[iter - vertices_.begin()].second.push_back(*track);
819  continue;
820  }
821 
822  unsigned int idx = iter - vertices_.begin();
823  double best = 1.0e9;
824  for (std::vector<CachingVertex<5> >::const_iterator vtx = vertices_.begin(); vtx != vertices_.end(); ++vtx) {
825  if (info.pred.lambda(vtx->position()) < info.pred.lambda(vertices_[0].position()))
826  continue;
827 
828  double compat = sqr(trackVertexCompat(*vtx, *track));
829 
830  compat /= (vtx == vertices_.begin()) ? primcut_ : seccut_;
831 
832  if (compat < best) {
833  best = compat;
834  idx = vtx - vertices_.begin();
835  }
836  }
837 
838  if ((int)idx != iter - vertices_.begin())
839  assignmentChanged = true;
840 
841  trackBundles[idx].second.push_back(*track);
842  }
843  }
844 
845  if (!assignmentChanged)
846  return false;
847 
848  VertexTrackFactory<5> vertexTrackFactory;
849  std::vector<CachingVertex<5> > vertices;
850  vertices.reserve(vertices_.size());
851 
852  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices_.begin(); iter != vertices_.end(); ++iter) {
853  const std::vector<RefCountedVertexTrack> &tracks = trackBundles[iter - vertices_.begin()].second;
854  if (tracks.empty())
855  continue;
856 
858 
859  if (tracks.size() == 1) {
860  const TransientTrack &track = tracks[0]->linearizedTrack()->track();
861 
862  int idx = -1;
863  for (std::vector<GhostTrackState>::const_iterator iter = info.states.begin(); iter != info.states.end(); ++iter) {
864  if (iter->isTrack() && iter->track() == track) {
865  idx = iter - info.states.begin();
866  break;
867  }
868  }
869  if (idx < 0)
870  continue;
871 
872  vtx = vertexAtState(info.ghostTrack, info.pred, info.states[idx]);
873  if (!vtx.isValid())
874  continue;
875  } else {
876  std::vector<RefCountedVertexTrack> linTracks = relinearizeTracks(tracks, iter->vertexState());
877 
879  linTracks.push_back(
880  relinearizeTrack(trackBundles[iter - vertices_.begin()].first, iter->vertexState(), vertexTrackFactory));
881 
882  bool primary = iter == vertices_.begin();
883  try {
884  if (primary && info.hasBeamSpot)
885  vtx = vertexFitter(true).vertex(linTracks, info.beamSpot.position(), info.beamSpot.error());
886  else
887  vtx = vertexFitter(primary).vertex(linTracks);
888  } catch (const VertexException &e) {
889  // fit failed;
890  }
891  if (!vtx.isValid())
892  return false;
893  }
894 
895  vertices.push_back(vtx);
896  };
897 
898  std::swap(vertices_, vertices);
899  return true;
900 }
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
static const TGPicture * info(bool iBackgroundIsBlack)
Common base class.
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
static RefCountedVertexTrack relinearizeTrack(const RefCountedVertexTrack &track, const VertexState &state, const VertexTrackFactory< 5 > factory)
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
static std::vector< RefCountedVertexTrack > relinearizeTracks(const std::vector< RefCountedVertexTrack > &tracks, const VertexState &state)
virtual CachingVertex< N > vertex(const std::vector< reco::TransientTrack > &tracks) const =0
VertexFitter< 5 > & vertexFitter(bool primary) const
static double trackVertexCompat(const CachingVertex< 5 > &vtx, const RefCountedVertexTrack &vertexTrack)
Square< F >::type sqr(const F &f)
Definition: Square.h:14
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
static CachingVertex< 5 > vertexAtState(const TransientTrack &ghostTrack, const GhostTrackPrediction &pred, const GhostTrackState &state)

◆ recursiveMerge()

bool GhostTrackVertexFinder::recursiveMerge ( std::vector< CachingVertex< 5 > > &  vertices,
const FinderInfo info 
) const
private

Definition at line 720 of file GhostTrackVertexFinder.cc.

References fitChi2(), mps_fire::i, dqmdumpme::indices, info(), dqmiolumiharvest::j, SiStripPI::max, maxFitChi2_, mergeThreshold_, mergeVertices(), SiStripPI::min, dqmiodumpmetadata::n, BeamSpotFilterParameters_cfi::newVtx, trackingPlots::other, primcut_, seccut_, edm::swap(), vertexCompat(), and vertices().

Referenced by vertices().

720  {
721  typedef std::pair<unsigned int, unsigned int> Indices;
722 
723  std::multimap<float, Indices> compatMap;
724  unsigned int n = vertices.size();
725  for (unsigned int i = 0; i < n; i++) {
726  const CachingVertex<5> &v1 = vertices[i];
727  for (unsigned int j = i + 1; j < n; j++) {
728  const CachingVertex<5> &v2 = vertices[j];
729 
730  float compat = vertexCompat(v1, v2, info, i == 0 ? primcut_ : seccut_, seccut_);
731 
732  if (compat > mergeThreshold_)
733  continue;
734 
735  compatMap.insert(std::make_pair(compat, Indices(i, j)));
736  }
737  }
738 
739  bool changesMade = false;
740  bool repeat = true;
741  while (repeat) {
742  repeat = false;
743  for (std::multimap<float, Indices>::const_iterator iter = compatMap.begin(); iter != compatMap.end(); ++iter) {
744  unsigned int v1 = iter->second.first;
745  unsigned int v2 = iter->second.second;
746 
748  if (!newVtx.isValid() || (v1 != 0 && fitChi2(newVtx) > maxFitChi2_))
749  continue;
750 
751  std::swap(vertices[v1], newVtx);
752  vertices.erase(vertices.begin() + v2);
753  n--;
754 
755  std::multimap<float, Indices> newCompatMap;
756  for (++iter; iter != compatMap.end(); ++iter) {
757  if (iter->second.first == v1 || iter->second.first == v2 || iter->second.second == v1 ||
758  iter->second.second == v2)
759  continue;
760 
761  Indices indices = iter->second;
762  indices.first -= indices.first > v2;
763  indices.second -= indices.second > v2;
764 
765  newCompatMap.insert(std::make_pair(iter->first, indices));
766  }
767  std::swap(compatMap, newCompatMap);
768 
769  for (unsigned int i = 0; i < n; i++) {
770  if (i == v1)
771  continue;
772 
773  const CachingVertex<5> &other = vertices[i];
774  float compat =
775  vertexCompat(vertices[v1], other, info, v1 == 0 ? primcut_ : seccut_, i == 0 ? primcut_ : seccut_);
776 
777  if (compat > mergeThreshold_)
778  continue;
779 
780  compatMap.insert(std::make_pair(compat, Indices(std::min(i, v1), std::max(i, v1))));
781  }
782 
783  changesMade = true;
784  repeat = true;
785  break;
786  }
787  }
788 
789  return changesMade;
790 }
static const TGPicture * info(bool iBackgroundIsBlack)
static double vertexCompat(const CachingVertex< 5 > &vtx1, const CachingVertex< 5 > &vtx2, const FinderInfo &info, double scale1=1.0, double scale2=1.0)
CachingVertex< 5 > mergeVertices(const CachingVertex< 5 > &vertex1, const CachingVertex< 5 > &vertex2, const FinderInfo &info, bool isPrimary) const
static double fitChi2(const CachingVertex< 5 > &vtx)
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
Indices
Definition: EdmEventSize.cc:28
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const

◆ refitGhostTrack()

void GhostTrackVertexFinder::refitGhostTrack ( std::vector< CachingVertex< 5 > > &  vertices,
FinderInfo info 
) const
private

Definition at line 902 of file GhostTrackVertexFinder.cc.

References nano_mu_local_reco_cff::chi2, MillePedeFileConverter_cfg::e, reco::SequentialGhostTrackFitter::fit(), heavyIonCSV_trainingSettings::idx, info(), LinearizedTrackStateFactory::linearizedTrackState(), ndof, edm::swap(), HLT_2023v12_cff::track, transientGhostTrack(), groupFilesInBlocks::tt, trackerHitRTTI::vector, VertexFitter< N >::vertex(), vertexAtState(), vertexFitter(), VertexTrackFactory< N >::vertexTrack(), vertices(), and L1BJetProducer_cff::vtx.

Referenced by vertices().

902  {
903  VtxTrackIs isGhostTrack(info.ghostTrack);
904 
905  std::vector<GhostTrackState> states;
906  std::vector<unsigned int> oldStates;
907  oldStates.reserve(info.states.size());
908 
909  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices.begin(); iter != vertices.end(); ++iter) {
910  std::vector<RefCountedVertexTrack> vtxTracks = iter->tracks();
911 
912  oldStates.clear();
913  for (std::vector<RefCountedVertexTrack>::const_iterator track = vtxTracks.begin(); track != vtxTracks.end();
914  ++track) {
915  if (isGhostTrack(*track) || (*track)->weight() < 1e-3)
916  continue;
917 
918  const TransientTrack &tt = (*track)->linearizedTrack()->track();
919 
920  int idx = -1;
921  for (std::vector<GhostTrackState>::const_iterator iter = info.states.begin(); iter != info.states.end(); ++iter) {
922  if (iter->isTrack() && iter->track() == tt) {
923  idx = iter - info.states.begin();
924  break;
925  }
926  }
927 
928  if (idx >= 0)
929  oldStates.push_back(idx);
930  }
931 
932  if (oldStates.size() == 1)
933  states.push_back(info.states[oldStates[0]]);
934  else
935  states.push_back(GhostTrackState(iter->vertexState()));
936  }
937 
938  KalmanGhostTrackUpdater updater;
940  double ndof, chi2;
941  info.pred = fitter.fit(updater, info.prior, states, ndof, chi2);
942  TransientTrack ghostTrack = transientGhostTrack(info.pred, info.field);
943 
944  std::swap(info.states, states);
945  states.clear();
946 
947  std::vector<CachingVertex<5> > newVertices;
948  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices.begin(); iter != vertices.end(); ++iter) {
949  std::vector<RefCountedVertexTrack> vtxTracks = iter->tracks();
950 
951  int idx = -1;
952  bool redo = false;
953  for (std::vector<RefCountedVertexTrack>::iterator track = vtxTracks.begin(); track != vtxTracks.end(); ++track) {
954  if (isGhostTrack(*track)) {
955  LinearizedTrackStateFactory linTrackFactory;
956  VertexTrackFactory<5> vertexTrackFactory;
957 
958  *track = vertexTrackFactory.vertexTrack(linTrackFactory.linearizedTrackState(iter->position(), ghostTrack),
959  iter->vertexState());
960  redo = true;
961  continue;
962  }
963 
964  const TransientTrack &tt = (*track)->linearizedTrack()->track();
965 
966  if (idx >= 0) {
967  idx = -1;
968  break;
969  }
970 
971  for (std::vector<GhostTrackState>::const_iterator it = info.states.begin(); it != info.states.end(); ++it) {
972  if (!it->isTrack())
973  continue;
974 
975  if (it->track() == tt) {
976  idx = it - info.states.begin();
977  break;
978  }
979  }
980  }
981 
982  if (idx >= 0) {
983  CachingVertex<5> vtx = vertexAtState(ghostTrack, info.pred, info.states[idx]);
984  if (vtx.isValid())
985  newVertices.push_back(vtx);
986  } else if (redo) {
987  bool primary = iter == vertices.begin();
989  if (primary && info.hasBeamSpot)
990  vtx = vertexFitter(true).vertex(vtxTracks, info.beamSpot.position(), info.beamSpot.error());
991  else
992  vtx = vertexFitter(primary).vertex(vtxTracks);
993  if (vtx.isValid())
994  newVertices.push_back(vtx);
995  } else
996  newVertices.push_back(*iter);
997  }
998 
999  std::swap(newVertices, vertices);
1000  info.ghostTrack = ghostTrack;
1001 }
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
static const TGPicture * info(bool iBackgroundIsBlack)
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
static TransientTrack transientGhostTrack(const GhostTrackPrediction &pred, const MagneticField *field)
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
GhostTrackPrediction fit(const GhostTrackFitter::PredictionUpdater &updater, const GhostTrackPrediction &prior, std::vector< GhostTrackState > &states, double &ndof, double &chi2) override
Definition: TTTypes.h:54
virtual CachingVertex< N > vertex(const std::vector< reco::TransientTrack > &tracks) const =0
VertexFitter< 5 > & vertexFitter(bool primary) const
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
static CachingVertex< 5 > vertexAtState(const TransientTrack &ghostTrack, const GhostTrackPrediction &pred, const GhostTrackState &state)

◆ vertexCompat()

double GhostTrackVertexFinder::vertexCompat ( const CachingVertex< 5 > &  vtx1,
const CachingVertex< 5 > &  vtx2,
const FinderInfo info,
double  scale1 = 1.0,
double  scale2 = 1.0 
)
staticprivate

Definition at line 239 of file GhostTrackVertexFinder.cc.

References conv, change_name::diff, CachingVertex< N >::error(), GlobalErrorBase< T, ErrorWeightType >::matrix(), CachingVertex< N >::position(), and funct::sqr().

Referenced by recursiveMerge().

240  {
241  Vector3 diff = conv(vtx2.position() - vtx1.position());
242  Matrix3S cov = scale1 * vtx1.error().matrix() + scale2 * vtx2.error().matrix();
243 
244  return sqr(ROOT::Math::Dot(diff, diff)) / ROOT::Math::Similarity(cov, diff);
245 }
const AlgebraicSymMatrix33 matrix() const
EPOS::IO_EPOS conv
Square< F >::type sqr(const F &f)
Definition: Square.h:14
GlobalPoint position() const
GlobalError error() const

◆ vertexFitter()

VertexFitter< 5 > & GhostTrackVertexFinder::vertexFitter ( bool  primary) const
private

Definition at line 284 of file GhostTrackVertexFinder.cc.

References primcut_, primVertexFitter_, seccut_, and secVertexFitter_.

Referenced by mergeVertices(), reassignTracks(), and refitGhostTrack().

284  {
285  std::unique_ptr<VertexFitter<5> > *ptr = primary ? &primVertexFitter_ : &secVertexFitter_;
286  if (!ptr->get())
287  *ptr = std::make_unique<AdaptiveVertexFitter>(GeometricAnnealing(primary ? primcut_ : seccut_));
288 
289  return **ptr;
290 }
std::unique_ptr< VertexFitter< 5 > > primVertexFitter_
std::unique_ptr< VertexFitter< 5 > > secVertexFitter_

◆ vertices() [1/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const GlobalVector direction,
double  coneRadius,
const std::vector< TransientTrack > &  tracks 
) const

Definition at line 341 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), BeamMonitor_cff::primaryVertex, and DiMuonV_cfg::tracks.

Referenced by initialVertices(), reassignTracks(), recursiveMerge(), refitGhostTrack(), and vertices().

344  {
345  return vertices(RecoVertex::convertPos(primaryVertex.position()),
347  direction,
348  coneRadius,
349  tracks);
350 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
primaryVertex
hltOfflineBeamSpot for HLTMON

◆ vertices() [2/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const GlobalPoint primaryPosition,
const GlobalError primaryError,
const GlobalVector direction,
double  coneRadius,
const std::vector< TransientTrack > &  tracks 
) const

Definition at line 380 of file GhostTrackVertexFinder.cc.

References reco::GhostTrackFitter::fit(), ghostTrackFitter(), reco::GhostTrack::prediction(), mps_fire::result, DiMuonV_cfg::tracks, and vertices().

384  {
385  GhostTrack ghostTrack = ghostTrackFitter().fit(primaryPosition, primaryError, direction, coneRadius, tracks);
386 
387  CachingVertex<5> primary(primaryPosition, primaryError, std::vector<RefCountedVertexTrack>(), 0.);
388 
389  std::vector<TransientVertex> result = vertices(ghostTrack, primary);
390 
391 #ifdef DEBUG
392  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
393  debugVertex(*iter, ghostTrack.prediction());
394 #endif
395 
396  return result;
397 }
GhostTrackFitter & ghostTrackFitter() const
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
GhostTrack fit(const GlobalPoint &priorPosition, const GlobalError &priorError, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const

◆ vertices() [3/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const GlobalVector direction,
double  coneRadius,
const reco::BeamSpot beamSpot,
const std::vector< TransientTrack > &  tracks 
) const

Definition at line 352 of file GhostTrackVertexFinder.cc.

References pwdgSkimBPark_cfi::beamSpot, RecoVertex::convertError(), RecoVertex::convertPos(), BeamMonitor_cff::primaryVertex, DiMuonV_cfg::tracks, and vertices().

356  {
357  return vertices(RecoVertex::convertPos(primaryVertex.position()),
359  direction,
360  coneRadius,
361  beamSpot,
362  tracks);
363 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
primaryVertex
hltOfflineBeamSpot for HLTMON

◆ vertices() [4/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const GlobalPoint primaryPosition,
const GlobalError primaryError,
const GlobalVector direction,
double  coneRadius,
const reco::BeamSpot beamSpot,
const std::vector< TransientTrack > &  tracks 
) const

Definition at line 399 of file GhostTrackVertexFinder.cc.

References pwdgSkimBPark_cfi::beamSpot, reco::GhostTrackFitter::fit(), ghostTrackFitter(), reco::GhostTrack::prediction(), mps_fire::result, DiMuonV_cfg::tracks, and vertices().

404  {
405  GhostTrack ghostTrack = ghostTrackFitter().fit(primaryPosition, primaryError, direction, coneRadius, tracks);
406 
407  CachingVertex<5> primary(primaryPosition, primaryError, std::vector<RefCountedVertexTrack>(), 0.);
408 
409  std::vector<TransientVertex> result = vertices(ghostTrack, primary, beamSpot, true);
410 
411 #ifdef DEBUG
412  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
413  debugVertex(*iter, ghostTrack.prediction());
414 #endif
415 
416  return result;
417 }
GhostTrackFitter & ghostTrackFitter() const
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
GhostTrack fit(const GlobalPoint &priorPosition, const GlobalError &priorError, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const

◆ vertices() [5/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const GlobalVector direction,
double  coneRadius,
const reco::BeamSpot beamSpot,
const std::vector< TransientTrack > &  primaries,
const std::vector< TransientTrack > &  tracks 
) const

Definition at line 365 of file GhostTrackVertexFinder.cc.

References pwdgSkimBPark_cfi::beamSpot, RecoVertex::convertError(), RecoVertex::convertPos(), BeamMonitor_cff::primaryVertex, DiMuonV_cfg::tracks, and vertices().

370  {
371  return vertices(RecoVertex::convertPos(primaryVertex.position()),
373  direction,
374  coneRadius,
375  beamSpot,
376  primaries,
377  tracks);
378 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
primaryVertex
hltOfflineBeamSpot for HLTMON

◆ vertices() [6/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const GlobalPoint primaryPosition,
const GlobalError primaryError,
const GlobalVector direction,
double  coneRadius,
const reco::BeamSpot beamSpot,
const std::vector< TransientTrack > &  primaries,
const std::vector< TransientTrack > &  tracks 
) const

Definition at line 419 of file GhostTrackVertexFinder.cc.

References pwdgSkimBPark_cfi::beamSpot, reco::GhostTrackFitter::fit(), ghostTrackFitter(), LinearizedTrackStateFactory::linearizedTrackState(), reco::GhostTrack::prediction(), mps_fire::result, DiMuonV_cfg::tracks, VertexTrackFactory< N >::vertexTrack(), and vertices().

425  {
426  GhostTrack ghostTrack = ghostTrackFitter().fit(primaryPosition, primaryError, direction, coneRadius, tracks);
427 
428  std::vector<RefCountedVertexTrack> primaryVertexTracks;
429  if (!primaries.empty()) {
430  LinearizedTrackStateFactory linTrackFactory;
431  VertexTrackFactory<5> vertexTrackFactory;
432 
433  VertexState state(primaryPosition, primaryError);
434 
435  for (std::vector<TransientTrack>::const_iterator iter = primaries.begin(); iter != primaries.end(); ++iter) {
436  RefCountedLinearizedTrackState linState = linTrackFactory.linearizedTrackState(primaryPosition, *iter);
437 
438  primaryVertexTracks.push_back(vertexTrackFactory.vertexTrack(linState, state));
439  }
440  }
441 
442  CachingVertex<5> primary(primaryPosition, primaryError, primaryVertexTracks, 0.);
443 
444  std::vector<TransientVertex> result = vertices(ghostTrack, primary, beamSpot, true, true);
445 
446 #ifdef DEBUG
447  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
448  debugVertex(*iter, ghostTrack.prediction());
449 #endif
450 
451  return result;
452 }
GhostTrackFitter & ghostTrackFitter() const
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
GhostTrack fit(const GlobalPoint &priorPosition, const GlobalError &priorError, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const

◆ vertices() [7/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const reco::Track ghostTrack,
const std::vector< TransientTrack > &  tracks,
const std::vector< float > &  weights = std::vector<float>() 
) const

Definition at line 549 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), dummyPrediction(), reco::GhostTrack::prediction(), BeamMonitor_cff::primaryVertex, mps_fire::result, DiMuonV_cfg::tracks, vertices(), and hltDeepSecondaryVertexTagInfosPFPuppi_cfi::weights.

552  {
553  GhostTrack ghostTrack_(ghostTrack,
554  tracks,
555  weights,
556  dummyPrediction(primaryVertex, ghostTrack),
558  true);
559 
562  std::vector<RefCountedVertexTrack>(),
563  0.);
564 
565  std::vector<TransientVertex> result = vertices(ghostTrack_, primary);
566 
567 #ifdef DEBUG
568  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
569  debugVertex(*iter, ghostTrack_.prediction());
570 #endif
571 
572  return result;
573 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
static GhostTrackPrediction dummyPrediction(const Vertex &primaryVertex, const Track &ghostTrack)
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
primaryVertex
hltOfflineBeamSpot for HLTMON

◆ vertices() [8/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const reco::Track ghostTrack,
const reco::BeamSpot beamSpot,
const std::vector< TransientTrack > &  tracks,
const std::vector< float > &  weights = std::vector<float>() 
) const

Definition at line 575 of file GhostTrackVertexFinder.cc.

References pwdgSkimBPark_cfi::beamSpot, RecoVertex::convertError(), RecoVertex::convertPos(), dummyPrediction(), reco::GhostTrack::prediction(), BeamMonitor_cff::primaryVertex, mps_fire::result, DiMuonV_cfg::tracks, vertices(), and hltDeepSecondaryVertexTagInfosPFPuppi_cfi::weights.

579  {
580  GhostTrack ghostTrack_(ghostTrack,
581  tracks,
582  weights,
583  dummyPrediction(primaryVertex, ghostTrack),
585  true);
586 
589  std::vector<RefCountedVertexTrack>(),
590  0.);
591 
592  std::vector<TransientVertex> result = vertices(ghostTrack_, primary, beamSpot, true);
593 
594 #ifdef DEBUG
595  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
596  debugVertex(*iter, ghostTrack_.prediction());
597 #endif
598 
599  return result;
600 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
static GhostTrackPrediction dummyPrediction(const Vertex &primaryVertex, const Track &ghostTrack)
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
primaryVertex
hltOfflineBeamSpot for HLTMON

◆ vertices() [9/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const reco::Track ghostTrack,
const reco::BeamSpot beamSpot,
const std::vector< TransientTrack > &  primaries,
const std::vector< TransientTrack > &  tracks,
const std::vector< float > &  weights = std::vector<float>() 
) const

Definition at line 602 of file GhostTrackVertexFinder.cc.

References pwdgSkimBPark_cfi::beamSpot, RecoVertex::convertError(), RecoVertex::convertPos(), dummyPrediction(), LinearizedTrackStateFactory::linearizedTrackState(), reco::GhostTrack::prediction(), BeamMonitor_cff::primaryVertex, mps_fire::result, DiMuonV_cfg::tracks, VertexTrackFactory< N >::vertexTrack(), vertices(), and hltDeepSecondaryVertexTagInfosPFPuppi_cfi::weights.

607  {
608  GhostTrack ghostTrack_(ghostTrack,
609  tracks,
610  weights,
611  dummyPrediction(primaryVertex, ghostTrack),
613  true);
614 
615  std::vector<RefCountedVertexTrack> primaryVertexTracks;
616  if (!primaries.empty()) {
617  LinearizedTrackStateFactory linTrackFactory;
618  VertexTrackFactory<5> vertexTrackFactory;
619 
622 
623  for (std::vector<TransientTrack>::const_iterator iter = primaries.begin(); iter != primaries.end(); ++iter) {
624  RefCountedLinearizedTrackState linState = linTrackFactory.linearizedTrackState(state.position(), *iter);
625 
626  primaryVertexTracks.push_back(vertexTrackFactory.vertexTrack(linState, state));
627  }
628  }
629 
632  primaryVertexTracks,
633  0.);
634 
635  std::vector<TransientVertex> result = vertices(ghostTrack_, primary, beamSpot, true, true);
636 
637 #ifdef DEBUG
638  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
639  debugVertex(*iter, ghostTrack_.prediction());
640 #endif
641 
642  return result;
643 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
static GhostTrackPrediction dummyPrediction(const Vertex &primaryVertex, const Track &ghostTrack)
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
primaryVertex
hltOfflineBeamSpot for HLTMON

◆ vertices() [10/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const GlobalPoint primaryPosition,
const GlobalError primaryError,
const GhostTrack ghostTrack 
) const

Definition at line 454 of file GhostTrackVertexFinder.cc.

References reco::GhostTrack::prediction(), mps_fire::result, and vertices().

456  {
457  CachingVertex<5> primary(primaryPosition, primaryError, std::vector<RefCountedVertexTrack>(), 0.);
458 
459  std::vector<TransientVertex> result = vertices(ghostTrack, primary);
460 
461 #ifdef DEBUG
462  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
463  debugVertex(*iter, ghostTrack.prediction());
464 #endif
465 
466  return result;
467 }
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const

◆ vertices() [11/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const GlobalPoint primaryPosition,
const GlobalError primaryError,
const reco::BeamSpot beamSpot,
const GhostTrack ghostTrack 
) const

Definition at line 469 of file GhostTrackVertexFinder.cc.

References pwdgSkimBPark_cfi::beamSpot, reco::GhostTrack::prediction(), mps_fire::result, and vertices().

472  {
473  CachingVertex<5> primary(primaryPosition, primaryError, std::vector<RefCountedVertexTrack>(), 0.);
474 
475  std::vector<TransientVertex> result = vertices(ghostTrack, primary, beamSpot, true);
476 
477 #ifdef DEBUG
478  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
479  debugVertex(*iter, ghostTrack.prediction());
480 #endif
481 
482  return result;
483 }
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const

◆ vertices() [12/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const GlobalPoint primaryPosition,
const GlobalError primaryError,
const reco::BeamSpot beamSpot,
const std::vector< TransientTrack > &  primaries,
const GhostTrack ghostTrack 
) const

Definition at line 485 of file GhostTrackVertexFinder.cc.

References pwdgSkimBPark_cfi::beamSpot, LinearizedTrackStateFactory::linearizedTrackState(), reco::GhostTrack::prediction(), mps_fire::result, VertexTrackFactory< N >::vertexTrack(), and vertices().

489  {
490  std::vector<RefCountedVertexTrack> primaryVertexTracks;
491  if (!primaries.empty()) {
492  LinearizedTrackStateFactory linTrackFactory;
493  VertexTrackFactory<5> vertexTrackFactory;
494 
495  VertexState state(primaryPosition, primaryError);
496 
497  for (std::vector<TransientTrack>::const_iterator iter = primaries.begin(); iter != primaries.end(); ++iter) {
498  RefCountedLinearizedTrackState linState = linTrackFactory.linearizedTrackState(primaryPosition, *iter);
499 
500  primaryVertexTracks.push_back(vertexTrackFactory.vertexTrack(linState, state));
501  }
502  }
503 
504  CachingVertex<5> primary(primaryPosition, primaryError, primaryVertexTracks, 0.);
505 
506  std::vector<TransientVertex> result = vertices(ghostTrack, primary, beamSpot, true, true);
507 
508 #ifdef DEBUG
509  for (std::vector<TransientVertex>::const_iterator iter = result.begin(); iter != result.end(); ++iter)
510  debugVertex(*iter, ghostTrack.prediction());
511 #endif
512 
513  return result;
514 }
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const

◆ vertices() [13/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const GhostTrack ghostTrack 
) const

Definition at line 516 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), BeamMonitor_cff::primaryVertex, and vertices().

517  {
518  return vertices(
520 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
primaryVertex
hltOfflineBeamSpot for HLTMON

◆ vertices() [14/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const reco::BeamSpot beamSpot,
const GhostTrack ghostTrack 
) const

Definition at line 522 of file GhostTrackVertexFinder.cc.

References pwdgSkimBPark_cfi::beamSpot, RecoVertex::convertError(), RecoVertex::convertPos(), BeamMonitor_cff::primaryVertex, and vertices().

524  {
525  return vertices(RecoVertex::convertPos(primaryVertex.position()),
527  beamSpot,
528  ghostTrack);
529 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
primaryVertex
hltOfflineBeamSpot for HLTMON

◆ vertices() [15/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const reco::BeamSpot beamSpot,
const std::vector< TransientTrack > &  primaries,
const GhostTrack ghostTrack 
) const

Definition at line 531 of file GhostTrackVertexFinder.cc.

References pwdgSkimBPark_cfi::beamSpot, RecoVertex::convertError(), RecoVertex::convertPos(), BeamMonitor_cff::primaryVertex, and vertices().

534  {
535  return vertices(RecoVertex::convertPos(primaryVertex.position()),
537  beamSpot,
538  primaries,
539  ghostTrack);
540 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
primaryVertex
hltOfflineBeamSpot for HLTMON

◆ vertices() [16/16]

std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const GhostTrack ghostTrack,
const CachingVertex< 5 > &  primary = CachingVertex<5>(),
const reco::BeamSpot beamSpot = reco::BeamSpot(),
bool  hasBeamSpot = false,
bool  hasPrimaries = false 
) const

Definition at line 1005 of file GhostTrackVertexFinder.cc.

References pwdgSkimBPark_cfi::beamSpot, gather_cfg::cout, MillePedeFileConverter_cfg::e, fitType_, info(), initialVertices(), CachingVertex< N >::isValid(), kRefitGhostTrackWithVertices, reco::GhostTrack::prediction(), reassignTracks(), recursiveMerge(), refitGhostTrack(), mps_fire::result, edm::swap(), DiMuonV_cfg::tracks, transientGhostTrack(), trackerHitRTTI::vector, vertices(), and L1BJetProducer_cff::vtx.

1009  {
1010  FinderInfo info(primary, ghostTrack, beamSpot, hasBeamSpot, hasPrimaries);
1011 
1012  std::vector<TransientVertex> result;
1013  if (info.states.empty())
1014  return result;
1015 
1016  info.field = info.states[0].track().field();
1017  info.ghostTrack = transientGhostTrack(info.pred, info.field);
1018 
1019  std::vector<CachingVertex<5> > vertices = initialVertices(info);
1020  if (primary.isValid()) {
1021  vertices.push_back(primary);
1022  if (vertices.size() > 1)
1023  std::swap(vertices.front(), vertices.back());
1024  }
1025 
1026  unsigned int reassigned = 0;
1027  while (reassigned < 3) {
1028  if (vertices.size() < 2)
1029  break;
1030 
1031 #ifdef DEBUG
1032  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices.begin(); iter != vertices.end(); ++iter)
1033 
1034  debugVertex(*iter, ghostTrack.prediction());
1035 
1036  std::cout << "----- recursive merging: ---------" << std::endl;
1037 #endif
1038 
1039  bool changed = recursiveMerge(vertices, info);
1040  if ((!changed && !reassigned) || vertices.size() < 2)
1041  break;
1042  if (changed)
1043  reassigned = 0;
1044 
1047  changed = true;
1048  }
1049 
1050  try {
1051 #ifdef DEBUG
1052  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices.begin(); iter != vertices.end(); ++iter)
1053  debugVertex(*iter, ghostTrack.prediction());
1054  std::cout << "----- reassignment: ---------" << std::endl;
1055 #endif
1056  if (reassignTracks(vertices, info)) {
1057  reassigned++;
1058  changed = true;
1059  } else
1060  reassigned = 0;
1061  } catch (const VertexException &e) {
1062  // just keep vertices as they are
1063  }
1064 
1065  if (!changed)
1066  break;
1067  }
1068 
1069  for (std::vector<CachingVertex<5> >::const_iterator iter = vertices.begin(); iter != vertices.end(); ++iter) {
1070  std::vector<RefCountedVertexTrack> tracks = iter->tracks();
1071  std::vector<RefCountedVertexTrack> newTracks;
1072  newTracks.reserve(tracks.size());
1073 
1074  std::remove_copy_if(tracks.begin(), tracks.end(), std::back_inserter(newTracks), VtxTrackIs(info.ghostTrack));
1075 
1076  if (newTracks.empty())
1077  continue;
1078 
1079  CachingVertex<5> vtx(iter->vertexState(), newTracks, iter->totalChiSquared());
1080  result.push_back(vtx);
1081  }
1082 
1083  return result;
1084 }
static const TGPicture * info(bool iBackgroundIsBlack)
Common base class.
static TransientTrack transientGhostTrack(const GhostTrackPrediction &pred, const MagneticField *field)
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
bool recursiveMerge(std::vector< CachingVertex< 5 > > &vertices, const FinderInfo &info) const
bool reassignTracks(std::vector< CachingVertex< 5 > > &vertices, const FinderInfo &info) const
void refitGhostTrack(std::vector< CachingVertex< 5 > > &vertices, FinderInfo &info) const
bool isValid() const
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
std::vector< CachingVertex< 5 > > initialVertices(const FinderInfo &info) const

Member Data Documentation

◆ fitType_

FitType reco::GhostTrackVertexFinder::fitType_
private

Definition at line 155 of file GhostTrackVertexFinder.h.

Referenced by mergeVertices(), reassignTracks(), and vertices().

◆ ghostTrackFitter_

std::unique_ptr<GhostTrackFitter> reco::GhostTrackVertexFinder::ghostTrackFitter_
mutableprivate

Definition at line 157 of file GhostTrackVertexFinder.h.

Referenced by ghostTrackFitter().

◆ maxFitChi2_

double reco::GhostTrackVertexFinder::maxFitChi2_
private

Definition at line 151 of file GhostTrackVertexFinder.h.

Referenced by recursiveMerge().

◆ mergeThreshold_

double reco::GhostTrackVertexFinder::mergeThreshold_
private

Definition at line 152 of file GhostTrackVertexFinder.h.

Referenced by recursiveMerge().

◆ primcut_

double reco::GhostTrackVertexFinder::primcut_
private

Definition at line 153 of file GhostTrackVertexFinder.h.

Referenced by reassignTracks(), recursiveMerge(), and vertexFitter().

◆ primVertexFitter_

std::unique_ptr<VertexFitter<5> > reco::GhostTrackVertexFinder::primVertexFitter_
mutableprivate

Definition at line 158 of file GhostTrackVertexFinder.h.

Referenced by vertexFitter().

◆ seccut_

double reco::GhostTrackVertexFinder::seccut_
private

Definition at line 154 of file GhostTrackVertexFinder.h.

Referenced by reassignTracks(), recursiveMerge(), and vertexFitter().

◆ secVertexFitter_

std::unique_ptr<VertexFitter<5> > reco::GhostTrackVertexFinder::secVertexFitter_
mutableprivate

Definition at line 159 of file GhostTrackVertexFinder.h.

Referenced by vertexFitter().