8 std::shared_ptr<IObsWilsonBuilder>& wil_builder,
10 config.
groups = update_state(config, std::move(iobs_wfreezer));
11 if (config.
groups.empty()) {
14 for (
auto group : config.
groups) {
17 wil_builder->build(std::make_shared<WilsonBuildConfig>(config));
21 state[group] = GroupState{frozen, make_signature(config)};
25 double matching_scale,
26 double hadronic_scale,
37std::unordered_set<WGroupId> ObsWilsonHelper::get_all_groups(
const std::unordered_set<WGroupId>& needed)
const {
38 std::unordered_set<WGroupId> all_groups;
39 all_groups.reserve(state.size() + needed.size());
41 for (
const auto& [group, _] : state) {
42 all_groups.emplace(group);
44 all_groups.insert(needed.begin(), needed.end());
49std::unordered_set<WGroupId> ObsWilsonHelper::update_state(
const WilsonBuildConfig& config,
51 std::unordered_set<WGroupId> to_build;
52 const auto signature = make_signature(config);
54 for (
auto group : get_all_groups(config.groups)) {
55 if (!config.
groups.contains(group)) {
56 auto it = state.find(group);
57 if (it != state.end() && !it->second.frozen && iobs_wfreezer) {
58 iobs_wfreezer->freeze(group);
59 it->second.frozen =
true;
64 auto it = state.find(group);
65 if (it == state.end()) {
66 to_build.emplace(group);
67 state[group] = GroupState{
false, signature};
71 if (!it->second.signature.matches(config)) {
72 to_build.emplace(group);
73 it->second = GroupState{
false, signature};
77 if (it->second.frozen) {
79 iobs_wfreezer->unfreeze(group);
81 it->second.frozen =
false;
88ObsWilsonHelper::BuildSignature ObsWilsonHelper::make_signature(
const WilsonBuildConfig& config) {
#define LOG_DEBUG(...)
Macro for logging debug messages.
Per-manager helper that manages the Wilson group lifecycle for observable computations.
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.
void clear()
Clear the per-helper build/freeze state.
void mark_built(WGroupId group, const WilsonBuildConfig &config, bool frozen=false)
Mark a Wilson group as already available in this helper state.
void build(WilsonBuildConfig config, std::shared_ptr< IObsWilsonBuilder > &wil_builder, std::shared_ptr< IWilsonFreezer< WGroupId > > iobs_wfreezer)
Build or update Wilson groups required by observables.
Returns an uppercase copy of the input string.
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.