Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
WilsonCoefficientRegistry.h File Reference

Factory registry for creating concrete WilsonCoefficient objects by (coefficient, model, backend). More...

#include <functional>
#include <memory>
#include <unordered_map>
#include "GroupDefinition.h"
#include "Wilson.h"
Include dependency graph for WilsonCoefficientRegistry.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CoefficientRegistry
 Registry mapping (WCoef, Model, Backend) -> coefficient factory function. More...
 

Typedefs

using CoefPtr = std::shared_ptr< WilsonCoefficient >
 Shared pointer type used to store coefficients in groups.
 
using CoefMaker = std::function< CoefPtr(const BuildContext &, WCoef)>
 Factory signature for constructing a coefficient instance given a build context and enum id.
 

Functions

void register_B (CoefficientRegistry &)
 Registers coefficient factories for the B group (C1..C10).
 
void register_BPrime (CoefficientRegistry &)
 Registers coefficient factories for the B' group (CP1..CP10, CPQ1, CPQ2).
 
void register_BScalar (CoefficientRegistry &)
 Registers coefficient factories for the scalar B group (CQ1, CQ2).
 
void register_CC_bc (CoefficientRegistry &)
 Registers coefficient factories for charged-current b->c (C_V1_bc, ...).
 
void register_CC_bu (CoefficientRegistry &)
 Registers coefficient factories for charged-current b->u (C_V1_bu, ...).
 
void register_CC_cs (CoefficientRegistry &)
 Registers coefficient factories for charged-current c->s (C_V1_cs, ...).
 
void register_CC_cd (CoefficientRegistry &)
 Registers coefficient factories for charged-current c->d (C_V1_cd, ...).
 
void register_CC_su (CoefficientRegistry &)
 Registers coefficient factories for charged-current s->u (C_V1_su, ...).
 
void register_CC_du (CoefficientRegistry &)
 Registers coefficient factories for charged-current d->u (C_V1_du, ...).
 
void register_MesonMixing (CoefficientRegistry &)
 Registers coefficient factories for meson mixing coefficients.
 
void register_K (CoefficientRegistry &reg)
 Registers coefficient factories for the K group (CK9, CK10, ...).
 

Detailed Description

Factory registry for creating concrete WilsonCoefficient objects by (coefficient, model, backend).

This header defines CoefficientRegistry, a lightweight runtime registry used to build the concrete WilsonCoefficient objects that populate a CoefficientGroup.

Motivation

In the domain layer, a same Wilson coefficient (e.g. C1) can have multiple concrete implementations depending on:

  • the active physics Model (SM / SUSY / THDM / ...),
  • the selected computation Backend (Builtin vs Marty).

Rather than hard-coding large switch statements in group builders, this registry provides:

  • explicit registration of "creator" functions (factories),
  • a single create() entry point with well-defined fallback rules.

Fallback rules implemented by @ref CoefficientRegistry::create

When create(ctx, c) is called: 1) Try exact match (c, ctx.model, ctx.backend). 2) For a non-SM model using the MARTY backend, route supported SM/BSM requests through the registered SM/MARTY factory while preserving the original build context. The factory then instantiates the target model. 3) Otherwise, if backend is Marty, fallback to Builtin for the same model. 4) If model is not SM, fallback to SM for the same backend.

If none match, an exception is thrown.

Typical usage

register_B(reg); // registers creators for the B group coefficients
auto c1 = reg.create(ctx, WCoef::C1);
void register_B(CoefficientRegistry &reg)
Registers coefficient factories for the B group (C1..C10).
Registry mapping (WCoef, Model, Backend) -> coefficient factory function.
CoefPtr create(const BuildContext &ctx, WCoef c) const
Creates a coefficient instance according to the provided build context.
Build-time context passed to group setup hooks.

Registration is typically done per group (see the free functions register_*) in a dedicated translation unit.

See also
BuildContext
GroupDefinition
CoefficientGroup
WilsonCoefficient

Definition in file WilsonCoefficientRegistry.h.

Typedef Documentation

◆ CoefMaker

using CoefMaker = std::function<CoefPtr(const BuildContext&, WCoef)>

Factory signature for constructing a coefficient instance given a build context and enum id.

Definition at line 64 of file WilsonCoefficientRegistry.h.

◆ CoefPtr

using CoefPtr = std::shared_ptr<WilsonCoefficient>

Shared pointer type used to store coefficients in groups.

Definition at line 61 of file WilsonCoefficientRegistry.h.

Function Documentation

◆ register_B()

void register_B ( CoefficientRegistry reg)

Registers coefficient factories for the B group (C1..C10).

Implementations typically register:

  • Builtin SM/SUSY/THDM concrete classes,
  • optional Marty creators for SM (and later for other models).

Definition at line 155 of file WilsonCoefficientRegistry.cpp.

◆ register_BPrime()

void register_BPrime ( CoefficientRegistry reg)

Registers coefficient factories for the B' group (CP1..CP10, CPQ1, CPQ2).

Definition at line 205 of file WilsonCoefficientRegistry.cpp.

◆ register_BScalar()

void register_BScalar ( CoefficientRegistry reg)

Registers coefficient factories for the scalar B group (CQ1, CQ2).

Definition at line 272 of file WilsonCoefficientRegistry.cpp.

◆ register_CC_bc()

void register_CC_bc ( CoefficientRegistry reg)

Registers coefficient factories for charged-current b->c (C_V1_bc, ...).

Definition at line 306 of file WilsonCoefficientRegistry.cpp.

◆ register_CC_bu()

void register_CC_bu ( CoefficientRegistry reg)

Registers coefficient factories for charged-current b->u (C_V1_bu, ...).

Definition at line 333 of file WilsonCoefficientRegistry.cpp.

◆ register_CC_cd()

void register_CC_cd ( CoefficientRegistry reg)

Registers coefficient factories for charged-current c->d (C_V1_cd, ...).

Definition at line 387 of file WilsonCoefficientRegistry.cpp.

◆ register_CC_cs()

void register_CC_cs ( CoefficientRegistry reg)

Registers coefficient factories for charged-current c->s (C_V1_cs, ...).

Definition at line 360 of file WilsonCoefficientRegistry.cpp.

◆ register_CC_du()

void register_CC_du ( CoefficientRegistry reg)

Registers coefficient factories for charged-current d->u (C_V1_du, ...).

Definition at line 441 of file WilsonCoefficientRegistry.cpp.

◆ register_CC_su()

void register_CC_su ( CoefficientRegistry reg)

Registers coefficient factories for charged-current s->u (C_V1_su, ...).

Definition at line 414 of file WilsonCoefficientRegistry.cpp.

◆ register_K()

void register_K ( CoefficientRegistry reg)

Registers coefficient factories for the K group (CK9, CK10, ...).

Definition at line 512 of file WilsonCoefficientRegistry.cpp.

◆ register_MesonMixing()

void register_MesonMixing ( CoefficientRegistry reg)

Registers coefficient factories for meson mixing coefficients.

Definition at line 469 of file WilsonCoefficientRegistry.cpp.