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 
16 
17 using namespace std;
18 
19 
20 
22 {
23  if (dtseg4d->hasPhi() && dtseg4d->hasZed()) {
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  match2D = true;
45  AlgebraicVector dtseg = dtseg4d->parameters();
46  v1_2d[0] = dtseg[0];
47  v1_2d[1] = dtseg[1];
48 
49  AlgebraicSymMatrix rhErr_vect = dtseg4d->parametersError();
50  m1_2d(0,0) = rhErr_vect(1,1); m1_2d(0,1) = rhErr_vect(1,2);
51  m1_2d(1,0) = rhErr_vect(2,1); m1_2d(1,1) = rhErr_vect(2,2);
52 
53 
54  if (dtseg4d->hasPhi()) {
55  Tsos2DPhi tsos2d = Tsos2DPhi(tsos);
56  v2_2d = tsos2d.paramVector();
57  m2_2d = tsos2d.errorMatrix();
58  }
59 
60  if (dtseg4d->hasZed()) {
61  Tsos2DZed tsos2d = Tsos2DZed(tsos);
62  v2_2d = tsos2d.paramVector();
63  m2_2d = tsos2d.errorMatrix();
64  }
65  }
66 }
67 
68 
69 
71 {
72  match2D = false;
73  AlgebraicVector cscseg = cscseg4d->parameters();
74  v1[0] = cscseg[0];
75  v1[1] = cscseg[1];
76  v1[2] = cscseg[2];
77  v1[3] = cscseg[3];
78 
79  AlgebraicSymMatrix rhErr_vect = cscseg4d->parametersError();
80  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);
81  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);
82  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);
83  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);
84 
85 
86  Tsos4D tsos4d = Tsos4D(tsos);
87  v2 = tsos4d.paramVector();
88  m2 = tsos4d.errorMatrix();
89 }
90 
91 
92 
94 {
95  if (match2D) {
96  AlgebraicVector2 v3(v1_2d - v2_2d);
97  AlgebraicSymMatrix22 m3(m1_2d + m2_2d);
98  bool m3i = !m3.Invert();
99  if ( m3i ) {
100  return 1e7;
101  } else {
102  estValue = ROOT::Math::Similarity(v3,m3);
103  }
104 
105  } else {
106  AlgebraicVector4 v3(v1 - v2);
107  AlgebraicSymMatrix44 m3(m1 + m2);
108  bool m3i = !m3.Invert();
109  if ( m3i ) {
110  return 1e7;
111  } else {
112  estValue = ROOT::Math::Similarity(v3,m3);
113  }
114  }
115  return estValue;
116 }
117 
118 
120 {
121  AlgebraicVector5 tsos_v = tsos->localParameters().vector();
122  tsos_4d[0] = tsos_v[1];
123  tsos_4d[1] = tsos_v[2];
124  tsos_4d[2] = tsos_v[3];
125  tsos_4d[3] = tsos_v[4];
126 
127  AlgebraicSymMatrix55 E = tsos->localError().matrix();
128  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);
129  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);
130  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);
131  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);
132 }
133 
134 
135 AlgebraicVector4 Tsos4D::paramVector() const {return tsos_4d;}
136 
137 
138 AlgebraicSymMatrix44 Tsos4D::errorMatrix() const {return tsosErr_44;}
139 
140 
141 
143 {
144  AlgebraicVector5 tsos_v = tsos->localParameters().vector();
145  tsos_2d_phi[0] = tsos_v[1];
146  tsos_2d_phi[1] = tsos_v[3];
147 
148  AlgebraicSymMatrix55 E = tsos->localError().matrix();
149  tsosErr_22_phi(0,0) = E(1,1);tsosErr_22_phi(0,1) = E(1,3);
150  tsosErr_22_phi(1,0) = E(3,1);tsosErr_22_phi(1,1) = E(3,3);
151 }
152 
153 
154 AlgebraicVector2 Tsos2DPhi::paramVector() const {return tsos_2d_phi;}
155 
156 
157 AlgebraicSymMatrix22 Tsos2DPhi::errorMatrix() const {return tsosErr_22_phi;}
158 
159 
160 
162 {
163  AlgebraicVector5 tsos_v = tsos->localParameters().vector();
164  tsos_2d_zed[0] = tsos_v[2];
165  tsos_2d_zed[1] = tsos_v[4];
166 
167  AlgebraicSymMatrix55 E = tsos->localError().matrix();
168  tsosErr_22_zed(0,0) = E(2,2);tsosErr_22_zed(0,1) = E(2,4);
169  tsosErr_22_zed(1,0) = E(4,2);tsosErr_22_zed(1,1) = E(4,4);
170 }
171 
172 
173 AlgebraicVector2 Tsos2DZed::paramVector() const {return tsos_2d_zed;}
174 
175 
176 AlgebraicSymMatrix22 Tsos2DZed::errorMatrix() const {return tsosErr_22_zed;}
AlgebraicSymMatrix22 errorMatrix() const
AlgebraicVector parameters() const
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > AlgebraicSymMatrix22
AlgebraicVector2 paramVector() const
const LocalTrajectoryParameters & localParameters() const
AlgebraicVector parameters() const
Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y )
Definition: CSCSegment.cc:57
Tsos4D(TrajectoryStateOnSurface *)
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
StateSegmentMatcher(TrajectoryStateOnSurface *, CSCSegment *)
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
AlgebraicSymMatrix parametersError() const
Covariance matrix of parameters()
Definition: CSCSegment.h:49
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