Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
WilsonManager.h
Go to the documentation of this file.
1#ifndef HYPERISO_WILSONMANAGER_H
2#define HYPERISO_WILSONMANAGER_H
3
4#include <map>
5#include <memory>
6#include <string>
7#include <stdexcept>
8#include <set>
9
10#include "Wilson.h"
11#include "WilsonGroup.h"
12#include "BWilsonGroup.h"
13#include "MemoryManager.h"
14#include "QCDHelper.h"
15#include "Utils.h"
16#include "HyperisoMaster.h"
17#include "IParamSetter.h"
18#include "IWilsonParameters.h"
20#include "WilsonMatchingPatch.h"
21
100
102 std::shared_ptr<IBlockComposer> iblock_c;
103
105 std::shared_ptr<IParameterProxy<std::string, LhaID>> wilson_proxy;
106
108 std::shared_ptr<ICoreAPI<bool>> use_marty;
109
111 std::shared_ptr<ICoreAPI<bool>> has_wilson;
112
114 std::shared_ptr<ICoreAPI<Model>> model_api;
115
117 std::shared_ptr<IParamSetter<ScaleType>> scale_setter_api;
118
119 // Choice of SM Marty mixed-order
120 std::shared_ptr<ICoreAPI<bool>> hard_coded_lo;
121
123 std::shared_ptr<IMartyWilsonPathProxy> marty_paths;
124
126 std::vector<WilsonMatchingPatch> matching_patches;
127
139 std::function<std::shared_ptr<CoefficientGroup>(WGroupId, Model, bool, ContributionType, std::string)> build_group;
140};
141
181private:
183 std::map<std::string, std::shared_ptr<CoefficientGroup>> coefficientGroups;
184
186 WilsonPortsConfig ports_config;
187
189 std::set<std::string> applied_matching_patches;
190
191 bool apply_matching_patch_to_group(const std::string& groupName,
192 const WilsonMatchingPatch& patch,
193 std::size_t patch_index,
194 QCDOrder max_order);
195 void apply_matching_patches(const std::string& groupName, QCDOrder max_order);
196
198 void throw_no_group_error(const std::string& groupName) const;
199
200public:
201 CoefficientManager(WilsonPortsConfig ports_config) : ports_config(ports_config) {}
204
221 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 = {});
222
224 void set_matching_scale(double mu_W);
225
227 void set_hadronic_scale(double mu_h);
228
241 const std::string& groupName,
242 QCDOrder order,
243 WilsonPortsConfig& ports_config
244 );
245
254 const std::string& groupName,
255 QCDOrder order,
256 WilsonPortsConfig& ports_config
257 );
258
268 const std::string& groupName,
269 QCDOrder order,
270 WilsonPortsConfig& ports_config
271 );
272
275 const std::string& groupName,
276 QCDOrder o
277 );
278
281 const std::string& groupName,
282 QCDOrder max_order
283 );
284
287 const std::string& groupName,
288 QCDOrder max_order
289 );
290
292 void registerCoefficientGroup(const std::string& groupName, std::shared_ptr<CoefficientGroup> group);
293
295 void init_group_matching(const std::string& groupName, const std::string& order);
296
304 void init_group_hadronic(const std::string& groupName, const std::string& order, WilsonBasis id);
305
307 void init_group_hadronic_all_bases(const std::string& groupName, const std::string& order);
308
316 void init_specific_order_group_matching(const std::string& groupName, const std::string& order, bool only_total);
317
319 void add_matching_patch(const WilsonMatchingPatch& patch);
320
322 void add_matching_patches(const std::vector<WilsonMatchingPatch>& patches);
323
325 void update(double mu_W, double mu_h);
326
332 void fill_sources_for_group(const std::string & groupName, const std::string& order, std::unordered_map<ParameterType, std::vector<std::string>>& src, WilsonBasis id);
333
340 void fill_matching_groups(const std::string& groupName, const std::string& order);
341
343 std::string getModel();
344
346 std::shared_ptr<CoefficientGroup> getCoefficientGroup(const std::string& groupName) const;
347
349 std::map<std::string, std::shared_ptr<CoefficientGroup>> getGroups();
350
352 std::unordered_set<WilsonBasis> getGroupBases(WGroupId group);
353
355 complex_t getMatchingCoefficient(const std::string& groupName, const std::string& coeffName, const std::string& order, ContributionType cont_type);
356
363 complex_t getFullMatchingCoefficient(const std::string& groupName, const std::string& coeffName, const std::string& order, ContributionType cont_type);
364
366 complex_t getRunCoefficient(const std::string& groupName, const std::string& coeffName, const std::string& order, ContributionType cont_type, WilsonBasis basis = WilsonBasis::B_STANDARD);
367
374 complex_t getFullRunCoefficient(const std::string& groupName, const std::string& coeffName, const std::string& order, ContributionType cont_type, WilsonBasis basis = WilsonBasis::B_STANDARD);
375
377 void printGroupCoefficients(const std::string& groupName) const;
378
386};
387
388
389#endif
Model
QCDOrder
WilsonBasis
ParameterType
ContributionType
High-level helpers for initializing and monitoring the Hyperiso framework.
Port used by the Wilson layer to access MARTY-generated output paths.
Interface for setting a specific “current parameter target” (typically a scale).
Manages memory caching, parameter blocks, and LHA reader instances.
Core QCD utilities for α_s running and quark mass evolution.
std::complex< double > complex_t
Convenience alias for std::complex<double>.
Definition Utils.h:35
Domain container grouping related Wilson coefficients with matching and running access.
Small extension point for additive Wilson matching terms.
Domain objects representing Wilson coefficients and their matching metadata.
High-level orchestrator for Wilson coefficient groups.
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.
CoefficientManager(WilsonPortsConfig ports_config)
void init_group_hadronic_all_bases(const std::string &groupName, const std::string &order)
Initializes hadronic blocks for all bases supported by the group.
CoefficientManager operator=(const CoefficientManager &)=delete
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.
CoefficientManager(const CoefficientManager &)=delete
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.
Generic interface returning a single value of type T from the core.
Definition ICoreAPI.h:30
Abstract interface for setting a chosen parameter.
Abstract interface for reading parameters and basic metadata.
Returns an uppercase copy of the input string.
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< IMartyWilsonPathProxy > marty_paths
Path provider for MARTY-generated Wilson CSV files.
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).
WilsonPortsConfig(std::shared_ptr< IBlockComposer > iblock_c, std::shared_ptr< IParameterProxy< std::string, LhaID > > wilson_proxy, std::shared_ptr< ICoreAPI< bool > > use_marty, std::shared_ptr< ICoreAPI< bool > > has_wilson, std::shared_ptr< ICoreAPI< Model > > model_api, std::shared_ptr< IParamSetter< ScaleType > > scale_setter_api, std::shared_ptr< ICoreAPI< bool > > hard_coded_lo, std::shared_ptr< IMartyWilsonPathProxy > marty_paths=nullptr)
Constructs the port bundle.