forked from Expander/FlexibleSUSY
/
slha_io.cpp.in
271 lines (236 loc) · 7.39 KB
/
slha_io.cpp.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
// ====================================================================
// This file is part of FlexibleSUSY.
//
// FlexibleSUSY is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// FlexibleSUSY is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FlexibleSUSY. If not, see
// <http://www.gnu.org/licenses/>.
// ====================================================================
// File generated at @DateAndTime@
#include "@ModelName@_slha_io.hpp"
#include "@ModelName@_input_parameters.hpp"
#include "logger.hpp"
#include "wrappers.hpp"
#include "numerics.hpp"
#include "spectrum_generator_settings.hpp"
#include "lowe.h"
#include "config.h"
#include <fstream>
#include <sstream>
#include <iostream>
#include <boost/bind.hpp>
using namespace softsusy;
namespace flexiblesusy {
char const * const @ModelName@_slha_io::drbar_blocks[NUMBER_OF_DRBAR_BLOCKS] =
@drBarBlockNames@;
@ModelName@_slha_io::@ModelName@_slha_io()
: slha_io()
{
}
void @ModelName@_slha_io::clear()
{
slha_io.clear();
}
/**
* Stores the EXTPAR input parameters in the SLHA object.
*
* @param input struct of input parameters
*/
void @ModelName@_slha_io::set_extpar(const @ModelName@_input_parameters& input)
{
@writeSLHAExtparBlock@
}
/**
* Stores the MINPAR input parameters in the SLHA object.
*
* @param input struct of input parameters
*/
void @ModelName@_slha_io::set_minpar(const @ModelName@_input_parameters& input)
{
@writeSLHAMinparBlock@
}
/**
* Stores the SMINPUTS input parameters in the SLHA object.
*
* @param qedqcd class of Standard Model parameters
*/
void @ModelName@_slha_io::set_sminputs(const softsusy::QedQcd& qedqcd)
{
slha_io.set_sminputs(qedqcd);
}
/**
* Stores the spectrum generator information in the SPINFO block in
* the SLHA object.
*
* @param problems struct with parameter point problems
*/
void @ModelName@_slha_io::set_spinfo(const Problems<@ModelName@_info::NUMBER_OF_PARTICLES>& problems)
{
std::ostringstream spinfo;
spinfo << "Block SPINFO\n"
<< FORMAT_SPINFO(1, PKGNAME)
<< FORMAT_SPINFO(2, FLEXIBLESUSY_VERSION);
if (problems.have_warning()) {
std::ostringstream warnings;
problems.print_warnings(warnings);
spinfo << FORMAT_SPINFO(3, warnings.str());
}
if (problems.have_problem()) {
std::ostringstream problems_str;
problems.print_problems(problems_str);
spinfo << FORMAT_SPINFO(4, problems_str.str());
}
slha_io.set_block(spinfo, SLHA_io::front);
}
/**
* Stores the particle masses in the SLHA object.
*
* @param physical struct of physical parameters
*
* @param write_sm_masses flag to indicate if Standard Model
* particle masses should be written as well
*/
void @ModelName@_slha_io::set_mass(const @ModelName@_physical& physical,
bool write_sm_masses)
{
@writeSLHAMassBlock@
}
/**
* Stores the mixing matrices in the SLHA object.
*
* @param physical struct of physical parameters
*
* @param write_sm_mixing_matrics flag to indicate if Standard Model
* particle mixing matrices should be written as well
*/
void @ModelName@_slha_io::set_mixing_matrices(const @ModelName@_physical& physical,
bool write_sm_mixing_matrics)
{
@writeSLHAMixingMatricesBlocks@
}
/**
* Write SLHA object to file.
*
* @param file_name file name
*/
void @ModelName@_slha_io::write_to_file(const std::string& file_name)
{
slha_io.write_to_file(file_name);
}
/**
* Read (DR-bar) model parameter input scale from EXTPAR entry 0
*/
double @ModelName@_slha_io::get_input_scale() const
{
return slha_io.get_extpar().input_scale;
}
/**
* Read (DR-bar) model parameter output scale from MODSEL entry 12
*/
double @ModelName@_slha_io::get_parameter_output_scale() const
{
return slha_io.get_modsel().parameter_output_scale;
}
/**
* Read SLHA object from file
*
* @param file_name file name
*/
void @ModelName@_slha_io::read_from_file(const std::string& file_name)
{
slha_io.read_from_file(file_name);
slha_io.read_modsel();
slha_io.read_extpar();
}
/**
* Fill struct of model input parameters from SLHA object (MINPAR and
* EXTPAR blocks)
*
* @param input struct of model input parameters
*/
void @ModelName@_slha_io::fill(@ModelName@_input_parameters& input) const
{
SLHA_io::Tuple_processor minpar_processor
= boost::bind(&@ModelName@_slha_io::fill_minpar_tuple, boost::ref(input), _1, _2);
SLHA_io::Tuple_processor extpar_processor
= boost::bind(&@ModelName@_slha_io::fill_extpar_tuple, boost::ref(input), _1, _2);
slha_io.read_block("MINPAR", minpar_processor);
slha_io.read_block("EXTPAR", extpar_processor);
@readLesHouchesInputParameters@
}
/**
* Fill struct of spectrum generator settings from SLHA object
* (FlexibleSUSY block)
*
* @param settings struct of spectrum generator settings
*/
void @ModelName@_slha_io::fill(Spectrum_generator_settings& settings) const
{
SLHA_io::Tuple_processor flexiblesusy_processor
= boost::bind(&@ModelName@_slha_io::fill_flexiblesusy_tuple, boost::ref(settings), _1, _2);
slha_io.read_block("FlexibleSUSY", flexiblesusy_processor);
}
void @ModelName@_slha_io::fill_minpar_tuple(@ModelName@_input_parameters& input,
int key, double value)
{
@fillInputParametersFromMINPAR@
}
void @ModelName@_slha_io::fill_extpar_tuple(@ModelName@_input_parameters& input,
int key, double value)
{
// key 0 is the model parameter input scale, which is read in
// slha_io.{hpp,cpp}
if (key == 0)
return;
@fillInputParametersFromEXTPAR@
}
void @ModelName@_slha_io::fill_flexiblesusy_tuple(Spectrum_generator_settings& settings,
int key, double value)
{
if (0 <= key && key < static_cast<int>(Spectrum_generator_settings::NUMBER_OF_OPTIONS)) {
settings.set((Spectrum_generator_settings::Settings)key, value);
} else {
WARNING("Unrecognized key in block FlexibleSUSY: " << key);
}
}
/**
* Reads the renormalization scales from all DR-bar parameter blocks.
* If blocks with different scales are found the last scale is
* returned and a warning is printed.
*
* @return common renormalization scale
*/
double @ModelName@_slha_io::read_scale() const
{
double scale = 0.;
for (unsigned i = 0; i < NUMBER_OF_DRBAR_BLOCKS; i++) {
const double block_scale = slha_io.read_scale(drbar_blocks[i]);
if (!is_zero(block_scale)) {
if (!is_zero(scale) && !is_equal(scale, block_scale))
WARNING("DR-bar parameters defined at different scales");
scale = block_scale;
}
}
return scale;
}
/**
* Convert masses and mixing matrices to SLHA convention: Fermion
* mixing matrices are always real and fermion masses are allowed to
* be negative.
*
* @param physical struct of physical parameters to convert
*/
void @ModelName@_slha_io::convert_to_slha_convention(@ModelName@_physical& physical)
{
@convertMixingsToSLHAConvention@
}
} // namespace flexiblesusy