Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
ExperimentObs.h
Go to the documentation of this file.
1#ifndef EXPERIMENT_OBS_H
2#define EXPERIMENT_OBS_H
3
4#include "Include.h"
5
33 std::string experiment;
41 ExperimentObs() = default;
42
50 : experiment(std::move(exp)), obs(std::move(o)) {}
51
61 ExperimentObs(std::string exp, ObservableId o)
62 : experiment(std::move(exp)), obs(BinnedObservableId(o, {0.,0.})) {}
63
74 ExperimentObs(std::string exp, Observables o)
75 : experiment(std::move(exp)), obs(BinnedObservableId(ObservableMapper::to_id(o), {0.,0.})) {}
76
87 bool operator==(ExperimentObs const& other) const noexcept {
88 return experiment == other.experiment
89 && obs == other.obs;
90 }
91
102 bool operator<(ExperimentObs const& other) const noexcept {
103 return std::tie(experiment, obs)
104 < std::tie(other.experiment, other.obs);
105 }
106
112 std::string str() const {
113 std::stringstream ss;
114 ss << experiment << " :: " << obs.str();
115 return ss.str();
116 }
117};
118
129inline std::ostream& operator<<(std::ostream& os, ExperimentObs const& x) {
130 os << x.experiment << " :: " << x.obs.str();
131 return os << x.str();
132}
133
141template<>
142struct std::hash<ExperimentObs> {
149 std::size_t operator()(ExperimentObs const& x) const noexcept {
150 std::size_t h = std::hash<std::string>{}(x.experiment);
151
152 auto mix = [](std::size_t& seed, std::size_t v) {
153 seed ^= v + 0x9e3779b97f4a7c15ULL + (seed << 6) + (seed >> 2);
154 };
155
156 mix(h, std::hash<BinnedObservableId>{}(x.obs));
157 return h;
158 }
159};
160
161
162#endif // EXPERIMENT_OBS_H
std::ostream & operator<<(std::ostream &os, ExperimentObs const &x)
Stream output operator for ExperimentObs.
Observables
Definition GeneralEnum.h:4
High-level mapper for observable names, FLHA ids and parent decays.
Hash specialization for SymbolId<Tag>.
Definition BlockName.h:353
Identifies an observable together with a numerical bin.
std::string str() const
Returns a human-readable representation of the binned observable.
ExperimentObs()=default
Default constructor.
std::string experiment
bool operator==(ExperimentObs const &other) const noexcept
Equality comparison operator.
ExperimentObs(std::string exp, ObservableId o)
Constructs an experiment-specific unbinned observable.
std::string str() const
Returns a human-readable representation of the object.
ExperimentObs(std::string exp, Observables o)
Constructs an experiment-specific observable from an enum value.
bool operator<(ExperimentObs const &other) const noexcept
Strict weak ordering for experiment-specific observables.
BinnedObservableId obs
ExperimentObs(std::string exp, BinnedObservableId o)
Constructs an experiment-specific binned observable.
std::size_t operator()(ExperimentObs const &x) const noexcept
Computes the hash of an experiment-specific observable.