CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::auto_ptr< GhostTrackFitterghostTrackFitter_
 
double maxFitChi2_
 
double mergeThreshold_
 
double primcut_
 
std::auto_ptr< VertexFitter< 5 > > primVertexFitter_
 
double seccut_
 
std::auto_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 
)

Definition at line 284 of file GhostTrackVertexFinder.cc.

286  :
287  maxFitChi2_(maxFitChi2),
288  mergeThreshold_(mergeThreshold),
289  primcut_(primcut),
290  seccut_(seccut),
291  fitType_(fitType)
292 {
293 }
GhostTrackVertexFinder::~GhostTrackVertexFinder ( )

Definition at line 295 of file GhostTrackVertexFinder.cc.

296 {
297 }

Member Function Documentation

GhostTrackFitter & GhostTrackVertexFinder::ghostTrackFitter ( ) const
private

Definition at line 299 of file GhostTrackVertexFinder.cc.

References ghostTrackFitter_.

Referenced by vertices().

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

Definition at line 751 of file GhostTrackVertexFinder.cc.

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

Referenced by vertices().

753 {
754  std::vector<CachingVertex<5> > vertices;
755  for(std::vector<GhostTrackState>::const_iterator iter =
756  info.states.begin(); iter != info. states.end(); ++iter) {
757 
758  if (!iter->isValid())
759  continue;
760 
761  GhostTrackState state(*iter);
762  state.linearize(info.pred);
763 
764  if (!state.isValid())
765  continue;
766 
767  CachingVertex<5> vtx = vertexAtState(info.ghostTrack,
768  info.pred, state);
769 
770  if (vtx.isValid()) // && fitChi2(vtx) < maxFitChi2_)
771  vertices.push_back(vtx);
772  }
773 
774  return vertices;
775 }
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
char state
Definition: procUtils.cc:75
bool isValid() const
Definition: CachingVertex.h:96
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 800 of file GhostTrackVertexFinder.cc.

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

Referenced by recursiveMerge().

805 {
806  VertexTrackFactory<5> vertexTrackFactory;
807 
809  vertex2.vertexState());
810  std::vector<RefCountedVertexTrack> linTracks;
811  VtxTrackIs isGhostTrack(info.ghostTrack);
812  RefCountedVertexTrack vtxGhostTrack;
813 
814  mergeTrackHelper(vertex1.tracks(), linTracks, state,
815  isGhostTrack, vtxGhostTrack, vertexTrackFactory);
816  mergeTrackHelper(vertex2.tracks(), linTracks, state,
817  isGhostTrack, vtxGhostTrack, vertexTrackFactory);
818 
819  if (vtxGhostTrack &&
820  (fitType_ == kAlwaysWithGhostTrack || linTracks.size() < 2))
821  linTracks.push_back(
822  vertexTrackFactory.vertexTrack(
823  vtxGhostTrack->linearizedTrack(),
824  vtxGhostTrack->vertexState()));
825 
826  try {
827  CachingVertex<5> vtx;
828  if (info.hasBeamSpot && isPrimary)
829  vtx = vertexFitter(true).vertex(linTracks,
830  info.beamSpot.position(),
831  info.beamSpot.error());
832  else
833  vtx = vertexFitter(isPrimary).vertex(linTracks);
834  if (vtx.isValid())
835  return vtx;
836  } catch(const VertexException &e) {
837  // fit failed
838  }
839 
840  return CachingVertex<5>();
841 }
std::vector< RefCountedVertexTrack > tracks() const
Definition: CachingVertex.h:91
VertexState vertexState() const
Definition: CachingVertex.h:85
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
Common base class.
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
char state
Definition: procUtils.cc:75
bool isValid() const
Definition: CachingVertex.h:96
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 933 of file GhostTrackVertexFinder.cc.

References reco::GhostTrackVertexFinder::FinderInfo::beamSpot, alignCSCRings::e, VertexState::error(), fitType_, reco::GhostTrackVertexFinder::FinderInfo::ghostTrack, reco::GhostTrackVertexFinder::FinderInfo::hasBeamSpot, customizeTrackingMonitorSeedNumber::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(), trackVertexCompat(), VertexFitter< N >::vertex(), vertexAtState(), vertexFitter(), VertexTrackFactory< N >::vertexTrack(), and vertices().

Referenced by vertices().

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

References fitChi2(), i, CachingVertex< N >::isValid(), j, max(), maxFitChi2_, mergeThreshold_, mergeVertices(), min, n, BeamSpotFilterParameters_cfi::newVtx, primcut_, seccut_, std::swap(), vertexCompat(), and vertices().

