Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
Parameters.cpp
Go to the documentation of this file.
1#include "Parameters.h"
2
3#include <stdexcept>
5#include "MemoryManager.h"
7
8std::map<ParameterType, std::shared_ptr<Parameters>> Parameters::instances;
9std::map<ParameterType, std::shared_ptr<Parameters>> ParametersFactory::instances;
10
11std::shared_ptr<Parameters> Parameters::GetInstance(ParameterType id) {
12 if (auto* ctx = ParameterRuntimeContext::current()) {
13 const auto& allowed = ctx->parameter_types();
14 if (std::find(allowed.begin(), allowed.end(), id) == allowed.end())
15 LOG_ERROR("OutOfRange", "Parameter type undefined in runtime context: ", ParameterTypeMapper::str(id));
16 return ctx->get_parameters(id);
17 }
18
20 if (std::find(allowed.begin(), allowed.end(), id) == allowed.end())
21 LOG_ERROR("OutOfRange", "Parameter type undefined: ", ParameterTypeMapper::str(id));
23}
24
28
29void Parameters::claim_parameters(ParameterType type) {
30 for (auto& [_, block] : *blockAccessor) {
31 block->set_owner(type);
32 }
33}
34
35Parameters::Parameters(std::shared_ptr<ModelStrategy> modelStrategy)
36 : strategy(modelStrategy)
37{
38 LOG_VERBOSE("Param creation at", this);
39 auto truc = strategy->initializeParameters(*this);
40 strategy->add_absent_block(truc);
41}
42
44 return blockAccessor->getValue(block, id);
45}
46
47std::shared_ptr<Parameter> Parameters::get_parameter(const BlockName &block,
48 LhaID pdgCode) {
49 return blockAccessor->at(block)->retrieve(pdgCode);
50}
51
52bool Parameters::exist(const BlockName& block, LhaID id) {
53 if (!blockAccessor->contains(block)) return false;
54 return blockAccessor->at(block)->contains(id);
55}
56
57void Parameters::setBlockValue(const BlockName& name, LhaID id, scalar_t value) {
58 blockAccessor->setValue(name, id, value);
59}
60
61std::map<LhaID, scalar_t> Parameters::get_block_infos(BlockName blockName) {
62 return blockAccessor->getAllValues(blockName);
63}
64
65double Parameters::get_block_scale(BlockName blockName) const{
66 return this->blockAccessor->at(blockName)->get_scale();
67}
68
69std::unordered_set<BlockName> Parameters::get_blocks_list()
70{
71 return blockAccessor->get_block_names();
72}
73
74bool Parameters::is_dependent_block(const BlockName& blockName) const {
75 return blockAccessor->is_dependent_block(blockName);
76}
77
78std::vector<std::string> Parameters::get_source_blocks(const BlockName& blockName) const {
79 return blockAccessor->get_source_block_names(blockName);
80}
81
82std::vector<std::string> Parameters::get_dependent_blocks(const BlockName& blockName) const {
83 return blockAccessor->get_dependent_block_names(blockName);
84}
85
86std::vector<std::string> Parameters::get_all_source_blocks(const BlockName& blockName) const {
87 return blockAccessor->get_all_source_block_names(blockName);
88}
89
90std::vector<std::string> Parameters::get_all_dependent_blocks(const BlockName& blockName) const {
91 return blockAccessor->get_all_dependent_block_names(blockName);
92}
93
94auto matches_block = [](const BlockName& expected, const BlockName& actual) {
95 if (expected == actual) {
96 return true;
97 }
98
99 if (expected == "FOBS") {
100 return actual.to_string().starts_with("FOBS_");
101 }
102
103 return false;
104};
105
106std::unordered_set<BlockName> Parameters::init_blocks(ParameterType type) {
107 LOG_DEBUG("Init blocks for parameter type", ParameterTypeMapper::str(type));
108
109 std::unordered_set<BlockName> blocks_to_extract;
110 std::unordered_set<BlockName> missing;
111
112 const auto available_blocks =
115 : MemoryManager::GetInstance()->input_cache->get_block_names();
116
117 for (const auto& expected : ParamRouter::GetOwnedBlocks(type)) {
118 bool found = false;
119
120 for (const auto& actual : available_blocks) {
121 if (matches_block(expected, actual)) {
122 found = true;
123 blocks_to_extract.insert(actual);
124 }
125 }
126
127 if (!found) {
128 missing.insert(expected);
129 }
130 }
131
132 if (type == ParameterType::WILSON &&
134 blocks_to_extract.erase("FWCOEF");
135 blocks_to_extract.erase("IMFWCOEF");
136 }
137
138 // FUTURE_UPDATE v1.1 : manage case of theoretical obs in lha. For now, assume only exp is given.
139 if (type == ParameterType::OBSERVABLE &&
141 throw std::logic_error("Theoretical observable input is not implemented");
142 }
143
144 if (auto* ctx = ParameterRuntimeContext::current()) {
145 this->blockAccessor = ctx->extract_blocks(blocks_to_extract);
146 } else {
147 this->blockAccessor = MemoryManager::GetInstance()->extract_blocks(blocks_to_extract);
148 }
149 claim_parameters(type);
150 return missing;
151}
152
153void Parameters::freeze_block(const BlockName &blockName) {
154 if (!blockAccessor->contains(blockName)) {
155 LOG_INFO(blockAccessor);
156 LOG_ERROR("Cannot freeze non-existing block", blockName);
157 }
158
159 return this->blockAccessor->at(blockName)->freeze();
160}
161
162void Parameters::unfreeze_block(const BlockName &blockName) {
163 return this->blockAccessor->at(blockName)->unfreeze();
164}
165
166void Parameters::freeze_param(const BlockName &blockName, const LhaID &id) {
167 if (!blockAccessor->contains(blockName)) {
168 LOG_ERROR("Cannot freeze dependent parameter in non-existing block", blockName);
169 }
170
171 if (!blockAccessor->at(blockName)->contains(id)) {
172 LOG_ERROR("Cannot freeze non-existing dependent parameter", id.to_string(), "in block", blockName);
173 }
174
175 return this->blockAccessor->at(blockName)->retrieve(id)->freeze();
176}
177
178void Parameters::unfreeze_param(const BlockName &blockName, const LhaID &id) {
179 return this->blockAccessor->at(blockName)->retrieve(id)->unfreeze();
180}
181
182void Parameters::detach_block(const BlockName &blockName) {
183 this->blockAccessor->detach_block(blockName);
184}
185
186void Parameters::reattach_block(const BlockName &blockName) {
187 this->blockAccessor->reattach_block(blockName);
188}
189
190void Parameters::detach_param(const BlockName &blockName, const LhaID &id) {
191 this->blockAccessor->detach_parameter(blockName, id);
192}
193
194void Parameters::reattach_param(const BlockName &blockName, const LhaID &id) {
195 this->blockAccessor->reattach_parameter(blockName, id);
196}
197
198std::ostream &operator<<(std::ostream &os, std::shared_ptr<Parameters> instance) {
199 os << instance->blockAccessor;
200 return os;
201}
202
203std::unordered_set<BlockName> SMModelStrategy::initializeParameters(Parameters& params) {
205 return absent_blocks;
206}
207
208namespace {
209
210double superiso_scale(double ref_mass, double x_log2)
211{
212 return (x_log2 > 0.0)
213 ? std::pow(2.0, x_log2) * ref_mass
214 : ref_mass;
215}
216
217void add_wilson_ew_scale_from_nuisance()
218{
219 std::unordered_map<ParameterType, std::vector<std::string>> src = {
220 {ParameterType::SM, {"MASS"}},
221 {ParameterType::WILSON, {"SCALE_NUIS"}}
222 };
223
224 auto ew_scale_func =
225 [] (const BlockSrc& src, std::shared_ptr<DependentBlock> dep_block)
226 {
227 const double x_W = src.get_val("SCALE_NUIS", 1);
228 const double m_W = src.get_val("MASS", 24);
229
230 const double mu_W = superiso_scale(m_W, x_W);
231
232 dep_block->store_or_assign(
233 1,
234 std::make_shared<Parameter>(
235 ParamId{ParameterType::WILSON, "EW_SCALE", 1},
236 mu_W, 0.0, 0.0
237 )
238 );
239 };
240
242 "EW_SCALE",
243 src,
245 ew_scale_func
246 );
247}
248
249void add_wilson_b_scale_from_nuisance()
250{
251 std::unordered_map<ParameterType, std::vector<std::string>> src = {
252 {ParameterType::SM, {"QCD"}},
253 {ParameterType::WILSON, {"SCALE_NUIS"}}
254 };
255
256 auto b_scale_func =
257 [] (const BlockSrc& src, std::shared_ptr<DependentBlock> dep_block)
258 {
259 const double x_b = src.get_val("SCALE_NUIS", 2);
260
261 const double m_b_pole = src.get_val("QCD", LhaID(5, 2));
262
263 const double mu_b = superiso_scale(m_b_pole, x_b);
264
265 dep_block->store_or_assign(
266 1,
267 std::make_shared<Parameter>(
268 ParamId{ParameterType::WILSON, "B_SCALE", 1},
269 mu_b, 0.0, 0.0
270 )
271 );
272 };
273
275 "B_SCALE",
276 src,
278 b_scale_func
279 );
280}
281
282}
283
285
286
287
288 if (absent_blocks.contains("VCKM")) {
289 std::unordered_map<ParameterType, std::vector<std::string>> src_ckm = {
290 {ParameterType::SM, {"VCKMIN"}}
291 };
292
293 auto func_ckm = [] (const BlockSrc& src, std::shared_ptr<DependentBlock> dep_block) {
294 double lambda = src.get_val("VCKMIN", 1);
295 double l2 = lambda * lambda;
296 double l3 = l2 * lambda;
297 double A = src.get_val("VCKMIN", 2);
298 double rho = src.get_val("VCKMIN", 3);
299 double eta = src.get_val("VCKMIN", 4);
300
301 double s_12 = lambda;
302 double s_23 = A * l2;
303 complex_t u_13 = A * l3 * complex_t(rho, eta) * sqrt(1 - std::pow(A * l2, 2)) / (std::sqrt(1 - l2) * (1. - std::pow(A * l2, 2) * complex_t(rho, eta)));
304 double s_13 = std::abs(u_13);
305 complex_t expid = u_13 / std::abs(u_13);
306 double c_12 = std::sqrt(1 - s_12 * s_12);
307 double c_23 = std::sqrt(1 - s_23 * s_23);
308 double c_13 = std::sqrt(1 - s_13 * s_13);
309
310 dep_block->store_or_assign(LhaID(0, 0), std::make_shared<Parameter>(ParamId{ParameterType::SM, "VCKM", LhaID(0, 0)}, c_12 * c_13, 0., 0.));
311 dep_block->store_or_assign(LhaID(0, 1), std::make_shared<Parameter>(ParamId{ParameterType::SM, "VCKM", LhaID(0, 1)}, s_12 * c_13, 0., 0.));
312 dep_block->store_or_assign(LhaID(0, 2), std::make_shared<Parameter>(ParamId{ParameterType::SM, "VCKM", LhaID(0, 2)}, s_13 / expid, 0., 0.));
313 dep_block->store_or_assign(LhaID(1, 0), std::make_shared<Parameter>(ParamId{ParameterType::SM, "VCKM", LhaID(1, 0)}, -s_12 * c_23 - c_12 * s_23 * s_13 * expid, 0., 0.));
314 dep_block->store_or_assign(LhaID(1, 1), std::make_shared<Parameter>(ParamId{ParameterType::SM, "VCKM", LhaID(1, 1)}, c_12 * c_23 - s_12 * s_23 * s_13 * expid, 0., 0.));
315 dep_block->store_or_assign(LhaID(1, 2), std::make_shared<Parameter>(ParamId{ParameterType::SM, "VCKM", LhaID(1, 2)}, s_23 * c_13, 0., 0.));
316 dep_block->store_or_assign(LhaID(2, 0), std::make_shared<Parameter>(ParamId{ParameterType::SM, "VCKM", LhaID(2, 0)}, s_12 * s_23 - c_12 * c_23 * s_13 * expid, 0., 0.));
317 dep_block->store_or_assign(LhaID(2, 1), std::make_shared<Parameter>(ParamId{ParameterType::SM, "VCKM", LhaID(2, 1)}, -c_12 * s_23 - s_12 * c_23 * s_13 * expid, 0., 0.));
318 dep_block->store_or_assign(LhaID(2, 2), std::make_shared<Parameter>(ParamId{ParameterType::SM, "VCKM", LhaID(2, 2)}, c_23 * c_13, 0., 0.));
319 };
320
322 }
323
324 if (absent_blocks.contains("UPMNS")) {
325 std::unordered_map<ParameterType, std::vector<std::string>> src_pmns = {
326 {ParameterType::SM, {"UPMNSIN"}}
327 };
328
329 auto func_pmns = [] (const BlockSrc& src, std::shared_ptr<DependentBlock> dep_block) {
330 double theta_12 = src.get_val("UPMNSIN", 1);
331 double theta_23 = src.get_val("UPMNSIN", 2);
332 double theta_13 = src.get_val("UPMNSIN", 3);
333 double delta = src.get_val("UPMNSIN", 4);
334 double alpha_1 = src.get_val("UPMNSIN", 5);
335 double alpha_2 = src.get_val("UPMNSIN", 6);
336
337 double s_12 = std::sin(theta_12);
338 double s_23 = std::sin(theta_23);
339 double s_13 = std::sin(theta_13);
340 double c_12 = std::sqrt(1 - s_12 * s_12);
341 double c_23 = std::sqrt(1 - s_23 * s_23);
342 double c_13 = std::sqrt(1 - s_13 * s_13);
343 complex_t exp_i_delta = std::exp(I * delta);
344 complex_t exp_i_alpha_1 = std::exp(I * alpha_1);
345 complex_t exp_i_alpha_2 = std::exp(I * alpha_2);
346
347 dep_block->store_or_assign(LhaID(0, 0), std::make_shared<Parameter>(ParamId{ParameterType::SM, "UPMNS", LhaID(0, 0)}, c_12 * c_13 * exp_i_alpha_1, 0., 0.));
348 dep_block->store_or_assign(LhaID(0, 1), std::make_shared<Parameter>(ParamId{ParameterType::SM, "UPMNS", LhaID(0, 1)}, s_12 * c_13 * exp_i_alpha_2, 0., 0.));
349 dep_block->store_or_assign(LhaID(0, 2), std::make_shared<Parameter>(ParamId{ParameterType::SM, "UPMNS", LhaID(0, 2)}, s_13 / exp_i_delta, 0., 0.));
350 dep_block->store_or_assign(LhaID(1, 0), std::make_shared<Parameter>(ParamId{ParameterType::SM, "UPMNS", LhaID(1, 0)}, (-s_12 * c_23 - c_12 * s_23 * s_13 * exp_i_delta) * exp_i_alpha_1, 0., 0.));
351 dep_block->store_or_assign(LhaID(1, 1), std::make_shared<Parameter>(ParamId{ParameterType::SM, "UPMNS", LhaID(1, 1)}, (c_12 * c_23 - s_12 * s_23 * s_13 * exp_i_delta) * exp_i_alpha_2, 0., 0.));
352 dep_block->store_or_assign(LhaID(1, 2), std::make_shared<Parameter>(ParamId{ParameterType::SM, "UPMNS", LhaID(1, 2)}, s_23 * c_13, 0., 0.));
353 dep_block->store_or_assign(LhaID(2, 0), std::make_shared<Parameter>(ParamId{ParameterType::SM, "UPMNS", LhaID(2, 0)}, (s_12 * s_23 - c_12 * c_23 * s_13 * exp_i_delta) * exp_i_alpha_1, 0., 0.));
354 dep_block->store_or_assign(LhaID(2, 1), std::make_shared<Parameter>(ParamId{ParameterType::SM, "UPMNS", LhaID(2, 1)}, (-c_12 * s_23 - s_12 * c_23 * s_13 * exp_i_delta) * exp_i_alpha_2, 0., 0.));
355 dep_block->store_or_assign(LhaID(2, 2), std::make_shared<Parameter>(ParamId{ParameterType::SM, "UPMNS", LhaID(2, 2)}, c_23 * c_13, 0., 0.));
356 };
357
358 DependentBlockManager::addDependentBlock("UPMNS", src_pmns, ParameterType::SM, func_pmns);
359 }
360
362
363 const bool has_ew_scale = wilson_params->exist("EW_SCALE", 1);
364 const bool has_b_scale = wilson_params->exist("B_SCALE", 1);
365
366 const bool has_x_w = wilson_params->exist("SCALE_NUIS", 1);
367 const bool has_x_b = wilson_params->exist("SCALE_NUIS", 2);
368
369 if (!has_ew_scale) {
370 if (!has_x_w) {
371 LOG_ERROR(
372 "MissingScale",
373 "WILSON::EW_SCALE[1] is absent and WILSON::SCALE_NUIS[1] is absent. "
374 "Provide either EW_SCALE directly or SCALE_NUIS[1] to derive it."
375 );
376 }
377
378 add_wilson_ew_scale_from_nuisance();
379 }
380
382
383 if (!has_b_scale) {
384 if (!has_x_b) {
385 LOG_ERROR(
386 "MissingScale",
387 "WILSON::B_SCALE[1] is absent and WILSON::SCALE_NUIS[2] is absent. "
388 "Provide either B_SCALE directly or SCALE_NUIS[2] to derive it."
389 );
390 }
391
392 add_wilson_b_scale_from_nuisance();
393 }
394
396
397
398 std::unordered_map<ParameterType, std::vector<std::string>> src = {
399 {ParameterType::SM, {"QCD"}},
400 {ParameterType::WILSON, {"EW_SCALE"}}
401 };
402
403 auto func = [] (const BlockSrc& src, std::shared_ptr<DependentBlock> dep_block) {
404 double mu_W = src.get_val("EW_SCALE", 1);
405 double mass_top_muW = QCDHelper::msbar_mass(6, mu_W, MassType::MSBAR);
406 double mass_b_muW_mbrun = QCDHelper::msbar_mass(5, mu_W, MassType::MSBAR);
407 double mass_b_muW_mbpole = QCDHelper::msbar_mass(5, mu_W, MassType::POLE);
408 double mass_c_muW = QCDHelper::msbar_mass(4, mu_W, MassType::POLE);
409
410 dep_block->store_or_assign(4, std::make_shared<Parameter>(ParamId{ParameterType::SM, "MASS_EW_SCALE", 4}, mass_c_muW, 0., 0.));
411 dep_block->store_or_assign(LhaID(5, 1), std::make_shared<Parameter>(ParamId{ParameterType::SM, "MASS_EW_SCALE", LhaID(5, 1)}, mass_b_muW_mbrun, 0., 0.));
412 dep_block->store_or_assign(LhaID(5, 2), std::make_shared<Parameter>(ParamId{ParameterType::SM, "MASS_EW_SCALE", LhaID(5, 2)}, mass_b_muW_mbpole, 0., 0.));
413 dep_block->store_or_assign(6, std::make_shared<Parameter>(ParamId{ParameterType::SM, "MASS_EW_SCALE", 6}, mass_top_muW, 0., 0.));
414 };
415
417}
418
419std::unordered_set<BlockName> BSMModelStrategy::initializeParameters(Parameters& params) {
421 return absent_blocks;
422}
423
425 const auto& cache = MemoryManager::GetInstance()->getMemoryCache();
426 if (cache.config.model != Model::SUSY) return;
427
428 auto ensure_zero_7x7 = [&](const std::string& block_name) {
429 auto have = params.get_blocks_list();
430 if (have.find(block_name) != have.end()) return;
431
432 auto filler = [](const BlockSrc&, std::shared_ptr<DependentBlock> dep_block) {
433 for (int i = 1; i <= 7; ++i) {
434 for (int j = 1; j <= 7; ++j) {
435 dep_block->store_or_assign(
436 LhaID(i, j),
437 std::make_shared<Parameter>(
438 ParamId{ParameterType::BSM, dep_block->get_name(), LhaID(i, j)},
439 0.0, 0.0, 0.0
440 )
441 );
442 }
443 }
444 };
445
447 block_name,
448 {},
450 filler
451 );
452 };
453
454 ensure_zero_7x7("USQMIX");
455 ensure_zero_7x7("DSQMIX");
456 }
457
458std::unordered_set<BlockName> FlavorStrategy::initializeParameters(Parameters& params) {
460 return absent_blocks;
461}
462
463std::unordered_set<BlockName> WilsonInputStrategy::initializeParameters(Parameters &params) {
465 return absent_blocks;
466}
467
469 const auto& cfg = MemoryManager::GetInstance()->getMemoryCache().config;
470
471 if (!cfg.flags.at(ExternalFlag::HAS_WILSON_INPUT)) {
472 return;
473 }
474
475 const double muW = params.get_block_scale("FWCOEF");
476
477 if (params.exist("EW_SCALE", 1)) {
478 params.setBlockValue("EW_SCALE", 1, muW);
479 return;
480 }
481
483 "EW_SCALE",
484 {},
486 [muW](const BlockSrc&, std::shared_ptr<DependentBlock> dep_block) {
487 dep_block->store_or_assign(
488 1,
489 std::make_shared<Parameter>(
490 ParamId{ParameterType::WILSON, "EW_SCALE", 1},
491 muW, 0.0, 0.0
492 )
493 );
494 }
495 );
496}
497
498std::unordered_set<BlockName> DecayStrategy::initializeParameters(Parameters &params) {
500 return absent_blocks;
501}
502
503std::unordered_set<BlockName> ObservableStrategy::initializeParameters(Parameters &params) {
505 return absent_blocks;
506}
507
508std::unordered_set<BlockName> PassthroughStrategy::initializeParameters(Parameters &params) {
510 return absent_blocks;
511}
512
514 // blockAccessor->setMode(param_id.block, param_id.code, new_mode);
515 //not use
516}
517
518void Parameters::shiftParameter(const ParamId &param_id, scalar_t shift_value) {
519 blockAccessor->setValue(param_id.block, param_id.code, blockAccessor->getValue(param_id.block, param_id.code) + shift_value);
520}
521
522std::shared_ptr<Parameters> ParametersFactory::GetParameters(ParameterType id) {
523 auto it = instances.find(id);
524 if (it != instances.end()) {
525 return it->second;
526 }
527
528 try {
530 id,
531 [id](const std::shared_ptr<Parameters>& params) {
532 ParametersFactory::instances[id] = params;
533 }
534 );
535 } catch (...) {
536 ParametersFactory::instances.erase(id);
537 throw;
538 }
539}
540
541std::shared_ptr<Parameters> ParametersFactory::CreateUncached(ParameterType id) {
542 return CreateUncachedRegistered(id, {});
543}
544
546 ParameterType id,
547 const std::function<void(const std::shared_ptr<Parameters>&)>& register_before_postinit
548) {
549 std::shared_ptr<ModelStrategy> strategy = createStrategy(id);
550 auto params = std::shared_ptr<Parameters>(new Parameters(strategy));
551
552 if (register_before_postinit) {
553 register_before_postinit(params);
554 }
555
556 strategy->postInitialization(*params);
557 return params;
558}
559
561 if (instances.find(id) == instances.end()) {
562 LOG_ERROR("OutOfRange", "Cannot remove parameters if it doesn't exist");
563 }
564 LOG_DEBUG("erasing ; ", (int)id);
565 std::shared_ptr<Parameters> _ = instances[id];
566 instances.erase(id);
567}
568
569std::shared_ptr<ModelStrategy> ParametersFactory::createStrategy(ParameterType id) {
570 switch (id) {
572 return std::make_shared<SMModelStrategy>(SMModelStrategy());
574 return std::make_shared<BSMModelStrategy>(BSMModelStrategy());
576 return std::make_shared<FlavorStrategy>(FlavorStrategy());
578 return std::make_shared<WilsonInputStrategy>(WilsonInputStrategy());
580 return std::make_shared<DecayStrategy>(DecayStrategy());
582 return std::make_shared<ObservableStrategy>(ObservableStrategy());
584 return std::make_shared<PassthroughStrategy>(PassthroughStrategy());
585 default:
586 throw std::invalid_argument("Unknown parameters instance ID");
587 }
588}
589
591 instances.clear();
592}
593
594void Parameters::print_block(const std::string blockname) {
595 std::cout << this->blockAccessor->at(blockname) << std::endl;
596}
@ HAS_TH_OBSERVABLE_INPUT
User provided theoretical observable input.
@ HAS_WILSON_INPUT
User provided Wilson coefficient input.
Provides static utilities to create, manage, and update dependent blocks and dependent parameters.
ParameterType
#define LOG_ERROR(type,...)
Macro for logging error messages and terminating the application.
Definition Logger.h:41
#define LOG_INFO(...)
Macro for logging informational messages.
Definition Logger.h:39
#define LOG_DEBUG(...)
Macro for logging debug messages.
Definition Logger.h:45
#define LOG_VERBOSE(...)
Macro for logging verbose messages.
Definition Logger.h:47
Manages memory caching, parameter blocks, and LHA reader instances.
ParameterMode
Defines the modes in which a parameter can operate.
Definition Parameter.h:45
std::ostream & operator<<(std::ostream &os, std::shared_ptr< Parameters > instance)
auto matches_block
Model-dependent parameter repository and initialization strategies.
std::string to_string(const LhaID &id)
Convenience stringification for LhaID.
Definition SourceView.cpp:9
std::complex< double > complex_t
Convenience alias for std::complex<double>.
Definition Utils.h:35
Strategy responsible for BSM parameters.
Definition Parameters.h:174
std::unordered_set< BlockName > initializeParameters(class Parameters &params) override
Initializes the block set for the target parameter repository.
void postInitialization(Parameters &params) override
Performs additional initialization after raw blocks are loaded.
Block identifier with alias support.
Definition BlockName.h:59
Lightweight view over a set of source blocks.
Definition SourcesView.h:71
scalar_t get_val(std::string_view blk, std::initializer_list< long > code) const
Retrieves the value of a parameter given as an initializer_list.
Strategy responsible for decay-related parameter blocks.
Definition Parameters.h:270
std::unordered_set< BlockName > initializeParameters(class Parameters &params) override
Initializes the block set for the target parameter repository.
static void addDependentBlock(std::string name, std::unordered_map< ParameterType, std::vector< std::string > > source_names, ParameterType dest, DepUpdateFunc recalculateFunc)
Adds a DependentBlock with multiple sources coming from various Parameters instances.
static void Init()
Initializes the EW dependent block.
Definition EWHelper.cpp:5
Strategy responsible for flavor-sector input blocks.
Definition Parameters.h:195
std::unordered_set< BlockName > initializeParameters(class Parameters &params) override
Initializes the block set for the target parameter repository.
static std::string str(const IdOf< ParamTypeTag > &id)
Returns the string representation associated with an identifier.
const MemoryCache & getMemoryCache()
Retrieves the current memory cache.
static MemoryManager * GetInstance()
Retrieves the singleton instance of MemoryManager.
std::shared_ptr< BlockAccessor > extract_blocks(std::unordered_set< BlockName > block_names)
Extracts specific blocks from the cached input.
std::unordered_set< BlockName > absent_blocks
Definition Parameters.h:132
Strategy responsible for observable-related blocks.
Definition Parameters.h:293
std::unordered_set< BlockName > initializeParameters(class Parameters &params) override
Initializes the block set for the target parameter repository.
static std::unordered_set< BlockName > GetOwnedBlocks(ParameterType ptype)
Retrieves all blocks owned by a given ParameterType.
std::unordered_set< BlockName > available_input_blocks() const
static ParameterRuntimeContext * current()
static std::shared_ptr< Parameters > CreateUncachedRegistered(ParameterType id, const std::function< void(const std::shared_ptr< Parameters > &)> &register_before_postinit)
Creates a fresh uncached repository and registers it before post-initialization.
static std::shared_ptr< Parameters > CreateUncached(ParameterType id)
Creates a fresh uncached repository for a runtime context.
static void clear()
static std::shared_ptr< Parameters > GetParameters(ParameterType id)
Returns the cached repository for one parameter type.
static void removeParameters(ParameterType id)
Removes one cached repository.
Block-based parameter repository for one ParameterType namespace.
Definition Parameters.h:351
void reattach_block(const BlockName &blockName)
Reattaches one previously detached dependent block.
void detach_param(const BlockName &blockName, const LhaID &id)
Detaches one dependent parameter from its upstream dependencies.
std::vector< std::string > get_dependent_blocks(const BlockName &blockName) const
Returns the direct blocks depending on one block.
std::vector< std::string > get_all_dependent_blocks(const BlockName &blockName) const
Returns all transitive blocks depending on one block.
std::unordered_set< BlockName > get_blocks_list()
Returns the list of blocks currently held in this repository.
void unfreeze_block(const BlockName &blockName)
Freezes one whole block.
void reattach_param(const BlockName &blockName, const LhaID &id)
Reattaches one previously detached dependent parameter.
void shiftParameter(const ParamId &param_id, scalar_t shift_value)
Applies an additive shift to a parameter by rewriting its value.
void CleanupInstance(ParameterType id=ParameterType::SM)
Removes one repository instance from the factory cache.
bool exist(const BlockName &block, LhaID pdgCode)
Checks whether a parameter exists in a given block.
std::unordered_set< BlockName > init_blocks(ParameterType type)
Loads the raw blocks for one parameter namespace from MemoryManager.
scalar_t operator()(const BlockName &block, LhaID pdgCode) const
Reads the current scalar value of a parameter.
void setBlockValue(const BlockName &name, LhaID pdgCode, scalar_t value)
Sets or creates a scalar value inside a block.
void detach_block(const BlockName &blockName)
Detaches one dependent block from its upstream dependency graph.
void changeParameterMode(const ParamId &param_id, ParameterMode new_mode)
Changes the mode of one parameter.
std::shared_ptr< Parameter > get_parameter(const BlockName &block, LhaID pdgCode)
Returns the full Parameter object for one entry.
static std::shared_ptr< Parameters > GetInstance(ParameterType id=ParameterType::SM)
Returns the singleton-like repository for a given parameter type.
std::vector< std::string > get_source_blocks(const BlockName &blockName) const
Returns the direct source blocks of one block.
double get_block_scale(BlockName blockName) const
Returns the scale attached to a block.
void unfreeze_param(const BlockName &blockName, const LhaID &id)
Unfreezes one parameter inside a block.
std::map< LhaID, scalar_t > get_block_infos(BlockName blockName)
Returns all scalar values stored in one block.
void freeze_param(const BlockName &blockName, const LhaID &id)
Freezes one parameter inside a block.
void freeze_block(const BlockName &blockName)
Freezes one whole block.
void print_block(const std::string blockname)
Prints one block to stdout.
std::vector< std::string > get_all_source_blocks(const BlockName &blockName) const
Returns all transitive source blocks of one block.
bool is_dependent_block(const BlockName &blockName) const
Checks whether one block is a dependent block.
Strategy responsible for passthrough / output-preserved blocks.
Definition Parameters.h:317
std::unordered_set< BlockName > initializeParameters(class Parameters &params) override
Initializes the block set for the target parameter repository.
static double msbar_mass(int pdg_code, double mu, MassType mass_b_type=MassType::POLE, MassType mass_t_type=MassType::POLE)
Computes the MS-bar running mass of a quark at scale μ.
Definition QCDHelper.cpp:64
static void Init()
Initializes the QCD dependent block.
Definition QCDHelper.cpp:3
Strategy responsible for Standard Model parameters.
Definition Parameters.h:149
void postInitialization(Parameters &params) override
Performs additional initialization after raw blocks are loaded.
std::unordered_set< BlockName > initializeParameters(class Parameters &params) override
Initializes the block set for the target parameter repository.
Strategy responsible for Wilson-coefficient input blocks.
Definition Parameters.h:249
void postInitialization(Parameters &params) override
Performs additional initialization after raw blocks are loaded.
std::unordered_set< BlockName > initializeParameters(class Parameters &params) override
Initializes the block set for the target parameter repository.
constexpr std::complex< double > I
Definition constants.h:20
std::map< ExternalFlag, bool > flags
External flags describing the nature of the inputs.
Definition Config.h:26
Represents an identifier of a LHA element, possibly containing several sub-ids.
Definition LhaID.h:56
std::vector< ParameterType > parameter_types
List of parameter types currently managed.
HyperisoConfig config
Config struct for various flags and runtime information.
Composite identifier for a single parameter.
Definition ParamID.h:57
BlockName block
Name of the block where the parameter is stored.
Definition ParamID.h:73
LhaID code
Index or multi-index of the parameter inside the block.
Definition ParamID.h:82