|
|
Go to the documentation of this file.
20 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fit] - start the fitting fun :: nhits = " <<
nhits();
26 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fit] - cannot fit just 1 hit!!";
40 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fit] - cannot fit more than 8 hits!!";
54 std::vector<const TrackingRecHit*>::const_iterator ih =
hits_.begin();
64 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector";
75 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector";
80 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - 2 hits on same layer!!";
96 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector";
106 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector";
115 float dz = h2pos.
z() - h1pos.
z();
120 float uintercept = (h1pos.
x() * h2pos.
z() - h2pos.
x() * h1pos.
z()) /
dz;
121 float vintercept = (h1pos.
y() * h2pos.
z() - h2pos.
y() * h1pos.
z()) /
dz;
134 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fitlsq] - start fitlsq";
211 std::vector<const TrackingRecHit*>::const_iterator ih =
hits_.begin();
214 for (ih =
hits_.begin(); ih !=
hits_.end(); ++ih) {
215 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fitlsq] - looping over TrackingRecHits";
218 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fitlsq] - Tracking RecHit in detid (" <<
d.rawId() <<
")";
220 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fitlsq] - Tracking RecHit is a GEM Hit in detid ("
224 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fitlsq] - Tracking RecHit is a CSC Hit in detid ("
228 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector";
233 for (ih =
hits_.begin(); ih !=
hits_.end(); ++ih) {
244 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector";
249 std::stringstream lpss;
252 std::stringstream gpss;
255 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fitlsq] - Tracking RecHit global position " << std::setw(30)
256 << gps <<
" and local position " << std::setw(30) << lps
268 IC(0, 0) =
hit.localPositionError().xx();
269 IC(1, 1) =
hit.localPositionError().yy();
272 IC(1, 0) =
hit.localPositionError().xy();
275 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fit] 2x2 covariance matrix for this Tracking RecHit :: [["
276 << IC(0, 0) <<
", " << IC(0, 1) <<
"][" << IC(1, 0) <<
"," << IC(1, 1) <<
"]]";
279 bool ok = IC.Invert();
281 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fit] Failed to invert covariance matrix: \n" << IC;
291 M(0, 2) += IC(0, 0) *
z;
292 M(0, 3) += IC(0, 1) *
z;
293 B(0) += u * IC(0, 0) +
v * IC(0, 1);
297 M(1, 2) += IC(1, 0) *
z;
298 M(1, 3) += IC(1, 1) *
z;
299 B(1) += u * IC(1, 0) +
v * IC(1, 1);
301 M(2, 0) += IC(0, 0) *
z;
302 M(2, 1) += IC(0, 1) *
z;
303 M(2, 2) += IC(0, 0) *
z *
z;
304 M(2, 3) += IC(0, 1) *
z *
z;
305 B(2) += (u * IC(0, 0) +
v * IC(0, 1)) *
z;
307 M(3, 0) += IC(1, 0) *
z;
308 M(3, 1) += IC(1, 1) *
z;
309 M(3, 2) += IC(1, 0) *
z *
z;
310 M(3, 3) += IC(1, 1) *
z *
z;
311 B(3) += (u * IC(1, 0) +
v * IC(1, 1)) *
z;
316 bool ok = M.Invert();
318 edm::LogVerbatim(
"GEMCSCSegment|GEMCSCSegFit") <<
"[GEMCSCSegFit::fit] Failed to invert matrix: \n" << M;
324 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fit] p = " <<
p(0) <<
", " <<
p(1) <<
", " <<
p(2) <<
", "
347 std::vector<const TrackingRecHit*>::const_iterator ih;
348 for (ih =
hits_.begin(); ih !=
hits_.end(); ++ih) {
361 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector";
366 std::stringstream lpss;
369 std::stringstream gpss;
372 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] - Tracking RecHit in " << (
gem ?
"GEM" :
"CSC")
373 <<
" global position " << std::setw(30) << gps <<
" and local position "
374 << std::setw(30) << lps <<
" wrt reference csc chamber "
384 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] u, v, z = " << u <<
", " <<
v <<
", " <<
z;
388 IC(0, 0) =
hit.localPositionError().xx();
390 IC(1, 0) =
hit.localPositionError().xy();
391 IC(1, 1) =
hit.localPositionError().yy();
394 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] IC before = \n" << IC;
397 bool ok = IC.Invert();
399 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] Failed to invert covariance matrix: \n" << IC;
402 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] IC after = \n" << IC;
403 chsq += du * du * IC(0, 0) + 2. * du * dv * IC(0, 1) + dv * dv * IC(1, 1);
405 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] Contribution of this Tracking RecHit to Chi2: "
406 "du^2*D(1,1) + 2*du*dv*D(1,2) + dv^2*D(2,2) = "
407 << du * du <<
"*" << IC(0, 0) <<
" + 2.*" << du <<
"*" << dv <<
"*" << IC(0, 1)
408 <<
" + " << dv * dv <<
"*" << IC(1, 1) <<
" = "
409 << du * du * IC(0, 0) + 2. * du * dv * IC(0, 1) + dv * dv * IC(1, 1);
412 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] Total Chi2 = " << chsq;
413 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] Total NDof = " << 2. *
hits_.size() - 4;
414 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] Total Chi2/NDof = "
415 << ((
hits_.size() > 2) ? (chsq / (2. *
hits_.size() - 4)) : (0.0));
434 for (std::vector<const TrackingRecHit*>::const_iterator it =
hits_.begin(); it !=
hits_.end(); ++it) {
440 matrix(row, row + 1) =
hit.localPositionError().xy();
442 matrix(row, row - 1) =
hit.localPositionError().xy();
443 matrix(row, row) =
hit.localPositionError().yy();
449 edm::LogVerbatim(
"GEMCSCSegment|GEMCSCSegFit") <<
"[GEMCSCSegFit::weightMatrix] Failed to invert matrix: \n"
451 SMatrixSym16 emptymatrix = ROOT::Math::SMatrixIdentity();
461 for (std::vector<const TrackingRecHit*>::const_iterator it =
hits_.begin(); it !=
hits_.end(); ++it) {
472 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector";
504 double directionSign = globalZpos * globalZdir;
512 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::covarianceMatrix] derivatives matrix A: \n" <<
A;
522 edm::LogVerbatim(
"GEMCSCSegment|GEMCSCSegFit") <<
"[GEMCSCSegFit::calculateError] Failed to invert matrix: \n"
545 for (
short j = 0;
j != 4; ++
j) {
546 for (
short i = 0;
i != 4; ++
i) {
547 hold(
i + 1,
j + 1) =
a(
i,
j);
558 hold(1, 1) =
a(2, 2);
559 hold(1, 2) =
a(2, 3);
560 hold(2, 1) =
a(3, 2);
561 hold(2, 2) =
a(3, 3);
564 hold(3, 3) =
a(0, 0);
565 hold(3, 4) =
a(0, 1);
566 hold(4, 3) =
a(1, 0);
567 hold(4, 4) =
a(1, 1);
570 hold(4, 1) =
a(1, 2);
571 hold(3, 2) =
a(0, 3);
572 hold(2, 3) =
a(3, 0);
573 hold(1, 4) =
a(2, 1);
const CSCChamber * refcscchamber() const
ROOT::Math::SMatrix< double, 16, 16, ROOT::Math::MatRepSym< double, 16 > > SMatrixSym16
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > SMatrixSym2
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
constexpr int layer() const
const CSCChamber * cscchamber(uint32_t id) const
AlgebraicSymMatrix flipErrors(const SMatrixSym4 &)
float yfit(float z) const
ROOT::Math::SMatrix< double, 16, 4 > SMatrix16by4
AlgebraicSymMatrix covarianceMatrix(void)
Point3DBase< Scalar, LocalTag > LocalPoint
virtual LocalPoint localPosition() const =0
std::vector< const TrackingRecHit * > hits_
ROOT::Math::SMatrix< double, 4 > SMatrix4
float ydev(float y, float z) const
float xfit(float z) const
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.
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
CLHEP::HepSymMatrix AlgebraicSymMatrix
float Rdev(float x, float y, float z) const
double scaleXError(void) const
Basic3DVector unit() const
static const std::string B
constexpr uint32_t rawId() const
get the raw id
ROOT::Math::SVector< double, 4 > SVector4
SMatrix16by4 derivativeMatrix(void)
Log< level::Info, true > LogVerbatim
const GEMEtaPartition * gemetapartition(uint32_t id) const
SMatrixSym16 weightMatrix(void)
CSCDetId id() const
Get the (concrete) DetId.
static constexpr float d1
float xdev(float x, float z) const