flexiblesusy is hosted by Hepforge, IPPP Durham
FlexibleSUSY
spectrum_generator_settings.cpp
Go to the documentation of this file.
1// ====================================================================
2// This file is part of FlexibleSUSY.
3//
4// FlexibleSUSY is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published
6// by the Free Software Foundation, either version 3 of the License,
7// or (at your option) any later version.
8//
9// FlexibleSUSY is distributed in the hope that it will be useful, but
10// WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with FlexibleSUSY. If not, see
16// <http://www.gnu.org/licenses/>.
17// ====================================================================
18
20#include "error.hpp"
21#include "string_format.hpp"
22
23#include <cmath>
24#include <iostream>
25#include <string>
26
27namespace flexiblesusy {
28
29namespace {
30const std::array<std::string, Spectrum_generator_settings::NUMBER_OF_OPTIONS> descriptions = {
31 "precision goal",
32 "max. iterations (0 = automatic)",
33 "solver (0 = all)",
34 "calculate SM pole masses",
35 "pole mass loop order",
36 "EWSB loop order",
37 "beta-functions loop order",
38 "threshold corrections loop order",
39 "Higgs 2-loop corrections O(alpha_t alpha_s)",
40 "Higgs 2-loop corrections O(alpha_b alpha_s)",
41 "Higgs 2-loop corrections O((alpha_t + alpha_b)^2)",
42 "Higgs 2-loop corrections O(alpha_tau^2)",
43 "force output",
44 "Top pole mass QCD corrections (0 = 1L, 1 = 2L, 2 = 3L)",
45 "beta-function zero threshold",
46 "calculate all observables",
47 "force positive majorana masses",
48 "pole mass renormalization scale (0 = SUSY scale)",
49 "pole mass renormalization scale in the EFT (0 = min(SUSY scale, Mt))",
50 "EFT matching scale (0 = SUSY scale)",
51 "EFT loop order for upwards matching",
52 "EFT loop order for downwards matching",
53 "EFT index of SM-like Higgs in the BSM model",
54 "calculate BSM pole masses",
55 "individual threshold correction loop orders",
56 "Renormalization scheme for Higgs 3-loop corrections O(alpha_t alpha_s^2 + alpha_b alpha_s^2)",
57 "Higgs 3-loop corrections O(alpha_t alpha_s^2)",
58 "Higgs 3-loop corrections O(alpha_b alpha_s^2)",
59 "Higgs 3-loop corrections O(alpha_t^2 alpha_s)",
60 "Higgs 3-loop corrections O(alpha_t^3)",
61 "Higgs 4-loop corrections O(alpha_t alpha_s^3)",
62 "loop library type (0 = Softsusy)",
63 "calculate amm (0 = no, 1 = 1L, 1.5 = 1L+2L(QED), 2 = 1L+2L(QED) + 2L(Barr-Zee))"
64};
65
66bool is_integer(double value)
67{
68 double intpart;
69 return std::modf(value, &intpart) == 0.0;
70}
71
72void assert_bool(double value, const char* quantity)
73{
74 if (value != 0.0 && value != 1.0) {
75 throw SetupError(std::string(quantity) + " must either 0 or 1");
76 }
77}
78
79void assert_integer(double value, const char* quantity)
80{
81 if (!is_integer(value)) {
82 throw SetupError(std::string(quantity) + " must be an integer");
83 }
84}
85
86void assert_ge(double value, double lower_bound, const char* quantity)
87{
88 if (value < lower_bound) {
89 throw SetupError(std::string(quantity) +
90 " must be greater than or equal to " +
91 flexiblesusy::to_string(lower_bound));
92 }
93}
94
95void assert_gt(double value, double lower_bound, const char* quantity)
96{
97 if (value <= lower_bound) {
98 throw SetupError(std::string(quantity) + " must be greater than " +
99 flexiblesusy::to_string(lower_bound));
100 }
101}
102
103void assert_le(double value, double upper_bound, const char* quantity)
104{
105 if (value > upper_bound) {
106 throw SetupError(std::string(quantity) +
107 " must be lower than or equal to " +
108 flexiblesusy::to_string(upper_bound));
109 }
110}
111
112void assert_lt(double value, double upper_bound, const char* quantity)
113{
114 if (value >= upper_bound) {
115 throw SetupError(std::string(quantity) +
116 " must be lower than " +
117 flexiblesusy::to_string(upper_bound));
118 }
119}
120
121} // anonymous namespace
122
130{
131 reset();
132}
133
135{
136 return values.at(o);
137}
138
140{
141 Settings_t s(&values[0]);
142 return s;
143}
144
146{
147 return descriptions.at(o);
148}
149
151{
152 switch (o) {
153 case precision: // 0 [double > 0]
154 assert_gt(value, 0.0, descriptions.at(o).c_str());
155 break;
156 case max_iterations: // 1 [int >= 0]
157 assert_integer(value, descriptions.at(o).c_str());
158 assert_ge(value, 0, descriptions.at(o).c_str());
159 break;
160 case solver: // 2 [int >= 0]
161 assert_integer(value, descriptions.at(o).c_str());
162 assert_ge(value, 0, descriptions.at(o).c_str());
163 break;
164 case calculate_sm_masses: // 3 [bool]
165 assert_bool(value, descriptions.at(o).c_str());
166 break;
167 case pole_mass_loop_order: // 4 [int >= 0]
168 assert_integer(value, descriptions.at(o).c_str());
169 assert_ge(value, 0, descriptions.at(o).c_str());
170 break;
171 case ewsb_loop_order: // 5 [int >= 0]
172 assert_integer(value, descriptions.at(o).c_str());
173 assert_ge(value, 0, descriptions.at(o).c_str());
174 break;
175 case beta_loop_order: // 6 [int >= 0]
176 assert_integer(value, descriptions.at(o).c_str());
177 assert_ge(value, 0, descriptions.at(o).c_str());
178 break;
179 case threshold_corrections_loop_order: // 7 [int >= 0]
180 assert_integer(value, descriptions.at(o).c_str());
181 assert_ge(value, 0, descriptions.at(o).c_str());
182 break;
183 case higgs_2loop_correction_at_as: // 8 [bool]
184 assert_bool(value, descriptions.at(o).c_str());
185 break;
186 case higgs_2loop_correction_ab_as: // 9 [bool]
187 assert_bool(value, descriptions.at(o).c_str());
188 break;
189 case higgs_2loop_correction_at_at: // 10 [bool]
190 assert_bool(value, descriptions.at(o).c_str());
191 break;
192 case higgs_2loop_correction_atau_atau: // 11 [bool]
193 assert_bool(value, descriptions.at(o).c_str());
194 break;
195 case force_output: // 12 [bool]
196 assert_bool(value, descriptions.at(o).c_str());
197 break;
198 case top_pole_qcd_corrections: // 13 [int >= 0]
199 assert_integer(value, descriptions.at(o).c_str());
200 assert_ge(value, 0, descriptions.at(o).c_str());
201 break;
202 case beta_zero_threshold: // 14 [double > 0]
203 assert_ge(value, 0.0, descriptions.at(o).c_str());
204 break;
205 case calculate_observables: // 15 [bool]
206 assert_bool(value, descriptions.at(o).c_str());
207 break;
208 case force_positive_masses: // 16 [bool]
209 assert_bool(value, descriptions.at(o).c_str());
210 break;
211 case pole_mass_scale: // 17 [double >= 0]
212 assert_ge(value, 0.0, descriptions.at(o).c_str());
213 break;
214 case eft_pole_mass_scale: // 18 [double >= 0]
215 assert_ge(value, 0.0, descriptions.at(o).c_str());
216 break;
217 case eft_matching_scale: // 19 [double >= 0]
218 assert_ge(value, 0.0, descriptions.at(o).c_str());
219 break;
220 case eft_matching_loop_order_up: // 20 [int >= 0]
221 assert_integer(value, descriptions.at(o).c_str());
222 assert_ge(value, 0, descriptions.at(o).c_str());
223 break;
224 case eft_matching_loop_order_down: // 21 [int >= 0]
225 assert_integer(value, descriptions.at(o).c_str());
226 assert_ge(value, 0, descriptions.at(o).c_str());
227 break;
228 case eft_higgs_index: // 22 [int >= 0]
229 assert_integer(value, descriptions.at(o).c_str());
230 assert_ge(value, 0, descriptions.at(o).c_str());
231 break;
232 case calculate_bsm_masses: // 23 [bool]
233 assert_bool(value, descriptions.at(o).c_str());
234 break;
235 case threshold_corrections: // 24 [int >= 0]
236 assert_integer(value, descriptions.at(o).c_str());
237 assert_ge(value, 0, descriptions.at(o).c_str());
238 break;
239 case higgs_3loop_ren_scheme_atb_as2: // 25 [int >= 0 and <= 2]
240 assert_integer(value, descriptions.at(o).c_str());
241 assert_ge(value, 0, descriptions.at(o).c_str());
242 assert_le(value, 2, descriptions.at(o).c_str());
243 break;
244 case higgs_3loop_correction_at_as2: // 26 [bool]
245 assert_bool(value, descriptions.at(o).c_str());
246 break;
247 case higgs_3loop_correction_ab_as2: // 27 [bool]
248 assert_bool(value, descriptions.at(o).c_str());
249 break;
250 case higgs_3loop_correction_at2_as: // 28 [bool]
251 assert_bool(value, descriptions.at(o).c_str());
252 break;
253 case higgs_3loop_correction_at3: // 29 [bool]
254 assert_bool(value, descriptions.at(o).c_str());
255 break;
256 case higgs_4loop_correction_at_as3: // 30 [bool]
257 assert_bool(value, descriptions.at(o).c_str());
258 break;
259 case loop_library: // 31 [int >= -1 and <= 3]
260 assert_integer(value, descriptions.at(o).c_str());
261 assert_ge(value, -1, descriptions.at(o).c_str());
262 assert_le(value, 3, descriptions.at(o).c_str());
263 break;
264 case calculate_amm: // 32 [double >= 0 and < 3]
265 assert_ge(value, 0, descriptions.at(o).c_str());
266 assert_lt(value, 3, descriptions.at(o).c_str());
267 break;
268 default:
269 break;
270 }
271
272 values.at(o) = value;
273}
274
276{
277 std::copy(s.data(), s.data() + s.size(), values.begin());
278}
279
320{
321 values[precision] = 1.0e-4;
322 values[max_iterations] = 0.; // 0 = automatic
323 values[solver] = 0.; // 0 = all
324 values[calculate_sm_masses] = 0.; // 0 = false
333 values[force_output] = 0;
334 values[calculate_sm_masses] = 0.; // 0 = false
336 values[beta_zero_threshold] = 1.0e-11;
353 values[loop_library] = -1.; // -1 = (set via environment FLEXIBLESUSY_LOOP_LIBRARY)
354 values[calculate_amm] = 2.0;
355}
356
358{
359 Loop_corrections loop_corrections;
360 loop_corrections.higgs_at_as = get(higgs_2loop_correction_at_as);
361 loop_corrections.higgs_ab_as = get(higgs_2loop_correction_ab_as);
362 loop_corrections.higgs_at_at = get(higgs_2loop_correction_at_at);
370 loop_corrections.top_qcd = get(top_pole_qcd_corrections);
371
372 return loop_corrections;
373}
374
376 const Loop_corrections& loop_corrections)
377{
388 set(top_pole_qcd_corrections, loop_corrections.top_qcd);
389}
390
392{
394}
395
397{
399}
400
401std::ostream& operator<<(std::ostream& ostr, const Spectrum_generator_settings& sgs)
402{
403 ostr << "(";
404
405 for (int i = 0; i < Spectrum_generator_settings::NUMBER_OF_OPTIONS; i++) {
406 ostr << sgs.get(static_cast<Spectrum_generator_settings::Settings>(i));
408 ostr << ", ";
409 }
410
411 ostr << ")";
412
413 return ostr;
414}
415
416} // namespace flexiblesusy
Spectrum generator was not setup correctly.
Definition: error.hpp:46
stores the spectrum generator settings
Eigen::Array< double, NUMBER_OF_OPTIONS, 1 > Settings_t
void reset()
resets all settings to their defaults
void set_threshold_corrections(const Threshold_corrections &)
std::string get_description(Settings) const
get description of spectrum generator setting
@ pole_mass_loop_order
[4] loop-order for calculation of pole masses
@ eft_matching_loop_order_down
[21] loop order at which lambda of the SM is calculated from the full model parameters at the matchin...
@ eft_matching_scale
[19] renormalization scale at which the EFT is matched to the full model
@ top_pole_qcd_corrections
[13] Top-quark pole mass QCD corrections
@ eft_pole_mass_scale
[18] renormalization scale at which the pole masses are calculated in the EFT
@ pole_mass_scale
[17] renormalization scale at which the pole masses are calculated
@ higgs_2loop_correction_at_as
[8] Higgs 2-loop correction O(alpha_t alpha_s)
@ higgs_3loop_ren_scheme_atb_as2
[25] Renormalization scheme for Higgs 3-loop corrections O(alpha_t alpha_s^2 + alpha_b alpha_s^2)
@ threshold_corrections_loop_order
[7] threshold corrections loop order
@ ewsb_loop_order
[5] loop-order for solving the EWSB eqs.
@ force_positive_masses
[16] force positive masses of majoran fermions
@ calculate_sm_masses
[3] calculate Standard Model pole masses
@ higgs_2loop_correction_ab_as
[9] Higgs 2-loop correction O(alpha_b alpha_s)
@ max_iterations
[1] maximum number of iterations (0 = automatic)
@ higgs_2loop_correction_at_at
[10] Higgs 2-loop correction O(alpha_t alpha_t + alpha_t alpha_b + alpha_b alpha_b)
@ solver
[2] RG solver algorithm (0 = two-scale)
@ higgs_4loop_correction_at_as3
[30] Higgs 4-loop correction O(alpha_t alpha_s^3)
@ higgs_3loop_correction_ab_as2
[27] Higgs 3-loop correction O(alpha_b alpha_s^2)
@ eft_matching_loop_order_up
[20] loop order at which the gauge and Yukawa couplings of the full model are calculated from the EFT...
@ higgs_3loop_correction_at3
[29] Higgs 3-loop correction O(alpha_t^3)
@ higgs_2loop_correction_atau_atau
[11] Higgs 2-loop correction O(alpha_tau alpha_tau)
@ higgs_3loop_correction_at_as2
[26] Higgs 3-loop correction O(alpha_t alpha_s^2)
@ threshold_corrections
[24] individual threshold correction loop orders
@ eft_higgs_index
[22] index of SM-Higgs in Higgs multiplet
@ beta_zero_threshold
[14] beta function zero threshold
@ higgs_3loop_correction_at2_as
[28] Higgs 3-loop correction O(alpha_t^2 alpha_s)
double get(Settings) const
get value of spectrum generator setting
void set(Settings, double)
set value of spectrum generator setting
std::array< double, NUMBER_OF_OPTIONS > values
spectrum generator settings
Settings_t get() const
get all spectrum generator settings
void assert_ge(double value, double lower_bound, const char *quantity)
void assert_lt(double value, double upper_bound, const char *quantity)
void assert_le(double value, double upper_bound, const char *quantity)
void assert_gt(double value, double lower_bound, const char *quantity)
const std::array< std::string, Spectrum_generator_settings::NUMBER_OF_OPTIONS > descriptions
bool is_integer(double value)
std::string to_string(char a)
std::ostream & operator<<(std::ostream &ostr, const Dynamic_array_view< ElementType > &av)
Definition: array_view.hpp:143
int top_qcd
top pole mass QCD corrections
Flags_t get() const
returns all value in a Flags_t