21 out.err_up = std::abs(gs.
sigma);
26 out.err_down = std::abs(gs.
sigma_m);
27 out.err_up = std::abs(gs.
sigma_p);
30 if (out.err_down == 0.0 && out.err_up == 0.0 && gs.
sigma != 0.0) {
31 out.err_down = std::abs(gs.
sigma);
32 out.err_up = std::abs(gs.
sigma);
35 out.err_sym = gs.
sigma;
40static void write_observables_to_csv(
41 const std::string& filename,
42 const std::vector<ObservableValue>& obs_val,
43 const std::vector<ObservableUncertainty>& uncertainties
45 if (obs_val.size() != uncertainties.size()) {
46 throw std::runtime_error(
"obs_val et uncertainties n'ont pas la même taille");
49 std::ofstream out(filename);
51 throw std::runtime_error(
"Impossible d'ouvrir le fichier CSV: " + filename);
54 out <<
"bin_low,bin_high,value,err_down,err_up,err_sym\n";
55 out << std::setprecision(17);
57 for (std::size_t i = 0; i < obs_val.size(); ++i) {
58 const auto& obs = obs_val[i];
59 const auto& unc = uncertainties[i];
61 if (!obs.bin.has_value()) {
65 out << obs.bin->first <<
","
66 << obs.bin->second <<
","
68 << unc.err_down <<
","
70 << unc.err_sym <<
"\n";
79 hyp.
init(
"lha/si_input.flha", config);
82 std::shared_ptr<ObservableInterface> oi = std::make_shared<ObservableInterface>();
92 std::vector<double> squares;
94 for (
double x = 0.05; x<8.1; x+=0.01) {
97 for (
double x = 15; x<20; x+=0.01) {
100 for (
auto elem : squares) {
112 std::vector<ObservableUncertainty> uncertainties;
113 uncertainties.reserve(obs_val.size());
115 for (
const auto& obs : obs_val) {
116 if (!obs.bin.has_value()) {
117 uncertainties.push_back({0.0, 0.0});
123 auto it = unc_map.find(key);
125 <<
"OBS [" << obs.bin->first <<
", " << obs.bin->second <<
"] "
126 <<
" value=" << obs.value
127 <<
" | GS.id=[" << it->second.id.p.first <<
", " << it->second.id.p.second <<
"]"
128 <<
" mu=" << it->second.mu
129 <<
" sigma=" << it->second.sigma
130 <<
" sigma_m=" << it->second.sigma_m
131 <<
" sigma_p=" << it->second.sigma_p
132 <<
" skew=" << it->second.skew
133 <<
" symmetric=" << it->second.symmetric
135 if (it == unc_map.end()) {
136 std::cerr <<
"Warning: uncertainty not found for bin ["
137 << obs.bin->first <<
", " << obs.bin->second <<
"]\n";
140 uncertainties.push_back({0.0, 0.0});
144 uncertainties.push_back(uncertainty_from_summary(it->second));
147 write_observables_to_csv(
"K__pi_nu_nu.csv", obs_val, uncertainties);
149 std::cout <<
"CSV écrit dans K__pi_nu_nu.csv\n";
Facade combining block existence/logging (BlockProvider) and block listing (APIAdapter).
High-level helpers for initializing and monitoring the Hyperiso framework.
High-level, user-facing entry point to compute flavor observables.
High-level facade for statistical computations.
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.
void setLevel(LogLevel level)
Sets the logging level.
static Logger * getInstance()
Retrieves the singleton instance of the Logger.
std::map< BinnedObservableId, GaussianSummary > compute_uncertainties()
Computes Gaussian uncertainty summaries for all active observables.
Identifies an observable together with a numerical bin.
double sigma_m
Left-side standard deviation for an asymmetric approximation.
bool symmetric
True when the distribution is treated as sufficiently symmetric.
double sigma_p
Right-side standard deviation for an asymmetric approximation.
double sigma
Symmetric population standard deviation.
Configuration object controlling model, input flags and optional MARTY resources.
Model model
Current model.
std::size_t MC_draws
Number of accepted MC draws used for uncertainty propagation.