CMS 3D CMS Logo

GhostTrackPrediction.cc
Go to the documentation of this file.
1 #include <cmath>
2 
3 #include <Math/SMatrix.h>
4 #include <Math/MatrixFunctions.h>
5 
10 
14 
16 
17 using namespace reco;
18 
19 namespace {
20 #ifndef __clang__
21  inline double sqr(double arg) { return arg * arg; }
22 #endif
23  typedef ROOT::Math::SMatrix<double, 3, 4> Matrix34;
24  typedef ROOT::Math::SMatrix<double, 4, 5> Matrix45;
25  typedef ROOT::Math::SMatrix<double, 5, 4> Matrix54;
26  typedef ROOT::Math::SMatrix<double, 4, 6> Matrix46;
27  typedef ROOT::Math::SMatrix<double, 6, 4> Matrix64;
28  typedef ROOT::Math::SMatrix<double, 6, 6, ROOT::Math::MatRepSym<double, 6> > Matrix6S;
29 
31  return GhostTrackPrediction::Vector(trajectory.yT() / std::cos(trajectory.lambda()),
32  trajectory.xT(),
33  std::tan(trajectory.lambda()),
34  trajectory.phi());
35  }
36 
38  return convert(CurvilinearTrajectoryParameters(trajectory.position(), trajectory.momentum(), 0));
39  }
40 
43  double rho2 = pred[2] * pred[2] + 1.;
44  double rho = std::sqrt(rho2);
45 
46  Matrix45 jacobian;
47  jacobian(0, 1) = pred[0] * pred[2];
48  jacobian(0, 4) = rho;
49  jacobian(1, 3) = 1.;
50  jacobian(2, 1) = rho2;
51  jacobian(3, 2) = 1.;
52 
53  return ROOT::Math::Similarity(jacobian, error.matrix());
54  }
55 
56 } // namespace
57 
58 void GhostTrackPrediction::init(const GlobalPoint &priorPosition,
59  const GlobalError &priorError,
60  const GlobalVector &direction,
61  const GlobalError &directionError) {
62  double perp2 = direction.perp2();
64  double tip = priorPosition.y() * dir.x() - priorPosition.x() * dir.y();
65  double l = priorPosition.x() * dir.x() + priorPosition.y() * dir.y();
66 
67  prediction_[0] = priorPosition.z() - dir.z() * l;
68  prediction_[1] = tip;
69  prediction_[2] = dir.z();
70  prediction_[3] = dir.phi();
71 
72  Matrix46 jacobian;
73  jacobian(0, 0) = -dir.x() * dir.z();
74  jacobian(1, 0) = -dir.y();
75  jacobian(0, 1) = -dir.y() * dir.z();
76  jacobian(1, 1) = dir.x();
77  jacobian(0, 2) = 1.;
78  jacobian(0, 3) = -dir.z() * priorPosition.x();
79  jacobian(1, 3) = priorPosition.y();
80  jacobian(3, 3) = -dir.y();
81  jacobian(0, 4) = -dir.z() * priorPosition.y();
82  jacobian(1, 4) = -priorPosition.x();
83  jacobian(3, 4) = dir.x();
84  jacobian(0, 5) = -l;
85  jacobian(2, 5) = 1.;
86 
87  Matrix6S origCov;
88  origCov.Place_at(priorError.matrix(), 0, 0);
89  origCov.Place_at(directionError.matrix() / perp2, 3, 3);
90 
91  covariance_ = ROOT::Math::Similarity(jacobian, origCov);
92 }
93 
95  const GlobalError &priorError,
96  const GlobalVector &direction,
97  double coneRadius) {
98  double dTheta = std::cosh((double)direction.eta()) * coneRadius;
99 
100  double r2 = direction.mag2();
101  double r = std::sqrt(r2);
102  double perp = direction.perp();
103  double P = direction.x() / perp;
104  double p = direction.y() / perp;
105  double T = direction.z() / r;
106  double t = perp / r;
107  double h2 = dTheta * dTheta;
108  double d2 = coneRadius * coneRadius;
109 
110  GlobalError cov(r2 * (T * T * P * P * h2 + t * t * p * p * d2),
111  r2 * p * P * (T * T * h2 - t * t * d2),
112  r2 * (T * T * p * p * h2 + t * t * P * P * d2),
113  -r2 * t * T * P * h2,
114  -r2 * t * T * p * h2,
115  r2 * t * t * h2);
116 
117  init(priorPosition, priorError, direction, cov);
118 }
119 
122  : prediction_(convert(trajectory)), covariance_(convert(prediction_, error)) {}
123 
125  : prediction_(convert(GlobalTrajectoryParameters(GlobalPoint(track.vx(), track.vy(), track.vz()),
126  GlobalVector(track.px(), track.py(), track.pz()),
127  0,
128  nullptr))),
129  covariance_(convert(prediction_, track.covariance())) {}
130 
132  double x = std::cos(phi());
133  double y = std::sin(phi());
134 
135  Matrix34 jacobian;
136  jacobian(0, 1) = -y;
137  jacobian(0, 3) = -y * lambda - x * ip();
138  jacobian(1, 1) = x;
139  jacobian(1, 3) = x * lambda - y * ip();
140  jacobian(2, 0) = 1.;
141  jacobian(2, 2) = lambda;
142 
143  return ROOT::Math::Similarity(jacobian, covariance());
144 }
145 
146 Matrix6S GhostTrackPrediction::cartesianError(double lambda) const {
147  double x = std::cos(phi());
148  double y = std::sin(phi());
149 
150  Matrix64 jacobian;
151  jacobian(0, 1) = -y;
152  jacobian(0, 3) = -y * lambda - x * ip();
153  jacobian(1, 1) = x;
154  jacobian(1, 3) = x * lambda - y * ip();
155  jacobian(2, 0) = 1.;
156  jacobian(2, 2) = lambda;
157  jacobian(3, 3) = -y;
158  jacobian(4, 3) = x;
159  jacobian(5, 2) = 1.;
160 
161  return ROOT::Math::Similarity(jacobian, covariance());
162 }
163 
165  return GlobalTrajectoryParameters(origin(), direction(), 0, fieldProvider);
166 }
167 
169  double rho2I = 1. / rho2();
170  double rhoI = std::sqrt(rho2I);
171 
172  Matrix54 jacobian;
173  jacobian(1, 2) = rho2I;
174  jacobian(2, 3) = 1.;
175  jacobian(3, 1) = 1.;
176  jacobian(4, 0) = rhoI;
177  jacobian(4, 2) = -z() * rhoI * cotTheta() * rho2I;
178 
179  AlgebraicSymMatrix55 err = Similarity(jacobian, covariance());
180  err(0, 0) = 1.;
181 
183 }
184 
186  return FreeTrajectoryState(globalTrajectory(fieldProvider), curvilinearError());
187 }
188 
190  GlobalPoint origin = this->origin();
191  GlobalVector dir = direction().unit();
192 
193  Track::Point point(origin.x(), origin.y(), origin.z());
194  Track::Vector vector(dir.x(), dir.y(), dir.z());
195 
196  return Track(chi2, ndof, point, vector, 0, curvilinearError());
197 }
CurvilinearTrajectoryParameters::yT
double yT() const
Definition: CurvilinearTrajectoryParameters.h:72
GhostTrackPrediction.h
FreeTrajectoryState.h
CurvilinearTrajectoryParameters::lambda
double lambda() const
Definition: CurvilinearTrajectoryParameters.h:69
GlobalTrajectoryParameters.h
reco::GhostTrackPrediction::positionError
GlobalError positionError(double lambda=0.) const
Definition: GhostTrackPrediction.cc:131
GlobalTrajectoryParameters::position
GlobalPoint position() const
Definition: GlobalTrajectoryParameters.h:60
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
reco::GhostTrackPrediction::covariance_
Error covariance_
Definition: GhostTrackPrediction.h:86
ZElectronSkim_cff.rho
rho
Definition: ZElectronSkim_cff.py:38
sqr
int sqr(const T &t)
Definition: pfalgo_common_ref.h:9
reco::GhostTrackPrediction::phi
double phi() const
Definition: GhostTrackPrediction.h:51
GlobalErrorBase::matrix
const AlgebraicSymMatrix33 matrix() const
Definition: GlobalErrorBase.h:121
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
reco::GhostTrackPrediction::track
Track track(double ndof=0., double chi2=0.) const
Definition: GhostTrackPrediction.cc:189
perp
T perp() const
Magnitude of transverse component.
Definition: Basic3DVectorLD.h:133
relativeConstraints.error
error
Definition: relativeConstraints.py:53
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ndof
Definition: HIMultiTrackSelector.h:49
reco::GhostTrackPrediction::GhostTrackPrediction
GhostTrackPrediction()
Definition: GhostTrackPrediction.h:29
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Track.h
CurvilinearTrajectoryError
Definition: CurvilinearTrajectoryError.h:27
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::Track
Definition: Track.h:27
reco::GhostTrackPrediction::ip
double ip() const
Definition: GhostTrackPrediction.h:49
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
reco::GhostTrackPrediction::z
double z() const
Definition: GhostTrackPrediction.h:48
OrderedSet.t
t
Definition: OrderedSet.py:90
reco::GhostTrackPrediction::Vector
ROOT::Math::SVector< double, 4 > Vector
Definition: GhostTrackPrediction.h:25
GlobalTrajectoryParameters::momentum
GlobalVector momentum() const
Definition: GlobalTrajectoryParameters.h:65
qcdUeDQM_cfi.tip
tip
Definition: qcdUeDQM_cfi.py:23
CurvilinearTrajectoryParameters.h
fileCollector.convert
def convert(infile, ofile)
Definition: fileCollector.py:47
reco::GhostTrackPrediction::cotTheta
double cotTheta() const
Definition: GhostTrackPrediction.h:50
reco::GhostTrackPrediction::direction
const GlobalVector direction() const
Definition: GhostTrackPrediction.h:63
reco::GhostTrackPrediction::fts
FreeTrajectoryState fts(const MagneticField *fieldProvider) const
Definition: GhostTrackPrediction.cc:185
runTheMatrix.err
err
Definition: runTheMatrix.py:288
CurvilinearTrajectoryParameters
Definition: CurvilinearTrajectoryParameters.h:23
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
reco::GhostTrackPrediction::covariance
const Error & covariance() const
Definition: GhostTrackPrediction.h:60
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
GlobalError.h
GlobalErrorBase< double, ErrorMatrixTag >
perp2
T perp2() const
Squared magnitude of transverse component.
Definition: Basic3DVectorLD.h:130
CurvilinearTrajectoryParameters::xT
double xT() const
Definition: CurvilinearTrajectoryParameters.h:71
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
alignCSCRings.r
r
Definition: alignCSCRings.py:93
reco::TrackBase::Point
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
T
long double T
Definition: Basic3DVectorLD.h:48
GlobalVector.h
reco::GhostTrackPrediction::origin
const GlobalPoint origin() const
Definition: GhostTrackPrediction.h:62
reco::GhostTrackPrediction::prediction_
Vector prediction_
Definition: GhostTrackPrediction.h:85
reco::GhostTrackPrediction::cartesianError
CartesianError cartesianError(double lambda=0.) const
Definition: GhostTrackPrediction.cc:146
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:36
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
P
std::pair< OmniClusterRef, TrackingParticleRef > P
Definition: BDHadronTrackMonitoringAnalyzer.cc:202
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
UEAnalysisJets_cfi.coneRadius
coneRadius
Definition: UEAnalysisJets_cfi.py:7
MagneticField
Definition: MagneticField.h:19
AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Definition: AlgebraicROOTObjects.h:23
CurvilinearTrajectoryParameters::phi
double phi() const
Definition: CurvilinearTrajectoryParameters.h:70
reco::GhostTrackPrediction::globalTrajectory
GlobalTrajectoryParameters globalTrajectory(const MagneticField *fieldProvider) const
Definition: GhostTrackPrediction.cc:164
GlobalPoint.h
reco::GhostTrackPrediction::Error
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > Error
Definition: GhostTrackPrediction.h:26
reco::GhostTrackPrediction::init
void init(const GlobalPoint &priorPosition, const GlobalError &priorError, const GlobalVector &direction, const GlobalError &directionError)
Definition: GhostTrackPrediction.cc:58
reco::TrackBase::Vector
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:77
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
reco::GhostTrackPrediction::curvilinearError
CurvilinearTrajectoryError curvilinearError() const
Definition: GhostTrackPrediction.cc:168
reco::GhostTrackPrediction::lambda
double lambda(const GlobalPoint &point) const
Definition: GhostTrackPrediction.h:65