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

High-level orchestrator for Wilson coefficient groups. More...

#include <WilsonManager.h>

Public Member Functions

 CoefficientManager (WilsonPortsConfig ports_config)
 
 CoefficientManager (const CoefficientManager &)=delete
 
CoefficientManager operator= (const CoefficientManager &)=delete
 
void set_matching_scale (double mu_W)
 Switches to matching scale context and sets mu_W via scale_setter_api.
 
void set_hadronic_scale (double mu_h)
 Switches to hadronic scale context and sets mu_h via scale_setter_api.
 
void ensure_sm_intermediate_and_copy_to_final (const std::string &groupName, QCDOrder order, WilsonPortsConfig &ports_config)
 Ensures an SM intermediate matching block exists and copies SM entries into the final block.
 
void compose_missing_from_calculation (const std::string &groupName, QCDOrder order, WilsonPortsConfig &ports_config)
 For a given group/order, composes the “missing piece” of the triplet using algebraic relations.
 
void compose_from_fwcoef (const std::string &groupName, QCDOrder order, WilsonPortsConfig &ports_config)
 Composes matching triplets from an input FWCOEF-like block into final storage block.
 
void ensure_matching_triplet_zeroed (const std::string &groupName, QCDOrder o)
 Ensures that, for a given order, SM/BSM/TOTAL slots exist and are set to 0 in the group matching block.
 
void ensure_sm_model_triplet_in_matching (const std::string &groupName, QCDOrder max_order)
 Ensures SM-model semantics: BSM=0 and TOTAL=SM for all coefficients up to max_order in final matching block.
 
void ensure_final_triplet_defaults_zero (const std::string &groupName, QCDOrder max_order)
 Ensures final matching block has triplet parameters defined (SM/BSM/TOTAL) defaulting to zero if absent.
 
void registerCoefficientGroup (const std::string &groupName, std::shared_ptr< CoefficientGroup > group)
 Registers a coefficient group under a given name.
 
void init_group_matching (const std::string &groupName, const std::string &order)
 Initializes matching-side parameters for a group up to order.
 
void init_group_hadronic (const std::string &groupName, const std::string &order, WilsonBasis id)
 Initializes hadronic (running) block for one basis.
 
void init_group_hadronic_all_bases (const std::string &groupName, const std::string &order)
 Initializes hadronic blocks for all bases supported by the group.
 
void init_specific_order_group_matching (const std::string &groupName, const std::string &order, bool only_total)
 Initializes matching parameters for a specific QCD order.
 
void add_matching_patch (const WilsonMatchingPatch &patch)
 Add one additive matching patch and apply it to already-registered groups when relevant.
 
void add_matching_patches (const std::vector< WilsonMatchingPatch > &patches)
 Add several additive matching patches.
 
void update (double mu_W, double mu_h)
 Updates the manager by changing scales (delegates to set_matching_scale / set_hadronic_scale).
 
void fill_sources_for_group (const std::string &groupName, const std::string &order, std::unordered_map< ParameterType, std::vector< std::string > > &src, WilsonBasis id)
 Gathers source block names needed to build hadronic/running block dependencies.
 
void fill_matching_groups (const std::string &groupName, const std::string &order)
 Ensures missing higher-order matching triplets are present/zeroed when only lower order is requested.
 
std::string getModel ()
 Returns current model as a string (via model_api).
 
std::shared_ptr< CoefficientGroupgetCoefficientGroup (const std::string &groupName) const
 Retrieves a registered coefficient group by name (throws/logs on missing).
 
std::map< std::string, std::shared_ptr< CoefficientGroup > > getGroups ()
 Returns all registered groups.
 
std::unordered_set< WilsonBasisgetGroupBases (WGroupId group)
 Returns bases supported by the group (delegates to CoefficientGroup::get_bases()).
 
complex_t getMatchingCoefficient (const std::string &groupName, const std::string &coeffName, const std::string &order, ContributionType cont_type)
 Returns matching coefficient (raw, order slot) for a given contribution type.
 
complex_t getFullMatchingCoefficient (const std::string &groupName, const std::string &coeffName, const std::string &order, ContributionType cont_type)
 Returns “full” matching coefficient including perturbative prefactor powers.
 
complex_t getRunCoefficient (const std::string &groupName, const std::string &coeffName, const std::string &order, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD)
 Returns running/hadronic coefficient (raw, order slot) for given basis and contribution type.
 
complex_t getFullRunCoefficient (const std::string &groupName, const std::string &coeffName, const std::string &order, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD)
 Returns “full” running coefficient including perturbative prefactor powers.
 
