19 edm::LogVerbatim(
"CSCSegFit") <<
"[CSCSegFit::fit] - cannot fit just 1 hit!!";
31 edm::LogVerbatim(
"CSCSegFit") <<
"[CSCSegFit::fit] - cannot fit more than 6 hits!!";
42 CSCSetOfHits::const_iterator ih =
hits_.begin();
43 int il1 = (*ih)->cscDetId().layer();
51 edm::LogVerbatim(
"CSCSegFit") <<
"[CSCSegFit:fit]2 - 2 hits on same layer!!";
65 float dz = h2pos.
z() - h1pos.
z();
70 float uintercept = (h1pos.
x() * h2pos.
z() - h2pos.
x() * h1pos.
z()) /
dz;
71 float vintercept = (h1pos.
y() * h2pos.
z() - h2pos.
y() * h1pos.
z()) /
dz;
153 CSCSetOfHits::const_iterator ih =
hits_.begin();
155 for (ih =
hits_.begin(); ih !=
hits_.end(); ++ih) {
169 IC(0, 0) =
hit.localPositionError().xx();
170 IC(1, 1) =
hit.localPositionError().yy();
173 IC(1, 0) =
hit.localPositionError().xy();
177 bool ok = IC.Invert();
179 edm::LogVerbatim(
"CSCSegment|CSCSegFit") <<
"[CSCSegFit::fit] Failed to invert covariance matrix: \n" << IC;
185 M(0, 2) += IC(0, 0) *
z;
186 M(0, 3) += IC(0, 1) *
z;
187 B(0) += u * IC(0, 0) +
v * IC(0, 1);
191 M(1, 2) += IC(1, 0) *
z;
192 M(1, 3) += IC(1, 1) *
z;
193 B(1) += u * IC(1, 0) +
v * IC(1, 1);
195 M(2, 0) += IC(0, 0) *
z;
196 M(2, 1) += IC(0, 1) *
z;
197 M(2, 2) += IC(0, 0) *
z *
z;
198 M(2, 3) += IC(0, 1) *
z *
z;
199 B(2) += (u * IC(0, 0) +
v * IC(0, 1)) *
z;
201 M(3, 0) += IC(1, 0) *
z;
202 M(3, 1) += IC(1, 1) *
z;
203 M(3, 2) += IC(1, 0) *
z *
z;
204 M(3, 3) += IC(1, 1) *
z *
z;
205 B(3) += (u * IC(1, 0) +
v * IC(1, 1)) *
z;
209 bool ok = M.Invert();
211 edm::LogVerbatim(
"CSCSegment|CSCSegFit") <<
"[CSCSegFit::fit] Failed to invert matrix: \n" << M;
239 CSCSetOfHits::const_iterator ih;
240 for (ih =
hits_.begin(); ih !=
hits_.end(); ++ih) {
257 IC(0, 0) =
hit.localPositionError().xx();
259 IC(1, 0) =
hit.localPositionError().xy();
260 IC(1, 1) =
hit.localPositionError().yy();
266 bool ok = IC.Invert();
268 edm::LogVerbatim(
"CSCSegment|CSCSegFit") <<
"[CSCSegFit::setChi2] Failed to invert covariance matrix: \n" << IC;
272 chsq += du * du * IC(0, 0) + 2. * du * dv * IC(0, 1) + dv * dv * IC(1, 1);
289 for (CSCSetOfHits::const_iterator it =
hits_.begin(); it !=
hits_.end(); ++it) {
295 matrix(row, row + 1) =
hit.localPositionError().xy();
297 matrix(row, row - 1) =
hit.localPositionError().xy();
298 matrix(row, row) =
hit.localPositionError().yy();
304 edm::LogVerbatim(
"CSCSegment|CSCSegFit") <<
"[CSCSegFit::weightMatrix] Failed to invert matrix: \n" <<
matrix;
314 for (CSCSetOfHits::const_iterator it =
hits_.begin(); it !=
hits_.end(); ++it) {
348 double directionSign = globalZpos * globalZdir;
366 edm::LogVerbatim(
"CSCSegment|CSCSegFit") <<
"[CSCSegFit::calculateError] Failed to invert matrix: \n" <<
result;
387 for (
short j = 0;
j != 4; ++
j) {
388 for (
short i = 0;
i != 4; ++
i) {
389 hold(
i + 1,
j + 1) =
a(
i,
j);
400 hold(1, 1) =
a(2, 2);
401 hold(1, 2) =
a(2, 3);
402 hold(2, 1) =
a(3, 2);
403 hold(2, 2) =
a(3, 3);
406 hold(3, 3) =
a(0, 0);
407 hold(3, 4) =
a(0, 1);
408 hold(4, 3) =
a(1, 0);
409 hold(4, 4) =
a(1, 1);
412 hold(4, 1) =
a(1, 2);
413 hold(3, 2) =
a(0, 3);
414 hold(2, 3) =
a(3, 0);
415 hold(1, 4) =
a(2, 1);
ROOT::Math::SMatrix< double, 12, 12, ROOT::Math::MatRepSym< double, 12 > > SMatrixSym12
Log< level::Info, true > LogVerbatim
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Point3DBase< Scalar, LocalTag > LocalPoint
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > SMatrixSym4
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
AlgebraicSymMatrix flipErrors(const SMatrixSym4 &)
float ydev(float y, float z) const
ROOT::Math::SVector< double, 4 > SVector4
CSCDetId cscDetId() const
float yfit(float z) const
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > SMatrixSym2
constexpr std::array< uint8_t, layerIndexSize > layer
const CSCChamber * chamber() const
ROOT::Math::SMatrix< double, 4 > SMatrix4
Basic3DVector unit() const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
float xdev(float x, float z) const
LocalPoint localPosition() const override
AlgebraicSymMatrix covarianceMatrix(void)
SMatrixSym12 weightMatrix(void)
float xfit(float z) const
SMatrix12by4 derivativeMatrix(void)
CLHEP::HepSymMatrix AlgebraicSymMatrix
ROOT::Math::SMatrix< double, 12, 4 > SMatrix12by4
double scaleXError(void) const
float Rdev(float x, float y, float z) const