flexiblesusy is hosted by Hepforge, IPPP Durham
FlexibleSUSY
flexibledecay_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, FlexibleDecay_settings::NUMBER_OF_OPTIONS> descriptions = {
31 "calculate particle decays",
32 "minimum BR to print",
33 "include higher order corrections in decays",
34 "use Thomson alpha(0) instead of alpha(m) in decays to γγ and γZ",
35 "off-shell decays into VV pair",
36 "print loop-induced Higgs couplings",
37 "calculate effective couplings normalized to SM",
38 "call HiggsTools",
39 "call Lilith",
40 "use pole Higgs mixings in decays"
41};
42
43bool is_integer(double value)
44{
45 double intpart;
46 return std::modf(value, &intpart) == 0.0;
47}
48
49void assert_bool(double value, const char* quantity)
50{
51 if (value != 0.0 && value != 1.0) {
52 throw SetupError(std::string(quantity) + " must either 0 or 1");
53 }
54}
55
56void assert_integer(double value, const char* quantity)
57{
58 if (!is_integer(value)) {
59 throw SetupError(std::string(quantity) + " must be an integer");
60 }
61}
62
63void assert_ge(double value, double lower_bound, const char* quantity)
64{
65 if (value < lower_bound) {
66 throw SetupError(std::string(quantity) +
67 " must be greater than or equal to " +
68 flexiblesusy::to_string(lower_bound));
69 }
70}
71
72void assert_le(double value, double upper_bound, const char* quantity)
73{
74 if (value > upper_bound) {
75 throw SetupError(std::string(quantity) +
76 " must be lower than or equal to " +
77 flexiblesusy::to_string(upper_bound));
78 }
79}
80
81} // anonymous namespace
82
93
95{
96 return values.at(o);
97}
98
104
106{
107 return descriptions.at(o);
108}
109
111{
112 switch (o) {
113 case calculate_decays: // 0 [bool]
114 assert_bool(value, descriptions.at(o).c_str());
115 break;
116 case min_br_to_print: // 1 [double >= 0 and <= 1]
117 assert_ge(value, 0, descriptions.at(o).c_str());
118 assert_le(value, 1, descriptions.at(o).c_str());
119 break;
120 case include_higher_order_corrections: // 2 [int >= 0 and <= 4]
121 assert_integer(value, descriptions.at(o).c_str());
122 assert_ge(value, 0, descriptions.at(o).c_str());
123 assert_le(value, 4, descriptions.at(o).c_str());
124 break;
126 assert_bool(value, descriptions.at(o).c_str());
127 break;
128 case offshell_VV_decays: // 4 [int >= 0 and <= 2]
129 assert_integer(value, descriptions.at(o).c_str());
130 assert_ge(value, 0, descriptions.at(o).c_str());
131 assert_le(value, 2, descriptions.at(o).c_str());
132 break;
133 case print_effc_block: // 5 [bool]
134 assert_bool(value, descriptions.at(o).c_str());
135 break;
136 case calculate_normalized_effc: // 6 [bool]
137 assert_bool(value, descriptions.at(o).c_str());
138 break;
139 case call_higgstools: // 7 [bool]
140 assert_bool(value, descriptions.at(o).c_str());
141 break;
142 case call_lilith: // 8 [bool]
143 assert_bool(value, descriptions.at(o).c_str());
144 break;
145 case use_pole_higgs_mixings: // 9 [bool]
146 assert_bool(value, descriptions.at(o).c_str());
147 break;
148 default:
149 break;
150 }
151
152 values.at(o) = value;
153}
154
156{
157 std::copy(s.data(), s.data() + s.size(), values.begin());
158}
159
189
190bool is_integer(double value)
191{
192 double intpart;
193 return std::modf(value, &intpart) == 0.0;
194}
195
196}
@ include_higher_order_corrections
[2] include higher order corrections in decays
@ calculate_decays
[0] calculate particle decays
std::string get_description(Settings) const
get description of spectrum generator setting
Eigen::Array< double, NUMBER_OF_OPTIONS, 1 > Settings_t
void reset()
resets all settings to their defaults
std::array< double, NUMBER_OF_OPTIONS > values
spectrum generator settings
Settings_t get() const
get all spectrum generator settings
void set(Settings, double)
set value of spectrum generator setting
Spectrum generator was not setup correctly.
Definition error.hpp:46
const std::array< std::string, FlexibleDecay_settings::NUMBER_OF_OPTIONS > descriptions
void assert_le(double value, double upper_bound, const char *quantity)
void assert_ge(double value, double lower_bound, const char *quantity)
bool is_integer(double value)
std::string to_string(char a)