18 edm::LogVerbatim(
"MuonSegFit") <<
"[MuonSegFit::fit] - cannot fit just 1 hit!!";
44 MuonRecHitContainer::const_iterator ih =
hits_.begin();
54 float dz = h2pos.
z() - h1pos.
z();
60 float uintercept = (h1pos.
x() * h2pos.
z() - h2pos.
x() * h1pos.
z()) /
dz;
61 float vintercept = (h1pos.
y() * h2pos.
z() - h2pos.
y() * h1pos.
z()) /
dz;
141 MuonRecHitContainer::const_iterator ih =
hits_.begin();
144 for (ih =
hits_.begin(); ih !=
hits_.end(); ++ih) {
154 IC(0, 0) = (*ih)->localPositionError().xx();
155 IC(1, 1) = (*ih)->localPositionError().yy();
158 IC(1, 0) = (*ih)->localPositionError().xy();
163 <<
"[MuonSegFit::fit] 2x2 covariance matrix for this GEMRecHit :: [[" << IC(0, 0) <<
", " << IC(0, 1) <<
"][" 164 << IC(1, 0) <<
"," << IC(1, 1) <<
"]]";
168 bool ok = IC.Invert();
170 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::fit] Failed to invert covariance matrix: \n" << IC;
176 M(0, 2) += IC(0, 0) *
z;
177 M(0, 3) += IC(0, 1) *
z;
178 B(0) += u * IC(0, 0) +
v * IC(0, 1);
182 M(1, 2) += IC(1, 0) *
z;
183 M(1, 3) += IC(1, 1) *
z;
184 B(1) += u * IC(1, 0) +
v * IC(1, 1);
186 M(2, 0) += IC(0, 0) *
z;
187 M(2, 1) += IC(0, 1) *
z;
188 M(2, 2) += IC(0, 0) *
z *
z;
189 M(2, 3) += IC(0, 1) *
z *
z;
190 B(2) += (u * IC(0, 0) +
v * IC(0, 1)) *
z;
192 M(3, 0) += IC(1, 0) *
z;
193 M(3, 1) += IC(1, 1) *
z;
194 M(3, 2) += IC(1, 0) *
z *
z;
195 M(3, 3) += IC(1, 1) *
z *
z;
196 B(3) += (u * IC(1, 0) +
v * IC(1, 1)) *
z;
200 bool ok = M.Invert();
202 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::fit] Failed to invert matrix: \n" << M;
209 LogTrace(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::fit] p = " <<
p(0) <<
", " <<
p(1) <<
", " <<
p(2) <<
", " 232 MuonRecHitContainer::const_iterator ih;
234 for (ih =
hits_.begin(); ih !=
hits_.end(); ++ih) {
246 IC(0, 0) = (*ih)->localPositionError().xx();
248 IC(1, 0) = (*ih)->localPositionError().xy();
249 IC(1, 1) = (*ih)->localPositionError().yy();
253 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::setChi2] IC before = \n" << IC;
257 bool ok = IC.Invert();
259 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::setChi2] Failed to invert covariance matrix: \n" 263 chsq += du * du * IC(0, 0) + 2. * du * dv * IC(0, 1) + dv * dv * IC(1, 1);
266 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::setChi2] IC after = \n" << IC;
268 <<
"[GEM RecHit ] Contribution to Chi^2 of this hit :: du^2*Cov(0,0) + 2*du*dv*Cov(0,1) + dv^2*IC(1,1) = " 269 << du * du <<
"*" << IC(0, 0) <<
" + 2.*" << du <<
"*" << dv <<
"*" << IC(0, 1) <<
" + " << dv * dv <<
"*" 270 << IC(1, 1) <<
" = " << chsq;
280 edm::LogVerbatim(
"MuonSegFit") <<
"-----------------------------------------------------";
291 <<
"Now extrapolate to each of the GEMRecHits XY plane (so constant z = RH LP.z()) to obtain [x1,y1]";
302 for (MuonRecHitContainer::const_iterator
it =
hits_.begin();
it !=
hits_.end(); ++
it) {
305 matrix(row, row + 1) = (*it)->localPositionError().xy();
307 matrix(row, row - 1) = (*it)->localPositionError().xy();
308 matrix(row, row) = (*it)->localPositionError().yy();
314 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::weightMatrix] Failed to invert matrix: \n" <<
matrix;
324 for (MuonRecHitContainer::const_iterator
it =
hits_.begin();
it !=
hits_.end(); ++
it) {
353 <<
" dydz = vslope_ = " << std::setw(9) <<
vslope_ <<
" local dir = " << localDir;
363 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::covarianceMatrix] weights matrix W: \n" <<
weights;
364 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::covarianceMatrix] derivatives matrix A: \n" <<
A;
378 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::calculateError] Failed to invert matrix: \n" <<
result;
382 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::covarianceMatrix] (AT W A)^-1: \n" <<
result;
398 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::flipErrors] input: \n" <<
a;
403 for (
short j = 0;
j != 4; ++
j) {
404 for (
short i = 0;
i != 4; ++
i) {
405 hold(
i + 1,
j + 1) =
a(
i,
j);
410 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::flipErrors] after copy:";
412 <<
"(" << hold(1, 1) <<
" " << hold(1, 2) <<
" " << hold(1, 3) <<
" " << hold(1, 4);
414 <<
" " << hold(2, 1) <<
" " << hold(2, 2) <<
" " << hold(2, 3) <<
" " << hold(2, 4);
416 <<
" " << hold(3, 1) <<
" " << hold(3, 2) <<
" " << hold(3, 3) <<
" " << hold(3, 4);
418 <<
" " << hold(4, 1) <<
" " << hold(4, 2) <<
" " << hold(4, 3) <<
" " << hold(4, 4) <<
")";
422 hold(1, 1) =
a(2, 2);
423 hold(1, 2) =
a(2, 3);
424 hold(2, 1) =
a(3, 2);
425 hold(2, 2) =
a(3, 3);
428 hold(3, 3) =
a(0, 0);
429 hold(3, 4) =
a(0, 1);
430 hold(4, 3) =
a(1, 0);
431 hold(4, 4) =
a(1, 1);
434 hold(4, 1) =
a(1, 2);
435 hold(3, 2) =
a(0, 3);
436 hold(2, 3) =
a(3, 0);
437 hold(1, 4) =
a(2, 1);
440 edm::LogVerbatim(
"MuonSegFitMatrixDetails") <<
"[MuonSegFit::flipErrors] after flip:";
442 <<
"(" << hold(1, 1) <<
" " << hold(1, 2) <<
" " << hold(1, 3) <<
" " << hold(1, 4);
444 <<
" " << hold(2, 1) <<
" " << hold(2, 2) <<
" " << hold(2, 3) <<
" " << hold(2, 4);
446 <<
" " << hold(3, 1) <<
" " << hold(3, 2) <<
" " << hold(3, 3) <<
" " << hold(3, 4);
448 <<
" " << hold(4, 1) <<
" " << hold(4, 2) <<
" " << hold(4, 3) <<
" " << hold(4, 4) <<
")";
static const int MaxHits2
Log< level::Info, true > LogVerbatim
AlgebraicSymMatrix covarianceMatrix(void)
Point3DBase< Scalar, LocalTag > LocalPoint
SMatrixSym12 weightMatrix(void)
SMatrix12by4 derivativeMatrix(void)
Geom::Phi< T > phi() const
float xfit(float z) const
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > SMatrixSym2
ROOT::Math::SMatrix< double, MaxHits2, 4 > SMatrix12by4
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > SMatrixSym4
ROOT::Math::SMatrix< double, 4 > SMatrix4
ROOT::Math::SVector< double, 4 > SVector4
double scaleXError(void) const
float xdev(float x, float z) const
float Rdev(float x, float y, float z) const
Basic3DVector unit() const
float ydev(float y, float z) const
AlgebraicSymMatrix flipErrors(const SMatrixSym4 &)
MuonRecHitContainer hits_
ROOT::Math::SMatrix< double, MaxHits2, MaxHits2, ROOT::Math::MatRepSym< double, MaxHits2 > > SMatrixSym12
CLHEP::HepSymMatrix AlgebraicSymMatrix
float yfit(float z) const