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

Constructor & Destructor Documentation

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

Definition at line 294 of file GhostTrackVertexFinder.cc.

295 {
296 }

Member Function Documentation

GhostTrackFitter & GhostTrackVertexFinder::ghostTrackFitter ( ) const
private

Definition at line 298 of file GhostTrackVertexFinder.cc.

References ghostTrackFitter_.

Referenced by vertices().

299 {
300  if (!ghostTrackFitter_.get())
302 
303  return *ghostTrackFitter_;
304 }
std::unique_ptr< GhostTrackFitter > ghostTrackFitter_
std::vector< CachingVertex< 5 > > GhostTrackVertexFinder::initialVertices ( const FinderInfo info) const
private

Definition at line 750 of file GhostTrackVertexFinder.cc.

References reco::GhostTrackVertexFinder::FinderInfo::ghostTrack, reco::GhostTrackState::isValid(), CachingVertex< N >::isValid(), reco::GhostTrackState::linearize(), reco::GhostTrackVertexFinder::FinderInfo::pred, reco::GhostTrackVertexFinder::FinderInfo::states, vertexAtState(), and vertices().

Referenced by vertices().

752 {
753  std::vector<CachingVertex<5> > vertices;
754  for(std::vector<GhostTrackState>::const_iterator iter =
755  info.states.begin(); iter != info. states.end(); ++iter) {
756 
757  if (!iter->isValid())
758  continue;
759 
760  GhostTrackState state(*iter);
761  state.linearize(info.pred);
762 
763  if (!state.isValid())
764  continue;
765 
766  CachingVertex<5> vtx = vertexAtState(info.ghostTrack,
767  info.pred, state);
768 
769  if (vtx.isValid()) // && fitChi2(vtx) < maxFitChi2_)
770  vertices.push_back(vtx);
771  }
772 
773  return vertices;
774 }
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
bool isValid() const
static CachingVertex< 5 > vertexAtState(const TransientTrack &ghostTrack, const GhostTrackPrediction &pred, const GhostTrackState &state)
CachingVertex< 5 > GhostTrackVertexFinder::mergeVertices ( const CachingVertex< 5 > &  vertex1,
const CachingVertex< 5 > &  vertex2,
const FinderInfo info,
bool  isPrimary 
) const
private

Definition at line 799 of file GhostTrackVertexFinder.cc.

References reco::GhostTrackVertexFinder::FinderInfo::beamSpot, MillePedeFileConverter_cfg::e, VertexState::error(), fitType_, reco::GhostTrackVertexFinder::FinderInfo::ghostTrack, reco::GhostTrackVertexFinder::FinderInfo::hasBeamSpot, CachingVertex< N >::isValid(), kAlwaysWithGhostTrack, mergeTrackHelper(), VertexState::position(), stateMean(), CachingVertex< N >::tracks(), VertexFitter< N >::vertex(), vertexFitter(), CachingVertex< N >::vertexState(), VertexTrackFactory< N >::vertexTrack(), and badGlobalMuonTaggersAOD_cff::vtx.

Referenced by recursiveMerge().

804 {
805  VertexTrackFactory<5> vertexTrackFactory;
806 
807  VertexState state = stateMean(vertex1.vertexState(),
808  vertex2.vertexState());
809  std::vector<RefCountedVertexTrack> linTracks;
810  VtxTrackIs isGhostTrack(info.ghostTrack);
811  RefCountedVertexTrack vtxGhostTrack;
812 
813  mergeTrackHelper(vertex1.tracks(), linTracks, state,
814  isGhostTrack, vtxGhostTrack, vertexTrackFactory);
815  mergeTrackHelper(vertex2.tracks(), linTracks, state,
816  isGhostTrack, vtxGhostTrack, vertexTrackFactory);
817 
818  if (vtxGhostTrack &&
819  (fitType_ == kAlwaysWithGhostTrack || linTracks.size() < 2))
820  linTracks.push_back(
821  vertexTrackFactory.vertexTrack(
822  vtxGhostTrack->linearizedTrack(),
823  vtxGhostTrack->vertexState()));
824 
825  try {
827  if (info.hasBeamSpot && isPrimary)
828  vtx = vertexFitter(true).vertex(linTracks,
829  info.beamSpot.position(),
830  info.beamSpot.error());
831  else
832  vtx = vertexFitter(isPrimary).vertex(linTracks);
833  if (vtx.isValid())
834  return vtx;
835  } catch(const VertexException &e) {
836  // fit failed
837  }
838 
839  return CachingVertex<5>();
840 }
std::vector< RefCountedVertexTrack > tracks() const
static const TGPicture * info(bool iBackgroundIsBlack)
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
Common base class.
VertexState const & vertexState() const
static VertexState stateMean(const VertexState &v1, const VertexState &v2)
virtual CachingVertex< N > vertex(const std::vector< reco::TransientTrack > &tracks) const =0
VertexFitter< 5 > & vertexFitter(bool primary) const
bool isValid() 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)
bool GhostTrackVertexFinder::reassignTracks ( std::vector< CachingVertex< 5 > > &  vertices,
const FinderInfo info 
) const
private

Definition at line 932 of file GhostTrackVertexFinder.cc.

