Skip to content

fix bug in SelectiveBremMatchAlg

Maarten Van Veghel requested to merge mveghel-selbremmatchfix into master

This solves the non-deterministic, rare bug reported in Rec#197 -- closes #197 (closed)

The bug relates to an interator-based for-loop over vector while adding stuff to the vector in the loop in SelectiveMatchUtils.h:

Old (buggy):

          for ( const auto& cellid : cellids ) {
            const auto& neighbors = calo.neighborCells( cellid );
            cellids.insert( cellids.end(), neighbors.begin(), neighbors.end() );
          }

New:

          for ( auto i = 0; i < nCells; ++i ) {
            const auto& neighbors = calo.neighborCells( cellids.at( i ) );
            cellids.insert( cellids.end(), neighbors.begin(), neighbors.end() );
          }

On top of the bug fix

It puts further safety nets to ensure a maximum of calo cells is checked in selective search for brem and the reserved memory for vectors is updated accordingly such that reserved memory is always sufficient. The default maxima are set at 8 for maximum number of cells checked in scan from first to last state. Typically, search windows wider than 4 cells (smallest cize) are only relevant for tracks with < 3 GeV/c momentum.

In addition, applies (style) changes from Rec!2423 to other selective match algorithms as well.

Edited by Rosen Matev

Merge request reports

Loading