#include <RecoLocalMuon/CSCSegment/src/CSCSegAlgoShowering.h>
Handle case where too many hits are reconstructed in the chamber, even after preclustering for normal segment reconstruction to properly handle these. In this case, determine the average local (x,y) for each layer and find the hit closest to that localpoint for that given layer. From these hits, reconstruct a segment. The idea is to give the reconstruction (seeding) a valid starting point for the kalman filter.
Definition at line 24 of file CSCSegAlgoShowering.h.
typedef std::vector<const CSCRecHit2D*> CSCSegAlgoShowering::ChamberHitContainer |
Definition at line 28 of file CSCSegAlgoShowering.h.
CSCSegAlgoShowering::CSCSegAlgoShowering | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Constructor.
Definition at line 28 of file CSCSegAlgoShowering.cc.
References dPhiFineMax, dRPhiFineMax, edm::ParameterSet::getParameter(), maxDPhi, maxDTheta, maxRatioResidual, tanPhiMax, and tanThetaMax.
00028 { 00029 // debug = ps.getUntrackedParameter<bool>("CSCSegmentDebug"); 00030 dRPhiFineMax = ps.getParameter<double>("dRPhiFineMax"); 00031 dPhiFineMax = ps.getParameter<double>("dPhiFineMax"); 00032 tanThetaMax = ps.getParameter<double>("tanThetaMax"); 00033 tanPhiMax = ps.getParameter<double>("tanPhiMax"); 00034 maxRatioResidual = ps.getParameter<double>("maxRatioResidualPrune"); 00035 // maxDR = ps.getParameter<double>("maxDR"); 00036 maxDTheta = ps.getParameter<double>("maxDTheta"); 00037 maxDPhi = ps.getParameter<double>("maxDPhi"); 00038 }
CSCSegAlgoShowering::~CSCSegAlgoShowering | ( | ) | [virtual] |
bool CSCSegAlgoShowering::addHit | ( | const CSCRecHit2D * | hit, | |
int | layer | |||
) | [private] |
Definition at line 299 of file CSCSegAlgoShowering.cc.
References it, and protoSegment.
Referenced by compareProtoSegment().
00299 { 00300 00301 // Return true if hit was added successfully and then parameters are updated. 00302 // Return false if there is already a hit on the same layer, or insert failed. 00303 00304 bool ok = true; 00305 00306 // Test that we are not trying to add the same hit again 00307 for ( ChamberHitContainer::const_iterator it = protoSegment.begin(); it != protoSegment.end(); it++ ) 00308 if ( aHit == (*it) ) return false; 00309 00310 protoSegment.push_back(aHit); 00311 00312 return ok; 00313 }
AlgebraicSymMatrix CSCSegAlgoShowering::calculateError | ( | void | ) | const [private] |
Definition at line 469 of file CSCSegAlgoShowering.cc.
References a, funct::A, CSCRecHit2D::cscDetId(), it, CSCDetId::layer(), CSCChamber::layer(), CSCRecHit2D::localPosition(), CSCRecHit2D::localPositionError(), lp, protoSegment, row, theChamber, GeomDet::toGlobal(), GeomDet::toLocal(), weights, LocalError::xx(), LocalError::xy(), LocalError::yy(), PV3DBase< T, PVType, FrameType >::z(), and z.
Referenced by showerSeg().
00469 { 00470 00471 // Blightly assume the following never fails 00472 00473 std::vector<const CSCRecHit2D*>::const_iterator it; 00474 int nhits = protoSegment.size(); 00475 int ierr; 00476 00477 AlgebraicSymMatrix weights(2*nhits, 0); 00478 AlgebraicMatrix A(2*nhits, 4); 00479 00480 int row = 0; 00481 for (it = protoSegment.begin(); it != protoSegment.end(); ++it) { 00482 const CSCRecHit2D& hit = (**it); 00483 const CSCLayer* layer = theChamber->layer(hit.cscDetId().layer()); 00484 GlobalPoint gp = layer->toGlobal(hit.localPosition()); 00485 LocalPoint lp = theChamber->toLocal(gp); 00486 float z = lp.z(); 00487 ++row; 00488 weights(row, row) = hit.localPositionError().xx(); 00489 weights(row, row+1) = hit.localPositionError().xy(); 00490 A(row, 1) = 1.; 00491 A(row, 3) = z; 00492 ++row; 00493 weights(row, row-1) = hit.localPositionError().xy(); 00494 weights(row, row) = hit.localPositionError().yy(); 00495 A(row, 2) = 1.; 00496 A(row, 4) = z; 00497 } 00498 weights.invert(ierr); 00499 00500 AlgebraicSymMatrix a = weights.similarityT(A); 00501 a.invert(ierr); 00502 00503 // but reorder components to match what's required by TrackingRecHit interface 00504 // i.e. slopes first, then positions 00505 00506 AlgebraicSymMatrix hold( a ); 00507 00508 // errors on slopes into upper left 00509 a(1,1) = hold(3,3); 00510 a(1,2) = hold(3,4); 00511 a(2,1) = hold(4,3); 00512 a(2,2) = hold(4,4); 00513 00514 // errors on positions into lower right 00515 a(3,3) = hold(1,1); 00516 a(3,4) = hold(1,2); 00517 a(4,3) = hold(2,1); 00518 a(4,4) = hold(2,2); 00519 00520 // off-diagonal elements remain unchanged 00521 return a; 00522 }
void CSCSegAlgoShowering::compareProtoSegment | ( | const CSCRecHit2D * | h, | |
int | layer | |||
) | [private] |
Definition at line 431 of file CSCSegAlgoShowering.cc.
References addHit(), it, protoChi2, protoDirection, protoIntercept, protoSegment, protoSlope_u, protoSlope_v, and updateParameters().
Referenced by showerSeg().
00431 { 00432 00433 // Store old segment first 00434 double old_protoChi2 = protoChi2; 00435 LocalPoint old_protoIntercept = protoIntercept; 00436 float old_protoSlope_u = protoSlope_u; 00437 float old_protoSlope_v = protoSlope_v; 00438 LocalVector old_protoDirection = protoDirection; 00439 ChamberHitContainer old_protoSegment = protoSegment; 00440 00441 00442 // Try adding the hit to existing segment, and remove old one existing in same layer 00443 ChamberHitContainer::iterator it; 00444 for ( it = protoSegment.begin(); it != protoSegment.end(); ) { 00445 if ( (*it)->cscDetId().layer() == layer ) { 00446 it = protoSegment.erase(it); 00447 } else { 00448 ++it; 00449 } 00450 } 00451 bool ok = addHit(h, layer); 00452 00453 if (ok) updateParameters(); 00454 00455 if ( (protoChi2 > old_protoChi2) || ( !ok ) ) { 00456 protoChi2 = old_protoChi2; 00457 protoIntercept = old_protoIntercept; 00458 protoSlope_u = old_protoSlope_u; 00459 protoSlope_v = old_protoSlope_v; 00460 protoDirection = old_protoDirection; 00461 protoSegment = old_protoSegment; 00462 } 00463 }
bool CSCSegAlgoShowering::isHitNearSegment | ( | const CSCRecHit2D * | h | ) | const [private] |
Utility functions.
Definition at line 262 of file CSCSegAlgoShowering.cc.
References CSCRecHit2D::cscDetId(), deltaPhi(), dPhiFineMax, dRPhiFineMax, CSCDetId::layer(), CSCChamber::layer(), CSCRecHit2D::localPosition(), PV3DBase< T, PVType, FrameType >::phi(), protoIntercept, protoSlope_u, protoSlope_v, dttmaxenums::R, funct::sqrt(), theChamber, GeomDet::toGlobal(), GeomDet::toLocal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and z.
Referenced by showerSeg().
00262 { 00263 00264 const CSCLayer* layer = theChamber->layer(hit->cscDetId().layer()); 00265 00266 // hit phi position in global coordinates 00267 GlobalPoint Hgp = layer->toGlobal(hit->localPosition()); 00268 double Hphi = Hgp.phi(); 00269 if (Hphi < 0.) Hphi += 2.*M_PI; 00270 LocalPoint Hlp = theChamber->toLocal(Hgp); 00271 double z = Hlp.z(); 00272 00273 double LocalX = protoIntercept.x() + protoSlope_u * z; 00274 double LocalY = protoIntercept.y() + protoSlope_v * z; 00275 LocalPoint Slp(LocalX, LocalY, z); 00276 GlobalPoint Sgp = theChamber->toGlobal(Slp); 00277 double Sphi = Sgp.phi(); 00278 if (Sphi < 0.) Sphi += 2.*M_PI; 00279 double R = sqrt(Sgp.x()*Sgp.x() + Sgp.y()*Sgp.y()); 00280 00281 double deltaPhi = Sphi - Hphi; 00282 if (deltaPhi > 2.*M_PI) deltaPhi -= 2.*M_PI; 00283 if (deltaPhi < -2.*M_PI) deltaPhi += 2.*M_PI; 00284 if (deltaPhi < 0.) deltaPhi = -deltaPhi; 00285 00286 double RdeltaPhi = R * deltaPhi; 00287 00288 if (RdeltaPhi < dRPhiFineMax && deltaPhi < dPhiFineMax ) return true; 00289 00290 return false; 00291 }
void CSCSegAlgoShowering::pruneFromResidual | ( | ) | [private] |
Definition at line 525 of file CSCSegAlgoShowering.cc.
References CSCRecHit2D::cscDetId(), j, CSCDetId::layer(), CSCChamber::layer(), CSCRecHit2D::localPosition(), lp, maxRatioResidual, protoIntercept, protoSegment, protoSlope_u, protoSlope_v, funct::sqrt(), theChamber, GeomDet::toGlobal(), GeomDet::toLocal(), updateParameters(), v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and z.
Referenced by showerSeg().
00525 { 00526 00527 // Only prune if have at least 5 hits 00528 if ( protoSegment.size() < 5 ) return ; 00529 00530 00531 // Now Study residuals 00532 00533 float maxResidual = 0.; 00534 float sumResidual = 0.; 00535 int nHits = 0; 00536 int badIndex = -1; 00537 int j = 0; 00538 00539 00540 ChamberHitContainer::const_iterator ih; 00541 00542 for ( ih = protoSegment.begin(); ih != protoSegment.end(); ++ih ) { 00543 const CSCRecHit2D& hit = (**ih); 00544 const CSCLayer* layer = theChamber->layer(hit.cscDetId().layer()); 00545 GlobalPoint gp = layer->toGlobal(hit.localPosition()); 00546 LocalPoint lp = theChamber->toLocal(gp); 00547 00548 double u = lp.x(); 00549 double v = lp.y(); 00550 double z = lp.z(); 00551 00552 double du = protoIntercept.x() + protoSlope_u * z - u; 00553 double dv = protoIntercept.y() + protoSlope_v * z - v; 00554 00555 float residual = sqrt(du*du + dv*dv); 00556 00557 sumResidual += residual; 00558 nHits++; 00559 if ( residual > maxResidual ) { 00560 maxResidual = residual; 00561 badIndex = j; 00562 } 00563 j++; 00564 } 00565 00566 float corrAvgResidual = (sumResidual - maxResidual)/(nHits -1); 00567 00568 // Keep all hits 00569 if ( maxResidual/corrAvgResidual < maxRatioResidual ) return; 00570 00571 00572 // Drop worse hit and recompute segment properties + fill 00573 00574 ChamberHitContainer newProtoSegment; 00575 00576 j = 0; 00577 for ( ih = protoSegment.begin(); ih != protoSegment.end(); ++ih ) { 00578 if ( j != badIndex ) newProtoSegment.push_back(*ih); 00579 j++; 00580 } 00581 00582 protoSegment.clear(); 00583 00584 for ( ih = newProtoSegment.begin(); ih != newProtoSegment.end(); ++ih ) { 00585 protoSegment.push_back(*ih); 00586 } 00587 00588 // Update segment parameters 00589 updateParameters(); 00590 00591 }
CSCSegment CSCSegAlgoShowering::showerSeg | ( | const CSCChamber * | aChamber, | |
ChamberHitContainer | rechits | |||
) |
Definition at line 52 of file CSCSegAlgoShowering.cc.
References calculateError(), compareProtoSegment(), CSCRecHit2D::cscDetId(), diff, dPhi(), h, i, id, isHitNearSegment(), it, CSCDetId::layer(), CSCChamber::layer(), CSCRecHit2D::localPosition(), lp, PV3DBase< T, PVType, FrameType >::mag(), maxDPhi, maxDTheta, n, PV3DBase< T, PVType, FrameType >::phi(), protoChi2, protoDirection, protoIntercept, protoSegment, protoSlope_u, protoSlope_v, pruneFromResidual(), funct::sqrt(), pyDBSRunClass::temp, theChamber, PV3DBase< T, PVType, FrameType >::theta(), GeomDet::toGlobal(), GeomDet::toLocal(), updateParameters(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), and z.
Referenced by CSCSegAlgoDF::buildSegments().
00052 { 00053 00054 theChamber = aChamber; 00055 // Initialize parameters 00056 std::vector<float> x, y, gz; 00057 std::vector<int> n; 00058 00059 00060 for (int i = 0; i < 6; ++i) { 00061 x.push_back(0.); 00062 y.push_back(0.); 00063 gz.push_back(0.); 00064 n.push_back(0); 00065 } 00066 00067 // Loop over hits to find center-of-mass position in each layer 00068 for (ChamberHitContainer::const_iterator it = rechits.begin(); it != rechits.end(); it++ ) { 00069 const CSCRecHit2D& hit = (**it); 00070 const CSCDetId id = hit.cscDetId(); 00071 int l_id = id.layer(); 00072 const CSCLayer* layer = theChamber->layer(hit.cscDetId().layer()); 00073 GlobalPoint gp = layer->toGlobal(hit.localPosition()); 00074 LocalPoint lp = theChamber->toLocal(gp); 00075 00076 n[l_id -1]++; 00077 x[l_id -1] += lp.x(); 00078 y[l_id -1] += lp.y(); 00079 gz[l_id -1] += gp.z(); 00080 } 00081 00082 00083 // Determine center of mass for each layer and average center of mass for chamber 00084 float avgChamberX = 0.; 00085 float avgChamberY = 0.; 00086 int n_lay = 0; 00087 00088 for (unsigned i = 0; i < 6; ++i) { 00089 if (n[i] < 1 ) continue; 00090 00091 x[i] = x[i]/n[i]; 00092 y[i] = y[i]/n[i]; 00093 avgChamberX += x[i]; 00094 avgChamberY += y[i]; 00095 n_lay++; 00096 00097 } 00098 00099 if ( n_lay > 0) { 00100 avgChamberX = avgChamberX / n_lay; 00101 avgChamberY = avgChamberY / n_lay; 00102 } 00103 00104 // Create a FakeSegment origin that points back to the IP 00105 // Keep all this in global coordinates until last minute to avoid screwing up +/- signs ! 00106 00107 LocalPoint lpCOM(avgChamberX, avgChamberY, 0.); 00108 GlobalPoint gpCOM = theChamber->toGlobal(lpCOM); 00109 GlobalVector gvCOM(gpCOM.x(), gpCOM.y(), gpCOM.z()); 00110 00111 float Gdxdz = gpCOM.x()/gpCOM.z(); 00112 float Gdydz = gpCOM.y()/gpCOM.z(); 00113 00114 // Figure out the intersection of this vector with each layer of the chamber 00115 // by projecting the vector 00116 std::vector<LocalPoint> layerPoints; 00117 00118 for (unsigned i = 1; i < 7; i++) { 00119 // Get the layer z coordinates in global frame 00120 const CSCLayer* layer = theChamber->layer(i); 00121 LocalPoint temp(0., 0., 0.); 00122 GlobalPoint gp = layer->toGlobal(temp); 00123 float layer_Z = gp.z(); 00124 00125 // Then compute interesection of vector with that plane 00126 float layer_X = Gdxdz * layer_Z; 00127 float layer_Y = Gdydz * layer_Z; 00128 GlobalPoint Gintersect(layer_X, layer_Y, layer_Z); 00129 LocalPoint Lintersect = theChamber->toLocal(Gintersect); 00130 00131 float layerX = Lintersect.x(); 00132 float layerY = Lintersect.y(); 00133 float layerZ = Lintersect.z(); 00134 LocalPoint layerPoint(layerX, layerY, layerZ); 00135 layerPoints.push_back(layerPoint); 00136 } 00137 00138 00139 std::vector<float> r_closest; 00140 std::vector<int> id; 00141 for (unsigned i = 0; i < 6; ++i ) { 00142 id.push_back(-1); 00143 r_closest.push_back(9999.); 00144 } 00145 00146 int idx = 0; 00147 00148 // Loop over all hits and find hit closest to com for that layer. 00149 for (ChamberHitContainer::const_iterator it = rechits.begin(); it != rechits.end(); it++ ) { 00150 const CSCRecHit2D& hit = (**it); 00151 int layId = hit.cscDetId().layer(); 00152 const CSCLayer* layer = theChamber->layer(hit.cscDetId().layer()); 00153 GlobalPoint gp = layer->toGlobal(hit.localPosition()); 00154 LocalPoint lp = theChamber->toLocal(gp); 00155 00156 float d_x = lp.x() - layerPoints[layId-1].x(); 00157 float d_y = lp.y() - layerPoints[layId-1].y(); 00158 00159 LocalPoint diff(d_x, d_y, 0.); 00160 00161 if ( fabs(diff.mag() ) < r_closest[layId-1] ) { 00162 r_closest[layId-1] = fabs(diff.mag()); 00163 id[layId-1] = idx; 00164 } 00165 idx++; 00166 } 00167 00168 // Now fill vector of rechits closest to center of mass: 00169 protoSegment.clear(); 00170 idx = 0; 00171 00172 // Loop over all hits and find hit closest to com for that layer. 00173 for (ChamberHitContainer::const_iterator it = rechits.begin(); it != rechits.end(); it++ ) { 00174 const CSCRecHit2D& hit = (**it); 00175 int layId = hit.cscDetId().layer(); 00176 00177 if ( idx == id[layId-1] )protoSegment.push_back(*it); 00178 00179 idx++; 00180 } 00181 00182 // Reorder hits in protosegment 00183 if ( gz[0] > 0. ) { 00184 if ( gz[0] > gz[5] ) { 00185 reverse( protoSegment.begin(), protoSegment.end() ); 00186 } 00187 } 00188 else if ( gz[0] < 0. ) { 00189 if ( gz[0] < gz[5] ) { 00190 reverse( protoSegment.begin(), protoSegment.end() ); 00191 } 00192 } 00193 00194 00195 // Compute the segment properties 00196 updateParameters(); 00197 00198 // Clean up protosegment if there is one very bad hit on segment 00199 if (protoSegment.size() > 4) pruneFromResidual(); 00200 00201 // Look for better hits near segment 00202 for (ChamberHitContainer::const_iterator it = rechits.begin(); it != rechits.end(); it++ ) { 00203 00204 const CSCRecHit2D* h = *it; 00205 int layer = h->cscDetId().layer(); 00206 00207 if ( isHitNearSegment( h ) ) compareProtoSegment(h, layer); 00208 } 00209 00210 // Prune worse hit if necessary 00211 if ( protoSegment.size() > 5 ) pruneFromResidual(); 00212 00213 // Update the parameters 00214 updateParameters(); 00215 00216 // Local direction 00217 double dz = 1./sqrt(1. + protoSlope_u*protoSlope_u + protoSlope_v*protoSlope_v); 00218 double dx = dz*protoSlope_u; 00219 double dy = dz*protoSlope_v; 00220 LocalVector localDir(dx,dy,dz); 00221 00222 // localDir may need sign flip to ensure it points outward from IP 00223 double globalZpos = ( theChamber->toGlobal( protoIntercept ) ).z(); 00224 double globalZdir = ( theChamber->toGlobal( localDir ) ).z(); 00225 double directionSign = globalZpos * globalZdir; 00226 LocalVector protoDirection = (directionSign * localDir).unit(); 00227 00228 // Check to make sure the fitting didn't fuck things up 00229 GlobalVector protoGlobalDir = theChamber->toGlobal( protoDirection ); 00230 double protoTheta = protoGlobalDir.theta(); 00231 double protoPhi = protoGlobalDir.phi(); 00232 double simTheta = gvCOM.theta(); 00233 double simPhi = gvCOM.phi(); 00234 00235 float dTheta = fabs(protoTheta - simTheta); 00236 float dPhi = fabs(protoPhi - simPhi); 00237 // float dR = sqrt(dEta*dEta + dPhi*dPhi); 00238 00239 // Error matrix 00240 AlgebraicSymMatrix protoErrors = calculateError(); 00241 00242 00243 //Flag the segment with chi12 of -1 of the segment isn't pointing toward origin 00244 if (dTheta > maxDTheta || dPhi > maxDPhi) { 00245 CSCSegment temp(protoSegment, protoIntercept, protoDirection, protoErrors, -1); 00246 return temp; 00247 } 00248 else { 00249 CSCSegment temp(protoSegment, protoIntercept, protoDirection, protoErrors, protoChi2); 00250 return temp; 00251 } 00252 00253 }
Definition at line 321 of file CSCSegAlgoShowering.cc.
References CSCRecHit2D::cscDetId(), CSCDetId::layer(), CSCChamber::layer(), CSCRecHit2D::localPosition(), CSCRecHit2D::localPositionError(), LogDebug, lp, p, protoChi2, protoIntercept, protoSegment, protoSlope_u, protoSlope_v, solve(), theChamber, GeomDet::toGlobal(), GeomDet::toLocal(), v, PV3DBase< T, PVType, FrameType >::x(), LocalError::xx(), LocalError::xy(), PV3DBase< T, PVType, FrameType >::y(), LocalError::yy(), PV3DBase< T, PVType, FrameType >::z(), and z.
Referenced by compareProtoSegment(), pruneFromResidual(), and showerSeg().
00321 { 00322 00323 // Compute slope from Least Square Fit 00324 HepMatrix M(4,4,0); 00325 HepVector B(4,0); 00326 00327 ChamberHitContainer::const_iterator ih; 00328 00329 for (ih = protoSegment.begin(); ih != protoSegment.end(); ++ih) { 00330 00331 const CSCRecHit2D& hit = (**ih); 00332 const CSCLayer* layer = theChamber->layer(hit.cscDetId().layer()); 00333 GlobalPoint gp = layer->toGlobal(hit.localPosition()); 00334 LocalPoint lp = theChamber->toLocal(gp); 00335 00336 double u = lp.x(); 00337 double v = lp.y(); 00338 double z = lp.z(); 00339 00340 // ptc: Covariance matrix of local errors 00341 HepMatrix IC(2,2); 00342 IC(1,1) = hit.localPositionError().xx(); 00343 IC(1,2) = hit.localPositionError().xy(); 00344 IC(2,2) = hit.localPositionError().yy(); 00345 IC(2,1) = IC(1,2); // since Cov is symmetric 00346 00347 // ptc: Invert covariance matrix (and trap if it fails!) 00348 int ierr = 0; 00349 IC.invert(ierr); // inverts in place 00350 if (ierr != 0) { 00351 LogDebug("CSC") << "CSCSegment::fitSlopes: failed to invert covariance matrix=\n" << IC << "\n"; 00352 } 00353 00354 M(1,1) += IC(1,1); 00355 M(1,2) += IC(1,2); 00356 M(1,3) += IC(1,1) * z; 00357 M(1,4) += IC(1,2) * z; 00358 B(1) += u * IC(1,1) + v * IC(1,2); 00359 00360 M(2,1) += IC(2,1); 00361 M(2,2) += IC(2,2); 00362 M(2,3) += IC(2,1) * z; 00363 M(2,4) += IC(2,2) * z; 00364 B(2) += u * IC(2,1) + v * IC(2,2); 00365 00366 M(3,1) += IC(1,1) * z; 00367 M(3,2) += IC(1,2) * z; 00368 M(3,3) += IC(1,1) * z * z; 00369 M(3,4) += IC(1,2) * z * z; 00370 B(3) += ( u * IC(1,1) + v * IC(1,2) ) * z; 00371 00372 M(4,1) += IC(2,1) * z; 00373 M(4,2) += IC(2,2) * z; 00374 M(4,3) += IC(2,1) * z * z; 00375 M(4,4) += IC(2,2) * z * z; 00376 B(4) += ( u * IC(2,1) + v * IC(2,2) ) * z; 00377 } 00378 00379 HepVector p = solve(M, B); 00380 00381 // Update member variables 00382 // Note that origin has local z = 0 00383 00384 protoIntercept = LocalPoint(p(1), p(2), 0.); 00385 protoSlope_u = p(3); 00386 protoSlope_v = p(4); 00387 00388 // Determine Chi^2 for the proto wire segment 00389 00390 double chsq = 0.; 00391 00392 for (ih = protoSegment.begin(); ih != protoSegment.end(); ++ih) { 00393 00394 const CSCRecHit2D& hit = (**ih); 00395 const CSCLayer* layer = theChamber->layer(hit.cscDetId().layer()); 00396 GlobalPoint gp = layer->toGlobal(hit.localPosition()); 00397 LocalPoint lp = theChamber->toLocal(gp); 00398 00399 double u = lp.x(); 00400 double v = lp.y(); 00401 double z = lp.z(); 00402 00403 double du = protoIntercept.x() + protoSlope_u * z - u; 00404 double dv = protoIntercept.y() + protoSlope_v * z - v; 00405 00406 HepMatrix IC(2,2); 00407 IC(1,1) = hit.localPositionError().xx(); 00408 IC(1,2) = hit.localPositionError().xy(); 00409 IC(2,2) = hit.localPositionError().yy(); 00410 IC(2,1) = IC(1,2); 00411 00412 // Invert covariance matrix 00413 int ierr = 0; 00414 IC.invert(ierr); 00415 if (ierr != 0) { 00416 LogDebug("CSC") << "CSCSegment::fillChiSquared: failed to invert covariance matrix=\n" << IC << "\n"; 00417 } 00418 chsq += du*du*IC(1,1) + 2.*du*dv*IC(1,2) + dv*dv*IC(2,2); 00419 } 00420 protoChi2 = chsq; 00421 }
float CSCSegAlgoShowering::chi2Max [private] |
Definition at line 68 of file CSCSegAlgoShowering.h.
bool CSCSegAlgoShowering::debug [private] |
Definition at line 62 of file CSCSegAlgoShowering.h.
double CSCSegAlgoShowering::dPhiFineMax [private] |
Definition at line 65 of file CSCSegAlgoShowering.h.
Referenced by CSCSegAlgoShowering(), and isHitNearSegment().
double CSCSegAlgoShowering::dRPhiFineMax [private] |
Definition at line 64 of file CSCSegAlgoShowering.h.
Referenced by CSCSegAlgoShowering(), and isHitNearSegment().
float CSCSegAlgoShowering::maxDPhi [private] |
Definition at line 72 of file CSCSegAlgoShowering.h.
Referenced by CSCSegAlgoShowering(), and showerSeg().
float CSCSegAlgoShowering::maxDTheta [private] |
Definition at line 71 of file CSCSegAlgoShowering.h.
Referenced by CSCSegAlgoShowering(), and showerSeg().
float CSCSegAlgoShowering::maxRatioResidual [private] |
Definition at line 69 of file CSCSegAlgoShowering.h.
Referenced by CSCSegAlgoShowering(), and pruneFromResidual().
int CSCSegAlgoShowering::minHitsPerSegment [private] |
Definition at line 63 of file CSCSegAlgoShowering.h.
const std::string CSCSegAlgoShowering::myName [private] |
Definition at line 51 of file CSCSegAlgoShowering.h.
double CSCSegAlgoShowering::protoChi2 [private] |
Definition at line 58 of file CSCSegAlgoShowering.h.
Referenced by compareProtoSegment(), showerSeg(), and updateParameters().
Definition at line 59 of file CSCSegAlgoShowering.h.
Referenced by compareProtoSegment(), and showerSeg().
Definition at line 57 of file CSCSegAlgoShowering.h.
Referenced by compareProtoSegment(), isHitNearSegment(), pruneFromResidual(), showerSeg(), and updateParameters().
Definition at line 54 of file CSCSegAlgoShowering.h.
Referenced by addHit(), calculateError(), compareProtoSegment(), pruneFromResidual(), showerSeg(), and updateParameters().
float CSCSegAlgoShowering::protoSlope_u [private] |
Definition at line 55 of file CSCSegAlgoShowering.h.
Referenced by compareProtoSegment(), isHitNearSegment(), pruneFromResidual(), showerSeg(), and updateParameters().
float CSCSegAlgoShowering::protoSlope_v [private] |
Definition at line 56 of file CSCSegAlgoShowering.h.
Referenced by compareProtoSegment(), isHitNearSegment(), pruneFromResidual(), showerSeg(), and updateParameters().
float CSCSegAlgoShowering::tanPhiMax [private] |
float CSCSegAlgoShowering::tanThetaMax [private] |
const CSCChamber* CSCSegAlgoShowering::theChamber [private] |
Definition at line 52 of file CSCSegAlgoShowering.h.
Referenced by calculateError(), isHitNearSegment(), pruneFromResidual(), showerSeg(), and updateParameters().