References reco::GhostTrackVertexFinder::FinderInfo::beamSpot, MillePedeFileConverter_cfg::e, VertexState::error(), fitType_, reco::GhostTrackVertexFinder::FinderInfo::ghostTrack, reco::GhostTrackVertexFinder::FinderInfo::hasBeamSpot, training_settings::idx, CachingVertex< N >::isValid(), kAlwaysWithGhostTrack, reco::GhostTrackPrediction::lambda(), LinearizedTrackStateFactory::linearizedTrackState(), VertexState::position(), TransientVertex::position(), reco::GhostTrackVertexFinder::FinderInfo::pred, primcut_, relinearizeTrack(), relinearizeTracks(), seccut_, funct::sqr(), reco::GhostTrackVertexFinder::FinderInfo::states, std::swap(), HiIsolationCommonParameters_cff::track, reco::TransientTrack::track(), trackVertexCompat(), VertexFitter< N >::vertex(), vertexAtState(), vertexFitter(), VertexTrackFactory< N >::vertexTrack(), vertices(), and badGlobalMuonTaggersAOD_cff::vtx.

Referenced by vertices().

935 {
936  std::vector<std::pair<RefCountedVertexTrack,
937  std::vector<RefCountedVertexTrack> > >
938  trackBundles(vertices_.size());
939 
940  VtxTrackIs isGhostTrack(info.ghostTrack);
941 
942  bool assignmentChanged = false;
943  for(std::vector<CachingVertex<5> >::const_iterator iter =
944  vertices_.begin(); iter != vertices_.end(); ++iter) {
945  std::vector<RefCountedVertexTrack> vtxTracks = iter->tracks();
946 
947  if (vtxTracks.empty()) {
948  LinearizedTrackStateFactory linTrackFactory;
949  VertexTrackFactory<5> vertexTrackFactory;
950 
951  RefCountedLinearizedTrackState linState =
952  linTrackFactory.linearizedTrackState(
953  iter->position(), info.ghostTrack);
954 
955  trackBundles[iter - vertices_.begin()].first =
956  vertexTrackFactory.vertexTrack(
957  linState, iter->vertexState());
958  }
959 
960  for(std::vector<RefCountedVertexTrack>::const_iterator track =
961  vtxTracks.begin(); track != vtxTracks.end(); ++track) {
962 
963  if (isGhostTrack(*track)) {
964  trackBundles[iter - vertices_.begin()]
965  .first = *track;
966  continue;
967  }
968 
969  if ((*track)->weight() < 1e-3) {
970  trackBundles[iter - vertices_.begin()]
971  .second.push_back(*track);
972  continue;
973  }
974 
975  unsigned int idx = iter - vertices_.begin();
976  double best = 1.0e9;
977  for(std::vector<CachingVertex<5> >::const_iterator
978  vtx = vertices_.begin();
979  vtx != vertices_.end(); ++vtx) {
980  if (info.pred.lambda(vtx->position()) <
981  info.pred.lambda(vertices_[0].position()))
982  continue;
983 
984  double compat =
986 
987  compat /= (vtx == vertices_.begin()) ?
988  primcut_ : seccut_;
989 
990  if (compat < best) {
991  best = compat;
992  idx = vtx - vertices_.begin();
993  }
994  }
995 
996  if ((int)idx != iter - vertices_.begin())
997  assignmentChanged = true;
998 
999  trackBundles[idx].second.push_back(*track);
1000  }
1001  }
1002 
1003  if (!assignmentChanged)
1004  return false;
1005 
1006  VertexTrackFactory<5> vertexTrackFactory;
1007  std::vector<CachingVertex<5> > vertices;
1008  vertices.reserve(vertices_.size());
1009 
1010  for(std::vector<CachingVertex<5> >::const_iterator iter =
1011  vertices_.begin(); iter != vertices_.end(); ++iter) {
1012  const std::vector<RefCountedVertexTrack> &tracks =
1013  trackBundles[iter - vertices_.begin()].second;
1014  if (tracks.empty())
1015  continue;
1016 
1018 
1019  if (tracks.size() == 1) {
1020  const TransientTrack &track =
1021  tracks[0]->linearizedTrack()->track();
1022 
1023  int idx = -1;
1024  for(std::vector<GhostTrackState>::const_iterator iter =
1025  info.states.begin();
1026  iter != info.states.end(); ++iter) {
1027  if (iter->isTrack() && iter->track() == track) {
1028  idx = iter - info.states.begin();
1029  break;
1030  }
1031  }
1032  if (idx < 0)
1033  continue;
1034 
1035  vtx = vertexAtState(info.ghostTrack, info.pred,
1036  info.states[idx]);
1037  if (!vtx.isValid())
1038  continue;
1039  } else {
1040  std::vector<RefCountedVertexTrack> linTracks =
1041  relinearizeTracks(tracks, iter->vertexState());
1042 
1044  linTracks.push_back(relinearizeTrack(
1045  trackBundles[iter - vertices_.begin()].first,
1046  iter->vertexState(), vertexTrackFactory));
1047 
1048  bool primary = iter == vertices_.begin();
1049  try {
1050  if (primary && info.hasBeamSpot)
1051  vtx = vertexFitter(true).vertex(
1052  linTracks,
1053  info.beamSpot.position(),
1054  info.beamSpot.error());
1055  else
1056  vtx = vertexFitter(primary).vertex(
1057  linTracks);
1058  } catch(const VertexException &e) {
1059  // fit failed;
1060  }
1061  if (!vtx.isValid())
1062  return false;
1063  }
1064 
1065  vertices.push_back(vtx);
1066  };
1067 
1068  std::swap(vertices_, vertices);
1069  return true;
1070 }
static const TGPicture * info(bool iBackgroundIsBlack)
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
Common base class.
static RefCountedVertexTrack relinearizeTrack(const RefCountedVertexTrack &track, const VertexState &state, const VertexTrackFactory< 5 > factory)
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
static std::vector< RefCountedVertexTrack > relinearizeTracks(const std::vector< RefCountedVertexTrack > &tracks, const VertexState &state)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
virtual CachingVertex< N > vertex(const std::vector< reco::TransientTrack > &tracks) const =0
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
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:13
bool isValid() const
static CachingVertex< 5 > vertexAtState(const TransientTrack &ghostTrack, const GhostTrackPrediction &pred, const GhostTrackState &state)
bool GhostTrackVertexFinder::recursiveMerge ( std::vector< CachingVertex< 5 > > &  vertices,
const FinderInfo info 
) const
private

