Skip to content

SiDigitization: Add option to allow iterating over charged diodes in a defined order.

A normal iteration over a SiChargedDiodeCollection will use the unordered_map, so the ordering is not defined. The observed ordering can (and does) change depending on the compiler and library version used. In some cases, though, we are sensitive to the order of iteration, for example in cases where we generate a random number for each element of the collection. To get results which are identical across compilers, we need to instead do the iteration in a well-defined order.

This can be done using the methods sortedBegin and sortedEnd instead of begin and end. These work by maintaining a std::set of pointers to the diodes, sorted by the diode number. In order to avoid paying the penalty for maintaining the sorted set when we don't need to, we only start maintaining it the first time that it's requested.

Merge request reports