Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
ObservableInterface.h
Go to the documentation of this file.
1#ifndef OBSERVABLE_INTERFACE_H
2#define OBSERVABLE_INTERFACE_H
3
4#include <map>
5#include <memory>
6#include <vector>
7#include <string>
8#include <exception>
9#include <iostream>
10#include <cmath>
11#include <utility>
12
13#include "Include.h"
14#include "Decays.h"
15#include "ObsManager.h"
16#include "ObsUseMarty.h"
17#include "WilsonFreezer.h"
18#include "LambdaDecay.h"
19#include "WilsonMatchingPatch.h"
20
73private:
75 std::shared_ptr<ObsManager> manager;
76
78 std::shared_ptr<ObservablePortsConfig> ports;
79
80public:
105
121 void add_custom_decay(DecayId id, std::shared_ptr<DecayParent> ptr);
122
146
151
154
168 ObservableInterface& add_observable(Observables obs, QCDOrder order, bool add_dependencies=false);
169
179 ObservableInterface& add_observable(ObservableId obs, QCDOrder order, bool add_dependencies=false);
180
190 ObservableInterface& add_observable(BinnedObservableId obs, QCDOrder order, bool add_dependencies=false);
191
198 void add_observables(std::map<Observables, QCDOrder> obss, bool add_dependencies=false);
199
206 void add_observables(std::map<ObservableId, QCDOrder> obss, bool add_dependencies=false);
207
216 void add_observables(Decays decay, QCDOrder order, bool add_dependencies=false,
217 std::pair<double, double> bin={1.0, 6.0});
218
227 void add_observables(DecayId decay, QCDOrder order, bool add_dependencies=false,
228 std::pair<double, double> bin={1.0, 6.0});
229
233 bool is_decay_binned(Decays decay) const;
234
238 bool is_decay_binned(DecayId decay) const;
239
243 bool is_observable_binned(Observables obs) const;
244
248 bool is_observable_binned(ObservableId obs) const;
249
263
271
278 void add_observable_parameters(Observables obs, std::unordered_set<ParamId> pids);
279
286 void add_observable_parameters(ObservableId obs, std::unordered_set<ParamId> pids);
287
307 std::vector<ObservableValue> compute_observable(Observables obs) const;
308
314 std::vector<ObservableValue> compute_observable(ObservableId obs) const;
315
322
328
334
339 void remove_observables(std::unordered_set<Observables> ids);
340
345 void remove_observables(Decays dec);
346
358
365
372
379
388
396
404
412
417 std::vector<BinnedObservableId> get_current_observables();
418
425 std::shared_ptr<ObservableInterface> clone_for_worker() const;
426
431
435 void set_all_decay_threads(size_t n_threads);
436
440 void restore_decay_threads(const DecayThreadSnapshot& snapshot);
441
448 std::map<ObservableId, std::vector<ObservableValue>> compute_all();
449
465 void set_param(const std::string& block, LhaID code, double value, ParameterType type);
466
475 double get_param(const std::string& block, LhaID code, ParameterType type);
476
483 std::unordered_set<ParamId> get_all_ops_deps(ObservableId id);
484
491 std::unordered_set<ParamId> get_all_ops_deps(Observables id);
492
502 void reload_params();
503
512 void enable_obs();
513
526 void set_decay_config(Decays dec, std::any config);
527
537 void set_decay_threads(Decays dec, size_t n_threads);
538
546 void set_bkstarll_threads(size_t n_threads);
547
555 void set_bkll_threads(size_t n_threads);
556
564 void set_bsphi_threads(size_t n_threads);
565
571 void set_lblll_threads(size_t n_threads);
572
583};
584
585#endif
Observables
Definition GeneralEnum.h:4
QCDOrder
ParameterType
Decays
UncertaintyType
High-level manager for observable evaluation.
std::unordered_map< DecayId, size_t > DecayThreadSnapshot
Definition ObsManager.h:79
Observable-layer API exposing whether MARTY backend is active.
Concrete freezer for Wilson coefficient blocks (matching + hadronic).
Small extension point for additive Wilson matching terms.
void add_observables(std::map< Observables, QCDOrder > obss, bool add_dependencies=false)
Add multiple observables at once (enum map).
std::vector< BinnedObservableId > get_current_observables()
Return the set of currently registered observables.
void set_bkstarll_threads(size_t n_threads)
Set the thread option for the bkstarll decay.
ObservableInterface()
Construct a ready-to-use observable interface.
bool is_observable_binned(Observables obs) const
Return whether a specific observable requires q² bins.
void add_observable_parameter(Observables obs, ParamId pid)
Manually add a single parameter dependence to an observable (enum API).
void set_all_decay_threads(size_t n_threads)
Set every thread-configurable decay to the same value.
std::shared_ptr< ObservableInterface > clone_for_worker() const
Build a fresh ObservableInterface with the same selected builtin observables.
void set_bkll_threads(size_t n_threads)
Set the thread option for the bkll decay.
double get_param(const std::string &block, LhaID code, ParameterType type)
Read an input parameter in a given parameter space.
DecayThreadSnapshot snapshot_decay_threads() const
Snapshot thread settings for thread-configurable decays.
void set_param(const std::string &block, LhaID code, double value, ParameterType type)
Set an input parameter in a given parameter space.
scalar_t get_exp_uncertainty(Observables id, UncertaintyType u_type=UncertaintyType::COMBINED)
Get experimental uncertainty for an observable (enum API).
void remove_observable(Observables id)
Remove an observable from the manager (enum API).
void set_decay_config(Decays dec, std::any config)
Set configuration for a given decay.
void set_decay_threads(Decays dec, size_t n_threads)
Set the thread option for any decay that supports it.
void add_custom_decay(DecayId id, std::shared_ptr< DecayParent > ptr)
Register a custom decay implementation.
std::vector< ObservableValue > compute_observable(Observables obs) const
Compute a theory prediction for an observable (enum API).
void enable_obs()
Force enabling/re-enabling currently registered observables.
void restore_decay_threads(const DecayThreadSnapshot &snapshot)
Restore a previous decay-thread snapshot.
std::map< ObservableId, std::vector< ObservableValue > > compute_all()
Compute all currently registered observables.
ObservablePortsConfig & get_ports()
Access the underlying ports configuration (advanced use).
ObservableInterface & add_observable(Observables obs, QCDOrder order, bool add_dependencies=false)
Add an observable to the manager (enum API).
ObservableInterface & addMatchingPatch(const WilsonMatchingPatch &patch)
Camel-case alias for add_matching_patch.
ObservableInterface & add_lambda_decay(LambdaDecayConfig config, bool add_observables=true)
Register a complete custom decay backed by user lambdas.
void add_observable_parameters(Observables obs, std::unordered_set< ParamId > pids)
Manually add multiple parameter dependences to an observable (enum API).
void set_bsphi_threads(size_t n_threads)
Set the thread option for the bsphi decay.
ObservableInterface & add_matching_patch(const WilsonMatchingPatch &patch)
Add an additive Wilson matching patch through the observable layer.
bool is_decay_binned(Decays decay) const
Return whether this decay has at least one observable requiring q² bins.
std::unordered_set< ParamId > get_all_ops_deps(ObservableId id)
Retrieve the full allow-list of parameter dependences for an observable (id API).
void set_lblll_threads(size_t n_threads)
Set the thread option for the Lambda_b -> Lambda l+ l- decay.
void reload_params()
Reload cached parameters for all registered decays.
scalar_t get_exp_value(Observables id)
Get experimental central value for an observable (enum API).
void remove_observables(std::unordered_set< Observables > ids)
Remove several observables (enum set).
Identifies an observable together with a numerical bin.
Full runtime definition of a custom decay and its observables.
Represents an identifier of a LHA element, possibly containing several sub-ids.
Definition LhaID.h:56
Dependency container (“ports”) for observable computations.
Container for a computed observable value, optionally binned.
Composite identifier for a single parameter.
Definition ParamID.h:57