Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
UserParameterProxy.cpp
Go to the documentation of this file.
2
3
4UserParameterProxy::UserParameterProxy(std::vector<ParameterType> types) {
5 for (auto t : types) {
6 this->types_p[t] = ParameterProvider(t);
7 }
8}
9std::optional<double> UserParameterProxy::get_value(std::string block, LhaID id) {
10 std::optional<ParameterType> pt = this->get_proxy(block, id);
11
12 if (!pt.has_value()) {
13 return std::nullopt;
14 }
15
16 return std::optional<double>(this->types_p[pt.value()](block, id));
17}
18
19void UserParameterProxy::set_value(std::string block, LhaID id, double val) {
20 std::optional<ParameterType> pt = this->get_proxy(block, id);
21
22 if (!pt.has_value()) {
23 LOG_ERROR("ValueError", "Cannot set a parameter :", block, id, "that does not exist.");
24 }
25
26 ParameterSetter().mutate({pt.value(), block, id}, val);
27}
28
29std::optional<ParameterType> UserParameterProxy::get_proxy(std::string block, LhaID id) {
30 for (auto p : this->types_p) {
31 if (p.second.exists(block, id)) {
32 return std::optional<ParameterType>(p.first);
33 }
34 }
35 return std::nullopt;
36}
#define LOG_ERROR(type,...)
Macro for logging error messages and terminating the application.
Definition Logger.h:41
Provides access to parameter values, errors, and existence checks.
Concrete mutator that directly sets the value of parameters.
void mutate(const ParamId &pid, scalar_t value) override
Sets the value of a parameter.
std::optional< double > get_value(std::string block, LhaID id) override
void set_value(std::string block, LhaID id, double val) override
UserParameterProxy(std::vector< ParameterType > types)
Represents an identifier of a LHA element, possibly containing several sub-ids.
Definition LhaID.h:56