14 #include <gsl/gsl_integration.h>
17 #include <TFitResultPtr.h>
18 #include <gsl/gsl_spline.h>
22 #define NFPOLARBASIS_MVLL true
23 #define COMPUTECP false
24 #define GSL_INTERP_DIM 10
25 #define GSL_INTERP_DIM_DC 10
27 #define FULLNLOQCDF_MVll false
374 double beta (
double q2);
384 return (2. *
MM *
sqrt(q2))/
sqrt(lambda(q2)) * V_0t(q2);
416 return twoMM3/
sqrt(q2 * lambda(q2)) * T_0t(q2);
449 return S_L_pre/
sqrt(lambda(q2)) * S_L(q2);
558 return (
getQCDf_1(cutoff) * cutoff).abs();
564 return (
getQCDf_2(cutoff) * cutoff).abs();
570 return (
getQCDf_3(cutoff) * cutoff).abs();
581 return C2_inv * (gtilde_1_pre/(
sqrt(lambda(q2)) * V(q2)) * (
h_lambda(2,q2)-
h_lambda(1,q2))).real()/q2;
592 return C2_inv * (gtilde_1_pre/(
sqrt(lambda(q2)) * V(q2)) * (
h_lambda(2,q2)-
h_lambda(1,q2))).imag()/q2;
603 return C2_inv * (gtilde_2_pre/A_1(q2) * (
h_lambda(1,q2)+
h_lambda(2,q2))).real()/q2;
614 return C2_inv * (gtilde_2_pre/A_1(q2) * (
h_lambda(1,q2)+
h_lambda(2,q2))).imag()/q2;
625 return C2_inv * (gtilde_3_pre/(lambda(q2) * A_2(q2)) * (
sqrt(q2)*
h_lambda(0,q2)/q2-
637 return C2_inv * (gtilde_3_pre/(lambda(q2) * A_2(q2)) * (
sqrt(q2)*
h_lambda(0,q2)/q2-
648 return (sixteenM_PI2MM2 *
h_lambda(0,q2)/q2).real();
658 return (sixteenM_PI2MM2 *
h_lambda(0,q2)/q2).imag();
677 return (sixteenM_PI2MM2 *
h_lambda(1,q2)/q2).real();
687 return (sixteenM_PI2MM2 *
h_lambda(1,q2)/q2).imag();
706 return (sixteenM_PI2MM2 *
h_lambda(2,q2)/q2).real();
716 return (sixteenM_PI2MM2 *
h_lambda(2,q2)/q2).imag();
799 double ninetysixM_PI3MM3;
802 double sixteenM_PI2MM2;
916 std::vector<double> Re_T_perp;
917 std::vector<double> Im_T_perp;
918 std::vector<double> Re_T_para;
919 std::vector<double> Im_T_para;
921 gsl_interp_accel *acc_Re_T_perp;
922 gsl_interp_accel *acc_Im_T_perp;
923 gsl_interp_accel *acc_Re_T_para;
924 gsl_interp_accel *acc_Im_T_para;
926 gsl_spline *spline_Re_T_perp;
927 gsl_spline *spline_Im_T_perp;
928 gsl_spline *spline_Re_T_para;
929 gsl_spline *spline_Im_T_para;
931 gsl_interp_accel *acc_Re_deltaC7_QCDF;
932 gsl_interp_accel *acc_Im_deltaC7_QCDF;
933 gsl_interp_accel *acc_Re_deltaC9_QCDF;
934 gsl_interp_accel *acc_Im_deltaC9_QCDF;
936 gsl_spline *spline_Re_deltaC7_QCDF;
937 gsl_spline *spline_Im_deltaC7_QCDF;
938 gsl_spline *spline_Re_deltaC9_QCDF;
939 gsl_spline *spline_Im_deltaC9_QCDF;
942 std::vector<double> Re_T_perp_conj;
943 std::vector<double> Im_T_perp_conj;
944 std::vector<double> Re_T_para_conj;
945 std::vector<double> Im_T_para_conj;
947 gsl_interp_accel *acc_Re_T_perp_conj;
948 gsl_interp_accel *acc_Im_T_perp_conj;
949 gsl_interp_accel *acc_Re_T_para_conj;
950 gsl_interp_accel *acc_Im_T_para_conj;
952 gsl_interp_accel *acc_Re_deltaC7_QCDF_conj;
953 gsl_interp_accel *acc_Im_deltaC7_QCDF_conj;
954 gsl_interp_accel *acc_Re_deltaC9_QCDF_conj;
955 gsl_interp_accel *acc_Im_deltaC9_QCDF_conj;
957 gsl_spline *spline_Re_T_perp_conj;
958 gsl_spline *spline_Im_T_perp_conj;
959 gsl_spline *spline_Re_T_para_conj;
960 gsl_spline *spline_Im_T_para_conj;
962 gsl_spline *spline_Re_deltaC7_QCDF_conj;
963 gsl_spline *spline_Im_deltaC7_QCDF_conj;
964 gsl_spline *spline_Re_deltaC9_QCDF_conj;
965 gsl_spline *spline_Im_deltaC9_QCDF_conj;
968 std::vector<double> myq2;
970 TFitResultPtr Re_T_perp_res;
971 TFitResultPtr Im_T_perp_res;
972 TFitResultPtr Re_T_para_res;
973 TFitResultPtr Im_T_para_res;
975 TFitResultPtr Re_T_perp_res_conj;
976 TFitResultPtr Im_T_perp_res_conj;
977 TFitResultPtr Re_T_para_res_conj;
978 TFitResultPtr Im_T_para_res_conj;
997 gsl_integration_cquad_workspace * w_sigma;
998 gsl_integration_cquad_workspace * w_delta;
1000 gsl_error_handler_t * old_handler;
1004 std::map<std::pair<double, double>,
double > cacheSigma0;
1005 std::map<std::pair<double, double>,
double > cacheSigma1;
1006 std::map<std::pair<double, double>,
double > cacheSigma2;
1007 std::map<std::pair<double, double>,
double > cacheSigma3;
1008 std::map<std::pair<double, double>,
double > cacheSigma4;
1009 std::map<std::pair<double, double>,
double > cacheSigma5;
1010 std::map<std::pair<double, double>,
double > cacheSigma6;
1011 std::map<std::pair<double, double>,
double > cacheSigma7;
1012 std::map<std::pair<double, double>,
double > cacheSigma9;
1013 std::map<std::pair<double, double>,
double > cacheSigma10;
1014 std::map<std::pair<double, double>,
double > cacheSigma11;
1016 std::map<std::pair<double, double>,
double > cacheDelta0;
1017 std::map<std::pair<double, double>,
double > cacheDelta1;
1018 std::map<std::pair<double, double>,
double > cacheDelta2;
1019 std::map<std::pair<double, double>,
double > cacheDelta3;
1020 std::map<std::pair<double, double>,
double > cacheDelta6;
1021 std::map<std::pair<double, double>,
double > cacheDelta7;
1022 std::map<std::pair<double, double>,
double > cacheDelta8;
1023 std::map<std::pair<double, double>,
double > cacheDelta10;
1024 std::map<std::pair<double, double>,
double > cacheDelta11;
1026 unsigned int N_updated;
1030 unsigned int V_updated;
1033 unsigned int A0_updated;
1036 unsigned int A1_updated;
1039 unsigned int T1_updated;
1042 unsigned int T2_updated;
1045 unsigned int k2_updated;
1048 unsigned int z_updated;
1050 unsigned int lambda_updated;
1052 unsigned int beta_updated;
1055 unsigned int F_updated;
1057 unsigned int VL1_updated;
1058 unsigned int VL2_updated;
1060 unsigned int TL1_updated;
1061 unsigned int TL2_updated;
1063 unsigned int VR1_updated;
1064 unsigned int VR2_updated;
1066 unsigned int TR1_updated;
1067 unsigned int TR2_updated;
1069 unsigned int VL0_updated;
1072 unsigned int TL0_updated;
1075 unsigned int VR0_updated;
1077 unsigned int TR0_updated;
1079 unsigned int Mb_Ms_updated;
1081 unsigned int SL_updated;
1084 unsigned int SR_updated;
1086 unsigned int C_1_updated;
1089 unsigned int C_2_updated;
1092 unsigned int C_3_updated;
1095 unsigned int C_4_updated;
1098 unsigned int C_5_updated;
1101 unsigned int C_6_updated;
1104 unsigned int C_7_updated;
1107 unsigned int C_9_updated;
1110 unsigned int C_10_updated;
1113 unsigned int C_7p_updated;
1116 unsigned int C_9p_updated;
1119 unsigned int C_10p_updated;
1122 unsigned int C_S_updated;
1125 unsigned int C_P_updated;
1128 unsigned int C_Sp_updated;
1131 unsigned int C_Pp_updated;
1134 unsigned int C_2Lh_updated;
1137 unsigned int C_8Lh_updated;
1140 unsigned int Yupdated;
1147 unsigned int h0_updated;
1148 unsigned int h1_updated;
1149 unsigned int h2_updated;
1151 unsigned int H_V0updated;
1154 unsigned int H_V1updated;
1157 unsigned int H_V2updated;
1160 unsigned int H_A0updated;
1161 unsigned int H_A1updated;
1162 unsigned int H_A2updated;
1164 unsigned int H_Supdated;
1167 unsigned int H_Pupdated;
1170 unsigned int I0_updated;
1171 unsigned int I1_updated;
1172 unsigned int I2_updated;
1173 unsigned int I3_updated;
1174 unsigned int I4_updated;
1175 unsigned int I5_updated;
1176 unsigned int I6_updated;
1177 unsigned int I7_updated;
1178 unsigned int I8_updated;
1179 unsigned int I9_updated;
1180 unsigned int I10_updated;
1181 unsigned int I11_updated;
1183 std::map<std::pair<double, double>,
unsigned int > I1Cached;
1185 std::map<std::pair<double, double>,
unsigned int > sigma0Cached;
1186 std::map<std::pair<double, double>,
unsigned int > sigma1Cached;
1187 std::map<std::pair<double, double>,
unsigned int > sigma2Cached;
1188 std::map<std::pair<double, double>,
unsigned int > sigma3Cached;
1189 std::map<std::pair<double, double>,
unsigned int > sigma4Cached;
1190 std::map<std::pair<double, double>,
unsigned int > sigma5Cached;
1191 std::map<std::pair<double, double>,
unsigned int > sigma6Cached;
1192 std::map<std::pair<double, double>,
unsigned int > sigma7Cached;
1193 std::map<std::pair<double, double>,
unsigned int > sigma9Cached;
1194 std::map<std::pair<double, double>,
unsigned int > sigma10Cached;
1195 std::map<std::pair<double, double>,
unsigned int > sigma11Cached;
1197 std::map<std::pair<double, double>,
unsigned int > delta0Cached;
1198 std::map<std::pair<double, double>,
unsigned int > delta1Cached;
1199 std::map<std::pair<double, double>,
unsigned int > delta2Cached;
1200 std::map<std::pair<double, double>,
unsigned int > delta3Cached;
1201 std::map<std::pair<double, double>,
unsigned int > delta6Cached;
1202 std::map<std::pair<double, double>,
unsigned int > delta7Cached;
1203 std::map<std::pair<double, double>,
unsigned int > delta8Cached;
1204 std::map<std::pair<double, double>,
unsigned int > delta10Cached;
1205 std::map<std::pair<double, double>,
unsigned int > delta11Cached;
1207 std::map<double, unsigned int> deltaTparpCached;
1208 std::map<double, unsigned int> deltaTparmCached;
1209 std::map<double, unsigned int> deltaTperpCached;
1211 std::map<double, gslpp::complex> cacheDeltaTparp;
1212 std::map<double, gslpp::complex> cacheDeltaTparm;
1213 std::map<double, gslpp::complex> cacheDeltaTperp;
1215 unsigned int deltaTparpupdated;
1216 unsigned int deltaTparmupdated;
1217 unsigned int deltaTperpupdated;
1219 unsigned int T_updated;
1225 void updateParameters();
1237 double z(
double q2);
1244 double V(
double q2);
1252 double A_0(
double q2);
1260 double A_1(
double q2);
1267 double A_2(
double q2);
1274 double T_1(
double q2);
1282 double T_2(
double q2);
1289 double V_0t(
double q2);
1296 double V_p(
double q2);
1303 double V_m(
double q2);
1310 double T_0t(
double q2);
1317 double T_p(
double q2);
1324 double T_m(
double q2);
1331 double S_L(
double q2);
1365 double k2 (
double q2);
1372 double beta2 (
double q2);
1379 double lambda(
double q2);
1387 double F(
double q2,
double b_i);
1395 double I_1c(
double q2,
bool bar);
1403 double I_1s(
double q2,
bool bar);
1411 double I_2c(
double q2,
bool bar);
1419 double I_2s(
double q2,
bool bar);
1427 double I_3(
double q2,
bool bar);
1435 double I_4(
double q2,
bool bar);
1443 double I_5(
double q2,
bool bar);
1451 double I_6c(
double q2,
bool bar);
1459 double I_6s(
double q2,
bool bar);
1467 double I_7(
double q2,
bool bar);
1475 double I_8(
double q2,
bool bar);
1483 double I_9(
double q2,
bool bar);
1491 double h_1s(
double q2,
bool bar);
1499 double h_1c(
double q2,
bool bar);
1507 double h_2s(
double q2,
bool bar);
1515 double h_2c(
double q2,
bool bar);
1523 double h_3(
double q2,
bool bar);
1531 double h_4(
double q2,
bool bar);
1539 double h_7(
double q2,
bool bar);
1547 double s_5(
double q2,
bool bar);
1555 double s_6s(
double q2,
bool bar);
1563 double s_6c(
double q2,
bool bar);
1571 double s_8(
double q2,
bool bar);
1579 double s_9(
double q2,
bool bar);
1586 double getSigma1c(
double q2)
1590 return (I_1c(q2, 0) + I_1c(q2, 1))/2.;
1593 return (I_1c(q2, 0) + I_1c(q2, 1))/2.;
1596 return (I_1c(q2, 0) + I_1c(q2, 1) -
ys * h_1c(q2, 0) )/2.;
1599 std::stringstream out;
1601 throw std::runtime_error(
"MVll::getSigma1c : vector " + out.str() +
" not implemented");
1610 double getSigma1s(
double q2)
1614 return (I_1s(q2, 0) + I_1s(q2, 1))/2.;
1617 return (I_1s(q2, 0) + I_1s(q2, 1))/2.;
1620 return (I_1s(q2, 0) + I_1s(q2, 1) -
ys * h_1s(q2, 0))/2.;
1623 std::stringstream out;
1625 throw std::runtime_error(
"MVll::getSigma1s : vector " + out.str() +
" not implemented");
1634 double getSigma2c(
double q2)
1638 return (I_2c(q2, 0) + I_2c(q2, 1))/2.;
1641 return (I_2c(q2, 0) + I_2c(q2, 1))/2.;
1644 return (I_2c(q2, 0) + I_2c(q2, 1) -
ys * h_2c(q2, 0))/2.;
1647 std::stringstream out;
1649 throw std::runtime_error(
"MVll::getSigma2c : vector " + out.str() +
" not implemented");
1658 double getSigma2s(
double q2)
1662 return (I_2s(q2, 0) + I_2s(q2, 1))/2.;
1665 return (I_2s(q2, 0) + I_2s(q2, 1))/2.;
1668 return (I_2s(q2, 0) + I_2s(q2, 1) -
ys * h_2s(q2, 0))/2.;
1671 std::stringstream out;
1673 throw std::runtime_error(
"MVll::getSigma2s : vector " + out.str() +
" not implemented");
1682 double getSigma3(
double q2)
1686 return (I_3(q2, 0) + I_3(q2, 1))/2.;
1689 return (I_3(q2, 0) + I_3(q2, 1))/2.;
1692 return (I_3(q2, 0) + I_3(q2, 1) -
ys * h_3(q2, 0))/2.;
1695 std::stringstream out;
1697 throw std::runtime_error(
"MVll::getSigma3 : vector " + out.str() +
" not implemented");
1706 double getSigma4(
double q2)
1710 return (I_4(q2, 0) + I_4(q2, 1))/2.;
1713 return (I_4(q2, 0) + I_4(q2, 1))/2.;
1716 return (I_4(q2, 0) + I_4(q2, 1) -
ys * h_4(q2, 0))/2.;
1719 std::stringstream out;
1721 throw std::runtime_error(
"MVll::getSigma4 : vector " + out.str() +
" not implemented");
1730 double getSigma5(
double q2)
1732 return (I_5(q2, 0) + I_5(q2, 1))/2.;
1740 double getSigma6s(
double q2)
1742 return (I_6s(q2, 0) + I_6s(q2, 1))/2.;
1750 double getSigma6c(
double q2)
1752 return (I_6c(q2, 0) + I_6c(q2, 1))/2.;
1760 double getSigma7(
double q2)
1764 return (I_7(q2, 0) + I_7(q2, 1))/2.;
1767 return (I_7(q2, 0) + I_7(q2, 1))/2.;
1770 return (I_7(q2, 0) + I_7(q2, 1) -
ys * h_7(q2, 0))/2.;
1773 std::stringstream out;
1775 throw std::runtime_error(
"MVll::getSigma7 : vector " + out.str() +
" not implemented");
1784 double getSigma8(
double q2)
1786 return (I_8(q2, 0) + I_8(q2, 1))/2.;
1794 double getSigma9(
double q2)
1796 return (I_9(q2, 0) + I_9(q2, 1))/2.;
1804 double getDelta1c(
double q2)
1806 return (I_1c(q2, 0) - I_1c(q2, 1)) / 2.;
1814 double getDelta1s(
double q2)
1816 return (I_1s(q2, 0) - I_1s(q2, 1)) / 2.;
1824 double getDelta2c(
double q2)
1826 return (I_2c(q2, 0) - I_2c(q2, 1)) / 2.;
1834 double getDelta2s(
double q2)
1836 return (I_2s(q2, 0) - I_2s(q2, 1))/2.;
1844 double getDelta3(
double q2)
1846 return (I_3(q2, 0) - I_3(q2, 1))/2.;
1854 double getDelta4(
double q2)
1856 return (I_4(q2, 0) - I_4(q2, 1))/2.;
1864 double getDelta5(
double q2)
1868 return (I_5(q2, 0) - I_5(q2, 1))/2.;
1871 return (I_5(q2, 0) - I_5(q2, 1))/2.;
1874 return (1. -
ys*
ys)/(1. +
xs*
xs) * (I_5(q2, 0) - I_5(q2, 1) -
xs * s_5(q2, 0))/2.;
1877 std::stringstream out;
1879 throw std::runtime_error(
"MVll::getDelta5 : vector " + out.str() +
" not implemented");
1888 double getDelta6s(
double q2)
1892 return (I_6s(q2, 0) - I_6s(q2, 1))/2.;
1895 return (I_6s(q2, 0) - I_6s(q2, 1))/2.;
1898 return (1. -
ys*
ys)/(1. +
xs*
xs) * (I_6s(q2, 0) - I_6s(q2, 1) -
xs * s_6s(q2, 0))/2.;
1901 std::stringstream out;
1903 throw std::runtime_error(
"MVll::getDelta6s : vector " + out.str() +
" not implemented");
1912 double getDelta6c(
double q2)
1916 return (I_6c(q2, 0) - I_6c(q2, 1))/2.;
1919 return (I_6c(q2, 0) - I_6c(q2, 1))/2.;
1922 return (1. -
ys*
ys)/(1. +
xs*
xs) * (I_6c(q2, 0) - I_6c(q2, 1) -
xs * s_6c(q2, 0))/2.;
1925 std::stringstream out;
1927 throw std::runtime_error(
"MVll::getDelta6c : vector " + out.str() +
" not implemented");
1936 double getDelta7(
double q2)
1938 return (I_7(q2, 0) - I_7(q2, 1))/2.;
1946 double getDelta8(
double q2)
1950 return (I_8(q2, 0) - I_8(q2, 1))/2.;
1953 return (I_8(q2, 0) - I_8(q2, 1))/2.;
1956 return (1. -
ys*
ys)/(1. +
xs*
xs) * (I_8(q2, 0) - I_8(q2, 1) -
xs * s_8(q2, 0))/2.;
1959 std::stringstream out;
1961 throw std::runtime_error(
"MVll::getDelta8 : vector " + out.str() +
" not implemented");
1970 double getDelta9(
double q2)
1974 return (I_9(q2, 0) - I_9(q2, 1))/2.;
1977 return (I_9(q2, 0) - I_9(q2, 1))/2.;
1980 return (1. -
ys*
ys)/(1. +
xs*
xs) * (I_9(q2, 0) - I_9(q2, 1) -
xs * s_9(q2, 0))/2.;
1983 std::stringstream out;
1985 throw std::runtime_error(
"MVll::getDelta9 : vector " + out.str() +
" not implemented");
2000 gslpp::complex deltaC7_QCDF(
double q2,
bool conjugate,
bool spline =
false);
2007 gslpp::complex deltaC9_QCDF(
double q2,
bool conjugate,
bool spline =
false);
2079 gslpp::complex T_perp_plus_QSS(
double q2,
double u,
bool conjugate);
2087 gslpp::complex T_para_plus_QSS(
double q2,
double u,
bool conjugate);
2095 gslpp::complex T_para_minus_QSS(
double q2,
double u,
bool conjugate);
2102 double phi_V(
double u);
2113 double T_perp_real(
double q2,
double u,
bool conjugate);
2122 double T_perp_imag(
double q2,
double u,
bool conjugate);
2131 double T_para_real(
double q2,
double u,
bool conjugate);
2140 double T_para_imag(
double q2,
double u,
bool conjugate);
2148 double T_perp_real(
double q2,
bool conjugate);
2156 double T_perp_imag(
double q2,
bool conjugate);
2164 double T_para_real(
double q2,
bool conjugate);
2172 double T_para_imag(
double q2,
bool conjugate);
2174 double QCDF_fit_func(
double* x,
double* p);
2176 void fit_QCDF_func();
2178 void spline_QCDF_func();
2193 double FF_fit(
double q2,
double a_0,
double a_1,
double a_2,
double MR2);