|
Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
|
Represents a single parameter with value, uncertainties, and dependency links. More...
#include <Parameter.h>


Public Member Functions | |
| Parameter () | |
| Default constructor. | |
| Parameter (ParamId id, scalar_t mean, scalar_t std_stat, scalar_t std_syst) | |
| Constructs a parameter from its identifier, value, and uncertainties. | |
| Parameter (const Parameter &other) | |
| Copy constructor that copies only scalar payload/metadata. | |
| void | set_mode (ParameterMode mode) |
| Sets the parameter mode. | |
| void | set_std (scalar_t stat, scalar_t syst) |
| Sets the statistical and systematic uncertainties. | |
| void | set_scale (double scale) |
| Sets the parameter scale metadata. | |
| void | set_bin (std::pair< double, double > bin) |
| Sets the binning metadata of the parameter. | |
| void | set_id (ParamId id) |
| Replaces the identifier of the parameter. | |
| virtual scalar_t | get_val () const |
| Returns the current value of the parameter. | |
| void | set_expected (scalar_t val) |
| Sets the expected value and notifies dependents. | |
| void | set_expected_silent (scalar_t val) |
| Sets the expected value without notifying observers. | |
| scalar_t | get_combined_std () const |
| Returns the combined standard deviation. | |
| std::pair< scalar_t, scalar_t > | get_std () const |
| Returns statistical and systematic uncertainties separately. | |
| double | get_scale () |
| Returns the parameter scale metadata. | |
| std::pair< double, double > | get_bin () |
| Returns the parameter bin metadata. | |
| ParamId | get_id () const |
| Returns the identifier of the parameter. | |
| void | set_owner (ParameterType type) |
| Changes the owner ParameterType part of the identifier. | |
| void | set_shift (scalar_t shift) |
| Sets the additive shift of the parameter. | |
| void | addObserver (std::shared_ptr< Parameter > observer) |
| Adds an observer parameter. | |
| void | removeObserver (std::shared_ptr< Parameter > observer) |
| Removes an observer parameter. | |
| void | notifyObservers () |
| Notifies downstream parameter observers and then the owner block. | |
| void | notifyParamObserversOnly () |
| Notifies only parameter observers. | |
| virtual void | update () |
| Hook called when an upstream dependency changes. | |
| virtual void | freeze () |
| Hook to freeze the parameter. | |
| virtual void | unfreeze () |
| Hook to unfreeze the parameter. | |
| virtual void | clear_above () |
| Hook to clear upstream dependencies. | |
| virtual void | clear_below () |
| Recursively clears downstream dependencies below this parameter. | |
| virtual std::unordered_map< ParamId, std::shared_ptr< Parameter > > | get_source_parameters () const |
| Returns the source parameters this parameter depends on. | |
| void | set_owner_block (std::weak_ptr< Block > owner) |
| Sets the owning block of this parameter. | |
| std::weak_ptr< Block > | get_owner_block () const |
| Returns the owning block of this parameter. | |
| void | overwrite_payload_from (const Parameter &other) |
| Overwrites the numerical/configuration payload from another parameter. | |
| Parameter & | operator= (const Parameter &other) |
| Assignment operator. | |
| Parameter & | operator+= (const Parameter &other) |
| Adds another parameter payload to this one. | |
| Parameter & | operator*= (const scalar_t &scale) |
| Multiplies the parameter by a scalar factor. | |
| virtual | ~Parameter ()=default |
| Virtual destructor. | |
Protected Attributes | |
| ParamId | id |
| Unique identifier for the parameter. | |
| scalar_t | expected |
| Expected value of the parameter. | |
| scalar_t | deviation_stat |
| Statistical standard deviation. | |
| scalar_t | deviation_syst |
| Systematic standard deviation. | |
| scalar_t | shift |
| Additive shift applied when the parameter is SHIFTABLE. | |
| ParameterMode | mode |
| Current operating mode. | |
| std::vector< std::shared_ptr< Parameter > > | observers |
| Observers notified when this parameter changes. | |
| std::weak_ptr< Block > | owner_block |
| Owning Block (if any) that this parameter belongs to. | |
| std::optional< double > | scale |
| Optional renormalization scale associated with the parameter. | |
| std::optional< std::pair< double, double > > | binning |
| Optional energy bin [low, high] associated with the parameter. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Parameter &p) |
| Stream output operator for a parameter. | |
Represents a single parameter with value, uncertainties, and dependency links.
This is the fundamental data container for model, flavor, observable, and Wilson parameters.
A Parameter stores:
Notification model:
Read model:
get_val() first ensures that the owning block (if any) is up to date, so accessing a parameter transparently triggers lazy recomputation of dependent blocks when needed.Definition at line 78 of file Parameter.h.
|
inline |
Default constructor.
Creates a neutral parameter:
Definition at line 102 of file Parameter.h.
Constructs a parameter from its identifier, value, and uncertainties.
The shift is initialized to zero and the mode to ParameterMode::FIXED.
| id | Unique identifier of the parameter. |
| mean | Central value. |
| std_stat | Statistical uncertainty. |
| std_syst | Systematic uncertainty. |
Definition at line 6 of file Parameter.cpp.
| Parameter::Parameter | ( | const Parameter & | other | ) |
Copy constructor that copies only scalar payload/metadata.
Observer links and owning block are intentionally not copied so deep clones can be rebound to their new local blocks safely.
Definition at line 10 of file Parameter.cpp.
|
virtualdefault |
Virtual destructor.
| void Parameter::addObserver | ( | std::shared_ptr< Parameter > | observer | ) |
Adds an observer parameter.
Observers are stored uniquely by pointer identity.
| observer | Downstream observer parameter. |
Definition at line 89 of file Parameter.cpp.
|
inlinevirtual |
Hook to clear upstream dependencies.
Base implementation does nothing. Derived classes may override this to detach from source parameters.
Reimplemented in DependentParameter.
Definition at line 336 of file Parameter.h.
|
virtual |
Recursively clears downstream dependencies below this parameter.
Current behavior:
clear_below() on each former observer.This is used to tear down or invalidate a parameter dependency subtree.
Reimplemented in DependentParameter.
Definition at line 95 of file Parameter.cpp.
|
inlinevirtual |
Hook to freeze the parameter.
Base implementation does nothing. Derived classes may override this if they support explicit freezing.
Reimplemented in DependentParameter.
Definition at line 321 of file Parameter.h.
| std::pair< double, double > Parameter::get_bin | ( | ) |
Returns the parameter bin metadata.
If no bin has been assigned, returns (-1.0, -1.0).
Definition at line 68 of file Parameter.cpp.
| scalar_t Parameter::get_combined_std | ( | ) | const |
Returns the combined standard deviation.
The combined uncertainty is computed as:
![\[
\sqrt{\sigma_{\mathrm{stat}}^2 + \sigma_{\mathrm{syst}}^2}
\]](form_11.png)
Definition at line 55 of file Parameter.cpp.
| ParamId Parameter::get_id | ( | ) | const |
Returns the identifier of the parameter.
Definition at line 72 of file Parameter.cpp.
| std::weak_ptr< Block > Parameter::get_owner_block | ( | ) | const |
Returns the owning block of this parameter.
Definition at line 112 of file Parameter.cpp.
| double Parameter::get_scale | ( | ) |
Returns the parameter scale metadata.
If no scale has been assigned, returns -1.0.
-1.0 if undefined. Definition at line 64 of file Parameter.cpp.
|
virtual |
Returns the source parameters this parameter depends on.
A plain Parameter has no explicit upstream parameter sources, so the default implementation returns an empty map.
Derived classes such as computed/dependent parameters should override this.
Reimplemented in DependentParameter.
Definition at line 106 of file Parameter.cpp.
Returns statistical and systematic uncertainties separately.
(stat, syst). Definition at line 60 of file Parameter.cpp.
|
virtual |
Returns the current value of the parameter.
Behavior:
ensure_up_to_date(),expected if mode is ParameterMode::FIXED,expected + shift if mode is ParameterMode::SHIFTABLE.Reimplemented in DependentParameter.
Definition at line 34 of file Parameter.cpp.
| void Parameter::notifyObservers | ( | ) |
Notifies downstream parameter observers and then the owner block.
Current behavior:
owner_block->notifyObservers().This is the standard propagation entry point after a value-changing operation.
Definition at line 146 of file Parameter.cpp.
| void Parameter::notifyParamObserversOnly | ( | ) |
Notifies only parameter observers.
This method:
update() on each non-null observer parameter,This is useful when propagating parameter-level dirtiness without re-triggering block-level cascades multiple times.
Definition at line 137 of file Parameter.cpp.
Multiplies the parameter by a scalar factor.
Update rules:
factor,abs(factor),factor.Metadata and observer relationships are unchanged.
| scale | Multiplicative factor. |
Definition at line 177 of file Parameter.cpp.
Adds another parameter payload to this one.
Update rules:
Identifier, mode, metadata, and observer relationships are unchanged.
| other | Parameter to add. |
Definition at line 169 of file Parameter.cpp.
Assignment operator.
Copies:
Does not copy:
| other | Source parameter. |
Definition at line 115 of file Parameter.cpp.
| void Parameter::overwrite_payload_from | ( | const Parameter & | other | ) |
Overwrites the numerical/configuration payload from another parameter.
Copied fields:
Preserved fields:
| other | Source parameter payload. |
Definition at line 127 of file Parameter.cpp.
| void Parameter::removeObserver | ( | std::shared_ptr< Parameter > | observer | ) |
Removes an observer parameter.
Removal is performed by pointer identity.
| observer | Observer to remove. |
Definition at line 153 of file Parameter.cpp.
| void Parameter::set_bin | ( | std::pair< double, double > | bin | ) |
Sets the binning metadata of the parameter.
| bin | Bin interval as (low, high). |
Definition at line 30 of file Parameter.cpp.
| void Parameter::set_expected | ( | scalar_t | val | ) |
Sets the expected value and notifies dependents.
This updates the central value, then calls notifyObservers().
| val | New expected value. |
Definition at line 41 of file Parameter.cpp.
| void Parameter::set_expected_silent | ( | scalar_t | val | ) |
Sets the expected value without notifying observers.
This is intended for internal/batched updates where propagation is handled separately.
| val | New expected value. |
Definition at line 47 of file Parameter.cpp.
| void Parameter::set_id | ( | ParamId | id | ) |
Replaces the identifier of the parameter.
| id | New identifier. |
Definition at line 51 of file Parameter.cpp.
| void Parameter::set_mode | ( | ParameterMode | mode | ) |
Sets the parameter mode.
This does not trigger notifications by itself.
| mode | New mode to assign. |
Definition at line 15 of file Parameter.cpp.
| void Parameter::set_owner | ( | ParameterType | type | ) |
Changes the owner ParameterType part of the identifier.
This is typically used when re-tagging a parameter as SM, BSM, WILSON, etc.
| type | New owner type. |
Definition at line 77 of file Parameter.cpp.
| void Parameter::set_owner_block | ( | std::weak_ptr< Block > | owner | ) |
Sets the owning block of this parameter.
| owner | Weak pointer to the owning block. |
Definition at line 110 of file Parameter.cpp.
| void Parameter::set_scale | ( | double | scale | ) |
Sets the parameter scale metadata.
This is purely metadata storage; no notification is emitted.
| scale | Scale value. |
Definition at line 26 of file Parameter.cpp.
| void Parameter::set_shift | ( | scalar_t | shift | ) |
Sets the additive shift of the parameter.
This is only allowed if the parameter is in ParameterMode::SHIFTABLE mode.
| shift | New shift value. |
| std::runtime_error | if called while the parameter is FIXED. |
Definition at line 81 of file Parameter.cpp.
Sets the statistical and systematic uncertainties.
| stat | Statistical standard deviation. |
| syst | Systematic standard deviation. |
Definition at line 21 of file Parameter.cpp.
|
inlinevirtual |
Hook to unfreeze the parameter.
Base implementation does nothing.
Reimplemented in DependentParameter.
Definition at line 328 of file Parameter.h.
|
inlinevirtual |
Hook called when an upstream dependency changes.
Base implementation does nothing. Derived classes may override this to recompute internal state.
Reimplemented in DependentParameter.
Definition at line 313 of file Parameter.h.
|
friend |
Stream output operator for a parameter.
Prints a compact human-readable representation including block/code, optional binning, central value, and uncertainties.
| os | Output stream. |
| p | Parameter to print. |
Definition at line 159 of file Parameter.cpp.
|
protected |
Optional energy bin [low, high] associated with the parameter.
Definition at line 89 of file Parameter.h.
|
protected |
Statistical standard deviation.
Definition at line 82 of file Parameter.h.
|
protected |
Systematic standard deviation.
Definition at line 83 of file Parameter.h.
|
protected |
Expected value of the parameter.
Definition at line 81 of file Parameter.h.
|
protected |
Unique identifier for the parameter.
Definition at line 80 of file Parameter.h.
|
protected |
Current operating mode.
Definition at line 85 of file Parameter.h.
|
protected |
Observers notified when this parameter changes.
Definition at line 86 of file Parameter.h.
|
protected |
Owning Block (if any) that this parameter belongs to.
Definition at line 87 of file Parameter.h.
|
protected |
Optional renormalization scale associated with the parameter.
Definition at line 88 of file Parameter.h.
|
protected |
Additive shift applied when the parameter is SHIFTABLE.
Definition at line 84 of file Parameter.h.