void printGroupCoefficients (const std::string &groupName) const
 Debug helper (currently stubby in implementation).
 
 ~CoefficientManager ()
 Destructor.
 

Static Public Member Functions

static std::shared_ptr< CoefficientManagerBuilder (std::map< std::string, std::shared_ptr< CoefficientGroup > > groups, double mu_W, double mu_h, std::string order, WilsonPortsConfig portconfig, std::map< Model, std::shared_ptr< IWilsonParameterHelper > > wilson_param_helpers={})
 Factory that builds and initializes a manager from pre-created groups.
 

Detailed Description

High-level orchestrator for Wilson coefficient groups.

The manager owns a registry of groups (by name) and composes all missing blocks/parameters so that:

  • matching coefficients are available in a “final matching block” (GroupMapper::... MATCHING),
  • hadronic/run coefficients are available in hadronic blocks (ScaleType::HADRONIC, per basis),
  • SM/BSM/TOTAL triplets exist consistently for each member coefficient and QCD order.

Key responsibilities:

1) Matching initialization (init_group_matching / init_specific_order_group_matching)

  • If there is no input Wilson block:
    • compute coefficients (group->init(order)) unless "only_total" is requested,
    • if model==SM: enforce BSM=0 and TOTAL=SM,
    • else (BSM model): ensure an SM intermediate group exists and copy SM -> final, then compose missing part (TOTAL or BSM) depending on backend.
  • If there is input Wilson block (FWCOEF):
    • ensure the SM intermediate block exists (SM group),
    • compose SM from FWCOEF when available (or from TOT-BSM if both exist),
    • compose BSM and TOTAL into the final block with copy/subtraction rules.

2) Hadronic initialization (init_group_hadronic / init_group_hadronic_all_bases)

  • Builds hadronic blocks by reading the matching block items and applying the group running functions per basis and QCD order.

3) Scale management

Notes on “blocks”:

  • Final matching block name is typically: GroupMapper::str(gid, ScaleType::MATCHING).
  • SM intermediate block name is: final + "_SM".
  • FWCOEF block is "FWCOEF".

Lifetime:

Definition at line 180 of file WilsonManager.h.

Constructor & Destructor Documentation

◆ CoefficientManager() [1/2]

CoefficientManager::CoefficientManager ( WilsonPortsConfig  ports_config)
inline

Definition at line 201 of file WilsonManager.h.

◆ CoefficientManager() [2/2]

CoefficientManager::CoefficientManager ( const CoefficientManager )
delete

◆ ~CoefficientManager()

CoefficientManager::~CoefficientManager ( )

Destructor.

Clears composed blocks/parameters from the dependency engine to avoid stale state leaking across runs.

Definition at line 939 of file WilsonManager.cpp.

Member Function Documentation

◆ add_matching_patch()

void CoefficientManager::add_matching_patch ( const WilsonMatchingPatch patch)

Add one additive matching patch and apply it to already-registered groups when relevant.

Definition at line 163 of file WilsonManager.cpp.

◆ add_matching_patches()

void CoefficientManager::add_matching_patches ( const std::vector< WilsonMatchingPatch > &  patches)

Add several additive matching patches.

Definition at line 186 of file WilsonManager.cpp.

◆ Builder()

std::shared_ptr< CoefficientManager > CoefficientManager::Builder ( std::map< std::string, std::shared_ptr< CoefficientGroup > >  groups,
double  mu_W,
double  mu_h,
std::string  order,
WilsonPortsConfig  portconfig,
std::map< Model, std::shared_ptr< IWilsonParameterHelper > >  wilson_param_helpers = {} 
)
static

Factory that builds and initializes a manager from pre-created groups.

This method:

  • ensures Wilson parameter helpers are initialized (if provided),
  • registers all provided groups in the manager,
  • sets matching/hadronic scales,
  • initializes matching + hadronic blocks for each group up to the requested QCD order.
Parameters
groupsMap of groupName -> group instance.
mu_WMatching scale.
mu_hHadronic scale.
orderMax order string ("LO"/"NLO"/"NNLO").
portconfigServices and hooks needed by the manager.
wilson_param_helpersOptional per-model helpers that compose WPARAM blocks/matrices.

Definition at line 952 of file WilsonManager.cpp.

◆ compose_from_fwcoef()

void CoefficientManager::compose_from_fwcoef ( const std::string &  groupName,
QCDOrder  order,
WilsonPortsConfig ports_config 
)