Definition at line 842 of file GhostTrackVertexFinder.cc.

References fitChi2(), mps_fire::i, CachingVertex< N >::isValid(), SiStripPI::max, maxFitChi2_, mergeThreshold_, mergeVertices(), min(), gen::n, trackingPlots::other, primcut_, seccut_, std::swap(), vertexCompat(), and vertices().

Referenced by vertices().

845 {
846  typedef std::pair<unsigned int, unsigned int> Indices;
847 
848  std::multimap<float, Indices> compatMap;
849  unsigned int n = vertices.size();
850  for(unsigned int i = 0; i < n; i++) {
851  const CachingVertex<5> &v1 = vertices[i];
852  for(unsigned int j = i + 1; j < n; j++) {
853  const CachingVertex<5> &v2 = vertices[j];
854 
855  float compat = vertexCompat(v1, v2, info,
856  i == 0 ? primcut_ : seccut_, seccut_);
857 
858  if (compat > mergeThreshold_)
859  continue;
860 
861  compatMap.insert(
862  std::make_pair(compat, Indices(i, j)));
863  }
864  }
865 
866  bool changesMade = false;
867  bool repeat = true;
868  while(repeat) {
869  repeat = false;
870  for(std::multimap<float, Indices>::const_iterator iter =
871  compatMap.begin(); iter != compatMap.end(); ++iter) {
872  unsigned int v1 = iter->second.first;
873  unsigned int v2 = iter->second.second;
874 
875  CachingVertex<5> newVtx =
877  info, v1 == 0);
878  if (!newVtx.isValid() ||
879  (v1 != 0 && fitChi2(newVtx) > maxFitChi2_))
880  continue;
881 
882  std::swap(vertices[v1], newVtx);
883  vertices.erase(vertices.begin() + v2);
884  n--;
885 
886  std::multimap<float, Indices> newCompatMap;
887  for(++iter; iter != compatMap.end(); ++iter) {
888  if (iter->second.first == v1 ||
889  iter->second.first == v2 ||
890  iter->second.second == v1 ||
891  iter->second.second == v2)
892  continue;
893 
894  Indices indices = iter->second;
895  indices.first -= indices.first > v2;
896  indices.second -= indices.second > v2;
897 
898  newCompatMap.insert(std::make_pair(
899  iter->first, indices));
900  }
901  std::swap(compatMap, newCompatMap);
902 
903  for(unsigned int i = 0; i < n; i++) {
904  if (i == v1)
905  continue;
906 
907  const CachingVertex<5> &other = vertices[i];
908  float compat = vertexCompat(
909  vertices[v1], other, info,
910  v1 == 0 ? primcut_ : seccut_,
911  i == 0 ? primcut_ : seccut_);
912 
913  if (compat > mergeThreshold_)
914  continue;
915 
916  compatMap.insert(
917  std::make_pair(
918  compat,
919  Indices(std::min(i, v1),
920  std::max(i, v1))));
921  }
922 
923  changesMade = true;
924  repeat = true;
925  break;
926  }
927  }
928 
929  return changesMade;
930 }
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)
static double fitChi2(const CachingVertex< 5 > &vtx)
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
Indices
Definition: EdmEventSize.cc:29
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
T min(T a, T b)
Definition: MathUtil.h:58
CachingVertex< 5 > mergeVertices(const CachingVertex< 5 > &vertex1, const CachingVertex< 5 > &vertex2, const FinderInfo &info, bool isPrimary) const
bool isValid() const
void GhostTrackVertexFinder::refitGhostTrack ( std::vector< CachingVertex< 5 > > &  vertices,
FinderInfo info 
) const
private

Definition at line 1072 of file GhostTrackVertexFinder.cc.

