Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
lha_elements.h
Go to the documentation of this file.
1#ifndef HYPERISO_LHA_ELEMENTS_H
2#define HYPERISO_LHA_ELEMENTS_H
3
4#include <string>
5#include <optional>
6#include <vector>
7#include <memory>
8#include <map>
9#include <sstream>
10#include <iostream>
11#include <limits>
12
13#include "Logger.h"
14#include "LhaID.h"
15#include "LhaBlockPrototype.h"
16#include "DBNode.h"
17
28
41protected:
42 const LhaID id;
44public:
50 inline explicit AbstractElement(const LhaID& id_) : id(id_) {}
51
60 inline LhaID getId() const { return this->id; }
61
70 virtual std::pair<double, double> getBinning() const = 0;
71
79 virtual double getScale() const = 0;
80
92 virtual std::string toString() const = 0;
93
105 virtual std::shared_ptr<DBNode> toDBNode() const = 0;
106
110 virtual ~AbstractElement() = default;
111
112};
113
134template <typename T>
136private:
137 T value;
138 std::optional<RenormalizationScheme> rScheme;
139 std::optional<double> Q;
140 std::optional<std::pair<double, double>> bin;
158 LhaID encodeId(const Prototype& prototype, const std::vector<std::string>& line);
159
160public:
177 LhaElement(const Prototype& prototype, const std::vector<std::string>& line);
178
184 inline T getValue() const { return this->value; }
185
193 inline RenormalizationScheme getScheme() const { return this->rScheme.has_value() ? this->rScheme.value() : RenormalizationScheme::NONE; }
194
202 inline double getScale() const override { return this->Q.has_value() ? this->Q.value() : 0; }
203
211 inline std::pair<double, double> getBinning() const override { return this->bin.value_or(std::pair(-1.0, -1.0)); }
212
223 std::string toString() const override;
224
237 std::shared_ptr<DBNode> toDBNode() const override;
238
239};
240
251 public:
265 static std::shared_ptr<AbstractElement> createElement(const Prototype& prototype, const std::vector<std::string>& line);
266 };
267
268#endif // HYPERISO_LHA_ELEMENTS_H
Hierarchical key–value tree with JSON/YAML serialization.
Lightweight representation of LHAPDF / SLHA-style identifiers.
Abstract base class for a single element of an LHA/FLHA block.
virtual ~AbstractElement()=default
Virtual destructor.
virtual std::pair< double, double > getBinning() const =0
Returns the binning associated to this element.
virtual std::string toString() const =0
Converts the element to a line-like string representation.
AbstractElement(const LhaID &id_)
Constructs an AbstractElement with a given identifier.
LhaID getId() const
Returns the identifier of the element.
virtual std::shared_ptr< DBNode > toDBNode() const =0
Converts the element into a DBNode for database/storage use.
virtual double getScale() const =0
Returns the renormalization scale of this element.
const LhaID id
Factory for creating LHA/FLHA elements from a prototype and a line.
static std::shared_ptr< AbstractElement > createElement(const Prototype &prototype, const std::vector< std::string > &line)
Creates an element of the appropriate type for a given line.
Template concrete implementation of an LHA/FLHA block element.
double getScale() const override
Returns the renormalization scale Q of the element.
std::pair< double, double > getBinning() const override
Returns the binning associated with the element.
RenormalizationScheme getScheme() const
Returns the renormalization scheme of the element.
std::string toString() const override
Returns a line-like string representation of the element.
std::shared_ptr< DBNode > toDBNode() const override
Converts the element to a DBNode representation.
T getValue() const
Returns the stored value of the element.
RenormalizationScheme
Enumeration of possible renormalization schemes for LHA elements.
double T(double x)
Wilson coefficient T(x).
Represents an identifier of a LHA element, possibly containing several sub-ids.
Definition LhaID.h:56
Represents the structure of an LHA block, specifying columns for values, scales, and renormalization ...