Referenced by vertices().

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

Definition at line 1073 of file GhostTrackVertexFinder.cc.

References reco::GhostTrackVertexFinder::FinderInfo::beamSpot, alignCSCRings::e, VertexState::error(), reco::GhostTrackVertexFinder::FinderInfo::field, reco::SequentialGhostTrackFitter::fit(), ghostTrackES_cfi::ghostTrack, reco::GhostTrackVertexFinder::FinderInfo::ghostTrack, reco::GhostTrackVertexFinder::FinderInfo::hasBeamSpot, customizeTrackingMonitorSeedNumber::idx, CachingVertex< N >::isValid(), LinearizedTrackStateFactory::linearizedTrackState(), VertexState::position(), reco::GhostTrackVertexFinder::FinderInfo::pred, reco::GhostTrackVertexFinder::FinderInfo::prior, reco::GhostTrackVertexFinder::FinderInfo::states, std::swap(), transientGhostTrack(), groupFilesInBlocks::tt, VertexFitter< N >::vertex(), vertexAtState(), vertexFitter(), VertexTrackFactory< N >::vertexTrack(), and vertices().

Referenced by vertices().

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

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

Referenced by recursiveMerge().

242 {
243  Vector3 diff = conv(vtx2.position() - vtx1.position());
244  Matrix3S cov = scale1 * vtx1.error().matrix_new() +
245  scale2 * vtx2.error().matrix_new();
246 
247  return sqr(ROOT::Math::Dot(diff, diff)) / ROOT::Math::Similarity(cov, diff);
248 }
static HepMC::IO_HEPEVT conv
const AlgebraicSymMatrix33 & matrix_new() 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 307 of file GhostTrackVertexFinder.cc.

References primcut_, primVertexFitter_, seccut_, and secVertexFitter_.

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

308 {
309  std::auto_ptr<VertexFitter<5> > *ptr =
310  primary ? &primVertexFitter_ : &secVertexFitter_;
311  if (!ptr->get())
312  ptr->reset(new AdaptiveVertexFitter(
313  GeometricAnnealing(primary
314  ? primcut_ : seccut_)));
315 
316  return **ptr;
317 }
std::auto_ptr< VertexFitter< 5 > > primVertexFitter_
std::auto_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 378 of file GhostTrackVertexFinder.cc.

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

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

383 {
384  return vertices(RecoVertex::convertPos(primaryVertex.position()),
385  RecoVertex::convertError(primaryVertex.error()),
386  direction, coneRadius, tracks);
387 }
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:93
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
tuple tracks
Definition: testEve_cfg.py:39
Error error() const
return SMatrix
Definition: Vertex.h:116
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 414 of file GhostTrackVertexFinder.cc.

References reco::GhostTrackFitter::fit(), ghostTrackES_cfi::ghostTrack, ghostTrackFitter(), reco::GhostTrack::prediction(), query::result, and vertices().

420 {
422  ghostTrackFitter().fit(primaryPosition, primaryError,
423  direction, coneRadius, tracks);
424 
425  CachingVertex<5> primary(primaryPosition, primaryError,
426  std::vector<RefCountedVertexTrack>(), 0.);
427 
428  std::vector<TransientVertex> result = vertices(ghostTrack, primary);
429 
430 #ifdef DEBUG
431  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
432  iter != result.end(); ++iter)
433  debugVertex(*iter, ghostTrack.prediction());
434 #endif
435 
436  return result;
437 }
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
tuple result
Definition: query.py:137
tuple tracks
Definition: testEve_cfg.py:39
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 389 of file GhostTrackVertexFinder.cc.

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

395 {
396  return vertices(RecoVertex::convertPos(primaryVertex.position()),
397  RecoVertex::convertError(primaryVertex.error()),
398  direction, coneRadius, beamSpot, tracks);
399 }
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:93
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
tuple tracks
Definition: testEve_cfg.py:39
Error error() const
return SMatrix
Definition: Vertex.h:116
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 439 of file GhostTrackVertexFinder.cc.

References reco::GhostTrackFitter::fit(), ghostTrackES_cfi::ghostTrack, ghostTrackFitter(), reco::GhostTrack::prediction(), query::result, and vertices().