Composes matching triplets from an input FWCOEF-like block into final storage block.

Handles cases where FWCOEF provides:

  • SM directly,
  • (TOTAL and BSM), allowing reconstruction of SM = TOTAL - BSM,
  • only TOTAL or only BSM (fills missing with 0 or with algebra when possible).

Definition at line 359 of file WilsonManager.cpp.

◆ compose_missing_from_calculation()

void CoefficientManager::compose_missing_from_calculation ( const std::string &  groupName,
QCDOrder  order,
WilsonPortsConfig ports_config 
)

For a given group/order, composes the “missing piece” of the triplet using algebraic relations.

Depending on backend and what is computed:

  • builtin path tends to compute SM and BSM separately, then compose TOTAL = SM + BSM,
  • Marty path tends to provide TOTAL, then we compose BSM = TOTAL - SM (or vice-versa).

Definition at line 470 of file WilsonManager.cpp.

◆ ensure_final_triplet_defaults_zero()

void CoefficientManager::ensure_final_triplet_defaults_zero ( const std::string &  groupName,
QCDOrder  max_order 
)

Ensures final matching block has triplet parameters defined (SM/BSM/TOTAL) defaulting to zero if absent.

Definition at line 201 of file WilsonManager.cpp.

◆ ensure_matching_triplet_zeroed()

void CoefficientManager::ensure_matching_triplet_zeroed ( const std::string &  groupName,
QCDOrder  o 
)

Ensures that, for a given order, SM/BSM/TOTAL slots exist and are set to 0 in the group matching block.

Definition at line 323 of file WilsonManager.cpp.

◆ ensure_sm_intermediate_and_copy_to_final()

void CoefficientManager::ensure_sm_intermediate_and_copy_to_final ( const std::string &  groupName,
QCDOrder  order,
WilsonPortsConfig ports_config 
)

Ensures an SM intermediate matching block exists and copies SM entries into the final block.

This is a crucial step for BSM models: we compute or retrieve SM contributions in a dedicated "<MATCHING>_SM" block, then compose dependent parameters that copy those values into the final block (SM slot of the SM/BSM/TOTAL triplet).

Parameters
groupNameGroup string key.
orderMax order to initialize/copy.
ports_configService wiring (uses build_group hook if present).

Definition at line 236 of file WilsonManager.cpp.

◆ ensure_sm_model_triplet_in_matching()

void CoefficientManager::ensure_sm_model_triplet_in_matching ( const std::string &  groupName,
QCDOrder  max_order 
)

Ensures SM-model semantics: BSM=0 and TOTAL=SM for all coefficients up to max_order in final matching block.

Definition at line 516 of file WilsonManager.cpp.

◆ fill_matching_groups()

void CoefficientManager::fill_matching_groups ( const std::string &  groupName,
const std::string &  order 
)

Ensures missing higher-order matching triplets are present/zeroed when only lower order is requested.

Example: if order==LO, ensures NLO and NNLO triplets exist and are set to zero, so later computations do not fail when expecting presence of those parameters.

Definition at line 346 of file WilsonManager.cpp.

◆ fill_sources_for_group()

void CoefficientManager::fill_sources_for_group ( const std::string &  groupName,
const std::string &  order,
std::unordered_map< ParameterType, std::vector< std::string > > &  src,
WilsonBasis  id 
)

Gathers source block names needed to build hadronic/running block dependencies.

This collects sources for LO/NLO/NNLO up to the requested order for a given basis.

Definition at line 641 of file WilsonManager.cpp.

◆ getCoefficientGroup()

std::shared_ptr< CoefficientGroup > CoefficientManager::getCoefficientGroup ( const std::string &  groupName) const

Retrieves a registered coefficient group by name (throws/logs on missing).

Definition at line 919 of file WilsonManager.cpp.

◆ getFullMatchingCoefficient()

complex_t CoefficientManager::getFullMatchingCoefficient ( const std::string &  groupName,
const std::string &  coeffName,
const std::string &  order,
ContributionType  cont_type 
)

Returns “full” matching coefficient including perturbative prefactor powers.

Uses fact = alpha_s(mu_W)/(4π) (read from WPARAM_MATCH_SM) and sums: C_full = C_LO + fact*C_NLO + fact^2*C_NNLO (up to requested order).

Definition at line 889 of file WilsonManager.cpp.

◆ getFullRunCoefficient()

