Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions RecoTracker/CkfPattern/src/BaseCkfTrajectoryBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,32 @@ bool BaseCkfTrajectoryBuilder::toBeContinued(TempTrajectory& traj, bool inOut) c
}
// Called after each new hit is added to the trajectory, to see if it is
// worth continuing to build this track candidate.
//
// When a sufficient amount of measurements are made,
// ensure that an infinite loop is not created (CMSHLT-3557).
// Avoid hit-pair structures as last = last-2, and last-1 = last-3,
// where last refers to measurements.
//
const TempTrajectory::DataContainer tms = traj.measurements();
TempTrajectory::DataContainer::const_iterator tm = tms.begin();

// Ensure at sufficient amount of measurements before checking for loops
if (traj.measurements().size() > 15) {
TrackingRecHit::RecHitPointer lastHit = tm->recHit();
++tm;
TrackingRecHit::RecHitPointer last2Hit = tm->recHit();
++tm;
TrackingRecHit::RecHitPointer last3Hit = tm->recHit();
++tm;
TrackingRecHit::RecHitPointer last4Hit = tm->recHit();
if (lastHit->geographicalId() == last3Hit->geographicalId() &&
last2Hit->geographicalId() == last4Hit->geographicalId() &&
(lastHit->geographicalId().rawId() == 0 || last2Hit->geographicalId().rawId() == 0)) {
LogDebug("CkfPattern") << "Loop pattern found in last recHits\n" << PrintoutHelper::dumpMeasurements(tms);

return false;
}
}
if (inOut) {
// if (theInOutFilter == 0) edm::LogError("CkfPattern") << "CkfTrajectoryBuilder error: trying to use dedicated filter for in-out tracking phase, when none specified";
return theInOutFilter->toBeContinued(traj);
Expand Down