CMS 3D CMS Logo

Classes | Functions
GhostTrackVertexFinder.cc File Reference
#include <algorithm>
#include <iterator>
#include <vector>
#include <map>
#include <set>
#include <Math/SVector.h>
#include <Math/SMatrix.h>
#include <Math/MatrixFunctions.h>
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "DataFormats/GeometryVector/interface/GlobalVector.h"
#include "DataFormats/GeometryCommonDetAlgo/interface/GlobalError.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
#include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
#include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
#include "TrackingTools/GeomPropagators/interface/AnalyticalImpactPointExtrapolator.h"
#include "TrackingTools/TransientTrack/interface/TransientTrack.h"
#include "TrackingTools/TransientTrack/interface/TransientTrackFromFTSFactory.h"
#include "RecoVertex/VertexPrimitives/interface/TransientVertex.h"
#include "RecoVertex/VertexPrimitives/interface/VertexFitter.h"
#include "RecoVertex/VertexPrimitives/interface/VertexState.h"
#include "RecoVertex/VertexPrimitives/interface/CachingVertex.h"
#include "RecoVertex/VertexPrimitives/interface/LinearizedTrackState.h"
#include "RecoVertex/VertexPrimitives/interface/ConvertError.h"
#include "RecoVertex/VertexPrimitives/interface/ConvertToFromReco.h"
#include "RecoVertex/VertexTools/interface/LinearizedTrackStateFactory.h"
#include "RecoVertex/VertexTools/interface/VertexTrackFactory.h"
#include "RecoVertex/VertexTools/interface/VertexDistance3D.h"
#include "RecoVertex/VertexTools/interface/GeometricAnnealing.h"
#include "RecoVertex/KalmanVertexFit/interface/KalmanVertexFitter.h"
#include "RecoVertex/AdaptiveVertexFit/interface/AdaptiveVertexFitter.h"
#include "RecoVertex/GhostTrackFitter/interface/GhostTrack.h"
#include "RecoVertex/GhostTrackFitter/interface/GhostTrackState.h"
#include "RecoVertex/GhostTrackFitter/interface/GhostTrackFitter.h"
#include "RecoVertex/GhostTrackFitter/interface/GhostTrackPrediction.h"
#include "RecoVertex/GhostTrackFitter/interface/SequentialGhostTrackFitter.h"
#include "RecoVertex/GhostTrackFitter/interface/KalmanGhostTrackUpdater.h"
#include "RecoVertex/GhostTrackFitter/interface/GhostTrackVertexFinder.h"

Go to the source code of this file.

Classes

struct  reco::GhostTrackVertexFinder::FinderInfo
 

Functions

static bool covarianceUpdate (Matrix3S &cov, const Vector3 &residual, const Matrix3S &error, double &chi2, double theta, double phi)
 
static GhostTrackPrediction dummyPrediction (const Vertex &primaryVertex, const Track &ghostTrack)
 
static double fitChi2 (const CachingVertex< 5 > &vtx)
 
static void mergeTrackHelper (const std::vector< RefCountedVertexTrack > &tracks, std::vector< RefCountedVertexTrack > &newTracks, const VertexState &state, const VtxTrackIs &ghostTrackFinder, RefCountedVertexTrack &ghostTrack, const VertexTrackFactory< 5 > &factory)
 
static RefCountedVertexTrack relinearizeTrack (const RefCountedVertexTrack &track, const VertexState &state, const VertexTrackFactory< 5 > factory)
 
static std::vector< RefCountedVertexTrack > relinearizeTracks (const std::vector< RefCountedVertexTrack > &tracks, const VertexState &state)
 
static VertexState stateMean (const VertexState &v1, const VertexState &v2)
 
static double trackVertexCompat (const CachingVertex< 5 > &vtx, const RefCountedVertexTrack &vertexTrack)
 
static TransientTrack transientGhostTrack (const GhostTrackPrediction &pred, const MagneticField *field)
 
