Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
observable_ids.hpp
Go to the documentation of this file.
1#ifndef OBSERVABLE_IDS_H
2#define OBSERVABLE_IDS_H
3
4#include <optional>
5#include <string>
6#include <string_view>
7#include <vector>
8
9#include "generic_mapper.h"
10#include "Map.h"
11#include "LhaID.h"
12#include "decay_graph.h"
13
30struct ObservableTag {};
31
34
36
52 ObservableTag,
53 Observables,
54 LhaID,
55 std::hash<LhaID>,
56 observable_mapping,
57 observable_flha_mapping
58 >
59{
60public:
64 LhaID,
65 std::hash<LhaID>,
68 >;
69
71 using Base::id_of;
72 using Base::enum_elt;
73 using Base::str;
74 using Base::to_id;
75 using Base::enum_of;
76 using Base::list_all;
78 using Base::external_of;
80
93 static Observables enum_elt_legacy(std::string_view s);
94
108 static Observables enum_elt(const LhaID& ext);
109
121 static std::optional<ObservableId> from_flha(const LhaID& ext);
122
129 static std::optional<LhaID> flha_of(const ObservableId& id);
130
140 static std::optional<BinnedObservableId> from_binned_flha(const LhaID& ext);
141
148 static std::optional<LhaID> binned_flha_of(const BinnedObservableId& id);
149
158 static BinnedObservableId binned_from_flha(const LhaID& ext);
159
168 static LhaID flha(const Observables& id);
169
184 static bool register_custom(const std::string& canonical,
185 std::vector<std::string> aliases,
186 std::optional<LhaID> ext,
187 const DecayId& parent_decay);
188
192 static bool register_custom(const std::string& canonical,
193 std::vector<std::string> aliases,
194 std::optional<LhaID> ext,
195 Decays parent_decay_enum);
196
200 static bool register_custom(const std::string& canonical,
201 std::vector<std::string> aliases,
202 std::optional<LhaID> ext,
203 std::string_view parent_decay_str);
204
213 static LhaID flha(const ObservableId& id);
214
223 static LhaID flha(const BinnedObservableId& id);
224};
225
226#endif // OBSERVABLE_IDS_H
Observables
Definition GeneralEnum.h:4
Decays
Lightweight representation of LHAPDF / SLHA-style identifiers.
const std::map< Observables, std::string > & observable_mapping()
Returns the mapping between Observables and their string names.
Definition Map.cpp:21
const std::map< Observables, LhaID > & observable_flha_mapping()
Returns the mapping between Observables and their FLHA identifiers.
Definition Map.cpp:566
Static mappings between enum classes and string (or FLHA) identifiers.
Generic enum↔string mapper with external keys and dynamic aliases.
static std::vector< IdOf< ObservableTag > > list_all()
Lists all distinct identifiers currently registered.
static std::optional< LhaID > external_of(const IdOf< ObservableTag > &id)
Returns the external key associated with a given identifier.
static std::optional< Observables > enum_of(const IdOf< ObservableTag > &id)
Attempts to recover the enum value associated with an identifier.
static IdOf< ObservableTag > enum_elt(std::string_view s)
Alias for id_of(), kept for compatibility.
static std::optional< IdOf< ObservableTag > > from_external(const LhaID &k)
Resolves an external key into an identifier.
static IdOf< ObservableTag > to_id(Observables e)
Converts an enum value to an IdOf<Tag>.
static bool set_external(const IdOf< ObservableTag > &id, const LhaID &k)
Sets or updates the external key of an existing identifier.
static IdOf< ObservableTag > id_of(std::string_view s)
Resolves a string into an IdOf<Tag> via the registry.
static std::string str(const IdOf< ObservableTag > &id)
Returns the string representation of an identifier.
High-level mapper for observable names, FLHA ids and parent decays.
static std::optional< ObservableId > from_flha(const LhaID &ext)
Resolve a FLHA id to a dynamic observable id.
static BinnedObservableId binned_from_flha(const LhaID &ext)
Throwing variant of from_binned_flha().
static std::optional< LhaID > flha_of(const ObservableId &id)
Return the FLHA id attached to an observable id, if any.
static std::optional< LhaID > binned_flha_of(const BinnedObservableId &id)
Encode a binned observable id into its FLHA representation.
static LhaID flha(const Observables &id)
Return the FLHA id associated with a builtin enum value.
static Observables enum_elt(const LhaID &ext)
Legacy builtin-only lookup from FLHA id to enum.
static bool register_custom(const std::string &canonical, std::vector< std::string > aliases, std::optional< LhaID > ext, const DecayId &parent_decay)
Register a custom observable and attach it to a parent decay.
static Observables enum_elt_legacy(std::string_view s)
Legacy builtin-only lookup from string to enum.
static std::optional< BinnedObservableId > from_binned_flha(const LhaID &ext)
Decode a binned FLHA id into a binned observable id.
Runtime graph linking decay identifiers to observable identifiers.
Generic enum↔string (and optional external key) mappers built on DynamicRegistry.
Identifies an observable together with a numerical bin.
Represents an identifier of a LHA element, possibly containing several sub-ids.
Definition LhaID.h:56