References reco::GhostTrackVertexFinder::FinderInfo::beamSpot, vertices_cff::chi2, MillePedeFileConverter_cfg::e, VertexState::error(), reco::GhostTrackVertexFinder::FinderInfo::field, reco::SequentialGhostTrackFitter::fit(), reco::GhostTrackVertexFinder::FinderInfo::ghostTrack, reco::GhostTrackVertexFinder::FinderInfo::hasBeamSpot, training_settings::idx, CachingVertex< N >::isValid(), LinearizedTrackStateFactory::linearizedTrackState(), ndof, VertexState::position(), reco::GhostTrackVertexFinder::FinderInfo::pred, reco::GhostTrackVertexFinder::FinderInfo::prior, reco::GhostTrackVertexFinder::FinderInfo::states, std::swap(), HiIsolationCommonParameters_cff::track, transientGhostTrack(), groupFilesInBlocks::tt, VertexFitter< N >::vertex(), vertexAtState(), vertexFitter(), VertexTrackFactory< N >::vertexTrack(), vertices(), and badGlobalMuonTaggersAOD_cff::vtx.

Referenced by vertices().

1075 {
1076  VtxTrackIs isGhostTrack(info.ghostTrack);
1077 
1078  std::vector<GhostTrackState> states;
1079  std::vector<unsigned int> oldStates;
1080  oldStates.reserve(info.states.size());
1081 
1082  for(std::vector<CachingVertex<5> >::const_iterator iter =
1083  vertices.begin(); iter != vertices.end(); ++iter) {
1084  std::vector<RefCountedVertexTrack> vtxTracks = iter->tracks();
1085 
1086  oldStates.clear();
1087  for(std::vector<RefCountedVertexTrack>::const_iterator track =
1088  vtxTracks.begin(); track != vtxTracks.end(); ++track) {
1089 
1090  if (isGhostTrack(*track) || (*track)->weight() < 1e-3)
1091  continue;
1092 
1093  const TransientTrack &tt =
1094  (*track)->linearizedTrack()->track();
1095 
1096  int idx = -1;
1097  for(std::vector<GhostTrackState>::const_iterator iter =
1098  info.states.begin();
1099  iter != info.states.end(); ++iter) {
1100  if (iter->isTrack() && iter->track() == tt) {
1101  idx = iter - info.states.begin();
1102  break;
1103  }
1104  }
1105 
1106  if (idx >= 0)
1107  oldStates.push_back(idx);
1108  }
1109 
1110  if (oldStates.size() == 1)
1111  states.push_back(info.states[oldStates[0]]);
1112  else
1113  states.push_back(GhostTrackState(iter->vertexState()));
1114  }
1115 
1116  KalmanGhostTrackUpdater updater;
1118  double ndof, chi2;
1119  info.pred = fitter.fit(updater, info.prior, states, ndof, chi2);
1120  TransientTrack ghostTrack = transientGhostTrack(info.pred, info.field);
1121 
1122  std::swap(info.states, states);
1123  states.clear();
1124 
1125  std::vector<CachingVertex<5> > newVertices;
1126  for(std::vector<CachingVertex<5> >::const_iterator iter =
1127  vertices.begin(); iter != vertices.end(); ++iter) {
1128  std::vector<RefCountedVertexTrack> vtxTracks = iter->tracks();
1129 
1130  int idx = -1;
1131  bool redo = false;
1132  for(std::vector<RefCountedVertexTrack>::iterator track =
1133  vtxTracks.begin(); track != vtxTracks.end(); ++track) {
1134 
1135  if (isGhostTrack(*track)) {
1136  LinearizedTrackStateFactory linTrackFactory;
1137  VertexTrackFactory<5> vertexTrackFactory;
1138 
1139  *track = vertexTrackFactory.vertexTrack(
1140  linTrackFactory.linearizedTrackState(
1141  iter->position(), ghostTrack),
1142  iter->vertexState());
1143  redo = true;
1144  continue;
1145  }
1146 
1147  const TransientTrack &tt =
1148  (*track)->linearizedTrack()->track();
1149 
1150  if (idx >= 0) {
1151  idx = -1;
1152  break;
1153  }
1154 
1155  for(std::vector<GhostTrackState>::const_iterator it =
1156  info.states.begin();
1157  it != info.states.end(); ++it) {
1158  if (!it->isTrack())
1159  continue;
1160 
1161  if (it->track() == tt) {
1162  idx = it - info.states.begin();
1163  break;
1164  }
1165  }
1166  }
1167 
1168  if (idx >= 0) {
1170  vertexAtState(ghostTrack, info.pred,
1171  info.states[idx]);
1172  if (vtx.isValid())
1173  newVertices.push_back(vtx);
1174  } else if (redo) {
1175  bool primary = iter == vertices.begin();
1177  if (primary && info.hasBeamSpot)
1178  vtx = vertexFitter(true).vertex(
1179  vtxTracks,
1180  info.beamSpot.position(),
1181  info.beamSpot.error());
1182  else
1183  vtx = vertexFitter(primary).vertex(vtxTracks);
1184  if (vtx.isValid())
1185  newVertices.push_back(vtx);
1186  } else
1187  newVertices.push_back(*iter);
1188  }
1189 
1190  std::swap(newVertices, vertices);
1191  info.ghostTrack = ghostTrack;
1192 }
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)
GhostTrackPrediction fit(const GhostTrackFitter::PredictionUpdater &updater, const GhostTrackPrediction &prior, std::vector< GhostTrackState > &states, double &ndof, double &chi2) override
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
virtual CachingVertex< N > vertex(const std::vector< reco::TransientTrack > &tracks) const =0
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
const Track & track() const
VertexFitter< 5 > & vertexFitter(bool primary) const
bool isValid() const
static CachingVertex< 5 > vertexAtState(const TransientTrack &ghostTrack, const GhostTrackPrediction &pred, const GhostTrackState &state)
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 237 of file GhostTrackVertexFinder.cc.

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

