Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
WilsonExtractor.cpp
Go to the documentation of this file.
1#include "WilsonExtractor.h"
2
3std::string wc_key(const std::string& coefName, QCDOrder o, ContributionType c) {
4 std::string k = "WC:";
5 k += coefName;
6 k += ":";
7 k += OrderMapper::str(o);
8 k += ":";
10 return k;
11}
12
13
14std::vector<std::string> WilsonCoeffExtractor::schema(const OutputSpec& /*spec*/) const {
15 std::vector<std::string> cols;
16 cols.reserve(coefs_.size() * 6);
17
18 std::vector<WCoefId> sorted(coefs_.begin(), coefs_.end());
19 std::sort(sorted.begin(), sorted.end(), [](WCoefId a, WCoefId b){
20 return WCoefMapper::str(a) < WCoefMapper::str(b);
21 });
22
23 for (auto coef : sorted) {
24 auto name = WCoefMapper::str(coef);
25 push_cols_for_coef(cols, name);
26 }
27 return cols;
28}
29
30void WilsonCoeffExtractor::extract(std::unordered_map<std::string, Value>& outY,
31 const OutputSpec& /*spec*/) const {
32 for (auto coef : coefs_) {
33 auto name = WCoefMapper::str(coef);
34 add_one(outY, coef, name, QCDOrder::LO, ContributionType::SM);
35 add_one(outY, coef, name, QCDOrder::LO, ContributionType::BSM);
36
37 if (wbc_.order > QCDOrder::LO) {
38 add_one(outY, coef, name, QCDOrder::NLO, ContributionType::SM);
39 add_one(outY, coef, name, QCDOrder::NLO, ContributionType::BSM);
40
41 if (wbc_.order > QCDOrder::NLO) {
42 add_one(outY, coef, name, QCDOrder::NNLO, ContributionType::SM);
43 add_one(outY, coef, name, QCDOrder::NNLO, ContributionType::BSM);
44 }
45 }
46 }
47}
48
49void WilsonCoeffExtractor::add_one(std::unordered_map<std::string, Value>& outY,
50 WCoefId coef,
51 const std::string& name,
52 QCDOrder ord,
53 ContributionType ct) const
54{
55 const WGroup grp = WCoefMapper::group_of(coef);
56 const WCoef en = WCoefMapper::enum_of(coef).value();
57 double val = wi_.getM(grp, en, ord, ct);
58 outY[wc_key(name, ord, ct)] = val;
59}
60
61void WilsonCoeffExtractor::push_cols_for_coef(std::vector<std::string>& cols,
62 const std::string& name) const
63{
64 cols.push_back(wc_key(name, QCDOrder::LO, ContributionType::SM));
65 cols.push_back(wc_key(name, QCDOrder::LO, ContributionType::BSM));
66 if (wbc_.order > QCDOrder::LO) {
67 cols.push_back(wc_key(name, QCDOrder::NLO, ContributionType::SM));
68 cols.push_back(wc_key(name, QCDOrder::NLO, ContributionType::BSM));
69 if (wbc_.order > QCDOrder::NLO) {
70 cols.push_back(wc_key(name, QCDOrder::NNLO, ContributionType::SM));
71 cols.push_back(wc_key(name, QCDOrder::NNLO, ContributionType::BSM));
72 }
73 }
74}
QCDOrder
ContributionType
WCoef
WGroup
std::string wc_key(const std::string &coefName, QCDOrder o, ContributionType c)
std::string wc_key(const std::string &coefName, QCDOrder o, ContributionType c)
static std::string str(const IdOf< QCDOrderTag > &id)
Returns the string representation associated with an identifier.
static std::optional< WCoef > enum_of(const IdOf< WCoefTag > &id)
Attempts to recover the enum value associated with an identifier.
static std::string str(const IdOf< WCoefTag > &id)
Returns the string representation of an identifier.
static WGroup group_of(WCoef c)
Returns the WGroup to which a given Wilson coefficient belongs.
void extract(std::unordered_map< std::string, Value > &outY, const OutputSpec &) const override
std::vector< std::string > schema(const OutputSpec &) const override
scalar_t getM(WGroupId group, WCoefId coeff, QCDOrder order, ContributionType cont_type)
Alias for getMatchingCoefficient(WGroupId,WCoefId,QCDOrder,ContributionType).
QCDOrder order
Perturbative QCD order used for the evolution and matching of Wilson coefficients....
Definition Configs.h:54