Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
CorrelationRepo.h
Go to the documentation of this file.
1#ifndef CORRELATIONREPO_H
2#define CORRELATIONREPO_H
3
4#include "Math.h"
5#include "Include.h"
6#include "ExperimentObs.h"
7
27template<typename T>
31
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);
45 };
46
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);
67 };
68
85 template<typename U>
86 friend std::ostream& operator<<(std::ostream&, const CorrelationMatrixPair<U>&);
87};
88
113public:
124 std::pair<double, double> get_correlation(ParamId p1, ParamId p2) const;
125
140 std::pair<double, double> get_correlation(const ExperimentObs& o1,
141 const ExperimentObs& o2) const;
142
156 std::pair<double, double> get_correlation(const std::string& experiment,
157 Observables o1,
158 Observables o2) const;
159
175 std::pair<double, double> get_correlation(const std::string& experiment,
176 ObservableId o1,
177 ObservableId o2) const;
178
190 std::pair<double, double> get_correlation(const std::string& experiment,
191 const BinnedObservableId& o1,
192 const BinnedObservableId& o2) const;
193
211 std::pair<double, double> get_correlation(const std::string& exp1,
212 const BinnedObservableId& o1,
213 const std::string& exp2,
214 const BinnedObservableId& o2) const;
215
235 template<typename T>
236 double get_combined_correlation(T p1, T p2) const {
237 auto corr = get_correlation(p1, p2);
238 return std::hypot(corr.first, corr.second);
239 }
240
247 void set_correlation_matrix(std::shared_ptr<CorrelationMatrixPair<ParamId>> correlation_matrices);
248
255 void set_correlation_matrix(std::shared_ptr<CorrelationMatrixPair<ExperimentObs>> correlation_matrix);
256
270 void merge_correlation_matrix(std::shared_ptr<CorrelationMatrixPair<ParamId>> correlation_matrix);
271
284 void merge_correlation_matrix(std::shared_ptr<CorrelationMatrixPair<ExperimentObs>> correlation_matrix);
285
296 void print_content() const;
297
298private:
299 std::shared_ptr<CorrelationMatrixPair<ParamId>> parameter_correlations;
300 std::shared_ptr<CorrelationMatrixPair<ExperimentObs>> observable_correlations;
301};
302
303#endif // CORRELATIONREPO_H
Experiment-scoped observable identifiers.
Observables
Definition GeneralEnum.h:4
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.
Definition ParamID.h:57