Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
WilsonHandler.cpp
Go to the documentation of this file.
1#include "WilsonHandler.h"
2
3#include <iostream>
4#include <unordered_set>
5#include <vector>
6
7#include "CliUtils.h"
8#include "WilsonInterface.h"
9#include "mapper_hub.hpp"
10
11namespace {
12
13void print_wilson_usage() {
14 std::cout
15 << "Usage:\n"
16 << " hyperiso-ui wilson summary [options]\n\n"
17 << "Options:\n"
18 << " --groups <csv> Wilson groups, default BCoefficients\n"
19 << " --coeffs <csv> Coefficients, default C7,C9,C10\n"
20 << " --qmatch <value> Matching scale, default 81\n"
21 << " --q <value> Running scale, default 4.8\n"
22 << " --order <order> LO, NLO or NNLO, default NNLO\n"
23 << " --model <model> SM, THDM, MSSM or MARTY, default SM\n"
24 << " --lha <path> Input LHA/SLHA/FLHA file\n"
25 << " --spectrum <bool> Treat the input as an already generated spectrum\n"
26 << " --contribution <type> SM, BSM or TOTAL, default TOTAL\n";
27}
28
29} // namespace
30
31int handleWilsonOptions(int argc, char* argv[]) {
32 CliOptions opts = CliOptions::parse(argc, argv, 1);
33 const std::string command = opts.positionals.empty() ? "summary" : opts.positionals[0];
34
35 if (opts.flag("help", false) || command == "help") {
36 print_wilson_usage();
37 return 0;
38 }
39 if (command != "summary") {
40 throw std::invalid_argument("Unknown wilson command: " + command);
41 }
42
43 auto hyp = init_hyperiso_from_cli(opts);
45
46 const auto group_names = opts.list("groups", {"BCoefficients"});
47 const auto coeff_names = opts.list("coeffs", {"C7", "C9", "C10"});
48 const double qmatch = opts.get_double("qmatch", 81.0);
49 const double q = opts.get_double("q", 4.8);
50 const QCDOrder order = parse_qcd_order(opts.get("order", "NNLO"));
51 const ContributionType contribution = parse_contribution(opts.get("contribution", "TOTAL"));
52
53 std::unordered_set<WGroupId> groups;
54 for (const auto& name : group_names) {
55 groups.insert(GroupMapper::id_of(name));
56 }
57
58 WilsonInterface wilson;
59 wilson.build(WilsonBuildConfig(groups, qmatch, q, order));
60
61 print_section("Wilson summary");
62 std::cout << "order=" << OrderMapper::str(order)
63 << ", qmatch=" << qmatch
64 << ", q=" << q << "\n";
65
66 for (const auto& group_name : group_names) {
67 WGroupId group = GroupMapper::id_of(group_name);
68 std::cout << "\nGroup: " << GroupMapper::str(group) << "\n";
69 for (const auto& coeff_name : coeff_names) {
70 WCoefId coeff = WCoefMapper::id_of(coeff_name);
71 const auto m = wilson.getFM(group, coeff, order, contribution);
72 const auto r = wilson.getFR(group, coeff, order, contribution);
73 std::cout << " " << WCoefMapper::str(coeff)
74 << " matching=" << m
75 << " running=" << r << "\n";
76 }
77 }
78
79 return 0;
80}
void print_section(const std::string &title)
Definition CliUtils.cpp:100
ContributionType parse_contribution(const std::string &contribution)
Definition CliUtils.cpp:122
HyperisoMaster init_hyperiso_from_cli(const CliOptions &opts)
Definition CliUtils.cpp:130
QCDOrder parse_qcd_order(const std::string &order)
Definition CliUtils.cpp:113
QCDOrder
ContributionType
int handleWilsonOptions(int argc, char *argv[])
static std::string str(const IdOf< QCDOrderTag > &id)
Returns the string representation associated with an identifier.
static IdOf< WGroupTag > 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.
static std::string str(const WGroupId &gid, ScaleType s, WilsonBasis b=WilsonBasis::B_STANDARD)
Builds a composite block name using a WGroupId, scale and basis.
Returns an uppercase copy of the input string.
User-facing API to build and query Wilson coefficients at matching and hadronic scales.
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).
void build(WilsonBuildConfig config)
Builds the full Wilson pipeline and makes queries available.
Non-templated façade over the project mapper families.
void init_all_builtins()
Initializes all builtin mapper registries and the decay graph.
Configuration for building sets of Wilson coefficients.
Definition Configs.h:32