10 #ifndef WEIGHTMANAGER_H 11 #define WEIGHTMANAGER_H 33 const std::string&
Name()
const;
44 template <
typename EngineCreator>
76 template <
typename EngineCreator>
83 auto const rw_func = p.
get<std::vector<std::string>>(
"weight_functions");
86 auto const module_label = p.
get<std::string>(
"module_label");
87 for (
auto const& func : rw_func) {
89 std::string func_type = ps_func.
get<std::string>(
"type");
94 <<
"Function " << func <<
" requested in fcl file has not been registered!" << std::endl;
97 <<
"Function " << func <<
" has been requested multiple times in fcl file!" << std::endl;
101 createEngine(
"HepJamesRandom", func),
"HepJamesRandom", func, ps_func,
"random_seed");
102 wcalc->SetName(func);
103 wcalc->Configure(p, engine);
107 winfo->
fNmultisims = ps_func.get<
int>(
"number_of_multisims", 0);
static WeightCalc * Create(const std::string &classname)
std::map< std::string, Weight_t * > GetWeightCalcMap()
Returns the map between calculator name and Weight_t product.
std::string fWeightCalcType
T get(std::string const &key) const
An art service to assist in the distribution of guaranteed unique seeds to all engines within an art ...
bool _configured
Readiness flag.
std::reference_wrapper< NuRandomService::engine_t > registerAndSeedEngine(engine_t &engine, std::string type="", std::string instance="", std::optional< seed_t > const seed=std::nullopt)
Creates an engine with art::RandomNumberGenerator service.
WeightManager(const std::string name="WeightManager")
std::map< std::string, Weight_t * > fWeightCalcMap
A set of custom weight calculators.
MCEventWeight Run(art::Event &e, const int inu)
Core function (previous call to Configure is needed)
const std::string & Name() const
Name getter.
Tools and modules for checking out the basics of the Monte Carlo.
size_t Configure(fhicl::ParameterSet const &cfg, EngineCreator engineCreator)
Configuration function.
cet::coded_exception< error, detail::translate > exception