Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
CustomWilsonGroup.h
Go to the documentation of this file.
1#ifndef CUSTOM_WILSON_GROUP_H
2#define CUSTOM_WILSON_GROUP_H
3
4#include <functional>
5#include <memory>
6#include <string>
7#include <unordered_map>
8#include <vector>
9#include <utility>
10
11#include "WilsonGroup.h"
12
43public:
52 explicit CustomCoefficientGroup(WilsonGroupAdapterConfig adapters, WGroupId gid, const std::string& name,
55 this->id = gid;
56 this->name_grp = name;
57 this->wilson_type = type;
58 }
59
65 std::shared_ptr<CoefficientGroup> clone() const override {
66 return std::make_shared<CustomCoefficientGroup>(*this);
67 }
68
77 CustomCoefficientGroup& add_coefficient(const std::shared_ptr<WilsonCoefficient>& coef) {
78 this->insert({coef->get_name(), coef});
79 this->add_member_id(WCoefMapper::id_of(coef->get_base_name()));
80 return *this;
81 }
82
95 CustomCoefficientGroup& add_coefficient(WCoefId id, const std::shared_ptr<WilsonCoefficient>& coef) {
96 this->insert({WCoefMapper::str(id), coef});
97 this->add_member_id(std::move(id));
98 return *this;
99 }
100
113 WilsonBasis basis,
114 QCDOrder order,
115 std::unordered_map<ParameterType, std::vector<std::string>> source_names,
116 std::function<std::unordered_map<WCoefId, scalar_t>(
117 const std::unordered_map<QCDOrder, std::unordered_map<WCoefId, scalar_t>>&,
118 const BlockSrc&
119 )> running_func
120 ) {
121 sources[basis][order].sources = std::move(source_names);
122 sources[basis][order].func = std::move(running_func);
123 if (order > current_order) current_order = order;
124 return *this;
125 }
126
136 static std::unordered_map<WCoefId, scalar_t> identity_running(
137 const std::unordered_map<QCDOrder, std::unordered_map<WCoefId, scalar_t>>& coef_matching,
138 const BlockSrc& /*src*/
139 ) {
140 QCDOrder best = QCDOrder::LO;
141 if (coef_matching.count(QCDOrder::NNLO)) best = QCDOrder::NNLO;
142 else if (coef_matching.count(QCDOrder::NLO)) best = QCDOrder::NLO;
143
144 return coef_matching.at(best);
145 }
146
158 this->init(order);
159 return *this;
160 }
161
163 std::string name_grp;
164};
165
166#endif // CUSTOM_WILSON_GROUP_H
QCDOrder
WilsonBasis
ParameterType
ContributionType
Domain container grouping related Wilson coefficients with matching and running access.
Lightweight view over a set of source blocks.
Definition SourcesView.h:71
Polymorphic container of WilsonCoefficient objects representing a coefficient group.
void init(QCDOrder order)
Registers dependent parameters for matching coefficients up to a maximum order.
WilsonGroupAdapterConfig adapters
Adapter configuration bundle (proxies, composers, core APIs, MARTY hooks).
void add_member_id(WCoefId id)
Add one dynamic coefficient id to the membership list if absent.
ContributionType wilson_type
Contribution type for this group (default SM).
std::map< WilsonBasis, std::map< QCDOrder, CoefficientGroupSources > > sources
Running-block source specification, keyed by (basis -> order).
QCDOrder current_order
Max initialized order (default LO).
Concrete CoefficientGroup built manually by the user.
CustomCoefficientGroup & set_basis_order_sources_and_running(WilsonBasis basis, QCDOrder order, std::unordered_map< ParameterType, std::vector< std::string > > source_names, std::function< std::unordered_map< WCoefId, scalar_t >(const std::unordered_map< QCDOrder, std::unordered_map< WCoefId, scalar_t > > &, const BlockSrc &)> running_func)
Defines dependency sources and running function for a basis and order.
std::string name_grp
Human-readable group name.
CustomCoefficientGroup(WilsonGroupAdapterConfig adapters, WGroupId gid, const std::string &name, ContributionType type=ContributionType::SM)
Constructs a custom coefficient group.
CustomCoefficientGroup & add_coefficient(const std::shared_ptr< WilsonCoefficient > &coef)
Adds a coefficient to the group (fluent API).
static std::unordered_map< WCoefId, scalar_t > identity_running(const std::unordered_map< QCDOrder, std::unordered_map< WCoefId, scalar_t > > &coef_matching, const BlockSrc &)
Default running function that returns the "best available" matching map.
CustomCoefficientGroup & add_coefficient(WCoefId id, const std::shared_ptr< WilsonCoefficient > &coef)
Adds a coefficient with an explicit dynamic id.
std::shared_ptr< CoefficientGroup > clone() const override
Polymorphic clone.
CustomCoefficientGroup & finalize(QCDOrder order)
Finalizes the group by composing dependent parameters up to order.
static IdOf< WCoefTag > id_of(std::string_view s)
Resolves a string into an IdOf<Tag> via the registry.
static std::string str(const IdOf< WCoefTag > &id)
Returns the string representation of an identifier.
Returns an uppercase copy of the input string.
Dependency injection bundle for CoefficientGroup.