diff --git a/src/ConformalTracking.cc b/src/ConformalTracking.cc index 095eab8..bdf54c4 100644 --- a/src/ConformalTracking.cc +++ b/src/ConformalTracking.cc @@ -52,9 +52,9 @@ using namespace AIDA; ConformalTracking aConformalTracking; /* - + Pattern recognition code for the CLIC detector, using conformal mapping and cellular automaton - + */ class TooManyTracksException : public marlin::SkipEventException { @@ -620,55 +620,55 @@ void ConformalTracking::processEvent(LCEvent* evt) { /*std::sort(conformalTracks.begin(),conformalTracks.end(),sort_by_length); for(int existingTrack=0;existingTrack= 2) { clone = true; - + // Calculate the new and existing chi2 values double newchi2 = (conformalTracks[existingTrack]->chi2ndofZS()*conformalTracks[existingTrack]->chi2ndofZS() + conformalTracks[existingTrack]->chi2ndof()*conformalTracks[existingTrack]->chi2ndof()); double oldchi2 = (conformalTracksFinal[savedTrack]->chi2ndofZS()*conformalTracksFinal[savedTrack]->chi2ndofZS() + conformalTracksFinal[savedTrack]->chi2ndof()*conformalTracksFinal[savedTrack]->chi2ndof()); - + double deltachi2ZS = (conformalTracks[existingTrack]->chi2ndofZS()-conformalTracksFinal[savedTrack]->chi2ndofZS()); double deltachi2 = (conformalTracks[existingTrack]->chi2ndof()-conformalTracksFinal[savedTrack]->chi2ndof()); - + // If the new track is a subtrack of an existing track, don't consider it further (already try removing bad hits from tracks if(nOverlappingHits == conformalTracks[existingTrack]->m_clusters.size()) break; - + // Otherwise take the longest if the delta chi2 is not too much else if(conformalTracks[existingTrack]->m_clusters.size() >= conformalTracksFinal[savedTrack]->m_clusters.size()){ // New track longer/equal in length - + // Increase in chi2 is too much (double) if( (newchi2 - oldchi2) > oldchi2) break; - + // Otherwise take it delete conformalTracksFinal[savedTrack]; conformalTracksFinal[savedTrack] = conformalTracks[existingTrack]; saved = true; } else if(conformalTracks[existingTrack]->m_clusters.size() < conformalTracksFinal[savedTrack]->m_clusters.size()){ // Old track longer - + // Must improve chi2 by factor two if( (newchi2 - 0.5*oldchi2) > 0.) break; - + // Otherwise take it delete conformalTracksFinal[savedTrack]; conformalTracksFinal[savedTrack] = conformalTracks[existingTrack]; saved = true; } - + break; } } - + if(!clone){ conformalTracksFinal.push_back(conformalTracks[existingTrack]); }else{ if(!saved) delete conformalTracks[existingTrack]; } - + } //*/ @@ -2530,12 +2530,12 @@ void ConformalTracking::fitWithPoint(KDTrack kdTrack, SKDCluster& hit, double& d double chi2 = kdTrack.chi2ndof(); double chi2zs = kdTrack.chi2ndofZS(); /*if(m_debugPlots){ - + double xMeasured = hit->getU(); double yMeasured = hit->getV(); double dx = hit->getErrorU(); double dv = hit->getErrorV(); - + if(kdTrack.m_rotated){ double newxMeasured = yMeasured; double newyMeasured = -1. * xMeasured; @@ -2550,9 +2550,9 @@ void ConformalTracking::fitWithPoint(KDTrack kdTrack, SKDCluster& hit, double& d // Get the error on the hit position double term = kdTrack.m_gradient + 2. * kdTrack.m_quadratic * xMeasured; double dy2 = (dv * dv) + (term * term * dx * dx); - + streamlog_out(DEBUG7)<<"- hit has delta chi2 of "<<(residualY * residualY) / (dy2)< 10) { + if (not m_retryTooManyTracks || thisParameters._tightenStep >= 10) { streamlog_out(ERROR) << "Skipping event" << std::endl; throw; } + streamlog_out(MESSAGE) << "caught too many tracks, tightening parameters" << std::endl; + thisParameters.tighten(); + caughtException = true; } } while (caughtException);