Feature #20063
Random numbers in MixFilter detail
Description
Hello,
Users can call initialize a random engine in a module constructor with
the createEngine(seed) call. To achieve this in mixing code one has to
take a more contorted way, and put in the MixFilter detail class
constructor something like
art::RandomNumberGenerator::base_engine_t& engine = art::ServiceHandle<art::RandomNumberGenerator>()->getEngine();
int dummy(0);
engine.setSeed( art::ServiceHandle<SeedService>()->getSeed(), dummy );
It would be nice to streamline the interface for MixFilter users.
Andrei
History
#1 Updated by Kyle Knoepfel over 2 years ago
- Description updated (diff)
#2 Updated by Kyle Knoepfel over 2 years ago
- Status changed from New to Accepted
This sounds like a reasonable proposal.
#3 Updated by Kyle Knoepfel over 2 years ago
- Target version set to Vega
#4 Updated by Kyle Knoepfel over 2 years ago
- Category set to Infrastructure
- Status changed from Accepted to Resolved
- Assignee set to Kyle Knoepfel
- % Done changed from 0 to 100
- SSI Package art added
This feature has been implemented with art:652b484. The createEngine
interface has been added to the MixHelper
class. Note that under some circumstances, the MixHelper
already requires the use of a random-number engine for sampling entries in secondary files. In such case, calling createEngine
may return an engine that has already been created. This will not create any breaking changes since users have had the same behavior by calling getEngine
.
An example:
MixFilterDetail::MixFilterDetail(fhicl::ParameterSet const& pset,
art::MixHelper& helper)
// initializers
{
auto& engine1 = helper.createEngine(124); // May return already created engine
auto& engine2 = helper.createEngine(125, "HepJamesRandom"); // May return already created engine
auto& engine3 = helper.createEngine(126, "HepJamesRandom", "second_engine"); // new engine
// If an empty engine label has been specified, but with a different
// engine type other than HepJamesRandom, an exception will be thrown
// if a read mode was chosen that requires sampling.
auto& engine4 = helper.createEngine(127, "MTwistEngine"); // May throw.
}
#5 Updated by Kyle Knoepfel over 2 years ago
- Target version changed from Vega to 3.01.00
#6 Updated by Kyle Knoepfel over 2 years ago
- Target version changed from 3.01.00 to 3.02.00
#7 Updated by Kyle Knoepfel almost 2 years ago
- Status changed from Resolved to Closed