|
Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
|
Manages correlations between parameters and experiment-scoped observables. More...
#include <CorrelationRepo.h>
Public Member Functions | |
| std::pair< double, double > | get_correlation (ParamId p1, ParamId p2) const |
| Retrieves the correlation between two parameters. | |
| std::pair< double, double > | get_correlation (const ExperimentObs &o1, const ExperimentObs &o2) const |
| Retrieves the correlation between two experiment-scoped observables. | |
| std::pair< double, double > | get_correlation (const std::string &experiment, Observables o1, Observables o2) const |
| Retrieves the correlation between two observables given as enum, within the same experiment. | |
| std::pair< double, double > | get_correlation (const std::string &experiment, ObservableId o1, ObservableId o2) const |
| Retrieves the correlation between two observables given as IDs, within the same experiment. | |
| std::pair< double, double > | get_correlation (const std::string &experiment, const BinnedObservableId &o1, const BinnedObservableId &o2) const |
| Retrieves the correlation between two binned observables, within the same experiment. | |
| std::pair< double, double > | get_correlation (const std::string &exp1, const BinnedObservableId &o1, const std::string &exp2, const BinnedObservableId &o2) const |
| Retrieves the correlation between two binned observables coming from possibly different experiments. | |
| template<typename T > | |
| double | get_combined_correlation (T p1, T p2) const |
| Computes the combined correlation (quadratic sum) between two entities of the same type. | |
| void | set_correlation_matrix (std::shared_ptr< CorrelationMatrixPair< ParamId > > correlation_matrices) |
| Sets (replaces) the correlation matrix for parameters. | |
| void | set_correlation_matrix (std::shared_ptr< CorrelationMatrixPair< ExperimentObs > > correlation_matrix) |
| Sets (replaces) the correlation matrix for experiment-scoped observables. | |
| void | merge_correlation_matrix (std::shared_ptr< CorrelationMatrixPair< ParamId > > correlation_matrix) |
| Merges a new correlation matrix into the existing parameter correlations. | |
| void | merge_correlation_matrix (std::shared_ptr< CorrelationMatrixPair< ExperimentObs > > correlation_matrix) |
| Merges a new correlation matrix into the existing observable correlations. | |
| void | print_content () const |
| Prints the current content of parameter and observable correlations. | |
Manages correlations between parameters and experiment-scoped observables.
This class acts as a central repository of correlation information. It stores:
Observable correlations are indexed by ExperimentObs, i.e. by the pair (experiment, observable). This makes it possible to store different correlation values for the same observable pair across different experiments.
Typical usage:
set_correlation_matrix(...) once to install initial matrices.merge_correlation_matrix(...) to overlay new entries (overwriting any existing ones with the same key).get_correlation(...) and get_combined_correlation(...).Note: The repository expects its internal shared_ptr members to be set before any get_correlation calls are made.
Definition at line 112 of file CorrelationRepo.h.
|
inline |
Computes the combined correlation (quadratic sum) between two entities of the same type.
The combined correlation is defined as:
sqrt( rho_stat^2 + rho_syst^2 )
which is simply std::hypot(rho_stat, rho_syst).
This helper is intended for homogeneous key types, such as:
| T | Entity type. |
| p1 | First entity. |
| p2 | Second entity. |
Definition at line 236 of file CorrelationRepo.h.
| std::pair< double, double > CorrelationRepository::get_correlation | ( | const ExperimentObs & | o1, |
| const ExperimentObs & | o2 | ||
| ) | const |
Retrieves the correlation between two experiment-scoped observables.
This is the most explicit observable overload. Each observable is represented by an ExperimentObs, which combines:
| o1 | First experiment-scoped observable. |
| o2 | Second experiment-scoped observable. |
(rho_stat, rho_syst).observable_correlations must be non-null and properly initialized. Definition at line 8 of file CorrelationRepo.cpp.
| std::pair< double, double > CorrelationRepository::get_correlation | ( | const std::string & | exp1, |
| const BinnedObservableId & | o1, | ||
| const std::string & | exp2, | ||
| const BinnedObservableId & | o2 | ||
| ) | const |
Retrieves the correlation between two binned observables coming from possibly different experiments.
This overload is useful when one wants to explicitly query the entry corresponding to:
(exp1, o1)(exp2, o2)| exp1 | Experiment name associated with the first observable. |
| o1 | First binned observable ID. |
| exp2 | Experiment name associated with the second observable. |
| o2 | Second binned observable ID. |
(rho_stat, rho_syst).observable_correlations must be non-null and properly initialized. Definition at line 47 of file CorrelationRepo.cpp.
| std::pair< double, double > CorrelationRepository::get_correlation | ( | const std::string & | experiment, |
| const BinnedObservableId & | o1, | ||
| const BinnedObservableId & | o2 | ||
| ) | const |
Retrieves the correlation between two binned observables, within the same experiment.
| experiment | Experiment name used to scope both observables. |
| o1 | First binned observable ID. |
| o2 | Second binned observable ID. |
(rho_stat, rho_syst).observable_correlations must be non-null and properly initialized. Definition at line 38 of file CorrelationRepo.cpp.
| std::pair< double, double > CorrelationRepository::get_correlation | ( | const std::string & | experiment, |
| ObservableId | o1, | ||
| ObservableId | o2 | ||
| ) | const |
Retrieves the correlation between two observables given as IDs, within the same experiment.
This overload wraps each ObservableId into a default BinnedObservableId using a dummy bin range {0., 0.}, then delegates to the (experiment, BinnedObservableId, BinnedObservableId) overload.
| experiment | Experiment name used to scope both observables. |
| o1 | First observable ID. |
| o2 | Second observable ID. |
(rho_stat, rho_syst).observable_correlations must be non-null and properly initialized. Definition at line 27 of file CorrelationRepo.cpp.
| std::pair< double, double > CorrelationRepository::get_correlation | ( | const std::string & | experiment, |
| Observables | o1, | ||
| Observables | o2 | ||
| ) | const |
Retrieves the correlation between two observables given as enum, within the same experiment.
This overload converts the enum values to ObservableId using ObservableMapper::to_id, then delegates to the corresponding (experiment, ObservableId, ObservableId) overload.
| experiment | Experiment name used to scope both observables. |
| o1 | First observable (enum). |
| o2 | Second observable (enum). |
(rho_stat, rho_syst). Definition at line 16 of file CorrelationRepo.cpp.
Retrieves the correlation between two parameters.
| p1 | First parameter ID. |
| p2 | Second parameter ID. |
(rho_stat, rho_syst) with statistical and systematic correlation respectively.parameter_correlations must be non-null and properly initialized. Definition at line 3 of file CorrelationRepo.cpp.
| void CorrelationRepository::merge_correlation_matrix | ( | std::shared_ptr< CorrelationMatrixPair< ExperimentObs > > | correlation_matrix | ) |
Merges a new correlation matrix into the existing observable correlations.
Same semantics as the parameter version, but applied to observable_correlations, whose keys are ExperimentObs.
| correlation_matrix | Shared pointer to the new observable correlation matrix. |
observable_correlations must be non-null. Definition at line 79 of file CorrelationRepo.cpp.
| void CorrelationRepository::merge_correlation_matrix | ( | std::shared_ptr< CorrelationMatrixPair< ParamId > > | correlation_matrix | ) |
Merges a new correlation matrix into the existing parameter correlations.
For each entry in correlation_matrix->stat and correlation_matrix->syst, any existing entry in parameter_correlations with the same key is overwritten via insert_or_assign.
| correlation_matrix | Shared pointer to the new parameter correlation matrix. |
parameter_correlations must be non-null. Definition at line 67 of file CorrelationRepo.cpp.
| void CorrelationRepository::print_content | ( | ) | const |
Prints the current content of parameter and observable correlations.
Uses the LOGGER macros to print:
in a diagnostic-friendly format (using the overloaded operator<< on CorrelationMatrixPair).
Definition at line 91 of file CorrelationRepo.cpp.
| void CorrelationRepository::set_correlation_matrix | ( | std::shared_ptr< CorrelationMatrixPair< ExperimentObs > > | correlation_matrix | ) |
Sets (replaces) the correlation matrix for experiment-scoped observables.
| correlation_matrix | Shared pointer to the observable correlation matrices keyed by ExperimentObs. |
Definition at line 62 of file CorrelationRepo.cpp.
| void CorrelationRepository::set_correlation_matrix | ( | std::shared_ptr< CorrelationMatrixPair< ParamId > > | correlation_matrices | ) |
Sets (replaces) the correlation matrix for parameters.
| correlation_matrices | Shared pointer to the parameter correlation matrices. |
Definition at line 57 of file CorrelationRepo.cpp.