Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
speeeed.cpp
Go to the documentation of this file.
2#include "HyperisoMaster.h"
3#include "ParameterSetter.h"
4
5#include <chrono>
6#include <fstream>
7#include <iomanip>
8#include <iostream>
9#include <optional>
10#include <sstream>
11#include <string>
12#include <vector>
13
14struct CsvRow {
15 int step;
16 double mu_b;
17 std::string observable;
18 std::optional<double> q2_min;
19 std::optional<double> q2_max;
20 double value;
21};
22
23int main() {
25 HyperisoConfig config;
26 config.model = Model::SM;
27 hyp.init("lha/si_input.flha", config);
28
32
41
50
59
68
69 std::vector<CsvRow> rows;
70 rows.reserve(16 * 32);
71
72 auto start = std::chrono::steady_clock::now();
73 int step = 0;
74
75 for (double mu_b = 1.0; mu_b < 5.0; mu_b += 0.05) {
76 ++step;
77 ps.mutate({ParameterType::WILSON, "B_SCALE", 1}, mu_b);
78 const auto results = oi.compute_all();
79
80 for (const auto& group : results) {
81 const std::string obs_name = group.first.str();
82 for (const auto& val : group.second) {
83 CsvRow row;
84 row.step = step;
85 row.mu_b = mu_b;
86 row.observable = obs_name;
87 if (val.bin.has_value()) {
88 row.q2_min = val.bin->first;
89 row.q2_max = val.bin->second;
90 }
91 row.value = val.value;
92 rows.push_back(std::move(row));
93 }
94 }
95 }
96
97 auto stop = std::chrono::steady_clock::now();
98 const auto us = std::chrono::duration_cast<std::chrono::microseconds>(stop - start).count();
99
100 std::ofstream csv("hyperiso_bkstarll_scan.csv");
101 csv << "step,mu_b,observable,q2_min,q2_max,value\n";
102 csv << std::setprecision(17);
103 for (const auto& row : rows) {
104 csv << row.step << ','
105 << row.mu_b << ','
106 << row.observable << ',';
107 if (row.q2_min.has_value()) {
108 csv << *row.q2_min << ',' << *row.q2_max;
109 } else {
110 csv << ',';
111 }
112 csv << ',' << row.value << '\n';
113 }
114 csv.close();
115
116 std::cout << "Temps calcul seul : " << us * 1e-6 << " s\n";
117 std::cout << "num of steps : " << step << '\n';
118 std::cout << "CSV : hyperiso_bkstarll_scan.csv\n";
119 return 0;
120}
@ P_2_B0__KSTAR0_MU_MU
@ P_PRIME_8_B0__KSTAR0_MU_MU
@ A_T_2_B0__KSTAR0_MU_MU
@ P_PRIME_5_B0__KSTAR0_MU_MU
@ F_L_B0__KSTAR0_MU_MU
@ P_3_B0__KSTAR0_MU_MU
@ P_PRIME_4_B0__KSTAR0_MU_MU
@ P_PRIME_6_B0__KSTAR0_MU_MU
QCDOrder
High-level helpers for initializing and monitoring the Hyperiso framework.
High-level, user-facing entry point to compute flavor observables.
static IdOf< ObservableTag > to_id(Observables e)
Converts an enum value to an IdOf<Tag>.
High-level interface to initialize and monitor the main framework configuration.
void init(const std::string &lhaFile, HyperisoConfig config)
Initializes Hyperiso using a LHA file and a full Config object.
std::map< ObservableId, std::vector< ObservableValue > > compute_all()
Compute all currently registered observables.
ObservableInterface & add_observable(Observables obs, QCDOrder order, bool add_dependencies=false)
Add an observable to the manager (enum API).
Concrete mutator that directly sets the value of parameters.
void mutate(const ParamId &pid, scalar_t value) override
Sets the value of a parameter.
int main()
Definition speeeed.cpp:23
Identifies an observable together with a numerical bin.
double mu_b
Definition speeeed.cpp:16
int step
Definition speeeed.cpp:15
std::string observable
Definition speeeed.cpp:17
std::optional< double > q2_max
Definition speeeed.cpp:19
std::optional< double > q2_min
Definition speeeed.cpp:18
double value
Definition speeeed.cpp:20
Configuration object controlling model, input flags and optional MARTY resources.
Definition Config.h:24
Model model
Current model.
Definition Config.h:33