static CachingVertex< 5 > vertexAtState (const TransientTrack &ghostTrack, const GhostTrackPrediction &pred, const GhostTrackState &state)
 
static double vtxErrorLong (const GlobalError &error, const GlobalVector &dir)
 
static GlobalPoint vtxMean (const GlobalPoint &p1, const GlobalError &e1, const GlobalPoint &p2, const GlobalError &e2)
 

Function Documentation

◆ covarianceUpdate()

static bool covarianceUpdate ( Matrix3S &  cov,
const Vector3 &  residual,
const Matrix3S &  error,
double &  chi2,
double  theta,
double  phi 
)
static

Definition at line 136 of file GhostTrackVertexFinder.cc.

137  {
138  using namespace ROOT::Math;
139 
140  Matrix23 jacobian;
141  jacobian(0, 0) = std::cos(phi) * std::cos(theta);
142  jacobian(0, 1) = std::sin(phi) * std::cos(theta);
143  jacobian(0, 2) = -std::sin(theta);
144  jacobian(1, 0) = -std::sin(phi);
145  jacobian(1, 1) = std::cos(phi);
146 
147  Matrix2S measErr = Similarity(jacobian, error);
148  Matrix2S combErr = Similarity(jacobian, cov) + measErr;
149  if (!measErr.Invert() || !combErr.Invert())
150  return false;
151 
152  cov -= SimilarityT(jacobian * cov, combErr);
153  chi2 += Similarity(jacobian * residual, measErr);
154 
155  return true;
156 }

References hltPixelTracks_cff::chi2, funct::cos(), relativeConstraints::error, funct::sin(), and theta().

Referenced by vertexAtState().

◆ dummyPrediction()

static GhostTrackPrediction dummyPrediction ( const Vertex primaryVertex,
const Track ghostTrack 
)
static

◆ fitChi2()

static double fitChi2 ( const CachingVertex< 5 > &  vtx)
static

Definition at line 636 of file GhostTrackVertexFinder.cc.

636 { return vtx.totalChiSquared() / vtx.degreesOfFreedom(); }

References badGlobalMuonTaggersAOD_cff::vtx.

Referenced by PFGsfHelper::PFGsfHelper(), TtEvtBuilder< C >::produce(), and reco::GhostTrackVertexFinder::recursiveMerge().

◆ mergeTrackHelper()

static void mergeTrackHelper ( const std::vector< RefCountedVertexTrack > &  tracks,
std::vector< RefCountedVertexTrack > &  newTracks,
const VertexState state,
const VtxTrackIs &  ghostTrackFinder,
RefCountedVertexTrack &  ghostTrack,
const VertexTrackFactory< 5 > &  factory 
)
static

Definition at line 659 of file GhostTrackVertexFinder.cc.

664  {
665  for (std::vector<RefCountedVertexTrack>::const_iterator iter = tracks.begin(); iter != tracks.end(); ++iter) {
666  bool gt = ghostTrackFinder(*iter);
667  if (gt && ghostTrack)
668  continue;
669 
670  RefCountedVertexTrack track = relinearizeTrack(*iter, state, factory);
671 
672  if (gt)
673  ghostTrack = *iter;
674  else
675  newTracks.push_back(*iter);
676  }
677 }

References relinearizeTrack(), HLT_2018_cff::track, and PDWG_EXOHSCP_cff::tracks.

Referenced by reco::GhostTrackVertexFinder::mergeVertices().

◆ relinearizeTrack()

static RefCountedVertexTrack relinearizeTrack ( const RefCountedVertexTrack &  track,
const VertexState state,
const VertexTrackFactory< 5 >  factory 
)
static

Definition at line 209 of file GhostTrackVertexFinder.cc.

211  {
212  RefCountedLinearizedTrackState linTrack = track->linearizedTrack();
213  linTrack = linTrack->stateWithNewLinearizationPoint(state.position());
214  return factory.vertexTrack(linTrack, state);
215 }

