12static std::shared_ptr<CoefficientRegistry> make_registry() {
13 auto reg = std::make_shared<CoefficientRegistry>();
32 std::shared_ptr<IBlockComposer> iblock_c = std::make_shared<WilsonParamComposer>();
34 wilson_param_helpers[
Model::SM] = std::make_shared<WilsonParameterHelper>(iblock_c);
36 for (
const auto& elem : config.
groups) {
37 wilson_param_helpers[
Model::SM]->init(2, elem);
44 wilson_param_helpers[model] = std::make_shared<THDMParameterHelper>(iblock_c);
45 for (
const auto& elem : config.
groups) {
46 wilson_param_helpers[model]->init(2, elem);
50 wilson_param_helpers[model] = std::make_shared<SUSYParameterHelper>(iblock_c);
51 for (
const auto& elem : config.
groups) {
52 wilson_param_helpers[model]->init(2, elem);
58 std::shared_ptr<IParameterProxy<std::string, LhaID>> wilson_proxy = std::make_shared<ParameterProxy>(
ParameterType::WILSON);
59 std::shared_ptr<IParameterProxy<std::string, LhaID>> sm_proxy = std::make_shared<ParameterProxy>(
ParameterType::SM);
60 std::shared_ptr<ICoreAPI<bool>> use_marty = std::make_shared<UseMarty>();
61 std::shared_ptr<ICoreAPI<bool>> has_wilson = std::make_shared<HasWilsonAPI>();
62 std::shared_ptr<ICoreAPI<Model>> model_api = std::make_shared<ModelAPI>();
63 std::shared_ptr<IParamSetter<ScaleType>> scale_setter_api = std::make_shared<ScaleSetter>(
ScaleType::MATCHING);
64 std::shared_ptr<ICoreAPI<std::string>> marty_model_name = std::make_shared<MartyModelNameAPI>();
65 std::shared_ptr<ICoreAPI<fs::path>> marty_model_path = std::make_shared<MartyModelPathAPI>();
66 std::shared_ptr<IMartyWilsonProxy<InterpretedParam>> marty_proxy =
nullptr;
67 std::shared_ptr<IMartyWilsonPathProxy> marty_paths = std::make_shared<MartyWilsonPathProxy>();
68 std::shared_ptr<ICoreAPI<bool>> hard_coded_lo =
69 std::make_shared<SMFromHypProxy>();
70 if (use_marty->get()) {
71 marty_proxy = std::make_shared<MartyWilsonProxy>();
73 WilsonGroupAdapterConfig adapters(wilson_proxy, iblock_c, use_marty, marty_model_name, marty_model_path, marty_proxy);
75 this->current_group_adapters = std::make_shared<WilsonGroupAdapterConfig>(adapters);
76 this->current_marty_paths = marty_paths;
78 auto reg_ptr = make_registry();
79 auto build_group_fn = [reg_ptr, adapters, marty_paths](
WGroupId gid,
Model mdl,
bool useMarty,
ContributionType ct, std::string group_name =
"") -> std::shared_ptr<CoefficientGroup> {
86 .group_name = std::move(group_name),
87 .marty_paths = marty_paths
93 std::map<std::string, std::shared_ptr<CoefficientGroup>> groups;
94 const bool marty = use_marty->get();
96 for (
auto& g_id : config.
groups) {
105 auto grp = build_group_fn(g_id, model, marty, ct);
111 && !(hard_coded_lo && hard_coded_lo->get()))
117 WilsonPortsConfig port_config{iblock_c, wilson_proxy, use_marty, has_wilson, model_api, scale_setter_api, hard_coded_lo, marty_paths};
130 LOG_ERROR(
"LogicError",
"Cannot add Wilson groups before WilsonBuilder has been built.");
133 if (!this->current_group_adapters) {
134 LOG_ERROR(
"LogicError",
"WilsonBuilder has no cached group adapters for Wilson group registration.");
137 auto iblock_c = this->current_group_adapters->iblock_c;
140 wilson_param_helpers[
Model::SM] = std::make_shared<WilsonParameterHelper>(iblock_c);
143 for (
const auto& elem : config.
groups) {
144 wilson_param_helpers[
Model::SM]->init(2, elem);
150 if (!wilson_param_helpers[model]) {
151 wilson_param_helpers[model] = std::make_shared<THDMParameterHelper>(iblock_c);
153 for (
const auto& elem : config.
groups) {
154 wilson_param_helpers[model]->init(2, elem);
157 if (!wilson_param_helpers[model]) {
158 wilson_param_helpers[model] = std::make_shared<SUSYParameterHelper>(iblock_c);
160 for (
const auto& elem : config.
groups) {
161 wilson_param_helpers[model]->init(2, elem);
168 const bool marty = this->current_group_adapters->use_marty->get();
169 auto hard_coded_lo = std::make_shared<SMFromHypProxy>();
172 && !(hard_coded_lo && hard_coded_lo->get()))
177 auto reg_ptr = make_registry();
179 auto marty_paths = this->current_marty_paths
180 ? this->current_marty_paths
181 : std::make_shared<MartyWilsonPathProxy>();
183 for (
auto& g_id : config.
groups) {
194 .
adapters = *this->current_group_adapters,
199 .marty_paths = marty_paths
202 auto grp = b.build(ctx);
206 this->cm->registerCoefficientGroup(group_name, std::move(grp));
207 LOG_VERBOSE(
"Initializing group at matching scale", group_name);
209 LOG_VERBOSE(
"Initializing group at hardronic scale", group_name);
217 LOG_ERROR(
"LogicError",
"Cannot add a custom Wilson group before WilsonBuilder has been built.");
220 if (!this->current_group_adapters) {
221 LOG_ERROR(
"LogicError",
"WilsonBuilder has no cached group adapters for custom Wilson group registration.");
233 this->cm->registerCoefficientGroup(group_name, std::move(group));
241 LOG_ERROR(
"LogicError",
"Cannot add a Wilson matching patch before WilsonBuilder has been built.");
243 this->cm->add_matching_patch(patch);
248 LOG_ERROR(
"LogicError",
"Cannot add Wilson matching patches before WilsonBuilder has been built.");
250 this->cm->add_matching_patches(patches);
254 return std::make_shared<WilsonProvider>(shared_from_this());
Builder assembling a CoefficientGroup from a GroupDefinition and a CoefficientRegistry.
std::shared_ptr< CustomCoefficientGroup > make_custom_wilson_group(const CustomWilsonGroupConfig &cfg, WilsonGroupAdapterConfig adapters)
Build a CustomCoefficientGroup from a lambda config.
Declarative registry describing Wilson coefficient groups, their sources, and setup hooks.
#define LOG_ERROR(type,...)
Macro for logging error messages and terminating the application.
#define LOG_VERBOSE(...)
Macro for logging verbose messages.
Core-side adapter giving MARTY access to configuration and managed paths.
void register_CC_su(CoefficientRegistry ®)
Registers coefficient factories for charged-current s->u (C_V1_su, ...).
void register_BScalar(CoefficientRegistry ®)
Registers coefficient factories for the scalar B group (CQ1, CQ2).
void register_CC_du(CoefficientRegistry ®)
Registers coefficient factories for charged-current d->u (C_V1_du, ...).
void register_BPrime(CoefficientRegistry ®)
Registers coefficient factories for the B' group (CP1..CP10, CPQ1, CPQ2).
void register_CC_bc(CoefficientRegistry ®)
Registers coefficient factories for charged-current b->c (C_V1_bc, ...).
void register_CC_cd(CoefficientRegistry ®)
Registers coefficient factories for charged-current c->d (C_V1_cd, ...).
void register_K(CoefficientRegistry ®)
Registers coefficient factories for the K group (CK9, CK10, ...).
void register_MesonMixing(CoefficientRegistry ®)
Registers coefficient factories for meson mixing coefficients.
void register_CC_bu(CoefficientRegistry ®)
Registers coefficient factories for charged-current b->u (C_V1_bu, ...).
void register_B(CoefficientRegistry ®)
Registers coefficient factories for the B group (C1..C10).
void register_CC_cs(CoefficientRegistry ®)
Registers coefficient factories for charged-current c->s (C_V1_cs, ...).
Factory registry for creating concrete WilsonCoefficient objects by (coefficient, model,...
Builds a ready-to-use CoefficientGroup instance from a BuildContext.
std::shared_ptr< CoefficientGroup > build(const BuildContext &ctx) const
Builds the coefficient group described by ctx.group_id.
static std::shared_ptr< 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={})
Factory that builds and initializes a manager from pre-created groups.
static std::string str(const IdOf< QCDOrderTag > &id)
Returns the string representation associated with an identifier.
static std::string str(const WGroupId &gid, ScaleType s, WilsonBasis b=WilsonBasis::B_STANDARD)
Builds a composite block name using a WGroupId, scale and basis.
fs::path get_path(MartyPath path_name) override
Retrieves a required MARTY-related path.
Core API returning the current Model.
Model get() override
Returns the active physics model.
Returns an uppercase copy of the input string.
WilsonBuilder(WilsonBuildConfig config)
Constructs and immediately builds the Wilson pipeline from a config.
void add(WilsonBuildConfig config) override
Add additional Wilson groups to an existing manager.
void add_matching_patches(const std::vector< WilsonMatchingPatch > &patches)
Add several additive matching patches to the active Wilson manager.
void build(WilsonBuildConfig config) override
Build a new Wilson pipeline from scratch.
std::shared_ptr< CoefficientManager > get_coefficient_manager()
Returns the underlying coefficient manager.
void add_matching_patch(const WilsonMatchingPatch &patch)
Add one additive matching patch to the active Wilson manager.
void add_custom_group(const CustomWilsonGroupConfig &config)
Register and initialize a user-defined Wilson group built from lambdas.
std::shared_ptr< WilsonProvider > get_wilson_provider()
Returns a provider facade around this builder.
Build-time context passed to group setup hooks.
WilsonGroupAdapterConfig adapters
Adapter bundle used by domain objects (storage proxy, composer, core APIs, optional MARTY proxy).
Configuration of a user-defined Wilson group built from lambdas.
double hadronic_scale
Hadronic/running scale used when the group is added to the manager.
WGroupId group
Dynamic group id. Register it with GroupMapper before use if it is custom.
QCDOrder order
Highest QCD order to initialize.
double matching_scale
Matching scale used when the group is added to the manager.
std::vector< CustomWilsonCoefficientConfig > coefficients
Coefficients belonging to the group.
Configuration for building sets of Wilson coefficients.
std::unordered_set< WGroupId > groups
Set of Wilson operator group identifiers to be included in the build.
double hadronic_scale
Hadronic scale (in GeV) at which the Wilson coefficients are evaluated in the effective theory.
QCDOrder order
Perturbative QCD order used for the evolution and matching of Wilson coefficients....
double matching_scale
Matching scale (in GeV) at which the high-energy theory is matched to the effective theory.
Dependency injection bundle for CoefficientGroup.
fs::path sm_path
Default path to the SM MARTY header under assets.
Aggregates “ports” / APIs that connect the manager to the rest of the framework.
std::function< std::shared_ptr< CoefficientGroup >(WGroupId, Model, bool, ContributionType, std::string)> build_group
Optional group builder hook.