78class Parameter :
public std::enable_shared_from_this<Parameter> {
89 std::optional<std::pair<double, double>>
binning;
155 void set_bin(std::pair<double, double> bin);
217 std::pair<scalar_t, scalar_t>
get_std()
const;
235 std::pair<double, double>
get_bin();
272 void addObserver(std::shared_ptr<Parameter> observer);
ParameterMode
Defines the modes in which a parameter can operate.
@ FIXED
The parameter remains fixed at its expected value.
@ SHIFTABLE
The parameter value is shifted by an additive offset.
Represents a single parameter with value, uncertainties, and dependency links.
scalar_t deviation_syst
Systematic standard deviation.
virtual void unfreeze()
Hook to unfreeze the parameter.
std::optional< double > scale
Optional renormalization scale associated with the parameter.
ParameterMode mode
Current operating mode.
Parameter & operator+=(const Parameter &other)
Adds another parameter payload to this one.
std::vector< std::shared_ptr< Parameter > > observers
Observers notified when this parameter changes.
void set_id(ParamId id)
Replaces the identifier of the parameter.
void notifyParamObserversOnly()
Notifies only parameter observers.
void addObserver(std::shared_ptr< Parameter > observer)
Adds an observer parameter.
scalar_t expected
Expected value of the parameter.
virtual void clear_below()
Recursively clears downstream dependencies below this parameter.
Parameter()
Default constructor.
double get_scale()
Returns the parameter scale metadata.
virtual ~Parameter()=default
Virtual destructor.
virtual std::unordered_map< ParamId, std::shared_ptr< Parameter > > get_source_parameters() const
Returns the source parameters this parameter depends on.
friend std::ostream & operator<<(std::ostream &os, const Parameter &p)
Stream output operator for a parameter.
void set_expected(scalar_t val)
Sets the expected value and notifies dependents.
void set_owner(ParameterType type)
Changes the owner ParameterType part of the identifier.
Parameter & operator=(const Parameter &other)
Assignment operator.
void overwrite_payload_from(const Parameter &other)
Overwrites the numerical/configuration payload from another parameter.
virtual void clear_above()
Hook to clear upstream dependencies.
scalar_t deviation_stat
Statistical standard deviation.
void set_bin(std::pair< double, double > bin)
Sets the binning metadata of the parameter.
virtual scalar_t get_val() const
Returns the current value of the parameter.
std::pair< scalar_t, scalar_t > get_std() const
Returns statistical and systematic uncertainties separately.
void removeObserver(std::shared_ptr< Parameter > observer)
Removes an observer parameter.
void set_expected_silent(scalar_t val)
Sets the expected value without notifying observers.
ParamId id
Unique identifier for the parameter.
std::pair< double, double > get_bin()
Returns the parameter bin metadata.
std::optional< std::pair< double, double > > binning
Optional energy bin [low, high] associated with the parameter.
virtual void update()
Hook called when an upstream dependency changes.
std::weak_ptr< Block > get_owner_block() const
Returns the owning block of this parameter.
void set_owner_block(std::weak_ptr< Block > owner)
Sets the owning block of this parameter.
void set_std(scalar_t stat, scalar_t syst)
Sets the statistical and systematic uncertainties.
ParamId get_id() const
Returns the identifier of the parameter.
Parameter & operator*=(const scalar_t &scale)
Multiplies the parameter by a scalar factor.
scalar_t shift
Additive shift applied when the parameter is SHIFTABLE.
virtual void freeze()
Hook to freeze the parameter.
scalar_t get_combined_std() const
Returns the combined standard deviation.
void set_scale(double scale)
Sets the parameter scale metadata.
void notifyObservers()
Notifies downstream parameter observers and then the owner block.
void set_shift(scalar_t shift)
Sets the additive shift of the parameter.
void set_mode(ParameterMode mode)
Sets the parameter mode.
std::weak_ptr< Block > owner_block
Owning Block (if any) that this parameter belongs to.
Composite identifier for a single parameter.