446 {
448  ghostTrackFitter().fit(primaryPosition, primaryError,
449  direction, coneRadius, tracks);
450 
451  CachingVertex<5> primary(primaryPosition, primaryError,
452  std::vector<RefCountedVertexTrack>(), 0.);
453 
454  std::vector<TransientVertex> result =
455  vertices(ghostTrack, primary, beamSpot, true);
456 
457 #ifdef DEBUG
458  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
459  iter != result.end(); ++iter)
460  debugVertex(*iter, ghostTrack.prediction());
461 #endif
462 
463  return result;
464 }
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
tuple result
Definition: query.py:137
tuple tracks
Definition: testEve_cfg.py:39
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 401 of file GhostTrackVertexFinder.cc.

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

408 {
409  return vertices(RecoVertex::convertPos(primaryVertex.position()),
410  RecoVertex::convertError(primaryVertex.error()),
411  direction, coneRadius, beamSpot, primaries, tracks);
412 }
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:93
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
tuple tracks
Definition: testEve_cfg.py:39
Error error() const
return SMatrix
Definition: Vertex.h:116
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 466 of file GhostTrackVertexFinder.cc.

References reco::GhostTrackFitter::fit(), ghostTrackES_cfi::ghostTrack, ghostTrackFitter(), LinearizedTrackStateFactory::linearizedTrackState(), reco::GhostTrack::prediction(), query::result, evf::utils::state, VertexTrackFactory< N >::vertexTrack(), and vertices().

474 {
476  ghostTrackFitter().fit(primaryPosition, primaryError,
477  direction, coneRadius, tracks);
478 
479  std::vector<RefCountedVertexTrack> primaryVertexTracks;
480  if (!primaries.empty()) {
481  LinearizedTrackStateFactory linTrackFactory;
482  VertexTrackFactory<5> vertexTrackFactory;
483 
484  VertexState state(primaryPosition, primaryError);
485 
486  for(std::vector<TransientTrack>::const_iterator iter =
487  primaries.begin(); iter != primaries.end(); ++iter) {
488 
489  RefCountedLinearizedTrackState linState =
490  linTrackFactory.linearizedTrackState(
491  primaryPosition, *iter);
492 
493  primaryVertexTracks.push_back(
494  vertexTrackFactory.vertexTrack(
495  linState, state));
496  }
497  }
498 
499  CachingVertex<5> primary(primaryPosition, primaryError,
500  primaryVertexTracks, 0.);
501 
502  std::vector<TransientVertex> result =
503  vertices(ghostTrack, primary, beamSpot, true, true);
504 
505 #ifdef DEBUG
506  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
507  iter != result.end(); ++iter)
508  debugVertex(*iter, ghostTrack.prediction());
509 #endif
510 
511  return result;
512 }
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
tuple result
Definition: query.py:137
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const
tuple tracks
Definition: testEve_cfg.py:39
char state
Definition: procUtils.cc:75
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 637 of file GhostTrackVertexFinder.cc.

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

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

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

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

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

701 {
702  GhostTrack ghostTrack_(ghostTrack, tracks, weights,
703  dummyPrediction(primaryVertex, ghostTrack),
704  RecoVertex::convertPos(primaryVertex.position()),
705  true);
706 
707  std::vector<RefCountedVertexTrack> primaryVertexTracks;
708  if (!primaries.empty()) {
709  LinearizedTrackStateFactory linTrackFactory;
710  VertexTrackFactory<5> vertexTrackFactory;
711 
713  RecoVertex::convertPos(primaryVertex.position()),
714  RecoVertex::convertError(primaryVertex.error()));
715 
716  for(std::vector<TransientTrack>::const_iterator iter =
717  primaries.begin(); iter != primaries.end(); ++iter) {
718 
719  RefCountedLinearizedTrackState linState =
720  linTrackFactory.linearizedTrackState(
721  state.position(), *iter);
722 
723  primaryVertexTracks.push_back(
724  vertexTrackFactory.vertexTrack(
725  linState, state));
726  }
727  }
728 
729  CachingVertex<5> primary(
730  RecoVertex::convertPos(primaryVertex.position()),
731  RecoVertex::convertError(primaryVertex.error()),
732  primaryVertexTracks, 0.);
733 
734  std::vector<TransientVertex> result =
735  vertices(ghostTrack_, primary, beamSpot, true, true);
736 
737 #ifdef DEBUG
738  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
739  iter != result.end(); ++iter)
740  debugVertex(*iter, ghostTrack_.prediction());
741 #endif
742 
743  return result;
744 }
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:93
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
tuple result
Definition: query.py:137
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const
static GhostTrackPrediction dummyPrediction(const Vertex &primaryVertex, const Track &ghostTrack)
tuple tracks
Definition: testEve_cfg.py:39
Error error() const
return SMatrix
Definition: Vertex.h:116
char state
Definition: procUtils.cc:75
std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const GlobalPoint primaryPosition,
const GlobalError primaryError,
const GhostTrack ghostTrack 
) const

