Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
GeneralNumModelModifier.h
Go to the documentation of this file.
1#ifndef GENERAL_NUM_MODEL_MODIFIER_H
2#define GENERAL_NUM_MODEL_MODIFIER_H
3
4#include <map>
5#include <string>
6#include <unordered_map>
7
8#include "ModelModifier.h"
9#include "Extractor.h"
10#include "Interpreter.h"
11#include "SMParamSetter.h"
12#include "ParamWriter.h"
13#include "IncludeManager.hpp"
14#include "LineProcessor.h"
15#include "ModelWriter.h"
16#include "MartyFileWriter.h"
17#include "FileNameManager.h"
18
47private:
48 std::string wilson;
49 std::string model;
50 bool bsm_split_generation{false};
51 bool full_target_generation{false};
52 bool forceMode;
53
54 Interpreter interpreter;
55 std::unique_ptr<SMParamSetter> paramSetter;
56 MartyFileWriter fileWriter;
57 LineProcessor lineProcessor;
58 ModelWriter modelWriter;
59 ParamWriter paramWriter;
60 IncludeManager includeManager;
61
63 std::map<std::string, std::string> paramMap;
64
66 std::unordered_map<std::string, double> params;
67
69 std::unordered_map<std::string, InterpretedParam> interpreted_params;
70
71
72public:
84 GeneralNumModelModifier(const std::string& wilson,
85 const std::string& model,
86 std::unique_ptr<SMParamSetter> param_setter,
87 std::shared_ptr<ICoreAPI<Model>> api,
88 std::shared_ptr<IInterpreterPortsFactory> ports,
89 bool force = false)
90 : GeneralNumModelModifier(wilson, model, model, std::move(param_setter), std::move(api), std::move(ports), force, false, false)
91 {}
92
101 GeneralNumModelModifier(const std::string& wilson,
102 const std::string& model,
103 const std::string& mapping_model,
104 std::unique_ptr<SMParamSetter> param_setter,
105 std::shared_ptr<ICoreAPI<Model>> api,
106 std::shared_ptr<IInterpreterPortsFactory> ports,
107 bool force = false,
108 bool bsm_split_generation = false,
109 bool full_target_generation = false)
110 : wilson(wilson),
111 model(model),
112 bsm_split_generation(bsm_split_generation),
113 full_target_generation(full_target_generation),
114 forceMode(force),
115 interpreter(mapping_model, api, ports),
116 paramSetter(std::move(param_setter)),
117 fileWriter(wilson, model, bsm_split_generation, full_target_generation),
118 lineProcessor(includeManager, fileWriter, force),
119 modelWriter(lineProcessor, paramWriter) {
120 initializeParams();
121 }
122
127 : wilson(other.wilson),
128 model(other.model),
129 bsm_split_generation(other.bsm_split_generation),
130 full_target_generation(other.full_target_generation),
131 forceMode(other.forceMode),
132 interpreter(other.interpreter),
133 paramSetter(other.paramSetter ? std::make_unique<SMParamSetter>(*other.paramSetter) : nullptr),
134 fileWriter(other.wilson, other.model, other.bsm_split_generation, other.full_target_generation),
135 lineProcessor(includeManager, fileWriter, other.forceMode),
136 modelWriter(lineProcessor, paramWriter),
137 paramWriter(other.paramWriter),
138 includeManager(other.includeManager),
139 paramMap(other.paramMap),
140 params(other.params),
141 interpreted_params(other.interpreted_params)
142{}
143
154 void modify(std::ifstream& inputFile, std::ofstream& outputFile);
155
165 void createparamfile(std::ofstream& paramFile, const std::unordered_map<std::string, double> &params);
166
171 std::unordered_map<std::string, InterpretedParam> get_interpreted_param_map() { return this->interpreted_params; }
172
177 std::unordered_map<std::string, double> get_params() {return this->params;}
178private:
189 void initializeParams();
190};
191
192#endif // GENERAL_NUM_MODEL_MODIFIER_H
Declares utilities to extract parameter declarations from C++ code.
Manages file and directory names for generated MARTY code and assets.
Declares the Interpreter that maps MARTY parameters to Hyperiso IDs.
Declares a line-based transformer for MARTY-generated C++ files.
Declares utilities to generate C++ code for MARTY wrappers.
Declares the base interface for source-level model transformations.
Declares a helper that writes processed model code and parameters.
Declares a small helper to write parameter maps to CSV files.
High-level orchestrator for numeric MARTY model generation.
std::unordered_map< std::string, double > get_params()
Returns the map of numerical parameter values.
GeneralNumModelModifier(const std::string &wilson, const std::string &model, std::unique_ptr< SMParamSetter > param_setter, std::shared_ptr< ICoreAPI< Model > > api, std::shared_ptr< IInterpreterPortsFactory > ports, bool force=false)
Constructs a numeric model modifier for a given (Wilson, model) pair.
GeneralNumModelModifier(const std::string &wilson, const std::string &model, const std::string &mapping_model, std::unique_ptr< SMParamSetter > param_setter, std::shared_ptr< ICoreAPI< Model > > api, std::shared_ptr< IInterpreterPortsFactory > ports, bool force=false, bool bsm_split_generation=false, bool full_target_generation=false)
Constructs a numeric model modifier with distinct output and parameter-resolution models.
std::unordered_map< std::string, InterpretedParam > get_interpreted_param_map()
Returns the interpreted parameter mapping.
GeneralNumModelModifier(const GeneralNumModelModifier &other)
Copy constructor used to duplicate the whole modification pipeline.
void createparamfile(std::ofstream &paramFile, const std::unordered_map< std::string, double > &params)
Writes the parameter CSV/param file.
void modify(std::ifstream &inputFile, std::ofstream &outputFile)
Applies the numeric model transformation to a template file.
Generic interface returning a single value of type T from the core.
Definition ICoreAPI.h:30
Manages insertion of required #include directives.
Resolves MARTY parameter names into Hyperiso blocks and IDs.
Definition Interpreter.h:41
Processes lines of a template C++ file and injects custom code.
Emits C++ helper code to handle CLI, IO and Wilson output.
High-level helper for writing modified model code and parameter files.
Definition ModelWriter.h:28
Helper class to serialize parameter values to a text stream.
Definition ParamWriter.h:29
Converts Hyperiso parameters into MARTY input parameters.
Hash specialization for SymbolId<Tag>.
Definition BlockName.h:353