20 #include <WolframLibrary.h> 27 inline void MLPut(MLINK
link,
const std::string&
s)
29 MLPutSymbol(link, s.c_str());
32 inline void MLPut(MLINK link,
int c)
34 MLPutInteger(link, c);
58 void MLPut(MLINK link,
const Eigen::Array<double,M,1>&
a)
61 for (
int i = 0; i < M; i++)
63 MLPutRealList(link, static_cast<double*>(v), M);
67 void MLPut(MLINK link,
const Eigen::Matrix<double,M,1>& m)
69 const Eigen::Array<double,M,1>
a(m.array());
73 template <
int M,
int N>
74 void MLPut(MLINK link,
const Eigen::Matrix<double,M,N>& m)
77 for (
int i = 0; i < M; i++)
78 for (
int k = 0; k < N; k++)
81 long dims[] = { M, N };
82 MLPutDoubleArray(link, reinterpret_cast<double*>(mat), dims,
nullptr, 2);
86 void MLPut(MLINK link,
const Eigen::Array<std::complex<double>,M,1>& a)
88 MLPutFunction(link,
"List", M);
89 for (
int i = 0; i < M; i++)
94 void MLPut(MLINK link,
const Eigen::Matrix<std::complex<double>,M,1>& m)
96 const Eigen::Array<std::complex<double>,M,1>
a(m.array());
100 template <
int M,
int N>
101 void MLPut(MLINK link,
const Eigen::Matrix<std::complex<double>,M,N>& m)
103 MLPutFunction(link,
"List", M);
104 for (
int i = 0; i < M; i++) {
105 MLPutFunction(link,
"List", N);
106 for (
int k = 0; k < N; k++)
112 void MLPut(MLINK link,
const std::vector<T>& v)
114 MLPutFunction(link,
"List", v.size());
115 for (std::size_t i = 0; i < v.size(); i++)
121 void MLPutRule(MLINK link,
const std::string& name)
123 MLPutFunction(link,
"Rule", 2);
124 MLPutUTF8Symbol(link, reinterpret_cast<const unsigned char*>(name.c_str()), name.size());
128 void MLPutRuleTo(MLINK link, T1 t,
const std::string& name)
130 MLPutRule(link, name);
136 void put_message(MLINK link,
137 const std::string& message_function,
138 const std::string& message_str)
140 MLPutFunction(link,
"CompoundExpression", 2);
141 MLPutFunction(link, message_function.c_str(), 1);
142 MLPutUTF8String(link, reinterpret_cast<const unsigned char*>(message_str.c_str()), message_str.size());
147 class Redirect_output {
149 explicit Redirect_output(MLINK link_) noexcept
154 Redirect_output(
const Redirect_output&) =
delete;
155 Redirect_output(Redirect_output&&) noexcept = delete;
161 Redirect_output& operator=(
const Redirect_output&) =
delete;
162 Redirect_output& operator=(Redirect_output&& other) noexcept =
delete;
166 while (std::getline(
buffer, line)) {
167 put_message(link,
"HimalayaInfoMessage", line);
180 long number_of_args(MLINK link,
const std::string& head)
184 if (!MLCheckFunction(link, head.c_str(), &argc))
185 std::cerr <<
"Error: argument is not a " << head << std::endl;
192 bool check_number_of_args(MLINK link,
long number_of_arguments,
193 const std::string& function_name)
195 const auto n_given = number_of_args(link,
"List");
196 const bool ok = n_given == number_of_arguments;
199 std::cerr <<
"Error: " << function_name <<
" expects " 200 << number_of_arguments <<
" argument (" 201 << n_given <<
" given)." << std::endl;
209 std::vector<double> read_list(MLINK link)
213 if (!MLTestHead(link,
"List", &N)) {
214 throw std::runtime_error(
"HimalayaCalculateDMh3L expects a list" 215 " as the only argument!");
218 std::vector<double> vec(N, 0.);
220 for (
int i = 0; i < N; i++) {
222 if (!MLGetReal64(link, &val)) {
223 throw std::runtime_error(
"Cannot read " + std::to_string(i)
224 +
"'th value of parameter list!");
229 if (!MLNewPacket(link))
230 throw std::runtime_error(
"Cannot create new packet!");
246 Data make_data(
const std::vector<double>& parsvec)
248 const int N_input_parameters = 127;
250 if (parsvec.size() != N_input_parameters) {
251 throw std::runtime_error(
"HimalayaCalculateDMh3L expects " 252 + std::to_string(N_input_parameters) +
", but " 253 + std::to_string(parsvec.size()) +
" given!");
258 const bool bottom = parsvec.at(c++);
260 const bool verbose = parsvec.at(c++);
263 pars.
scale = parsvec.at(c++);
264 pars.
mu = parsvec.at(c++);
265 pars.
g1 = parsvec.at(c++);
266 pars.
g2 = parsvec.at(c++);
267 pars.
g3 = parsvec.at(c++);
268 pars.
vd = parsvec.at(c++);
269 pars.
vu = parsvec.at(c++);
270 for (
int i = 0; i < 3; i++)
271 for (
int k = 0; k < 3; k++)
272 pars.
mq2(i,k) = parsvec.at(c++);
273 for (
int i = 0; i < 3; i++)
274 for (
int k = 0; k < 3; k++)
275 pars.
md2(i,k) = parsvec.at(c++);
276 for (
int i = 0; i < 3; i++)
277 for (
int k = 0; k < 3; k++)
278 pars.
mu2(i,k) = parsvec.at(c++);
279 for (
int i = 0; i < 3; i++)
280 for (
int k = 0; k < 3; k++)
281 pars.
ml2(i,k) = parsvec.at(c++);
282 for (
int i = 0; i < 3; i++)
283 for (
int k = 0; k < 3; k++)
284 pars.
me2(i,k) = parsvec.at(c++);
285 for (
int i = 0; i < 3; i++)
286 for (
int k = 0; k < 3; k++)
287 pars.
Au(i,k) = parsvec.at(c++);
288 for (
int i = 0; i < 3; i++)
289 for (
int k = 0; k < 3; k++)
290 pars.
Ad(i,k) = parsvec.at(c++);
291 for (
int i = 0; i < 3; i++)
292 for (
int k = 0; k < 3; k++)
293 pars.
Ae(i,k) = parsvec.at(c++);
294 for (
int i = 0; i < 3; i++)
295 for (
int k = 0; k < 3; k++)
296 pars.
Yu(i,k) = parsvec.at(c++);
297 for (
int i = 0; i < 3; i++)
298 for (
int k = 0; k < 3; k++)
299 pars.
Yd(i,k) = parsvec.at(c++);
300 for (
int i = 0; i < 3; i++)
301 for (
int k = 0; k < 3; k++)
302 pars.
Ye(i,k) = parsvec.at(c++);
303 pars.
MA = parsvec.at(c++);
304 pars.
M1 = parsvec.at(c++);
305 pars.
M2 = parsvec.at(c++);
306 pars.
MG = parsvec.at(c++);
308 const double MW = parsvec.at(c++);
309 const double MZ = parsvec.at(c++);
310 const double Mt = parsvec.at(c++);
311 const double Mb = parsvec.at(c++);
312 const double Mtau = parsvec.at(c++);
314 if (MW > 0) pars.
MW = MW;
315 if (MZ > 0) pars.
MZ = MZ;
316 if (Mt > 0) pars.
Mt = Mt;
317 if (Mb > 0) pars.
Mb = Mb;
318 if (Mtau > 0) pars.
Mtau = Mtau;
320 Eigen::Vector2d MSt, MSb, MStau;
321 MSt(0) = parsvec.at(c++);
322 MSt(1) = parsvec.at(c++);
323 MSb(0) = parsvec.at(c++);
324 MSb(1) = parsvec.at(c++);
325 MStau(0) = parsvec.at(c++);
326 MStau(1) = parsvec.at(c++);
327 const double s2t = parsvec.at(c++);
328 const double s2b = parsvec.at(c++);
329 const double s2tau = parsvec.at(c++);
331 if (MSt.minCoeff() > 0. && std::abs(s2t) <= 1.) {
336 if (MSb.minCoeff() > 0. && std::abs(s2b) <= 1.) {
341 if (MStau.minCoeff() > 0. && std::abs(s2tau) <= 1.) {
348 if (c != N_input_parameters) {
349 throw std::runtime_error(
350 "Bug: Expecting to read " + std::to_string(N_input_parameters) +
351 " input parameters from input vector of size " +
352 std::to_string(parsvec.size()) +
", but only " + std::to_string(c) +
353 " parameters have been read.");
362 using Loop_corrections = std::tuple<double,double,double,double>;
366 Loop_corrections
fo{};
372 Results calculate_results(
const Data& data)
376 if (data.loopOrder > 2) {
380 const auto dmh2_eft_0l = res.ho.getDMh2EFTAt(0);
381 const auto dmh2_eft_1l = res.ho.getDMh2EFTAt(1);
382 const auto dmh2_eft_2l = res.ho.getDMh2EFTAt(2);
383 const auto dmh2_eft_3l = res.ho.getDMh2EFTAt(3);
386 std::make_tuple(dmh2_eft_0l, dmh2_eft_1l, dmh2_eft_2l, dmh2_eft_3l);
388 const auto dmh2_fo_0l = res.ho.getDMh2FO(0);
389 const auto dmh2_fo_1l = res.ho.getDMh2FO(1);
390 const auto dmh2_fo_2l = res.ho.getDMh2FO(2);
391 const auto dmh2_fo_3l = res.ho.getDMh2FO(3);
393 const auto dmh2_fo_0l_at = res.ho.getDMh2FOAt(0);
394 const auto dmh2_fo_1l_at = res.ho.getDMh2FOAt(1);
395 const auto dmh2_fo_2l_at = res.ho.getDMh2FOAt(2);
396 const auto dmh2_fo_3l_at = res.ho.getDMh2FOAt(3);
398 res.fo = std::make_tuple(dmh2_fo_0l, dmh2_fo_1l, dmh2_fo_2l, dmh2_fo_3l);
400 std::make_tuple(dmh2_fo_0l_at, dmh2_fo_1l_at, dmh2_fo_2l_at, dmh2_fo_3l_at);
407 const auto zero = 0.;
409 res.eft = std::make_tuple(dmh2_eft_0l, dmh2_eft_1l, dmh2_eft_2l, 0.);
419 res.fo = std::tuple_cat(dmh2_fo, std::tie(zero));
420 res.fo_dom = std::tuple_cat(dmh2_fo_dom, std::tie(zero));
428 void put_result(
const Results& res, MLINK link)
430 MLPutFunction(link,
"List", 13);
432 const auto&
ho = res.ho;
433 const auto&
eft = res.eft;
434 const auto&
fo = res.fo;
435 const auto&
fo_dom = res.fo_dom;
438 const std::string msf =
ho.
getIsAlphab() ?
"MsbottomMDRPrime" :
"MstopMDRPrime";
440 Eigen::Vector4d expansion_uncertainty;
444 Eigen::Vector4d lambda;
448 Eigen::Vector4d lambda_uncertainty;
451 Eigen::Vector4d lambda_shift_DRp_to_MS;
452 lambda_shift_DRp_to_MS <<
458 std::vector<Eigen::Matrix2d> Mh2;
460 for (
int i = 0; i < 4; i++)
463 std::vector<Eigen::Matrix2d> Mh2_shift_DRp_to_MDRp;
464 Mh2_shift_DRp_to_MDRp.reserve(4);
465 Mh2_shift_DRp_to_MDRp.emplace_back(Eigen::Matrix2d::Zero());
466 Mh2_shift_DRp_to_MDRp.emplace_back(Eigen::Matrix2d::Zero());
467 Mh2_shift_DRp_to_MDRp.emplace_back(Eigen::Matrix2d::Zero());
470 std::vector<Eigen::Matrix2d> Mh2_shift_DRp_to_H3m;
471 Mh2_shift_DRp_to_H3m.reserve(4);
472 Mh2_shift_DRp_to_H3m.emplace_back(Eigen::Matrix2d::Zero());
473 Mh2_shift_DRp_to_H3m.emplace_back(Eigen::Matrix2d::Zero());
474 Mh2_shift_DRp_to_H3m.emplace_back(Eigen::Matrix2d::Zero());
477 Eigen::Vector4d Mh2_eft;
478 Mh2_eft << std::get<0>(
eft), std::get<1>(
eft),
479 std::get<2>(
eft), std::get<3>(
eft);
481 Eigen::Vector4d Mh2_fo;
482 Mh2_fo << std::get<0>(
fo), std::get<1>(
fo),
483 std::get<2>(
fo), std::get<3>(
fo);
485 Eigen::Vector4d Mh2_fo_dominant;
486 Mh2_fo_dominant << std::get<0>(
fo_dom), std::get<1>(
fo_dom),
489 MLPutRuleTo(link, hierarchy,
"hierarchyID");
492 MLPutRuleTo(link, Mh2,
"Mh2");
493 MLPutRuleTo(link, Mh2_shift_DRp_to_MDRp,
"Mh2ShiftDRbarPrimeToMDRPrime");
494 MLPutRuleTo(link, Mh2_shift_DRp_to_H3m,
"Mh2ShiftDRbarPrimeToH3m");
495 MLPutRuleTo(link, expansion_uncertainty,
"expansionUncertainty");
496 MLPutRuleTo(link, Mh2_eft,
"Mh2EFTAt");
497 MLPutRuleTo(link, Mh2_fo,
"Mh2FO");
498 MLPutRuleTo(link, Mh2_fo_dominant,
"Mh2FOAt");
499 MLPutRuleTo(link, lambda,
"lambda");
500 MLPutRuleTo(link, lambda_uncertainty,
"lambdaUncertainty");
501 MLPutRuleTo(link, lambda_shift_DRp_to_MS,
"lambdaShiftDRbarPrimeToMSbar");
514 WolframLibraryData , MLINK link)
518 if (!check_number_of_args(link, 1,
"HimalayaCalculateDMh3L"))
519 return LIBRARY_TYPE_ERROR;
522 Redirect_output rd(link);
524 const auto res = calculate_results(make_data(read_list(link)));
528 put_result(res, link);
529 }
catch (
const std::exception& e) {
530 put_message(link,
"HimalayaErrorMessage", e.what());
531 MLPutSymbol(link,
"$Failed");
533 put_message(link,
"HimalayaErrorMessage",
"An unknown exception has been thrown.");
534 MLPutSymbol(link,
"$Failed");
537 return LIBRARY_NO_ERROR;
544 return WolframLibraryVersion;
551 return LIBRARY_NO_ERROR;
Contains the definition of the MSSM_mass_eigenstates class.
Loop_corrections eft
fixed-order corrections for v^2 << MS^2
Eigen::Matrix2d getDMhDRbarPrimeToMDRbarPrimeShift() const
double vu
VEV of up Higgs, with v = Sqrt[vu^2 + vd^2] ~ 246 GeV.
RM33 Yu
up-type yukawa coupling matrix
RM33 Ad
trilinear down type squark-Higgs coupling matrix
Eigen::Vector2d getMDRMasses() const
double getDMhExpUncertainty(int loops) const
void validate(bool verbose)
validates the parameter set
Loop_corrections fo
fixed-order corrections
double vd
VEV of down Higgs, with v = Sqrt[vu^2 + vd^2] ~ 246 GeV.
himalaya::HierarchyObject ho
double g2
gauge coupling g2
DLLEXPORT int WolframLibrary_initialize(WolframLibraryData)
himalaya::Parameters pars
DLLEXPORT int HimalayaCalculateDMh3L(WolframLibraryData, MLINK link)
RM33 Ae
trilinear electron type squark-Higgs coupling matrix
double s2b
sine of 2 times the sbottom mixing angle
Eigen::Matrix2d getDMhDRbarPrimeToH3mShift() const
std::string getH3mHierarchyNotation(int hierarchy) const
std::streambuf * old_cout
original stdout buffer
RM33 ml2
soft-breaking squared left-handed slepton mass parameters
double s2t
sine of 2 times the stop mixing angle
HierarchyObject calculateDMh3L(bool isAlphab)
double getDLambdaDRbarPrimeToMSbarShift(int loops) const
double mu
mu parameter, convention of [Phys.Rept. 117 (1985) 75-263]
RM33 mq2
soft-breaking squared left-handed squark mass parameters
RM33 Yd
down-type yukawa coupling matrix
RM33 mu2
soft-breaking squared right-handed up-squark mass parameters
HimalayaErrorMessage [s_] s
double getDLambdaUncertainty(int loops) const
double getDeltaMh2EFT0Loop() const
double scale
renormalization scale
std::streambuf * old_cerr
original stderr buffer
This class performs a fixed-order calculation of the light CP-even Higgs mass up to 2-loop order...
RM33 md2
soft-breaking squared right-handed down-squark mass parameters
double getDeltaMh2EFT2Loop(int omitSMLogs, int omitMSSMLogs) const
Loop_corrections fo_dom
fixed-order corrections O(at*(at + as))
DLLEXPORT mint WolframLibrary_getVersion()
double g3
gauge coupling g3 SU(3)
double g1
GUT-normalized gauge coupling g1, with gY = g1*Sqrt[3/5].
Definition of EFT Higgs mass calculation class.
std::stringstream buffer
buffer caching stdout
Eigen::Matrix2d getDMh(int loops) const
int getSuitableHierarchy() const
double s2tau
sine of 2 times the stau mixing angle
RM33 Ye
electron-type yukawa coupling matrix
double getDLambda(int loops) const
Definition of the HierarchyCalculator.
MLINK link
redirect to this link
double getDeltaMh2EFT1Loop(int omitSMLogs, int omitMSSMLogs) const
RM33 me2
soft-breaking squared right-handed slepton mass parameters
std::tuple< double, double, double > calculate_Mh2() const
calculates squared Higgs masses
RM33 Au
trilinear up type squark-Higgs coupling matrix