Definition at line 514 of file GhostTrackVertexFinder.cc.

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

518 {
519  CachingVertex<5> primary(primaryPosition, primaryError,
520  std::vector<RefCountedVertexTrack>(), 0.);
521 
522  std::vector<TransientVertex> result = vertices(ghostTrack, primary);
523 
524 #ifdef DEBUG
525  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
526  iter != result.end(); ++iter)
527  debugVertex(*iter, ghostTrack.prediction());
528 #endif
529 
530  return result;
531 }
std::vector< TransientVertex > vertices(const reco::Vertex &primaryVertex, const GlobalVector &direction, double coneRadius, const std::vector< TransientTrack > &tracks) const
tuple result
Definition: query.py:137
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 534 of file GhostTrackVertexFinder.cc.

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

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

References LinearizedTrackStateFactory::linearizedTrackState(), reco::GhostTrack::prediction(), query::result, evf::utils::state, VertexTrackFactory< N >::vertexTrack(), and vertices().

561 {
562  std::vector<RefCountedVertexTrack> primaryVertexTracks;
563  if (!primaries.empty()) {
564  LinearizedTrackStateFactory linTrackFactory;
565  VertexTrackFactory<5> vertexTrackFactory;
566 
567  VertexState state(primaryPosition, primaryError);
568 
569  for(std::vector<TransientTrack>::const_iterator iter =
570  primaries.begin(); iter != primaries.end(); ++iter) {
571 
572  RefCountedLinearizedTrackState linState =
573  linTrackFactory.linearizedTrackState(
574  primaryPosition, *iter);
575 
576  primaryVertexTracks.push_back(
577  vertexTrackFactory.vertexTrack(
578  linState, state));
579  }
580  }
581 
582  CachingVertex<5> primary(primaryPosition, primaryError,
583  primaryVertexTracks, 0.);
584 
585  std::vector<TransientVertex> result =
586  vertices(ghostTrack, primary, beamSpot, true, true);
587 
588 #ifdef DEBUG
589  for(std::vector<TransientVertex>::const_iterator iter = result.begin();
590  iter != result.end(); ++iter)
591  debugVertex(*iter, ghostTrack.prediction());
592 #endif
593 
594  return result;
595 }
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
tuple result
Definition: query.py:137
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const
char state
Definition: procUtils.cc:75
const GhostTrackPrediction & prediction() const
Definition: GhostTrack.h:41
std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const GhostTrack ghostTrack 
) const

Definition at line 597 of file GhostTrackVertexFinder.cc.

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

600 {
601  return vertices(RecoVertex::convertPos(primaryVertex.position()),
602  RecoVertex::convertError(primaryVertex.error()),
603  ghostTrack);
604 }
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:93
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:116
std::vector< TransientVertex > GhostTrackVertexFinder::vertices ( const reco::Vertex primaryVertex,
const reco::BeamSpot beamSpot,
const GhostTrack ghostTrack 
) const

Definition at line 606 of file GhostTrackVertexFinder.cc.

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

610 {
611  return vertices(RecoVertex::convertPos(primaryVertex.position()),
612  RecoVertex::convertError(primaryVertex.error()),
613  beamSpot, ghostTrack);
614 }
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:93
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:116
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 616 of file GhostTrackVertexFinder.cc.

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

621 {
622  return vertices(RecoVertex::convertPos(primaryVertex.position()),
623  RecoVertex::convertError(primaryVertex.error()),
624  beamSpot, primaries, ghostTrack);
625 }
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:93
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:116
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 1197 of file GhostTrackVertexFinder.cc.

References gather_cfg::cout, alignCSCRings::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(), query::result, reco::GhostTrackVertexFinder::FinderInfo::states, std::swap(), transientGhostTrack(), and vertices().

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

Member Data Documentation

FitType reco::GhostTrackVertexFinder::fitType_
private

Definition at line 180 of file GhostTrackVertexFinder.h.

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

std::auto_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::auto_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::auto_ptr<VertexFitter<5> > reco::GhostTrackVertexFinder::secVertexFitter_
mutableprivate

Definition at line 184 of file GhostTrackVertexFinder.h.

Referenced by vertexFitter().