Skip to content
Snippets Groups Projects

Modernize deterministic mixer code

Merged Gerhard Raven requested to merge modernize-mixer into master
Files
10
@@ -8,19 +8,14 @@
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
// Gaudi
#include "GaudiAlg/FilterPredicate.h"
// from LHCb core
#include "Event/ODIN.h"
// STL
#include "GaudiAlg/FilterPredicate.h"
#include "LHCbMath/DeterministicMixer.h"
#include <cmath>
#include <cstdint>
#include <limits>
#include <string>
#include "DeterministicPrescalerGenerator.h"
/** @class DeterministicPrescaler DeterministicPrescaler.cpp
*
* @brief Return a positive decision for a configurable fraction of executions.
@@ -51,7 +46,7 @@ public:
bool operator()( const LHCb::ODIN& odin ) const override {
auto accept = [&]( const LHCb::ODIN& odin ) {
auto x = mix64( mix32( mix64( m_initial, odin.gpsTime() ), odin.runNumber() ), odin.eventNumber() );
auto x = LHCb::DeterministicMixer{m_initial}( odin.gpsTime(), odin.runNumber(), odin.eventNumber() ).state;
if ( msgLevel( MSG::DEBUG ) )
debug() << " gpsTime: " << odin.gpsTime() << " run#: " << odin.runNumber() << " evt#: " << odin.eventNumber()
<< " --> " << x << endmsg;
@@ -72,12 +67,12 @@ private:
throw GaudiException( "Required property SeedName is empty", name(),
StatusCode::FAILURE );
}
m_initial = mixString( m_seed_name.size(), m_seed_name );
m_initial = LHCb::DeterministicMixer{m_seed_name};
},
"String used to seed pseudo-random number generation"};
/// initial seed unique to this instance (computed from the name)
std::uint32_t m_initial{0};
LHCb::DeterministicMixer m_initial{0};
/// integer representation of the above
std::uint32_t m_acc{std::numeric_limits<uint32_t>::max()};
Loading