complex_t CoefficientManager::getFullRunCoefficient ( const std::string &  groupName,
const std::string &  coeffName,
const std::string &  order,
ContributionType  cont_type,
WilsonBasis  basis = WilsonBasis::B_STANDARD 
)

Returns “full” running coefficient including perturbative prefactor powers.

Uses fact = alpha_s(mu_b)/(4π) (read from WPARAM_RUN_SM) and sums: C_full = C_LO + fact*C_NLO + fact^2*C_NNLO (up to requested order).

Definition at line 905 of file WilsonManager.cpp.

◆ getGroupBases()

std::unordered_set< WilsonBasis > CoefficientManager::getGroupBases ( WGroupId  group)

Returns bases supported by the group (delegates to CoefficientGroup::get_bases()).

Definition at line 931 of file WilsonManager.cpp.

◆ getGroups()

std::map< std::string, std::shared_ptr< CoefficientGroup > > CoefficientManager::getGroups ( )

Returns all registered groups.

Definition at line 927 of file WilsonManager.cpp.

◆ getMatchingCoefficient()

complex_t CoefficientManager::getMatchingCoefficient ( const std::string &  groupName,
const std::string &  coeffName,
const std::string &  order,
ContributionType  cont_type 
)

Returns matching coefficient (raw, order slot) for a given contribution type.

Definition at line 883 of file WilsonManager.cpp.

◆ getModel()

std::string CoefficientManager::getModel ( )

Returns current model as a string (via model_api).

Definition at line 315 of file WilsonManager.cpp.

◆ getRunCoefficient()

complex_t CoefficientManager::getRunCoefficient ( const std::string &  groupName,
const std::string &  coeffName,
const std::string &  order,
ContributionType  cont_type,
WilsonBasis  basis = WilsonBasis::B_STANDARD 
)

Returns running/hadronic coefficient (raw, order slot) for given basis and contribution type.

Definition at line 899 of file WilsonManager.cpp.

◆ init_group_hadronic()

void CoefficientManager::init_group_hadronic ( const std::string &  groupName,
const std::string &  order,
WilsonBasis  id 
)

Initializes hadronic (running) block for one basis.

Reads matching coefficients from the group matching block, applies the basis running function for each contribution type (SM/BSM/TOTAL) and for each order <= requested order, and stores results in the hadronic block (ScaleType::HADRONIC, basis).

Definition at line 688 of file WilsonManager.cpp.

◆ init_group_hadronic_all_bases()

void CoefficientManager::init_group_hadronic_all_bases ( const std::string &  groupName,
const std::string &  order 
)

Initializes hadronic blocks for all bases supported by the group.

Definition at line 873 of file WilsonManager.cpp.

◆ init_group_matching()

void CoefficientManager::init_group_matching ( const std::string &  groupName,
const std::string &  order 
)

Initializes matching-side parameters for a group up to order.

Definition at line 319 of file WilsonManager.cpp.

◆ init_specific_order_group_matching()

void CoefficientManager::init_specific_order_group_matching ( const std::string &  groupName,
const std::string &  order,
bool  only_total 
)

Initializes matching parameters for a specific QCD order.

Parameters
groupNameGroup string key.
orderQCD order string.
only_totalIf true, avoid calling group->init(order) (useful for workflows that only need TOTAL).

Definition at line 557 of file WilsonManager.cpp.

◆ operator=()

CoefficientManager CoefficientManager::operator= ( const CoefficientManager )
delete

◆ printGroupCoefficients()

void CoefficientManager::printGroupCoefficients ( const std::string &  groupName) const

Debug helper (currently stubby in implementation).

Definition at line 935 of file WilsonManager.cpp.

◆ registerCoefficientGroup()

void CoefficientManager::registerCoefficientGroup ( const std::string &  groupName,
std::shared_ptr< CoefficientGroup group 
)

Registers a coefficient group under a given name.

Definition at line 915 of file WilsonManager.cpp.

◆ set_hadronic_scale()

void CoefficientManager::set_hadronic_scale ( double  mu_h)

Switches to hadronic scale context and sets mu_h via scale_setter_api.

Definition at line 983 of file WilsonManager.cpp.

◆ set_matching_scale()

void CoefficientManager::set_matching_scale ( double  mu_W)

Switches to matching scale context and sets mu_W via scale_setter_api.

Definition at line 988 of file WilsonManager.cpp.

◆ update()

void CoefficientManager::update ( double  mu_W,
double  mu_h 
)

Updates the manager by changing scales (delegates to set_matching_scale / set_hadronic_scale).

Definition at line 947 of file WilsonManager.cpp.


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