|
Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
|
#include <ObservableInterface.h>
Public Member Functions | |
| ObservableInterface () | |
| Construct a ready-to-use observable interface. | |
| void | add_custom_decay (DecayId id, std::shared_ptr< DecayParent > ptr) |
| Register a custom decay implementation. | |
| ObservableInterface & | add_lambda_decay (LambdaDecayConfig config, bool add_observables=true) |
| Register a complete custom decay backed by user lambdas. | |
| ObservableInterface & | add_matching_patch (const WilsonMatchingPatch &patch) |
| Add an additive Wilson matching patch through the observable layer. | |
| ObservableInterface & | addMatchingPatch (const WilsonMatchingPatch &patch) |
| Camel-case alias for add_matching_patch. | |
| ObservableInterface & | add_observable (Observables obs, QCDOrder order, bool add_dependencies=false) |
| Add an observable to the manager (enum API). | |
| ObservableInterface & | add_observable (ObservableId obs, QCDOrder order, bool add_dependencies=false) |
| Add an observable to the manager (internal id API). | |
| ObservableInterface & | add_observable (BinnedObservableId obs, QCDOrder order, bool add_dependencies=false) |
| Add a binned observable to the manager (internal id API). | |
| void | add_observables (std::map< Observables, QCDOrder > obss, bool add_dependencies=false) |
| Add multiple observables at once (enum map). | |
| void | add_observables (std::map< ObservableId, QCDOrder > obss, bool add_dependencies=false) |
| Add multiple observables at once (internal id map). | |
| void | add_observables (Decays decay, QCDOrder order, bool add_dependencies=false, std::pair< double, double > bin={1.0, 6.0}) |
| Add all observables belonging to a decay. | |
| void | add_observables (DecayId decay, QCDOrder order, bool add_dependencies=false, std::pair< double, double > bin={1.0, 6.0}) |
| Add all observables belonging to a decay. | |
| bool | is_decay_binned (Decays decay) const |
| Return whether this decay has at least one observable requiring q² bins. | |
| bool | is_decay_binned (DecayId decay) const |
| Return whether this decay has at least one observable requiring q² bins. | |
| bool | is_observable_binned (Observables obs) const |
| Return whether a specific observable requires q² bins. | |
| bool | is_observable_binned (ObservableId 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 | add_observable_parameter (ObservableId obs, ParamId pid) |
| Manually add a single parameter dependence to an observable (id API). | |
| void | add_observable_parameters (Observables obs, std::unordered_set< ParamId > pids) |
| Manually add multiple parameter dependences to an observable (enum API). | |
| void | add_observable_parameters (ObservableId obs, std::unordered_set< ParamId > pids) |
| Manually add multiple parameter dependences to an observable (id API). | |
| std::vector< ObservableValue > | compute_observable (Observables obs) const |
| Compute a theory prediction for an observable (enum API). | |
| std::vector< ObservableValue > | compute_observable (ObservableId obs) const |
| Compute a theory prediction for an observable (id API). | |
| ObservableValue | compute_observable (BinnedObservableId obs) const |
| Compute a theory prediction for an observable (id API). | |
| void | remove_observable (Observables id) |
| Remove an observable from the manager (enum API). | |
| void | remove_observable (ObservableId id) |
| Remove an observable from the manager (id API). | |
| void | remove_observables (std::unordered_set< Observables > ids) |
| Remove several observables (enum set). | |
| void | remove_observables (Decays dec) |
| Remove all observables attached to a given decay. | |
| scalar_t | get_exp_value (Observables id) |
| Get experimental central value for an observable (enum API). | |
| scalar_t | get_exp_value (ObservableId id) |
| Get experimental central value for an observable (id API). | |
| scalar_t | get_exp_value (BinnedObservableId id) |
| Get experimental central value for an observable (id API). | |
| scalar_t | get_exp_value (ExperimentObs id) |
| Get experimental central value for an observable (id API). | |
| scalar_t | get_exp_uncertainty (Observables id, UncertaintyType u_type=UncertaintyType::COMBINED) |
| Get experimental uncertainty for an observable (enum API). | |
| scalar_t | get_exp_uncertainty (ObservableId id, UncertaintyType u_type=UncertaintyType::COMBINED) |
| Get experimental uncertainty for an observable (id API). | |
| scalar_t | get_exp_uncertainty (BinnedObservableId id, UncertaintyType u_type=UncertaintyType::COMBINED) |
| Get experimental uncertainty for an observable (id API). | |
| scalar_t | get_exp_uncertainty (ExperimentObs id, UncertaintyType u_type=UncertaintyType::COMBINED) |
| Get experimental uncertainty for an observable (id API). | |
| std::vector< BinnedObservableId > | get_current_observables () |
| Return the set of currently registered observables. | |
| std::shared_ptr< ObservableInterface > | clone_for_worker () const |
| Build a fresh ObservableInterface with the same selected builtin observables. | |
| DecayThreadSnapshot | snapshot_decay_threads () const |
| Snapshot thread settings for thread-configurable decays. | |
| void | set_all_decay_threads (size_t n_threads) |
| Set every thread-configurable decay to the same value. | |
| 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. | |
| void | set_param (const std::string &block, LhaID code, double value, ParameterType type) |
| Set an input parameter in a given parameter space. | |
| double | get_param (const std::string &block, LhaID code, ParameterType type) |
| Read an input parameter in a given parameter space. | |
| std::unordered_set< ParamId > | get_all_ops_deps (ObservableId id) |
| Retrieve the full allow-list of parameter dependences for an observable (id API). | |
| std::unordered_set< ParamId > | get_all_ops_deps (Observables id) |
| Retrieve the full allow-list of parameter dependences for an observable (enum API). | |
| void | reload_params () |
| Reload cached parameters for all registered decays. | |
| void | enable_obs () |
| Force enabling/re-enabling currently registered observables. | |
| 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 | set_bkstarll_threads (size_t n_threads) |
| Set the thread option for the bkstarll decay. | |
| void | set_bkll_threads (size_t n_threads) |
| Set the thread option for the bkll decay. | |
| void | set_bsphi_threads (size_t n_threads) |
| Set the thread option for the bsphi decay. | |
| void | set_lblll_threads (size_t n_threads) |
| Set the thread option for the Lambda_b -> Lambda l+ l- decay. | |
| ObservablePortsConfig & | get_ports () |
| Access the underlying ports configuration (advanced use). | |
Definition at line 72 of file ObservableInterface.h.
| ObservableInterface::ObservableInterface | ( | ) |
Construct a ready-to-use observable interface.
The constructor builds a default "ports" configuration and instantiates an ObsManager with default decays enabled.
Concretely, it:
WilsonBuilder (initially empty config),ObsWilsonBuilder,ObsParameterProxy()),ObsParameterProxy(ParameterType::FLAVOR)),ObsQCDProxy),ObsUseMarty),WilsonFreezer) bound to the Wilson builder,ObservablePortsConfig,ObsManager with those ports.ObsManager using values read from the SM/FLAVOR inputs. If you override parameters, call reload_params() or re-enable observables. Definition at line 3 of file ObservableInterface.cpp.
| void ObservableInterface::add_custom_decay | ( | DecayId | id, |
| std::shared_ptr< DecayParent > | ptr | ||
| ) |
Register a custom decay implementation.
This allows users to extend the set of computations by providing their own DecayParent subclass (typically implementing load_params() and compute_observable()).
The decay will be bound to the current Wilson builder through the manager.
| id | Unique decay identifier. |
| ptr | Shared pointer to the decay implementation. |
Definition at line 25 of file ObservableInterface.cpp.
| ObservableInterface & ObservableInterface::add_lambda_decay | ( | LambdaDecayConfig | config, |
| bool | add_observables = true |
||
| ) |
Register a complete custom decay backed by user lambdas.
This method is the high-level dynamic extension point for observables:
The observable lambdas can then use LambdaDecay::W(), LambdaDecay::SM(), LambdaDecay::FLAVOR() and LambdaDecay::QCD() to access the same services as a compiled decay.
| config | Runtime/custom decay configuration. |
| add_observables | If true, all observables declared in config are added to the manager immediately. |
*this for chaining.Definition at line 29 of file ObservableInterface.cpp.
| ObservableInterface & ObservableInterface::add_matching_patch | ( | const WilsonMatchingPatch & | patch | ) |
Add an additive Wilson matching patch through the observable layer.
Definition at line 82 of file ObservableInterface.cpp.
| ObservableInterface & ObservableInterface::add_observable | ( | BinnedObservableId | obs, |
| QCDOrder | order, | ||
| bool | add_dependencies = false |
||
| ) |
Add a binned observable to the manager (internal id API).
| obs | Observable internal id. |
| order | Maximum QCD order requested for this decay. |
| add_dependencies | If true, automatically adds the full allowed parameter dependence set for this observable. |
*this for chaining. Definition at line 101 of file ObservableInterface.cpp.
| ObservableInterface & ObservableInterface::add_observable | ( | ObservableId | obs, |
| QCDOrder | order, | ||
| bool | add_dependencies = false |
||
| ) |
Add an observable to the manager (internal id API).
| obs | Observable internal id. |
| order | Maximum QCD order requested for this decay. |
| add_dependencies | If true, automatically adds the full allowed parameter dependence set for this observable. |
*this for chaining. Definition at line 96 of file ObservableInterface.cpp.
| ObservableInterface & ObservableInterface::add_observable | ( | Observables | obs, |
| QCDOrder | order, | ||
| bool | add_dependencies = false |
||
| ) |
Add an observable to the manager (enum API).
| obs | Observable enum. |
| order | Maximum QCD order requested for this decay. |
| add_dependencies | If true, automatically adds the full allowed parameter dependence set for this observable (via DependenciesHelper). |
*this for chaining.DecayParent::set_order() (see warnings there). Definition at line 91 of file ObservableInterface.cpp.
| void ObservableInterface::add_observable_parameter | ( | ObservableId | obs, |
| ParamId | pid | ||
| ) |
Manually add a single parameter dependence to an observable (id API).
| obs | Observable id. |
| pid | Parameter id to add. |
Definition at line 172 of file ObservableInterface.cpp.
| void ObservableInterface::add_observable_parameter | ( | Observables | obs, |
| ParamId | pid | ||
| ) |
Manually add a single parameter dependence to an observable (enum API).
Dependences are used by downstream tooling (scans, profiling, likelihoods) to know which parameters should trigger recomputation.
| obs | Observable enum. |
| pid | Parameter id to add. |
Definition at line 168 of file ObservableInterface.cpp.
| void ObservableInterface::add_observable_parameters | ( | ObservableId | obs, |
| std::unordered_set< ParamId > | pids | ||
| ) |
Manually add multiple parameter dependences to an observable (id API).
| obs | Observable id. |
| pids | Set of parameter ids to add. |
Definition at line 180 of file ObservableInterface.cpp.
| void ObservableInterface::add_observable_parameters | ( | Observables | obs, |
| std::unordered_set< ParamId > | pids | ||
| ) |
Manually add multiple parameter dependences to an observable (enum API).
| obs | Observable enum. |
| pids | Set of parameter ids to add. |
Definition at line 176 of file ObservableInterface.cpp.
| void ObservableInterface::add_observables | ( | DecayId | decay, |
| QCDOrder | order, | ||
| bool | add_dependencies = false, |
||
| std::pair< double, double > | bin = {1.0, 6.0} |
||
| ) |
Add all observables belonging to a decay.
| decay | Decay dynamic enum. |
| order | Maximum QCD order requested for this decay. |
| add_dependencies | If true, add allowed dependences for each observable. |
| bin | q² bin to attach when the decay is binned; ignored otherwise. |
Definition at line 138 of file ObservableInterface.cpp.
| void ObservableInterface::add_observables | ( | Decays | decay, |
| QCDOrder | order, | ||
| bool | add_dependencies = false, |
||
| std::pair< double, double > | bin = {1.0, 6.0} |
||
| ) |
Add all observables belonging to a decay.
| decay | Decay enum. |
| order | Maximum QCD order requested for this decay. |
| add_dependencies | If true, add allowed dependences for each observable. |
| bin | q² bin to attach when the decay is binned; ignored otherwise. |
Definition at line 124 of file ObservableInterface.cpp.
| void ObservableInterface::add_observables | ( | std::map< ObservableId, QCDOrder > | obss, |
| bool | add_dependencies = false |
||
| ) |
Add multiple observables at once (internal id map).
| obss | Map (observable id -> QCD order). |
| add_dependencies | If true, add allowed dependences for each observable. |
Definition at line 117 of file ObservableInterface.cpp.
| void ObservableInterface::add_observables | ( | std::map< Observables, QCDOrder > | obss, |
| bool | add_dependencies = false |
||
| ) |
Add multiple observables at once (enum map).
| obss | Map (observable -> QCD order). |
| add_dependencies | If true, add allowed dependences for each observable. |
Definition at line 109 of file ObservableInterface.cpp.
| ObservableInterface & ObservableInterface::addMatchingPatch | ( | const WilsonMatchingPatch & | patch | ) |
Camel-case alias for add_matching_patch.
Definition at line 87 of file ObservableInterface.cpp.
| std::shared_ptr< ObservableInterface > ObservableInterface::clone_for_worker | ( | ) | const |
Build a fresh ObservableInterface with the same selected builtin observables.
The worker copy owns a distinct ObsManager, decays, Wilson builder and ports. It is intended for isolated Monte-Carlo worker evaluation.
Definition at line 253 of file ObservableInterface.cpp.
| std::map< ObservableId, std::vector< ObservableValue > > ObservableInterface::compute_all | ( | ) |
Compute all currently registered observables.
Definition at line 284 of file ObservableInterface.cpp.
| ObservableValue ObservableInterface::compute_observable | ( | BinnedObservableId | obs | ) | const |
Compute a theory prediction for an observable (id API).
| obs | Observable id with its bin. |
Definition at line 192 of file ObservableInterface.cpp.
| std::vector< ObservableValue > ObservableInterface::compute_observable | ( | ObservableId | obs | ) | const |
Compute a theory prediction for an observable (id API).
| obs | Observable id. |
Definition at line 188 of file ObservableInterface.cpp.
| std::vector< ObservableValue > ObservableInterface::compute_observable | ( | Observables | obs | ) | const |
Compute a theory prediction for an observable (enum API).
Returns a list of ObservableValue:
ObservableValue::bin set.This call triggers:
compute_observable().| obs | Observable enum. |
Definition at line 184 of file ObservableInterface.cpp.
| void ObservableInterface::enable_obs | ( | ) |
Force enabling/re-enabling currently registered observables.
This will trigger decay enabling logic in the manager so that Wilson blocks and decay internals are in a consistent state. Useful after large configuration changes or when adding multiple observables.
Definition at line 309 of file ObservableInterface.cpp.
| std::unordered_set< ParamId > ObservableInterface::get_all_ops_deps | ( | ObservableId | id | ) |
Retrieve the full allow-list of parameter dependences for an observable (id API).
| id | Observable id. |
Definition at line 297 of file ObservableInterface.cpp.
| std::unordered_set< ParamId > ObservableInterface::get_all_ops_deps | ( | Observables | id | ) |
Retrieve the full allow-list of parameter dependences for an observable (enum API).
| id | Observable enum. |
Definition at line 301 of file ObservableInterface.cpp.
| std::vector< BinnedObservableId > ObservableInterface::get_current_observables | ( | ) |
Return the set of currently registered observables.
Definition at line 249 of file ObservableInterface.cpp.
| scalar_t ObservableInterface::get_exp_uncertainty | ( | BinnedObservableId | id, |
| UncertaintyType | u_type = UncertaintyType::COMBINED |
||
| ) |
Get experimental uncertainty for an observable (id API).
| id | Observable id with bins. |
| u_type | Type of uncertainty requested. |
Definition at line 241 of file ObservableInterface.cpp.
| scalar_t ObservableInterface::get_exp_uncertainty | ( | ExperimentObs | id, |
| UncertaintyType | u_type = UncertaintyType::COMBINED |
||
| ) |
Get experimental uncertainty for an observable (id API).
| id | Observable id with bins and experience name. |
| u_type | Type of uncertainty requested. |
Definition at line 245 of file ObservableInterface.cpp.
| scalar_t ObservableInterface::get_exp_uncertainty | ( | ObservableId | id, |
| UncertaintyType | u_type = UncertaintyType::COMBINED |
||
| ) |
Get experimental uncertainty for an observable (id API).
| id | Observable id. |
| u_type | Type of uncertainty requested. |
Definition at line 237 of file ObservableInterface.cpp.
| scalar_t ObservableInterface::get_exp_uncertainty | ( | Observables | id, |
| UncertaintyType | u_type = UncertaintyType::COMBINED |
||
| ) |
Get experimental uncertainty for an observable (enum API).
| id | Observable enum. |
| u_type | Type of uncertainty requested (combined/stat/syst, etc.). |
Definition at line 233 of file ObservableInterface.cpp.
| scalar_t ObservableInterface::get_exp_value | ( | BinnedObservableId | id | ) |
Get experimental central value for an observable (id API).
| id | Observable id with bin. |
Definition at line 225 of file ObservableInterface.cpp.
| scalar_t ObservableInterface::get_exp_value | ( | ExperimentObs | id | ) |
Get experimental central value for an observable (id API).
| id | Observable id with bin and experience name. |
Definition at line 229 of file ObservableInterface.cpp.
| scalar_t ObservableInterface::get_exp_value | ( | ObservableId | id | ) |
Get experimental central value for an observable (id API).
| id | Observable id. |
Definition at line 221 of file ObservableInterface.cpp.
| scalar_t ObservableInterface::get_exp_value | ( | Observables | id | ) |
Get experimental central value for an observable (enum API).
Reads from the observable parameter space (typically block "FOBS") using the observable proxy stored in Observable.
| id | Observable enum. |
Definition at line 217 of file ObservableInterface.cpp.
| double ObservableInterface::get_param | ( | const std::string & | block, |
| LhaID | code, | ||
| ParameterType | type | ||
| ) |
Read an input parameter in a given parameter space.
| block | Parameter block name. |
| code | LHA-like code inside the block. |
| type | ParameterType namespace. |
Definition at line 293 of file ObservableInterface.cpp.
| ObservablePortsConfig & ObservableInterface::get_ports | ( | ) |
Access the underlying ports configuration (advanced use).
This exposes the proxies/builder/freezer used by the observable layer and is mainly intended for advanced workflows (custom decays, diagnostics, profiling).
Definition at line 316 of file ObservableInterface.cpp.
| bool ObservableInterface::is_decay_binned | ( | DecayId | decay | ) | const |
Return whether this decay has at least one observable requiring q² bins.
Definition at line 156 of file ObservableInterface.cpp.
| bool ObservableInterface::is_decay_binned | ( | Decays | decay | ) | const |
Return whether this decay has at least one observable requiring q² bins.
Definition at line 152 of file ObservableInterface.cpp.
| bool ObservableInterface::is_observable_binned | ( | ObservableId | obs | ) | const |
Return whether a specific observable requires q² bins.
Definition at line 164 of file ObservableInterface.cpp.
| bool ObservableInterface::is_observable_binned | ( | Observables | obs | ) | const |
Return whether a specific observable requires q² bins.
Definition at line 160 of file ObservableInterface.cpp.
| void ObservableInterface::reload_params | ( | ) |
Reload cached parameters for all registered decays.
Calls DecayParent::load_params() on each decay, refreshing internal cached masses/form factors/etc. from the current parameter providers.
This is typically used after changing input parameters via set_param().
Definition at line 305 of file ObservableInterface.cpp.
| void ObservableInterface::remove_observable | ( | ObservableId | id | ) |
Remove an observable from the manager (id API).
| id | Observable id. |
Definition at line 200 of file ObservableInterface.cpp.
| void ObservableInterface::remove_observable | ( | Observables | id | ) |
Remove an observable from the manager (enum API).
| id | Observable enum. |
Definition at line 196 of file ObservableInterface.cpp.
| void ObservableInterface::remove_observables | ( | Decays | dec | ) |
Remove all observables attached to a given decay.
| dec | Decay enum. |
Definition at line 211 of file ObservableInterface.cpp.
| void ObservableInterface::remove_observables | ( | std::unordered_set< Observables > | ids | ) |
Remove several observables (enum set).
| ids | Set of observable enums. |
Definition at line 204 of file ObservableInterface.cpp.
| void ObservableInterface::restore_decay_threads | ( | const DecayThreadSnapshot & | snapshot | ) |
Restore a previous decay-thread snapshot.
Definition at line 280 of file ObservableInterface.cpp.
| void ObservableInterface::set_all_decay_threads | ( | size_t | n_threads | ) |
Set every thread-configurable decay to the same value.
Definition at line 276 of file ObservableInterface.cpp.
| void ObservableInterface::set_bkll_threads | ( | size_t | n_threads | ) |
Set the thread option for the bkll decay.
Because bkll is one of the most time consuming calculation, multithreading is focused on it to improve calculation speed.
| n_threads | Number of threads. |
Definition at line 322 of file ObservableInterface.cpp.
| void ObservableInterface::set_bkstarll_threads | ( | size_t | n_threads | ) |
Set the thread option for the bkstarll decay.
Because bkstarll is the more time consuming calculation, multithreading is focused on it to improve calculation speed.
| n_threads | Number of threads. |
Definition at line 320 of file ObservableInterface.cpp.
| void ObservableInterface::set_bsphi_threads | ( | size_t | n_threads | ) |
Set the thread option for the bsphi decay.
Because bsphi is one of the most time consuming calculation, multithreading is focused on it to improve calculation speed.
| n_threads | Number of threads. |
Definition at line 324 of file ObservableInterface.cpp.
| void ObservableInterface::set_decay_config | ( | Decays | dec, |
| std::any | config | ||
| ) |
Set configuration for a given decay.
The config is passed as std::any and interpreted by the decay implementation (see DecayParentConfigurable<T>).
| dec | Decay enum. |
| config | Any-typed configuration payload. |
| std::bad_any_cast | if the decay expects a different config type. |
Definition at line 312 of file ObservableInterface.cpp.
| void ObservableInterface::set_decay_threads | ( | Decays | dec, |
| size_t | n_threads | ||
| ) |
Set the thread option for any decay that supports it.
Passing 0 delegates to std::thread::hardware_concurrency for supported decays. Unsupported decays keep their default behavior and emit a warning.
| dec | Decay enum. |
| n_threads | Number of threads. |
Definition at line 318 of file ObservableInterface.cpp.
| void ObservableInterface::set_lblll_threads | ( | size_t | n_threads | ) |
Set the thread option for the Lambda_b -> Lambda l+ l- decay.
| n_threads | Number of threads. |
Definition at line 326 of file ObservableInterface.cpp.
| void ObservableInterface::set_param | ( | const std::string & | block, |
| LhaID | code, | ||
| double | value, | ||
| ParameterType | type | ||
| ) |
Set an input parameter in a given parameter space.
This is a convenience wrapper around the global Parameters singleton for interactive use.
| block | Parameter block name. |
| code | LHA-like code inside the block. |
| value | New value. |
| type | ParameterType namespace (SM/BSM/FLAVOR/WILSON/OBSERVABLE/etc.). |
reload_params() and/or enable_obs() depending on your workflow. Definition at line 289 of file ObservableInterface.cpp.
| DecayThreadSnapshot ObservableInterface::snapshot_decay_threads | ( | ) | const |
Snapshot thread settings for thread-configurable decays.
Definition at line 272 of file ObservableInterface.cpp.