CMS 3D CMS Logo

TrackGhostTrackState.cc
Go to the documentation of this file.
1 #include <cmath>
2 
3 #include <Math/SMatrix.h>
4 #include <Math/MatrixFunctions.h>
5 
9 
15 
17 
19 
20 using namespace reco;
21 
22 namespace {
23  inline double sqr(double arg) { return arg * arg; }
24 
25  using namespace ROOT::Math;
26 
27  typedef SVector<double, 3> Vector3;
28 
29  typedef SMatrix<double, 3, 3, MatRepSym<double, 3> > Matrix3S;
30  typedef SMatrix<double, 6, 6, MatRepSym<double, 6> > Matrix6S;
31  typedef SMatrix<double, 3, 3> Matrix33;
32  typedef SMatrix<double, 3, 6> Matrix36;
33 
34  inline Vector3 conv(const GlobalVector &vec) {
35  Vector3 result;
36  result[0] = vec.x();
37  result[1] = vec.y();
38  result[2] = vec.z();
39  return result;
40  }
41 } // namespace
42 
43 bool TrackGhostTrackState::linearize(const GhostTrackPrediction &pred, bool initial, double lambda) {
45 
46  GlobalPoint origin = pred.origin();
47  GlobalVector direction = pred.direction();
48 
49  if (isValid() && !initial) {
50  GlobalPoint pca = origin + lambda_ * direction;
51  Line line(pca, direction);
52  tsos_ = extrap.extrapolate(tsos_, line);
53  } else {
54  GlobalPoint pca = origin + lambda * direction;
55  Line line(pca, direction);
56  tsos_ = extrap.extrapolate(track_.impactPointState(), line);
57  }
58 
59  if (!isValid())
60  return false;
61 
62  lambda_ = (tsos_.globalPosition() - origin) * direction / pred.rho2();
63 
64  return true;
65 }
66 
67 bool TrackGhostTrackState::linearize(const GhostTrackPrediction &pred, double lambda) {
69 
71 
72  tsos_ = extrap.extrapolate(track_.impactPointState(), point);
73  if (!isValid())
74  return false;
75 
76  lambda_ = lambda;
77 
78  return true;
79 }
80 
82  bool withMeasurementError) const {
83  using namespace ROOT::Math;
84 
85  if (!isValid())
86  return Vertex();
87 
88  GlobalPoint origin = pred.origin();
89  GlobalVector direction = pred.direction();
90 
91  double rho2 = pred.rho2();
92  double rho = std::sqrt(rho2);
93  double lambda = (tsos_.globalPosition() - origin) * direction / rho2;
94  GlobalPoint pos = origin + lambda * direction;
95 
96  GlobalVector momentum = tsos_.globalMomentum();
97  double mom = momentum.mag();
98 
99  Vector3 b = conv(direction) / rho;
100  Vector3 d = conv(momentum) / mom;
101  double l = Dot(b, d);
102  double g = 1. / (1. - sqr(l));
103 
104  Vector3 ca = conv(pos - tsos_.globalPosition());
105  Vector3 bd = b - l * d;
106  b *= g;
107 
108  Matrix33 pA = TensorProd(b, bd);
109  Matrix33 pB = TensorProd(b, ca);
110 
111  Matrix36 jacobian;
112  jacobian.Place_at(-pA + Matrix33(SMatrixIdentity()), 0, 0);
113  jacobian.Place_at(pB / rho, 0, 3);
114  Matrix3S error = Similarity(jacobian, pred.cartesianError(lambda));
115 
116  if (withMeasurementError) {
117  jacobian.Place_at(pA, 0, 0);
118  jacobian.Place_at(-pB / mom, 0, 3);
119  error += Similarity(jacobian, tsos_.cartesianError().matrix());
120  }
121 
122  return Vertex(pos, error);
123 }
124 
126  bool withGhostTrackError) const {
127  using namespace ROOT::Math;
128 
129  if (!isValid())
130  return Vertex();
131 
132  GlobalPoint origin = pred.origin();
133  GlobalVector direction = pred.direction();
134 
135  double rho2 = pred.rho2();
136  double rho = std::sqrt(rho2);
137  double lambda = (tsos_.globalPosition() - origin) * direction / rho2;
138  GlobalPoint pos = origin + lambda * direction;
139 
140  GlobalVector momentum = tsos_.globalMomentum();
141  double mom = momentum.mag();
142 
143  Vector3 b = conv(direction) / rho;
144  Vector3 d = conv(momentum) / mom;
145  double l = Dot(b, d);
146  double g = 1. / (1. - sqr(l));
147 
148  Vector3 ca = conv(tsos_.globalPosition() - pos);
149  Vector3 bd = l * b - d;
150  d *= g;
151 
152  Matrix33 pC = TensorProd(d, bd);
153  Matrix33 pD = TensorProd(d, ca);
154 
155  Matrix36 jacobian;
156  jacobian.Place_at(pC + Matrix33(SMatrixIdentity()), 0, 0);
157  jacobian.Place_at(pD / mom, 0, 3);
158  Matrix3S error = Similarity(jacobian, tsos_.cartesianError().matrix());
159 
160  if (withGhostTrackError) {
161  jacobian.Place_at(-pC, 0, 0);
162  jacobian.Place_at(-pD / rho, 0, 3);
163  error += Similarity(jacobian, pred.cartesianError(lambda));
164  }
165 
166  return Vertex(tsos_.globalPosition(), error);
167 }
Vector3DBase
Definition: Vector3DBase.h:8
GhostTrackPrediction.h
TrajectoryStateOnSurface.h
AnalyticalImpactPointExtrapolator.h
TrajectoryStateOnSurface::cartesianError
const CartesianTrajectoryError cartesianError() const
Definition: TrajectoryStateOnSurface.h:71
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
deep_tau::DeepTauBase::BasicDiscriminator
BasicDiscriminator
Definition: DeepTauBase.h:115
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
reco::TrackGhostTrackState::vertexStateOnMeasurement
Vertex vertexStateOnMeasurement(const GhostTrackPrediction &pred, bool withGhostTrackError) const override
Definition: TrackGhostTrackState.cc:125
pos
Definition: PixelAliasList.h:18
sqr
int sqr(const T &t)
Definition: pfalgo_common_ref.h:9
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
TransientTrack.h
relativeConstraints.error
error
Definition: relativeConstraints.py:53
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
reco::BasicGhostTrackState::lambda_
double lambda_
Definition: BasicGhostTrackState.h:62
reco::TrackGhostTrackState::vertexStateOnGhostTrack
Vertex vertexStateOnGhostTrack(const GhostTrackPrediction &pred, bool withMeasurementError) const override
Definition: TrackGhostTrackState.cc:81
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
CartesianTrajectoryError.h
Line.h
b
double b
Definition: hdecay.h:118
reco::TrackGhostTrackState::linearize
bool linearize(const GhostTrackPrediction &pred, bool initial, double lambda) override
Definition: TrackGhostTrackState.cc:43
ROOT::Math
Definition: Transform3DPJ.h:41
TrackGhostTrackState.h
reco::BasicGhostTrackState::Vertex
std::pair< GlobalPoint, GlobalError > Vertex
Definition: BasicGhostTrackState.h:27
AnalyticalImpactPointExtrapolator
Definition: AnalyticalImpactPointExtrapolator.h:26
reco::GhostTrackPrediction::direction
const GlobalVector direction() const
Definition: GhostTrackPrediction.h:63
reco::GhostTrackPrediction::position
GlobalPoint position(double lambda=0.) const
Definition: GhostTrackPrediction.h:67
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
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
reco::TransientTrack::impactPointState
TrajectoryStateOnSurface impactPointState() const
Definition: TransientTrack.h:96
Line
Definition: Line.h:10
reco::TrackGhostTrackState::tsos_
TrajectoryStateOnSurface tsos_
Definition: TrackGhostTrackState.h:44
reco::TrackGhostTrackState::isValid
bool isValid() const override
Definition: TrackGhostTrackState.h:26
reco::TransientTrack::field
const MagneticField * field() const
Definition: TransientTrack.h:108
CartesianTrajectoryError::matrix
const AlgebraicSymMatrix66 & matrix() const
Definition: CartesianTrajectoryError.h:28
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
reco::TrackGhostTrackState::track_
TransientTrack track_
Definition: TrackGhostTrackState.h:45
GlobalVector.h
reco::GhostTrackPrediction::origin
const GlobalPoint origin() const
Definition: GhostTrackPrediction.h:62
reco::GhostTrackPrediction::cartesianError
CartesianError cartesianError(double lambda=0.) const
Definition: GhostTrackPrediction.cc:146
reco::BasicGhostTrackState::lambda
double lambda() const
Definition: BasicGhostTrackState.h:40
math::GlobalPoint
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:18
funct::arg
A arg
Definition: Factorize.h:31
reco::GhostTrackPrediction
Definition: GhostTrackPrediction.h:21
ztail.d
d
Definition: ztail.py:151
mps_fire.result
result
Definition: mps_fire.py:311
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
mps_splice.line
line
Definition: mps_splice.py:76
AnalyticalTrajectoryExtrapolatorToLine
Definition: AnalyticalTrajectoryExtrapolatorToLine.h:28
GlobalPoint.h
AnalyticalTrajectoryExtrapolatorToLine.h
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
conv
EPOS::IO_EPOS conv
Definition: ReggeGribovPartonMCHadronizer.cc:42