Referenced by recursiveMerge().

241 {
242  Vector3 diff = conv(vtx2.position() - vtx1.position());
243  Matrix3S cov = scale1 * vtx1.error().matrix() +
244  scale2 * vtx2.error().matrix();
245 
246  return sqr(ROOT::Math::Dot(diff, diff)) / ROOT::Math::Similarity(cov, diff);
247 }
static HepMC::IO_HEPEVT conv
const AlgebraicSymMatrix33 matrix() const
GlobalPoint position() const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
GlobalError error() const
VertexFitter< 5 > & GhostTrackVertexFinder::vertexFitter ( bool  primary) const
private

Definition at line 306 of file GhostTrackVertexFinder.cc.

References reco::TrackKinematics::add(), FreeTrajectoryState::charge(), gather_cfg::cout, TransientVertex::degreesOfFreedom(), reco::GhostTrackPrediction::direction(), MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, reco::TransientTrack::initialFreeState(), reco::GhostTrackPrediction::lambda(), FreeTrajectoryState::momentum(), TransientVertex::originalTracks(), TransientVertex::position(), TransientVertex::positionError(), primcut_, primVertexFitter_, reco::GhostTrackPrediction::rho(), reco::GhostTrackPrediction::rho2(), seccut_, secVertexFitter_, mathSSE::sqrt(), TransientVertex::totalChiSquared(), HiIsolationCommonParameters_cff::track, reco::TransientTrack::trackBaseRef(), l1t::tracks, tracks_, reco::TrackKinematics::vectorSum(), badGlobalMuonTaggersAOD_cff::vtx, and vtxErrorLong().

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

307 {
308  std::unique_ptr<VertexFitter<5> > *ptr =
309  primary ? &primVertexFitter_ : &secVertexFitter_;
310  if (!ptr->get())
311  ptr->reset(new AdaptiveVertexFitter(
312  GeometricAnnealing(primary
313  ? primcut_ : seccut_)));
314 
315  return **ptr;
316 }
std::unique_ptr< VertexFitter< 5 > > primVertexFitter_
std::unique_ptr< VertexFitter< 5 > > secVertexFitter_
std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const GlobalVector direction,
double  coneRadius,
const std::vector< TransientTrack > &  tracks 
) const

Definition at line 377 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), reco::Vertex::error(), and reco::Vertex::position().

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

382 {
383  return vertices(RecoVertex::convertPos(primaryVertex.position()),
384  RecoVertex::convertError(primaryVertex.error()),
385  direction, coneRadius, tracks);
386 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
const Point & position() const
position
Definition: Vertex.h:109
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
Error error() const
return SMatrix
Definition: Vertex.h:139
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 413 of file GhostTrackVertexFinder.cc.

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

419 {
420  GhostTrack ghostTrack =
421  ghostTrackFitter().fit(primaryPosition, primaryError,
422  direction, coneRadius, tracks);
423 
424  CachingVertex<5> primary(primaryPosition, primaryError,
425  std::vector<RefCountedVertexTrack>(), 0.);
426 
427  std::vector<TransientVertex> result = vertices(ghostTrack, primary);
428 
429 #ifdef DEBUG
430  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
431  iter != result.end(); ++iter)
432  debugVertex(*iter, ghostTrack.prediction());
433 #endif
434 
435  return result;
436 }
GhostTrack fit(const GlobalPoint &priorPosition, const GlobalError &priorError, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
GhostTrackFitter & ghostTrackFitter() const
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
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 388 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), reco::Vertex::error(), reco::Vertex::position(), and vertices().

394 {
395  return vertices(RecoVertex::convertPos(primaryVertex.position()),
396  RecoVertex::convertError(primaryVertex.error()),
397  direction, coneRadius, beamSpot, tracks);
398 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
const Point & position() const
position
Definition: Vertex.h:109
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
Error error() const
return SMatrix
Definition: Vertex.h:139
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 438 of file GhostTrackVertexFinder.cc.

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

445 {
446  GhostTrack ghostTrack =
447  ghostTrackFitter().fit(primaryPosition, primaryError,
448  direction, coneRadius, tracks);
449 
450  CachingVertex<5> primary(primaryPosition, primaryError,
451  std::vector<RefCountedVertexTrack>(), 0.);
452 
453  std::vector<TransientVertex> result =
454  vertices(ghostTrack, primary, beamSpot, true);
455 
456 #ifdef DEBUG
457  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
458  iter != result.end(); ++iter)
459  debugVertex(*iter, ghostTrack.prediction());
460 #endif
461 
462  return result;
463 }
GhostTrack fit(const GlobalPoint &priorPosition, const GlobalError &priorError, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
GhostTrackFitter & ghostTrackFitter() const
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
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 400 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), reco::Vertex::error(), reco::Vertex::position(), and vertices().

