Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
BPFFCalculator.cpp
Go to the documentation of this file.
1#include "BPFFCalculator.h"
2
5 BP_FF_Src src) : iobspp_sm(p){
6 if (!this->allowed_decays.contains({B_id, P_id})) {
7 LOG_ERROR("ValueError", "Wrong meson PDG code in BPFFCalculator constructor:", B_id, ",", P_id);
8 }
9
10 this->m_B = (*p)({ParameterType::FLAVOR, "FMASS", B_id}, DataType::VALUE);
11 this->m_P = (*p)({ParameterType::FLAVOR, "FMASS", P_id}, DataType::VALUE);
12 this->t_p = std::pow(this->m_B + this->m_P, 2);
13 this->t_m = std::pow(this->m_B - this->m_P, 2);
14 this->t_0 = src == BP_FF_Src::HPQCD22 ? 0. : this->t_p * (1. - std::sqrt(1 - this->t_m / this->t_p));
15
16 if (src == BP_FF_Src::AS || src == BP_FF_Src::FLAG24 || src == BP_FF_Src::HPQCD22)
17 this->z_0 = 0.0;
18 else
19 this->z_0 = std::real(z(0.0, this->t_p, this->t_0));
20
21 this->src_block = allowed_decays.at({B_id, P_id});
22 this->load_FF_params(src);
23}
24
25complex_t BPFFCalculator::z(double t, double t_p, double t_0) {
26 double a = std::sqrt(t_p - t);
27 double b = std::sqrt(t_p - t_0);
28 return (a - b) / (a + b);
29}
30
31double BPFFCalculator::get(BP_FF a, double q2) {
32 switch (a) {
33 case BP_FF::XI_P:
34 return this->F_a(BP_FF::F_PLUS, q2);
35 default:
36 return this->F_a(a, q2);
37 }
38}
39
40void BPFFCalculator::load_FF_params(BP_FF_Src src) {
41 int ff_id = (int)(src) + 1;
42 int order = this->sse_order.at(src);
43 std::string src_block = this->src_block;
44
45 auto get_m = [this, ff_id, src_block] (int i) { return (*iobspp_sm)(ParamId{ParameterType::DECAY, src_block, {ff_id, 0, i}}, DataType::VALUE); };
46 this->m_R[BP_FF::F_PLUS] = get_m(1);
47 this->m_R[BP_FF::F_0] = get_m(2);
48 this->m_R[BP_FF::F_T] = get_m(3);
49
50 for (int i = 1; i <= 3; i++) {
51 for (int j = 0; j <= order; j++) {
52 ParamId PId {ParameterType::DECAY, src_block, {ff_id, i, j}};
53 this->alpha_ai[(BP_FF)(i - 1)][j] = (*iobspp_sm)(PId, DataType::VALUE);
54 }
55 }
56
57 this->L_chi = 1.0;
58
59 if (src == BP_FF_Src::AS) {
60 this->alpha_ai[BP_FF::F_PLUS][3] = (2 * this->alpha_ai[BP_FF::F_PLUS][2] - this->alpha_ai[BP_FF::F_PLUS][1]) / 3;
61 this->alpha_ai[BP_FF::F_T][3] = (2 * this->alpha_ai[BP_FF::F_T][2] - this->alpha_ai[BP_FF::F_T][1]) / 3;
62 this->m_R[BP_FF::F_PLUS] += m_B;
63 this->m_R[BP_FF::F_T] += m_B;
64 }
65
66 if (src == BP_FF_Src::FLAG24) {
67 this->alpha_ai[BP_FF::F_PLUS][3] = (2 * this->alpha_ai[BP_FF::F_PLUS][2] - this->alpha_ai[BP_FF::F_PLUS][1]) / 3;
68 double z0 = std::real(this->z(0, this->t_p, this->t_0));
69 this->alpha_ai[BP_FF::F_0][2] = this->alpha_ai[BP_FF::F_PLUS][2] + (this->alpha_ai[BP_FF::F_PLUS][0] - this->alpha_ai[BP_FF::F_0][0]) / pow(z0, 2.) + (this->alpha_ai[BP_FF::F_PLUS][1] - this->alpha_ai[BP_FF::F_0][1]) / z0 + this->alpha_ai[BP_FF::F_PLUS][3] * z0;
70 }
71
72 if (src == BP_FF_Src::HPQCD22) {
73 this->alpha_ai[BP_FF::F_PLUS][3] = (2 * this->alpha_ai[BP_FF::F_PLUS][2] - this->alpha_ai[BP_FF::F_PLUS][1]) / 3;
74 this->alpha_ai[BP_FF::F_T][3] = (2 * this->alpha_ai[BP_FF::F_T][2] + this->alpha_ai[BP_FF::F_T][1]) / 3;
75 this->L_chi = (*iobspp_sm)({ParameterType::DECAY, this->src_block, 16}, DataType::VALUE);
76 }
77
78 if (src == BP_FF_Src::GKvD_SR_LAT || src == BP_FF_Src::GKvD_SR) {
79 this->alpha_ai[BP_FF::F_0][0] = this->alpha_ai[BP_FF::F_PLUS][0];
80 }
81}
82
83double BPFFCalculator::pole(double q2, double m_R) {
84 if (fpeq(m_R, 0.0)) return 1.0;
85
86 return 1. / (1 - q2 / std::pow(m_R, 2));
87}
88
89double BPFFCalculator::E(double q2) {
90 return (this->m_B * this->m_B + this->m_P * this->m_P - q2) / (2 * this->m_B);
91}
92
93double BPFFCalculator::F_a(BP_FF a, double q2) {
94 auto ai = this->alpha_ai.at(a);
95 double P = pole(q2, this->m_R.at(a));
96 double Z = std::real(z(q2, this->t_p, this->t_0)) - this->z_0;
97
98 // printf("P = %.4e\n", P);
99 // printf("Z = %.4e\n", Z);
100
101 double res {0.0};
102 for (int k = 0; k < 4; k++) {
103 // printf("alpha_%i = %.4e\n", k, ai[k]);
104 res += ai[k] * std::pow(Z, k);
105 }
106
107 return this->L_chi * P * res;
108}
BP_FF_Src
BP_FF
#define LOG_ERROR(type,...)
Macro for logging error messages and terminating the application.
Definition Logger.h:41
std::complex< double > complex_t
Convenience alias for std::complex<double>.
Definition Utils.h:35
complex_t z(double t, double t_p, double t_0)
double get(BP_FF a, double q2) override
BPFFCalculator()=default
double E(double q2)
scalar_t pow(const scalar_t &base, const scalar_t &exp)
Definition scalar.cpp:75
std::enable_if_t< not std::numeric_limits< T >::is_integer, bool > fpeq(T, T, std::size_t n=10)
Compares two floating point numbers with a given precision.
Composite identifier for a single parameter.
Definition ParamID.h:57