Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
WilsonGroup.h
Go to the documentation of this file.
1#ifndef WILSON_GROUP_H
2#define WILSON_GROUP_H
3
4#include <unordered_map>
5#include <optional>
6
7#include "Include.h"
8#include "Utils.h"
9#include "Wilson.h"
10#include "IBlockComposer.h"
11#include "ICoreAPI.h"
12#include "IMartyWilsonProxy.h"
13#include "config.hpp"
14#include "InterpretedParam.h"
16
70 std::unordered_map<ParameterType, std::vector<std::string>> sources {};
71
82 std::function<std::unordered_map<WCoefId, scalar_t>(const std::unordered_map<QCDOrder, std::unordered_map<WCoefId, scalar_t>>&, const BlockSrc&)> func =
83 [](const auto&, const auto&) { return std::unordered_map<WCoefId, scalar_t>(); };
84};
85
86
127class CoefficientGroup : public std::map<std::string, std::shared_ptr<WilsonCoefficient>> {
128public:
135
145
148
158 CoefficientGroup(std::map<std::string, std::shared_ptr<WilsonCoefficient>>& coeffs, WilsonGroupAdapterConfig adapters);
159
169 void init(QCDOrder order);
170
182 void init_full_running_block(const std::unordered_map<ParameterType, std::vector<std::string>> &source_names, WilsonBasis basis, bool inter, std::vector<ContributionType> type);
183
190 virtual std::shared_ptr<CoefficientGroup> get_sm_group() {LOG_ERROR("LogicError", "cannot get_sm_group for virtual group"); return nullptr;}
191
207 complex_t get_matching_coefficient(std::string coeff, std::string order, ContributionType cont_type) const;
208
224 complex_t get_running_coefficient(std::string coeff, std::string order, ContributionType cont_type, WilsonBasis basis = WilsonBasis::B_STANDARD) const;
225
228
234 std::string get_matching_storage_block() const { return block_name; }
235
237 void set_matching_storage_block(std::string);
238
241
248 std::unordered_map<ParameterType, std::vector<std::string>> get_sources(QCDOrder ord, WilsonBasis id) {return this->sources[id][ord].sources;}
249
253 std::unordered_set<WilsonBasis> get_bases() const {
254 return get_keys(this->sources);
255 }
256
262 std::function<std::unordered_map<WCoefId, scalar_t>(const std::unordered_map<QCDOrder, std::unordered_map<WCoefId, scalar_t>>&, const BlockSrc&)> get_func(QCDOrder ord, WilsonBasis id) {return this->sources[id][ord].func;}
263
265 WGroupId get_group_id() const {return id;}
266
275 const std::vector<WCoefId>& get_member_ids() const { return member_ids; }
276
284 void set_member_ids(std::vector<WCoefId> ids) { member_ids = std::move(ids); }
285
289 void add_member_id(WCoefId id);
290
292 void set_group_id(WGroupId gid) { id = gid; }
293
296
303 void add_sources(WilsonBasis basis, const std::map<QCDOrder, CoefficientGroupSources>& m) {
304 sources[basis] = m;
305 }
306
312 virtual std::shared_ptr<CoefficientGroup> clone() const = 0;
313
314 virtual ~CoefficientGroup() = default;
315
316protected:
325 void claim_coefficients();
326
329
332
335
337 std::string block_name;
338
345 std::vector<WCoefId> member_ids;
346
350 std::map<WilsonBasis, std::map<QCDOrder, CoefficientGroupSources>> sources;
351
356};
357
359std::ostream& operator<<(std::ostream& os, const CoefficientGroup& coeffs);
360
362std::ostream& operator<<(std::ostream& os, const std::shared_ptr<CoefficientGroup>& coeffs);
363
364#endif // WILSON_GROUP_H
QCDOrder
WilsonBasis
ParameterType
ContributionType
Interface for composing (creating/removing/updating) dependent blocks and parameters.
Interface for MARTY-based Wilson coefficient calculations.
Lightweight key describing an interpreted LHA/SLHA parameter.
#define LOG_ERROR(type,...)
Macro for logging error messages and terminating the application.
Definition Logger.h:41
std::complex< double > complex_t
Convenience alias for std::complex<double>.
Definition Utils.h:35
std::unordered_set< T > get_keys(const std::map< T, U > &map)
Extracts the key set from a std::map into an unordered_set.
Definition Utils.h:108
Adapter bundle wiring a CoefficientGroup to framework services.
std::ostream & operator<<(std::ostream &os, const CoefficientGroup &coeffs)
Streams all coefficients and standard values (LO/NLO/NNLO at matching + hadronic scales).
Domain objects representing Wilson coefficients and their matching metadata.
Lightweight view over a set of source blocks.
Definition SourcesView.h:71
Polymorphic container of WilsonCoefficient objects representing a coefficient group.
CoefficientGroup(WilsonGroupAdapterConfig adapters)
Constructs an empty group with adapter configuration.
std::function< std::unordered_map< WCoefId, scalar_t >(const std::unordered_map< QCDOrder, std::unordered_map< WCoefId, scalar_t > > &, const BlockSrc &)> get_func(QCDOrder ord, WilsonBasis id)
Returns the computation function for a given basis and order.
virtual std::shared_ptr< CoefficientGroup > clone() const =0
Polymorphic clone.
void init(QCDOrder order)
Registers dependent parameters for matching coefficients up to a maximum order.
virtual std::shared_ptr< CoefficientGroup > get_sm_group()
Returns the SM-only subgroup if the concrete group supports it.
std::unordered_map< ParameterType, std::vector< std::string > > get_sources(QCDOrder ord, WilsonBasis id)
Returns source blocks for a given basis and order.
std::vector< WCoefId > member_ids
Dynamic coefficient ids belonging to this group.
std::string get_matching_storage_block() const
Returns the current matching storage block name.
WilsonGroupAdapterConfig adapters
Adapter configuration bundle (proxies, composers, core APIs, MARTY hooks).
complex_t get_matching_coefficient(std::string coeff, std::string order, ContributionType cont_type) const
Reads a coefficient at the matching scale (mu_W).
void claim_coefficients()
Claims coefficient objects as owned by this group and sets their storage/type.
WGroupId get_group_id() const
Returns the group identifier.
void init_full_running_block(const std::unordered_map< ParameterType, std::vector< std::string > > &source_names, WilsonBasis basis, bool inter, std::vector< ContributionType > type)
Initializes sources to build a full running block.
void set_matching_storage_block(std::string)
Sets the matching storage block name (used by claim_coefficients()).
void add_sources(WilsonBasis basis, const std::map< QCDOrder, CoefficientGroupSources > &m)
Adds running-block sources for a given basis.
CoefficientGroup(CoefficientGroup &&)=default
Move construction (default).
ContributionType get_type()
Returns the contribution type associated with this group (SM/BSM/TOTAL...).
std::unordered_set< WilsonBasis > get_bases() const
Returns the set of bases configured in sources.
void set_wilson_type(ContributionType ct)
Sets the group contribution type.
void add_member_id(WCoefId id)
Add one dynamic coefficient id to the membership list if absent.
void set_member_ids(std::vector< WCoefId > ids)
Replace the dynamic coefficient membership list.
virtual ~CoefficientGroup()=default
const std::vector< WCoefId > & get_member_ids() const
Returns the dynamic ids of coefficients owned by this group.
WGroupId id
Identifier of this group (used by GroupMapper to build block names).
ContributionType wilson_type
Contribution type for this group (default SM).
std::string block_name
Block name for matching-scale storage.
std::map< WilsonBasis, std::map< QCDOrder, CoefficientGroupSources > > sources
Running-block source specification, keyed by (basis -> order).
complex_t get_running_coefficient(std::string coeff, std::string order, ContributionType cont_type, WilsonBasis basis=WilsonBasis::B_STANDARD) const
Reads a coefficient at the hadronic scale (mu_h) in a given basis.
void set_group_id(WGroupId gid)
Sets the group identifier (caller must ensure consistency with block naming).
QCDOrder get_order()
Returns the maximum initialized QCD order for this group.
QCDOrder current_order
Max initialized order (default LO).
Returns an uppercase copy of the input string.
Source specification and aggregation function for a coefficient group block.
Definition WilsonGroup.h:68
std::unordered_map< ParameterType, std::vector< std::string > > sources
Map of required source blocks for each ParameterType scope.
Definition WilsonGroup.h:70
std::function< std::unordered_map< WCoefId, scalar_t >(const std::unordered_map< QCDOrder, std::unordered_map< WCoefId, scalar_t > > &, const BlockSrc &)> func
Computes a set of coefficients from existing values and source blocks.
Definition WilsonGroup.h:82
Dependency injection bundle for CoefficientGroup.