21 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!!";
56 std::vector<const TrackingRecHit*>::const_iterator ih =
hits_.begin();
67 else {
edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector"; }
78 else {
edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector"; }
82 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - 2 hits on same layer!!";
100 else {
edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector"; }
110 else {
edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector"; }
119 float dz = h2pos.
z()-h1pos.
z();
121 uslope_ = ( h2pos.
x() - h1pos.
x() ) / dz ;
122 vslope_ = ( h2pos.
y() - h1pos.
y() ) / dz ;
124 float uintercept = ( h1pos.
x()*h2pos.
z() - h2pos.
x()*h1pos.
z() ) / dz;
125 float vintercept = ( h1pos.
y()*h2pos.
z() - h2pos.
y()*h1pos.
z() ) / dz;
140 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fitlsq] - start fitlsq";
219 std::vector<const TrackingRecHit*>::const_iterator ih =
hits_.begin();
222 for (ih =
hits_.begin(); ih !=
hits_.end(); ++ih)
224 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fitlsq] - looping over TrackingRecHits";
227 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fitlsq] - Tracking RecHit in detid ("<<d.
rawId()<<
")";
229 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fitlsq] - Tracking RecHit is a GEM Hit in detid ("<<d.
rawId()<<
")";
233 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fitlsq] - Tracking RecHit is a CSC Hit in detid ("<<d.
rawId()<<
")";
236 else {
edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector"; }
240 for (ih =
hits_.begin(); ih !=
hits_.end(); ++ih)
255 else {
edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector"; }
259 std::stringstream lpss; lpss<<lp;
std::string lps = lpss.str();
260 std::stringstream gpss; gpss<<gp;
std::string gps = gpss.str();
261 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fitlsq] - Tracking RecHit global position "<<std::setw(30)<<gps<<
" and local position "<<std::setw(30)<<lps
279 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fit] 2x2 covariance matrix for this Tracking RecHit :: [[" << IC(0,0) <<
", "<< IC(0,1) <<
"]["<< IC(1,0) <<
","<<IC(1,1)<<
"]]";
282 bool ok = IC.Invert();
285 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::fit] Failed to invert covariance matrix: \n" << IC;
295 M(0,2) += IC(0,0) *
z;
296 M(0,3) += IC(0,1) *
z;
297 B(0) += u * IC(0,0) + v * IC(0,1);
301 M(1,2) += IC(1,0) *
z;
302 M(1,3) += IC(1,1) *
z;
303 B(1) += u * IC(1,0) + v * IC(1,1);
305 M(2,0) += IC(0,0) *
z;
306 M(2,1) += IC(0,1) *
z;
307 M(2,2) += IC(0,0) * z *
z;
308 M(2,3) += IC(0,1) * z *
z;
309 B(2) += ( u * IC(0,0) + v * IC(0,1) ) * z;
311 M(3,0) += IC(1,0) *
z;
312 M(3,1) += IC(1,1) *
z;
313 M(3,2) += IC(1,0) * z *
z;
314 M(3,3) += IC(1,1) * z *
z;
315 B(3) += ( u * IC(1,0) + v * IC(1,1) ) * z;
320 bool ok = M.Invert();
323 edm::LogVerbatim(
"GEMCSCSegment|GEMCSCSegFit") <<
"[GEMCSCSegFit::fit] Failed to invert matrix: \n" << M;
332 <<
p(0) <<
", " <<
p(1) <<
", " <<
p(2) <<
", " <<
p(3);
358 std::vector<const TrackingRecHit*>::const_iterator ih;
359 for (ih =
hits_.begin(); ih !=
hits_.end(); ++ih) {
374 else {
edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector"; }
378 std::stringstream lpss; lpss<<lp;
std::string lps = lpss.str();
379 std::stringstream gpss; gpss<<gp;
std::string gps = gpss.str();
380 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] - Tracking RecHit in "<<(gem?
"GEM":
"CSC")<<
" global position "<<std::setw(30)<<gps<<
" and local position "<<std::setw(30)<<lps
390 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] u, v, z = " << u <<
", " << v <<
", " <<
z;
400 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] IC before = \n" << IC;
403 bool ok = IC.Invert();
405 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] Failed to invert covariance matrix: \n" << IC;
408 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] IC after = \n" << IC;
409 chsq += du*du*IC(0,0) + 2.*du*dv*IC(0,1) + dv*dv*IC(1,1);
411 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] Contribution of this Tracking RecHit to Chi2: du^2*D(1,1) + 2*du*dv*D(1,2) + dv^2*D(2,2) = "
412 << du*du <<
"*"<<IC(0,0)<<
" + 2.*"<<du<<
"*"<<dv<<
"*"<<IC(0,1)<<
" + "<<dv*dv<<
"*"<<IC(1,1)<<
" = "<<du*du*IC(0,0) + 2.*du*dv*IC(0,1) + dv*dv*IC(1,1);
415 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] Total Chi2 = "<<chsq;
417 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::setChi2] Total Chi2/NDof = "<<((
hits_.size()>2)?(chsq/(2.*
hits_.size() - 4)):(0.0));
441 for (std::vector<const TrackingRecHit*>::const_iterator it =
hits_.begin(); it !=
hits_.end(); ++it)
456 ok = matrix.Invert();
459 edm::LogVerbatim(
"GEMCSCSegment|GEMCSCSegFit") <<
"[GEMCSCSegFit::weightMatrix] Failed to invert matrix: \n" <<
matrix;
460 SMatrixSym16 emptymatrix = ROOT::Math::SMatrixIdentity();
474 for(std::vector<const TrackingRecHit*>::const_iterator it =
hits_.begin(); it !=
hits_.end(); ++it) {
487 else {
edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit:fit2] - TrackingRecHit is not in GEM or CSC subdetector"; }
508 double dz = 1./
sqrt(1. + dxdz*dxdz + dydz*dydz);
519 double directionSign = globalZpos * globalZdir;
530 edm::LogVerbatim(
"GEMCSCSegFit") <<
"[GEMCSCSegFit::covarianceMatrix] derivatives matrix A: \n" <<
A;
538 ok = result.Invert();
540 edm::LogVerbatim(
"GEMCSCSegment|GEMCSCSegFit") <<
"[GEMCSCSegFit::calculateError] Failed to invert matrix: \n" <<
result;
564 for (
short j=0;
j!=4; ++
j) {
565 for (
short i=0;
i!=4; ++
i) {
566 hold(
i+1,
j+1) =
a(
i,
j);
SMatrix16by4 derivativeMatrix(void)
float xdev(float x, float z) const
std::vector< const TrackingRecHit * > hits_
float ydev(float y, float z) const
CSCDetId id() const
Get the (concrete) DetId.
float Rdev(float x, float y, float z) const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
ROOT::Math::SMatrix< double, 4 > SMatrix4
ROOT::Math::SMatrix< double, 16, 4 > SMatrix16by4
float xfit(float z) const
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
ROOT::Math::SVector< double, 4 > SVector4
double scaleXError(void) const
uint32_t rawId() const
get the raw id
AlgebraicSymMatrix covarianceMatrix(void)
const CSCChamber * refcscchamber() const
T x() const
Cartesian x coordinate.
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > SMatrixSym2
int layer() const
Layer id: each station have two layers of chambers: layer 1 is the inner chamber and layer 2 is the o...
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > SMatrixSym4
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
float yfit(float z) const
AlgebraicSymMatrix flipErrors(const SMatrixSym4 &)
virtual LocalError localPositionError() const =0
CLHEP::HepSymMatrix AlgebraicSymMatrix
SMatrixSym16 weightMatrix(void)
virtual LocalPoint localPosition() const =0
const CSCChamber * cscchamber(uint32_t id) const
const GEMEtaPartition * gemetapartition(uint32_t id) const
ROOT::Math::SMatrix< double, 16, 16, ROOT::Math::MatRepSym< double, 16 > > SMatrixSym16