References VertexState::position(), HLT_2018_cff::track, and VertexTrackFactory< N >::vertexTrack().

Referenced by mergeTrackHelper(), reco::GhostTrackVertexFinder::reassignTracks(), and relinearizeTracks().

◆ relinearizeTracks()

static std::vector<RefCountedVertexTrack> relinearizeTracks ( const std::vector< RefCountedVertexTrack > &  tracks,
const VertexState state 
)
static

Definition at line 217 of file GhostTrackVertexFinder.cc.

218  {
219  VertexTrackFactory<5> vertexTrackFactory;
220 
221  std::vector<RefCountedVertexTrack> finalTracks;
222  finalTracks.reserve(tracks.size());
223 
224  for (std::vector<RefCountedVertexTrack>::const_iterator iter = tracks.begin(); iter != tracks.end(); ++iter)
225  finalTracks.push_back(relinearizeTrack(*iter, state, vertexTrackFactory));
226 
227  return finalTracks;
228 }

References relinearizeTrack(), and PDWG_EXOHSCP_cff::tracks.

Referenced by reco::GhostTrackVertexFinder::reassignTracks().

◆ stateMean()

static VertexState stateMean ( const VertexState v1,
const VertexState v2 
)
static

Definition at line 132 of file GhostTrackVertexFinder.cc.

132  {
133  return VertexState(vtxMean(v1.position(), v1.error(), v2.position(), v2.error()), v1.error() + v2.error());
134 }

References VertexState::error(), VertexState::position(), and vtxMean().

Referenced by reco::GhostTrackVertexFinder::mergeVertices().

◆ trackVertexCompat()

static double trackVertexCompat ( const CachingVertex< 5 > &  vtx,
const RefCountedVertexTrack &  vertexTrack 
)
static

Definition at line 238 of file GhostTrackVertexFinder.cc.

238  {
239  using namespace ROOT::Math;
240 
241  TransientTrack track = vertexTrack->linearizedTrack()->track();
242  GlobalPoint point = vtx.position();
244  TrajectoryStateOnSurface tsos = extrap.extrapolate(track.impactPointState(), point);
245 
246  if (!tsos.isValid())
247  return 1.0e6;
248 
249  GlobalPoint point1 = vtx.position();
250  GlobalPoint point2 = tsos.globalPosition();
251  Vector3 dir = conv(point2 - point1);
252  Matrix3S error = vtx.error().matrix() + tsos.cartesianError().matrix().Sub<Matrix3S>(0, 0);
253  if (!error.Invert())
254  return 1.0e6;
255 
256  return ROOT::Math::Similarity(error, dir);
257 }

References conv, DeadROC_duringRun::dir, relativeConstraints::error, point, HLT_2018_cff::track, and badGlobalMuonTaggersAOD_cff::vtx.

Referenced by reco::GhostTrackVertexFinder::reassignTracks().

◆ transientGhostTrack()

static TransientTrack transientGhostTrack ( const GhostTrackPrediction pred,
const MagneticField field 
)
static

◆ vertexAtState()

static CachingVertex<5> vertexAtState ( const TransientTrack ghostTrack,
const GhostTrackPrediction pred,
const GhostTrackState state 
)
static

Definition at line 158 of file GhostTrackVertexFinder.cc.