407 {
408  return vertices(RecoVertex::convertPos(primaryVertex.position()),
409  RecoVertex::convertError(primaryVertex.error()),
410  direction, coneRadius, beamSpot, primaries, tracks);
411 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
const Point & position() const
position
Definition: Vertex.h:109
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
Error error() const
return SMatrix
Definition: Vertex.h:139
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 465 of file GhostTrackVertexFinder.cc.

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

473 {
474  GhostTrack ghostTrack =
475  ghostTrackFitter().fit(primaryPosition, primaryError,
476  direction, coneRadius, tracks);
477 
478  std::vector<RefCountedVertexTrack> primaryVertexTracks;
479  if (!primaries.empty()) {
480  LinearizedTrackStateFactory linTrackFactory;
481  VertexTrackFactory<5> vertexTrackFactory;
482 
483  VertexState state(primaryPosition, primaryError);
484 
485  for(std::vector<TransientTrack>::const_iterator iter =
486  primaries.begin(); iter != primaries.end(); ++iter) {
487 
488  RefCountedLinearizedTrackState linState =
489  linTrackFactory.linearizedTrackState(
490  primaryPosition, *iter);
491 
492  primaryVertexTracks.push_back(
493  vertexTrackFactory.vertexTrack(
494  linState, state));
495  }
496  }
497 
498  CachingVertex<5> primary(primaryPosition, primaryError,
499  primaryVertexTracks, 0.);
500 
501  std::vector<TransientVertex> result =
502  vertices(ghostTrack, primary, beamSpot, true, true);
503 
504 #ifdef DEBUG
505  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
506  iter != result.end(); ++iter)
507  debugVertex(*iter, ghostTrack.prediction());
508 #endif
509 
510  return result;
511 }
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
GhostTrack fit(const GlobalPoint &priorPosition, const GlobalError &priorError, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
GhostTrackFitter & ghostTrackFitter() const
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
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 636 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), dummyPrediction(), reco::Vertex::error(), reco::Vertex::position(), reco::GhostTrack::prediction(), mps_fire::result, and vertices().

641 {
642  GhostTrack ghostTrack_(ghostTrack, tracks, weights,
643  dummyPrediction(primaryVertex, ghostTrack),
645  primaryVertex.position()),
646  true);
647 
648  CachingVertex<5> primary(
649  RecoVertex::convertPos(primaryVertex.position()),
650  RecoVertex::convertError(primaryVertex.error()),
651  std::vector<RefCountedVertexTrack>(), 0.);
652 
653  std::vector<TransientVertex> result = vertices(ghostTrack_, primary);
654 
655 #ifdef DEBUG
656  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
657  iter != result.end(); ++iter)
658  debugVertex(*iter, ghostTrack_.prediction());
659 #endif
660 
661  return result;
662 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
const Point & position() const
position
Definition: Vertex.h:109
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
static GhostTrackPrediction dummyPrediction(const Vertex &primaryVertex, const Track &ghostTrack)
Error error() const
return SMatrix
Definition: Vertex.h:139
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 664 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), dummyPrediction(), reco::Vertex::error(), reco::Vertex::position(), reco::GhostTrack::prediction(), mps_fire::result, and vertices().

670 {
671  GhostTrack ghostTrack_(ghostTrack, tracks, weights,
672  dummyPrediction(primaryVertex, ghostTrack),
673  RecoVertex::convertPos(primaryVertex.position()),
674  true);
675 
676  CachingVertex<5> primary(
677  RecoVertex::convertPos(primaryVertex.position()),
678  RecoVertex::convertError(primaryVertex.error()),
679  std::vector<RefCountedVertexTrack>(), 0.);
680 
681  std::vector<TransientVertex> result =
682  vertices(ghostTrack_, primary, beamSpot, true);
683 
684 #ifdef DEBUG
685  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
686  iter != result.end(); ++iter)
687  debugVertex(*iter, ghostTrack_.prediction());
688 #endif
689 
690  return result;
691 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
const Point & position() const
position
Definition: Vertex.h:109
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
static GhostTrackPrediction dummyPrediction(const Vertex &primaryVertex, const Track &ghostTrack)
Error error() const
return SMatrix
Definition: Vertex.h:139
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 693 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), dummyPrediction(), reco::Vertex::error(), LinearizedTrackStateFactory::linearizedTrackState(), VertexState::position(), reco::Vertex::position(), reco::GhostTrack::prediction(), mps_fire::result, VertexTrackFactory< N >::vertexTrack(), and vertices().

