Example usage of CompositeParamAdapter to manage parameter dependencies.
Example usage of CompositeParamAdapter to manage parameter dependencies.This example demonstrates how to add a dependent block based on multiple source blocks and how to trigger an update manually.
#include "CompositeParamAdapter.h"
#include <iostream>
std::unordered_map<ParameterType, std::vector<std::string>> sources = {
};
auto recalculate = [](const std::unordered_map<std::string, std::shared_ptr<Block>>& src_blocks,
std::shared_ptr<DependentBlock> dep_block) {
double alpha_em = src_blocks.at(
"GAUGE")->retrieve(
LhaID(1))->get_val();
double mass_w = src_blocks.at(
"MASS")->retrieve(
LhaID(24))->get_val();
dep_block->store_or_assign(
LhaID(100), std::make_shared<Parameter>(
ParamId(
"NEWBLOCK", 100), alpha_em + mass_w, 0., 0.));
};
std::cout << "Combined value = " << value << std::endl;
return 0;
}
Model-dependent parameter repository and initialization strategies.
Concrete implementation of IDependency using DependentBlockManager.
void update_dependency(const BlockName &name, ParameterType src) override
Manually triggers an update on a dependent block using DependentBlockManager.
void add_block_dependency(const BlockName &name, const std::unordered_map< ParameterType, std::vector< std::string > > &source_names, ParameterType dest, DepUpdateFunc recalculateFunc) override
Adds a dependent block using DependentBlockManager.
static std::shared_ptr< Parameters > GetInstance(ParameterType id=ParameterType::SM)
Returns the singleton-like repository for a given parameter type.
Represents an identifier of a LHA element, possibly containing several sub-ids.
Composite identifier for a single parameter.