Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
WilsonInterface.cpp
Go to the documentation of this file.
1#include "WilsonInterface.h"
2
3QCDOrder WilsonInterface::ensure_mty_compat(QCDOrder order) {
4 if (UseMarty().get() && !(order == QCDOrder::LO)) {
5 LOG_WARN("Using MARTY defaults all calculations to LO in QCD.");
6 return QCDOrder::LO;
7 }
8 return order;
9}
10
11
13 this->builder = std::make_shared<WilsonBuilder>(config);
14 this->provider = this->builder->get_wilson_provider();
15 built = true;
16
17 for (const auto& patch : pending_matching_patches) {
18 this->builder->add_matching_patch(patch);
19 }
20 pending_matching_patches.clear();
21}
22
24 if (!this->builder) {
25 LOG_ERROR("AccessError", "Please build the interface first before adding groups");
26 }
27 this->builder->add(config);
28}
29
30
32 if (!built) {
34 base.matching_scale = config.matching_scale;
35 base.hadronic_scale = config.hadronic_scale;
36 base.order = config.order;
37 build(base);
38 }
39
40 if (!this->builder) {
41 LOG_ERROR("LogicError", "WilsonInterface has no builder available for custom Wilson group registration.");
42 }
43
44 this->builder->add_custom_group(config);
45 this->provider = this->builder->get_wilson_provider();
46 built = true;
47 return *this;
48}
49
53
55 if (built && this->builder) {
56 this->builder->add_matching_patch(patch);
57 this->provider = this->builder->get_wilson_provider();
58 } else {
59 pending_matching_patches.push_back(patch);
60 }
61 return *this;
62}
63
67
68WilsonInterface& WilsonInterface::addMatchingPatches(const std::vector<WilsonMatchingPatch>& patches) {
69 for (const auto& patch : patches) {
70 addMatchingPatch(patch);
71 }
72 return *this;
73}
74
78
82
84 if (!built) {
85 LOG_ERROR("LogicError", "Interface has not been built");
86 }
87
88 WilsonRequest request {
89 group,
90 coeff,
91 order,
92 cont_type,
94 false // sum_qcd_orders
95 };
96 return this->provider->get(std::make_shared<WilsonRequest>(request));
97}
98
102
104 return getMatchingCoefficient(group, coeff, order, cont_type);
105}
106
108 return getMatchingCoefficient(group, coeff, order, cont_type);
109}
110
112 if (!built) {
113 LOG_ERROR("LogicError", "Interface has not been built");
114 }
115
116 WilsonRequest request {
117 group,
118 coeff,
119 order,
120 cont_type,
122 true // sum_qcd_orders
123 };
124 return this->provider->get(std::make_shared<WilsonRequest>(request));
125}
126
130
132 return getFullMatchingCoefficient(group, coeff, order, cont_type);
133}
134
136 return getFullMatchingCoefficient(group, coeff, order, cont_type);
137}
138
140 if (!built) {
141 LOG_ERROR("LogicError", "Interface has not been built");
142 }
143
144 WilsonRequest request {
145 group,
146 coeff,
147 order,
148 cont_type,
150 false // sum_qcd_orders
151 };
152 request.basis = basis;
153 return this->provider->get(std::make_shared<WilsonRequest>(request));
154}
155
157 return getRunCoefficient(GroupMapper::to_id(group), WCoefMapper::to_id(coeff), order, cont_type, basis);
158}
159
161 return getRunCoefficient(group, coeff, order, cont_type, basis);
162}
163
165 return getRunCoefficient(group, coeff, order, cont_type, basis);
166}
167
169 if (!built) {
170 LOG_ERROR("LogicError", "Interface has not been built");
171 }
172
173 WilsonRequest request {
174 group,
175 coeff,
176 order,
177 cont_type,
179 true // sum_qcd_orders
180 };
181 request.basis = basis;
182 return this->provider->get(std::make_shared<WilsonRequest>(request));
183}
184
186 return getFullRunCoefficient(GroupMapper::to_id(group), WCoefMapper::to_id(coeff), order, cont_type, basis);
187}
188
190 return getFullRunCoefficient(group, coeff, order, cont_type, basis);
191}
192
194 return getFullRunCoefficient(group, coeff, order, cont_type, basis);
195}
196
197std::map<QCDOrder, scalar_t> WilsonInterface::getSepOrderMatchingCoefficient(WGroupId group, WCoefId coeff, ContributionType cont_type) {
198 std::map<QCDOrder, scalar_t> C {{
199 {QCDOrder::LO, getMatchingCoefficient(group, coeff, QCDOrder::LO, cont_type)},
200 {QCDOrder::NLO, getMatchingCoefficient(group, coeff, QCDOrder::NLO, cont_type)},
201 {QCDOrder::NNLO, getMatchingCoefficient(group, coeff, QCDOrder::NNLO, cont_type)}
202 }};
203 return C;
204}
205
206std::map<QCDOrder, scalar_t> WilsonInterface::getSepOrderMatchingCoefficient(WGroup group, WCoef coeff, ContributionType cont_type) {
208}
209
210std::map<QCDOrder, scalar_t> WilsonInterface::getSM(WGroupId group, WCoefId coeff, ContributionType cont_type) {
211 return getSepOrderMatchingCoefficient(group, coeff, cont_type);
212}
213
214std::map<QCDOrder, scalar_t> WilsonInterface::getSM(WGroup group, WCoef coeff, ContributionType cont_type) {
215 return getSepOrderMatchingCoefficient(group, coeff, cont_type);
216}
217
218std::map<QCDOrder, scalar_t> WilsonInterface::getSepOrderRunCoefficient(WGroupId group, WCoefId coeff, ContributionType cont_type, WilsonBasis basis) {
219 std::map<QCDOrder, scalar_t> C {{
220 {QCDOrder::LO, getRunCoefficient(group, coeff, QCDOrder::LO, cont_type, basis)},
221 {QCDOrder::NLO, getRunCoefficient(group, coeff, QCDOrder::NLO, cont_type, basis)},
222 {QCDOrder::NNLO, getRunCoefficient(group, coeff, QCDOrder::NNLO, cont_type, basis)}
223 }};
224 return C;
225}
226
227std::map<QCDOrder, scalar_t> WilsonInterface::getSepOrderRunCoefficient(WGroup group, WCoef coeff, ContributionType cont_type, WilsonBasis basis) {
228 return getSepOrderRunCoefficient(GroupMapper::to_id(group), WCoefMapper::to_id(coeff), cont_type, basis);
229}
230
231std::map<QCDOrder, scalar_t> WilsonInterface::getSR(WGroupId group, WCoefId coeff, ContributionType cont_type, WilsonBasis basis) {
232 return getSepOrderRunCoefficient(group, coeff, cont_type, basis);
233}
234
235std::map<QCDOrder, scalar_t> WilsonInterface::getSR(WGroup group, WCoef coeff, ContributionType cont_type, WilsonBasis basis) {
236 return getSepOrderRunCoefficient(group, coeff, cont_type, basis);
237}
238
239std::map<WCoef, scalar_t> WilsonInterface::getAllMatchingCoefficients(WGroup group, QCDOrder order, ContributionType cont_type) {
240 std::vector<WCoef> ids = WCoefMapper::get_group(group);
241 std::map<WCoef, scalar_t> Cs;
242 for (auto c : ids) {
243 Cs.emplace(c, getMatchingCoefficient(group, c, order, cont_type));
244 }
245
246 return Cs;
247}
248
249std::map<WCoef, scalar_t> WilsonInterface::getAM(WGroup group, QCDOrder order, ContributionType cont_type) {
250 return getAllMatchingCoefficients(group, order, cont_type);
251}
252
253std::map<WCoef, scalar_t> WilsonInterface::getAllRunCoefficients(WGroup group, QCDOrder order, ContributionType cont_type, WilsonBasis basis) {
254 std::vector<WCoef> ids = WCoefMapper::get_group(group);
255 std::map<WCoef, scalar_t> Cs;
256 for (auto c : ids) {
257 Cs.emplace(c, getRunCoefficient(group, c, order, cont_type, basis));
258 }
259
260 return Cs;
261}
262
263std::map<WCoef, scalar_t> WilsonInterface::getAR(WGroup group, QCDOrder order, ContributionType cont_type, WilsonBasis basis) {
264 return getAllRunCoefficients(group, order, cont_type, basis);
265}
266
267std::map<WCoef, scalar_t> WilsonInterface::getAllFullMatchingCoefficients(WGroup group, QCDOrder order, ContributionType cont_type) {
268 std::vector<WCoef> ids = WCoefMapper::get_group(group);
269 std::map<WCoef, scalar_t> Cs;
270 for (auto c : ids) {
271 Cs.emplace(c, getFullMatchingCoefficient(group, c, order, cont_type));
272 }
273
274 return Cs;
275}
276
277std::map<WCoef, scalar_t> WilsonInterface::getAFM(WGroup group, QCDOrder order, ContributionType cont_type) {
278 return getAllFullMatchingCoefficients(group, order, cont_type);
279}
280
281std::map<WCoef, scalar_t> WilsonInterface::getAllFullRunCoefficients(WGroup group, QCDOrder order, ContributionType cont_type, WilsonBasis basis) {
282 std::vector<WCoef> ids = WCoefMapper::get_group(group);
283 std::map<WCoef, scalar_t> Cs;
284 for (auto c : ids) {
285 Cs.emplace(c, getFullRunCoefficient(group, c, order, cont_type, basis));
286 }
287
288 return Cs;
289}
290
291std::map<WCoef, scalar_t> WilsonInterface::getAFR(WGroup group, QCDOrder order, ContributionType cont_type, WilsonBasis basis) {
292 return getAllFullRunCoefficients(group, order, cont_type, basis);
293}
QCDOrder
WilsonBasis
ContributionType
WCoef
WGroup
#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
Sets Wilson scale values through the Parameters mutation layer.
Definition ScaleSetter.h:39
void set(double value) override
Sets the value of the currently selected scale.
Returns an uppercase copy of the input string.
Core API returning whether MARTY is used as backend.
Definition UseMarty.h:24
static std::vector< WCoef > get_group(WGroup g)
Returns the list of Wilson coefficients belonging to a WGroup.
User-facing API to build and query Wilson coefficients at matching and hadronic scales.
WilsonInterface & addMatchingPatches(const std::vector< WilsonMatchingPatch > &patches)
Add several additive Wilson matching patches.
std::map< QCDOrder, scalar_t > getSepOrderMatchingCoefficient(WGroupId group, WCoefId coeff, ContributionType cont_type)
Returns a map {LO,NLO,NNLO} -> matching coefficient for a dynamic coefficient.
void addWilsonGroup(WilsonBuildConfig config)
Adds one or more Wilson groups to an existing built interface.
std::map< WCoef, scalar_t > getAllRunCoefficients(WGroup group, QCDOrder order, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD)
Returns {coef -> hadronic coefficient} for all coefficients in the group at a given order and basis.
scalar_t getRunCoefficient(WGroupId group, WCoefId coeff, QCDOrder order, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD)
Returns the hadronic/run coefficient at the requested order.
scalar_t getMatchingCoefficient(WGroupId group, WCoefId coeff, QCDOrder order, ContributionType cont_type)
Returns the matching-scale coefficient at the requested QCD order.
void set_matching_scale(double mu_W)
Sets the matching scale (mu_W) in the global parameter system.
std::map< QCDOrder, scalar_t > getSR(WGroupId group, WCoefId coeff, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD)
Alias for getSepOrderRunCoefficient(WGroupId,WCoefId,ContributionType,WilsonBasis).
WilsonInterface & add_matching_patch(const WilsonMatchingPatch &patch)
Snake-case alias for addMatchingPatch.
scalar_t getFullMatchingCoefficient(WGroupId group, WCoefId coeff, QCDOrder order, ContributionType cont_type)
Returns the matching coefficient with perturbative summation up to order.
std::map< WCoef, scalar_t > getAllFullRunCoefficients(WGroup group, QCDOrder order, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD)
Returns {coef -> full hadronic coefficient} (summed up to order) for all coefficients in the group.
std::map< WCoef, scalar_t > getAR(WGroup group, QCDOrder order, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD)
Alias for getAllRunCoefficients.
std::map< WCoef, scalar_t > getAllMatchingCoefficients(WGroup group, QCDOrder order, ContributionType cont_type)
Returns {coef -> matching coefficient} for all coefficients in the group at a given order.
scalar_t getM(WGroupId group, WCoefId coeff, QCDOrder order, ContributionType cont_type)
Alias for getMatchingCoefficient(WGroupId,WCoefId,QCDOrder,ContributionType).
void set_hadronic_scale(double mu_h)
Sets the hadronic scale (mu_h) in the global parameter system.
scalar_t getFullRunCoefficient(WGroupId group, WCoefId coeff, QCDOrder order, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD)
Returns the full hadronic/run coefficient summed up to order.
std::map< WCoef, scalar_t > getAM(WGroup group, QCDOrder order, ContributionType cont_type)
Alias for getAllMatchingCoefficients.
std::map< QCDOrder, scalar_t > getSM(WGroupId group, WCoefId coeff, ContributionType cont_type)
Alias for getSepOrderMatchingCoefficient(WGroupId,WCoefId,ContributionType).
WilsonInterface & addMatchingPatch(const WilsonMatchingPatch &patch)
Add an additive Wilson matching patch.
std::map< WCoef, scalar_t > getAllFullMatchingCoefficients(WGroup group, QCDOrder order, ContributionType cont_type)
Returns {coef -> full matching coefficient} (summed up to order) for all coefficients in the group.
std::map< QCDOrder, scalar_t > getSepOrderRunCoefficient(WGroupId group, WCoefId coeff, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD)
Returns a map {LO,NLO,NNLO} -> hadronic coefficient for a dynamic coefficient.
WilsonInterface & addCustomWilsonGroup(const CustomWilsonGroupConfig &config)
Register and initialize a runtime Wilson group described by lambdas.
scalar_t getFM(WGroupId group, WCoefId coeff, QCDOrder order, ContributionType cont_type)
Alias for getFullMatchingCoefficient(WGroupId,WCoefId,QCDOrder,ContributionType).
scalar_t getFR(WGroupId group, WCoefId coeff, QCDOrder order, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD)
Alias for getFullRunCoefficient(WGroupId,WCoefId,QCDOrder,ContributionType,WilsonBasis).
std::map< WCoef, scalar_t > getAFR(WGroup group, QCDOrder order, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD)
Alias for getAllFullRunCoefficients.
std::map< WCoef, scalar_t > getAFM(WGroup group, QCDOrder order, ContributionType cont_type)
Alias for getAllFullMatchingCoefficients.
scalar_t getR(WGroupId group, WCoefId coeff, QCDOrder order, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD)
Alias for getRunCoefficient(WGroupId,WCoefId,QCDOrder,ContributionType,WilsonBasis).
void build(WilsonBuildConfig config)
Builds the full Wilson pipeline and makes queries available.
WilsonInterface & add_custom_group(const CustomWilsonGroupConfig &config)
Snake-case alias for addCustomWilsonGroup.
const GroupDefinition & get(WGroupId g)
Returns the definition for a given group id.
Configuration of a user-defined Wilson group built from lambdas.
double hadronic_scale
Hadronic/running scale used when the group is added to the manager.
QCDOrder order
Highest QCD order to initialize.
double matching_scale
Matching scale used when the group is added to the manager.
Configuration for building sets of Wilson coefficients.
Definition Configs.h:32
double hadronic_scale
Hadronic scale (in GeV) at which the Wilson coefficients are evaluated in the effective theory.
Definition Configs.h:48
QCDOrder order
Perturbative QCD order used for the evolution and matching of Wilson coefficients....
Definition Configs.h:54
double matching_scale
Matching scale (in GeV) at which the high-energy theory is matched to the effective theory.
Definition Configs.h:42
Dynamic configuration for requesting a specific Wilson coefficient.
Definition Configs.h:122