1#ifndef CORRELATIONREPO_H
2#define CORRELATIONREPO_H
41 std::pair<double, double>
at(
const std::pair<T, T>& key)
const {
42 double statv =
stat.contains(key) ?
stat.at(key) : 0.0;
43 double systv =
syst.contains(key) ?
syst.at(key) : 0.0;
44 return std::make_pair(statv, systv);
62 void emplace(std::pair<T, T>&& key,
double stat_val,
double syst_val) {
63 stat.emplace(key, stat_val);
64 syst.emplace(key, syst_val);
65 stat.emplace(std::make_pair(key.second, key.first), stat_val);
66 syst.emplace(std::make_pair(key.second, key.first), syst_val);
156 std::pair<double, double>
get_correlation(
const std::string& experiment,
175 std::pair<double, double>
get_correlation(
const std::string& experiment,
190 std::pair<double, double>
get_correlation(
const std::string& experiment,
213 const std::string& exp2,
238 return std::hypot(corr.first, corr.second);
299 std::shared_ptr<CorrelationMatrixPair<ParamId>> parameter_correlations;
300 std::shared_ptr<CorrelationMatrixPair<ExperimentObs>> observable_correlations;
Experiment-scoped observable identifiers.
std::map< std::pair< T, T >, double > SparseMatrix
Alias for a sparse matrix using a map of coordinate pairs.
Manages correlations between parameters and experiment-scoped observables.
void set_correlation_matrix(std::shared_ptr< CorrelationMatrixPair< ParamId > > correlation_matrices)
Sets (replaces) the correlation matrix for parameters.
void print_content() const
Prints the current content of parameter and observable correlations.
void merge_correlation_matrix(std::shared_ptr< CorrelationMatrixPair< ParamId > > correlation_matrix)
Merges a new correlation matrix into the existing parameter correlations.
double get_combined_correlation(T p1, T p2) const
Computes the combined correlation (quadratic sum) between two entities of the same type.
std::pair< double, double > get_correlation(ParamId p1, ParamId p2) const
Retrieves the correlation between two parameters.
double T(double x)
Wilson coefficient T(x).
Identifies an observable together with a numerical bin.
Stores a pair of correlation matrices (statistical and systematic) for a given key type.
void emplace(std::pair< T, T > &&key, double stat_val, double syst_val)
Inserts a new entry into both the statistical and systematic matrices, enforcing symmetry.
std::pair< double, double > at(const std::pair< T, T > &key) const
Retrieves the correlation values for a given pair.
SparseMatrix< T > syst
Systematic correlation matrix.
friend std::ostream & operator<<(std::ostream &, const CorrelationMatrixPair< U > &)
Stream output operator for a CorrelationMatrixPair.
SparseMatrix< T > stat
Statistical correlation matrix.
Composite identifier for a single parameter.