Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
DecayParent Class Referenceabstract

Abstract base class for a decay/observable module. More...

#include <DecayParent.h>

Inheritance diagram for DecayParent:
Collaboration diagram for DecayParent:

Public Member Functions

virtual ~DecayParent ()=default
 
 DecayParent (DecayId custom_id, double matching_scale, double hadronic_scale, QCDOrder order, ObservablePortsConfig &ports)
 Construct a decay module and bind it to the observable ports.
 
void bind_wilson_builder (std::shared_ptr< IObsWilsonBuilder > &wilson_builder)
 Bind a Wilson builder to this decay.
 
void enable ()
 Enable the decay module (build Wilson groups and load parameters).
 
void disable ()
 Disable the decay module.
 
void set_order (QCDOrder new_order)
 Set the QCD order for this decay (one-shot policy).
 
virtual void load_params ()=0
 Load and cache parameters needed by this decay.
 
virtual std::vector< ObservableValuecompute_observable (Observables obs)=0
 Compute an observable given a public observable enum.
 
virtual std::vector< ObservableValuecompute_observable (ObservableId obs)=0
 Compute an observable given an internal observable identifier.
 
virtual void set_config (std::any cfg)=0
 Set a configuration blob for this decay.
 
virtual std::any get_config () const
 Return the current decay configuration when the decay has one.
 
virtual void set_n_threads (size_t n_threads)
 Set the number of worker threads used by decays that support parallel cache filling.
 
virtual size_t get_n_threads () const
 Return the currently configured worker-thread count.
 
virtual bool supports_thread_config () const
 Whether this decay supports runtime thread configuration.
 
void set_bins (std::vector< std::pair< double, double > > new_bins)
 Set the binning for the observables related to this decay.
 
void add_bin (std::pair< double, double > new_bin)
 Adds a bin to the observables related to this decay.
 
std::optional< std::vector< std::pair< double, double > > > get_bins ()
 Returns the current binning of the decay.
 
DecayId get_id ()
 Return the decay identifier.
 
QCDOrder get_order () const
 Return the currently configured QCD order for this decay.
 
bool is_enabled () const
 Return whether the decay has already been enabled.
 
bool is_binned () const
 Return whether this decay has at least one observable requiring q² bins.
 
virtual bool is_observable_binned (ObservableId) const
 Return whether one observable of this decay requires q² bins.
 
virtual bool is_observable_binned (Observables obs) const
 Convenience overload for public observable enum ids.
 

Protected Member Functions

QCDOrder check_max_order (QCDOrder order) const
 Clamp a requested QCD order to this decay's supported maximum.
 

Protected Attributes

QCDOrder max_order = QCDOrder::LO
 Maximum QCD order supported by this decay module (default: LO).
 
ObservablePortsConfigports
 Reference to the ports/configuration wiring this decay to the framework.
 
std::shared_ptr< IObsWilsonBuilderw_builder
 Wilson builder used to build/add Wilson groups for this decay.
 
std::shared_ptr< IObsWilsonProxyw_proxy
 Wilson proxy used at compute-time to query coefficients (matching/run).
 
std::shared_ptr< IObsCoreAPI< bool > > use_marty
 Port exposing whether the MARTY backend is active.
 
std::shared_ptr< IObsParameterProxy< ParamId, DataType, std::string, LhaID > > p
 Parameter proxy for SM-like quantities used by the decay (may be SM/BSM depending on wiring).
 
std::shared_ptr< IObsQCDProxyiobs_qcdp
 QCD proxy (alpha_s, running masses, constants...).
 
std::shared_ptr< IWilsonFreezer< WGroupId > > iobs_wfreezer
 Freezer to freeze/unfreeze Wilson blocks when they are not needed by active decays.
 
std::shared_ptr< ObsWilsonHelperw_helper
 Per-manager Wilson lifecycle helper.
 
WilsonBuildConfig w_config {}
 Wilson build configuration used when enabling this decay (scales, order, groups).
 
bool enabled {false}
 Whether the decay is enabled (i.e. Wilson groups built and parameters loaded).
 
bool binned {false}
 Whether this decay requires q² bins before its observables can be computed.
 
DecayId id
 Unique decay identifier.
 
std::optional< std::vector< std::pair< double, double > > > bins
 Optional q^2 bins.
 

Detailed Description

Abstract base class for a decay/observable module.

Responsibilities

  • Holds the module identifier (DecayId)
  • Stores the requested Wilson build configuration (WilsonBuildConfig) (matching/hadronic scales + QCD order)
  • Owns references/pointers to all required "ports":
    • Wilson builder/proxy
    • parameter proxies
    • QCD proxy
    • freezer (to freeze/unfreeze Wilson blocks)
  • Implements the lifecycle:
    • enable builds/activates the module (build Wilson groups, bind proxy, load params)
    • disable disables computation without destroying the object

