18static constexpr std::array<QCDOrder, 3> ALL_ORDERS = {
22static std::string hadronic_final_block_name(
const std::string& groupName,
WilsonBasis basis) {
26static std::string hadronic_sm_intermediate_block_name(
const std::string& groupName,
WilsonBasis basis) {
27 return hadronic_final_block_name(groupName, basis) +
"__SM_INTERMEDIATE";
30static std::string hadronic_bsm_intermediate_block_name(
const std::string& groupName,
WilsonBasis basis) {
31 return hadronic_final_block_name(groupName, basis) +
"__BSM_INTERMEDIATE";
34static scalar_t get_block_value_or_zero(
35 const std::map<
LhaID, std::shared_ptr<Parameter>>& items,
38 auto it = items.find(
id);
39 if (it == items.end() || !it->second) {
42 return it->second->get_val();
49static void compose_sm_only_triplet_for_order(
50 const std::string& groupName,
51 const std::vector<WCoefId>& members,
58 for (
const auto& wcoef_id : members) {
61 LhaID id_sm (base.first, base.second, qcd_index(order), 0);
62 LhaID id_bsm(base.first, base.second, qcd_index(order), 1);
63 LhaID id_tot(base.first, base.second, qcd_index(order), 2);
69 ports_config.
iblock_c->compose_parameter(
71 std::unordered_set<ParamId>{},
72 [](
const ParamSrc&, std::shared_ptr<DependentParameter> dep) {
73 dep->set_expected(0.);
77 ports_config.
iblock_c->compose_parameter(
79 std::unordered_set<ParamId>{ pid_sm },
80 [pid_sm](
const ParamSrc& src, std::shared_ptr<DependentParameter> dep) {
81 dep->set_expected(src.
get_val(pid_sm));
87static std::vector<QCDOrder> orders_up_to(
QCDOrder max) {
95bool CoefficientManager::apply_matching_patch_to_group(
96 const std::string& groupName,
98 std::size_t patch_index,
107 if (!this->coefficientGroups.contains(groupName)) {
111 auto group = this->coefficientGroups.at(groupName);
115 if (!(group->get_group_id() == patch.
group)) {
119 const bool contribution_compatible =
123 if (!contribution_compatible) {
128 auto coeff_it = group->find(coeff_name);
129 if (coeff_it == group->end() || !coeff_it->second) {
133 if (patch.
marty_only && !std::dynamic_pointer_cast<MartyWilson>(coeff_it->second)) {
138 LOG_ERROR(
"ValueError",
"Wilson matching patch", patch.
label,
"has no compute function.");
141 const std::string key = groupName +
"|" + std::to_string(patch_index);
142 if (this->applied_matching_patches.contains(key)) {
147 this->applied_matching_patches.insert(key);
150 "Applied Wilson matching patch",
151 patch.
label.empty() ? std::string(
"<anonymous>") : patch.label,
152 "to", groupName, coeff_name,
OrderMapper::str(patch.order)
157void CoefficientManager::apply_matching_patches(
const std::string& groupName,
QCDOrder max_order) {
159 apply_matching_patch_to_group(groupName, ports_config.
matching_patches[i], i, max_order);
167 for (
auto& [groupName, group] : this->coefficientGroups) {
171 const QCDOrder reinit_order = qcd_index(group->get_order()) > qcd_index(patch.
order)
174 const bool applied = apply_matching_patch_to_group(
181 group->init(reinit_order);
187 for (
const auto& patch : patches) {
192void CoefficientManager::throw_no_group_error(
const std::string &groupName)
const {
193 std::stringstream ss;
194 ss <<
"Coefficient group " << groupName <<
" not found in manager. Existing groups are:\n";
195 for (
const auto& group : this->coefficientGroups) {
196 ss <<
"\t- " << group.first <<
"\n";
202 const std::string& groupName,
208 const auto& members = this->coefficientGroups.at(groupName)->get_member_ids();
212 for (
auto o : orders_up_to(max_order)) {
213 for (
const auto& wcoef_id : members) {
216 LhaID id_sm (base.first, base.second, qcd_index(o), 0);
217 LhaID id_bsm(base.first, base.second, qcd_index(o), 1);
218 LhaID id_tot(base.first, base.second, qcd_index(o), 2);
224 auto zero = [](
const ParamSrc&, std::shared_ptr<DependentParameter> dep) {
225 dep->set_expected(0.);
228 if (!wp->exist(final_block, id_sm)) ports_config.
iblock_c->compose_parameter(pid_sm, {}, zero);
229 if (!wp->exist(final_block, id_bsm)) ports_config.
iblock_c->compose_parameter(pid_bsm, {}, zero);
230 if (!wp->exist(final_block, id_tot)) ports_config.
iblock_c->compose_parameter(pid_tot, {}, zero);
237 const std::string& groupName,
245 std::shared_ptr<CoefficientGroup> sm_group_ptr;
247 const bool marty_backend = ports_config.
use_marty->get();
248 const bool hard_lo = hard_coded_lo_enabled(ports_config);
250 bool allow_hardcoded_sm = (marty_backend && hard_lo);
251 if (allow_hardcoded_sm && !ports_config.
build_group) {
253 "(CoefficientManager) HYP_AS_SM_MARTY=true but no ports_config.build_group provided; "
254 "cannot build a built-in SM group. Falling back to MARTY SM at LO."
256 allow_hardcoded_sm =
false;
259 const bool sm_use_marty = allow_hardcoded_sm ? false : marty_backend;
263 const QCDOrder sm_max_order = (marty_backend && (max_order >
QCDOrder::LO) && !allow_hardcoded_sm)
276 sm_group_ptr = this->coefficientGroups.at(groupName)->get_sm_group();
277 sm_group_ptr->set_matching_storage_block(sm_block);
281 LOG_ERROR(
"LogicError",
"No SM group found for " + groupName);
284 if (!this->coefficientGroups.contains(sm_block)) {
288 apply_matching_patches(sm_block, sm_max_order);
289 sm_group_ptr->init(sm_max_order);
291 const auto& members = this->coefficientGroups.at(groupName)->get_member_ids();
293 for (
auto o : ALL_ORDERS) {
294 if (qcd_index(o) > qcd_index(sm_max_order))
continue;
296 for (
const auto& wcoef_id : members) {
299 LhaID id_sm(base.first, base.second, qcd_index(o), 0);
304 ports_config.
iblock_c->compose_parameter(
306 std::unordered_set<ParamId>{ pid_src },
307 [pid_src](
const ParamSrc& src, std::shared_ptr<DependentParameter> dep) {
308 dep->set_expected(src.
get_val(pid_src));
324 const std::string& groupName,
327 std::string storage_block = this->coefficientGroups.at(groupName)->get_matching_storage_block();
329 for (
auto& coeff : *this->coefficientGroups.at(groupName)) {
336 auto zero = [] (
const ParamSrc&, std::shared_ptr<DependentParameter> dep) {
337 dep->set_expected(0.);
340 ports_config.
iblock_c->compose_parameter(pid_SM, {}, zero);
341 ports_config.
iblock_c->compose_parameter(pid_BSM, {}, zero);
342 ports_config.
iblock_c->compose_parameter(pid_TOT, {}, zero);
360 const std::string& groupName,
371 const auto& members = this->coefficientGroups.at(groupName)->get_member_ids();
373 for (
auto o : ALL_ORDERS) {
374 if (qcd_index(o) > qcd_index(max_order))
continue;
376 for (
const auto& wcoef_id : members) {
379 LhaID id_sm (base.first, base.second, qcd_index(o), 0);
380 LhaID id_bsm(base.first, base.second, qcd_index(o), 1);
381 LhaID id_tot(base.first, base.second, qcd_index(o), 2);
387 const bool fw_has_sm = wp->exist(fw_block, id_sm);
388 const bool fw_has_bsm = wp->exist(fw_block, id_bsm);
389 const bool fw_has_tot = wp->exist(fw_block, id_tot);
394 ports_config.
iblock_c->compose_parameter(
396 std::unordered_set<ParamId>{ fw_sm },
397 [fw_sm](
const ParamSrc& src, std::shared_ptr<DependentParameter> dep) {
398 dep->set_expected(src.
get_val(fw_sm));
401 }
else if (fw_has_tot && fw_has_bsm) {
402 ports_config.
iblock_c->compose_parameter(
404 std::unordered_set<ParamId>{ fw_tot, fw_bsm },
405 [fw_tot, fw_bsm](
const ParamSrc& src, std::shared_ptr<DependentParameter> dep) {
406 dep->set_expected(src.get_val(fw_tot) - src.get_val(fw_bsm));
416 ports_config.
iblock_c->compose_parameter(
418 std::unordered_set<ParamId>{ fw_bsm },
419 [fw_bsm](
const ParamSrc& src, std::shared_ptr<DependentParameter> dep) {
420 dep->set_expected(src.
get_val(fw_bsm));
423 }
else if (fw_has_tot) {
424 ports_config.
iblock_c->compose_parameter(
426 std::unordered_set<ParamId>{ fw_tot, final_sm },
427 [fw_tot, final_sm](
const ParamSrc& src, std::shared_ptr<DependentParameter> dep) {
428 dep->set_expected(src.get_val(fw_tot) - src.get_val(final_sm));
432 ports_config.
iblock_c->compose_parameter(
434 std::unordered_set<ParamId>{},
435 [](
const ParamSrc&, std::shared_ptr<DependentParameter> dep) {
436 dep->set_expected(0.0);
442 ports_config.
iblock_c->compose_parameter(
444 std::unordered_set<ParamId>{ fw_tot },
445 [fw_tot](
const ParamSrc& src, std::shared_ptr<DependentParameter> dep) {
446 dep->set_expected(src.
get_val(fw_tot));
449 }
else if (fw_has_bsm) {
450 ports_config.
iblock_c->compose_parameter(
452 std::unordered_set<ParamId>{ final_sm, final_bsm },
453 [final_sm, final_bsm](
const ParamSrc& src, std::shared_ptr<DependentParameter> dep) {
454 dep->set_expected(src.get_val(final_sm) + src.get_val(final_bsm));
458 ports_config.
iblock_c->compose_parameter(
460 std::unordered_set<ParamId>{ final_sm },
461 [final_sm](
const ParamSrc& src, std::shared_ptr<DependentParameter> dep) {
462 dep->set_expected(src.
get_val(final_sm));
471 const std::string& groupName,
478 const auto group = this->coefficientGroups.at(groupName);
479 const auto& members = group->get_member_ids();
482 for (
const auto& wcoef_id : members) {
485 LhaID id_sm (base.first, base.second, qcd_index(order), 0);
486 LhaID id_bsm(base.first, base.second, qcd_index(order), 1);
487 LhaID id_tot(base.first, base.second, qcd_index(order), 2);
493 if (calculation_is_total) {
496 ports_config.
iblock_c->compose_parameter(
498 std::unordered_set<ParamId>{ pid_tot, pid_sm },
499 [pid_tot, pid_sm](
const ParamSrc& src, std::shared_ptr<DependentParameter> dep) {
500 dep->set_expected(src.get_val(pid_tot) - src.get_val(pid_sm));
505 ports_config.
iblock_c->compose_parameter(
507 std::unordered_set<ParamId>{ pid_sm, pid_bsm },
508 [pid_sm, pid_bsm](
const ParamSrc& src, std::shared_ptr<DependentParameter> dep) {
509 dep->set_expected(src.get_val(pid_sm) + src.get_val(pid_bsm));
517 const std::string& groupName,
523 const auto& members = this->coefficientGroups.at(groupName)->get_member_ids();
525 for (
auto o : orders_up_to(max_order)) {
526 for (
const auto& wcoef_id : members) {
529 LhaID id_sm (base.first, base.second, qcd_index(o), 0);
530 LhaID id_bsm(base.first, base.second, qcd_index(o), 1);
531 LhaID id_tot(base.first, base.second, qcd_index(o), 2);
537 ports_config.
iblock_c->compose_parameter(
539 std::unordered_set<ParamId>{},
540 [](
const ParamSrc&, std::shared_ptr<DependentParameter> dep) {
541 dep->set_expected(0.0);
545 ports_config.
iblock_c->compose_parameter(
547 std::unordered_set<ParamId>{ pid_sm, pid_bsm },
548 [pid_sm, pid_bsm](
const ParamSrc& src, std::shared_ptr<DependentParameter> dep) {
549 dep->set_expected(src.get_val(pid_sm) + src.get_val(pid_bsm));
558 const std::string& orderStr,
561 if (!this->coefficientGroups.contains(groupName)) {
562 throw_no_group_error(groupName);
565 const bool has_input = ports_config.
has_wilson->get();
566 const bool marty_backend = ports_config.
use_marty->get();
567 const bool hard_lo = hard_coded_lo_enabled(ports_config);
572 const bool mixed_orders = marty_backend
583 apply_matching_patches(groupName, marty_calc_order);
584 this->coefficientGroups.at(groupName)->init(marty_calc_order);
590 for (
auto o : ALL_ORDERS) {
591 if (qcd_index(o) > qcd_index(requested))
continue;
592 if (qcd_index(o) <= qcd_index(marty_calc_order))
continue;
606 for (
auto o : ALL_ORDERS) {
608 if (qcd_index(o) > qcd_index(requested))
continue;
609 compose_sm_only_triplet_for_order(groupName, this->coefficientGroups.at(groupName)->get_member_ids(), o, ports_config);
612 for (
auto o : ALL_ORDERS) {
614 if (qcd_index(o) > qcd_index(requested))
continue;
620 "(CoefficientManager) hard_coded_lo=true requested but ports_config.build_group is not set; "
621 "cannot compute SM beyond LO. Higher orders are zero-filled."
623 }
else if (!hard_lo) {
625 "(CoefficientManager) Marty backend does not support QCD orders beyond LO; "
626 "higher orders are zero-filled. Set hard_coded_lo=true (with build_group hook) to keep SM up to the requested order."
645 for (
const auto& [key, vec] : this->coefficientGroups[groupName]->get_sources(
QCDOrder::NNLO,
id)) {
646 auto& targetVec = src[key];
647 targetVec.insert(targetVec.end(), vec.begin(), vec.end());
652 for (
const auto& [key, vec] : this->coefficientGroups[groupName]->get_sources(
QCDOrder::NLO,
id)) {
653 auto& targetVec = src[key];
654 targetVec.insert(targetVec.end(), vec.begin(), vec.end());
659 for (
const auto& [key, vec] : this->coefficientGroups[groupName]->get_sources(
QCDOrder::LO,
id)) {
660 auto& targetVec = src[key];
661 targetVec.insert(targetVec.end(), vec.begin(), vec.end());
671 auto parts =
id.get_parts();
672 auto w_id = std::make_pair<int, int>(parts[0], parts[1]);
676 LOG_ERROR(
"ValueError",
"bad lha id for wilson conversion (unknown custom/base key)");
682 std::pair<WCoefId, std::pair<QCDOrder, ContributionType>> ret;
683 ret = {coef, {order, part}};
689 const std::string& order,
691 if (!this->coefficientGroups.contains(groupName)) {
692 throw_no_group_error(groupName);
695 std::unordered_map<ParameterType, std::vector<std::string>> running_src = {};
701 std::function<std::unordered_map<WCoefId, scalar_t>(
702 const std::unordered_map<
QCDOrder, std::unordered_map<WCoefId, scalar_t>>&,
709 const std::string matching_block_name = this->coefficientGroups[groupName]->get_matching_storage_block();
710 const auto& members = this->coefficientGroups.at(groupName)->get_member_ids();
712 const std::string final_block_name = hadronic_final_block_name(groupName, basis);
713 const std::string sm_run_block_name = hadronic_sm_intermediate_block_name(groupName, basis);
714 const std::string bsm_run_block_name = hadronic_bsm_intermediate_block_name(groupName, basis);
716 auto make_partial_running_func =
717 [matching_block_name, ord, funcs, members, groupName, basis]
720 return [matching_block_name, ord, funcs, kept_contrib, target_block_name, members, groupName, basis]
721 (
const BlockSrc& src, std::shared_ptr<DependentBlock> dep_block) {
722 auto raw = src.raw();
723 auto it = raw.find(matching_block_name);
724 if (it == raw.end() || !it->second) {
728 const auto& matching_coeff = it->second->getItems();
730 std::unordered_map<QCDOrder, std::unordered_map<WCoefId, scalar_t>> matching_one;
735 for (
auto qcd_order : ALL_ORDERS) {
736 if (qcd_index(qcd_order) > qcd_index(ord)) {
739 for (
const auto& wcoef_id : members) {
740 matching_one[qcd_order][wcoef_id] = 0.0;
744 for (
const auto& [lha_id, param] : matching_coeff) {
746 const WCoefId& wcoef = dec.first;
747 const QCDOrder& qcd_order = dec.second.first;
750 if (qcd_index(qcd_order) > qcd_index(ord) || contrib != kept_contrib || !param) {
754 matching_one[qcd_order][wcoef] = param->get_val();
757 std::unordered_map<QCDOrder, std::unordered_map<WCoefId, scalar_t>> res_one;
759 auto run_order = [&](
QCDOrder qcd_order) {
763 auto result = funcs.at(qcd_order)(matching_one, src);
765 res_one[qcd_order] = std::move(result);
782 for (
const auto& [qcd_order, coef_map] : res_one) {
783 for (
const auto& [coef_id, coef_val] : coef_map) {
790 dep_block->store_or_assign(
792 std::make_shared<Parameter>(pid, coef_val, 0.0,
static_cast<int>(kept_contrib))
802 ports_config.
iblock_c->compose_block(sm_run_block_name, running_src, sm_func);
803 ports_config.
iblock_c->compose_block(bsm_run_block_name, running_src, bsm_func);
805 std::unordered_map<ParameterType, std::vector<std::string>> combine_src = {
811 [groupName, basis, ord, final_block_name, sm_run_block_name, bsm_run_block_name, members]
812 (
const BlockSrc& src, std::shared_ptr<DependentBlock> dep_block) {
813 auto raw = src.raw();
815 auto it_sm = raw.find(sm_run_block_name);
816 auto it_bsm = raw.find(bsm_run_block_name);
818 if (it_sm == raw.end() || !it_sm->second) {
821 if (it_bsm == raw.end() || !it_bsm->second) {
825 const auto& sm_items = it_sm->second->getItems();
826 const auto& bsm_items = it_bsm->second->getItems();
828 for (
auto qcd_order : ALL_ORDERS) {
829 if (qcd_index(qcd_order) > qcd_index(ord)) {
833 for (
const auto& wcoef_id : members) {
836 const LhaID id_sm (base.first, base.second, qcd_index(qcd_order), 0);
837 const LhaID id_bsm(base.first, base.second, qcd_index(qcd_order), 1);
838 const LhaID id_tot(base.first, base.second, qcd_index(qcd_order), 2);
840 const scalar_t sm_val = get_block_value_or_zero(sm_items, id_sm);
841 const scalar_t bsm_val = get_block_value_or_zero(bsm_items, id_bsm);
842 const scalar_t tot_val = sm_val + bsm_val;
846 dep_block->store_or_assign(
853 dep_block->store_or_assign(
860 dep_block->store_or_assign(
869 ports_config.
iblock_c->compose_block(final_block_name, combine_src, combine_func);
878 for (
auto basis : this->coefficientGroups.at(groupName)->get_bases()) {
884 complex_t c = this->coefficientGroups.at(groupName)->get_matching_coefficient(coeffName, order, cont_type);
890 double fact = (*ports_config.
wilson_proxy)(
"WPARAM_MATCH_SM", 1) / (4 *
PI);
893 for (
size_t o = 1; o <= max_order; o++) {
901 complex_t c = this->coefficientGroups.at(groupName)->get_running_coefficient(coeffName, order, cont_type, basis);
906 double fact = (*ports_config.
wilson_proxy)(
"WPARAM_RUN_SM", 1) / (4 *
PI);
909 for (
size_t o = 1; o <= max_order; o++) {
916 coefficientGroups[groupName] = group;
920 if (!this->coefficientGroups.contains(groupName)) {
921 throw_no_group_error(groupName);
924 return this->coefficientGroups.at(groupName);
928 return this->coefficientGroups;
940 LOG_TRACE(
"Call to CoefficientManager destructor");
942 ports_config.
iblock_c->remove_all_composed_blocks();
952std::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) {
954 for (
auto& helper : wilson_param_helpers) {
955 for (
const auto& elem : groups) {
960 if (groups.empty()) {
961 return std::make_shared<CoefficientManager>(portconfig);
964 auto manager = std::make_shared<CoefficientManager>(portconfig);
965 for (
auto& group : groups) {
966 LOG_DEBUG(
"(CoefficientManager) Registering coefficient group", group.first);
967 manager->registerCoefficientGroup(group.first, group.second);
969 LOG_DEBUG(
"(CoefficientManager) Setting matching scale");
970 manager->set_matching_scale(mu_W);
971 LOG_DEBUG(
"(CoefficientManager) Setting hadronic scale");
972 manager->set_hadronic_scale(mu_h);
973 for (
auto& group: groups) {
974 LOG_DEBUG(
"(CoefficientManager) Initializing group matching", group.first,
"at", order);
975 manager->init_group_matching(group.first, order);
976 LOG_DEBUG(
"(CoefficientManager) Initializing group hadronic", group.first,
"at", order);
977 manager->init_group_hadronic_all_bases(group.first, order);
979 LOG_DEBUG(
"(CoefficientManager) Manager successfully initialized");
#define LOG_ERROR(type,...)
Macro for logging error messages and terminating the application.
#define LOG_TRACE(...)
Macro for logging trace messages.
#define LOG_DEBUG(...)
Macro for logging debug messages.
#define LOG_VERBOSE(...)
Macro for logging verbose messages.
#define LOG_WARN(...)
Macro for logging warning messages.
WilsonCoefficient implementation whose matching is produced by a MARTY backend.
std::complex< double > complex_t
Convenience alias for std::complex<double>.
Centralizes canonical SLHA/LHA block naming conventions for Wilson blocks.
std::pair< WCoefId, std::pair< QCDOrder, ContributionType > > lha_wilson_deserialize(LhaID id)
High-level orchestration of Wilson coefficient groups (matching + running/hadronic).
Lightweight view over a set of source blocks.
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 init_group_hadronic_all_bases(const std::string &groupName, const std::string &order)
Initializes hadronic blocks for all bases supported by the group.
void set_hadronic_scale(double mu_h)
Switches to hadronic scale context and sets mu_h via scale_setter_api.
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 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.
std::map< std::string, std::shared_ptr< CoefficientGroup > > getGroups()
Returns all registered groups.
void add_matching_patches(const std::vector< WilsonMatchingPatch > &patches)
Add several additive matching patches.
void set_matching_scale(double mu_W)
Switches to matching scale context and sets mu_W via scale_setter_api.
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 abse...
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.
std::shared_ptr< CoefficientGroup > getCoefficientGroup(const std::string &groupName) const
Retrieves a registered coefficient group by name (throws/logs on missing).
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.
std::unordered_set< WilsonBasis > getGroupBases(WGroupId group)
Returns bases supported by the group (delegates to CoefficientGroup::get_bases()).
void add_matching_patch(const WilsonMatchingPatch &patch)
Add one additive matching patch and apply it to already-registered groups when relevant.
void printGroupCoefficients(const std::string &groupName) const
Debug helper (currently stubby in implementation).
void update(double mu_W, double mu_h)
Updates the manager by changing scales (delegates to set_matching_scale / set_hadronic_scale).
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 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).
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 bloc...
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.
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.
void init_group_matching(const std::string &groupName, const std::string &order)
Initializes matching-side parameters for a group up to order.
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...
~CoefficientManager()
Destructor.
void init_group_hadronic(const std::string &groupName, const std::string &order, WilsonBasis id)
Initializes hadronic (running) block for one basis.
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.
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.
void registerCoefficientGroup(const std::string &groupName, std::shared_ptr< CoefficientGroup > group)
Registers a coefficient group under a given name.
static std::string str(const IdOf< ModelTag > &id)
Returns the string representation associated with an identifier.
static IdOf< WGroupTag > enum_elt(std::string_view s)
Alias for id_of(), kept for compatibility.
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.
static QCDOrder enum_elt(std::string_view s)
Legacy lookup: converts a string into a QCDOrder enum. Performs a case-insensitive search over the bu...
Lightweight view over a set of source parameters keyed by ParamId.
scalar_t get_val(const ParamId &id) const
Retrieves the current value of a parameter.
Returns an uppercase copy of the input string.
static std::pair< int, int > flha_base(WCoef e)
Returns the base FLHA pair (a,b) for a given WCoef.
static LhaID flha_full(WCoef e, QCDOrder q, ContributionType c)
static std::optional< WCoefId > from_flha_key(int a, int b)
Registry-based lookup of WCoefId from a FLHA base key (a,b).
void require_matching_input_complete(const std::unordered_map< QCDOrder, std::unordered_map< WCoefId, scalar_t > > &matching, const std::vector< WCoefId > &members, QCDOrder order, const std::string &group_name, WilsonBasis basis)
void require_running_function(const std::map< QCDOrder, std::function< std::unordered_map< WCoefId, scalar_t >(const std::unordered_map< QCDOrder, std::unordered_map< WCoefId, scalar_t > > &, const BlockSrc &)> > &funcs, QCDOrder order, const std::string &group_name, WilsonBasis basis)
void require_running_result_known_members(const std::unordered_map< WCoefId, scalar_t > &result, const std::vector< WCoefId > &members, QCDOrder order, const std::string &group_name, WilsonBasis basis)
Represents an identifier of a LHA element, possibly containing several sub-ids.
Composite identifier for a single parameter.
static std::string matching(WGroupId gid)
Returns the canonical matching block name for a Wilson group.
static constexpr const char * fwcoef()
Returns the fixed FWCOEF block name.
static std::string sm_matching(WGroupId gid)
Returns the SM-only matching block name for a Wilson group.
ContributionType contribution
WilsonMatchingPatchFunction compute
std::unordered_set< ParamId > sources
Aggregates “ports” / APIs that connect the manager to the rest of the framework.
std::vector< WilsonMatchingPatch > matching_patches
Additive matching patches applied before group initialization.
std::shared_ptr< ICoreAPI< bool > > hard_coded_lo
std::shared_ptr< IParameterProxy< std::string, LhaID > > wilson_proxy
Read-only access to existing blocks/parameters (FWCOEF, matching blocks, etc.).
std::shared_ptr< IParamSetter< ScaleType > > scale_setter_api
Scale setter used to switch and set mu_W / mu_h.
std::shared_ptr< ICoreAPI< Model > > model_api
Current model selector (SM/SUSY/THDM...).
std::shared_ptr< IBlockComposer > iblock_c
Dependency engine used to compose derived blocks/parameters.
std::shared_ptr< ICoreAPI< bool > > use_marty
Backend selector: true => Marty, false => builtin.
std::function< std::shared_ptr< CoefficientGroup >(WGroupId, Model, bool, ContributionType, std::string)> build_group
Optional group builder hook.
std::shared_ptr< ICoreAPI< bool > > has_wilson
Whether an input Wilson block exists (FWCOEF-style input present).