Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
CoefficientGroupBuilder.cpp
Go to the documentation of this file.
2
12std::shared_ptr<CoefficientGroup> CoefficientGroupBuilder::build(const BuildContext& ctx) const {
13 auto def = GroupDefinitions::get(ctx.group_id);
14
15 auto grp = std::make_shared<GenericCoefficientGroup>(ctx.adapters);
16 grp->set_group_id(def.id);
17 grp->set_wilson_type(ctx.contrib);
18
19 std::string matching_block =
20 (ctx.group_name.empty())
22 : ctx.group_name;
23
24 grp->set_matching_storage_block(matching_block);
25
26 for (const auto& [basis, per_order] : def.sources) {
27 std::map<QCDOrder, CoefficientGroupSources> m;
28 for (const auto& [ord, s] : per_order) {
29 auto s2 = s;
30 for (auto& [ptype, names] : s2.sources)
31 for (auto& n : names)
32 if (n == MATCHING_BLOCK_PLACEHOLDER) n = matching_block;
33 m.emplace(ord, std::move(s2));
34 }
35 grp->add_sources(basis, m);
36 }
37
38 std::vector<WCoefId> member_ids;
39 member_ids.reserve(def.members.size());
40
41 for (auto c : def.members) {
42 auto coef = reg_.create(ctx, c);
43 grp->insert({ WCoefMapper::str(c), std::move(coef) });
44 member_ids.emplace_back(WCoefMapper::to_id(c));
45 }
46
47 grp->set_member_ids(std::move(member_ids));
48
49 if (auto it = def.setup.find(ctx.model); it != def.setup.end()) {
50 for (auto& hook : it->second) hook(ctx, *grp);
51 }
52
53 return grp;
54}
55
Builder assembling a CoefficientGroup from a GroupDefinition and a CoefficientRegistry.
constexpr const char * MATCHING_BLOCK_PLACEHOLDER
Placeholder string used in GroupDefinition sources to refer to the matching block.
std::shared_ptr< CoefficientGroup > build(const BuildContext &ctx) const
Builds the coefficient group described by ctx.group_id.
CoefPtr create(const BuildContext &ctx, WCoef c) const
Creates a coefficient instance according to the provided build context.
static IdOf< WCoefTag > to_id(WCoef e)
Converts an enum value to an IdOf<Tag>.
static std::string str(const IdOf< WCoefTag > &id)
Returns the string representation of 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.
const GroupDefinition & get(WGroupId g)
Returns the definition for a given group id.
Build-time context passed to group setup hooks.
WGroupId group_id
Identifier of the group being built.
ContributionType contrib
Contribution type used for this build (SM/BSM/TOTAL, etc.).
WilsonGroupAdapterConfig adapters
Adapter bundle used by domain objects (storage proxy, composer, core APIs, optional MARTY proxy).
std::string group_name
Optional name for diagnostics / display.
Model model
Active model used by the core (SM / SUSY / THDM / MARTY).