Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
BKsllDecay.cpp
Go to the documentation of this file.
1
2#include "BKsllDecay.h"
3#include "wcoef_ids.hpp"
4
5#include <algorithm>
6#include <exception>
7#include <mutex>
8#include <thread>
9#include <vector>
10
12
13static double finite_or_nan(double x) {
14 return std::isfinite(x) ? x : std::numeric_limits<double>::quiet_NaN();
15}
16
17static double safe_div(double num, double den, const char* name) {
18 if (!std::isfinite(num) || !std::isfinite(den) || std::abs(den) < 1e-30) {
19 LOG_WARN(name, "non-finite/singular ratio: num =", num, "den =", den);
20 return std::numeric_limits<double>::quiet_NaN();
21 }
22
23 return num / den;
24}
25
28
29 cache.alpha_em = (*p)(ParamId{ParameterType::SM, "EW", {1, 2}}, DataType::VALUE);
30 cache.G_F = (*p)(ParamId{ParameterType::SM, "SMINPUTS", 2}, DataType::VALUE);
31 cache.m_b_mb = (*p)(ParamId{ParameterType::SM, "SMINPUTS", 5}, DataType::VALUE);
32 cache.m_s = (*p)(ParamId{ParameterType::SM, "MASS", 3}, DataType::VALUE);
33 cache.mu_b = (*p)(ParamId{ParameterType::WILSON, "B_SCALE", 1}, DataType::VALUE);
34 cache.alpha_s_mu_b = (*iobs_qcdp)(AlphasConfig(cache.mu_b, MassType::POLE, MassType::POLE));
35 cache.m_c_mu_b = (*p)(ParamId{ParameterType::SM, "MASS", 4}, DataType::VALUE); // ASK : To match SI, should probably be m_c(mu_b) instead
36 cache.m_b_mu_b = (*iobs_qcdp)(MassConfig(5, cache.mu_b, MassType::MSBAR, MassType::POLE));
37 double mu_f = sqrt(cache.mu_b * (*p)(ParamId{ParameterType::DECAY, "B_Ks", 14}, DataType::VALUE));
38 cache.m_b_PS = (*p)(ParamId{ParameterType::SM, "QCD", {5, 2}}, DataType::VALUE) - 4 * (*iobs_qcdp)(AlphasConfig((*p)(ParamId{ParameterType::SM, "QCD", {5, 2}}, DataType::VALUE), MassType::POLE, MassType::POLE)) * mu_f / (3 * PI);
39 cache.L_b = std::log(cache.mu_b / cache.m_b_PS);
40 cache.Delta_M = -6. * cache.L_b - 4. * (1 - mu_f / cache.m_b_PS);
41 cache.lambda_hat_u = std::conj((*p)(ParamId{ParameterType::SM, "VCKM", {0, 1}}, DataType::VALUE)) * (*p)(ParamId{ParameterType::SM, "VCKM", {0, 2}}, DataType::VALUE)
42 / (std::conj((*p)(ParamId{ParameterType::SM, "VCKM", {2, 1}}, DataType::VALUE)) * (*p)(ParamId{ParameterType::SM, "VCKM", {2, 2}}, DataType::VALUE));
43 cache.kappa = 1. - 2. * cache.alpha_s_mu_b / (3. * PI) * std::log(cache.mu_b / cache.m_b_mb);
44 cache.q2_low = (*p)(ParamId{ParameterType::DECAY, "B_Ks", {15, 1}}, DataType::VALUE);
45 cache.q2_high = (*p)(ParamId{ParameterType::DECAY, "B_Ks", {15, 2}}, DataType::VALUE);
46
47 for (size_t i = 0; i < 6; i++) {
48 cache.a_k_low[i] = (*p)(ParamId{ParameterType::DECAY, "B_Ks", {18, 1, i + 1}}, DataType::VALUE);
49 cache.b_k_low[i] = (*p)(ParamId{ParameterType::DECAY, "B_Ks", {18, 2, i + 1}}, DataType::VALUE);
50 cache.phi_k_low[i] = (*p)(ParamId{ParameterType::DECAY, "B_Ks", {18, 4, i + 1}}, DataType::VALUE);
51 cache.theta_k_low[i] = (*p)(ParamId{ParameterType::DECAY, "B_Ks", {18, 5, i + 1}}, DataType::VALUE);
52 }
53
54 for (size_t i = 0; i < 8; i++) {
55 cache.a_k_high[i] = (*p)(ParamId{ParameterType::DECAY, "B_Ks", {18, 3, i + 1}}, DataType::VALUE);
56 cache.phi_k_high[i] = (*p)(ParamId{ParameterType::DECAY, "B_Ks", {18, 6, i + 1}}, DataType::VALUE);
57 }
58
60}
61
63 auto b_wilsons = w_proxy->getAFR(WGroup::B, this->w_config.order);
64 auto bp_wilsons = w_proxy->getAFR(WGroup::BPrime, this->w_config.order);
65 auto bq_wilsons = w_proxy->getAFR(WGroup::BScalar, this->w_config.order);
66
67 cache.C.clear();
68
69 for (const auto& [coef, val] : b_wilsons) {
70 cache.C[coef] = val;
71 }
72 for (const auto& [coef, val] : bq_wilsons) {
73 cache.C[coef] = val;
74 }
75
76 for (const auto& [coef, val] : bp_wilsons) {
77 cache.C[coef] = val;
78 }
79}
80
82 const int B_id = cfg.charge == Charge::B_0 ? 511 : 521;
83 const int V_id = cfg.charge == Charge::B_0 ? 313 : 323;
84
86 B_id,
87 V_id,
88 p,
89 cfg.ff_src
90 );
91
93 B_id,
94 V_id,
95 cache.mu_b,
96 cache.C,
97 std::make_shared<BVFFCalculator>(cache.ff_calculator),
98 cfg.ff_type,
99 p,
101 );
102
103 cache.m_l = (*p)(ParamId{ParameterType::SM, "MASS", 11 + 2 * (int)cfg.gen}, DataType::VALUE);
104 cache.m_B = (*p)(ParamId{ParameterType::FLAVOR, "FMASS", cfg.charge == Charge::B_0 ? 511 : 521}, DataType::VALUE);
105 cache.life_B = (*p)(ParamId{ParameterType::FLAVOR, "FLIFE", cfg.charge == Charge::B_0 ? 511 : 521}, DataType::VALUE) / HBAR;
106 cache.m_Ks = (*p)(ParamId{ParameterType::FLAVOR, "FMASS", cfg.charge == Charge::B_0 ? 313 : 323}, DataType::VALUE);
107 cache.N_0 = std::conj((*p)(ParamId{ParameterType::SM, "VCKM", {2, 1}}, DataType::VALUE)) * (*p)(ParamId{ParameterType::SM, "VCKM", {2, 2}}, DataType::VALUE) * cache.G_F * cache.alpha_em / (std::sqrt(3072. * std::pow(PI, 5) * std::pow(cache.m_B, 3)));
108 cache.q2_min = 4 * std::pow(cache.m_l, 2);
109 cache.q2_max = std::pow(cache.m_B - cache.m_Ks, 2);
110
111 cache.q2_lookup_min = std::max(cache.q2_min, 1e-4);
113 auto requested_threads = cfg.n_threads;
114 if (requested_threads == 0u) {
115 requested_threads = std::thread::hardware_concurrency();
116 }
117 if (requested_threads == 0u) {
118 requested_threads = 1u;
119 }
120
121 const size_t npts = BKstarllCache::LOOKUP_SIZE;
122 const size_t nworkers = std::min<size_t>(requested_threads, npts);
123
124 if (nworkers <= 1u) {
125 auto lam_T_perp_p = [this] (double q2, bool bar) {
126 return cache.qcdf_calculator.T_perp_p(q2, bar);
127 };
128
129 fill_cache(lam_T_perp_p, cache.q2_lookup_min, cache.q2_high, cache.T_perp_p_lookup, false);
130 fill_cache(lam_T_perp_p, cache.q2_lookup_min, cache.q2_high, cache.T_perp_p_bar_lookup, true);
131
132 auto lam_T_perp_m = [this] (double q2, bool bar) {
133 return cache.qcdf_calculator.T_perp_m(q2, bar);
134 };
135
136 fill_cache(lam_T_perp_m, cache.q2_lookup_min, cache.q2_high, cache.T_perp_m_lookup, false);
137 fill_cache(lam_T_perp_m, cache.q2_lookup_min, cache.q2_high, cache.T_perp_m_bar_lookup, true);
138
139 auto lam_T_par_m = [this] (double q2, bool bar) {
140 return cache.qcdf_calculator.T_par_m(q2, bar);
141 };
142
143 fill_cache(lam_T_par_m, cache.q2_lookup_min, cache.q2_high, cache.T_par_m_lookup, false);
144 fill_cache(lam_T_par_m, cache.q2_lookup_min, cache.q2_high, cache.T_par_m_bar_lookup, true);
145 } else {
146 const double x_min = cache.q2_lookup_min;
147 const double x_max = cache.q2_high;
148 const double step = (x_max - x_min) / static_cast<double>(npts - 1);
149
150 std::vector<std::shared_ptr<BVQCDfCalculator>> qcdf_locals;
151 qcdf_locals.reserve(nworkers);
152 for (size_t w = 0; w < nworkers; ++w) {
153 auto ff_local = std::make_shared<BVFFCalculator>(cache.ff_calculator);
154 qcdf_locals.emplace_back(std::make_shared<BVQCDfCalculator>(
155 B_id,
156 V_id,
157 cache.mu_b,
158 cache.C,
159 ff_local,
160 cfg.ff_type,
161 p,
163 ));
164 }
165
166 std::vector<std::thread> workers;
167 workers.reserve(nworkers);
168
169 std::exception_ptr first_exception = nullptr;
170 std::mutex exception_mutex;
171
172 auto worker = [&] (size_t worker_id, size_t begin, size_t end) {
173 try {
174 BVQCDfCalculator& qcdf = *qcdf_locals[worker_id];
175 for (size_t i = begin; i < end; ++i) {
176 const double q2 = x_min + step * static_cast<double>(i);
177
178 cache.T_perp_p_lookup[i] = qcdf.T_perp_p(q2, false);
179 cache.T_perp_p_bar_lookup[i] = qcdf.T_perp_p(q2, true);
180
181 cache.T_perp_m_lookup[i] = qcdf.T_perp_m(q2, false);
182 cache.T_perp_m_bar_lookup[i] = qcdf.T_perp_m(q2, true);
183
184 cache.T_par_m_lookup[i] = qcdf.T_par_m(q2, false);
185 cache.T_par_m_bar_lookup[i] = qcdf.T_par_m(q2, true);
186 }
187 } catch (...) {
188 std::lock_guard<std::mutex> lock(exception_mutex);
189 if (!first_exception) {
190 first_exception = std::current_exception();
191 }
192 }
193 };
194
195 const size_t chunk = (npts + nworkers - 1) / nworkers;
196 for (size_t w = 0; w < nworkers; ++w) {
197 const size_t begin = w * chunk;
198 const size_t end = std::min(npts, begin + chunk);
199 if (begin >= end) {
200 break;
201 }
202 workers.emplace_back(worker, w, begin, end);
203 }
204
205 for (auto& th : workers) {
206 th.join();
207 }
208
209 if (first_exception) {
210 std::rethrow_exception(first_exception);
211 }
212 }
213 }
214
216 double m_D0 = (*p)(ParamId{ParameterType::FLAVOR, "FMASS", 421}, DataType::VALUE);
217 double m_Jpsi = (*p)(ParamId{ParameterType::FLAVOR, "FMASS", 443}, DataType::VALUE);
218 double m_psi_2S = (*p)(ParamId{ParameterType::FLAVOR, "FMASS", 100443}, DataType::VALUE);
219 cache.tp_nf = 4. * std::pow(m_D0, 2);
220 cache.t0_nf = cache.tp_nf - std::sqrt(cache.tp_nf * (cache.tp_nf - std::pow(m_psi_2S, 2)));
221 cache.z0_nf = (sqrt(cache.tp_nf) - sqrt(cache.tp_nf - cache.t0_nf)) / (sqrt(cache.tp_nf) + sqrt(cache.tp_nf - cache.t0_nf));
222 cache.z_Jpsi_nf = (sqrt(cache.tp_nf - std::pow(m_Jpsi, 2)) - sqrt(cache.tp_nf - cache.t0_nf)) / (sqrt(cache.tp_nf - std::pow(m_Jpsi, 2)) + sqrt(cache.tp_nf - cache.t0_nf));
223 cache.z_psi2S_nf = (sqrt(cache.tp_nf - std::pow(m_psi_2S, 2)) - sqrt(cache.tp_nf - cache.t0_nf)) / (sqrt(cache.tp_nf - std::pow(m_psi_2S, 2)) + sqrt(cache.tp_nf - cache.t0_nf));
224
225 for (size_t i = 0; i < 3; i++) {
226 cache.alpha_perp[i] = complex_t {
227 (*p)(ParamId{ParameterType::DECAY, "B_Ks", {19, 1, 1, i}}, DataType::VALUE),
228 (*p)(ParamId{ParameterType::DECAY, "B_Ks", {19, 2, 1, i}}, DataType::VALUE)
229 };
230
231 cache.alpha_par[i] = complex_t {
232 (*p)(ParamId{ParameterType::DECAY, "B_Ks", {19, 1, 2, i}}, DataType::VALUE),
233 (*p)(ParamId{ParameterType::DECAY, "B_Ks", {19, 2, 2, i}}, DataType::VALUE)
234 };
235 }
236
237 for (size_t i = 0; i < 2; i++) {
238 cache.alpha_0[i] = complex_t {
239 (*p)(ParamId{ParameterType::DECAY, "B_Ks", {19, 1, 3, i}}, DataType::VALUE),
240 (*p)(ParamId{ParameterType::DECAY, "B_Ks", {19, 2, 3, i}}, DataType::VALUE)
241 };
242 }
243 }
244
246 cache.q2_bar = 1.0;
247 cache.q2_Jpsi = std::pow(std::real((*p)(ParamId{ParameterType::FLAVOR, "FMASS", 443}, DataType::VALUE)), 2);
248
249 for (size_t i = 0; i < 3; i++) {
250 cache.DeltaC9_M_qbar[i] = (*p)(ParamId{ParameterType::DECAY, "B_Ks", {20, i}}, DataType::VALUE);
251 cache.r1_M[i] = (*p)(ParamId{ParameterType::DECAY, "B_Ks", {21, 1, i}}, DataType::VALUE);
252 cache.r2_M[i] = (*p)(ParamId{ParameterType::DECAY, "B_Ks", {21, 2, i}}, DataType::VALUE);
253 }
254 }
255
256 test_J();
257
259}
260
262 bool changed = cfg.gen != gen || cfg.charge != charge;
263 if (changed) {
264 cfg.gen = gen;
265 cfg.charge = charge;
267 }
268}
269
271 const double x = std::clamp(q2, cache.q2_lookup_min, cache.q2_high);
272 return lerp(
273 x,
274 bar ? cache.T_perp_p_bar_lookup : cache.T_perp_p_lookup,
275 cache.q2_lookup_min,
276 cache.q2_high
277 );
278}
279
281 const double x = std::clamp(q2, cache.q2_lookup_min, cache.q2_high);
282 return lerp(
283 x,
284 bar ? cache.T_perp_m_bar_lookup : cache.T_perp_m_lookup,
285 cache.q2_lookup_min,
286 cache.q2_high
287 );
288}
289
291 const double x = std::clamp(q2, cache.q2_lookup_min, cache.q2_high);
292 return lerp(
293 x,
294 bar ? cache.T_par_m_bar_lookup : cache.T_par_m_lookup,
295 cache.q2_lookup_min,
296 cache.q2_high
297 );
298}
299
300double BKstarllDecay::beta_l(double q2) {
301 const double x = 1.0 - 4.0 * cache.m_l * cache.m_l / q2;
302 return std::sqrt(std::max(0.0, x));
303}
304
305double BKstarllDecay::lambda(double q2) {
306 const double mB2 = cache.m_B * cache.m_B;
307 const double mK2 = cache.m_Ks * cache.m_Ks;
308
309 const double lam =
310 mB2 * mB2
311 + mK2 * mK2
312 + q2 * q2
313 - 2.0 * (mB2 * mK2 + (mB2 + mK2) * q2);
314
315 return std::max(0.0, lam);
316}
317
318complex_t BKstarllDecay::N(double q2, bool bar) {
319 const complex_t N0 = bar ? std::conj(cache.N_0) : cache.N_0;
320 const double b = beta_l(q2);
321 const double lam = lambda(q2);
322
323 return N0 * std::sqrt(std::max(0.0, q2 * b * std::sqrt(lam)));
324}
325
326complex_t BKstarllDecay::delta_A_perp_QCDf(double q2, double sign, bool bar) {
327 complex_t guesstimate_err = 1.0;
328 complex_t delta_A = 0.0;
329
330 if (!fpeq(std::abs(cache.h_p_fit[0]), 0.0)) {
331 complex_t h_p = cache.h_p_fit[0] + q2 * (cache.h_p_fit[1] + q2 * cache.h_p_fit[2]);
332 complex_t h_m = cache.h_m_fit[0] + q2 * (cache.h_m_fit[1] + q2 * cache.h_m_fit[2]);
333 delta_A = 16.0 * PI2 * RT2 * N(q2, bar) * std::pow(cache.m_B, 3) * (h_p - h_m) / q2;
334 } else {
335 size_t id = size_t (0.5 * (1 + sign));
336 guesstimate_err = 1.0 + cache.a_k_low[id] * std::exp(I * cache.phi_k_low[id]) + cache.b_k_low[id] * std::exp(I * cache.theta_k_low[id]) * q2 / 6.0;
337 }
338
339 return 2 * RT2 * (cache.m_b_PS + cache.alpha_s_mu_b * cache.Delta_M / (3 * PI)) * N(q2, bar) * std::sqrt(lambda(q2)) / q2 * T_perp_p_cached(q2, bar) * guesstimate_err + delta_A;
340}
341
343 double F_perp = std::sqrt(2. * lambda(q2)) / (cache.m_B * (cache.m_B + cache.m_Ks)) * cache.ff_calculator.get(BV_FF::V, q2);
344 complex_t z_q2 = cache.ff_calculator.z(q2, cache.tp_nf, cache.t0_nf);
345 complex_t P_H_perp = cache.alpha_perp[0] + z_q2 * (cache.alpha_perp[1] + z_q2 * cache.alpha_perp[2]);
346 complex_t H_perp = (1. - z_q2 * std::conj(cache.z_Jpsi_nf)) / (z_q2 - cache.z_Jpsi_nf) * (1. - z_q2 * std::conj(cache.z_psi2S_nf)) / (z_q2 - cache.z_psi2S_nf) * P_H_perp * F_perp;
347 return -32.0 * PI2 * N(q2, bar) * std::pow(cache.m_B, 3) * H_perp / q2;
348}
349
351 double DeltaC9_M1 = (cache.r1_M[0] * (1 - cache.q2_bar / q2) + cache.DeltaC9_M_qbar[0] * cache.q2_bar / q2) / (1 + cache.r2_M[0] * (cache.q2_bar - q2) / cache.q2_Jpsi);
352 return N(q2, bar) * RT2 * std::sqrt(lambda(q2)) * DeltaC9_M1 * cache.ff_calculator.get(BV_FF::V, q2) / (cache.m_B + cache.m_Ks);
353}
354
355complex_t BKstarllDecay::delta_A_perp(double q2, double sign, bool bar) {
356 switch(cfg.power_corr_impl) {
358 return delta_A_perp_QCDf(q2, sign, bar);
360 return delta_A_perp_vD(q2, bar);
362 return delta_A_perp_K(q2, bar);
363 default:
364 return 0.0;
365 }
366}
367
368complex_t BKstarllDecay::delta_A_par_QCDf(double q2, double sign, bool bar) {
369 complex_t guesstimate_err = 1.0;
370 complex_t delta_A = 0.0;
371
372 if (!fpeq(std::abs(cache.h_p_fit[0]), 0.0)) {
373 complex_t h_p = cache.h_p_fit[0] + q2 * (cache.h_p_fit[1] + q2 * cache.h_p_fit[2]);
374 complex_t h_m = cache.h_m_fit[0] + q2 * (cache.h_m_fit[1] + q2 * cache.h_m_fit[2]);
375 delta_A = 16.0 * PI2 * RT2 * N(q2, bar) * std::pow(cache.m_B, 3) * (h_p + h_m) / q2;
376 } else {
377 size_t id = 2 + size_t (0.5 * (1 + sign));
378 guesstimate_err = guesstimate_err = 1.0 + cache.a_k_low[id] * std::exp(I * cache.phi_k_low[id]) + cache.b_k_low[id] * std::exp(I * cache.theta_k_low[id]) * q2 / 6.0;
379 }
380
381 return -4 * RT2 * (cache.m_b_PS + cache.alpha_s_mu_b * cache.Delta_M / (3 * PI)) * N(q2, bar) * (cache.m_B * cache.m_B - cache.m_Ks * cache.m_Ks) * cache.ff_calculator.E(q2) / (q2 * cache.m_B) * T_perp_m_cached(q2, bar) * guesstimate_err + delta_A;
382}
383
385 double F_par = RT2 * (cache.m_B + cache.m_Ks) / cache.m_B * cache.ff_calculator.get(BV_FF::A1, q2);
386 complex_t z_q2 = cache.ff_calculator.z(q2, cache.tp_nf, cache.t0_nf);
387 complex_t P_H_par = cache.alpha_par[0] + z_q2 * (cache.alpha_par[1] + z_q2 * cache.alpha_par[2]);
388 complex_t H_par = (1. - z_q2 * std::conj(cache.z_Jpsi_nf)) / (z_q2 - cache.z_Jpsi_nf) * (1. - z_q2 * std::conj(cache.z_psi2S_nf)) / (z_q2 - cache.z_psi2S_nf) * P_H_par * F_par;
389 return 32.0 * PI2 * N(q2, bar) * std::pow(cache.m_B, 3) * H_par / q2;
390}
391
393 double DeltaC9_M2 = (cache.r1_M[1] * (1 - cache.q2_bar / q2) + cache.DeltaC9_M_qbar[1] * cache.q2_bar / q2) / (1 + cache.r2_M[1] * (cache.q2_bar - q2) / cache.q2_Jpsi);
394 return N(q2, bar) / RT2 * (cache.m_B * cache.m_B - cache.m_Ks * cache.m_Ks) * DeltaC9_M2 * cache.ff_calculator.get(BV_FF::A1, q2) / (cache.m_B - cache.m_Ks);
395}
396
397complex_t BKstarllDecay::A_perp_low(double q2, double sign, bool bar) {
398 complex_t F, F_T;
399 complex_t delta_A {0.0};
400 complex_t had_err_factor {1.0};
401 double m_b_local;
402
403 if (cfg.ff_type == B_FF_Type::SOFT) {
404 complex_t w = cache.C[WCoef::C9] + cache.C[WCoef::CP9] + sign * (cache.C[WCoef::C10] + cache.C[WCoef::CP10]);
405 if (bar) w = std::conj(w);
406 F = w * cache.ff_calculator.get(BV_FF::V, q2) / (cache.m_B + cache.m_Ks);
407 F_T = T_perp_p_cached(q2, bar);
408 size_t id = size_t (0.5 * (1 + sign));
409 had_err_factor = 1.0 + cache.a_k_low[id] + cache.b_k_low[id] * q2 / 6.0;
410 m_b_local = cache.m_b_PS;
411 } else {
412 F_T = (cache.C[WCoef::C7] + cache.C[WCoef::CP7]) * cache.ff_calculator.get(BV_FF::T1, q2);
413 complex_t w = cache.C[WCoef::C9] + cache.C[WCoef::CP9] + sign * (cache.C[WCoef::C10] + cache.C[WCoef::CP10]);
414 if (bar) {
415 w = std::conj(w);
416 F_T = std::conj(F_T);
417 }
419 F = w * cache.ff_calculator.get(BV_FF::V, q2) / (cache.m_B + cache.m_Ks);
420 delta_A = delta_A_perp(q2, sign, bar);
421 m_b_local = cache.m_b_PS + cache.alpha_s_mu_b * cache.Delta_M / (3 * PI);
422 }
423
424 return (N(q2, bar) * std::sqrt(2 * lambda(q2)) * (F + 2. * m_b_local * F_T / q2) + delta_A) * had_err_factor;
425}
426
427complex_t BKstarllDecay::A_par_low(double q2, double sign, bool bar) {
428 complex_t F, F_T;
429 complex_t delta_A {0.0};
430 complex_t had_err_factor {1.0};
431 double m_b_local;
432
433 if (cfg.ff_type == B_FF_Type::SOFT) {
434 complex_t w = cache.C[WCoef::C9] - cache.C[WCoef::CP9] + sign * (cache.C[WCoef::C10] - cache.C[WCoef::CP10]);
435 if (bar) w = std::conj(w);
436 F = w * cache.ff_calculator.get(BV_FF::XI_PERP, q2) * 2. * cache.ff_calculator.E(q2) / (cache.m_B * cache.m_B - cache.m_Ks * cache.m_Ks);
437 F_T = 2. * cache.ff_calculator.E(q2) * T_perp_m_cached(q2, bar) / cache.m_B;
438 size_t id = 2 + size_t (0.5 * (1 + sign));
439 had_err_factor = 1.0 + cache.a_k_low[id] + cache.b_k_low[id] * q2 / 6.0;
440 m_b_local = cache.m_b_PS;
441 } else {
442 F_T = (cache.C[WCoef::C7] - cache.C[WCoef::CP7]) * cache.ff_calculator.get(BV_FF::T2, q2);
443 complex_t w = cache.C[WCoef::C9] - cache.C[WCoef::CP9] + sign * (cache.C[WCoef::C10] - cache.C[WCoef::CP10]);
444 if (bar) {
445 w = std::conj(w);
446 F_T = std::conj(F_T);
447 }
449 F = w * cache.ff_calculator.get(BV_FF::A1, q2) / (cache.m_B - cache.m_Ks);
450 delta_A = delta_A_par(q2, sign, bar);
451 m_b_local = cache.m_b_PS + cache.alpha_s_mu_b * cache.Delta_M / (3 * PI);
452 }
453
454 return (-N(q2, bar) * std::sqrt(2.) * (cache.m_B * cache.m_B - cache.m_Ks * cache.m_Ks) * (F + 2. * m_b_local * F_T / q2) + delta_A) * had_err_factor;
455}
456
457complex_t BKstarllDecay::A_0_low(double q2, double sign, bool bar) {
458 double mB2 = cache.m_B * cache.m_B;
459 double mK2 = cache.m_Ks * cache.m_Ks;
460 complex_t F, F_T;
461 complex_t delta_A {0.0};
462 complex_t had_err_factor {1.0};
463 double m_b_local;
464
465 if (cfg.ff_type == B_FF_Type::SOFT) {
466 complex_t w = cache.C[WCoef::C9] - cache.C[WCoef::CP9] + sign * (cache.C[WCoef::C10] - cache.C[WCoef::CP10]);
467 if (bar) w = std::conj(w);
468 F = w * (
469 (2 * cache.ff_calculator.E(q2) * (mB2 - mK2 - q2) - lambda(q2) * cache.m_B / (mB2 - mK2)) * cache.ff_calculator.get(BV_FF::XI_PERP, q2)
470 + (lambda(q2) * cache.m_B / (mB2 - mK2)) * cache.ff_calculator.get(BV_FF::XI_PAR, q2)
471 );
472 F_T = 2. * cache.ff_calculator.E(q2) * (mB2 + 3. * mK2 - q2) / cache.m_B * T_perp_m_cached(q2, bar) - lambda(q2) * (T_perp_m_cached(q2, bar) + T_par_m_cached(q2, bar)) / (mB2 - mK2);
473 size_t id = 4 + size_t (0.5 * (1 + sign));
474 had_err_factor = 1.0 + cache.a_k_low[id] + cache.b_k_low[id] * q2 / 6.0;
475 m_b_local = cache.m_b_PS;
476 } else {
477 F_T = (cache.C[WCoef::C7] - cache.C[WCoef::CP7]) * 8. * cache.m_B * mK2 / (cache.m_B + cache.m_Ks) * cache.ff_calculator.get(BV_FF::T23, q2);
478 complex_t w = cache.C[WCoef::C9] - cache.C[WCoef::CP9] + sign * (cache.C[WCoef::C10] - cache.C[WCoef::CP10]);
479 if (bar) {
480 w = std::conj(w);
481 F_T = std::conj(F_T);
482 }
484 F = w * 16. * cache.m_B * mK2 * cache.ff_calculator.get(BV_FF::A12, q2);
485 delta_A = delta_A_0(q2, sign, bar);
486 m_b_local = cache.m_b_PS + cache.alpha_s_mu_b * cache.Delta_M / (3 * PI);
487 }
488
489 return (-N(q2, bar) / (2. * cache.m_Ks * std::sqrt(q2)) * (F + 2. * m_b_local * F_T) + delta_A) * had_err_factor;
490}
491
492complex_t BKstarllDecay::A_t_low(double q2, bool bar) {
493 complex_t C10 = cache.C[WCoef::C10] - cache.C[WCoef::CP10];
494 complex_t CQ2 = cache.C[WCoefMapper::cq2_for_lepton_index(static_cast<int>(cfg.gen))] - cache.C[WCoefMapper::cpq2_for_lepton_index(static_cast<int>(cfg.gen))];
495 if (bar) {
496 C10 = std::conj(C10);
497 CQ2 = std::conj(CQ2);
498 }
499
500 complex_t F;
501 if (cfg.ff_type == B_FF_Type::SOFT) {
502 F = cache.ff_calculator.E(q2) * cache.ff_calculator.get(BV_FF::XI_PAR, q2) / (cache.m_Ks * cache.qcdf_calculator.Delta_par(q2));
503 } else {
504 F = cache.ff_calculator.get(BV_FF::A0, q2);
505 }
506
507 return N(q2, bar) * std::sqrt(lambda(q2) / q2) * ((2. * C10 + q2 / (cache.m_l * (cache.m_b_mu_b + cache.m_s)) * CQ2)) * F;
508}
509
510complex_t BKstarllDecay::A_S_low(double q2, bool bar) {
511 complex_t CQ1 = cache.C[WCoefMapper::cq1_for_lepton_index(static_cast<int>(cfg.gen))] - cache.C[WCoefMapper::cpq1_for_lepton_index(static_cast<int>(cfg.gen))];
512 if (bar) CQ1 = std::conj(CQ1);
513
514 complex_t F;
515 if (cfg.ff_type == B_FF_Type::SOFT) {
516 F = cache.ff_calculator.E(q2) * cache.ff_calculator.get(BV_FF::XI_PAR, q2) / (cache.m_Ks * cache.qcdf_calculator.Delta_par(q2));
517 } else {
518 F = cache.ff_calculator.get(BV_FF::A0, q2);
519 }
520
521 return -2. * N(q2, bar) * std::sqrt(lambda(q2)) * CQ1 / (cache.m_b_mu_b + cache.m_s) * F;
522}
523
524complex_t BKstarllDecay::delta_A_par(double q2, double sign, bool bar) {
525 switch(cfg.power_corr_impl) {
527 return delta_A_par_QCDf(q2, sign, bar);
529 return delta_A_par_vD(q2, bar);
531 return delta_A_par_K(q2, bar);
532 default:
533 return 0.0;
534 }
535}
536
537complex_t BKstarllDecay::delta_A_0_QCDf(double q2, double sign, bool bar) {
538 complex_t guesstimate_err = 1.0;
539 complex_t delta_A_PC = 0.0;
540
541 if (!fpeq(std::abs(cache.h_p_fit[0]), 0.0)) {
542 complex_t h_0 = cache.h_0_fit[0] + q2 * (cache.h_0_fit[1] + q2 * cache.h_0_fit[2]);
543 delta_A_PC = 32.0 * PI2 * N(q2, bar) * std::pow(cache.m_B, 3) * h_0 / std::sqrt(q2);
544 } else {
545 size_t id = 4 + size_t (0.5 * (1 + sign));
546 guesstimate_err = 1.0 + cache.a_k_low[id] * std::exp(I * cache.phi_k_low[id]) + cache.b_k_low[id] * std::exp(I * cache.theta_k_low[id]) * q2 / 6.0;
547 }
548
549 const double mB2 = cache.m_B * cache.m_B;
550 const double mB3 = cache.m_B * mB2;
551 const double mK2 = cache.m_Ks * cache.m_Ks;
552 const double f = lambda(q2) / ((mB2 - mK2) * mB2);
553
554 const complex_t Tperp_m = T_perp_m_cached(q2, bar);
555 const complex_t Tpar_m = T_par_m_cached(q2, bar);
556
557 complex_t delta_A_QCDf =
558 -N(q2, bar)
559 * (cache.m_b_PS + cache.alpha_s_mu_b * cache.Delta_M / (3 * PI))
560 * mB2 / (std::sqrt(q2) * cache.m_Ks)
561 * ((2 * (mB2 + 3 * mK2 - q2) * cache.ff_calculator.E(q2) / mB3 - f) * Tperp_m
562 - f * Tpar_m);
563
564 return delta_A_QCDf * guesstimate_err + delta_A_PC;
565}
566
568 double F_0 = cache.m_Ks / std::sqrt(q2) * ((std::pow(cache.m_B, 2) - std::pow(cache.m_Ks, 2) - q2) * std::pow(cache.m_B + cache.m_Ks, 2) * cache.ff_calculator.get(BV_FF::A1, q2) - lambda(q2) * cache.ff_calculator.get(BV_FF::A2, q2))/(2. * std::pow(cache.m_Ks, 2) * std::pow(cache.m_B + cache.m_Ks, 2));
569 complex_t z_q2 = cache.ff_calculator.z(q2, cache.tp_nf, cache.t0_nf);
570 complex_t P_H_0 = cache.alpha_0[0] + z_q2 * cache.alpha_0[1];
571 complex_t H_0 = (1. - z_q2 * std::conj(cache.z_Jpsi_nf)) / (z_q2 - cache.z_Jpsi_nf) * (1. - z_q2 * std::conj(cache.z_psi2S_nf)) / (z_q2 - cache.z_psi2S_nf) * P_H_0 * F_0;
572 return 32.0 * PI2 * N(q2, bar) * std::pow(cache.m_B, 2) * (cache.m_B + cache.m_Ks) * H_0 / q2;
573}
574
576 double DeltaC9_M2 = (cache.r1_M[1] * (1 - cache.q2_bar / q2) + cache.DeltaC9_M_qbar[1] * cache.q2_bar / q2) / (1 + cache.r2_M[1] * (cache.q2_bar - q2) / cache.q2_Jpsi);
577 double DeltaC9_M3 = (cache.r1_M[2] * (1 - cache.q2_bar / q2) + cache.DeltaC9_M_qbar[2] * cache.q2_bar / q2) / (1 + cache.r2_M[2] * (cache.q2_bar - q2) / cache.q2_Jpsi);
578 return -N(q2, bar) / 2. / cache.m_Ks / std::sqrt(q2) * (((cache.m_B * cache.m_B- cache.m_Ks * cache.m_Ks - q2) * (cache.m_B + cache.m_Ks) * cache.ff_calculator.get(BV_FF::A1, q2) * DeltaC9_M2 - lambda(q2) * cache.ff_calculator.get(BV_FF::A2, q2) * DeltaC9_M3 / (cache.m_B + cache.m_Ks)));
579}
580
581complex_t BKstarllDecay::delta_A_0(double q2, double sign, bool bar) {
582 switch(cfg.power_corr_impl) {
584 return delta_A_0_QCDf(q2, sign, bar);
586 return delta_A_0_vD(q2, bar);
588 return delta_A_0_K(q2, bar);
589 default:
590 return 0.0;
591 }
592}
593
594complex_t BKstarllDecay::C7_eff(double q2, bool bar) {
595 double s_hat = q2 / std::pow(cache.m_b_PS, 2);
596 complex_t A = BV::A_Seidel(s_hat, cache.L_b);
597 return (bar ? std::conj(cache.C[WCoef::C7]) : cache.C[WCoef::C7]) + cache.alpha_s_mu_b / (4. * PI) * ((cache.C[WCoef::C1]-6.*cache.C[WCoef::C2])*A-cache.C[WCoef::C8]*BV::f_87(s_hat, cache.L_b));
598}
599
600complex_t BKstarllDecay::C9_eff(double q2, bool bar) {
601 complex_t C_h0 = 4./3.*cache.C[WCoef::C1]+cache.C[WCoef::C2]+11./2.*cache.C[WCoef::C3]-2./3.*cache.C[WCoef::C4]+52.*cache.C[WCoef::C5]-32./3.*cache.C[WCoef::C6];
602 complex_t C_hb = -0.5 * (7.*cache.C[WCoef::C3]+4./3.*cache.C[WCoef::C4]+76.*cache.C[WCoef::C5]+64./3.*cache.C[WCoef::C6]);
603 complex_t C_0 = 4./3.*(cache.C[WCoef::C3]+16./3.*cache.C[WCoef::C5]+16./9.*cache.C[WCoef::C6]);
604 complex_t l_u = bar ? std::conj(cache.lambda_hat_u) : cache.lambda_hat_u;
605 complex_t C_mc = 8. * ((4./9.*cache.C[WCoef::C1]+1./3.*cache.C[WCoef::C2])*(1.+l_u)+2.*cache.C[WCoef::C3]+20.*cache.C[WCoef::C5]);
606
607 double s_hat = q2 / std::pow(cache.m_b_PS, 2);
608 complex_t B = BV::B_Seidel(s_hat, cache.L_b);
609 complex_t C = BV::C_Seidel(q2, cache.mu_b);
610
611 return (bar ? std::conj(cache.C[WCoef::C9]) : cache.C[WCoef::C9])
612 + BV::h(q2, 0., cache.mu_b) * C_h0
613 + BV::h(q2, cache.m_b_PS, cache.mu_b) * C_hb
614 + C_0
615 + cache.alpha_s_mu_b / (4. * PI) * (cache.C[WCoef::C1]*(B + 4. * C) - 3. * cache.C[WCoef::C2] * (2. * B - C) - cache.C[WCoef::C8] * BV::f_89(s_hat))
616 + std::pow(cache.m_c_mu_b, 2) / q2 * C_mc;
617}
618
619complex_t BKstarllDecay::A_perp_high(double q2, double sign, bool bar) {
620 complex_t C7 = C7_eff(q2, bar) + (bar ? std::conj(cache.C[WCoef::CP7]) : cache.C[WCoef::CP7]);
621 complex_t C9 = C9_eff(q2, bar) + (bar ? std::conj(cache.C[WCoef::CP9]) : cache.C[WCoef::CP9]);
622 complex_t C10 = cache.C[WCoef::C10] + cache.C[WCoef::CP10];
623 if (bar) C10 = std::conj(C10);
624
625 return N(q2, bar) * (C9 + sign * C10 + 2. * cache.kappa * cache.m_b_mb * cache.m_B / q2 * C7) * cache.ff_calculator.get(BV_FF::F_PERP, q2) * (1. + cache.a_k_high[size_t (0.5 * (1 + sign))] * std::exp(I * cache.phi_k_high[size_t (0.5 * (1 + sign))]));
626}
627
628complex_t BKstarllDecay::A_par_high(double q2, double sign, bool bar) {
629 complex_t C7 = C7_eff(q2, bar) - (bar ? std::conj(cache.C[WCoef::CP7]) : cache.C[WCoef::CP7]);
630 complex_t C9 = C9_eff(q2, bar) - (bar ? std::conj(cache.C[WCoef::CP9]) : cache.C[WCoef::CP9]);
631 complex_t C10 = cache.C[WCoef::C10] - cache.C[WCoef::CP10];
632 if (bar) C10 = std::conj(C10);
633 return -N(q2, bar) * (C9 + sign * C10 + 2. * cache.kappa * cache.m_b_mb * cache.m_B / q2 * C7) * cache.ff_calculator.get(BV_FF::F_PAR, q2) * (1. + cache.a_k_high[2 + size_t (0.5 * (1 + sign))] * std::exp(I * cache.phi_k_high[2 + size_t (0.5 * (1 + sign))]));
634}
635
636complex_t BKstarllDecay::A_0_high(double q2, double sign, bool bar) {
637 complex_t C7 = C7_eff(q2, bar) - (bar ? std::conj(cache.C[WCoef::CP7]) : cache.C[WCoef::CP7]);
638 complex_t C9 = C9_eff(q2, bar) - (bar ? std::conj(cache.C[WCoef::CP9]) : cache.C[WCoef::CP9]);
639 complex_t C10 = cache.C[WCoef::C10] - cache.C[WCoef::CP10];
640 if (bar) C10 = std::conj(C10);
641 return -N(q2, bar) * (C9 + sign * C10 + 2. * cache.kappa * cache.m_b_mb * cache.m_B / q2 * C7) * cache.ff_calculator.get(BV_FF::F_0, q2) * (1. + cache.a_k_high[4 + size_t (0.5 * (1 + sign))] * std::exp(I * cache.phi_k_high[4 + size_t (0.5 * (1 + sign))]));
642}
643
644complex_t BKstarllDecay::A_t_high(double q2, bool bar) {
645 complex_t C10 = cache.C[WCoef::C10] - cache.C[WCoef::CP10];
646 complex_t CQ2 = cache.C[WCoefMapper::cq2_for_lepton_index(static_cast<int>(cfg.gen))] - cache.C[WCoefMapper::cpq2_for_lepton_index(static_cast<int>(cfg.gen))];
647 if (bar) {
648 C10 = std::conj(C10);
649 CQ2 = std::conj(CQ2);
650 }
651 return N(q2, bar) * sqrt(lambda(q2) / q2) * (2. * C10 + q2 / cache.m_l * CQ2 / (cache.m_b_mb + cache.m_s)) * cache.ff_calculator.get(BV_FF::A0, q2) * (1. + cache.a_k_high[6] * std::exp(I * cache.phi_k_high[6]));
652}
653
654complex_t BKstarllDecay::A_S_high(double q2, bool bar) {
655 complex_t CQ1 = cache.C[WCoefMapper::cq1_for_lepton_index(static_cast<int>(cfg.gen))] - cache.C[WCoefMapper::cpq1_for_lepton_index(static_cast<int>(cfg.gen))];
656 if (bar) CQ1 = std::conj(CQ1);
657 return -2. * N(q2, bar) * sqrt(lambda(q2)) * CQ1 / (cache.m_b_mb + cache.m_s) * cache.ff_calculator.get(BV_FF::A0, q2) * (1. + cache.a_k_high[7] * std::exp(I * cache.phi_k_high[7]));
658}
659
661 if (q2 < cache.q2_low)
662 return val_low;
663
664 if (q2 > cache.q2_high)
665 return val_high;
666
667 double t = (cache.q2_high - q2) / (cache.q2_high - cache.q2_low);
668 return t * val_low + (1 - t) * val_high;
669}
670
671complex_t BKstarllDecay::A_perp(double q2, double sign, bool bar) {
672 return interpolate(q2, A_perp_low(q2, sign, bar), A_perp_high(q2, sign, bar));
673}
674
675complex_t BKstarllDecay::A_par(double q2, double sign, bool bar) {
676 return interpolate(q2, A_par_low(q2, sign, bar), A_par_high(q2, sign, bar));
677}
678
679complex_t BKstarllDecay::A_0(double q2, double sign, bool bar) {
680 return interpolate(q2, A_0_low(q2, sign, bar), A_0_high(q2, sign, bar));
681}
682
683complex_t BKstarllDecay::A_t(double q2, bool bar) {
684 return interpolate(q2, A_t_low(q2, bar), A_t_high(q2, bar));
685}
686
687complex_t BKstarllDecay::A_S(double q2, bool bar) {
688 return interpolate(q2, A_S_low(q2, bar), A_S_high(q2, bar));
689}
690
691double BKstarllDecay::J1s(double q2, bool bar) {
692 return (2. + std::pow(beta_l(q2), 2)) / 4. * (
693 std::pow(std::abs(A_perp(q2, -1, bar)), 2)
694 + std::pow(std::abs(A_perp(q2, 1, bar)), 2)
695 + std::pow(std::abs(A_par(q2, -1, bar)), 2)
696 + std::pow(std::abs(A_par(q2, 1, bar)), 2)
697 ) + std::pow(2. * cache.m_l, 2) / q2 * std::real(
698 A_perp(q2, -1, bar) * std::conj(A_perp(q2, 1, bar))
699 + A_par(q2, -1, bar) * std::conj(A_par(q2, 1, bar))
700 );
701}
702
703double BKstarllDecay::J1c(double q2, bool bar) {
704 return std::pow(std::abs(A_0(q2, -1, bar)), 2) + std::pow(std::abs(A_0(q2, 1, bar)), 2)
705 + std::pow(2 * cache.m_l, 2) / q2 * (
706 std::pow(std::abs(A_t(q2, bar)), 2)
707 + 2. * std::real(A_0(q2, -1, bar) * std::conj(A_0(q2, 1, bar)))
708 )
709 + std::pow(beta_l(q2) * std::abs(A_S(q2, bar)), 2);
710}
711
712double BKstarllDecay::J2s(double q2, bool bar) {
713 return std::pow(beta_l(q2), 2) / 4. * (
714 std::pow(std::abs(A_perp(q2, -1, bar)), 2)
715 + std::pow(std::abs(A_perp(q2, 1, bar)), 2)
716 + std::pow(std::abs(A_par(q2, -1, bar)), 2)
717 + std::pow(std::abs(A_par(q2, 1, bar)), 2)
718 );
719}
720
721double BKstarllDecay::J2c(double q2, bool bar) {
722 return -std::pow(beta_l(q2), 2) * (
723 std::pow(std::abs(A_0(q2, -1, bar)), 2)
724 + std::pow(std::abs(A_0(q2, 1, bar)), 2)
725 );
726}
727
728double BKstarllDecay::J3(double q2, bool bar) {
729 return std::pow(beta_l(q2), 2) / 2. * (
730 std::pow(std::abs(A_perp(q2, -1, bar)), 2)
731 + std::pow(std::abs(A_perp(q2, 1, bar)), 2)
732 - std::pow(std::abs(A_par(q2, -1, bar)), 2)
733 - std::pow(std::abs(A_par(q2, 1, bar)), 2)
734 );
735}
736
737double BKstarllDecay::J4(double q2, bool bar) {
738 return std::pow(beta_l(q2), 2) / std::sqrt(2.) * (
739 std::real(A_0(q2, -1, bar) * std::conj(A_par(q2, -1, bar)))
740 + std::real(A_0(q2, 1, bar) * std::conj(A_par(q2, 1, bar)))
741 );
742}
743
744double BKstarllDecay::J5(double q2, bool bar) {
745 return beta_l(q2) * std::sqrt(2.) * (
746 std::real(A_0(q2, -1, bar) * std::conj(A_perp(q2, -1, bar)))
747 - std::real(A_0(q2, 1, bar) * std::conj(A_perp(q2, 1, bar)))
748 - cache.m_l / std::sqrt(q2) * std::real((A_par(q2, -1, bar) + A_par(q2, 1, bar)) * std::conj(A_S(q2, bar)))
749 );
750}
751
752double BKstarllDecay::J6s(double q2, bool bar) {
753 return 2. * beta_l(q2) * (
754 std::real(A_par(q2, -1, bar) * std::conj(A_perp(q2, -1, bar)))
755 - std::real(A_par(q2, 1, bar) * std::conj(A_perp(q2, 1, bar)))
756 );
757}
758
759double BKstarllDecay::J6c(double q2, bool bar) {
760 return 4. * beta_l(q2) * cache.m_l / std::sqrt(q2) * (std::real((A_0(q2, -1, bar) + A_0(q2, 1, bar)) * std::conj(A_S(q2, bar))));
761}
762
763double BKstarllDecay::J7(double q2, bool bar) {
764 return beta_l(q2) * std::sqrt(2.) * (
765 std::imag(A_0(q2, -1, bar) * std::conj(A_par(q2, -1, bar)))
766 - std::imag(A_0(q2, 1, bar) * std::conj(A_par(q2, 1, bar)))
767 + cache.m_l / std::sqrt(q2) * std::imag((A_perp(q2, -1, bar) + A_perp(q2, 1, bar)) * std::conj(A_S(q2, bar)))
768 );
769}
770
771double BKstarllDecay::J8(double q2, bool bar) {
772 return std::pow(beta_l(q2), 2) / std::sqrt(2.) * (
773 std::imag(A_0(q2, -1, bar) * std::conj(A_perp(q2, -1, bar)))
774 + std::imag(A_0(q2, 1, bar) * std::conj(A_perp(q2, 1, bar)))
775 );
776}
777
778double BKstarllDecay::J9(double q2, bool bar) {
779 return std::pow(beta_l(q2), 2) * (
780 std::imag(A_perp(q2, -1, bar) * std::conj(A_par(q2, -1, bar)))
781 + std::imag(A_perp(q2, 1, bar) * std::conj(A_par(q2, 1, bar)))
782 );
783}
784
786
787 static constexpr std::array<double, 24> GL24_X {{
788 -0.99518721999702131, -0.97472855597130947, -0.93827455200273280, -0.88641552700440107,
789 -0.82000198597390295, -0.74012419157855436, -0.64809365193697555, -0.54542147138883956,
790 -0.43379350762604513, -0.31504267969616340, -0.19111886747361631, -0.06405689286260563,
791 0.06405689286260563, 0.19111886747361631, 0.31504267969616340, 0.43379350762604513,
792 0.54542147138883956, 0.64809365193697555, 0.74012419157855436, 0.82000198597390295,
793 0.88641552700440107, 0.93827455200273280, 0.97472855597130947, 0.99518721999702131
794 }};
795 static constexpr std::array<double, 24> GL24_W {{
796 0.01234122979998869, 0.02853138862893356, 0.04427743881741941, 0.05929858491543636,
797 0.07334648141108016, 0.08619016153195321, 0.09761865210411393, 0.10744427011596556,
798 0.11550566805372552, 0.12167047292780329, 0.12583745634682825, 0.12793819534675202,
799 0.12793819534675202, 0.12583745634682825, 0.12167047292780329, 0.11550566805372552,
800 0.10744427011596556, 0.09761865210411393, 0.08619016153195321, 0.07334648141108016,
801 0.05929858491543636, 0.04427743881741941, 0.02853138862893356, 0.01234122979998869
802 }};
803
804 struct AmpSet {
805 complex_t A_perp_L;
806 complex_t A_perp_R;
807 complex_t A_par_L;
808 complex_t A_par_R;
809 complex_t A_0_L;
810 complex_t A_0_R;
811 complex_t A_t;
812 complex_t A_S;
813 double beta;
814 double beta2;
815 double sqrt_q2;
816 };
817
818 auto clear_and_reserve = [&] (std::array<std::vector<double>, 15>& dest, size_t nbins) {
819 for (auto& v : dest) {
820 v.clear();
821 v.reserve(nbins);
822 }
823 };
824
825 auto eval_amplitudes = [&] (double q2, bool bar) -> AmpSet {
826 const double beta = beta_l(q2);
827 return {
828 A_perp(q2, -1, bar),
829 A_perp(q2, 1, bar),
830 A_par(q2, -1, bar),
831 A_par(q2, 1, bar),
832 A_0(q2, -1, bar),
833 A_0(q2, 1, bar),
834 A_t(q2, bar),
835 A_S(q2, bar),
836 beta,
837 beta * beta,
838 std::sqrt(q2)
839 };
840 };
841
842 auto eval_integrands = [&] (double q2, bool bar) -> std::array<double, 15> {
843 const AmpSet a = eval_amplitudes(q2, bar);
844 const double sqrt2 = std::sqrt(2.0);
845 const double ml = cache.m_l;
846 const double ml_over_sqrt_q2 = ml / a.sqrt_q2;
847 const double four_ml2_over_q2 = 4.0 * ml * ml / q2;
848
849 const double norm_Aperp_L = std::norm(a.A_perp_L);
850 const double norm_Aperp_R = std::norm(a.A_perp_R);
851 const double norm_Apar_L = std::norm(a.A_par_L);
852 const double norm_Apar_R = std::norm(a.A_par_R);
853 const double norm_A0_L = std::norm(a.A_0_L);
854 const double norm_A0_R = std::norm(a.A_0_R);
855 const double norm_At = std::norm(a.A_t);
856 const double norm_AS = std::norm(a.A_S);
857
858 const complex_t Apar_sum = a.A_par_L + a.A_par_R;
859 const complex_t A0_sum = a.A_0_L + a.A_0_R;
860 const complex_t Aperp_sum = a.A_perp_L + a.A_perp_R;
861
862 const double j1s =
863 (2.0 + a.beta2) / 4.0 * (norm_Aperp_L + norm_Aperp_R + norm_Apar_L + norm_Apar_R)
864 + four_ml2_over_q2 * std::real(a.A_perp_L * std::conj(a.A_perp_R)
865 + a.A_par_L * std::conj(a.A_par_R));
866
867 const double j1c =
868 norm_A0_L + norm_A0_R
869 + four_ml2_over_q2 * (norm_At + 2.0 * std::real(a.A_0_L * std::conj(a.A_0_R)))
870 + a.beta2 * norm_AS;
871
872 const double j2s = a.beta2 / 4.0 * (norm_Aperp_L + norm_Aperp_R + norm_Apar_L + norm_Apar_R);
873 const double j2c = -a.beta2 * (norm_A0_L + norm_A0_R);
874
875 const double j3 = a.beta2 / 2.0 * (norm_Aperp_L + norm_Aperp_R - norm_Apar_L - norm_Apar_R);
876
877 const double j4 = a.beta2 / sqrt2 * (
878 std::real(a.A_0_L * std::conj(a.A_par_L))
879 + std::real(a.A_0_R * std::conj(a.A_par_R))
880 );
881
882 const double j5 = a.beta * sqrt2 * (
883 std::real(a.A_0_L * std::conj(a.A_perp_L))
884 - std::real(a.A_0_R * std::conj(a.A_perp_R))
885 - ml_over_sqrt_q2 * std::real(Apar_sum * std::conj(a.A_S))
886 );
887
888 const double j6s = 2.0 * a.beta * (
889 std::real(a.A_par_L * std::conj(a.A_perp_L))
890 - std::real(a.A_par_R * std::conj(a.A_perp_R))
891 );
892
893 const double j6c = 4.0 * a.beta * ml_over_sqrt_q2 * std::real(A0_sum * std::conj(a.A_S));
894
895 const double j7 = a.beta * sqrt2 * (
896 std::imag(a.A_0_L * std::conj(a.A_par_L))
897 - std::imag(a.A_0_R * std::conj(a.A_par_R))
898 + ml_over_sqrt_q2 * std::imag(Aperp_sum * std::conj(a.A_S))
899 );
900
901 const double j8 = a.beta2 / sqrt2 * (
902 std::imag(a.A_0_L * std::conj(a.A_perp_L))
903 + std::imag(a.A_0_R * std::conj(a.A_perp_R))
904 );
905
906 const double j9 = a.beta2 * (
907 std::imag(a.A_perp_L * std::conj(a.A_par_L))
908 + std::imag(a.A_perp_R * std::conj(a.A_par_R))
909 );
910
911 return {{
912 2.0 * j1s + j1c,
913 j2s,
914 j2c,
915 j3,
916 j4,
917 j5,
918 a.beta * j5,
919 j6s,
920 a.beta * j6s,
921 j6c,
922 j7,
923 a.beta * j7,
924 j8,
925 j9,
926 j1c
927 }};
928 };
929
930 auto integrate_bin = [&] (double q2_l, double q2_u, bool bar) -> std::array<double, 15> {
931 std::array<double, 15> acc {};
932 const double center = 0.5 * (q2_l + q2_u);
933 const double half_width = 0.5 * (q2_u - q2_l);
934
935 for (size_t i = 0; i < GL24_X.size(); ++i) {
936 const double q2 = center + half_width * GL24_X[i];
937 const auto vals = eval_integrands(q2, bar);
938 for (size_t k = 0; k < acc.size(); ++k) {
939 acc[k] += GL24_W[i] * vals[k];
940 }
941 }
942
943 for (double& v : acc) {
944 v *= half_width;
945 }
946
947 return acc;
948 };
949
950 const auto& bins = this->bins.value();
951 const size_t nbins = bins.size();
952
953 clear_and_reserve(cache.J_i_binned, nbins);
954 clear_and_reserve(cache.J_i_bar_binned, nbins);
955
956 auto fill_binned = [&] (std::array<std::vector<double>, 15>& dest, bool bar) {
957 for (const auto& [q2_l, q2_u] : bins) {
958 const auto integ = integrate_bin(q2_l, q2_u, bar);
959 for (size_t k = 0; k < dest.size(); ++k) {
960 dest[k].emplace_back(integ[k]);
961 }
962 }
963 };
964
965 fill_binned(cache.J_i_binned, false);
966 fill_binned(cache.J_i_bar_binned, true);
967}
968
969std::vector<ObservableValue> BKstarllDecay::dBR_dq2_binned(bool bar, Observables id, bool br) {
970 (void)bar;
971
972 std::vector<ObservableValue> out;
973 const auto& bins = this->bins.value();
974 const double br_factor = br ? cache.life_B : 1.0;
975
976 for (size_t i = 0; i < bins.size(); i++) {
977 const auto& [q2_l, q2_u] = bins[i];
978 const double width = q2_u - q2_l;
979
980 if (!std::isfinite(width) || width <= 0.0) {
981 LOG_WARN("BKstarll dBR/dq2: invalid bin width", q2_l, q2_u);
982 out.emplace_back(ObservableMapper::to_id(id),
983 std::numeric_limits<double>::quiet_NaN(),
984 bins[i]);
985 continue;
986 }
987
988 const double gamma_integrated_sum =
989 0.75 * (
990 cache.J_i_binned[0][i] + cache.J_i_bar_binned[0][i]
991 - (
992 2.0 * (cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i])
993 + cache.J_i_binned[2][i] + cache.J_i_bar_binned[2][i]
994 ) / 3.0
995 );
996
997 const double res = 0.5 * gamma_integrated_sum * br_factor / width;
998 out.emplace_back(ObservableMapper::to_id(id), res, bins[i]);
999 }
1000
1001 return out;
1002}
1003
1005 return 0.75 * (cache.J_i_binned[0][bin] + cache.J_i_bar_binned[0][bin] - (2 * (cache.J_i_binned[1][bin] + cache.J_i_bar_binned[1][bin]) + cache.J_i_binned[2][bin] + cache.J_i_bar_binned[2][bin]) / 3.);
1006}
1007
1008std::vector<ObservableValue> BKstarllDecay::A_FB_binned(Observables id, bool cpv) {
1009 std::vector<ObservableValue> out;
1010 double sign = cpv ? -1 : 1;
1011 for (size_t i = 0; i < this->bins.value().size(); i++) {
1012 double J6 = 2 * cache.J_i_binned[7][i] + sign * cache.J_i_binned[9][i];
1013 double J6bar = 2 * cache.J_i_bar_binned[7][i] + sign * cache.J_i_bar_binned[9][i];
1014 double res = -0.375 * (J6 + J6bar) / dG_dq2_avg_bin(i);
1015 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1016 }
1017 return out;
1018}
1019
1021 auto f = [this] (double q2) {
1022 return 2 * (J6s(q2, true) + J6s(q2, false)) + J6c(q2, true) + J6c(q2, false);
1023 };
1024
1025 double q2a, q2b;
1026 bool found_bracket = find_bracket(f, 1.01 * cache.q2_min, 0.99 * cache.q2_max, q2a, q2b);
1027 if (!found_bracket) {
1028 LOG_WARN("Forwards-Backwards asymmetry in B > K*ll doesn't cross 0.");
1030 }
1031
1032 return ObservableValue(ObservableMapper::to_id(id), brent_root(f, q2a, q2b));
1033}
1034
1035std::vector<ObservableValue> BKstarllDecay::A_CP_binned(Observables id) {
1036 std::vector<ObservableValue> out;
1037 for (size_t i = 0; i < this->bins.value().size(); i++) {
1038 double dG = cache.J_i_binned[0][i] - (2 * cache.J_i_binned[1][i] + cache.J_i_binned[2][i]) / 3.;
1039 double dGbar = cache.J_i_bar_binned[0][i] - (2 * cache.J_i_bar_binned[1][i] + cache.J_i_bar_binned[2][i]) / 3.;
1040 double res = (dG - dGbar) / (dG + dGbar);
1041 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1042 }
1043 return out;
1044}
1045
1046std::vector<ObservableValue> BKstarllDecay::F_L_binned(Observables id) {
1047 std::vector<ObservableValue> out;
1048
1049 for (size_t i = 0; i < this->bins.value().size(); i++) {
1050 const double num =
1051 0.75 * (cache.J_i_binned[14][i] + cache.J_i_bar_binned[14][i])
1052 - 0.25 * (cache.J_i_binned[2][i] + cache.J_i_bar_binned[2][i]);
1053
1054 const double den = dG_dq2_avg_bin(i);
1055
1056 const double res = safe_div(num, den, "BKstarll F_L");
1057
1058 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1059 }
1060
1061 return out;
1062}
1063
1064std::vector<ObservableValue> BKstarllDecay::F_T_binned(Observables id) {
1065 std::vector<ObservableValue> out;
1066 for (size_t i = 0; i < this->bins.value().size(); i++) {
1067 double res = 4.0 * (cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i]) / dG_dq2_avg_bin(i);
1068 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1069 }
1070 return out;
1071}
1072
1073std::vector<ObservableValue> BKstarllDecay::A_T_1_binned(Observables id) {
1074 auto num_f = [this] (double q2) {
1075 double AperpApar = std::real(A_par(q2, 1, false) * std::conj(A_perp(q2, 1, false)) + A_par(q2, -1, false) * std::conj(A_perp(q2, -1, false)));
1076 double AperpApar_bar = std::real(A_par(q2, 1, true) * std::conj(A_perp(q2, 1, true)) + A_par(q2, -1, true) * std::conj(A_perp(q2, -1, true)));
1077 return std::pow(beta_l(q2), 2) * std::real(AperpApar + AperpApar_bar);
1078 };
1079
1080 std::vector<ObservableValue> out;
1081 for (size_t i = 0; i < this->bins.value().size(); i++) {
1082 double J2scpa = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1083 double num = integrate(num_f, this->bins.value()[i].first, this->bins.value()[i].second, 1e-2);
1084 double res = -0.5 * num / J2scpa;
1085 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1086 }
1087 return out;
1088}
1089
1090std::vector<ObservableValue> BKstarllDecay::A_T_2_binned(Observables id) {
1091 std::vector<ObservableValue> out;
1092
1093 for (size_t i = 0; i < this->bins.value().size(); i++) {
1094 const double num = 0.5 * (cache.J_i_binned[3][i] + cache.J_i_bar_binned[3][i]);
1095 const double den = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1096
1097 const double res = safe_div(num, den, "BKstarll A_T_2");
1098
1099 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1100 }
1101
1102 return out;
1103}
1104
1105std::vector<ObservableValue> BKstarllDecay::A_T_3_binned(Observables id) {
1106 std::vector<ObservableValue> out;
1107 for (size_t i = 0; i < this->bins.value().size(); i++) {
1108 double J2scp = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1109 double J2ccp = cache.J_i_binned[2][i] + cache.J_i_bar_binned[2][i];
1110 double J3cp = cache.J_i_binned[3][i] + cache.J_i_bar_binned[3][i];
1111 double J4cp = cache.J_i_binned[4][i] + cache.J_i_bar_binned[4][i];
1112 double J7cp = cache.J_i_binned[11][i] + cache.J_i_bar_binned[11][i];
1113 double res = std::sqrt((4 * J4cp * J4cp + J7cp * J7cp) / std::abs(-2 * J2ccp * (2 * J2scp + J3cp)));
1114 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1115 }
1116 return out;
1117}
1118
1119std::vector<ObservableValue> BKstarllDecay::A_T_4_binned(Observables id) {
1120 std::vector<ObservableValue> out;
1121 for (size_t i = 0; i < this->bins.value().size(); i++) {
1122 double J4cp = cache.J_i_binned[4][i] + cache.J_i_bar_binned[4][i];
1123 double J5cp = cache.J_i_binned[6][i] + cache.J_i_bar_binned[6][i];
1124 double J7cp = cache.J_i_binned[11][i] + cache.J_i_bar_binned[11][i];
1125 double J8cp = cache.J_i_binned[12][i] + cache.J_i_bar_binned[12][i];
1126 double res = std::sqrt((J5cp * J5cp + 4 * J8cp * J8cp) / (J7cp * J7cp + 4 * J4cp * J4cp));
1127 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1128 }
1129 return out;
1130}
1131
1132std::vector<ObservableValue> BKstarllDecay::A_T_5_binned(Observables id) {
1133 auto num_f = [this] (double q2) {
1134 complex_t AperpApar = A_par(q2, 1, false) * std::conj(A_perp(q2, -1, false)) + A_perp(q2, 1, false) * std::conj(A_par(q2, -1, false));
1135 complex_t AperpApar_bar = A_par(q2, 1, true) * std::conj(A_perp(q2, -1, true)) + A_perp(q2, 1, true) * std::conj(A_par(q2, -1, true));
1136 return std::abs(AperpApar + AperpApar_bar);
1137 };
1138
1139 auto den_f = [this] (double q2) {
1140 double Aperp2Apar2 = (std::pow(std::abs(A_perp(q2, -1, false)), 2) + std::pow(std::abs(A_perp(q2, 1, false)), 2) + std::pow(std::abs(A_par(q2, -1, false)), 2) + std::pow(std::abs(A_par(q2, 1, false)), 2));
1141 double Aperp2Apar2bar = (std::pow(std::abs(A_perp(q2, -1, true)), 2) + std::pow(std::abs(A_perp(q2, 1, true)), 2) + std::pow(std::abs(A_par(q2, -1, true)), 2) + std::pow(std::abs(A_par(q2, 1, true)), 2));
1142 return Aperp2Apar2 + Aperp2Apar2bar;
1143 };
1144
1145 std::vector<ObservableValue> out;
1146 for (size_t i = 0; i < this->bins.value().size(); i++) {
1147 double num = integrate(num_f, this->bins.value()[i].first, this->bins.value()[i].second, 1e-2);
1148 double den = integrate(den_f, this->bins.value()[i].first, this->bins.value()[i].second, 1e-2);
1149 double res = num / den;
1150 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1151 }
1152 return out;
1153}
1154
1155std::vector<ObservableValue> BKstarllDecay::A_T_Re_binned(Observables id) {
1156 std::vector<ObservableValue> out;
1157
1158 for (size_t i = 0; i < this->bins.value().size(); i++) {
1159 const double num = 0.25 * (cache.J_i_binned[8][i] + cache.J_i_bar_binned[8][i]);
1160 const double den = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1161
1162 const double res = safe_div(num, den, "BKstarll A_T_Re");
1163
1164 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1165 }
1166
1167 return out;
1168}
1169
1170std::vector<ObservableValue> BKstarllDecay::A_T_Re_CPV_binned(Observables id) {
1171 std::vector<ObservableValue> out;
1172 for (size_t i = 0; i < this->bins.value().size(); i++) {
1173 double J2scp = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1174 double J6scpa = cache.J_i_binned[8][i] - cache.J_i_bar_binned[8][i];
1175 double res = 0.25 * J6scpa / J2scp;
1176 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1177 }
1178 return out;
1179}
1180
1181std::vector<ObservableValue> BKstarllDecay::A_Im_binned(Observables id) {
1182 std::vector<ObservableValue> out;
1183 for (size_t i = 0; i < this->bins.value().size(); i++) {
1184 double res = (cache.J_i_binned[13][i] + cache.J_i_bar_binned[13][i]) / dG_dq2_avg_bin(i);
1185 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1186 }
1187 return out;
1188}
1189
1190std::vector<ObservableValue> BKstarllDecay::alpha_K_binned(Observables id) {
1191 std::vector<ObservableValue> out;
1192 for (size_t i = 0; i < this->bins.value().size(); i++) {
1193 double J2scp = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1194 double J2ccp = cache.J_i_binned[2][i] + cache.J_i_bar_binned[2][i];
1195 double res = -0.5 * (2 * J2scp + J2ccp) / J2scp;
1196 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1197 }
1198 return out;
1199}
1200
1201std::vector<ObservableValue> BKstarllDecay::H_T_1_binned(Observables id) {
1202 std::vector<ObservableValue> out;
1203 for (size_t i = 0; i < this->bins.value().size(); i++) {
1204 double J2scp = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1205 double J2ccp = cache.J_i_binned[2][i] + cache.J_i_bar_binned[2][i];
1206 double J3cp = cache.J_i_binned[3][i] + cache.J_i_bar_binned[3][i];
1207 double J4cp = cache.J_i_binned[4][i] + cache.J_i_bar_binned[4][i];
1208 double res = RT2 * J4cp / std::sqrt(std::abs(J2ccp * (J2scp - J3cp)));
1209 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1210 }
1211 return out;
1212}
1213
1214std::vector<ObservableValue> BKstarllDecay::H_T_2_binned(Observables id) {
1215 std::vector<ObservableValue> out;
1216 for (size_t i = 0; i < this->bins.value().size(); i++) {
1217 double J2scp = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1218 double J2ccp = cache.J_i_binned[2][i] + cache.J_i_bar_binned[2][i];
1219 double J3cp = cache.J_i_binned[3][i] + cache.J_i_bar_binned[3][i];
1220 double J5cp = cache.J_i_binned[6][i] + cache.J_i_bar_binned[6][i];
1221 double res = J5cp / std::sqrt(std::abs(2 * J2ccp * (2 * J2scp + J3cp)));
1222 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1223 }
1224 return out;
1225}
1226
1227std::vector<ObservableValue> BKstarllDecay::H_T_3_binned(Observables id) {
1228 std::vector<ObservableValue> out;
1229 for (size_t i = 0; i < this->bins.value().size(); i++) {
1230 double J2scp = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1231 double J3cp = cache.J_i_binned[3][i] + cache.J_i_bar_binned[3][i];
1232 double J6cp = (2 * (cache.J_i_binned[7][i] + cache.J_i_bar_binned[7][i]) + cache.J_i_binned[9][i] + cache.J_i_bar_binned[9][i]);
1233 double res = 0.5 * J6cp / std::sqrt(std::abs(4 * J2scp * J2scp - J3cp * J3cp));
1234 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1235 }
1236 return out;
1237}
1238
1239std::vector<ObservableValue> BKstarllDecay::P_2_binned(Observables id) {
1240 std::vector<ObservableValue> out;
1241 for (size_t i = 0; i < this->bins.value().size(); i++) {
1242 double J2scp = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1243 double J6scp = cache.J_i_binned[7][i] + cache.J_i_bar_binned[7][i];
1244 double res = 0.125 * J6scp / J2scp;
1245 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1246 }
1247 return out;
1248}
1249
1250std::vector<ObservableValue> BKstarllDecay::P_3_binned(Observables id) {
1251 std::vector<ObservableValue> out;
1252 for (size_t i = 0; i < this->bins.value().size(); i++) {
1253 double J2scp = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1254 double J9cp = cache.J_i_binned[13][i] + cache.J_i_bar_binned[13][i];
1255 double res = -0.25 * J9cp / J2scp;
1256 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1257 }
1258 return out;
1259}
1260
1261std::vector<ObservableValue> BKstarllDecay::P_6_binned(Observables id) {
1262 std::vector<ObservableValue> out;
1263 for (size_t i = 0; i < this->bins.value().size(); i++) {
1264 double J2scp = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1265 double J2ccp = cache.J_i_binned[2][i] + cache.J_i_bar_binned[2][i];
1266 double J3cp = cache.J_i_binned[3][i] + cache.J_i_bar_binned[3][i];
1267 double J7cp = cache.J_i_binned[11][i] + cache.J_i_bar_binned[11][i];
1268 double res = -J7cp / std::sqrt(std::abs(2 * J2ccp * (2 * J2scp - J3cp)));
1269 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1270 }
1271 return out;
1272}
1273
1274std::vector<ObservableValue> BKstarllDecay::P_8_binned(Observables id) {
1275 std::vector<ObservableValue> out;
1276 for (size_t i = 0; i < this->bins.value().size(); i++) {
1277 double J2scp = cache.J_i_binned[1][i] + cache.J_i_bar_binned[1][i];
1278 double J2ccp = cache.J_i_binned[2][i] + cache.J_i_bar_binned[2][i];
1279 double J3cp = cache.J_i_binned[3][i] + cache.J_i_bar_binned[3][i];
1280 double J8cp = cache.J_i_binned[12][i] + cache.J_i_bar_binned[12][i];
1281 double res = -RT2 * J8cp / std::sqrt(std::abs(J2ccp * (2 * J2scp - J3cp)));
1282 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[i]);
1283 }
1284 return out;
1285}
1286
1287std::vector<ObservableValue> BKstarllDecay::Pp_i_binned(size_t i, bool cpv, Observables id) {
1288 if (!(i == 4 || i == 5 || i == 6 || i == 8)) LOG_ERROR("Value Error", "P'_i(B > K*ll) is not defined for i =", i);
1289
1290 std::map<size_t, double> factors = {{4, 1.0}, {5, 0.5}, {6, -0.5}, {8, -1.0}};
1291 std::map<size_t, size_t> J_idx = {{4, 4}, {5, 5}, {6, 10}, {8, 12}};
1292 double sign = cpv ? -1 : 1;
1293
1294 std::vector<ObservableValue> out;
1295 for (size_t j = 0; j < this->bins.value().size(); j++) {
1296 double J2scp = cache.J_i_binned[1][j] + cache.J_i_bar_binned[1][j];
1297 double J2ccp = cache.J_i_binned[2][j] + cache.J_i_bar_binned[2][j];
1298 double Jicp = cache.J_i_binned[J_idx[i]][j] + sign * cache.J_i_bar_binned[J_idx[i]][j];
1299 double res = factors[i] * Jicp / std::sqrt(std::abs(J2ccp * J2scp));
1300 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[j]);
1301 }
1302 return out;
1303}
1304
1305std::vector<ObservableValue> BKstarllDecay::S_i_binned(size_t i, bool cpv, Observables id) {
1306 if (i > 10) LOG_ERROR("Value Error", "S_i(B > K*ll) is not defined for i =", i);
1307
1308 // 0: S1c, 1: S2s, 2: S2c
1309 std::map<size_t, size_t> J_idx = {{0, 14}, {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 7}, {7, 10}, {8, 12}, {9, 13}, {10, 9}};
1310 double sign = cpv ? -1 : 1;
1311 double global_sign = i == 10 || i == 2 && cpv ? -1 : 1;
1312
1313 std::vector<ObservableValue> out;
1314 for (size_t j = 0; j < this->bins.value().size(); j++) {
1315 double res = global_sign * (cache.J_i_binned[J_idx[i]][j] + sign * cache.J_i_bar_binned[J_idx[i]][j]) / dG_dq2_avg_bin(j);
1316 out.emplace_back(ObservableMapper::to_id(id), i == 6 ? -res : res, this->bins.value()[j]);
1317 }
1318 return out;
1319}
1320
1321std::vector<ObservableValue> BKstarllDecay::P_i_CPV_binned(size_t i, Observables id) {
1322 if (i < 1 || i > 3) LOG_ERROR("Value Error", "P_i_CPV(B > K*ll) is not defined for i =", i);
1323
1324 std::map<size_t, double> factors = {{1, 0.5}, {2, 0.125}, {3, -0.25}};
1325 std::map<size_t, size_t> J_idx = {{1, 3}, {2, 7}, {3, 13}};
1326
1327 std::vector<ObservableValue> out;
1328 for (size_t j = 0; j < this->bins.value().size(); j++) {
1329 double J2scp = cache.J_i_binned[1][j] + cache.J_i_bar_binned[1][j];
1330 double Jicpv = cache.J_i_binned[J_idx[i]][j] - cache.J_i_bar_binned[J_idx[i]][j];
1331 double res = factors[i] * Jicpv / J2scp;
1332 out.emplace_back(ObservableMapper::to_id(id), res, this->bins.value()[j]);
1333 }
1334 return out;
1335}
1336
1338 std::ofstream fs;
1339 fs.open("B_Ksll_FF.csv");
1340 fs << "q2,A0,A1,A12,V,T1,T2,T23\n";
1341
1342 auto write_line = [&] (double q2) {
1343 fs << q2 << ","
1344 << cache.ff_calculator.get(BV_FF::A0, q2) << ","
1345 << cache.ff_calculator.get(BV_FF::A1, q2) << ","
1346 << cache.ff_calculator.get(BV_FF::A12, q2) << ","
1347 << cache.ff_calculator.get(BV_FF::V, q2) << ","
1348 << cache.ff_calculator.get(BV_FF::T1, q2) << ","
1349 << cache.ff_calculator.get(BV_FF::T2, q2) << ","
1350 << cache.ff_calculator.get(BV_FF::T23, q2)
1351 << "\n";
1352 };
1353
1354 double q2_min = 4 * std::pow(0.1057, 2);
1355 double q2_max = 19.2542;
1356 size_t n = 200;
1357 double dq2 = (q2_max - q2_min) / n;
1358 double q2 = q2_min;
1359 for (size_t i = 0; i <= n; i++) {
1360 write_line(q2);
1361 q2 += dq2;
1362 }
1363}
1364
1366 std::ofstream fs;
1367 fs.open("B_Ksll_T.csv");
1368 fs << "q2,T_perp_p_re,T_perp_p_im,T_perp_m_re,T_perp_m_im,T_par_p_re,T_par_p_im,T_par_m_re,T_par_m_im\n";
1369
1370 auto write_line = [&] (double q2) {
1371 fs << q2
1372 << "," << std::real(T_perp_p_cached(q2, false)) << "," << std::imag(T_perp_p_cached(q2, false))
1373 << "," << std::real(T_perp_m_cached(q2, false)) << "," << std::imag(T_perp_m_cached(q2, false))
1374 << "," << std::real(T_par_m_cached(q2, false)) << "," << std::imag(T_par_m_cached(q2, false))
1375 << "\n";
1376 };
1377
1378 size_t n = 200;
1379 double dq2 = (cache.q2_high - cache.q2_min) / n;
1380 double q2 = cache.q2_min;
1381 for (size_t i = 0; i <= n; i++) {
1382 write_line(q2);
1383 q2 += dq2;
1384 }
1385}
1386
1388 std::ofstream fs;
1389 fs.open("B_Ksll_J.csv");
1390 fs << "q2,J1s,J1c,J2s,J2c,J3,J4,J5,J6s,J6c,J7,J8,J9,J1sbar,J1cbar,J2sbar,J2cbar,J3bar,J4bar,J5bar,J6sbar,J6cbar,J7bar,J8bar,J9bar\n";
1391
1392 auto write_line = [&] (double q2) {
1393 fs << q2
1394 << "," << J1s(q2, false)
1395 << "," << J1c(q2, false)
1396 << "," << J2s(q2, false)
1397 << "," << J2c(q2, false)
1398 << "," << J3(q2, false)
1399 << "," << J4(q2, false)
1400 << "," << J5(q2, false)
1401 << "," << J6s(q2, false)
1402 << "," << J6c(q2, false)
1403 << "," << J7(q2, false)
1404 << "," << J8(q2, false)
1405 << "," << J9(q2, false)
1406 << "," << J1s(q2, true)
1407 << "," << J1c(q2, true)
1408 << "," << J2s(q2, true)
1409 << "," << J2c(q2, true)
1410 << "," << J3(q2, true)
1411 << "," << J4(q2, true)
1412 << "," << J5(q2, true)
1413 << "," << J6s(q2, true)
1414 << "," << J6c(q2, true)
1415 << "," << J7(q2, true)
1416 << "," << J8(q2, true)
1417 << "," << J9(q2, true)
1418 << "\n";
1419 };
1420
1421 size_t n = 200;
1422 double dq2 = (cache.q2_max - cache.q2_min) / n;
1423 double q2 = cache.q2_min;
1424
1425 for (size_t i = 0; i <= n; i++) {
1426 write_line(q2);
1427 q2 += dq2;
1428 }
1429}
1430
1431std::vector<ObservableValue> BKstarllDecay::Rm1_BKstar(
1432 Observables id,
1434) {
1435 std::vector<ObservableValue> out;
1436 std::vector<double> Gamma_mu;
1437 std::vector<double> Gamma_e;
1438
1440
1441 for (size_t i = 0; i < this->bins.value().size(); i++) {
1442 Gamma_mu.emplace_back(dG_dq2_avg_bin(i));
1443 }
1444
1446
1447 for (size_t i = 0; i < this->bins.value().size(); i++) {
1448 Gamma_e.emplace_back(dG_dq2_avg_bin(i));
1449 }
1450
1451 for (size_t i = 0; i < this->bins.value().size(); i++) {
1452 out.emplace_back(
1454 Gamma_mu[i] / Gamma_e[i] - 1.0,
1455 this->bins.value()[i]
1456 );
1457 }
1458
1459 return out;
1460}
1461
1462
1463std::vector<ObservableValue> BKstarllDecay::compute_observable(Observables obs) {
1464 switch (obs) {
1467 return dBR_dq2_binned(false, obs, true);
1470 return dBR_dq2_binned(false, obs, false);
1473 return A_FB_binned(obs, false);
1476 return A_FB_binned(obs, true);
1479 return {q0(obs)};
1482 return A_CP_binned(obs);
1485 return F_L_binned(obs);
1488 return F_T_binned(obs);
1491 return A_T_1_binned(obs);
1494 return A_T_2_binned(obs);
1497 return A_T_3_binned(obs);
1500 return A_T_4_binned(obs);
1503 return A_T_5_binned(obs);
1506 return A_T_Re_binned(obs);
1509 return A_T_Re_CPV_binned(obs);
1512 return A_Im_binned(obs);
1515 return alpha_K_binned(obs);
1518 return H_T_1_binned(obs);
1521 return H_T_2_binned(obs);
1524 return H_T_3_binned(obs);
1527 return A_T_2_binned(obs);
1530 return P_2_binned(obs);
1533 return P_3_binned(obs);
1536 return H_T_1_binned(obs);
1539 return H_T_2_binned(obs);
1542 return P_6_binned(obs);
1545 return P_8_binned(obs);
1548 return Pp_i_binned(4, false, obs);
1551 return Pp_i_binned(5, false, obs);
1554 return Pp_i_binned(6, false, obs);
1557 return Pp_i_binned(8, false, obs);
1560 return S_i_binned(0, false, obs);
1563 return S_i_binned(1, false, obs);
1566 return S_i_binned(2, false, obs);
1569 return S_i_binned(3, false, obs);
1572 return S_i_binned(4, false, obs);
1575 return S_i_binned(5, false, obs);
1578 return S_i_binned(10, false, obs);
1581 return S_i_binned(7, false, obs);
1584 return S_i_binned(8, false, obs);
1587 return S_i_binned(9, false, obs);
1590 return S_i_binned(0, true, obs);
1593 return S_i_binned(1, true, obs);
1596 return S_i_binned(2, true, obs);
1599 return S_i_binned(3, true, obs);
1602 return S_i_binned(4, true, obs);
1605 return S_i_binned(5, true, obs);
1608 return S_i_binned(6, true, obs);
1611 return S_i_binned(10, true, obs);
1614 return S_i_binned(7, true, obs);
1617 return S_i_binned(8, true, obs);
1620 return S_i_binned(9, true, obs);
1623 return P_i_CPV_binned(1, obs);
1626 return P_i_CPV_binned(2, obs);
1629 return P_i_CPV_binned(3, obs);
1632 return Pp_i_binned(4, true, obs);
1635 return Pp_i_binned(5, true, obs);
1638 return Pp_i_binned(6, true, obs);
1641 return Pp_i_binned(8, true, obs);
1644 return dBR_dq2_binned(false, obs);
1647 return dBR_dq2_binned(false, obs, false);
1650 return A_FB_binned(obs, false);
1653 return A_FB_binned(obs, true);
1656 return {q0(obs)};
1659 return A_CP_binned(obs);
1662 return F_L_binned(obs);
1665 return F_T_binned(obs);
1668 return A_T_1_binned(obs);
1671 return A_T_2_binned(obs);
1674 return A_T_3_binned(obs);
1677 return A_T_4_binned(obs);
1680 return A_T_5_binned(obs);
1683 return A_T_Re_binned(obs);
1686 return A_T_Re_CPV_binned(obs);
1689 return A_Im_binned(obs);
1692 return alpha_K_binned(obs);
1695 return H_T_1_binned(obs);
1698 return H_T_2_binned(obs);
1701 return H_T_3_binned(obs);
1704 return A_T_2_binned(obs);
1707 return P_2_binned(obs);
1710 return P_3_binned(obs);
1713 return H_T_1_binned(obs);
1716 return H_T_2_binned(obs);
1719 return P_6_binned(obs);
1722 return P_8_binned(obs);
1725 return Pp_i_binned(4, false, obs);
1728 return Pp_i_binned(5, false, obs);
1731 return Pp_i_binned(6, false, obs);
1733 // LOG_INFO("Computing P'8(B > K* mu mu)");
1735 return Pp_i_binned(8, false, obs);
1738 return S_i_binned(0, false, obs);
1741 return S_i_binned(1, false, obs);
1744 return S_i_binned(2, false, obs);
1747 return S_i_binned(3, false, obs);
1750 return S_i_binned(4, false, obs);
1753 return S_i_binned(5, false, obs);
1756 return S_i_binned(10, false, obs);
1759 return S_i_binned(7, false, obs);
1762 return S_i_binned(8, false, obs);
1765 return S_i_binned(9, false, obs);
1768 return S_i_binned(0, true, obs);
1771 return S_i_binned(1, true, obs);
1774 return S_i_binned(2, true, obs);
1777 return S_i_binned(3, true, obs);
1780 return S_i_binned(4, true, obs);
1783 return S_i_binned(5, true, obs);
1786 return S_i_binned(6, true, obs);
1789 return S_i_binned(10, true, obs);
1792 return S_i_binned(7, true, obs);
1795 return S_i_binned(8, true, obs);
1798 return S_i_binned(9, true, obs);
1801 return P_i_CPV_binned(1, obs);
1804 return P_i_CPV_binned(2, obs);
1807 return P_i_CPV_binned(3, obs);
1810 return Pp_i_binned(4, true, obs);
1813 return Pp_i_binned(5, true, obs);
1816 return Pp_i_binned(6, true, obs);
1819 return Pp_i_binned(8, true, obs);
1822 return dBR_dq2_binned(false, obs);
1825 return dBR_dq2_binned(false, obs, false);
1828 return A_FB_binned(obs, false);
1831 return A_FB_binned(obs, true);
1834 return {q0(obs)};
1837 return A_CP_binned(obs);
1840 return F_L_binned(obs);
1843 return F_T_binned(obs);
1846 return A_T_1_binned(obs);
1849 return A_T_2_binned(obs);
1852 return A_T_3_binned(obs);
1855 return A_T_4_binned(obs);
1858 return A_T_5_binned(obs);
1861 return A_T_Re_binned(obs);
1864 return A_T_Re_CPV_binned(obs);
1867 return A_Im_binned(obs);
1870 return alpha_K_binned(obs);
1873 return H_T_1_binned(obs);
1876 return H_T_2_binned(obs);
1879 return H_T_3_binned(obs);
1882 return A_T_2_binned(obs);
1885 return P_2_binned(obs);
1888 return P_3_binned(obs);
1891 return H_T_1_binned(obs);
1894 return H_T_2_binned(obs);
1897 return P_6_binned(obs);
1900 return P_8_binned(obs);
1903 return Pp_i_binned(4, false, obs);
1906 return Pp_i_binned(5, false, obs);
1909 return Pp_i_binned(6, false, obs);
1912 return Pp_i_binned(8, false, obs);
1915 return S_i_binned(0, false, obs);
1918 return S_i_binned(1, false, obs);
1921 return S_i_binned(2, false, obs);
1924 return S_i_binned(3, false, obs);
1927 return S_i_binned(4, false, obs);
1930 return S_i_binned(5, false, obs);
1933 return S_i_binned(10, false, obs);
1936 return S_i_binned(7, false, obs);
1939 return S_i_binned(8, false, obs);
1942 return S_i_binned(9, false, obs);
1945 return S_i_binned(0, true, obs);
1948 return S_i_binned(1, true, obs);
1951 return S_i_binned(2, true, obs);
1954 return S_i_binned(3, true, obs);
1957 return S_i_binned(4, true, obs);
1960 return S_i_binned(5, true, obs);
1963 return S_i_binned(6, true, obs);
1966 return S_i_binned(10, true, obs);
1969 return S_i_binned(7, true, obs);
1972 return S_i_binned(8, true, obs);
1975 return S_i_binned(9, true, obs);
1978 return P_i_CPV_binned(1, obs);
1981 return P_i_CPV_binned(2, obs);
1984 return P_i_CPV_binned(3, obs);
1987 return Pp_i_binned(4, true, obs);
1990 return Pp_i_binned(5, true, obs);
1993 return Pp_i_binned(6, true, obs);
1996 return Pp_i_binned(8, true, obs);
1999 return dBR_dq2_binned(false, obs);
2002 return dBR_dq2_binned(false, obs, false);
2005 return A_FB_binned(obs, false);
2008 return A_FB_binned(obs, true);
2011 return {q0(obs)};
2014 return A_CP_binned(obs);
2017 return F_L_binned(obs);
2020 return F_T_binned(obs);
2023 return A_T_1_binned(obs);
2026 return A_T_2_binned(obs);
2029 return A_T_3_binned(obs);
2032 return A_T_4_binned(obs);
2035 return A_T_5_binned(obs);
2038 return A_T_Re_binned(obs);
2041 return A_T_Re_CPV_binned(obs);
2044 return A_Im_binned(obs);
2047 return alpha_K_binned(obs);
2050 return H_T_1_binned(obs);
2053 return H_T_2_binned(obs);
2056 return H_T_3_binned(obs);
2059 return A_T_2_binned(obs);
2062 return P_2_binned(obs);
2065 return P_3_binned(obs);
2068 return H_T_1_binned(obs);
2071 return H_T_2_binned(obs);
2074 return P_6_binned(obs);
2077 return P_8_binned(obs);
2080 return Pp_i_binned(4, false, obs);
2083 return Pp_i_binned(5, false, obs);
2086 return Pp_i_binned(6, false, obs);
2089 return Pp_i_binned(8, false, obs);
2092 return S_i_binned(0, false, obs);
2095 return S_i_binned(1, false, obs);
2098 return S_i_binned(2, false, obs);
2101 return S_i_binned(3, false, obs);
2104 return S_i_binned(4, false, obs);
2107 return S_i_binned(5, false, obs);
2110 return S_i_binned(10, false, obs);
2113 return S_i_binned(7, false, obs);
2116 return S_i_binned(8, false, obs);
2119 return S_i_binned(9, false, obs);
2122 return S_i_binned(0, true, obs);
2125 return S_i_binned(1, true, obs);
2128 return S_i_binned(2, true, obs);
2131 return S_i_binned(3, true, obs);
2134 return S_i_binned(4, true, obs);
2137 return S_i_binned(5, true, obs);
2140 return S_i_binned(6, true, obs);
2143 return S_i_binned(10, true, obs);
2146 return S_i_binned(7, true, obs);
2149 return S_i_binned(8, true, obs);
2152 return S_i_binned(9, true, obs);
2155 return P_i_CPV_binned(1, obs);
2158 return P_i_CPV_binned(2, obs);
2161 return P_i_CPV_binned(3, obs);
2164 return Pp_i_binned(4, true, obs);
2167 return Pp_i_binned(5, true, obs);
2170 return Pp_i_binned(6, true, obs);
2173 return Pp_i_binned(8, true, obs);
2176 return dBR_dq2_binned(false, obs);
2179 return dBR_dq2_binned(false, obs, false);
2182 return A_FB_binned(obs, false);
2185 return A_FB_binned(obs, true);
2188 return {q0(obs)};
2191 return A_CP_binned(obs);
2194 return F_L_binned(obs);
2197 return F_T_binned(obs);
2200 return A_T_1_binned(obs);
2203 return A_T_2_binned(obs);
2206 return A_T_3_binned(obs);
2209 return A_T_4_binned(obs);
2212 return A_T_5_binned(obs);
2215 return A_T_Re_binned(obs);
2218 return A_T_Re_CPV_binned(obs);
2221 return A_Im_binned(obs);
2224 return alpha_K_binned(obs);
2227 return H_T_1_binned(obs);
2230 return H_T_2_binned(obs);
2233 return H_T_3_binned(obs);
2236 return A_T_2_binned(obs);
2239 return P_2_binned(obs);
2242 return P_3_binned(obs);
2245 return H_T_1_binned(obs);
2248 return H_T_2_binned(obs);
2251 return P_6_binned(obs);
2254 return P_8_binned(obs);
2257 return Pp_i_binned(4, false, obs);
2260 return Pp_i_binned(5, false, obs);
2263 return Pp_i_binned(6, false, obs);
2265 // LOG_INFO("Computing P'8(B0 > K*0 mu mu)");
2267 return Pp_i_binned(8, false, obs);
2270 return S_i_binned(0, false, obs);
2273 return S_i_binned(1, false, obs);
2276 return S_i_binned(2, false, obs);
2279 return S_i_binned(3, false, obs);
2282 return S_i_binned(4, false, obs);
2285 return S_i_binned(5, false, obs);
2288 return S_i_binned(10, false, obs);
2291 return S_i_binned(7, false, obs);
2294 return S_i_binned(8, false, obs);
2297 return S_i_binned(9, false, obs);
2300 return S_i_binned(0, true, obs);
2303 return S_i_binned(1, true, obs);
2306 return S_i_binned(2, true, obs);
2309 return S_i_binned(3, true, obs);
2312 return S_i_binned(4, true, obs);
2315 return S_i_binned(5, true, obs);
2318 return S_i_binned(6, true, obs);
2321 return S_i_binned(10, true, obs);
2324 return S_i_binned(7, true, obs);
2327 return S_i_binned(8, true, obs);
2330 return S_i_binned(9, true, obs);
2333 return P_i_CPV_binned(1, obs);
2336 return P_i_CPV_binned(2, obs);
2339 return P_i_CPV_binned(3, obs);
2342 return Pp_i_binned(4, true, obs);
2345 return Pp_i_binned(5, true, obs);
2348 return Pp_i_binned(6, true, obs);
2351 return Pp_i_binned(8, true, obs);
2354 return dBR_dq2_binned(false, obs);
2357 return dBR_dq2_binned(false, obs, false);
2360 return A_FB_binned(obs, false);
2363 return A_FB_binned(obs, true);
2366 return {q0(obs)};
2369 return A_CP_binned(obs);
2372 return F_L_binned(obs);
2375 return F_T_binned(obs);
2378 return A_T_1_binned(obs);
2381 return A_T_2_binned(obs);
2384 return A_T_3_binned(obs);
2387 return A_T_4_binned(obs);
2390 return A_T_5_binned(obs);
2393 return A_T_Re_binned(obs);
2396 return A_T_Re_CPV_binned(obs);
2399 return A_Im_binned(obs);
2402 return alpha_K_binned(obs);
2405 return H_T_1_binned(obs);
2408 return H_T_2_binned(obs);
2411 return H_T_3_binned(obs);
2414 return A_T_2_binned(obs);
2417 return P_2_binned(obs);
2420 return P_3_binned(obs);
2423 return H_T_1_binned(obs);
2426 return H_T_2_binned(obs);
2429 return P_6_binned(obs);
2432 return P_8_binned(obs);
2435 return Pp_i_binned(4, false, obs);
2438 return Pp_i_binned(5, false, obs);
2441 return Pp_i_binned(6, false, obs);
2444 return Pp_i_binned(8, false, obs);
2447 return S_i_binned(0, false, obs);
2450 return S_i_binned(1, false, obs);
2453 return S_i_binned(2, false, obs);
2456 return S_i_binned(3, false, obs);
2459 return S_i_binned(4, false, obs);
2462 return S_i_binned(5, false, obs);
2465 return S_i_binned(10, false, obs);
2468 return S_i_binned(7, false, obs);
2471 return S_i_binned(8, false, obs);
2474 return S_i_binned(9, false, obs);
2477 return S_i_binned(0, true, obs);
2480 return S_i_binned(1, true, obs);
2483 return S_i_binned(2, true, obs);
2486 return S_i_binned(3, true, obs);
2489 return S_i_binned(4, true, obs);
2492 return S_i_binned(5, true, obs);
2495 return S_i_binned(6, true, obs);
2498 return S_i_binned(10, true, obs);
2501 return S_i_binned(7, true, obs);
2504 return S_i_binned(8, true, obs);
2507 return S_i_binned(9, true, obs);
2510 return P_i_CPV_binned(1, obs);
2513 return P_i_CPV_binned(2, obs);
2516 return P_i_CPV_binned(3, obs);
2519 return Pp_i_binned(4, true, obs);
2522 return Pp_i_binned(5, true, obs);
2525 return Pp_i_binned(6, true, obs);
2528 return Pp_i_binned(8, true, obs);
2531
2534 default:
2535 LOG_ERROR("IndexError", "Observable", ObservableMapper::str(obs), "doesn't belong to the decay", DecayMapper::str(this->id));
2536 }
2537}
2538
2539std::vector<ObservableValue> BKstarllDecay::compute_observable(ObservableId obs) {
2540 return compute_observable(ObservableMapper::enum_of(obs).value());
2541}
2542
2544 const auto enum_obs = ObservableMapper::enum_of(obs);
2545 if (!enum_obs.has_value()) {
2546 return true;
2547 }
2548
2549 switch (enum_obs.value()) {
2556 return false;
2557 default:
2558 return true;
2559 }
2560}
2561
2562void BKstarllDecay::set_n_threads(size_t n_threads) {
2563 unsigned int available_threads = std::thread::hardware_concurrency();
2564
2565 if (available_threads == 0) {
2566 available_threads = 1;
2567 }
2568
2569 if (n_threads == 0) {
2570 this->cfg.n_threads = available_threads;
2571 return;
2572 }
2573
2574 if (n_threads > available_threads) {
2575 LOG_WARN(
2576 "Requested", n_threads,
2577 "threads, but only", available_threads,
2578 "are available. Using", available_threads,
2579 "threads instead."
2580 );
2581
2582 this->cfg.n_threads = available_threads;
2583 return;
2584 }
2585
2586 this->cfg.n_threads = std::max<size_t>(1, n_threads);
2587}
Observables
Definition GeneralEnum.h:4
@ S_7_B0__KSTAR0_MU_MU
@ A_T_RE_CPV_B__KSTAR_MU_MU
@ A_FL_B0__KSTAR0_TAU_TAU
@ A_T_1_B0__KSTAR0_TAU_TAU
@ P_3_CPV_B0__KSTAR0_E_E
@ A_9_B0__KSTAR0_MU_MU
@ DBR_DQ2_B0__KSTAR0_E_E
@ P_5_B0__KSTAR0_TAU_TAU
@ A_T_5_B__KSTAR_TAU_TAU
@ A_T_1_B__KSTAR_TAU_TAU
@ H_T_1_B0__KSTAR0_TAU_TAU
@ S_5_B__KSTAR_TAU_TAU
@ S_9_B0__KSTAR0_MU_MU
@ A_CP_B0__KSTAR0_MU_MU
@ A_T_3_B0__KSTAR0_MU_MU
@ A_7_B0__KSTAR0_TAU_TAU
@ P_PRIME_8_CPV_B__KSTAR_MU_MU
@ A_CP_B__KSTAR_TAU_TAU
@ P_2_CPV_B0__KSTAR0_TAU_TAU
@ S_5_B0__KSTAR0_MU_MU
@ Q0_A_FB_B__KSTAR_TAU_TAU
@ P_8_B0__KSTAR0_TAU_TAU
@ P_3_CPV_B__KSTAR_E_E
@ P_PRIME_8_CPV_B__KSTAR_E_E
@ Q0_A_FB_B0__KSTAR0_TAU_TAU
@ P_PRIME_8_B__KSTAR_MU_MU
@ A_T_1_B0__KSTAR0_MU_MU
@ A_2S_B0__KSTAR0_TAU_TAU
@ Q0_A_FB_B0__KSTAR0_E_E
@ P_4_B__KSTAR_TAU_TAU
@ S_8_B0__KSTAR0_TAU_TAU
@ P_PRIME_4_CPV_B0__KSTAR0_MU_MU
@ A_T_2_B__KSTAR_TAU_TAU
@ P_1_CPV_B0__KSTAR0_TAU_TAU
@ A_T_RE_B0__KSTAR0_E_E
@ P_PRIME_4_CPV_B0__KSTAR0_TAU_TAU
@ P_5_B0__KSTAR0_MU_MU
@ A_T_1_B0__KSTAR0_E_E
@ A_CP_B0__KSTAR0_TAU_TAU
@ S_3_B__KSTAR_TAU_TAU
@ DGAMMA_DQ2_B0__KSTAR0_E_E
@ A_T_4_B0__KSTAR0_E_E
@ S_2S_B0__KSTAR0_TAU_TAU
@ P_2_CPV_B0__KSTAR0_MU_MU
@ A_3_B0__KSTAR0_TAU_TAU
@ DBR_DQ2_B0__KSTAR0_MU_MU
@ A_FB_B0__KSTAR0_MU_MU
@ P_PRIME_4_CPV_B__KSTAR_TAU_TAU
@ P_2_CPV_B0__KSTAR0_E_E
@ F_T_B__KSTAR_TAU_TAU
@ S_4_B__KSTAR_TAU_TAU
@ A_T_RE_B__KSTAR_TAU_TAU
@ P_PRIME_5_B__KSTAR_E_E
@ A_5_B0__KSTAR0_TAU_TAU
@ A_1C_B0__KSTAR0_MU_MU
@ A_T_3_B0__KSTAR0_E_E
@ H_T_1_B__KSTAR_MU_MU
@ A_T_3_B0__KSTAR0_TAU_TAU
@ P_2_B0__KSTAR0_MU_MU
@ S_6C_B0__KSTAR0_MU_MU
@ A_6S_B0__KSTAR0_MU_MU
@ A_FB_CPV_B0__KSTAR0_TAU_TAU
@ P_PRIME_5_B0__KSTAR0_E_E
@ DGAMMA_DQ2_B__KSTAR_MU_MU
@ P_6_B0__KSTAR0_TAU_TAU
@ P_PRIME_4_CPV_B0__KSTAR0_E_E
@ S_2C_B0__KSTAR0_MU_MU
@ P_PRIME_8_CPV_B0__KSTAR0_TAU_TAU
@ DGAMMA_DQ2_B__KSTAR_E_E
@ A_T_RE_B0__KSTAR0_TAU_TAU
@ S_6C_B0__KSTAR0_TAU_TAU
@ A_FB_CPV_B0__KSTAR0_E_E
@ A_T_4_B0__KSTAR0_MU_MU
@ P_PRIME_6_CPV_B0__KSTAR0_E_E
@ Q0_A_FB_B0__KSTAR0_MU_MU
@ S_9_B__KSTAR_TAU_TAU
@ A_2S_B__KSTAR_TAU_TAU
@ ALPHA_K_B0__KSTAR0_MU_MU
@ DBR_DQ2_B0__KSTAR0_TAU_TAU
@ ALPHA_K_B__KSTAR_TAU_TAU
@ P_8_B0__KSTAR0_MU_MU
@ A_T_RE_B0__KSTAR0_MU_MU
@ A_T_RE_CPV_B__KSTAR_E_E
@ A_T_5_B__KSTAR_MU_MU
@ H_T_3_B0__KSTAR0_MU_MU
@ P_PRIME_8_CPV_B0__KSTAR0_MU_MU
@ A_4_B0__KSTAR0_MU_MU
@ P_1_B0__KSTAR0_TAU_TAU
@ H_T_2_B__KSTAR_TAU_TAU
@ A_T_RE_CPV_B0__KSTAR0_E_E
@ P_PRIME_8_B0__KSTAR0_TAU_TAU
@ A_T_RE_CPV_B0__KSTAR0_TAU_TAU
@ S_1C_B__KSTAR_TAU_TAU
@ A_7_B0__KSTAR0_MU_MU
@ P_PRIME_6_CPV_B0__KSTAR0_TAU_TAU
@ P_PRIME_5_CPV_B__KSTAR_E_E
@ P_PRIME_8_B__KSTAR_E_E
@ A_FL_B__KSTAR_TAU_TAU
@ P_2_CPV_B__KSTAR_TAU_TAU
@ P_PRIME_8_B0__KSTAR0_MU_MU
@ A_8_B0__KSTAR0_TAU_TAU
@ A_T_2_B0__KSTAR0_TAU_TAU
@ S_9_B0__KSTAR0_TAU_TAU
@ DBR_DQ2_B__KSTAR_TAU_TAU
@ P_4_B0__KSTAR0_TAU_TAU
@ S_1C_B0__KSTAR0_TAU_TAU
@ P_1_CPV_B0__KSTAR0_E_E
@ A_6C_B__KSTAR_TAU_TAU
@ S_2S_B__KSTAR_TAU_TAU
@ P_2_CPV_B__KSTAR_E_E
@ S_7_B0__KSTAR0_TAU_TAU
@ A_T_5_B0__KSTAR0_E_E
@ A_FB_CPV_B__KSTAR_TAU_TAU
@ H_T_3_B0__KSTAR0_E_E
@ S_3_B0__KSTAR0_TAU_TAU
@ A_6C_B0__KSTAR0_TAU_TAU
@ P_6_B0__KSTAR0_MU_MU
@ Q0_A_FB_B__KSTAR_MU_MU
@ P_PRIME_4_B0__KSTAR0_E_E
@ A_4_B0__KSTAR0_TAU_TAU
@ ALPHA_K_B__KSTAR_E_E
@ P_1_CPV_B__KSTAR_TAU_TAU
@ A_1C_B0__KSTAR0_TAU_TAU
@ A_8_B0__KSTAR0_MU_MU
@ S_7_B__KSTAR_TAU_TAU
@ H_T_1_B__KSTAR_TAU_TAU
@ A_T_5_B0__KSTAR0_MU_MU
@ P_PRIME_5_B0__KSTAR0_TAU_TAU
@ A_T_4_B__KSTAR_MU_MU
@ A_8_B__KSTAR_TAU_TAU
@ P_2_B0__KSTAR0_TAU_TAU
@ A_6C_B0__KSTAR0_MU_MU
@ ALPHA_K_B0__KSTAR0_E_E
@ A_T_2_B0__KSTAR0_MU_MU
@ DBR_DQ2_B__KSTAR_MU_MU
@ P_PRIME_4_B__KSTAR_E_E
@ S_8_B0__KSTAR0_MU_MU
@ P_PRIME_4_CPV_B__KSTAR_MU_MU
@ P_2_B__KSTAR_TAU_TAU
@ A_IM_B0__KSTAR0_MU_MU
@ H_T_3_B0__KSTAR0_TAU_TAU
@ P_PRIME_6_CPV_B0__KSTAR0_MU_MU
@ H_T_2_B0__KSTAR0_E_E
@ P_PRIME_5_B0__KSTAR0_MU_MU
@ DGAMMA_DQ2_B__KSTAR_TAU_TAU
@ A_3_B0__KSTAR0_MU_MU
@ A_FB_B__KSTAR_TAU_TAU
@ P_PRIME_5_CPV_B0__KSTAR0_E_E
@ A_T_2_B__KSTAR_MU_MU
@ A_T_2_B0__KSTAR0_E_E
@ A_T_5_B0__KSTAR0_TAU_TAU
@ A_6S_B0__KSTAR0_TAU_TAU
@ P_PRIME_5_B__KSTAR_TAU_TAU
@ A_2S_B0__KSTAR0_MU_MU
@ P_PRIME_4_B0__KSTAR0_TAU_TAU
@ A_7_B__KSTAR_TAU_TAU
@ P_8_B__KSTAR_TAU_TAU
@ F_L_B__KSTAR_TAU_TAU
@ P_PRIME_5_CPV_B0__KSTAR0_TAU_TAU
@ A_FB_B0__KSTAR0_TAU_TAU
@ H_T_2_B0__KSTAR0_MU_MU
@ P_PRIME_4_B__KSTAR_TAU_TAU
@ A_IM_B__KSTAR_TAU_TAU
@ S_1C_B0__KSTAR0_MU_MU
@ S_4_B0__KSTAR0_MU_MU
@ P_PRIME_8_CPV_B0__KSTAR0_E_E
@ A_FB_CPV_B__KSTAR_E_E
@ P_1_B__KSTAR_TAU_TAU
@ DGAMMA_DQ2_B0__KSTAR0_MU_MU
@ S_2C_B0__KSTAR0_TAU_TAU
@ P_3_CPV_B__KSTAR_TAU_TAU
@ P_1_CPV_B0__KSTAR0_MU_MU
@ F_L_B0__KSTAR0_MU_MU
@ P_PRIME_8_B__KSTAR_TAU_TAU
@ P_PRIME_8_CPV_B__KSTAR_TAU_TAU
@ H_T_1_B0__KSTAR0_E_E
@ P_3_B0__KSTAR0_TAU_TAU
@ S_2C_B__KSTAR_TAU_TAU
@ P_3_CPV_B__KSTAR_MU_MU
@ S_8_B__KSTAR_TAU_TAU
@ A_T_4_B__KSTAR_TAU_TAU
@ A_1C_B__KSTAR_TAU_TAU
@ P_1_CPV_B__KSTAR_MU_MU
@ S_5_B0__KSTAR0_TAU_TAU
@ P_PRIME_6_B__KSTAR_MU_MU
@ P_6_B__KSTAR_TAU_TAU
@ A_T_RE_B__KSTAR_MU_MU
@ P_1_B0__KSTAR0_MU_MU
@ P_PRIME_8_B0__KSTAR0_E_E
@ H_T_3_B__KSTAR_TAU_TAU
@ H_T_2_B0__KSTAR0_TAU_TAU
@ S_3_B0__KSTAR0_MU_MU
@ S_2S_B0__KSTAR0_MU_MU
@ P_3_B0__KSTAR0_MU_MU
@ S_6C_B__KSTAR_TAU_TAU
@ A_T_RE_CPV_B0__KSTAR0_MU_MU
@ P_PRIME_6_B0__KSTAR0_E_E
@ A_9_B0__KSTAR0_TAU_TAU
@ P_PRIME_4_B__KSTAR_MU_MU
@ A_T_RE_CPV_B__KSTAR_TAU_TAU
@ F_T_B0__KSTAR0_MU_MU
@ P_PRIME_5_CPV_B__KSTAR_TAU_TAU
@ A_T_3_B__KSTAR_TAU_TAU
@ S_4_B0__KSTAR0_TAU_TAU
@ P_4_B0__KSTAR0_MU_MU
@ A_3_B__KSTAR_TAU_TAU
@ P_PRIME_4_B0__KSTAR0_MU_MU
@ A_IM_B0__KSTAR0_TAU_TAU
@ H_T_2_B__KSTAR_MU_MU
@ P_5_B__KSTAR_TAU_TAU
@ P_PRIME_6_B__KSTAR_TAU_TAU
@ A_4_B__KSTAR_TAU_TAU
@ F_L_B0__KSTAR0_TAU_TAU
@ ALPHA_K_B0__KSTAR0_TAU_TAU
@ A_FB_CPV_B0__KSTAR0_MU_MU
@ ALPHA_K_B__KSTAR_MU_MU
@ Q0_A_FB_B__KSTAR_E_E
@ A_5_B0__KSTAR0_MU_MU
@ P_2_CPV_B__KSTAR_MU_MU
@ P_PRIME_5_CPV_B__KSTAR_MU_MU
@ A_FB_CPV_B__KSTAR_MU_MU
@ A_9_B__KSTAR_TAU_TAU
@ P_3_B__KSTAR_TAU_TAU
@ P_1_CPV_B__KSTAR_E_E
@ P_PRIME_6_B0__KSTAR0_TAU_TAU
@ A_6S_B__KSTAR_TAU_TAU
@ P_PRIME_6_CPV_B__KSTAR_E_E
@ A_T_4_B0__KSTAR0_TAU_TAU
@ DBR_DQ2_B__KSTAR_E_E
@ P_PRIME_6_CPV_B__KSTAR_TAU_TAU
@ P_3_CPV_B0__KSTAR0_TAU_TAU
@ DGAMMA_DQ2_B0__KSTAR0_TAU_TAU
@ P_PRIME_6_B__KSTAR_E_E
@ A_5_B__KSTAR_TAU_TAU
@ F_T_B0__KSTAR0_TAU_TAU
@ P_PRIME_6_B0__KSTAR0_MU_MU
@ A_T_1_B__KSTAR_MU_MU
@ P_PRIME_4_CPV_B__KSTAR_E_E
@ A_FL_B0__KSTAR0_MU_MU
@ H_T_1_B0__KSTAR0_MU_MU
@ H_T_3_B__KSTAR_MU_MU
@ P_PRIME_6_CPV_B__KSTAR_MU_MU
@ P_3_CPV_B0__KSTAR0_MU_MU
@ P_PRIME_5_CPV_B0__KSTAR0_MU_MU
@ P_PRIME_5_B__KSTAR_MU_MU
@ A_T_3_B__KSTAR_MU_MU
#define LOG_ERROR(type,...)
Macro for logging error messages and terminating the application.
Definition Logger.h:41
#define LOG_WARN(...)
Macro for logging warning messages.
Definition Logger.h:40
void fill_cache(Func &&f, double a, double b, std::array< T, cache_size > &cache, Args &&... args)
Fills a lookup cache for a function on a finite interval [a, b].
Definition Utils.h:241
std::complex< double > complex_t
Convenience alias for std::complex<double>.
Definition Utils.h:35
T lerp(U x, const std::array< T, cache_size > &lookup, double a=0.0, double b=1.0)
Linearly interpolates a cached function on [a, b].
Definition Utils.h:276
complex_t delta_A_0_K(double q2, bool bar)
complex_t A_S(double q2, bool bar)
std::vector< ObservableValue > P_3_binned(Observables id)
std::vector< ObservableValue > S_i_binned(size_t i, bool cpv, Observables id)
double J2s(double q2, bool bar)
complex_t A_perp_low(double q2, double sign, bool bar)
double J2c(double q2, bool bar)
std::vector< ObservableValue > P_6_binned(Observables id)
complex_t A_t_high(double q2, bool bar)
std::vector< ObservableValue > H_T_2_binned(Observables id)
complex_t delta_A_perp_QCDf(double q2, double sign, bool bar)
complex_t T_par_m_cached(double q2, bool bar)
complex_t delta_A_0_QCDf(double q2, double sign, bool bar)
void fill_wilson_cache()
complex_t delta_A_0(double q2, double sign, bool bar)
double lambda(double q2)
std::vector< ObservableValue > Rm1_BKstar(Observables id, BKstarllConfig::B_Charge charge)
complex_t delta_A_par_vD(double q2, bool bar)
std::vector< ObservableValue > H_T_3_binned(Observables id)
double J7(double q2, bool bar)
void set_lepton_gen_and_charge(BKstarllConfig::Lepton gen, BKstarllConfig::B_Charge charge)
double J3(double q2, bool bar)
double J1c(double q2, bool bar)
complex_t A_perp(double q2, double sign, bool bar)
std::vector< ObservableValue > A_T_2_binned(Observables id)
std::vector< ObservableValue > P_8_binned(Observables id)
std::vector< ObservableValue > P_i_CPV_binned(size_t i, Observables id)
complex_t A_0(double q2, double sign, bool bar)
complex_t N(double q2, bool bar)
std::vector< ObservableValue > A_T_Re_CPV_binned(Observables id)
complex_t delta_A_perp(double q2, double sign, bool bar)
complex_t A_0_low(double q2, double sign, bool bar)
std::vector< ObservableValue > A_T_3_binned(Observables id)
std::vector< ObservableValue > A_T_1_binned(Observables id)
complex_t delta_A_perp_vD(double q2, bool bar)
std::vector< ObservableValue > compute_observable(Observables obs) override
Compute an observable given a public observable enum.
std::vector< ObservableValue > A_T_4_binned(Observables id)
std::vector< ObservableValue > alpha_K_binned(Observables id)
complex_t A_perp_high(double q2, double sign, bool bar)
std::vector< ObservableValue > dBR_dq2_binned(bool bar, Observables id, bool br=true)
complex_t delta_A_par(double q2, double sign, bool bar)
double J6s(double q2, bool bar)
std::vector< ObservableValue > A_CP_binned(Observables id)
std::vector< ObservableValue > Pp_i_binned(size_t i, bool cpv, Observables id)
std::vector< ObservableValue > A_Im_binned(Observables id)
complex_t A_par_high(double q2, double sign, bool bar)
bool is_observable_binned(ObservableId obs) const override
Return whether one observable of this decay requires q² bins.
complex_t delta_A_0_vD(double q2, bool bar)
void compute_binned_J_i()
double dG_dq2_avg_bin(size_t bin)
std::vector< ObservableValue > H_T_1_binned(Observables id)
double beta_l(double q2)
std::vector< ObservableValue > F_L_binned(Observables id)
complex_t C7_eff(double q2, bool bar)
double J8(double q2, bool bar)
complex_t A_par(double q2, double sign, bool bar)
complex_t delta_A_par_K(double q2, bool bar)
double J5(double q2, bool bar)
complex_t A_S_low(double q2, bool bar)
std::vector< ObservableValue > A_T_Re_binned(Observables id)
void set_n_threads(size_t n_threads) override
Set the number of worker threads used by decays that support parallel cache filling.
complex_t T_perp_p_cached(double q2, bool bar)
std::vector< ObservableValue > F_T_binned(Observables id)
double J4(double q2, bool bar)
complex_t A_0_high(double q2, double sign, bool bar)
complex_t T_perp_m_cached(double q2, bool bar)
double J9(double q2, bool bar)
std::vector< ObservableValue > A_T_5_binned(Observables id)
complex_t A_S_high(double q2, bool bar)
complex_t delta_A_par_QCDf(double q2, double sign, bool bar)
void load_cfg_dependent_params()
ObservableValue q0(Observables id)
double J6c(double q2, bool bar)
complex_t A_t(double q2, bool bar)
complex_t delta_A_perp_K(double q2, bool bar)
complex_t C9_eff(double q2, bool bar)
std::vector< ObservableValue > A_FB_binned(Observables id, bool cpv)
complex_t interpolate(double q2, complex_t val_low, complex_t val_high)
std::vector< ObservableValue > P_2_binned(Observables id)
complex_t A_par_low(double q2, double sign, bool bar)
complex_t A_t_low(double q2, bool bar)
double J1s(double q2, bool bar)
void load_params() override
Load and cache parameters needed by this decay.
double get(BV_FF a, double q2) override
complex_t z(double t, double t_p, double t_0)
double E(double q2)
complex_t T_par_m(double q2, bool bar)
complex_t T_perp_m(double q2, bool bar)
complex_t T_perp_p(double q2, bool bar)
complex_t Delta_par(double q2)
complex_t Y(double q2)
Definition BWilson.h:149
Definition BWilson.h:99
Definition BWilson.h:133
DecayId id
Unique decay identifier.
WilsonBuildConfig w_config
Wilson build configuration used when enabling this decay (scales, order, groups).
std::optional< std::vector< std::pair< double, double > > > bins
Optional q^2 bins.
std::shared_ptr< IObsParameterProxy< ParamId, DataType, std::string, LhaID > > p
Parameter proxy for SM-like quantities used by the decay (may be SM/BSM depending on wiring).
std::shared_ptr< IObsWilsonProxy > w_proxy
Wilson proxy used at compute-time to query coefficients (matching/run).
Definition DecayParent.h:99
std::shared_ptr< IObsQCDProxy > iobs_qcdp
QCD proxy (alpha_s, running masses, constants...).
static std::optional< Observables > enum_of(const IdOf< ObservableTag > &id)
Attempts to recover the enum value associated with an identifier.
static IdOf< ObservableTag > to_id(Observables e)
Converts an enum value to an IdOf<Tag>.
static std::string str(const IdOf< ObservableTag > &id)
Returns the string representation of an identifier.
static WCoef cpq1_for_lepton_index(int lepton_index)
static WCoef cq1_for_lepton_index(int lepton_index)
static WCoef cq2_for_lepton_index(int lepton_index)
static WCoef cpq2_for_lepton_index(int lepton_index)
constexpr double PI
Definition constants.h:7
constexpr double HBAR
Definition constants.h:23
constexpr std::complex< double > I
Definition constants.h:20
constexpr double PI2
Definition constants.h:8
constexpr double RT2
Definition constants.h:15
double integrate(RealValuedFunction f, double l, double u, double prec)
Performs numerical integration of a real-valued function of a real variable.
complex_t h(double s, double m_q, double mu_b)
complex_t B_Seidel(double s_hat, double L_b)
complex_t C_Seidel(double s, double mu_b)
complex_t f_87(double s_hat, double L_b)
complex_t A_Seidel(double s_hat, double L_b)
complex_t f_89(double s_hat)
bool find_bracket(const RealValuedFunction &f, double x_min, double x_max, double &a, double &b, int n_samples)
double brent_root(const RealValuedFunction &f, double a, double b, double xtol, double ftol, int max_it)
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.
double f(double x)
Wilson special function f depending on x.
Configuration for evaluating the strong coupling constant .
Definition Configs.h:206
std::array< complex_t, 8 > phi_k_high
Definition BKsllDecay.h:59
double z_psi2S_nf
Definition BKsllDecay.h:63
std::array< double, 3 > r2_M
Definition BKsllDecay.h:72
double alpha_s_mu_b
Definition BKsllDecay.h:37
double m_c_mu_b
Definition BKsllDecay.h:35
double life_B
Definition BKsllDecay.h:39
std::array< scalar_t, LOOKUP_SIZE > T_perp_p_lookup
Definition BKsllDecay.h:76
std::array< double, 3 > DeltaC9_M_qbar
Definition BKsllDecay.h:70
complex_t lambda_hat_u
Definition BKsllDecay.h:40
double q2_bar
Definition BKsllDecay.h:69
std::array< double, 3 > r1_M
Definition BKsllDecay.h:71
BVFFCalculator ff_calculator
Definition BKsllDecay.h:30
std::array< complex_t, 6 > b_k_low
Definition BKsllDecay.h:55
std::array< complex_t, 6 > theta_k_low
Definition BKsllDecay.h:58
std::array< std::vector< double >, 15 > J_i_binned
Definition BKsllDecay.h:83
std::array< scalar_t, LOOKUP_SIZE > T_par_m_lookup
Definition BKsllDecay.h:78
double Delta_M
Definition BKsllDecay.h:36
double alpha_em
Definition BKsllDecay.h:33
std::array< complex_t, 3 > h_0_fit
Definition BKsllDecay.h:51
std::array< complex_t, 3 > h_p_fit
Definition BKsllDecay.h:49
complex_t N_0
Definition BKsllDecay.h:42
std::array< scalar_t, LOOKUP_SIZE > T_par_m_bar_lookup
Definition BKsllDecay.h:81
std::array< complex_t, 8 > a_k_high
Definition BKsllDecay.h:56
std::array< complex_t, 3 > alpha_par
Definition BKsllDecay.h:65
std::map< WCoef, complex_t > C
Definition BKsllDecay.h:29
double q2_min
Definition BKsllDecay.h:43
double m_b_mb
Definition BKsllDecay.h:35
std::array< scalar_t, LOOKUP_SIZE > T_perp_m_lookup
Definition BKsllDecay.h:77
std::array< complex_t, 2 > alpha_0
Definition BKsllDecay.h:66
double q2_low
Definition BKsllDecay.h:44
BVQCDfCalculator qcdf_calculator
Definition BKsllDecay.h:31
double m_b_mu_b
Definition BKsllDecay.h:35
double q2_high
Definition BKsllDecay.h:44
std::array< scalar_t, LOOKUP_SIZE > T_perp_p_bar_lookup
Definition BKsllDecay.h:79
double q2_max
Definition BKsllDecay.h:43
std::array< complex_t, 6 > phi_k_low
Definition BKsllDecay.h:57
std::array< complex_t, 6 > a_k_low
Definition BKsllDecay.h:54
double z_Jpsi_nf
Definition BKsllDecay.h:63
std::array< complex_t, 3 > h_m_fit
Definition BKsllDecay.h:50
double m_b_PS
Definition BKsllDecay.h:35
std::array< complex_t, 3 > alpha_perp
Definition BKsllDecay.h:64
static constexpr size_t LOOKUP_SIZE
Definition BKsllDecay.h:75
double q2_Jpsi
Definition BKsllDecay.h:69
std::array< std::vector< double >, 15 > J_i_bar_binned
Definition BKsllDecay.h:84
std::array< scalar_t, LOOKUP_SIZE > T_perp_m_bar_lookup
Definition BKsllDecay.h:80
double q2_lookup_min
Definition BKsllDecay.h:46
size_t n_threads
Definition BKsllDecay.h:25
BV_FF_Src ff_src
Definition BKsllDecay.h:19
Power_Corrections_Impl power_corr_impl
Definition BKsllDecay.h:21
B_FF_Type ff_type
Definition BKsllDecay.h:20
B_Charge charge
Definition BKsllDecay.h:22
Configuration for computing a particle mass at a given scale.
Definition Configs.h:242
Container for a computed observable value, optionally binned.
Composite identifier for a single parameter.
Definition ParamID.h:57
QCDOrder order
Perturbative QCD order used for the evolution and matching of Wilson coefficients....
Definition Configs.h:54