Lifecycle

Typical usage is:

MyDecay d(id, muW, muh, QCDOrder::NLO, ports);
d.enable(); // builds required Wilson groups and loads parameters
auto obs = d.compute_observable(Observables::SOME_OBS);
ObservablePortsConfig & ports
Reference to the ports/configuration wiring this decay to the framework.
Definition DecayParent.h:93

Calling enable twice is safe (it becomes a no-op after first enable).

QCD order and MARTY backend

  • The decay declares a maximum supported order via max_order (default LO).
  • The constructor stores the requested order, but it is clamped by check_max_order.
  • If MARTY is enabled (ports.iobs_use_marty), the effective order is limited to LO.
Note
The actual Wilson construction and caching policy is handled externally via ObsWilsonHelper and the IWilsonFreezer port.

Definition at line 87 of file DecayParent.h.

Constructor & Destructor Documentation

◆ ~DecayParent()

virtual DecayParent::~DecayParent ( )
virtualdefault

◆ DecayParent()

DecayParent::DecayParent ( DecayId  custom_id,
double  matching_scale,
double  hadronic_scale,
QCDOrder  order,
ObservablePortsConfig ports 
)

Construct a decay module and bind it to the observable ports.

The constructor does NOT build Wilson groups. That happens in enable. It stores the scales and the requested QCD order (clamped to max_order).

Parameters
custom_idIdentifier of the decay module.
matching_scaleMatching scale mu_W used for Wilson matching.
hadronic_scaleHadronic scale mu_h used for running/evolution.
orderRequested QCD order (will be clamped to max_order).
portsPorts configuration providing dependencies.

Definition at line 13 of file DecayParent.cpp.

Member Function Documentation

◆ add_bin()

void DecayParent::add_bin ( std::pair< double, double >  new_bin)

Adds a bin to the observables related to this decay.

Parameters
new_binsDesired bin in the form of {q²_min, q²_max}

Definition at line 98 of file DecayParent.cpp.

◆ bind_wilson_builder()

void DecayParent::bind_wilson_builder ( std::shared_ptr< IObsWilsonBuilder > &  wilson_builder)

Bind a Wilson builder to this decay.

This is typically used internally by the constructor (binding ports.iobswb), but can be called explicitly if the builder is swapped/replaced.

Parameters
wilson_builderBuilder used to build Wilson groups needed by this decay.

Definition at line 22 of file DecayParent.cpp.

◆ check_max_order()

QCDOrder DecayParent::check_max_order ( QCDOrder  order) const
protected

Clamp a requested QCD order to this decay's supported maximum.

If order is higher than max_order, a warning is emitted and max_order is returned.

Parameters
orderRequested order.
Returns
Effective order (clamped).

Definition at line 5 of file DecayParent.cpp.

◆ compute_observable() [1/2]

virtual std::vector< ObservableValue > DecayParent::compute_observable ( ObservableId  obs)
pure virtual

Compute an observable given an internal observable identifier.

Parameters
obsInternal observable id.
Returns
One or more results as ObservableValue.

Implemented in BDlnuDecay, BDstarlnuDecay, BKllDecay, BKstarllDecay, BKstarGammaDecay, BllDecay, BlnuDecay, BsPhiDecay, BXsDecay, BXsllDecay, DlnuDecay, DslnuDecay, KllDecay, KlnuDecay, KPinunuDecay, LbLllDecay, M0Mixing, LambdaDecay, and WilsonDecay.

◆ compute_observable() [2/2]

virtual std::vector< ObservableValue > DecayParent::compute_observable ( Observables  obs)
pure virtual

Compute an observable given a public observable enum.

Parameters
obsObservable enum id.
Returns
One or more results as ObservableValue.
Note
Some observables are binned; return multiple values or fill ObservableValue::bin.

Implemented in BDlnuDecay, BDstarlnuDecay, BKllDecay, BKstarllDecay, BKstarGammaDecay, BllDecay, BlnuDecay, BsPhiDecay, BXsDecay, BXsllDecay, DlnuDecay, DslnuDecay, KllDecay, KlnuDecay, KPinunuDecay, LbLllDecay, M0Mixing, LambdaDecay, and WilsonDecay.

◆ disable()

void DecayParent::disable ( )

Disable the decay module.

This only flips the enabled flag. It does not automatically unbuild or unfreeze Wilson groups; the global policy is handled by ObsWilsonHelper and the freezer port.

Definition at line 41 of file DecayParent.cpp.

◆ enable()

void DecayParent::enable ( )

