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  setAPE4d(*apeLoc);
26 
27  match2D = false;
28  AlgebraicVector dtseg = dtseg4d->parameters();
29  v1[0] = dtseg[0];
30  v1[1] = dtseg[1];
31  v1[2] = dtseg[2];
32  v1[3] = dtseg[3];
33 
34  AlgebraicSymMatrix rhErr_vect = dtseg4d->parametersError();
35  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);
36  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);
37  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);
38  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);
39 
40  Tsos4D tsos4d = Tsos4D(tsos);
41  v2 = tsos4d.paramVector();
42  m2 = tsos4d.errorMatrix();
43 
44  } else {
45 
46  setAPE2d(*apeLoc);
47 
48  match2D = true;
49  AlgebraicVector dtseg = dtseg4d->parameters();
50  v1_2d[0] = dtseg[0];
51  v1_2d[1] = dtseg[1];
52 
53  AlgebraicSymMatrix rhErr_vect = dtseg4d->parametersError();
54  m1_2d(0,0) = rhErr_vect(1,1); m1_2d(0,1) = rhErr_vect(1,2);
55  m1_2d(1,0) = rhErr_vect(2,1); m1_2d(1,1) = rhErr_vect(2,2);
56 
57 
58  if (dtseg4d->hasPhi()) {
59  Tsos2DPhi tsos2d = Tsos2DPhi(tsos);
60  v2_2d = tsos2d.paramVector();
61  m2_2d = tsos2d.errorMatrix();
62  }
63 
64  if (dtseg4d->hasZed()) {
65  Tsos2DZed tsos2d = Tsos2DZed(tsos);
66  v2_2d = tsos2d.paramVector();
67  m2_2d = tsos2d.errorMatrix();
68  }
69  }
70 }
71 
72 
73 
75 {
76  setAPE4d(*apeLoc);
77 
78  match2D = false;
79  AlgebraicVector cscseg = cscseg4d->parameters();
80  v1[0] = cscseg[0];
81  v1[1] = cscseg[1];
82  v1[2] = cscseg[2];
83  v1[3] = cscseg[3];
84 
85  AlgebraicSymMatrix rhErr_vect = cscseg4d->parametersError();
86  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);
87  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);
88  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);
89  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);
90 
91 
92  Tsos4D tsos4d = Tsos4D(tsos);
93  v2 = tsos4d.paramVector();
94  m2 = tsos4d.errorMatrix();
95 }
96 
97 
98 
100 {
101  if (match2D) {
102  AlgebraicVector2 v3(v1_2d - v2_2d);
103  AlgebraicSymMatrix22 m3(m1_2d + m2_2d + ape_2d);
104  bool m3i = !m3.Invert();
105  if ( m3i ) {
106  return 1e7;
107  } else {
108  estValue = ROOT::Math::Similarity(v3,m3);
109  }
110 
111  } else {
112  AlgebraicVector4 v3(v1 - v2);
113  AlgebraicSymMatrix44 m3(m1 + m2 + ape);
114  bool m3i = !m3.Invert();
115  if ( m3i ) {
116  return 1e7;
117  } else {
118  estValue = ROOT::Math::Similarity(v3,m3);
119  }
120  }
121  return estValue;
122 }
123 
124 
126 {
127  AlgebraicVector5 tsos_v = tsos->localParameters().vector();
128  tsos_4d[0] = tsos_v[1];
129  tsos_4d[1] = tsos_v[2];
130  tsos_4d[2] = tsos_v[3];
131  tsos_4d[3] = tsos_v[4];
132 
133  AlgebraicSymMatrix55 E = tsos->localError().matrix();
134  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);
135  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);
136  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);
137  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);
138 }
139 
140 
141 AlgebraicVector4 Tsos4D::paramVector() const {return tsos_4d;}
142 
143 
144 AlgebraicSymMatrix44 Tsos4D::errorMatrix() const {return tsosErr_44;}
145 
146 
147 
149 {
150  AlgebraicVector5 tsos_v = tsos->localParameters().vector();
151  tsos_2d_phi[0] = tsos_v[1];
152  tsos_2d_phi[1] = tsos_v[3];
153 
154  AlgebraicSymMatrix55 E = tsos->localError().matrix();
155  tsosErr_22_phi(0,0) = E(1,1);tsosErr_22_phi(0,1) = E(1,3);
156  tsosErr_22_phi(1,0) = E(3,1);tsosErr_22_phi(1,1) = E(3,3);
157 }
158 
159 
160 AlgebraicVector2 Tsos2DPhi::paramVector() const {return tsos_2d_phi;}
161 
162 
163 AlgebraicSymMatrix22 Tsos2DPhi::errorMatrix() const {return tsosErr_22_phi;}
164 
165 
166 
168 {
169  AlgebraicVector5 tsos_v = tsos->localParameters().vector();
170  tsos_2d_zed[0] = tsos_v[2];
171  tsos_2d_zed[1] = tsos_v[4];
172 
173  AlgebraicSymMatrix55 E = tsos->localError().matrix();
174  tsosErr_22_zed(0,0) = E(2,2);tsosErr_22_zed(0,1) = E(2,4);
175  tsosErr_22_zed(1,0) = E(4,2);tsosErr_22_zed(1,1) = E(4,4);
176 }
177 
178 
179 AlgebraicVector2 Tsos2DZed::paramVector() const {return tsos_2d_zed;}
180 
181 
182 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
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
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