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