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 
40  : Base(new VertexGhostTrackState(pos, error.matrix())) {}
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 }
double lambdaError(const GhostTrackPrediction &pred, const GlobalError &pvError=GlobalError()) const
Vertex vertexStateOnGhostTrack(const GhostTrackPrediction &pred, bool withMeasurementError=true) const
const GlobalPoint origin() const
const TransientTrack & track() const
static HepMC::IO_HEPEVT conv
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const AlgebraicSymMatrix33 matrix() const
T y() const
Definition: PV3DBase.h:60
const TransientTrack & track() const
double flightDistance(const GlobalPoint &point, const GlobalVector &dir) const
const TrajectoryStateOnSurface & tsos() const
const T & data() const
Definition: ProxyBase11.h:51
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
const TrajectoryStateOnSurface & tsos() const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalVector
vector in glovbal coordinate system
Definition: Vector3D.h:28
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
double axisDistance(const GlobalPoint &point, const GlobalVector &dir) const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:18
fixed size matrix
static int position[264][3]
Definition: ReadPGInfo.cc:289
GhostTrackState(const TransientTrack &track)
T x() const
Definition: PV3DBase.h:59
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
const GlobalVector direction() const