Enable the decay module (build Wilson groups and load parameters).

Steps: 1) Build/update Wilson groups using ObsWilsonHelper::build with w_config 2) Acquire a Wilson proxy from the builder 3) Set a default basis (currently WilsonBasis::B_STANDARD) 4) Call load_params (implemented by derived class) 5) Mark the decay as enabled

Calling enable() multiple times is safe: if already enabled, Wilson groups are not rebuilt, but load_params() is called again to refresh cached inputs.

Definition at line 26 of file DecayParent.cpp.

◆ get_bins()

std::optional< std::vector< std::pair< double, double > > > DecayParent::get_bins ( )

Returns the current binning of the decay.

Definition at line 112 of file DecayParent.cpp.

◆ get_config()

virtual std::any DecayParent::get_config ( ) const
inlinevirtual

Return the current decay configuration when the decay has one.

The base implementation returns an empty std::any. Configurable decays that keep runtime options, such as form-factor source or internal thread count, override this so ObservableInterface worker clones can reproduce the same physics setup as the parent interface.

Reimplemented in BKllDecay, BKstarllDecay, BKstarGammaDecay, BsPhiDecay, and LbLllDecay.

Definition at line 253 of file DecayParent.h.

◆ get_id()

DecayId DecayParent::get_id ( )
inline

Return the decay identifier.

Definition at line 300 of file DecayParent.h.

◆ get_n_threads()

size_t DecayParent::get_n_threads ( ) const
virtual

Return the currently configured worker-thread count.

Decays that do not implement internal parallelism return 1.

Reimplemented in BKllDecay, BKstarllDecay, BsPhiDecay, and LbLllDecay.

Definition at line 82 of file DecayParent.cpp.

◆ get_order()

QCDOrder DecayParent::get_order ( ) const
inline

Return the currently configured QCD order for this decay.

Definition at line 305 of file DecayParent.h.

◆ is_binned()

bool DecayParent::is_binned ( ) const
inline

Return whether this decay has at least one observable requiring q² bins.

Bins are stored at decay level, but mixed decays may expose both binned and non-binned observables. Use is_observable_binned(...) for single-observable routing.

Definition at line 324 of file DecayParent.h.

◆ is_enabled()

bool DecayParent::is_enabled ( ) const
inline

Return whether the decay has already been enabled.

A decay is considered enabled after enable has built/acquired its Wilson proxy and loaded its parameters at least once. This is useful for manager-level refresh operations: disabled decays may not have a valid Wilson proxy yet and must not be asked to reload their parameters.

Definition at line 315 of file DecayParent.h.

◆ is_observable_binned() [1/2]

virtual bool DecayParent::is_observable_binned ( ObservableId  ) const
inlinevirtual

Return whether one observable of this decay requires q² bins.

Most decays are either fully binned or fully unbinned, but some mixed decays such as B -> K*ll also expose global observables like q0(A_FB).

Reimplemented in BKstarllDecay.

Definition at line 332 of file DecayParent.h.

◆ is_observable_binned() [2/2]

virtual bool DecayParent::is_observable_binned ( Observables  obs) const
inlinevirtual

Convenience overload for public observable enum ids.

Definition at line 335 of file DecayParent.h.

◆ load_params()

virtual void DecayParent::load_params ( )
pure virtual

Load and cache parameters needed by this decay.

Derived classes should read all relevant inputs through the proxies (e.g. p, w_proxy, iobs_qcdp) and store them internally.

This is called by enable after Wilson has been built and the proxy is ready.

Implemented in BDlnuDecay, BDstarlnuDecay, BKllDecay, BKstarllDecay, BKstarGammaDecay, BllDecay, BlnuDecay, BsPhiDecay, BXsDecay, BXsllDecay, DlnuDecay, DslnuDecay, KllDecay, KlnuDecay, KPinunuDecay, LbLllDecay, M0Mixing, LambdaDecay, and WilsonDecay.

◆ set_bins()

void DecayParent::set_bins ( std::vector< std::pair< double, double > >  new_bins)

Set the binning for the observables related to this decay.

Parameters
new_binsDesired binning in the form of {{q²_min, q²_max}, ...}

Definition at line 90 of file DecayParent.cpp.

◆ set_config()

virtual void DecayParent::set_config ( std::any  cfg)
pure virtual

Set a configuration blob for this decay.

This generic entry point allows the framework to pass a type-erased config. Most users should prefer inheriting from DecayParentConfigurable<T> to get a typed config setter.

Parameters
cfgType-erased configuration object.
Exceptions
std::bad_any_castif the derived class expects a different type.