700 {
701  GhostTrack ghostTrack_(ghostTrack, tracks, weights,
702  dummyPrediction(primaryVertex, ghostTrack),
703  RecoVertex::convertPos(primaryVertex.position()),
704  true);
705 
706  std::vector<RefCountedVertexTrack> primaryVertexTracks;
707  if (!primaries.empty()) {
708  LinearizedTrackStateFactory linTrackFactory;
709  VertexTrackFactory<5> vertexTrackFactory;
710 
711  VertexState state(
712  RecoVertex::convertPos(primaryVertex.position()),
713  RecoVertex::convertError(primaryVertex.error()));
714 
715  for(std::vector<TransientTrack>::const_iterator iter =
716  primaries.begin(); iter != primaries.end(); ++iter) {
717 
718  RefCountedLinearizedTrackState linState =
719  linTrackFactory.linearizedTrackState(
720  state.position(), *iter);
721 
722  primaryVertexTracks.push_back(
723  vertexTrackFactory.vertexTrack(
724  linState, state));
725  }
726  }
727 
728  CachingVertex<5> primary(
729  RecoVertex::convertPos(primaryVertex.position()),
730  RecoVertex::convertError(primaryVertex.error()),
731  primaryVertexTracks, 0.);
732 
733  std::vector<TransientVertex> result =
734  vertices(ghostTrack_, primary, beamSpot, true, true);
735 
736 #ifdef DEBUG
737  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
738  iter != result.end(); ++iter)
739  debugVertex(*iter, ghostTrack_.prediction());
740 #endif
741 
742  return result;
743 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
const Point & position() const
position
Definition: Vertex.h:109
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
static GhostTrackPrediction dummyPrediction(const Vertex &primaryVertex, const Track &ghostTrack)
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
Error error() const
return SMatrix
Definition: Vertex.h:139
std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const GlobalPoint primaryPosition,
const GlobalError primaryError,
const GhostTrack ghostTrack 
) const

Definition at line 513 of file GhostTrackVertexFinder.cc.

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

517 {
518  CachingVertex<5> primary(primaryPosition, primaryError,
519  std::vector<RefCountedVertexTrack>(), 0.);
520 
521  std::vector<TransientVertex> result = vertices(ghostTrack, primary);
522 
523 #ifdef DEBUG
524  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
525  iter != result.end(); ++iter)
526  debugVertex(*iter, ghostTrack.prediction());
527 #endif
528 
529  return result;
530 }
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const GlobalPoint primaryPosition,
const GlobalError primaryError,
const reco::BeamSpot beamSpot,
const GhostTrack ghostTrack 
) const

Definition at line 533 of file GhostTrackVertexFinder.cc.

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

538 {
539  CachingVertex<5> primary(primaryPosition, primaryError,
540  std::vector<RefCountedVertexTrack>(), 0.);
541 
542  std::vector<TransientVertex> result =
543  vertices(ghostTrack, primary, beamSpot, true);
544 
545 #ifdef DEBUG
546  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
547  iter != result.end(); ++iter)
548  debugVertex(*iter, ghostTrack.prediction());
549 #endif
550 
551  return result;
552 }
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
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 554 of file GhostTrackVertexFinder.cc.

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

560 {
561  std::vector<RefCountedVertexTrack> primaryVertexTracks;
562  if (!primaries.empty()) {
563  LinearizedTrackStateFactory linTrackFactory;
564  VertexTrackFactory<5> vertexTrackFactory;
565 
566  VertexState state(primaryPosition, primaryError);
567 
568  for(std::vector<TransientTrack>::const_iterator iter =
569  primaries.begin(); iter != primaries.end(); ++iter) {
570 
571  RefCountedLinearizedTrackState linState =
572  linTrackFactory.linearizedTrackState(
573  primaryPosition, *iter);
574 
575  primaryVertexTracks.push_back(
576  vertexTrackFactory.vertexTrack(
577  linState, state));
578  }
579  }
580 
581  CachingVertex<5> primary(primaryPosition, primaryError,
582  primaryVertexTracks, 0.);
583 
584  std::vector<TransientVertex> result =
585  vertices(ghostTrack, primary, beamSpot, true, true);
586 
587 #ifdef DEBUG
588  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
589  iter != result.end(); ++iter)
590  debugVertex(*iter, ghostTrack.prediction());
591 #endif
592 
593  return result;
594 }
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const GhostTrack ghostTrack 
) const

Definition at line 596 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), reco::Vertex::error(), reco::Vertex::position(), and vertices().

599 {
600  return vertices(RecoVertex::convertPos(primaryVertex.position()),
601  RecoVertex::convertError(primaryVertex.error()),
602  ghostTrack);
603 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
const Point & position() const
position
Definition: Vertex.h:109
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
Error error() const
return SMatrix
Definition: Vertex.h:139
std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const reco::BeamSpot beamSpot,
const GhostTrack ghostTrack 
) const

Definition at line 605 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), reco::Vertex::error(), reco::Vertex::position(), and vertices().

609 {
610  return vertices(RecoVertex::convertPos(primaryVertex.position()),
611  RecoVertex::convertError(primaryVertex.error()),
612  beamSpot, ghostTrack);
613 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
const Point & position() const
position
Definition: Vertex.h:109
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
Error error() const
return SMatrix
Definition: Vertex.h:139
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 615 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), reco::Vertex::error(), reco::Vertex::position(), and vertices().