160  {
161  LinearizedTrackStateFactory linTrackFactory;
162  VertexTrackFactory<5> vertexTrackFactory;
163 
164  if (!state.isValid())
165  return CachingVertex<5>();
166 
167  GlobalPoint pca1 = pred.position(state.lambda());
168  GlobalError err1 = pred.positionError(state.lambda());
169 
170  GlobalPoint pca2 = state.globalPosition();
171  GlobalError err2 = state.cartesianError();
172 
173  GlobalPoint point = vtxMean(pca1, err1, pca2, err2);
174 
175  const TransientTrack &recTrack = state.track();
176 
177  RefCountedLinearizedTrackState linState[2] = {linTrackFactory.linearizedTrackState(point, ghostTrack),
178  linTrackFactory.linearizedTrackState(point, recTrack)};
179  if (!linState[0]->isValid() || !linState[1]->isValid())
180  return CachingVertex<5>();
181 
182  Matrix3S cov = SMatrixIdentity();
183  cov *= 10000;
184  double chi2 = 0.;
185  if (!covarianceUpdate(cov,
186  conv(pca1 - point),
187  err1.matrix(),
188  chi2,
189  linState[0]->predictedStateParameters()[1],
190  linState[0]->predictedStateParameters()[2]) ||
191  !covarianceUpdate(cov,
192  conv(pca2 - point),
193  err2.matrix(),
194  chi2,
195  linState[1]->predictedStateParameters()[1],
196  linState[1]->predictedStateParameters()[2]))
197  return CachingVertex<5>();
198 
199  GlobalError error(cov);
200  VertexState vtxState(point, error);
201 
202  std::vector<RefCountedVertexTrack> linTracks(2);
203  linTracks[0] = vertexTrackFactory.vertexTrack(linState[0], vtxState);
204  linTracks[1] = vertexTrackFactory.vertexTrack(linState[1], vtxState);
205 
206  return CachingVertex<5>(point, error, linTracks, chi2);
207 }

References reco::GhostTrackState::cartesianError(), hltPixelTracks_cff::chi2, conv, covarianceUpdate(), relativeConstraints::error, reco::GhostTrackState::globalPosition(), reco::GhostTrackState::isValid(), reco::GhostTrackState::lambda(), LinearizedTrackStateFactory::linearizedTrackState(), GlobalErrorBase< T, ErrorWeightType >::matrix(), point, reco::GhostTrackPrediction::position(), reco::GhostTrackPrediction::positionError(), reco::GhostTrackState::track(), VertexTrackFactory< N >::vertexTrack(), and vtxMean().

Referenced by reco::GhostTrackVertexFinder::initialVertices(), reco::GhostTrackVertexFinder::reassignTracks(), and reco::GhostTrackVertexFinder::refitGhostTrack().

◆ vtxErrorLong()

static double vtxErrorLong ( const GlobalError error,
const GlobalVector dir 
)
static

Definition at line 117 of file GhostTrackVertexFinder.cc.

117  {
118  return ROOT::Math::Similarity(conv(dir), error.matrix());
119 }

References conv, DeadROC_duringRun::dir, and relativeConstraints::error.

Referenced by vtxMean().

◆ vtxMean()

static GlobalPoint vtxMean ( const GlobalPoint p1,
const GlobalError e1,
const GlobalPoint p2,
const GlobalError e2 
)
static

Definition at line 121 of file GhostTrackVertexFinder.cc.

121  {
122  GlobalVector diff = p2 - p1;
123 
124  double err1 = vtxErrorLong(e1, diff);
125  double err2 = vtxErrorLong(e2, diff);
126 
127  double weight = err1 / (err1 + err2);
128 
129  return p1 + weight * diff;
130 }

References change_name::diff, StorageManager_cfg::e1, p1, p2, and vtxErrorLong().

Referenced by GlobalTrackingRegion::checkRZ(), RectangularEtaPhiTrackingRegion::checkRZOld(), stateMean(), and vertexAtState().

