CMS 3D CMS Logo

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