diff --git a/Pr/PrAlgorithms/src/PrHybridSeeding.cpp b/Pr/PrAlgorithms/src/PrHybridSeeding.cpp index f1344f4fe38cd86303f91625773f660fc490c20c..abf1c0854070b9a19f11ac30b1c8b3b159aea8b0 100644 --- a/Pr/PrAlgorithms/src/PrHybridSeeding.cpp +++ b/Pr/PrAlgorithms/src/PrHybridSeeding.cpp @@ -802,7 +802,7 @@ bool PrHybridSeeding::createTracksFromHough( const unsigned int& //---LoH: could probably be done in one pass with minimal loss while ( itEnd2 - itBeg2 > nLay ) { auto worstMultiple = itEnd2; - float worstchi = std::numeric_limits<float>::min(); + float worstchi = std::numeric_limits<float>::lowest(); float chi_hit; for ( auto line_hit = itBeg2; line_hit != itEnd2; ++line_hit ) { if ( plCount.nbInPlane( line_hit->planeCode ) == 1 ) continue; @@ -812,6 +812,11 @@ bool PrHybridSeeding::createTracksFromHough( const unsigned int& worstMultiple = line_hit; } } + if ( worstMultiple == itEnd2 ) { + // This should probably never be reached, see + // https://gitlab.cern.ch/lhcb/Rec/merge_requests/1788#note_2987027 + break; + } // it will just change the m_planeCode[int] not the whole internal hit counting ! ) plCount.removeHitInPlane( worstMultiple->planeCode ); // Avoid relocations by swapping the worst hit to the last hit and reducing the end by one. @@ -825,7 +830,7 @@ bool PrHybridSeeding::createTracksFromHough( const unsigned int& fit &= LineOK( minChi2LineLow, minChi2LineHigh, xCandidate, BestLine, nInit ); if ( !fit ) continue; trackCand.setFromXCand( xCandidate ); - for ( auto hit = itBeg2; hit < itEnd2; hit++ ) trackCand.hits().push_back( *hit ); + trackCand.hits().insert( trackCand.hits().end(), itBeg2, itEnd2 ); } trackCand.setYParam( BestLine.ay(), BestLine.by() ); //---LoH: performs the simultaneous fit