620 {
621  return vertices(RecoVertex::convertPos(primaryVertex.position()),
622  RecoVertex::convertError(primaryVertex.error()),
623  beamSpot, primaries, ghostTrack);
624 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
const Point & position() const
position
Definition: Vertex.h:109
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
Error error() const
return SMatrix
Definition: Vertex.h:139
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 1196 of file GhostTrackVertexFinder.cc.

References gather_cfg::cout, MillePedeFileConverter_cfg::e, reco::GhostTrackVertexFinder::FinderInfo::field, fitType_, reco::GhostTrackVertexFinder::FinderInfo::ghostTrack, info(), initialVertices(), CachingVertex< N >::isValid(), kRefitGhostTrackWithVertices, reco::GhostTrackVertexFinder::FinderInfo::pred, reco::GhostTrack::prediction(), reassignTracks(), recursiveMerge(), refitGhostTrack(), mps_fire::result, reco::GhostTrackVertexFinder::FinderInfo::states, std::swap(), transientGhostTrack(), vertices(), and badGlobalMuonTaggersAOD_cff::vtx.

1201 {
1202  FinderInfo info(primary, ghostTrack, beamSpot,
1203  hasBeamSpot, hasPrimaries);
1204 
1205  std::vector<TransientVertex> result;
1206  if (info.states.empty())
1207  return result;
1208 
1209  info.field = info.states[0].track().field();
1210  info.ghostTrack = transientGhostTrack(info.pred, info.field);
1211 
1212  std::vector<CachingVertex<5> > vertices = initialVertices(info);
1213  if (primary.isValid()) {
1214  vertices.push_back(primary);
1215  if (vertices.size() > 1)
1216  std::swap(vertices.front(), vertices.back());
1217  }
1218 
1219  unsigned int reassigned = 0;
1220  while(reassigned < 3) {
1221  if (vertices.size() < 2)
1222  break;
1223 
1224 #ifdef DEBUG
1225  for(std::vector<CachingVertex<5> >::const_iterator iter =
1226  vertices.begin(); iter != vertices.end(); ++iter)
1227 
1228  debugVertex(*iter, ghostTrack.prediction());
1229 
1230  std::cout << "----- recursive merging: ---------" << std::endl;
1231 #endif
1232 
1233  bool changed = recursiveMerge(vertices, info);
1234  if ((!changed && !reassigned) || vertices.size() < 2)
1235  break;
1236  if (changed)
1237  reassigned = 0;
1238 
1240  refitGhostTrack(vertices, info);
1241  changed = true;
1242  }
1243 
1244  try {
1245 #ifdef DEBUG
1246  for(std::vector<CachingVertex<5> >::const_iterator
1247  iter = vertices.begin();
1248  iter != vertices.end(); ++iter)
1249  debugVertex(*iter, ghostTrack.prediction());
1250  std::cout << "----- reassignment: ---------" << std::endl;
1251 #endif
1252  if (reassignTracks(vertices, info)) {
1253  reassigned++;
1254  changed = true;
1255  } else
1256  reassigned = 0;
1257  } catch(const VertexException &e) {
1258  // just keep vertices as they are
1259  }
1260 
1261  if (!changed)
1262  break;
1263  }
1264 
1265  for(std::vector<CachingVertex<5> >::const_iterator iter =
1266  vertices.begin(); iter != vertices.end(); ++iter) {
1267  std::vector<RefCountedVertexTrack> tracks = iter->tracks();
1268  std::vector<RefCountedVertexTrack> newTracks;
1269  newTracks.reserve(tracks.size());
1270 
1271  std::remove_copy_if(tracks.begin(), tracks.end(),
1272  std::back_inserter(newTracks),
1273  VtxTrackIs(info.ghostTrack));
1274 
1275  if (newTracks.empty())
1276  continue;
1277 
1278  CachingVertex<5> vtx(iter->vertexState(), newTracks,
1279  iter->totalChiSquared());
1280  result.push_back(vtx);
1281  }
1282 
1283  return result;
1284 }
static const TGPicture * info(bool iBackgroundIsBlack)
Common base class.
bool reassignTracks(std::vector< CachingVertex< 5 > > &vertices, const FinderInfo &info) const
bool recursiveMerge(std::vector< CachingVertex< 5 > > &vertices, const FinderInfo &info) const
static TransientTrack transientGhostTrack(const GhostTrackPrediction &pred, const MagneticField *field)
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
std::vector< CachingVertex< 5 > > initialVertices(const FinderInfo &info) const
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
void refitGhostTrack(std::vector< CachingVertex< 5 > > &vertices, FinderInfo &info) const
bool isValid() const

Member Data Documentation

FitType reco::GhostTrackVertexFinder::fitType_
private

Definition at line 180 of file GhostTrackVertexFinder.h.

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

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

Definition at line 182 of file GhostTrackVertexFinder.h.

Referenced by ghostTrackFitter().

double reco::GhostTrackVertexFinder::maxFitChi2_
private

Definition at line 176 of file GhostTrackVertexFinder.h.

Referenced by recursiveMerge().

double reco::GhostTrackVertexFinder::mergeThreshold_
private

Definition at line 177 of file GhostTrackVertexFinder.h.

Referenced by recursiveMerge().

double reco::GhostTrackVertexFinder::primcut_
private

Definition at line 178 of file GhostTrackVertexFinder.h.

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

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

Definition at line 183 of file GhostTrackVertexFinder.h.

Referenced by vertexFitter().

double reco::GhostTrackVertexFinder::seccut_
private

Definition at line 179 of file GhostTrackVertexFinder.h.

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

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

Definition at line 184 of file GhostTrackVertexFinder.h.

Referenced by vertexFitter().