Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
BinnedObservableId Struct Reference

Identifies an observable together with a numerical bin. More...

#include <BinnedObservableId.h>

Collaboration diagram for BinnedObservableId:

Public Member Functions

 BinnedObservableId ()=default
 Default constructor.
 
 BinnedObservableId (ObservableId id)
 Constructs an unbinned observable identifier.
 
 BinnedObservableId (ObservableId id, std::pair< double, double > bin)
 Constructs a binned observable identifier.
 
 BinnedObservableId (Observables id)
 Constructs an unbinned observable identifier.
 
 BinnedObservableId (Observables id, std::pair< double, double > bin)
 Constructs a binned observable identifier.
 
bool operator== (BinnedObservableId const &o) const noexcept
 Equality comparison operator.
 
bool operator< (BinnedObservableId const &o) const noexcept
 Strict weak ordering for binned observable identifiers.
 
LhaID flha () const
 Converts this binned observable identifier to its FLHA encoding.
 
std::string str () const
 Returns a human-readable representation of the binned observable.
 

Static Public Member Functions

static BinnedObservableId from_flha (LhaID const &id)
 Reconstructs a binned observable identifier from an FLHA encoding.
 

Public Attributes

ObservableId s
 
std::pair< double, double > p
 

Detailed Description

Identifies an observable together with a numerical bin.

A BinnedObservableId combines an ObservableId with a pair of bin boundaries, typically interpreted as the lower and upper edges of the bin. This is useful for observables whose experimental value is defined in a specific kinematic interval.

The bin is stored as a pair of doubles:

  • p.first is the lower bin edge,
  • p.second is the upper bin edge.

The type provides equality comparison, strict weak ordering, hashing, conversion to a robust FLHA/LhaID representation, reconstruction from that representation, and a human-readable string representation.

Definition at line 285 of file BinnedObservableId.h.

Constructor & Destructor Documentation

◆ BinnedObservableId() [1/5]

BinnedObservableId::BinnedObservableId ( )
default

Default constructor.

Leaves the observable identifier and bin boundaries default-initialized.

◆ BinnedObservableId() [2/5]

BinnedObservableId::BinnedObservableId ( ObservableId  id)
inline

Constructs an unbinned observable identifier.

The observable is initialized from id and the bin boundaries are set to {0.0, 0.0}, which is used here as the default unbinned interval.

Parameters
idIdentifier of the observable.

Definition at line 304 of file BinnedObservableId.h.

◆ BinnedObservableId() [3/5]

BinnedObservableId::BinnedObservableId ( ObservableId  id,
std::pair< double, double >  bin 
)
inline

Constructs a binned observable identifier.

Parameters
idIdentifier of the observable.
binPair containing the lower and upper bin boundaries.

Definition at line 312 of file BinnedObservableId.h.

◆ BinnedObservableId() [4/5]

BinnedObservableId::BinnedObservableId ( Observables  id)
inline

Constructs an unbinned observable identifier.

The observable is initialized from id and the bin boundaries are set to {0.0, 0.0}, which is used here as the default unbinned interval.

Parameters
idIdentifier of the observable.

Definition at line 322 of file BinnedObservableId.h.

◆ BinnedObservableId() [5/5]

BinnedObservableId::BinnedObservableId ( Observables  id,
std::pair< double, double >  bin 
)
inline

Constructs a binned observable identifier.

Parameters
idIdentifier of the observable.
binPair containing the lower and upper bin boundaries.

Definition at line 330 of file BinnedObservableId.h.

Member Function Documentation

◆ flha()

LhaID BinnedObservableId::flha ( ) const
inline

Converts this binned observable identifier to its FLHA encoding.

The underlying observable is first converted to its unbinned FLHA identifier using ObservableMapper::flha_of. The lower and upper bin boundaries are then encoded as six integer components and inserted into the resulting LhaID at kBinnedFlhaInsertPos.

Returns
LhaID containing both the observable identifier and the encoded bin boundaries.
Exceptions
std::runtime_errorif no FLHA mapping is known for the underlying observable.
std::runtime_errorif one of the bin boundaries cannot be encoded, for example because it is not finite.

Definition at line 384 of file BinnedObservableId.h.

◆ from_flha()

static BinnedObservableId BinnedObservableId::from_flha ( LhaID const &  id)
inlinestatic

Reconstructs a binned observable identifier from an FLHA encoding.

This function expects an LhaID containing the encoded bin information at kBinnedFlhaInsertPos. The six bin-related components are extracted, decoded into lower and upper bin boundaries, and removed before converting the remaining unbinned identifier back to an ObservableId.

Parameters
idFLHA/LhaID representation of a binned observable.
Returns
Reconstructed BinnedObservableId.
Exceptions
std::runtime_errorif id does not contain enough components for the encoded bin.
std::runtime_errorif the unbinned FLHA identifier cannot be mapped back to an ObservableId.
std::runtime_errorif the encoded bin components are invalid.

Definition at line 427 of file BinnedObservableId.h.

◆ operator<()

bool BinnedObservableId::operator< ( BinnedObservableId const &  o) const
inlinenoexcept

Strict weak ordering for binned observable identifiers.

Ordering is lexicographic on the observable identifier and the bitwise representation of the normalized bin edges. This allows the type to be used as a key in ordered containers such as std::map or std::set.

Parameters
oObject to compare with.
Returns
true if this object is ordered before o.

Definition at line 359 of file BinnedObservableId.h.

◆ operator==()

bool BinnedObservableId::operator== ( BinnedObservableId const &  o) const
inlinenoexcept

Equality comparison operator.

Two BinnedObservableId objects are equal if they refer to the same observable and have identical normalized bin boundaries. Positive and negative zero are treated as the same value.

Parameters
oObject to compare with.
Returns
true if both identifiers represent the same binned observable, false otherwise.

Definition at line 343 of file BinnedObservableId.h.

◆ str()

std::string BinnedObservableId::str ( ) const
inline

Returns a human-readable representation of the binned observable.

The returned string contains the observable string representation followed by the bin boundaries.

Returns
String of the form "observable [low, high]".

Definition at line 468 of file BinnedObservableId.h.

Member Data Documentation

◆ p

std::pair<double, double> BinnedObservableId::p

Bin boundaries, usually {lower, upper}.

Definition at line 287 of file BinnedObservableId.h.

◆ s

ObservableId BinnedObservableId::s

Identifier of the underlying observable.

Definition at line 286 of file BinnedObservableId.h.


The documentation for this struct was generated from the following file: