CMS 3D CMS Logo

GhostTrackState.cc
Go to the documentation of this file.
1 #include <cmath>
2 
3 #include <Math/SMatrix.h>
4 #include <Math/MatrixFunctions.h>
5 
7 
10 
13 
17 
18 using namespace reco;
19 
20 namespace {
21  using namespace ROOT::Math;
22 
23  typedef SVector<double, 3> Vector3;
24 
25  inline Vector3 conv(const GlobalVector &vec) {
26  Vector3 result;
27  result[0] = vec.x();
28  result[1] = vec.y();
29  result[2] = vec.z();
30  return result;
31  }
32 } // namespace
33 
35 
37  : Base(new VertexGhostTrackState(pos, cov)) {}
38 
41 
43  : Base(new VertexGhostTrackState(state.position(), state.error().matrix())) {}
44 
45 bool GhostTrackState::isTrack() const { return dynamic_cast<const TrackGhostTrackState *>(&data()) != nullptr; }
46 
47 bool GhostTrackState::isVertex() const { return dynamic_cast<const VertexGhostTrackState *>(&data()) != nullptr; }
48 
49 static const TrackGhostTrackState *getTrack(const BasicGhostTrackState *basic) {
50  const TrackGhostTrackState *track = dynamic_cast<const TrackGhostTrackState *>(basic);
51  if (!track)
52  throw cms::Exception("InvalidOperation") << "track requested on non non-track GhostTrackState";
53  return track;
54 }
55 
56 const TransientTrack &GhostTrackState::track() const { return getTrack(&data())->track(); }
57 
59 
61  return (globalPosition() - point).dot(dir.unit());
62 }
63 
65  return (globalPosition() - point).cross(dir.unit()).mag();
66 }
67 
69  return axisDistance(pred.origin(), pred.direction());
70 }
71 
72 double GhostTrackState::lambdaError(const GhostTrackPrediction &pred, const GlobalError &pvError) const {
73  if (!isValid())
74  return -1.;
75 
76  return std::sqrt(ROOT::Math::Similarity(conv(pred.direction()),
77  (vertexStateOnGhostTrack(pred).second.matrix() + pvError.matrix())) /
78  pred.rho2());
79 }
Vector3DBase
Definition: Vector3DBase.h:8
reco::TrackGhostTrackState::tsos
const TrajectoryStateOnSurface & tsos() const
Definition: TrackGhostTrackState.h:24
GhostTrackPrediction.h
reco::GhostTrackState::isVertex
bool isVertex() const
Definition: GhostTrackState.cc:47
reco::GhostTrackState::isValid
bool isValid() const
Definition: GhostTrackState.h:42
VertexGhostTrackState.h
makeMuonMisalignmentScenario.matrix
list matrix
Definition: makeMuonMisalignmentScenario.py:141
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
conv
static HepMC::IO_HEPEVT conv
Definition: BeamHaloProducer.cc:48
reco::GhostTrackState::track
const TransientTrack & track() const
Definition: GhostTrackState.cc:56
pos
Definition: PixelAliasList.h:18
reco::GhostTrackState::isTrack
bool isTrack() const
Definition: GhostTrackState.cc:45
CovarianceMatrix
Definition: CovarianceMatrix.h:27
GlobalErrorBase::matrix
const AlgebraicSymMatrix33 matrix() const
Definition: GlobalErrorBase.h:121
GhostTrackState.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
reco::GhostTrackState::vertexStateOnGhostTrack
Vertex vertexStateOnGhostTrack(const GhostTrackPrediction &pred, bool withMeasurementError=true) const
Definition: GhostTrackState.h:56
relativeConstraints.error
error
Definition: relativeConstraints.py:53
reco::GhostTrackState::lambdaError
double lambdaError(const GhostTrackPrediction &pred, const GlobalError &pvError=GlobalError()) const
Definition: GhostTrackState.cc:72
reco::GhostTrackState::globalPosition
GlobalPoint globalPosition() const
Definition: GhostTrackState.h:36
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
reco::GhostTrackState::axisDistance
double axisDistance(const GlobalPoint &point, const GlobalVector &dir) const
Definition: GhostTrackState.cc:64
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
reco::TrackGhostTrackState
Definition: TrackGhostTrackState.h:19
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
VertexState.h
ROOT::Math
Definition: Transform3DPJ.h:41
TrackGhostTrackState.h
reco::GhostTrackPrediction::direction
const GlobalVector direction() const
Definition: GhostTrackPrediction.h:63
reco::GhostTrackPrediction::rho2
double rho2() const
Definition: GhostTrackPrediction.h:53
math::GlobalVector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalVector
vector in glovbal coordinate system
Definition: Vector3D.h:28
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
GlobalErrorBase< double, ErrorMatrixTag >
getTrack
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
Definition: GhostTrackState.cc:49
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
reco::TransientTrack
Definition: TransientTrack.h:19
ProxyBase11
Definition: ProxyBase11.h:23
VertexState
Definition: VertexState.h:13
reco::GhostTrackState::tsos
const TrajectoryStateOnSurface & tsos() const
Definition: GhostTrackState.cc:58
Exception
Definition: hltDiff.cc:246
ProxyBase11::data
const T & data() const
Definition: ProxyBase11.h:51
reco::TrackGhostTrackState::track
const TransientTrack & track() const
Definition: TrackGhostTrackState.h:23
GlobalVector.h
reco::GhostTrackPrediction::origin
const GlobalPoint origin() const
Definition: GhostTrackPrediction.h:62
Exception.h
reco::GhostTrackState::GhostTrackState
GhostTrackState(const TransientTrack &track)
Definition: GhostTrackState.cc:34
reco::GhostTrackState::flightDistance
double flightDistance(const GlobalPoint &point, const GlobalVector &dir) const
Definition: GhostTrackState.cc:60
math::GlobalPoint
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:18
reco::GhostTrackPrediction
Definition: GhostTrackPrediction.h:21
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
mps_fire.result
result
Definition: mps_fire.py:303
reco::VertexGhostTrackState
Definition: VertexGhostTrackState.h:15
reco::BasicGhostTrackState
Definition: BasicGhostTrackState.h:20
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
GlobalPoint.h
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23