Vector3DBase
Definition: Vector3DBase.h:8
change_name.diff
diff
Definition: change_name.py:13
relinearizeTrack
static RefCountedVertexTrack relinearizeTrack(const RefCountedVertexTrack &track, const VertexState &state, const VertexTrackFactory< 5 > factory)
Definition: GhostTrackVertexFinder.cc:209
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
reco::GhostTrackState::isValid
bool isValid() const
Definition: GhostTrackState.h:42
reco::GhostTrackPrediction::positionError
GlobalError positionError(double lambda=0.) const
Definition: GhostTrackPrediction.cc:131
conv
static HepMC::IO_HEPEVT conv
Definition: BeamHaloProducer.cc:48
reco::GhostTrackState::track
const TransientTrack & track() const
Definition: GhostTrackState.cc:56
CachingVertex< 5 >
reco::GhostTrackState::cartesianError
GlobalError cartesianError() const
Definition: GhostTrackState.h:37
reco::TrackBase::px
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:611
GlobalErrorBase::matrix
const AlgebraicSymMatrix33 matrix() const
Definition: GlobalErrorBase.h:121
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
relativeConstraints.error
error
Definition: relativeConstraints.py:53
reco::GhostTrackState::globalPosition
GlobalPoint globalPosition() const
Definition: GhostTrackState.h:36
LinearizedTrackStateFactory::linearizedTrackState
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const override
Definition: LinearizedTrackStateFactory.cc:9
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
BeamMonitor_cff.primaryVertex
primaryVertex
hltOfflineBeamSpot for HLTMON
Definition: BeamMonitor_cff.py:7
reco::GhostTrackState::lambda
double lambda() const
Definition: GhostTrackState.h:40
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
LinearizedTrackStateFactory
Definition: LinearizedTrackStateFactory.h:14
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
reco::TrackBase::py
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:614
p2
double p2[4]
Definition: TauolaWrapper.h:90
VertexState::error
GlobalError error() const
Definition: VertexState.h:64
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
Point3DBase< float, GlobalTag >
covarianceUpdate
static bool covarianceUpdate(Matrix3S &cov, const Vector3 &residual, const Matrix3S &error, double &chi2, double theta, double phi)
Definition: GhostTrackVertexFinder.cc:136
ROOT::Math
Definition: Transform3DPJ.h:41
badGlobalMuonTaggersAOD_cff.vtx
vtx
Definition: badGlobalMuonTaggersAOD_cff.py:5
AnalyticalImpactPointExtrapolator
Definition: AnalyticalImpactPointExtrapolator.h:26
VertexTrackFactory< 5 >
RecoVertex::convertError
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
reco::GhostTrackPrediction::fts
FreeTrajectoryState fts(const MagneticField *fieldProvider) const
Definition: GhostTrackPrediction.cc:185
reco::GhostTrackPrediction::position
GlobalPoint position(double lambda=0.) const
Definition: GhostTrackPrediction.h:67
TransientTrackFromFTSFactory::build
reco::TransientTrack build(const FreeTrajectoryState &fts) const
Definition: TransientTrackFromFTSFactory.cc:7
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
p1
double p1[4]
Definition: TauolaWrapper.h:89
GlobalErrorBase< double, ErrorMatrixTag >
vtxErrorLong
static double vtxErrorLong(const GlobalError &error, const GlobalVector &dir)
Definition: GhostTrackVertexFinder.cc:117
VertexTrackFactory::vertexTrack
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
Definition: VertexTrackFactory.h:27
reco::TransientTrack
Definition: TransientTrack.h:19
VertexState
Definition: VertexState.h:13
TransientTrackFromFTSFactory
Definition: TransientTrackFromFTSFactory.h:10
VertexState::position
GlobalPoint position() const
Definition: VertexState.h:62
RecoVertex::convertPos
reco::Vertex::Point convertPos(const GlobalPoint &p)
Definition: ConvertToFromReco.h:7
reco::GhostTrackPrediction
Definition: GhostTrackPrediction.h:21
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
reco::TrackBase::pz
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:617
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
vtxMean
static GlobalPoint vtxMean(const GlobalPoint &p1, const GlobalError &e1, const GlobalPoint &p2, const GlobalError &e2)
Definition: GhostTrackVertexFinder.cc:121
weight
Definition: weight.py:1
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23