Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
StatParameterProxy.cpp
Go to the documentation of this file.
2
13 if (!StatParameterProxy::ALLOWED.contains(type)) {
14 LOG_ERROR("ValueError", "BusinessLogic cannot access parameter type", ParameterTypeMapper::str(type));
15 }
16 this->pp_with_type = ParameterProvider(type);
17 this->pp = ParameterProvider();
18}
19
23std::shared_ptr<Parameter> StatParameterProxy::get_param(const ParamId& pid) const {
24 return pp.get_parameter(pid);
25}
26
30std::shared_ptr<Parameter> StatParameterProxy::get_param(const std::string& block, const LhaID& id) const {
31 return pp_with_type.get_parameter(ParamId(pp_with_type.get_type(), block, id));
32}
33
38 if (!pid.type.has_value()) {
39 LOG_WARN("LogicError", "Use of untyped ParamId in ParameterProvider.");
40 }
41
42 if (!StatParameterProxy::ALLOWED.contains(pid.type.value())) {
43 LOG_ERROR("ValueError", "BusinessLogic cannot access parameter type", ParameterTypeMapper::str(pid.type.value()));
44 }
45 if (pid.type == ParameterType::WILSON) {
46 return pp.exists(pid) ? pp(pid, d_type) : scalar_t();
47 }
48 return pp(pid, d_type);
49
50}
51
55std::map<ExperimentObs, double> StatParameterProxy::operator()(const ObservableId& id, DataType d_type) const {
56
57
58 std::unordered_set<std::string> blocks = BlockProvider().get_all_blocks(ParameterType::OBSERVABLE);
59 std::map<ExperimentObs, double> out;
60 for (auto block : blocks) {
61 ExperimentObs obs = {block.substr(5), id};
62 out[obs] = pp(ParamId(ParameterType::OBSERVABLE, block, ObservableMapper::flha(id)), d_type);
63 }
64 return out;
65 // return pp(PKCaramId(ParameterType::OBSERVABLE, "FOBS", ObservableMapper::flha(id)), d_type);
66}
67
71std::map<ExperimentObs, double> StatParameterProxy::operator()(const BinnedObservableId &id, DataType d_type) const {
72
73 std::unordered_set<std::string> blocks = BlockProvider().get_all_blocks(ParameterType::OBSERVABLE);
74
75 std::map<ExperimentObs, double> out;
76 for (auto block : blocks) {
77 ExperimentObs obs = {block.substr(5), id};
78 if (pp.exists(ParamId(ParameterType::OBSERVABLE, block, id.flha()))) {
79 out[obs] = pp(ParamId(ParameterType::OBSERVABLE, block, id.flha()), d_type);
80 }
81 }
82 return out;
83 // return pp(ParamId(ParameterType::OBSERVABLE, "FOBS", id.flha()), d_type);
84}
85
89scalar_t StatParameterProxy::operator()(const std::string& block, const LhaID& id, DataType d_type) const {
90 if (pp_with_type.get_type() == ParameterType::WILSON) {
91 return pp_with_type.exists(block, id) ? pp_with_type(block, id, d_type) : scalar_t();
92 }
93 scalar_t value = pp_with_type(block, id, d_type);
94 return value;
95}
96
100std::map<ExperimentObs, std::shared_ptr<Parameter>> StatParameterProxy::get_obs_param(const BinnedObservableId& id) const {
101
102 std::unordered_set<std::string> blocks = BlockProvider().get_all_blocks(ParameterType::OBSERVABLE);
103
104 std::map<ExperimentObs, std::shared_ptr<Parameter>> out;
105 for (auto block : blocks) {
106 ExperimentObs obs = {block.substr(5), id};
107 if (pp.exists(ParamId(ParameterType::OBSERVABLE, block, id.flha()))) {
108 out[obs] = pp.get_parameter(ParamId(ParameterType::OBSERVABLE, block, id.flha()));
109 }
110 // out.push_back(pp.get_parameter(ParamId(ParameterType::OBSERVABLE, block, id.flha())));
111 }
112 return out;
113 // return pp.get_parameter(ParamId(ParameterType::OBSERVABLE, "FOBS", id.flha()));
114}
ParameterType
DataType
#define LOG_ERROR(type,...)
Macro for logging error messages and terminating the application.
Definition Logger.h:41
#define LOG_WARN(...)
Macro for logging warning messages.
Definition Logger.h:40
Statistics-layer proxy for read-only access to parameters and observables.
Block provider bound to HyperISO Parameters / ParameterType.
std::unordered_set< std::string > get_all_blocks(ParameterType type) override
return all blocks for a given ParameterType.
static std::string str(const IdOf< ParamTypeTag > &id)
Returns the string representation associated with an identifier.
static LhaID flha(const Observables &id)
Return the FLHA id associated with a builtin enum value.
Provides access to parameter values, errors, and existence checks.
std::shared_ptr< Parameter > get_parameter(const ParamId &pid) const
Retrieves the actual Parameter object corresponding to the given ParamId.
ParameterType get_type() const
Retrieves the renormalization scale associated with a given block.
bool exists(const ParamId &pid) const
Checks if a parameter identified by ParamId exists.
scalar_t operator()(const ParamId &, DataType d_type=DataType::VALUE) const override
Returns a scalar quantity for a typed parameter.
StatParameterProxy(ParameterType type=ParameterType::SM)
Constructs a proxy optionally bound to a parameter type.
std::map< ExperimentObs, std::shared_ptr< Parameter > > get_obs_param(const BinnedObservableId &) const override
Returns the parameter object associated with a binned observable.
std::shared_ptr< Parameter > get_param(const ParamId &) const override
Returns the parameter object identified by a typed ParamId.
Identifies an observable together with a numerical bin.
Represents an identifier of a LHA element, possibly containing several sub-ids.
Definition LhaID.h:56
Composite identifier for a single parameter.
Definition ParamID.h:57
std::optional< ParameterType > type
Optional high-level parameter category.
Definition ParamID.h:65