Implemented in DecayParentConfigurable< T >, DecayParentConfigurable< BDlnuConfig >, DecayParentConfigurable< BDstarlnuConfig >, DecayParentConfigurable< BKllConfig >, DecayParentConfigurable< BKstarGammaConfig >, DecayParentConfigurable< BKstarllConfig >, DecayParentConfigurable< BsPhiConfig >, DecayParentConfigurable< BXsllConfig >, DecayParentConfigurable< KllDecayConfig >, DecayParentConfigurable< LbLllConfig >, LambdaDecay, and DecayParentConfigurable< DecayConfig >.

◆ set_n_threads()

void DecayParent::set_n_threads ( size_t  n_threads)
virtual

Set the number of worker threads used by decays that support parallel cache filling.

The default implementation warns and leaves the decay unchanged. Derived decays with long QCDf/integration caches can override this method. Passing 0 means "use hardware_concurrency" for decays that support it.

Parameters
n_threadsRequested number of threads.

Reimplemented in BKllDecay, BKstarllDecay, BsPhiDecay, and LbLllDecay.

Definition at line 72 of file DecayParent.cpp.

◆ set_order()

void DecayParent::set_order ( QCDOrder  new_order)

Set the QCD order for this decay (one-shot policy).

  • If MARTY is enabled and new_order > LO, it is downgraded to LO.
  • The requested order is clamped to the maximum supported by the decay.
  • Changing the order invalidates cached parameters and disables the decay; the next enable() call rebuilds Wilson groups if the helper detects that the build signature changed.
Parameters
new_orderRequested order.

Definition at line 45 of file DecayParent.cpp.

◆ supports_thread_config()

bool DecayParent::supports_thread_config ( ) const
virtual

Whether this decay supports runtime thread configuration.

Reimplemented in BKllDecay, BKstarllDecay, BsPhiDecay, and LbLllDecay.

Definition at line 86 of file DecayParent.cpp.

Member Data Documentation

◆ binned

bool DecayParent::binned {false}
protected

Whether this decay requires q² bins before its observables can be computed.

Definition at line 123 of file DecayParent.h.

◆ bins

std::optional<std::vector<std::pair<double, double> > > DecayParent::bins
protected

Optional q^2 bins.

Definition at line 129 of file DecayParent.h.

◆ enabled

bool DecayParent::enabled {false}
protected

Whether the decay is enabled (i.e. Wilson groups built and parameters loaded).

Definition at line 120 of file DecayParent.h.

◆ id

DecayId DecayParent::id
protected

Unique decay identifier.

Definition at line 126 of file DecayParent.h.

◆ iobs_qcdp

std::shared_ptr<IObsQCDProxy> DecayParent::iobs_qcdp
protected

QCD proxy (alpha_s, running masses, constants...).

Definition at line 108 of file DecayParent.h.

◆ iobs_wfreezer

std::shared_ptr<IWilsonFreezer<WGroupId> > DecayParent::iobs_wfreezer
protected

Freezer to freeze/unfreeze Wilson blocks when they are not needed by active decays.

Definition at line 111 of file DecayParent.h.

◆ max_order

QCDOrder DecayParent::max_order = QCDOrder::LO
protected

Maximum QCD order supported by this decay module (default: LO).

Definition at line 90 of file DecayParent.h.

◆ p

std::shared_ptr<IObsParameterProxy<ParamId, DataType, std::string, LhaID> > DecayParent::p
protected

Parameter proxy for SM-like quantities used by the decay (may be SM/BSM depending on wiring).

Definition at line 105 of file DecayParent.h.

◆ ports

ObservablePortsConfig& DecayParent::ports
protected

Reference to the ports/configuration wiring this decay to the framework.

Definition at line 93 of file DecayParent.h.

◆ use_marty

std::shared_ptr<IObsCoreAPI<bool> > DecayParent::use_marty
protected

Port exposing whether the MARTY backend is active.

Definition at line 102 of file DecayParent.h.

◆ w_builder

std::shared_ptr<IObsWilsonBuilder> DecayParent::w_builder
protected

Wilson builder used to build/add Wilson groups for this decay.

Definition at line 96 of file DecayParent.h.

◆ w_config

WilsonBuildConfig DecayParent::w_config {}
protected

Wilson build configuration used when enabling this decay (scales, order, groups).

Definition at line 117 of file DecayParent.h.

◆ w_helper

std::shared_ptr<ObsWilsonHelper> DecayParent::w_helper
protected

Per-manager Wilson lifecycle helper.

Definition at line 114 of file DecayParent.h.

◆ w_proxy

std::shared_ptr<IObsWilsonProxy> DecayParent::w_proxy
protected

Wilson proxy used at compute-time to query coefficients (matching/run).

Definition at line 99 of file DecayParent.h.


The documentation for this class was generated from the following files: