CMS 3D CMS Logo

StateSegmentMatcher.cc
Go to the documentation of this file.
1 
13 
14 using namespace std;
15 
17  DTRecSegment4D const &dtseg4d,
18  LocalError const &apeLoc) {
19  if (dtseg4d.hasPhi() && dtseg4d.hasZed()) {
20  setAPE4d(apeLoc);
21  match2D = false;
22  AlgebraicVector dtseg = dtseg4d.parameters();
23  v1[0] = dtseg[0];
24  v1[1] = dtseg[1];
25  v1[2] = dtseg[2];
26  v1[3] = dtseg[3];
27 
28  AlgebraicSymMatrix rhErr_vect = dtseg4d.parametersError();
29  m1(0, 0) = rhErr_vect(1, 1);
30  m1(0, 1) = rhErr_vect(1, 2);
31  m1(0, 2) = rhErr_vect(1, 3);
32  m1(0, 3) = rhErr_vect(1, 4);
33  m1(1, 0) = rhErr_vect(2, 1);
34  m1(1, 1) = rhErr_vect(2, 2);
35  m1(1, 2) = rhErr_vect(2, 3);
36  m1(1, 3) = rhErr_vect(2, 4);
37  m1(2, 0) = rhErr_vect(3, 1);
38  m1(2, 1) = rhErr_vect(3, 2);
39  m1(2, 2) = rhErr_vect(3, 3);
40  m1(2, 3) = rhErr_vect(3, 4);
41  m1(3, 0) = rhErr_vect(4, 1);
42  m1(3, 1) = rhErr_vect(4, 2);
43  m1(3, 2) = rhErr_vect(4, 3);
44  m1(3, 3) = rhErr_vect(4, 4);
45 
46  Tsos4D tsos4d = Tsos4D(tsos);
47  v2 = tsos4d.paramVector();
48  m2 = tsos4d.errorMatrix();
49  } else {
50  setAPE2d(apeLoc);
51  match2D = true;
52  AlgebraicVector dtseg = dtseg4d.parameters();
53  v1_2d[0] = dtseg[0];
54  v1_2d[1] = dtseg[1];
55 
56  AlgebraicSymMatrix rhErr_vect = dtseg4d.parametersError();
57  m1_2d(0, 0) = rhErr_vect(1, 1);
58  m1_2d(0, 1) = rhErr_vect(1, 2);
59  m1_2d(1, 0) = rhErr_vect(2, 1);
60  m1_2d(1, 1) = rhErr_vect(2, 2);
61 
62  if (dtseg4d.hasPhi()) {
63  Tsos2DPhi tsos2d = Tsos2DPhi(tsos);
64  v2_2d = tsos2d.paramVector();
65  m2_2d = tsos2d.errorMatrix();
66  }
67 
68  if (dtseg4d.hasZed()) {
69  Tsos2DZed tsos2d = Tsos2DZed(tsos);
70  v2_2d = tsos2d.paramVector();
71  m2_2d = tsos2d.errorMatrix();
72  }
73  }
74 }
75 
77  CSCSegment const &cscseg4d,
78  LocalError const &apeLoc) {
79  setAPE4d(apeLoc);
80  match2D = false;
81  AlgebraicVector cscseg = cscseg4d.parameters();
82  v1[0] = cscseg[0];
83  v1[1] = cscseg[1];
84  v1[2] = cscseg[2];
85  v1[3] = cscseg[3];
86 
87  AlgebraicSymMatrix rhErr_vect = cscseg4d.parametersError();
88  m1(0, 0) = rhErr_vect(1, 1);
89  m1(0, 1) = rhErr_vect(1, 2);
90  m1(0, 2) = rhErr_vect(1, 3);
91  m1(0, 3) = rhErr_vect(1, 4);
92  m1(1, 0) = rhErr_vect(2, 1);
93  m1(1, 1) = rhErr_vect(2, 2);
94  m1(1, 2) = rhErr_vect(2, 3);
95  m1(1, 3) = rhErr_vect(2, 4);
96  m1(2, 0) = rhErr_vect(3, 1);
97  m1(2, 1) = rhErr_vect(3, 2);
98  m1(2, 2) = rhErr_vect(3, 3);
99  m1(2, 3) = rhErr_vect(3, 4);
100  m1(3, 0) = rhErr_vect(4, 1);
101  m1(3, 1) = rhErr_vect(4, 2);
102  m1(3, 2) = rhErr_vect(4, 3);
103  m1(3, 3) = rhErr_vect(4, 4);
104 
105  Tsos4D tsos4d = Tsos4D(tsos);
106  v2 = tsos4d.paramVector();
107  m2 = tsos4d.errorMatrix();
108 }
109 
111  if (match2D) {
112  AlgebraicVector2 v3(v1_2d - v2_2d);
113  AlgebraicSymMatrix22 m3(m1_2d + m2_2d + ape_2d);
114  bool m3i = !m3.Invert();
115  if (m3i) {
116  return 1e7;
117  } else {
118  estValue = ROOT::Math::Similarity(v3, m3);
119  }
120 
121  } else {
122  AlgebraicVector4 v3(v1 - v2);
123  AlgebraicSymMatrix44 m3(m1 + m2 + ape);
124  bool m3i = !m3.Invert();
125  if (m3i) {
126  return 1e7;
127  } else {
128  estValue = ROOT::Math::Similarity(v3, m3);
129  }
130  }
131  return estValue;
132 }
133 
135  AlgebraicVector5 tsos_v = tsos.localParameters().vector();
136  tsos_4d[0] = tsos_v[1];
137  tsos_4d[1] = tsos_v[2];
138  tsos_4d[2] = tsos_v[3];
139  tsos_4d[3] = tsos_v[4];
140 
142  tsosErr_44(0, 0) = E(1, 1);
143  tsosErr_44(0, 1) = E(1, 2);
144  tsosErr_44(0, 2) = E(1, 3);
145  tsosErr_44(0, 3) = E(1, 4);
146  tsosErr_44(1, 0) = E(2, 1);
147  tsosErr_44(1, 1) = E(2, 2);
148  tsosErr_44(1, 2) = E(2, 3);
149  tsosErr_44(1, 3) = E(2, 4);
150  tsosErr_44(2, 0) = E(3, 1);
151  tsosErr_44(2, 1) = E(3, 2);
152  tsosErr_44(2, 2) = E(3, 3);
153  tsosErr_44(2, 3) = E(3, 4);
154  tsosErr_44(3, 0) = E(4, 1);
155  tsosErr_44(3, 1) = E(4, 2);
156  tsosErr_44(3, 2) = E(4, 3);
157  tsosErr_44(3, 3) = E(4, 4);
158 }
159 
160 AlgebraicVector4 Tsos4D::paramVector() const { return tsos_4d; }
161 
162 AlgebraicSymMatrix44 Tsos4D::errorMatrix() const { return tsosErr_44; }
163 
165  AlgebraicVector5 tsos_v = tsos.localParameters().vector();
166  tsos_2d_phi[0] = tsos_v[1];
167  tsos_2d_phi[1] = tsos_v[3];
168 
170  tsosErr_22_phi(0, 0) = E(1, 1);
171  tsosErr_22_phi(0, 1) = E(1, 3);
172  tsosErr_22_phi(1, 0) = E(3, 1);
173  tsosErr_22_phi(1, 1) = E(3, 3);
174 }
175 
176 AlgebraicVector2 Tsos2DPhi::paramVector() const { return tsos_2d_phi; }
177 
178 AlgebraicSymMatrix22 Tsos2DPhi::errorMatrix() const { return tsosErr_22_phi; }
179 
181  AlgebraicVector5 tsos_v = tsos.localParameters().vector();
182  tsos_2d_zed[0] = tsos_v[2];
183  tsos_2d_zed[1] = tsos_v[4];
184 
186  tsosErr_22_zed(0, 0) = E(2, 2);
187  tsosErr_22_zed(0, 1) = E(2, 4);
188  tsosErr_22_zed(1, 0) = E(4, 2);
189  tsosErr_22_zed(1, 1) = E(4, 4);
190 }
191 
192 AlgebraicVector2 Tsos2DZed::paramVector() const { return tsos_2d_zed; }
193 
194 AlgebraicSymMatrix22 Tsos2DZed::errorMatrix() const { return tsosErr_22_zed; }
StateSegmentMatcher::StateSegmentMatcher
StateSegmentMatcher(TrajectoryStateOnSurface const &, CSCSegment const &, LocalError const &)
Definition: StateSegmentMatcher.cc:76
DTRecSegment4D
Definition: DTRecSegment4D.h:23
Tsos2DPhi::errorMatrix
AlgebraicSymMatrix22 errorMatrix() const
Definition: StateSegmentMatcher.cc:178
Tsos4D
Definition: StateSegmentMatcher.h:22
LocalTrajectoryError::matrix
const AlgebraicSymMatrix55 & matrix() const
Definition: LocalTrajectoryError.h:60
Tsos2DPhi::Tsos2DPhi
Tsos2DPhi(TrajectoryStateOnSurface const &)
Definition: StateSegmentMatcher.cc:164
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
Tsos4D::errorMatrix
AlgebraicSymMatrix44 errorMatrix() const
Definition: StateSegmentMatcher.cc:162
Tsos2DZed::Tsos2DZed
Tsos2DZed(TrajectoryStateOnSurface const &)
Definition: StateSegmentMatcher.cc:180
LocalTrajectoryParameters::vector
AlgebraicVector5 vector() const
Definition: LocalTrajectoryParameters.h:120
CSCSegment
Definition: CSCSegment.h:21
TrajectoryStateOnSurface::localParameters
const LocalTrajectoryParameters & localParameters() const
Definition: TrajectoryStateOnSurface.h:73
DTRecSegment4D::parametersError
AlgebraicSymMatrix parametersError() const override
Covariance matrix fo parameters()
Definition: DTRecSegment4D.cc:104
Tsos2DZed
Definition: StateSegmentMatcher.h:53
LocalError
Definition: LocalError.h:12
AlgebraicVector2
ROOT::Math::SVector< double, 2 > AlgebraicVector2
Definition: AlgebraicROOTObjects.h:11
Tsos2DPhi::paramVector
AlgebraicVector2 paramVector() const
Definition: StateSegmentMatcher.cc:176
DTRecSegment4D::parameters
AlgebraicVector parameters() const override
Definition: DTRecSegment4D.cc:80
StateSegmentMatcher.h
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
Tsos2DZed::paramVector
AlgebraicVector2 paramVector() const
Definition: StateSegmentMatcher.cc:192
AlgebraicVector5
ROOT::Math::SVector< double, 5 > AlgebraicVector5
Definition: AlgebraicROOTObjects.h:14
Tsos2DZed::errorMatrix
AlgebraicSymMatrix22 errorMatrix() const
Definition: StateSegmentMatcher.cc:194
AlgebraicSymMatrix44
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > AlgebraicSymMatrix44
Definition: AlgebraicROOTObjects.h:22
callgraph.m2
m2
Definition: callgraph.py:38
AlgebraicVector4
ROOT::Math::SVector< double, 4 > AlgebraicVector4
Definition: AlgebraicROOTObjects.h:13
Tsos2DPhi
Definition: StateSegmentMatcher.h:37
std
Definition: JetResolutionObject.h:76
DTRecSegment4D::hasZed
bool hasZed() const
Does it have the Z projection?
Definition: DTRecSegment4D.h:93
Tsos4D::paramVector
AlgebraicVector4 paramVector() const
Definition: StateSegmentMatcher.cc:160
CSCSegment::parametersError
AlgebraicSymMatrix parametersError() const override
Covariance matrix of parameters()
Definition: CSCSegment.h:49
Tsos4D::Tsos4D
Tsos4D(TrajectoryStateOnSurface const &)
Definition: StateSegmentMatcher.cc:134
DTRecSegment4D::hasPhi
bool hasPhi() const
Does it have the Phi projection?
Definition: DTRecSegment4D.h:90
CSCSegment::parameters
AlgebraicVector parameters() const override
Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y )
Definition: CSCSegment.cc:56
StateSegmentMatcher::value
double value()
Definition: StateSegmentMatcher.cc:110
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Definition: AlgebraicROOTObjects.h:23
AlgebraicSymMatrix22
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > AlgebraicSymMatrix22
Definition: AlgebraicROOTObjects.h:20