test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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

Definition at line 139 of file GhostTrackVertexFinder.cc.

References funct::cos(), and funct::sin().

Referenced by vertexAtState().

142 {
143  using namespace ROOT::Math;
144 
145  Matrix23 jacobian;
146  jacobian(0, 0) = std::cos(phi) * std::cos(theta);
147  jacobian(0, 1) = std::sin(phi) * std::cos(theta);
148  jacobian(0, 2) = -std::sin(theta);
149  jacobian(1, 0) = -std::sin(phi);
150  jacobian(1, 1) = std::cos(phi);
151 
152  Matrix2S measErr = Similarity(jacobian, error);
153  Matrix2S combErr = Similarity(jacobian, cov) + measErr;
154  if (!measErr.Invert() || !combErr.Invert())
155  return false;
156 
157  cov -= SimilarityT(jacobian * cov, combErr);
158  chi2 += Similarity(jacobian * residual, measErr);
159 
160  return true;
161 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Definition: DDAxes.h:10
static GhostTrackPrediction dummyPrediction ( const Vertex primaryVertex,
const Track ghostTrack 
)
static

Definition at line 627 of file GhostTrackVertexFinder.cc.

References RecoVertex::convertError(), RecoVertex::convertPos(), reco::Vertex::error(), reco::Vertex::position(), reco::TrackBase::px(), reco::TrackBase::py(), and reco::TrackBase::pz().

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

629 {
630  return GhostTrackPrediction(
631  RecoVertex::convertPos(primaryVertex.position()),
632  RecoVertex::convertError(primaryVertex.error()),
633  GlobalVector(ghostTrack.px(), ghostTrack.py(),
634  ghostTrack.pz()), 0.05);
635 }
reco::Vertex::Point convertPos(const GlobalPoint &p)
reco::Vertex::Error convertError(const GlobalError &ge)
Definition: ConvertError.h:8
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:131
const Point & position() const
position
Definition: Vertex.h:106
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:135
Error error() const
return SMatrix
Definition: Vertex.h:129
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:133
Global3DVector GlobalVector
Definition: GlobalVector.h:10
static double fitChi2 ( const CachingVertex< 5 > &  vtx)
static
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 777 of file GhostTrackVertexFinder.cc.

References gt, getDQMSummary::iter, and relinearizeTrack().

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

783 {
784  for(std::vector<RefCountedVertexTrack>::const_iterator iter =
785  tracks.begin(); iter != tracks.end(); ++iter) {
786  bool gt = ghostTrackFinder(*iter);
787  if (gt && ghostTrack)
788  continue;
789 
790  RefCountedVertexTrack track =
791  relinearizeTrack(*iter, state, factory);
792 
793  if (gt)
794  ghostTrack = *iter;
795  else
796  newTracks.push_back(*iter);
797  }
798 }
static RefCountedVertexTrack relinearizeTrack(const RefCountedVertexTrack &track, const VertexState &state, const VertexTrackFactory< 5 > factory)
tuple tracks
Definition: testEve_cfg.py:39
DTRecHit1DPair & gt
static RefCountedVertexTrack relinearizeTrack ( const RefCountedVertexTrack &  track,
const VertexState state,
const VertexTrackFactory< 5 >  factory 
)
static

Definition at line 211 of file GhostTrackVertexFinder.cc.

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

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

215 {
216  RefCountedLinearizedTrackState linTrack = track->linearizedTrack();
217  linTrack = linTrack->stateWithNewLinearizationPoint(state.position());
218  return factory.vertexTrack(linTrack, state);
219 }
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
GlobalPoint position() const
Definition: VertexState.h:50
static std::vector<RefCountedVertexTrack> relinearizeTracks ( const std::vector< RefCountedVertexTrack > &  tracks,
const VertexState state 
)
static

Definition at line 221 of file GhostTrackVertexFinder.cc.

References getDQMSummary::iter, and relinearizeTrack().

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

224 {
225  VertexTrackFactory<5> vertexTrackFactory;
226 
227  std::vector<RefCountedVertexTrack> finalTracks;
228  finalTracks.reserve(tracks.size());
229 
230  for(std::vector<RefCountedVertexTrack>::const_iterator iter =
231  tracks.begin(); iter != tracks.end(); ++iter)
232  finalTracks.push_back(
233  relinearizeTrack(*iter, state, vertexTrackFactory));
234 
235  return finalTracks;
236 }
static RefCountedVertexTrack relinearizeTrack(const RefCountedVertexTrack &track, const VertexState &state, const VertexTrackFactory< 5 > factory)
tuple tracks
Definition: testEve_cfg.py:39
static VertexState stateMean ( const VertexState v1,
const VertexState v2 
)
static

Definition at line 132 of file GhostTrackVertexFinder.cc.

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

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

133 {
134  return VertexState(vtxMean(v1.position(), v1.error(),
135  v2.position(), v2.error()),
136  v1.error() + v2.error());
137 }
GlobalPoint position() const
Definition: VertexState.h:50
static GlobalPoint vtxMean(const GlobalPoint &p1, const GlobalError &e1, const GlobalPoint &p2, const GlobalError &e2)
GlobalError error() const
Definition: VertexState.h:55
static double trackVertexCompat ( const CachingVertex< 5 > &  vtx,
const RefCountedVertexTrack &  vertexTrack 
)
static

Definition at line 250 of file GhostTrackVertexFinder.cc.

References conv, dir, relativeConstraints::error, CachingVertex< N >::error(), GlobalErrorBase< T, ErrorWeightType >::matrix_new(), point, CachingVertex< N >::position(), and reco::TransientTrack::track().

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

252 {
253  using namespace ROOT::Math;
254 
255  TransientTrack track = vertexTrack->linearizedTrack()->track();
256  GlobalPoint point = vtx.position();
257  AnalyticalImpactPointExtrapolator extrap(track.field());
259  extrap.extrapolate(track.impactPointState(), point);
260 
261  if (!tsos.isValid())
262  return 1.0e6;
263 
264  GlobalPoint point1 = vtx.position();
265  GlobalPoint point2 = tsos.globalPosition();
266  Vector3 dir = conv(point2 - point1);
267  Matrix3S error = vtx.error().matrix_new() +
268  tsos.cartesianError().matrix().Sub<Matrix3S>(0, 0);
269  if (!error.Invert())
270  return 1.0e6;
271 
272  return ROOT::Math::Similarity(error, dir);
273 }
static HepMC::IO_HEPEVT conv
const AlgebraicSymMatrix33 & matrix_new() const
const Track & track() const
GlobalPoint position() const
dbl *** dir
Definition: mlp_gen.cc:35
GlobalError error() const
*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
static TransientTrack transientGhostTrack ( const GhostTrackPrediction pred,
const MagneticField field 
)
static

Definition at line 110 of file GhostTrackVertexFinder.cc.

References TransientTrackFromFTSFactory::build(), and reco::GhostTrackPrediction::fts().

Referenced by reco::GhostTrackVertexFinder::refitGhostTrack(), and reco::GhostTrackVertexFinder::vertices().

112 { return TransientTrackFromFTSFactory().build(pred.fts(field)); }
FreeTrajectoryState fts(const MagneticField *fieldProvider) const
reco::TransientTrack build(const FreeTrajectoryState &fts) const
static CachingVertex<5> vertexAtState ( const TransientTrack ghostTrack,
const GhostTrackPrediction pred,
const GhostTrackState state 
)
static

Definition at line 163 of file GhostTrackVertexFinder.cc.

References reco::GhostTrackState::cartesianError(), conv, covarianceUpdate(), relativeConstraints::error, reco::GhostTrackState::globalPosition(), reco::GhostTrackState::isValid(), reco::GhostTrackState::lambda(), LinearizedTrackStateFactory::linearizedTrackState(), GlobalErrorBase< T, ErrorWeightType >::matrix_new(), 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().

166 {
167  LinearizedTrackStateFactory linTrackFactory;
168  VertexTrackFactory<5> vertexTrackFactory;
169 
170  if (!state.isValid())
171  return CachingVertex<5>();
172 
173  GlobalPoint pca1 = pred.position(state.lambda());
174  GlobalError err1 = pred.positionError(state.lambda());
175 
176  GlobalPoint pca2 = state.globalPosition();
177  GlobalError err2 = state.cartesianError();
178 
179  GlobalPoint point = vtxMean(pca1, err1, pca2, err2);
180 
181  TransientTrack recTrack = state.track();
182 
183  RefCountedLinearizedTrackState linState[2] = {
184  linTrackFactory.linearizedTrackState(point, ghostTrack),
185  linTrackFactory.linearizedTrackState(point, recTrack)
186  };
187  if ( !linState[0]->isValid() || !linState[1]->isValid() )
188  return CachingVertex<5>();
189 
190  Matrix3S cov = SMatrixIdentity();
191  cov *= 10000;
192  double chi2 = 0.;
193  if (!covarianceUpdate(cov, conv(pca1 - point), err1.matrix_new(), chi2,
194  linState[0]->predictedStateParameters()[1],
195  linState[0]->predictedStateParameters()[2]) ||
196  !covarianceUpdate(cov, conv(pca2 - point), err2.matrix_new(), chi2,
197  linState[1]->predictedStateParameters()[1],
198  linState[1]->predictedStateParameters()[2]))
199  return CachingVertex<5>();
200 
201  GlobalError error(cov);
202  VertexState vtxState(point, error);
203 
204  std::vector<RefCountedVertexTrack> linTracks(2);
205  linTracks[0] = vertexTrackFactory.vertexTrack(linState[0], vtxState);
206  linTracks[1] = vertexTrackFactory.vertexTrack(linState[1], vtxState);
207 
208  return CachingVertex<5>(point, error, linTracks, chi2);
209 }
static bool covarianceUpdate(Matrix3S &cov, const Vector3 &residual, const Matrix3S &error, double &chi2, double theta, double phi)
const TransientTrack & track() const
static HepMC::IO_HEPEVT conv
RefCountedVertexTrack vertexTrack(const RefCountedLinearizedTrackState lt, const VertexState vs, float weight=1.0) const
GlobalError cartesianError() const
const AlgebraicSymMatrix33 & matrix_new() const
RefCountedLinearizedTrackState linearizedTrackState(const GlobalPoint &linP, const reco::TransientTrack &track) const
static GlobalPoint vtxMean(const GlobalPoint &p1, const GlobalError &e1, const GlobalPoint &p2, const GlobalError &e2)
double lambda() const
GlobalPoint position(double lambda=0.) const
GlobalPoint globalPosition() const
*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
GlobalError positionError(double lambda=0.) const
static double vtxErrorLong ( const GlobalError error,
const GlobalVector dir 
)
static

Definition at line 114 of file GhostTrackVertexFinder.cc.

References conv, and GlobalErrorBase< T, ErrorWeightType >::matrix_new().

Referenced by vtxMean().

115 {
116  return ROOT::Math::Similarity(conv(dir), error.matrix_new());
117 }
static HepMC::IO_HEPEVT conv
const AlgebraicSymMatrix33 & matrix_new() const
static GlobalPoint vtxMean ( const GlobalPoint p1,
const GlobalError e1,
const GlobalPoint p2,
const GlobalError e2 
)
static

Definition at line 119 of file GhostTrackVertexFinder.cc.

References diffTreeTool::diff, p1, vtxErrorLong(), and histoStyle::weight.

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

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 }
double p1[4]
Definition: TauolaWrapper.h:89
static double vtxErrorLong(const GlobalError &error, const GlobalVector &dir)
int weight
Definition: histoStyle.py:50