From 0fbb878432c1718fc0def6f21041555e9ef6d0eb Mon Sep 17 00:00:00 2001 From: Juri Fiaschi <fiaschi@uni-muenster.de> Date: Sun, 19 Aug 2018 21:49:21 +0200 Subject: [PATCH 01/11] project for including AFB in xFitter --- Reactions.txt | 1 + configure.ac | 1 + reactions/AFB/include/ReactionAFB.h | 89 ++++++++ reactions/AFB/src/Makefile.am | 15 ++ reactions/AFB/src/ReactionAFB.cc | 337 ++++++++++++++++++++++++++++ reactions/AFB/src/temp.cc | 191 ++++++++++++++++ 6 files changed, 634 insertions(+) create mode 100644 reactions/AFB/include/ReactionAFB.h create mode 100644 reactions/AFB/src/Makefile.am create mode 100644 reactions/AFB/src/ReactionAFB.cc create mode 100644 reactions/AFB/src/temp.cc diff --git a/Reactions.txt b/Reactions.txt index ccfb9b042..ae4c16236 100644 --- a/Reactions.txt +++ b/Reactions.txt @@ -14,3 +14,4 @@ FFABM_DISCC libffabm_discc_xfitter.so KFactor libkfactor_xfitter.so FONLL_DISNC libfonll_disnc_xfitter.so FONLL_DISCC libfonll_discc_xfitter.so +AFB libafb_xfitter.so diff --git a/configure.ac b/configure.ac index 869c03662..161e18244 100644 --- a/configure.ac +++ b/configure.ac @@ -558,6 +558,7 @@ AC_CONFIG_FILES([include/Makefile examples/Makefile python/Makefile xfitter-config + reactions/AFB/src/Makefile reactions/KFactor/src/Makefile reactions/BaseDISCC/src/Makefile reactions/FFABM_DISCC/src/Makefile diff --git a/reactions/AFB/include/ReactionAFB.h b/reactions/AFB/include/ReactionAFB.h new file mode 100644 index 000000000..0de8d7935 --- /dev/null +++ b/reactions/AFB/include/ReactionAFB.h @@ -0,0 +1,89 @@ + +#pragma once + +#include "ReactionTheory.h" + +/** + @class' ReactionAFB + + @brief A wrapper class for AFB reaction + + Based on the ReactionTheory class. Reads options produces 3d cross section. + + @version 0.1 + @date 2018-07-16 + */ + + +class ReactionAFB : public ReactionTheory +{ + public: + ReactionAFB(){}; + +// ~ReactionAFB(){}; +// ~ReactionAFB(const ReactionAFB &){}; +// ReactionAFB & operator =(const ReactionAFB &r){return *(new ReactionAFB(r));}; + + public: + virtual string getReactionName() const { return "AFB" ;}; + int initAtStart(const string &); + virtual int compute(int dataSetID, valarray<double> &val, map<string, valarray<double> > &err); + protected: + virtual int parseOptions(){ return 0;}; + + private: + static double *propagators (double); + static double uubarEF_funct (double *, size_t, void *); +// double uubarEF_funct (double *, size_t, void *); + + double integration_uubarEF (double, double); + double *observables (double, double); + + +// public: +// double *propagators (double Minv); +// double uubarEF_funct (double *entries, size_t dim, void *params); +// double integration_uubarEF (double Minv_inf, double Minv_sup); + + +// double uubarEB_funct (double *entries, size_t dim, void *params); +// double integration_uubarEB (double Minv_inf, double Minv_sup); +// double uubarOF_funct (double *entries, size_t dim, void *params); +// double integration_uubarOF (double Minv_inf, double Minv_sup); +// double uubarOB_funct (double *entries, size_t dim, void *params); +// double integration_uubarOB (double Minv_inf, double Minv_sup); +// +// double ubaruEF_funct (double *entries, size_t dim, void *params); +// double integration_ubaruEF (double Minv_inf, double Minv_sup); +// double ubaruEB_funct (double *entries, size_t dim, void *params); +// double integration_ubaruEB (double Minv_inf, double Minv_sup); +// double ubaruOF_funct (double *entries, size_t dim, void *params); +// double integration_ubaruOF (double Minv_inf, double Minv_sup); +// double ubaruOB_funct (double *entries, size_t dim, void *params); +// double integration_ubaruOB (double Minv_inf, double Minv_sup); +// +// double ddbarEF_funct (double *entries, size_t dim, void *params); +// double integration_ddbarEF (double Minv_inf, double Minv_sup); +// double ddbarEB_funct (double *entries, size_t dim, void *params); +// double integration_ddbarEB (double Minv_inf, double Minv_sup); +// double ddbarOF_funct (double *entries, size_t dim, void *params); +// double integration_ddbarOF (double Minv_inf, double Minv_sup); +// double ddbarOB_funct (double *entries, size_t dim, void *params); +// double integration_ddbarOB (double Minv_inf, double Minv_sup); +// +// double dbardEF_funct (double *entries, size_t dim, void *params); +// double integration_dbardEF (double Minv_inf, double Minv_sup); +// double dbardEB_funct (double *entries, size_t dim, void *params); +// double integration_dbardEB (double Minv_inf, double Minv_sup); +// double dbardOF_funct (double *entries, size_t dim, void *params); +// double integration_dbardOF (double Minv_inf, double Minv_sup); +// double dbardOB_funct (double *entries, size_t dim, void *params); +// double integration_dbardOB (double Minv_inf, double Minv_sup); +// +// double observables (double Minv_inf, double Minv_sup); + +}; + + + + diff --git a/reactions/AFB/src/Makefile.am b/reactions/AFB/src/Makefile.am new file mode 100644 index 000000000..2af7659a2 --- /dev/null +++ b/reactions/AFB/src/Makefile.am @@ -0,0 +1,15 @@ + +# Created by AddReaction.py on 2018-07-16 + +AM_CXXFLAGS = -I$(srcdir)/../include -I$(srcdir)/../../../include -I$(srcdir)/../../../interfaces/include -Wall -fPIC -Wno-deprecated + +lib_LTLIBRARIES = libafb_xfitter.la +libafb_xfitter_la_SOURCES = ReactionAFB.cc + +libafb_xfitter_la_LDFLAGS = -lgsl -lgslcblas -lm + +datadir = ${prefix}/yaml/reactions/AFB +data_DATA = ../yaml/parameters.yaml + +dist_noinst_HEADERS = ../include ../yaml + diff --git a/reactions/AFB/src/ReactionAFB.cc b/reactions/AFB/src/ReactionAFB.cc new file mode 100644 index 000000000..70c3735a2 --- /dev/null +++ b/reactions/AFB/src/ReactionAFB.cc @@ -0,0 +1,337 @@ + +/* + @file ReactionAFB.cc + @date 2018-07-16 + @author AddReaction.py + Created by AddReaction.py on 2018-07-16 +*/ + +#include "ReactionAFB.h" +#include "iostream" +#include <gsl/gsl_rng.h> +#include <gsl/gsl_randist.h> +#include <gsl/gsl_monte_miser.h> +#include <gsl/gsl_monte_vegas.h> +//#include "/home/jf6g13/LHAPDF-6.2.1/include/LHAPDF_link/LHAPDF.h" + +using namespace std; + +// Constants +#define PI 3.14159265 +#define GeVtofb 0.38937966e+12 + +// SM parameters +#define MZ 91.19 +#define GammaZ 2.5 +#define alphaEM 0.0078125 +#define sthetaW 0.4817 + +// set collider energy and luminosity +#define energy 13000 +#define lum 300 + +// define acceptance cuts +#define eta_cut 2.5 +#define pT_cut 20 + +// kinematic cuts +#define ycut 1 + +// // PDF set and grid +// #define setname "CT14nnlo" +// #define PDF_set 0 + +// Setting of the integration +const int dim_integration = 2; // Only integration on yreduced variable +// Integration extremes +double yreducedmin = 0; +double yreducedmax = ycut; + +// Integration number of calls +size_t calls = 10000; + +int ichk = 0; +int iset = 1; + + +double *ReactionAFB::propagators (double Minv) +{ + const double e = sqrt(4*PI*alphaEM); + const double gsm = (e/(sthetaW*sqrt(1-pow(sthetaW,2))))*sqrt(1+pow(sthetaW,4)); + + const double smangle = atan(-pow(sthetaW,2)); + + // SM couplings + static double *couplings_foton = new double[8]; + couplings_foton[0] = e*(2.0/3.0); + couplings_foton[1] = 0; + couplings_foton[2] = e*(-1.0/3.0); + couplings_foton[3] = 0; + couplings_foton[4] = e*(-1.0); + couplings_foton[5] = 0; + couplings_foton[6] = 0; + couplings_foton[7] = 0; + + static double *couplings_Z = new double[8]; + couplings_Z[0] = (1.0/2.0)*gsm*(1.0/6.0)*(3*cos(smangle)+8*sin(smangle)); + couplings_Z[1] = (1.0/2.0)*gsm*(cos(smangle)/2.0); + couplings_Z[2] = (1.0/2.0)*gsm*(1.0/6.0)*(-3*cos(smangle)-4*sin(smangle)); + couplings_Z[3] = (1.0/2.0)*gsm*(-cos(smangle)/2.0); + couplings_Z[4] = (1.0/2.0)*gsm*((-cos(smangle)/2.0)+(-2*sin(smangle))); + couplings_Z[5] = (1.0/2.0)*gsm*(-cos(smangle)/2.0); + couplings_Z[6] = (1.0/2.0)*gsm*(cos(smangle)/2.0); + couplings_Z[7] = (1.0/2.0)*gsm*(cos(smangle)/2.0); + + // Even combination of couplings + double even_foton_up = (pow(couplings_foton[0],2)+pow(couplings_foton[1],2))*(pow(couplings_foton[4],2)+pow(couplings_foton[5],2)); + double even_foton_down = (pow(couplings_foton[2],2)+pow(couplings_foton[3],2))*(pow(couplings_foton[4],2)+pow(couplings_foton[5],2)); + double even_interf_up = ((couplings_foton[0]*couplings_Z[0])+(couplings_foton[1]*couplings_Z[1]))*((couplings_foton[4]*couplings_Z[4])+(couplings_foton[5]*couplings_Z[5])); + double even_interf_down = ((couplings_foton[2]*couplings_Z[2])+(couplings_foton[3]*couplings_Z[3]))*((couplings_foton[4]*couplings_Z[4])+(couplings_foton[5]*couplings_Z[5])); + double even_Z_up = (pow(couplings_Z[0],2)+pow(couplings_Z[1],2))*(pow(couplings_Z[4],2)+pow(couplings_Z[5],2)); + double even_Z_down = (pow(couplings_Z[2],2)+pow(couplings_Z[3],2))*(pow(couplings_Z[4],2)+pow(couplings_Z[5],2)); + + // Odd combination of couplings + double odd_foton_up = 4*couplings_foton[0]*couplings_foton[1]*couplings_foton[4]*couplings_foton[5]; + double odd_foton_down = 4*couplings_foton[2]*couplings_foton[3]*couplings_foton[4]*couplings_foton[5]; + double odd_interf_up = (couplings_foton[0]*couplings_Z[1]+couplings_foton[1]*couplings_Z[0])*(couplings_foton[4]*couplings_Z[5]+couplings_foton[5]*couplings_Z[4]); + double odd_interf_down = (couplings_foton[2]*couplings_Z[3]+couplings_foton[3]*couplings_Z[2])*(couplings_foton[4]*couplings_Z[5]+couplings_foton[5]*couplings_Z[4]); + double odd_Z_up = 4*couplings_Z[0]*couplings_Z[1]*couplings_Z[4]*couplings_Z[5]; + double odd_Z_down = 4*couplings_Z[2]*couplings_Z[3]*couplings_Z[4]*couplings_Z[5]; + + // Propagators squared and interference + double foton_squared = 1.0/pow(Minv,4); + double interference = 2.0*(-pow(Minv,2)*(pow(MZ,2)-pow(Minv,2)))/(pow(Minv,4)*((pow(pow(MZ,2)-pow(Minv,2),2))+pow(MZ,2)*pow(GammaZ,2))); + double Z_squared = 1.0/(pow(pow(MZ,2)-pow(Minv,2),2)+pow(MZ,2)*pow(GammaZ,2)); + + static double *propagators = new double[4]; + + propagators[0] = (even_foton_up * foton_squared)+(even_interf_up * interference) + (even_Z_up * Z_squared); + propagators[1] = (odd_foton_up * foton_squared)+(odd_interf_up * interference) + (odd_Z_up * Z_squared); + propagators[2] = (even_foton_down * foton_squared)+(even_interf_down * interference) + (even_Z_down * Z_squared); + propagators[3] = (odd_foton_down * foton_squared)+(odd_interf_down * interference) + (odd_Z_down * Z_squared); + + return propagators; +} + +// extern "C"{ +// void allfxq_(int iset, double x, double q2, double *pdfs, int n, int ichk); +// } + +// extern "C"{ +// void allfxq_(int iset, double x, double q2, double *pdfs, int n, int ichk); +// } + +extern "C"{ +double fvalxq_(int iset, int id, double x, double q2, int ichk); +} + +// extern "C"{ +// void fpdfxq_(int *iset, const double *x, const double *q2, double *pdfs, int *ichk); +// } + +////UUBAR EVEN FORWARD Matrix element +double ReactionAFB::uubarEF_funct (double *entries, size_t dim, void *params) +{ + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs +// double f1u = (pdf[PDF_set]->xfxQ(2, x1, Q))/x1; +// double f1c = (pdf[PDF_set]->xfxQ(4, x1, Q))/x1; +// double f2ubar = (pdf[PDF_set]->xfxQ(-2, x2, Q))/x2; +// double f2cbar = (pdf[PDF_set]->xfxQ(-4, x2, Q))/x2; + + + static double pdfs1[13]; + static double pdfs2[13]; + double q2 = pow(Q,2); + +// allfxq_(&iset,&x1,&q2,pdfs1,&ichk); +// allfxq_(&iset,&x2,&q2,pdfs2,&ichk); + +// allfxq_(iset,x1,q2,pdfs1,0,ichk); +// allfxq_(iset,x2,q2,pdfs2,0,ichk); +// +// // fpdfxq_(&iset,&x1,&q2,pdfs1,&ichk); +// // fpdfxq_(&iset,&x2,&q2,pdfs2,&ichk); +// +// double f1u = pdfs1[7]/x1; +// double f1c = pdfs1[9]/x1; +// double f2ubar = pdfs2[4]/x2; +// double f2cbar = pdfs2[2]/x2; + + double f1u = fvalxq_(iset,2,x1,q2,ichk)/x1; + double f1c = fvalxq_(iset,4,x1,q2,ichk)/x1; + double f2ubar = fvalxq_(iset,-2,x2,q2,ichk)/x2; + double f2cbar = fvalxq_(iset,-4,x2,q2,ichk)/x2; + + +// double f1u = xfx(x1,Q,2)/x1; +// double f1c = xfx(x1,Q,4)/x1; +// double f2ubar = xfx(x2,Q,-2)/x2; +// double f2cbar = xfx(x2,Q,-4)/x2; + + // PDF combinations + double uubar_PDF = f1u*f2ubar + f1c*f2cbar; + + // Angular integration limits + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_min = 0; + + double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_EF = dsigma*angular_integration_EF; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // U-UBAR + double uubarEF = uubar_PDF*dsigma_EF; + + + + double *propagator = propagators (Minv); + + return uubarEF * propagator[0]; +} + +// double (ReactionAFB::*pointer_to_funct)(double *entries, size_t dim, void *params) = &ReactionAFB::uubarEF_funct; + + +////UUBAR EVEN FORWARD Integration +double ReactionAFB::integration_uubarEF (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + double uubarEF, error_uubarEF; + + // Initialization of the integration (quite a black box) + + gsl_monte_function Integrate_uubarEF = { &(ReactionAFB::uubarEF_funct), dim_integration, 0 }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_uubarEF, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarEF, &error_uubarEF); + do + { + gsl_monte_vegas_integrate (&Integrate_uubarEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarEF, &error_uubarEF); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*uubarEF; +} + + + +double *ReactionAFB::observables (double Minv_inf, double Minv_sup) +{ + double uubarEF = integration_uubarEF (Minv_inf, Minv_sup); +// double uubarEB = integration_uubarEB (Minv_inf, Minv_sup); +// double uubarOF = integration_uubarOF (Minv_inf, Minv_sup); +// double uubarOB = integration_uubarOB (Minv_inf, Minv_sup); +// +// double ubaruEF = integration_ubaruEF (Minv_inf, Minv_sup); +// double ubaruEB = integration_ubaruEB (Minv_inf, Minv_sup); +// double ubaruOF = integration_ubaruOF (Minv_inf, Minv_sup); +// double ubaruOB = integration_ubaruOB (Minv_inf, Minv_sup); +// +// double ddbarEF = integration_ddbarEF (Minv_inf, Minv_sup); +// double ddbarEB = integration_ddbarEB (Minv_inf, Minv_sup); +// double ddbarOF = integration_ddbarOF (Minv_inf, Minv_sup); +// double ddbarOB = integration_ddbarOB (Minv_inf, Minv_sup); +// +// double dbardEF = integration_dbardEF (Minv_inf, Minv_sup); +// double dbardEB = integration_dbardEB (Minv_inf, Minv_sup); +// double dbardOF = integration_dbardOF (Minv_inf, Minv_sup); +// double dbardOB = integration_dbardOB (Minv_inf, Minv_sup); +// +// // Reconstructed Forward and Backward +// double Forward = uubarEF+ubaruEF+ddbarEF+dbardEF+uubarOF+ubaruOF+ddbarOF+dbardOF; +// double Backward = uubarEB+ubaruEB+ddbarEB+dbardEB+uubarOB+ubaruOB+ddbarOB+dbardOB; +// +// // Cross section and statistical relative uncertainty +// double XS = Forward + Backward; +// double Epsilon_XS = 100.0 / sqrt(XS*lum); +// +// +// // Reconstructed AFB and statistical absolute uncertainty +// double AFB = (Forward - Backward) / (Forward + Backward); +// double Delta_AFB = sqrt((1.0-pow(AFB,2)) / (XS*lum)); +// +// +// double *results = new double[4]; +// +// results[0] = XS; +// results[1] = Epsilon_XS; +// results[2] = AFB; +// results[3] = Delta_AFB; + + double *results = new double[4]; + results[0] = uubarEF; + results[1] = uubarEF; + results[2] = uubarEF; + results[3] = uubarEF; + + + return results; +} + + + +// the class factories +extern "C" ReactionAFB* create() { + return new ReactionAFB(); +} + +// Initialize at the start of the computation +int ReactionAFB::initAtStart(const string &s) +{ + return 0; +} + +// Main function to compute results at an iteration +int ReactionAFB::compute(int dataSetID, valarray<double> &val, map<string, valarray<double> > &err) +{ + auto *Minv_min = GetBinValues(dataSetID,"Minv_min"), *Minv_max = GetBinValues(dataSetID,"Minv_max"); + if (Minv_min == nullptr || Minv_max == nullptr) { + std::cout << "\n\nFATAL ERROR" << std::endl; + std::cout << "CHECK THE DATAFILE !!!" << std::endl; + return 1; + } + + auto min = *Minv_min, max = *Minv_max; + + printf("%1f \n", min[0]); + printf("%1f \n", max[0]); + + printf("Calling AFB \n"); + +// val[0] = *propagators (min[0]); + +// val[0] = integration_uubarEF(min[0], max[0]); + + double *results = observables (min[0], max[0]); + + val[0] = results[0]; + + + return 0; +} diff --git a/reactions/AFB/src/temp.cc b/reactions/AFB/src/temp.cc new file mode 100644 index 000000000..28c72a025 --- /dev/null +++ b/reactions/AFB/src/temp.cc @@ -0,0 +1,191 @@ +#include <algorithm> +#include <vector> +#include <math.h> +#include <iostream> +#include "PhysPar.h" +#include <gsl/gsl_integration.h> + +#define MAX_CHAR 1000 +#define NALLOC 100000 +//#define PRECISION 1.e-3 + +using namespace std; +using namespace PhysPar; + +extern "C"{ +void fpdfxq_(int *iset, const double *x, const double *q2, double *pdfs, int *ichk); +} + +extern "C" { + int zee_integ__(double *integral, double *integral_err, void *mass_range, void *y_range); +} + +extern "C" { + void dy_check__(); +} + +static double CurrentY = 0; + +namespace IntegDY_Z +{ + +double intgd_m(double , void *); +double dsig_gammaZ(double , void *); +double get_Fqqbar(const double &, const double &, const double &, const int ); + +double INT_PREC(1.e-3); + +double intgd_m(double m, void *y_range){ +//cout << "m: " << m << endl; + gsl_integration_workspace *wsp = + gsl_integration_workspace_alloc(NALLOC); + + // prepare y-range for integration + double y_low = (*(double*)y_range); + double y_up = (*((double*)y_range+1)); + // cout << "here" << y_low << "\t" << y_up << endl; + // prepare gsl_function + double inty, inty_err; + gsl_function F; + F.function = &dsig_gammaZ; + F.params = &m; + + gsl_integration_qags(&F, y_low, y_up, 0, INT_PREC, NALLOC, wsp, &inty, &inty_err); + + gsl_integration_workspace_free(wsp); +// cout << "gnuplot " << m << "\t" << inty << endl; + + return inty; +} + +double get_Fqqbar(const double &x1, const double &x2, const double &scale, const int iflav, const int iget) +{ +// short int bar_sign = ( iflav>2 )? 1: -1; +// if ( iflav>2 ) bar_sign = 1; + static double pdfs1[13]; + static double pdfs2[13]; + int ichk = 0; + int iset = 1; + + double q2 = (scale) * (scale); + + + if ( (x1< 1.e-6)||(x2<1.e-6)||(x1>1.-1.e-6)||(x2>1.-1.e-6)) { + return 0.; + } + else{ + // Access QCDNUM pdfs: + if (iget == 0) { + fpdfxq_(&iset,&x1,&q2,pdfs1,&ichk); + fpdfxq_(&iset,&x2,&q2,pdfs2,&ichk); + } + } + + int ifl = 6+iflav ; + int iflbar = 6-iflav ; + + double xq1 = pdfs1[ifl]; //LHAPDF::xfx(x1, scale, iflav); + double xqbar2 = pdfs2[iflbar]; //LHAPDF::xfx(x2, scale, bar_sign*iflav); + double xq2 = pdfs2[ifl]; //lLHAPDF::xfx(x2, scale, iflav); + double xqbar1 = pdfs1[iflbar]; //LHAPDF::xfx(x1, scale, bar_sign*iflav); + double ret = (xq1*xqbar2+xqbar1*xq2)/(x1*x2); + + /* + for (int i=0; i<=12; i++){ + cout << pdfs1[i] << " "; + } + cout << "\n"; + cout << "IFlav = " << iflav << endl; + cout << "Check: "<< xq1 << "\t" << xq2 << "\t" << xqbar1<<"\t"<<xqbar2<<endl; + */ + return ret; +} + +// http://cdsweb.cern.ch/record/1232420/files/CERN-THESIS-2010-006.pdf version +double dsig_gammaZ(double y, void *pm) +{ + const double m = *(double*) pm; +//cout << m << "\t" << y << endl; + const double m2 = m*m; + const double x1 = m/ebeam*exp(y); + const double x2 = m/ebeam*exp(-y); + if ( (x1< 1.e-6)||(x2<1.e-6)||(x1>1.-1.e-6)||(x2>1.-1.e-6)) { + return 0.; + } + //cout << x1 << "\t" << x2 << endl; + + double phi_gamma(0.), phi_Z(0.), phi_intf(0.); + for ( int iflav = 0; iflav<5; iflav++ ) { + double Fqqbar = get_Fqqbar(x1,x2,mz, iflav+1,iflav); // iflav = 0: read new pdfs from QCDNUM + + phi_gamma += pow(chq[iflav%2],2) * Fqqbar; + phi_intf += vq[iflav%2]*chq[iflav%2]*Fqqbar; + phi_Z += (pow(vq[iflav%2],2)+1.) * Fqqbar; + } + + //const double kZ = 1./4./sw2/cw2; + alpha = 1./M_PI*gfermi*sqrt(2.)*sw2*cw2*m2z; + // cout << 1./alpha << endl; + const double denZ = pow(m2-m2z,2)+pow(wz*mz,2); + double dsig = conhc*8.*M_PI*pow(alpha,2)/(9.*m*pow(ebeam,2))*( + phi_gamma + + m2*(m2-m2z)*(1.-4.*sw2)/(8.*sw2*cw2*denZ)*phi_intf + + 3*pow(m2,2)*(1.+pow(1.-4.*sw2,2))/(16.*sw2*cw2*denZ*48.*sw2*cw2)*phi_Z + ); + + return dsig; +} + +} // IntegDY_Z namespace + +int zee_integ__( double *integral, double *integral_err, void *mass_range, void *y_range){ + + //int proc_id(0); + double m_low = (*(double*)mass_range); + double m_up = (*((double*)mass_range+1)); + double y_low = (*(double*)y_range); + double y_up = (*((double*)y_range+1)); + + // cout << m_low << "\t" << m_up <<endl; + // cout << y_low << "\t" << y_up <<endl; + + gsl_integration_workspace *wsp = + gsl_integration_workspace_alloc(NALLOC); + + + //double integral, integral_err; + gsl_function gF; + gF.function = &(IntegDY_Z::intgd_m); + gF.params = y_range; + + int integ_res = + gsl_integration_qags(&gF, m_low, m_up, 0, IntegDY_Z::INT_PREC, NALLOC, wsp, integral, integral_err); + + gsl_integration_workspace_free(wsp); + + return integ_res; +} + +void dy_check__() { + double mass = 90.; + for ( int i = 0; i<=0; i++){ + mass += i / 10.; + double val = IntegDY_Z::dsig_gammaZ(0.0 , &mass); + cout << "mass="<<mass<<" Double diff = " << val << "\n"; + } + + double integral(0); double err(0); + double mass_range[2]; double y_range[2]; + mass_range[0] = 50.; mass_range[1] = 110.; + y_range[0] = -10.; y_range[1] = 10.; + + int res = zee_integ__(&integral,&err,mass_range,y_range); + /* + double yrange[2]; + yrange[0] = -10.; + yrange[1] = 10.; + double amint = intgd_m(mass,yrange); + cout << " mass int=" << amint << "\n"; +*/ + cout << " Integral ="<< integral <<" +- "<<err<<"\n"; +} -- GitLab From 1e890dc6369f5c73af6be8a7da62f9183d59e9b7 Mon Sep 17 00:00:00 2001 From: Juri Fiaschi <fiaschi@uni-muenster.de> Date: Sun, 19 Aug 2018 19:51:27 +0000 Subject: [PATCH 02/11] Delete temp.cc --- reactions/AFB/src/temp.cc | 191 -------------------------------------- 1 file changed, 191 deletions(-) delete mode 100644 reactions/AFB/src/temp.cc diff --git a/reactions/AFB/src/temp.cc b/reactions/AFB/src/temp.cc deleted file mode 100644 index 28c72a025..000000000 --- a/reactions/AFB/src/temp.cc +++ /dev/null @@ -1,191 +0,0 @@ -#include <algorithm> -#include <vector> -#include <math.h> -#include <iostream> -#include "PhysPar.h" -#include <gsl/gsl_integration.h> - -#define MAX_CHAR 1000 -#define NALLOC 100000 -//#define PRECISION 1.e-3 - -using namespace std; -using namespace PhysPar; - -extern "C"{ -void fpdfxq_(int *iset, const double *x, const double *q2, double *pdfs, int *ichk); -} - -extern "C" { - int zee_integ__(double *integral, double *integral_err, void *mass_range, void *y_range); -} - -extern "C" { - void dy_check__(); -} - -static double CurrentY = 0; - -namespace IntegDY_Z -{ - -double intgd_m(double , void *); -double dsig_gammaZ(double , void *); -double get_Fqqbar(const double &, const double &, const double &, const int ); - -double INT_PREC(1.e-3); - -double intgd_m(double m, void *y_range){ -//cout << "m: " << m << endl; - gsl_integration_workspace *wsp = - gsl_integration_workspace_alloc(NALLOC); - - // prepare y-range for integration - double y_low = (*(double*)y_range); - double y_up = (*((double*)y_range+1)); - // cout << "here" << y_low << "\t" << y_up << endl; - // prepare gsl_function - double inty, inty_err; - gsl_function F; - F.function = &dsig_gammaZ; - F.params = &m; - - gsl_integration_qags(&F, y_low, y_up, 0, INT_PREC, NALLOC, wsp, &inty, &inty_err); - - gsl_integration_workspace_free(wsp); -// cout << "gnuplot " << m << "\t" << inty << endl; - - return inty; -} - -double get_Fqqbar(const double &x1, const double &x2, const double &scale, const int iflav, const int iget) -{ -// short int bar_sign = ( iflav>2 )? 1: -1; -// if ( iflav>2 ) bar_sign = 1; - static double pdfs1[13]; - static double pdfs2[13]; - int ichk = 0; - int iset = 1; - - double q2 = (scale) * (scale); - - - if ( (x1< 1.e-6)||(x2<1.e-6)||(x1>1.-1.e-6)||(x2>1.-1.e-6)) { - return 0.; - } - else{ - // Access QCDNUM pdfs: - if (iget == 0) { - fpdfxq_(&iset,&x1,&q2,pdfs1,&ichk); - fpdfxq_(&iset,&x2,&q2,pdfs2,&ichk); - } - } - - int ifl = 6+iflav ; - int iflbar = 6-iflav ; - - double xq1 = pdfs1[ifl]; //LHAPDF::xfx(x1, scale, iflav); - double xqbar2 = pdfs2[iflbar]; //LHAPDF::xfx(x2, scale, bar_sign*iflav); - double xq2 = pdfs2[ifl]; //lLHAPDF::xfx(x2, scale, iflav); - double xqbar1 = pdfs1[iflbar]; //LHAPDF::xfx(x1, scale, bar_sign*iflav); - double ret = (xq1*xqbar2+xqbar1*xq2)/(x1*x2); - - /* - for (int i=0; i<=12; i++){ - cout << pdfs1[i] << " "; - } - cout << "\n"; - cout << "IFlav = " << iflav << endl; - cout << "Check: "<< xq1 << "\t" << xq2 << "\t" << xqbar1<<"\t"<<xqbar2<<endl; - */ - return ret; -} - -// http://cdsweb.cern.ch/record/1232420/files/CERN-THESIS-2010-006.pdf version -double dsig_gammaZ(double y, void *pm) -{ - const double m = *(double*) pm; -//cout << m << "\t" << y << endl; - const double m2 = m*m; - const double x1 = m/ebeam*exp(y); - const double x2 = m/ebeam*exp(-y); - if ( (x1< 1.e-6)||(x2<1.e-6)||(x1>1.-1.e-6)||(x2>1.-1.e-6)) { - return 0.; - } - //cout << x1 << "\t" << x2 << endl; - - double phi_gamma(0.), phi_Z(0.), phi_intf(0.); - for ( int iflav = 0; iflav<5; iflav++ ) { - double Fqqbar = get_Fqqbar(x1,x2,mz, iflav+1,iflav); // iflav = 0: read new pdfs from QCDNUM - - phi_gamma += pow(chq[iflav%2],2) * Fqqbar; - phi_intf += vq[iflav%2]*chq[iflav%2]*Fqqbar; - phi_Z += (pow(vq[iflav%2],2)+1.) * Fqqbar; - } - - //const double kZ = 1./4./sw2/cw2; - alpha = 1./M_PI*gfermi*sqrt(2.)*sw2*cw2*m2z; - // cout << 1./alpha << endl; - const double denZ = pow(m2-m2z,2)+pow(wz*mz,2); - double dsig = conhc*8.*M_PI*pow(alpha,2)/(9.*m*pow(ebeam,2))*( - phi_gamma - + m2*(m2-m2z)*(1.-4.*sw2)/(8.*sw2*cw2*denZ)*phi_intf - + 3*pow(m2,2)*(1.+pow(1.-4.*sw2,2))/(16.*sw2*cw2*denZ*48.*sw2*cw2)*phi_Z - ); - - return dsig; -} - -} // IntegDY_Z namespace - -int zee_integ__( double *integral, double *integral_err, void *mass_range, void *y_range){ - - //int proc_id(0); - double m_low = (*(double*)mass_range); - double m_up = (*((double*)mass_range+1)); - double y_low = (*(double*)y_range); - double y_up = (*((double*)y_range+1)); - - // cout << m_low << "\t" << m_up <<endl; - // cout << y_low << "\t" << y_up <<endl; - - gsl_integration_workspace *wsp = - gsl_integration_workspace_alloc(NALLOC); - - - //double integral, integral_err; - gsl_function gF; - gF.function = &(IntegDY_Z::intgd_m); - gF.params = y_range; - - int integ_res = - gsl_integration_qags(&gF, m_low, m_up, 0, IntegDY_Z::INT_PREC, NALLOC, wsp, integral, integral_err); - - gsl_integration_workspace_free(wsp); - - return integ_res; -} - -void dy_check__() { - double mass = 90.; - for ( int i = 0; i<=0; i++){ - mass += i / 10.; - double val = IntegDY_Z::dsig_gammaZ(0.0 , &mass); - cout << "mass="<<mass<<" Double diff = " << val << "\n"; - } - - double integral(0); double err(0); - double mass_range[2]; double y_range[2]; - mass_range[0] = 50.; mass_range[1] = 110.; - y_range[0] = -10.; y_range[1] = 10.; - - int res = zee_integ__(&integral,&err,mass_range,y_range); - /* - double yrange[2]; - yrange[0] = -10.; - yrange[1] = 10.; - double amint = intgd_m(mass,yrange); - cout << " mass int=" << amint << "\n"; -*/ - cout << " Integral ="<< integral <<" +- "<<err<<"\n"; -} -- GitLab From 3626c0f7eb262eb786e8f199cb548cb9e2e633be Mon Sep 17 00:00:00 2001 From: Juri Fiaschi <fiaschi@uni-muenster.de> Date: Mon, 20 Aug 2018 17:21:41 +0200 Subject: [PATCH 03/11] Including AFB in xFitter --- reactions/AFB/include/ReactionAFB.h | 85 +- reactions/AFB/src/ReactionAFB.cc | 1253 +++++++++++++++++++++++++-- 2 files changed, 1208 insertions(+), 130 deletions(-) diff --git a/reactions/AFB/include/ReactionAFB.h b/reactions/AFB/include/ReactionAFB.h index 0de8d7935..e55534053 100644 --- a/reactions/AFB/include/ReactionAFB.h +++ b/reactions/AFB/include/ReactionAFB.h @@ -33,57 +33,42 @@ class ReactionAFB : public ReactionTheory private: static double *propagators (double); + static double uubarEF_funct (double *, size_t, void *); -// double uubarEF_funct (double *, size_t, void *); - double integration_uubarEF (double, double); - double *observables (double, double); - - -// public: -// double *propagators (double Minv); -// double uubarEF_funct (double *entries, size_t dim, void *params); -// double integration_uubarEF (double Minv_inf, double Minv_sup); - - -// double uubarEB_funct (double *entries, size_t dim, void *params); -// double integration_uubarEB (double Minv_inf, double Minv_sup); -// double uubarOF_funct (double *entries, size_t dim, void *params); -// double integration_uubarOF (double Minv_inf, double Minv_sup); -// double uubarOB_funct (double *entries, size_t dim, void *params); -// double integration_uubarOB (double Minv_inf, double Minv_sup); -// -// double ubaruEF_funct (double *entries, size_t dim, void *params); -// double integration_ubaruEF (double Minv_inf, double Minv_sup); -// double ubaruEB_funct (double *entries, size_t dim, void *params); -// double integration_ubaruEB (double Minv_inf, double Minv_sup); -// double ubaruOF_funct (double *entries, size_t dim, void *params); -// double integration_ubaruOF (double Minv_inf, double Minv_sup); -// double ubaruOB_funct (double *entries, size_t dim, void *params); -// double integration_ubaruOB (double Minv_inf, double Minv_sup); -// -// double ddbarEF_funct (double *entries, size_t dim, void *params); -// double integration_ddbarEF (double Minv_inf, double Minv_sup); -// double ddbarEB_funct (double *entries, size_t dim, void *params); -// double integration_ddbarEB (double Minv_inf, double Minv_sup); -// double ddbarOF_funct (double *entries, size_t dim, void *params); -// double integration_ddbarOF (double Minv_inf, double Minv_sup); -// double ddbarOB_funct (double *entries, size_t dim, void *params); -// double integration_ddbarOB (double Minv_inf, double Minv_sup); -// -// double dbardEF_funct (double *entries, size_t dim, void *params); -// double integration_dbardEF (double Minv_inf, double Minv_sup); -// double dbardEB_funct (double *entries, size_t dim, void *params); -// double integration_dbardEB (double Minv_inf, double Minv_sup); -// double dbardOF_funct (double *entries, size_t dim, void *params); -// double integration_dbardOF (double Minv_inf, double Minv_sup); -// double dbardOB_funct (double *entries, size_t dim, void *params); -// double integration_dbardOB (double Minv_inf, double Minv_sup); -// -// double observables (double Minv_inf, double Minv_sup); + static double uubarEB_funct (double *, size_t, void *); + double integration_uubarEB (double, double); + static double uubarOF_funct (double *, size_t, void *); + double integration_uubarOF (double, double); + static double uubarOB_funct (double *, size_t, void *); + double integration_uubarOB (double, double); + + static double ubaruEF_funct (double *, size_t, void *); + double integration_ubaruEF (double, double); + static double ubaruEB_funct (double *, size_t, void *); + double integration_ubaruEB (double, double); + static double ubaruOF_funct (double *, size_t, void *); + double integration_ubaruOF (double, double); + static double ubaruOB_funct (double *, size_t, void *); + double integration_ubaruOB (double, double); + + static double ddbarEF_funct (double *, size_t, void *); + double integration_ddbarEF (double, double); + static double ddbarEB_funct (double *, size_t, void *); + double integration_ddbarEB (double, double); + static double ddbarOF_funct (double *, size_t, void *); + double integration_ddbarOF (double, double); + static double ddbarOB_funct (double *, size_t, void *); + double integration_ddbarOB (double, double); + + static double dbardEF_funct (double *, size_t, void *); + double integration_dbardEF (double, double); + static double dbardEB_funct (double *, size_t, void *); + double integration_dbardEB (double, double); + static double dbardOF_funct (double *, size_t, void *); + double integration_dbardOF (double, double); + static double dbardOB_funct (double *, size_t, void *); + double integration_dbardOB (double, double); + double *observables (double, double); }; - - - - diff --git a/reactions/AFB/src/ReactionAFB.cc b/reactions/AFB/src/ReactionAFB.cc index 70c3735a2..01be3ce53 100644 --- a/reactions/AFB/src/ReactionAFB.cc +++ b/reactions/AFB/src/ReactionAFB.cc @@ -8,11 +8,8 @@ #include "ReactionAFB.h" #include "iostream" -#include <gsl/gsl_rng.h> -#include <gsl/gsl_randist.h> #include <gsl/gsl_monte_miser.h> #include <gsl/gsl_monte_vegas.h> -//#include "/home/jf6g13/LHAPDF-6.2.1/include/LHAPDF_link/LHAPDF.h" using namespace std; @@ -37,12 +34,12 @@ using namespace std; // kinematic cuts #define ycut 1 -// // PDF set and grid -// #define setname "CT14nnlo" -// #define PDF_set 0 +// PDF set and check +const int iset = 1; +const int ichk = 0; // Setting of the integration -const int dim_integration = 2; // Only integration on yreduced variable +const int dim_integration = 2; // Integration on yreduced and Minv // Integration extremes double yreducedmin = 0; double yreducedmax = ycut; @@ -50,10 +47,10 @@ double yreducedmax = ycut; // Integration number of calls size_t calls = 10000; -int ichk = 0; -int iset = 1; + +//// Function retirning the combination of propagators double *ReactionAFB::propagators (double Minv) { const double e = sqrt(4*PI*alphaEM); @@ -113,22 +110,6 @@ double *ReactionAFB::propagators (double Minv) return propagators; } -// extern "C"{ -// void allfxq_(int iset, double x, double q2, double *pdfs, int n, int ichk); -// } - -// extern "C"{ -// void allfxq_(int iset, double x, double q2, double *pdfs, int n, int ichk); -// } - -extern "C"{ -double fvalxq_(int iset, int id, double x, double q2, int ichk); -} - -// extern "C"{ -// void fpdfxq_(int *iset, const double *x, const double *q2, double *pdfs, int *ichk); -// } - ////UUBAR EVEN FORWARD Matrix element double ReactionAFB::uubarEF_funct (double *entries, size_t dim, void *params) { @@ -145,41 +126,13 @@ double ReactionAFB::uubarEF_funct (double *entries, size_t dim, void *params) double dsigma_temp = pow(Minv,2)/(96*PI); double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - // Partons PDFs -// double f1u = (pdf[PDF_set]->xfxQ(2, x1, Q))/x1; -// double f1c = (pdf[PDF_set]->xfxQ(4, x1, Q))/x1; -// double f2ubar = (pdf[PDF_set]->xfxQ(-2, x2, Q))/x2; -// double f2cbar = (pdf[PDF_set]->xfxQ(-4, x2, Q))/x2; - - - static double pdfs1[13]; - static double pdfs2[13]; - double q2 = pow(Q,2); - -// allfxq_(&iset,&x1,&q2,pdfs1,&ichk); -// allfxq_(&iset,&x2,&q2,pdfs2,&ichk); - -// allfxq_(iset,x1,q2,pdfs1,0,ichk); -// allfxq_(iset,x2,q2,pdfs2,0,ichk); -// -// // fpdfxq_(&iset,&x1,&q2,pdfs1,&ichk); -// // fpdfxq_(&iset,&x2,&q2,pdfs2,&ichk); -// -// double f1u = pdfs1[7]/x1; -// double f1c = pdfs1[9]/x1; -// double f2ubar = pdfs2[4]/x2; -// double f2cbar = pdfs2[2]/x2; - - double f1u = fvalxq_(iset,2,x1,q2,ichk)/x1; - double f1c = fvalxq_(iset,4,x1,q2,ichk)/x1; - double f2ubar = fvalxq_(iset,-2,x2,q2,ichk)/x2; - double f2cbar = fvalxq_(iset,-4,x2,q2,ichk)/x2; -// double f1u = xfx(x1,Q,2)/x1; -// double f1c = xfx(x1,Q,4)/x1; -// double f2ubar = xfx(x2,Q,-2)/x2; -// double f2cbar = xfx(x2,Q,-4)/x2; + // Call the PDFs + double f1u = (ReactionTheory::xfx(x1,Q,2)) / x1; + double f1c = (ReactionTheory::xfx(x1,Q,4)) / x1; + double f2ubar = (ReactionTheory::xfx(x2,Q,-2)) / x2; + double f2cbar = (ReactionTheory::xfx(x2,Q,-4)) / x2; // PDF combinations double uubar_PDF = f1u*f2ubar + f1c*f2cbar; @@ -196,17 +149,12 @@ double ReactionAFB::uubarEF_funct (double *entries, size_t dim, void *params) // Covolution with PDFs (flipping direction for q-qbar & qbar-q) // U-UBAR double uubarEF = uubar_PDF*dsigma_EF; - - double *propagator = propagators (Minv); - return uubarEF * propagator[0]; + return uubarEF * propagator[0]; // Multiply the PDFs combination with the correct propagator. } -// double (ReactionAFB::*pointer_to_funct)(double *entries, size_t dim, void *params) = &ReactionAFB::uubarEF_funct; - - ////UUBAR EVEN FORWARD Integration double ReactionAFB::integration_uubarEF (double Minv_inf, double Minv_sup) { @@ -236,10 +184,1136 @@ double ReactionAFB::integration_uubarEF (double Minv_inf, double Minv_sup) gsl_rng_free (r); - return 2*uubarEF; + return 2*uubarEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. } +// ////UUBAR EVEN BACKWARD Matrix element +// double ReactionAFB::uubarEB_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1u = (ReactionTheory::xfx(x1,Q,2)) / x1; +// double f1c = (ReactionTheory::xfx(x1,Q,4)) / x1; +// double f2ubar = (ReactionTheory::xfx(x2,Q,-2)) / x2; +// double f2cbar = (ReactionTheory::xfx(x2,Q,-4)) / x2; +// +// // PDF combinations +// double uubar_PDF = f1u*f2ubar + f1c*f2cbar; +// +// // Angular integration limits +// double qbarq_cos_theta_max = 0; +// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// +// double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_EB = dsigma*angular_integration_EB; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // U-UBAR +// double uubarEB = uubar_PDF*dsigma_EB; +// +// double *propagator = propagators (Minv); +// +// return uubarEB * propagator[0]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////UUBAR EVEN BACKWARD Integration +// double ReactionAFB::integration_uubarEB (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double uubarEB, error_uubarEB; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_uubarEB = { &(ReactionAFB::uubarEB_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_uubarEB, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarEB, &error_uubarEB); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_uubarEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarEB, &error_uubarEB); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*uubarEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////UUBAR ODD FORWARD Matrix element +// double ReactionAFB::uubarOF_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1u = (ReactionTheory::xfx(x1,Q,2)) / x1; +// double f1c = (ReactionTheory::xfx(x1,Q,4)) / x1; +// double f2ubar = (ReactionTheory::xfx(x2,Q,-2)) / x2; +// double f2cbar = (ReactionTheory::xfx(x2,Q,-4)) / x2; +// +// // PDF combinations +// double uubar_PDF = f1u*f2ubar + f1c*f2cbar; +// +// // Angular integration limits +// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// double qqbar_cos_theta_min = 0; +// +// double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_OF = dsigma*angular_integration_OF; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // U-UBAR +// double uubarOF = uubar_PDF*dsigma_OF; +// +// double *propagator = propagators (Minv); +// +// return uubarOF * propagator[1]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////UUBAR ODD FORWARD Integration +// double ReactionAFB::integration_uubarOF (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double uubarOF, error_uubarOF; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_uubarOF = { &(ReactionAFB::uubarOF_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_uubarOF, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarOF, &error_uubarOF); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_uubarOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarOF, &error_uubarOF); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*uubarOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////UUBAR ODD BACKWARD Matrix element +// double ReactionAFB::uubarOB_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1u = (ReactionTheory::xfx(x1,Q,2)) / x1; +// double f1c = (ReactionTheory::xfx(x1,Q,4)) / x1; +// double f2ubar = (ReactionTheory::xfx(x2,Q,-2)) / x2; +// double f2cbar = (ReactionTheory::xfx(x2,Q,-4)) / x2; +// +// // PDF combinations +// double uubar_PDF = f1u*f2ubar + f1c*f2cbar; +// +// // Angular integration limits +// double qbarq_cos_theta_max = 0; +// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// +// double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_OB = dsigma*angular_integration_OB; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // U-UBAR +// double uubarOB = uubar_PDF*dsigma_OB; +// +// double *propagator = propagators (Minv); +// +// return uubarOB * propagator[1]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////UUBAR ODD BACKWARD Integration +// double ReactionAFB::integration_uubarOB (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double uubarOB, error_uubarOB; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_uubarOB = { &(ReactionAFB::uubarOB_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_uubarOB, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarOB, &error_uubarOB); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_uubarOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarOB, &error_uubarOB); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*uubarOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////UBARU EVEN FORWARD Matrix element +// double ReactionAFB::ubaruEF_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1ubar = (ReactionTheory::xfx(x1,Q,-2)) / x1; +// double f1cbar = (ReactionTheory::xfx(x1,Q,-4)) / x1; +// double f2u = (ReactionTheory::xfx(x2,Q,2)) / x2; +// double f2c = (ReactionTheory::xfx(x2,Q,4)) / x2; +// +// // PDF combinations +// double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; +// +// // Angular integration limits +// double qbarq_cos_theta_max = 0; +// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// +// double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_EB = dsigma*angular_integration_EB; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // UBAR-U +// double ubaruEF = ubaru_PDF*dsigma_EB; +// +// double *propagator = propagators (Minv); +// +// return ubaruEF * propagator[0]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////UBARU EVEN FORWARD Integration +// double ReactionAFB::integration_ubaruEF (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double ubaruEF, error_ubaruEF; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_ubaruEF = { &(ReactionAFB::ubaruEF_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_ubaruEF, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruEF, &error_ubaruEF); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_ubaruEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruEF, &error_ubaruEF); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*ubaruEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////UBARU EVEN BACKWARD Matrix element +// double ReactionAFB::ubaruEB_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1ubar = (ReactionTheory::xfx(x1,Q,-2)) / x1; +// double f1cbar = (ReactionTheory::xfx(x1,Q,-4)) / x1; +// double f2u = (ReactionTheory::xfx(x2,Q,2)) / x2; +// double f2c = (ReactionTheory::xfx(x2,Q,4)) / x2; +// +// // PDF combinations +// double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; +// +// // Angular integration limits +// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// double qqbar_cos_theta_min = 0; +// +// double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_EF = dsigma*angular_integration_EF; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // UBAR-U +// double ubaruEB = ubaru_PDF*dsigma_EF; +// +// double *propagator = propagators (Minv); +// +// return ubaruEB * propagator[0]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////UUBAR EVEN BACKWARD Integration +// double ReactionAFB::integration_ubaruEB (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double ubaruEB, error_ubaruEB; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_ubaruEB = { &(ReactionAFB::ubaruEB_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_ubaruEB, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruEB, &error_ubaruEB); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_ubaruEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruEB, &error_ubaruEB); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*ubaruEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////UBARU ODD FORWARD Matrix element +// double ReactionAFB::ubaruOF_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1ubar = (ReactionTheory::xfx(x1,Q,-2)) / x1; +// double f1cbar = (ReactionTheory::xfx(x1,Q,-4)) / x1; +// double f2u = (ReactionTheory::xfx(x2,Q,2)) / x2; +// double f2c = (ReactionTheory::xfx(x2,Q,4)) / x2; +// +// // PDF combinations +// double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; +// +// // Angular integration limits +// double qbarq_cos_theta_max = 0; +// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// +// double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_OB = dsigma*angular_integration_OB; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // UBAR-U +// double ubaruOF = ubaru_PDF*dsigma_OB; +// +// double *propagator = propagators (Minv); +// +// return ubaruOF * propagator[1]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////UBARU ODD FORWARD Integration +// double ReactionAFB::integration_ubaruOF (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double ubaruOF, error_ubaruOF; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_ubaruOF = { &(ReactionAFB::ubaruOF_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_ubaruOF, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruOF, &error_ubaruOF); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_ubaruOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruOF, &error_ubaruOF); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*ubaruOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////UBARU ODD BACKWARD Matrix element +// double ReactionAFB::ubaruOB_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1ubar = (ReactionTheory::xfx(x1,Q,-2)) / x1; +// double f1cbar = (ReactionTheory::xfx(x1,Q,-4)) / x1; +// double f2u = (ReactionTheory::xfx(x2,Q,2)) / x2; +// double f2c = (ReactionTheory::xfx(x2,Q,4)) / x2; +// +// // PDF combinations +// double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; +// +// // Angular integration limits +// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// double qqbar_cos_theta_min = 0; +// +// double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_OF = dsigma*angular_integration_OF; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // UBAR-U +// double ubaruOB = ubaru_PDF*dsigma_OF; +// +// double *propagator = propagators (Minv); +// +// return ubaruOB * propagator[1]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////UBARU ODD BACKWARD Integration +// double ReactionAFB::integration_ubaruOB (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double ubaruOB, error_ubaruOB; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_ubaruOB = { &(ReactionAFB::ubaruOB_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_ubaruOB, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruOB, &error_ubaruOB); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_ubaruOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruOB, &error_ubaruOB); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*ubaruOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////DDBAR EVEN FORWARD Matrix element +// double ReactionAFB::ddbarEF_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1d = (ReactionTheory::xfx(x1,Q,1)) / x1; +// double f1s = (ReactionTheory::xfx(x1,Q,3)) / x1; +// double f1b = (ReactionTheory::xfx(x1,Q,5)) / x1; +// double f2dbar = (ReactionTheory::xfx(x2,Q,-1)) / x2; +// double f2sbar = (ReactionTheory::xfx(x2,Q,-3)) / x2; +// double f2bbar = (ReactionTheory::xfx(x2,Q,-5)) / x2; +// +// // PDF combinations +// double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; +// +// // Angular integration limits +// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// double qqbar_cos_theta_min = 0; +// +// double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_EF = dsigma*angular_integration_EF; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // D-DBAR +// double ddbarEF = ddbar_PDF*dsigma_EF; +// +// double *propagator = propagators (Minv); +// +// return ddbarEF * propagator[2]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////DDBAR EVEN FORWARD Integration +// double ReactionAFB::integration_ddbarEF (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double ddbarEF, error_ddbarEF; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_ddbarEF = { &(ReactionAFB::ddbarEF_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_ddbarEF, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarEF, &error_ddbarEF); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_ddbarEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarEF, &error_ddbarEF); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*ddbarEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////DDBAR EVEN BACKWARD Matrix element +// double ReactionAFB::ddbarEB_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1d = (ReactionTheory::xfx(x1,Q,1)) / x1; +// double f1s = (ReactionTheory::xfx(x1,Q,3)) / x1; +// double f1b = (ReactionTheory::xfx(x1,Q,5)) / x1; +// double f2dbar = (ReactionTheory::xfx(x2,Q,-1)) / x2; +// double f2sbar = (ReactionTheory::xfx(x2,Q,-3)) / x2; +// double f2bbar = (ReactionTheory::xfx(x2,Q,-5)) / x2; +// +// // PDF combinations +// double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; +// +// // Angular integration limits +// double qbarq_cos_theta_max = 0; +// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// +// double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_EB = dsigma*angular_integration_EB; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // D-DBAR +// double ddbarEB = ddbar_PDF*dsigma_EB; +// +// double *propagator = propagators (Minv); +// +// return ddbarEB * propagator[2]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////DDBAR EVEN BACKWARD Integration +// double ReactionAFB::integration_ddbarEB (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double ddbarEB, error_ddbarEB; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_ddbarEB = { &(ReactionAFB::ddbarEB_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_ddbarEB, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarEB, &error_ddbarEB); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_ddbarEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarEB, &error_ddbarEB); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*ddbarEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////DDBAR ODD FORWARD Matrix element +// double ReactionAFB::ddbarOF_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1d = (ReactionTheory::xfx(x1,Q,1)) / x1; +// double f1s = (ReactionTheory::xfx(x1,Q,3)) / x1; +// double f1b = (ReactionTheory::xfx(x1,Q,5)) / x1; +// double f2dbar = (ReactionTheory::xfx(x2,Q,-1)) / x2; +// double f2sbar = (ReactionTheory::xfx(x2,Q,-3)) / x2; +// double f2bbar = (ReactionTheory::xfx(x2,Q,-5)) / x2; +// +// // PDF combinations +// double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; +// +// // Angular integration limits +// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// double qqbar_cos_theta_min = 0; +// +// double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_OF = dsigma*angular_integration_OF; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // D-DBAR +// double ddbarOF = ddbar_PDF*dsigma_OF; +// +// double *propagator = propagators (Minv); +// +// return ddbarOF * propagator[3]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////DDBAR ODD FORWARD Integration +// double ReactionAFB::integration_ddbarOF (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double ddbarOF, error_ddbarOF; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_ddbarOF = { &(ReactionAFB::ddbarOF_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_ddbarOF, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarOF, &error_ddbarOF); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_ddbarOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarOF, &error_ddbarOF); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*ddbarOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////DDBAR ODD BACKWARD Matrix element +// double ReactionAFB::ddbarOB_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1d = (ReactionTheory::xfx(x1,Q,1)) / x1; +// double f1s = (ReactionTheory::xfx(x1,Q,3)) / x1; +// double f1b = (ReactionTheory::xfx(x1,Q,5)) / x1; +// double f2dbar = (ReactionTheory::xfx(x2,Q,-1)) / x2; +// double f2sbar = (ReactionTheory::xfx(x2,Q,-3)) / x2; +// double f2bbar = (ReactionTheory::xfx(x2,Q,-5)) / x2; +// +// // PDF combinations +// double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; +// +// // Angular integration limits +// double qbarq_cos_theta_max = 0; +// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// +// double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_OB = dsigma*angular_integration_OB; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // D-DBAR +// double ddbarOB = ddbar_PDF*dsigma_OB; +// +// double *propagator = propagators (Minv); +// +// return ddbarOB * propagator[3]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////DDBAR ODD BACKWARD Integration +// double ReactionAFB::integration_ddbarOB (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double ddbarOB, error_ddbarOB; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_ddbarOB = { &(ReactionAFB::ddbarOB_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_ddbarOB, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarOB, &error_ddbarOB); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_ddbarOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarOB, &error_ddbarOB); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*ddbarOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////DBARD EVEN FORWARD Matrix element +// double ReactionAFB::dbardEF_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1dbar = (ReactionTheory::xfx(x1,Q,-1)) / x1; +// double f1sbar = (ReactionTheory::xfx(x1,Q,-3)) / x1; +// double f1bbar = (ReactionTheory::xfx(x1,Q,-5)) / x1; +// double f2d = (ReactionTheory::xfx(x2,Q,1)) / x2; +// double f2s = (ReactionTheory::xfx(x2,Q,3)) / x2; +// double f2b = (ReactionTheory::xfx(x2,Q,5)) / x2; +// +// // PDF combinations +// double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; +// +// // Angular integration limits +// double qbarq_cos_theta_max = 0; +// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// +// double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_EB = dsigma*angular_integration_EB; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // DBAR-D +// double dbardEF = dbard_PDF*dsigma_EB; +// +// double *propagator = propagators (Minv); +// +// return dbardEF * propagator[2]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////DBARD EVEN FORWARD Integration +// double ReactionAFB::integration_dbardEF (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double dbardEF, error_dbardEF; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_dbardEF = { &(ReactionAFB::dbardEF_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_dbardEF, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardEF, &error_dbardEF); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_dbardEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardEF, &error_dbardEF); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*dbardEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////DBARD EVEN BACKWARD Matrix element +// double ReactionAFB::dbardEB_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1dbar = (ReactionTheory::xfx(x1,Q,-1)) / x1; +// double f1sbar = (ReactionTheory::xfx(x1,Q,-3)) / x1; +// double f1bbar = (ReactionTheory::xfx(x1,Q,-5)) / x1; +// double f2d = (ReactionTheory::xfx(x2,Q,1)) / x2; +// double f2s = (ReactionTheory::xfx(x2,Q,3)) / x2; +// double f2b = (ReactionTheory::xfx(x2,Q,5)) / x2; +// +// // PDF combinations +// double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; +// +// // Angular integration limits +// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// double qqbar_cos_theta_min = 0; +// +// double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_EF = dsigma*angular_integration_EF; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // DBAR-D +// double dbardEB = dbard_PDF*dsigma_EF; +// +// double *propagator = propagators (Minv); +// +// return dbardEB * propagator[2]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////DBARD EVEN BACKWARD Integration +// double ReactionAFB::integration_dbardEB (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double dbardEB, error_dbardEB; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_dbardEB = { &(ReactionAFB::dbardEB_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_dbardEB, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardEB, &error_dbardEB); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_dbardEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardEB, &error_dbardEB); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*dbardEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////DBARD ODD FORWARD Matrix element +// double ReactionAFB::dbardOF_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1dbar = (ReactionTheory::xfx(x1,Q,-1)) / x1; +// double f1sbar = (ReactionTheory::xfx(x1,Q,-3)) / x1; +// double f1bbar = (ReactionTheory::xfx(x1,Q,-5)) / x1; +// double f2d = (ReactionTheory::xfx(x2,Q,1)) / x2; +// double f2s = (ReactionTheory::xfx(x2,Q,3)) / x2; +// double f2b = (ReactionTheory::xfx(x2,Q,5)) / x2; +// +// // PDF combinations +// double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; +// +// // Angular integration limits +// double qbarq_cos_theta_max = 0; +// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// +// double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_OB = dsigma*angular_integration_OB; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // DBAR-D +// double dbardOF = dbard_PDF*dsigma_OB; +// +// double *propagator = propagators (Minv); +// +// return dbardOF * propagator[3]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////DBARD ODD FORWARD Integration +// double ReactionAFB::integration_dbardOF (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double dbardOF, error_dbardOF; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_dbardOF = { &(ReactionAFB::dbardOF_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_dbardOF, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardOF, &error_dbardOF); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_dbardOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardOF, &error_dbardOF); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*dbardOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } +// +// ////DBARD ODD BACKWARD Matrix element +// double ReactionAFB::dbardOB_funct (double *entries, size_t dim, void *params) +// { +// (void)(dim); /* avoid unused parameter warnings */ +// double yreduced = entries[0]; +// double Minv = entries[1]; +// +// // Partonic cross section parameters +// double Q = Minv; +// double z = pow(Minv,2)/pow(energy,2); +// double y = -(1.0/2.0)*log(z)*(yreduced); +// double x1 = sqrt(z)*exp(y); +// double x2 = sqrt(z)*exp(-y); +// double dsigma_temp = pow(Minv,2)/(96*PI); +// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); +// +// // Call the PDFs +// double f1dbar = (ReactionTheory::xfx(x1,Q,-1)) / x1; +// double f1sbar = (ReactionTheory::xfx(x1,Q,-3)) / x1; +// double f1bbar = (ReactionTheory::xfx(x1,Q,-5)) / x1; +// double f2d = (ReactionTheory::xfx(x2,Q,1)) / x2; +// double f2s = (ReactionTheory::xfx(x2,Q,3)) / x2; +// double f2b = (ReactionTheory::xfx(x2,Q,5)) / x2; +// +// // PDF combinations +// double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; +// +// // Angular integration limits +// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); +// double qqbar_cos_theta_min = 0; +// +// double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); +// +// // Combination with angular integration (Forward - Backward for q-qbar) +// double dsigma_OF = dsigma*angular_integration_OF; +// +// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) +// // DBAR-D +// double dbardOB = dbard_PDF*dsigma_OF; +// +// double *propagator = propagators (Minv); +// +// return dbardOB * propagator[3]; // Multiply the PDFs combination with the correct propagator. +// } +// +// ////DBARD ODD BACKWARD Integration +// double ReactionAFB::integration_dbardOB (double Minv_inf, double Minv_sup) +// { +// double integration_inf[2] = {yreducedmin, Minv_inf}; +// double integration_sup[2] = {yreducedmax, Minv_sup}; +// +// double dbardOB, error_dbardOB; +// // Initialization of the integration (quite a black box) +// gsl_monte_function Integrate_dbardOB = { &(ReactionAFB::dbardOB_funct), dim_integration, 0 }; +// const gsl_rng_type *T; +// gsl_rng *r; +// gsl_rng_env_setup (); +// T = gsl_rng_default; +// r = gsl_rng_alloc (T); +// // Integration +// { +// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); +// gsl_monte_vegas_integrate (&Integrate_dbardOB, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardOB, &error_dbardOB); +// do +// { +// gsl_monte_vegas_integrate (&Integrate_dbardOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardOB, &error_dbardOB); +// } +// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); +// gsl_monte_vegas_free (s); +// } +// +// gsl_rng_free (r); +// +// return 2*dbardOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +// } + double *ReactionAFB::observables (double Minv_inf, double Minv_sup) { @@ -271,12 +1345,10 @@ double *ReactionAFB::observables (double Minv_inf, double Minv_sup) // double XS = Forward + Backward; // double Epsilon_XS = 100.0 / sqrt(XS*lum); // -// // // Reconstructed AFB and statistical absolute uncertainty // double AFB = (Forward - Backward) / (Forward + Backward); // double Delta_AFB = sqrt((1.0-pow(AFB,2)) / (XS*lum)); -// -// + // double *results = new double[4]; // // results[0] = XS; @@ -284,18 +1356,47 @@ double *ReactionAFB::observables (double Minv_inf, double Minv_sup) // results[2] = AFB; // results[3] = Delta_AFB; + + +// // Call the PDFs +// double f1u = (ReactionTheory::xfx(0.01,100,2)) / 0.01; +// printf("f1u(x1 = 0.01, 100, 2)/x1 = %1f \n", f1u); +// +// printf("uubarEF = %1f \n", uubarEF); +// printf("uubarEB = %1f \n", uubarEB); +// printf("uubarOF = %1f \n", uubarOF); +// printf("uubarOB = %1f \n", uubarOB); +// +// printf("ubaruEF = %1f \n", ubaruEF); +// printf("ubaruEB = %1f \n", ubaruEB); +// printf("ubaruOF = %1f \n", ubaruOF); +// printf("ubaruOB = %1f \n", ubaruOB); +// +// printf("ddbarEF = %1f \n", ddbarEF); +// printf("ddbarEB = %1f \n", ddbarEB); +// printf("ddbarOF = %1f \n", ddbarOF); +// printf("ddbarOB = %1f \n", ddbarOB); +// +// printf("dbardEF = %1f \n", dbardEF); +// printf("dbardEB = %1f \n", dbardEB); +// printf("dbardOF = %1f \n", dbardOF); +// printf("dbardOB = %1f \n", dbardOB); +// +// printf("AFB = %1f \n", AFB); + double *results = new double[4]; + results[0] = uubarEF; results[1] = uubarEF; results[2] = uubarEF; results[3] = uubarEF; + + return results; } - - // the class factories extern "C" ReactionAFB* create() { return new ReactionAFB(); @@ -307,6 +1408,7 @@ int ReactionAFB::initAtStart(const string &s) return 0; } + // Main function to compute results at an iteration int ReactionAFB::compute(int dataSetID, valarray<double> &val, map<string, valarray<double> > &err) { @@ -319,18 +1421,9 @@ int ReactionAFB::compute(int dataSetID, valarray<double> &val, map<string, valar auto min = *Minv_min, max = *Minv_max; - printf("%1f \n", min[0]); - printf("%1f \n", max[0]); - - printf("Calling AFB \n"); - -// val[0] = *propagators (min[0]); - -// val[0] = integration_uubarEF(min[0], max[0]); - double *results = observables (min[0], max[0]); - val[0] = results[0]; + val[0] = results[2]; return 0; -- GitLab From 98b32f26db5a54a56d7e60e8f8ba232fa8b91923 Mon Sep 17 00:00:00 2001 From: Oleksandr Zenaiev <oleksandr.zenaiev@cern.ch> Date: Mon, 20 Aug 2018 19:03:49 +0200 Subject: [PATCH 04/11] dummy parameters file for AFB --- reactions/AFB/yaml/parameters.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 reactions/AFB/yaml/parameters.yaml diff --git a/reactions/AFB/yaml/parameters.yaml b/reactions/AFB/yaml/parameters.yaml new file mode 100644 index 000000000..e69de29bb -- GitLab From ad7ac63d04343919811166ab236a20e31d93a7d9 Mon Sep 17 00:00:00 2001 From: Oleksandr Zenaiev <oleksandr.zenaiev@cern.ch> Date: Mon, 20 Aug 2018 19:04:03 +0200 Subject: [PATCH 05/11] access PDFs --- reactions/AFB/src/ReactionAFB.cc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/reactions/AFB/src/ReactionAFB.cc b/reactions/AFB/src/ReactionAFB.cc index 01be3ce53..d76dda777 100644 --- a/reactions/AFB/src/ReactionAFB.cc +++ b/reactions/AFB/src/ReactionAFB.cc @@ -113,6 +113,14 @@ double *ReactionAFB::propagators (double Minv) ////UUBAR EVEN FORWARD Matrix element double ReactionAFB::uubarEF_funct (double *entries, size_t dim, void *params) { + // access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + //std::valarray<double> pdfV(13); + //ptr->xfx(0.001, 100.0, &pdfV[0]); + //std::cout << " xg(100,0.001) (meth 2) = " << pdfV[6] << std::endl; + //std::cout << " xg(100,0.001) (meth 3) = " << ptr->xfx(0.001, 100.0 ,0) << std::endl; + + (void)(dim); /* avoid unused parameter warnings */ double yreduced = entries[0]; double Minv = entries[1]; @@ -129,10 +137,10 @@ double ReactionAFB::uubarEF_funct (double *entries, size_t dim, void *params) // Call the PDFs - double f1u = (ReactionTheory::xfx(x1,Q,2)) / x1; - double f1c = (ReactionTheory::xfx(x1,Q,4)) / x1; - double f2ubar = (ReactionTheory::xfx(x2,Q,-2)) / x2; - double f2cbar = (ReactionTheory::xfx(x2,Q,-4)) / x2; + double f1u = (ptr->xfx(x1,Q,2)) / x1; + double f1c = (ptr->xfx(x1,Q,4)) / x1; + double f2ubar = (ptr->xfx(x2,Q,-2)) / x2; + double f2cbar = (ptr->xfx(x2,Q,-4)) / x2; // PDF combinations double uubar_PDF = f1u*f2ubar + f1c*f2cbar; @@ -164,7 +172,8 @@ double ReactionAFB::integration_uubarEF (double Minv_inf, double Minv_sup) // Initialization of the integration (quite a black box) - gsl_monte_function Integrate_uubarEF = { &(ReactionAFB::uubarEF_funct), dim_integration, 0 }; + //gsl_monte_function Integrate_uubarEF = { &(ReactionAFB::uubarEF_funct), dim_integration, 0 }; + gsl_monte_function Integrate_uubarEF = { &(ReactionAFB::uubarEF_funct), dim_integration, this }; const gsl_rng_type *T; gsl_rng *r; gsl_rng_env_setup (); -- GitLab From 30bc75d43edd82c195d4b231cdb25187a6986aa6 Mon Sep 17 00:00:00 2001 From: Juri Fiaschi <fiaschi@uni-muenster.de> Date: Tue, 21 Aug 2018 13:11:12 +0200 Subject: [PATCH 06/11] final version of ReactionAFB --- reactions/AFB/include/ReactionAFB.h | 2 +- reactions/AFB/src/ReactionAFB.cc | 2474 +++++++++++++-------------- 2 files changed, 1235 insertions(+), 1241 deletions(-) diff --git a/reactions/AFB/include/ReactionAFB.h b/reactions/AFB/include/ReactionAFB.h index e55534053..9b9b5e86c 100644 --- a/reactions/AFB/include/ReactionAFB.h +++ b/reactions/AFB/include/ReactionAFB.h @@ -70,5 +70,5 @@ class ReactionAFB : public ReactionTheory static double dbardOB_funct (double *, size_t, void *); double integration_dbardOB (double, double); - double *observables (double, double); + double AFB (double, double); }; diff --git a/reactions/AFB/src/ReactionAFB.cc b/reactions/AFB/src/ReactionAFB.cc index d76dda777..842ce88b9 100644 --- a/reactions/AFB/src/ReactionAFB.cc +++ b/reactions/AFB/src/ReactionAFB.cc @@ -23,9 +23,8 @@ using namespace std; #define alphaEM 0.0078125 #define sthetaW 0.4817 -// set collider energy and luminosity +// set collider energy #define energy 13000 -#define lum 300 // define acceptance cuts #define eta_cut 2.5 @@ -48,9 +47,7 @@ double yreducedmax = ycut; size_t calls = 10000; - - -//// Function retirning the combination of propagators +//// Function returning the combination of propagators double *ReactionAFB::propagators (double Minv) { const double e = sqrt(4*PI*alphaEM); @@ -113,13 +110,8 @@ double *ReactionAFB::propagators (double Minv) ////UUBAR EVEN FORWARD Matrix element double ReactionAFB::uubarEF_funct (double *entries, size_t dim, void *params) { - // access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; - //std::valarray<double> pdfV(13); - //ptr->xfx(0.001, 100.0, &pdfV[0]); - //std::cout << " xg(100,0.001) (meth 2) = " << pdfV[6] << std::endl; - //std::cout << " xg(100,0.001) (meth 3) = " << ptr->xfx(0.001, 100.0 ,0) << std::endl; - + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; (void)(dim); /* avoid unused parameter warnings */ double yreduced = entries[0]; @@ -134,8 +126,6 @@ double ReactionAFB::uubarEF_funct (double *entries, size_t dim, void *params) double dsigma_temp = pow(Minv,2)/(96*PI); double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs double f1u = (ptr->xfx(x1,Q,2)) / x1; double f1c = (ptr->xfx(x1,Q,4)) / x1; @@ -170,9 +160,7 @@ double ReactionAFB::integration_uubarEF (double Minv_inf, double Minv_sup) double integration_sup[2] = {yreducedmax, Minv_sup}; double uubarEF, error_uubarEF; - // Initialization of the integration (quite a black box) - - //gsl_monte_function Integrate_uubarEF = { &(ReactionAFB::uubarEF_funct), dim_integration, 0 }; + // Initialization of the integration gsl_monte_function Integrate_uubarEF = { &(ReactionAFB::uubarEF_funct), dim_integration, this }; const gsl_rng_type *T; gsl_rng *r; @@ -197,1242 +185,1248 @@ double ReactionAFB::integration_uubarEF (double Minv_inf, double Minv_sup) } -// ////UUBAR EVEN BACKWARD Matrix element -// double ReactionAFB::uubarEB_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1u = (ReactionTheory::xfx(x1,Q,2)) / x1; -// double f1c = (ReactionTheory::xfx(x1,Q,4)) / x1; -// double f2ubar = (ReactionTheory::xfx(x2,Q,-2)) / x2; -// double f2cbar = (ReactionTheory::xfx(x2,Q,-4)) / x2; -// -// // PDF combinations -// double uubar_PDF = f1u*f2ubar + f1c*f2cbar; -// -// // Angular integration limits -// double qbarq_cos_theta_max = 0; -// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// -// double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_EB = dsigma*angular_integration_EB; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // U-UBAR -// double uubarEB = uubar_PDF*dsigma_EB; -// -// double *propagator = propagators (Minv); -// -// return uubarEB * propagator[0]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////UUBAR EVEN BACKWARD Integration -// double ReactionAFB::integration_uubarEB (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double uubarEB, error_uubarEB; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_uubarEB = { &(ReactionAFB::uubarEB_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_uubarEB, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarEB, &error_uubarEB); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_uubarEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarEB, &error_uubarEB); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*uubarEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////UUBAR ODD FORWARD Matrix element -// double ReactionAFB::uubarOF_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1u = (ReactionTheory::xfx(x1,Q,2)) / x1; -// double f1c = (ReactionTheory::xfx(x1,Q,4)) / x1; -// double f2ubar = (ReactionTheory::xfx(x2,Q,-2)) / x2; -// double f2cbar = (ReactionTheory::xfx(x2,Q,-4)) / x2; -// -// // PDF combinations -// double uubar_PDF = f1u*f2ubar + f1c*f2cbar; -// -// // Angular integration limits -// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// double qqbar_cos_theta_min = 0; -// -// double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_OF = dsigma*angular_integration_OF; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // U-UBAR -// double uubarOF = uubar_PDF*dsigma_OF; -// -// double *propagator = propagators (Minv); -// -// return uubarOF * propagator[1]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////UUBAR ODD FORWARD Integration -// double ReactionAFB::integration_uubarOF (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double uubarOF, error_uubarOF; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_uubarOF = { &(ReactionAFB::uubarOF_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_uubarOF, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarOF, &error_uubarOF); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_uubarOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarOF, &error_uubarOF); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*uubarOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////UUBAR ODD BACKWARD Matrix element -// double ReactionAFB::uubarOB_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1u = (ReactionTheory::xfx(x1,Q,2)) / x1; -// double f1c = (ReactionTheory::xfx(x1,Q,4)) / x1; -// double f2ubar = (ReactionTheory::xfx(x2,Q,-2)) / x2; -// double f2cbar = (ReactionTheory::xfx(x2,Q,-4)) / x2; -// -// // PDF combinations -// double uubar_PDF = f1u*f2ubar + f1c*f2cbar; -// -// // Angular integration limits -// double qbarq_cos_theta_max = 0; -// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// -// double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_OB = dsigma*angular_integration_OB; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // U-UBAR -// double uubarOB = uubar_PDF*dsigma_OB; -// -// double *propagator = propagators (Minv); -// -// return uubarOB * propagator[1]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////UUBAR ODD BACKWARD Integration -// double ReactionAFB::integration_uubarOB (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double uubarOB, error_uubarOB; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_uubarOB = { &(ReactionAFB::uubarOB_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_uubarOB, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarOB, &error_uubarOB); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_uubarOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarOB, &error_uubarOB); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*uubarOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////UBARU EVEN FORWARD Matrix element -// double ReactionAFB::ubaruEF_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1ubar = (ReactionTheory::xfx(x1,Q,-2)) / x1; -// double f1cbar = (ReactionTheory::xfx(x1,Q,-4)) / x1; -// double f2u = (ReactionTheory::xfx(x2,Q,2)) / x2; -// double f2c = (ReactionTheory::xfx(x2,Q,4)) / x2; -// -// // PDF combinations -// double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; -// -// // Angular integration limits -// double qbarq_cos_theta_max = 0; -// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// -// double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_EB = dsigma*angular_integration_EB; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // UBAR-U -// double ubaruEF = ubaru_PDF*dsigma_EB; -// -// double *propagator = propagators (Minv); -// -// return ubaruEF * propagator[0]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////UBARU EVEN FORWARD Integration -// double ReactionAFB::integration_ubaruEF (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double ubaruEF, error_ubaruEF; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_ubaruEF = { &(ReactionAFB::ubaruEF_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_ubaruEF, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruEF, &error_ubaruEF); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_ubaruEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruEF, &error_ubaruEF); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*ubaruEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////UBARU EVEN BACKWARD Matrix element -// double ReactionAFB::ubaruEB_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1ubar = (ReactionTheory::xfx(x1,Q,-2)) / x1; -// double f1cbar = (ReactionTheory::xfx(x1,Q,-4)) / x1; -// double f2u = (ReactionTheory::xfx(x2,Q,2)) / x2; -// double f2c = (ReactionTheory::xfx(x2,Q,4)) / x2; -// -// // PDF combinations -// double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; -// -// // Angular integration limits -// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// double qqbar_cos_theta_min = 0; -// -// double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_EF = dsigma*angular_integration_EF; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // UBAR-U -// double ubaruEB = ubaru_PDF*dsigma_EF; -// -// double *propagator = propagators (Minv); -// -// return ubaruEB * propagator[0]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////UUBAR EVEN BACKWARD Integration -// double ReactionAFB::integration_ubaruEB (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double ubaruEB, error_ubaruEB; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_ubaruEB = { &(ReactionAFB::ubaruEB_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_ubaruEB, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruEB, &error_ubaruEB); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_ubaruEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruEB, &error_ubaruEB); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*ubaruEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////UBARU ODD FORWARD Matrix element -// double ReactionAFB::ubaruOF_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1ubar = (ReactionTheory::xfx(x1,Q,-2)) / x1; -// double f1cbar = (ReactionTheory::xfx(x1,Q,-4)) / x1; -// double f2u = (ReactionTheory::xfx(x2,Q,2)) / x2; -// double f2c = (ReactionTheory::xfx(x2,Q,4)) / x2; -// -// // PDF combinations -// double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; -// -// // Angular integration limits -// double qbarq_cos_theta_max = 0; -// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// -// double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_OB = dsigma*angular_integration_OB; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // UBAR-U -// double ubaruOF = ubaru_PDF*dsigma_OB; -// -// double *propagator = propagators (Minv); -// -// return ubaruOF * propagator[1]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////UBARU ODD FORWARD Integration -// double ReactionAFB::integration_ubaruOF (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double ubaruOF, error_ubaruOF; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_ubaruOF = { &(ReactionAFB::ubaruOF_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_ubaruOF, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruOF, &error_ubaruOF); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_ubaruOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruOF, &error_ubaruOF); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*ubaruOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////UBARU ODD BACKWARD Matrix element -// double ReactionAFB::ubaruOB_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1ubar = (ReactionTheory::xfx(x1,Q,-2)) / x1; -// double f1cbar = (ReactionTheory::xfx(x1,Q,-4)) / x1; -// double f2u = (ReactionTheory::xfx(x2,Q,2)) / x2; -// double f2c = (ReactionTheory::xfx(x2,Q,4)) / x2; -// -// // PDF combinations -// double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; -// -// // Angular integration limits -// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// double qqbar_cos_theta_min = 0; -// -// double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_OF = dsigma*angular_integration_OF; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // UBAR-U -// double ubaruOB = ubaru_PDF*dsigma_OF; -// -// double *propagator = propagators (Minv); -// -// return ubaruOB * propagator[1]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////UBARU ODD BACKWARD Integration -// double ReactionAFB::integration_ubaruOB (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double ubaruOB, error_ubaruOB; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_ubaruOB = { &(ReactionAFB::ubaruOB_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_ubaruOB, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruOB, &error_ubaruOB); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_ubaruOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruOB, &error_ubaruOB); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*ubaruOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////DDBAR EVEN FORWARD Matrix element -// double ReactionAFB::ddbarEF_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1d = (ReactionTheory::xfx(x1,Q,1)) / x1; -// double f1s = (ReactionTheory::xfx(x1,Q,3)) / x1; -// double f1b = (ReactionTheory::xfx(x1,Q,5)) / x1; -// double f2dbar = (ReactionTheory::xfx(x2,Q,-1)) / x2; -// double f2sbar = (ReactionTheory::xfx(x2,Q,-3)) / x2; -// double f2bbar = (ReactionTheory::xfx(x2,Q,-5)) / x2; -// -// // PDF combinations -// double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; -// -// // Angular integration limits -// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// double qqbar_cos_theta_min = 0; -// -// double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_EF = dsigma*angular_integration_EF; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // D-DBAR -// double ddbarEF = ddbar_PDF*dsigma_EF; -// -// double *propagator = propagators (Minv); -// -// return ddbarEF * propagator[2]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////DDBAR EVEN FORWARD Integration -// double ReactionAFB::integration_ddbarEF (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double ddbarEF, error_ddbarEF; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_ddbarEF = { &(ReactionAFB::ddbarEF_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_ddbarEF, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarEF, &error_ddbarEF); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_ddbarEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarEF, &error_ddbarEF); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*ddbarEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////DDBAR EVEN BACKWARD Matrix element -// double ReactionAFB::ddbarEB_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1d = (ReactionTheory::xfx(x1,Q,1)) / x1; -// double f1s = (ReactionTheory::xfx(x1,Q,3)) / x1; -// double f1b = (ReactionTheory::xfx(x1,Q,5)) / x1; -// double f2dbar = (ReactionTheory::xfx(x2,Q,-1)) / x2; -// double f2sbar = (ReactionTheory::xfx(x2,Q,-3)) / x2; -// double f2bbar = (ReactionTheory::xfx(x2,Q,-5)) / x2; -// -// // PDF combinations -// double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; -// -// // Angular integration limits -// double qbarq_cos_theta_max = 0; -// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// -// double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_EB = dsigma*angular_integration_EB; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // D-DBAR -// double ddbarEB = ddbar_PDF*dsigma_EB; -// -// double *propagator = propagators (Minv); -// -// return ddbarEB * propagator[2]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////DDBAR EVEN BACKWARD Integration -// double ReactionAFB::integration_ddbarEB (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double ddbarEB, error_ddbarEB; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_ddbarEB = { &(ReactionAFB::ddbarEB_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_ddbarEB, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarEB, &error_ddbarEB); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_ddbarEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarEB, &error_ddbarEB); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*ddbarEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////DDBAR ODD FORWARD Matrix element -// double ReactionAFB::ddbarOF_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1d = (ReactionTheory::xfx(x1,Q,1)) / x1; -// double f1s = (ReactionTheory::xfx(x1,Q,3)) / x1; -// double f1b = (ReactionTheory::xfx(x1,Q,5)) / x1; -// double f2dbar = (ReactionTheory::xfx(x2,Q,-1)) / x2; -// double f2sbar = (ReactionTheory::xfx(x2,Q,-3)) / x2; -// double f2bbar = (ReactionTheory::xfx(x2,Q,-5)) / x2; -// -// // PDF combinations -// double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; -// -// // Angular integration limits -// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// double qqbar_cos_theta_min = 0; -// -// double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_OF = dsigma*angular_integration_OF; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // D-DBAR -// double ddbarOF = ddbar_PDF*dsigma_OF; -// -// double *propagator = propagators (Minv); -// -// return ddbarOF * propagator[3]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////DDBAR ODD FORWARD Integration -// double ReactionAFB::integration_ddbarOF (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double ddbarOF, error_ddbarOF; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_ddbarOF = { &(ReactionAFB::ddbarOF_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_ddbarOF, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarOF, &error_ddbarOF); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_ddbarOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarOF, &error_ddbarOF); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*ddbarOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////DDBAR ODD BACKWARD Matrix element -// double ReactionAFB::ddbarOB_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1d = (ReactionTheory::xfx(x1,Q,1)) / x1; -// double f1s = (ReactionTheory::xfx(x1,Q,3)) / x1; -// double f1b = (ReactionTheory::xfx(x1,Q,5)) / x1; -// double f2dbar = (ReactionTheory::xfx(x2,Q,-1)) / x2; -// double f2sbar = (ReactionTheory::xfx(x2,Q,-3)) / x2; -// double f2bbar = (ReactionTheory::xfx(x2,Q,-5)) / x2; -// -// // PDF combinations -// double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; -// -// // Angular integration limits -// double qbarq_cos_theta_max = 0; -// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// -// double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_OB = dsigma*angular_integration_OB; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // D-DBAR -// double ddbarOB = ddbar_PDF*dsigma_OB; -// -// double *propagator = propagators (Minv); -// -// return ddbarOB * propagator[3]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////DDBAR ODD BACKWARD Integration -// double ReactionAFB::integration_ddbarOB (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double ddbarOB, error_ddbarOB; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_ddbarOB = { &(ReactionAFB::ddbarOB_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_ddbarOB, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarOB, &error_ddbarOB); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_ddbarOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarOB, &error_ddbarOB); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*ddbarOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////DBARD EVEN FORWARD Matrix element -// double ReactionAFB::dbardEF_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1dbar = (ReactionTheory::xfx(x1,Q,-1)) / x1; -// double f1sbar = (ReactionTheory::xfx(x1,Q,-3)) / x1; -// double f1bbar = (ReactionTheory::xfx(x1,Q,-5)) / x1; -// double f2d = (ReactionTheory::xfx(x2,Q,1)) / x2; -// double f2s = (ReactionTheory::xfx(x2,Q,3)) / x2; -// double f2b = (ReactionTheory::xfx(x2,Q,5)) / x2; -// -// // PDF combinations -// double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; -// -// // Angular integration limits -// double qbarq_cos_theta_max = 0; -// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// -// double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_EB = dsigma*angular_integration_EB; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // DBAR-D -// double dbardEF = dbard_PDF*dsigma_EB; -// -// double *propagator = propagators (Minv); -// -// return dbardEF * propagator[2]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////DBARD EVEN FORWARD Integration -// double ReactionAFB::integration_dbardEF (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double dbardEF, error_dbardEF; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_dbardEF = { &(ReactionAFB::dbardEF_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_dbardEF, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardEF, &error_dbardEF); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_dbardEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardEF, &error_dbardEF); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*dbardEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////DBARD EVEN BACKWARD Matrix element -// double ReactionAFB::dbardEB_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1dbar = (ReactionTheory::xfx(x1,Q,-1)) / x1; -// double f1sbar = (ReactionTheory::xfx(x1,Q,-3)) / x1; -// double f1bbar = (ReactionTheory::xfx(x1,Q,-5)) / x1; -// double f2d = (ReactionTheory::xfx(x2,Q,1)) / x2; -// double f2s = (ReactionTheory::xfx(x2,Q,3)) / x2; -// double f2b = (ReactionTheory::xfx(x2,Q,5)) / x2; -// -// // PDF combinations -// double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; -// -// // Angular integration limits -// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// double qqbar_cos_theta_min = 0; -// -// double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_EF = dsigma*angular_integration_EF; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // DBAR-D -// double dbardEB = dbard_PDF*dsigma_EF; -// -// double *propagator = propagators (Minv); -// -// return dbardEB * propagator[2]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////DBARD EVEN BACKWARD Integration -// double ReactionAFB::integration_dbardEB (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double dbardEB, error_dbardEB; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_dbardEB = { &(ReactionAFB::dbardEB_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_dbardEB, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardEB, &error_dbardEB); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_dbardEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardEB, &error_dbardEB); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*dbardEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////DBARD ODD FORWARD Matrix element -// double ReactionAFB::dbardOF_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1dbar = (ReactionTheory::xfx(x1,Q,-1)) / x1; -// double f1sbar = (ReactionTheory::xfx(x1,Q,-3)) / x1; -// double f1bbar = (ReactionTheory::xfx(x1,Q,-5)) / x1; -// double f2d = (ReactionTheory::xfx(x2,Q,1)) / x2; -// double f2s = (ReactionTheory::xfx(x2,Q,3)) / x2; -// double f2b = (ReactionTheory::xfx(x2,Q,5)) / x2; -// -// // PDF combinations -// double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; -// -// // Angular integration limits -// double qbarq_cos_theta_max = 0; -// double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// -// double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_OB = dsigma*angular_integration_OB; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // DBAR-D -// double dbardOF = dbard_PDF*dsigma_OB; -// -// double *propagator = propagators (Minv); -// -// return dbardOF * propagator[3]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////DBARD ODD FORWARD Integration -// double ReactionAFB::integration_dbardOF (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double dbardOF, error_dbardOF; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_dbardOF = { &(ReactionAFB::dbardOF_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_dbardOF, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardOF, &error_dbardOF); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_dbardOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardOF, &error_dbardOF); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*dbardOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } -// -// ////DBARD ODD BACKWARD Matrix element -// double ReactionAFB::dbardOB_funct (double *entries, size_t dim, void *params) -// { -// (void)(dim); /* avoid unused parameter warnings */ -// double yreduced = entries[0]; -// double Minv = entries[1]; -// -// // Partonic cross section parameters -// double Q = Minv; -// double z = pow(Minv,2)/pow(energy,2); -// double y = -(1.0/2.0)*log(z)*(yreduced); -// double x1 = sqrt(z)*exp(y); -// double x2 = sqrt(z)*exp(-y); -// double dsigma_temp = pow(Minv,2)/(96*PI); -// double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); -// -// // Call the PDFs -// double f1dbar = (ReactionTheory::xfx(x1,Q,-1)) / x1; -// double f1sbar = (ReactionTheory::xfx(x1,Q,-3)) / x1; -// double f1bbar = (ReactionTheory::xfx(x1,Q,-5)) / x1; -// double f2d = (ReactionTheory::xfx(x2,Q,1)) / x2; -// double f2s = (ReactionTheory::xfx(x2,Q,3)) / x2; -// double f2b = (ReactionTheory::xfx(x2,Q,5)) / x2; -// -// // PDF combinations -// double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; -// -// // Angular integration limits -// double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); -// double qqbar_cos_theta_min = 0; -// -// double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); -// -// // Combination with angular integration (Forward - Backward for q-qbar) -// double dsigma_OF = dsigma*angular_integration_OF; -// -// // Covolution with PDFs (flipping direction for q-qbar & qbar-q) -// // DBAR-D -// double dbardOB = dbard_PDF*dsigma_OF; -// -// double *propagator = propagators (Minv); -// -// return dbardOB * propagator[3]; // Multiply the PDFs combination with the correct propagator. -// } -// -// ////DBARD ODD BACKWARD Integration -// double ReactionAFB::integration_dbardOB (double Minv_inf, double Minv_sup) -// { -// double integration_inf[2] = {yreducedmin, Minv_inf}; -// double integration_sup[2] = {yreducedmax, Minv_sup}; -// -// double dbardOB, error_dbardOB; -// // Initialization of the integration (quite a black box) -// gsl_monte_function Integrate_dbardOB = { &(ReactionAFB::dbardOB_funct), dim_integration, 0 }; -// const gsl_rng_type *T; -// gsl_rng *r; -// gsl_rng_env_setup (); -// T = gsl_rng_default; -// r = gsl_rng_alloc (T); -// // Integration -// { -// gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); -// gsl_monte_vegas_integrate (&Integrate_dbardOB, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardOB, &error_dbardOB); -// do -// { -// gsl_monte_vegas_integrate (&Integrate_dbardOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardOB, &error_dbardOB); -// } -// while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); -// gsl_monte_vegas_free (s); -// } -// -// gsl_rng_free (r); -// -// return 2*dbardOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. -// } - - -double *ReactionAFB::observables (double Minv_inf, double Minv_sup) +////UUBAR EVEN BACKWARD Matrix element +double ReactionAFB::uubarEB_funct (double *entries, size_t dim, void *params) { - double uubarEF = integration_uubarEF (Minv_inf, Minv_sup); -// double uubarEB = integration_uubarEB (Minv_inf, Minv_sup); -// double uubarOF = integration_uubarOF (Minv_inf, Minv_sup); -// double uubarOB = integration_uubarOB (Minv_inf, Minv_sup); -// -// double ubaruEF = integration_ubaruEF (Minv_inf, Minv_sup); -// double ubaruEB = integration_ubaruEB (Minv_inf, Minv_sup); -// double ubaruOF = integration_ubaruOF (Minv_inf, Minv_sup); -// double ubaruOB = integration_ubaruOB (Minv_inf, Minv_sup); -// -// double ddbarEF = integration_ddbarEF (Minv_inf, Minv_sup); -// double ddbarEB = integration_ddbarEB (Minv_inf, Minv_sup); -// double ddbarOF = integration_ddbarOF (Minv_inf, Minv_sup); -// double ddbarOB = integration_ddbarOB (Minv_inf, Minv_sup); -// -// double dbardEF = integration_dbardEF (Minv_inf, Minv_sup); -// double dbardEB = integration_dbardEB (Minv_inf, Minv_sup); -// double dbardOF = integration_dbardOF (Minv_inf, Minv_sup); -// double dbardOB = integration_dbardOB (Minv_inf, Minv_sup); -// -// // Reconstructed Forward and Backward -// double Forward = uubarEF+ubaruEF+ddbarEF+dbardEF+uubarOF+ubaruOF+ddbarOF+dbardOF; -// double Backward = uubarEB+ubaruEB+ddbarEB+dbardEB+uubarOB+ubaruOB+ddbarOB+dbardOB; -// -// // Cross section and statistical relative uncertainty -// double XS = Forward + Backward; -// double Epsilon_XS = 100.0 / sqrt(XS*lum); -// -// // Reconstructed AFB and statistical absolute uncertainty -// double AFB = (Forward - Backward) / (Forward + Backward); -// double Delta_AFB = sqrt((1.0-pow(AFB,2)) / (XS*lum)); - -// double *results = new double[4]; -// -// results[0] = XS; -// results[1] = Epsilon_XS; -// results[2] = AFB; -// results[3] = Delta_AFB; - - - -// // Call the PDFs -// double f1u = (ReactionTheory::xfx(0.01,100,2)) / 0.01; -// printf("f1u(x1 = 0.01, 100, 2)/x1 = %1f \n", f1u); -// -// printf("uubarEF = %1f \n", uubarEF); -// printf("uubarEB = %1f \n", uubarEB); -// printf("uubarOF = %1f \n", uubarOF); -// printf("uubarOB = %1f \n", uubarOB); -// -// printf("ubaruEF = %1f \n", ubaruEF); -// printf("ubaruEB = %1f \n", ubaruEB); -// printf("ubaruOF = %1f \n", ubaruOF); -// printf("ubaruOB = %1f \n", ubaruOB); -// -// printf("ddbarEF = %1f \n", ddbarEF); -// printf("ddbarEB = %1f \n", ddbarEB); -// printf("ddbarOF = %1f \n", ddbarOF); -// printf("ddbarOB = %1f \n", ddbarOB); -// -// printf("dbardEF = %1f \n", dbardEF); -// printf("dbardEB = %1f \n", dbardEB); -// printf("dbardOF = %1f \n", dbardOF); -// printf("dbardOB = %1f \n", dbardOB); -// -// printf("AFB = %1f \n", AFB); - - double *results = new double[4]; - - results[0] = uubarEF; - results[1] = uubarEF; - results[2] = uubarEF; - results[3] = uubarEF; - - - - - return results; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1u = (ptr->xfx(x1,Q,2)) / x1; + double f1c = (ptr->xfx(x1,Q,4)) / x1; + double f2ubar = (ptr->xfx(x2,Q,-2)) / x2; + double f2cbar = (ptr->xfx(x2,Q,-4)) / x2; + + // PDF combinations + double uubar_PDF = f1u*f2ubar + f1c*f2cbar; + + // Angular integration limits + double qbarq_cos_theta_max = 0; + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + + double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_EB = dsigma*angular_integration_EB; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // U-UBAR + double uubarEB = uubar_PDF*dsigma_EB; + + double *propagator = propagators (Minv); + + return uubarEB * propagator[0]; // Multiply the PDFs combination with the correct propagator. } -// the class factories -extern "C" ReactionAFB* create() { - return new ReactionAFB(); +////UUBAR EVEN BACKWARD Integration +double ReactionAFB::integration_uubarEB (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double uubarEB, error_uubarEB; + // Initialization of the integration + gsl_monte_function Integrate_uubarEB = { &(ReactionAFB::uubarEB_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_uubarEB, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarEB, &error_uubarEB); + do + { + gsl_monte_vegas_integrate (&Integrate_uubarEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarEB, &error_uubarEB); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*uubarEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. } -// Initialize at the start of the computation -int ReactionAFB::initAtStart(const string &s) +////UUBAR ODD FORWARD Matrix element +double ReactionAFB::uubarOF_funct (double *entries, size_t dim, void *params) { - return 0; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1u = (ptr->xfx(x1,Q,2)) / x1; + double f1c = (ptr->xfx(x1,Q,4)) / x1; + double f2ubar = (ptr->xfx(x2,Q,-2)) / x2; + double f2cbar = (ptr->xfx(x2,Q,-4)) / x2; + + // PDF combinations + double uubar_PDF = f1u*f2ubar + f1c*f2cbar; + + // Angular integration limits + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_min = 0; + + double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_OF = dsigma*angular_integration_OF; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // U-UBAR + double uubarOF = uubar_PDF*dsigma_OF; + + double *propagator = propagators (Minv); + + return uubarOF * propagator[1]; // Multiply the PDFs combination with the correct propagator. } +////UUBAR ODD FORWARD Integration +double ReactionAFB::integration_uubarOF (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double uubarOF, error_uubarOF; + // Initialization of the integration + gsl_monte_function Integrate_uubarOF = { &(ReactionAFB::uubarOF_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_uubarOF, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarOF, &error_uubarOF); + do + { + gsl_monte_vegas_integrate (&Integrate_uubarOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarOF, &error_uubarOF); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*uubarOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} -// Main function to compute results at an iteration -int ReactionAFB::compute(int dataSetID, valarray<double> &val, map<string, valarray<double> > &err) +////UUBAR ODD BACKWARD Matrix element +double ReactionAFB::uubarOB_funct (double *entries, size_t dim, void *params) { - auto *Minv_min = GetBinValues(dataSetID,"Minv_min"), *Minv_max = GetBinValues(dataSetID,"Minv_max"); - if (Minv_min == nullptr || Minv_max == nullptr) { - std::cout << "\n\nFATAL ERROR" << std::endl; - std::cout << "CHECK THE DATAFILE !!!" << std::endl; - return 1; - } + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1u = (ptr->xfx(x1,Q,2)) / x1; + double f1c = (ptr->xfx(x1,Q,4)) / x1; + double f2ubar = (ptr->xfx(x2,Q,-2)) / x2; + double f2cbar = (ptr->xfx(x2,Q,-4)) / x2; - auto min = *Minv_min, max = *Minv_max; + // PDF combinations + double uubar_PDF = f1u*f2ubar + f1c*f2cbar; + + // Angular integration limits + double qbarq_cos_theta_max = 0; + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + + double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_OB = dsigma*angular_integration_OB; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // U-UBAR + double uubarOB = uubar_PDF*dsigma_OB; + + double *propagator = propagators (Minv); + + return uubarOB * propagator[1]; // Multiply the PDFs combination with the correct propagator. +} + +////UUBAR ODD BACKWARD Integration +double ReactionAFB::integration_uubarOB (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double uubarOB, error_uubarOB; + // Initialization of the integration + gsl_monte_function Integrate_uubarOB = { &(ReactionAFB::uubarOB_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_uubarOB, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarOB, &error_uubarOB); + do + { + gsl_monte_vegas_integrate (&Integrate_uubarOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarOB, &error_uubarOB); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*uubarOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + +////UBARU EVEN FORWARD Matrix element +double ReactionAFB::ubaruEF_funct (double *entries, size_t dim, void *params) +{ + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; - double *results = observables (min[0], max[0]); + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1ubar = (ptr->xfx(x1,Q,-2)) / x1; + double f1cbar = (ptr->xfx(x1,Q,-4)) / x1; + double f2u = (ptr->xfx(x2,Q,2)) / x2; + double f2c = (ptr->xfx(x2,Q,4)) / x2; + + // PDF combinations + double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; + + // Angular integration limits + double qbarq_cos_theta_max = 0; + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + + double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_EB = dsigma*angular_integration_EB; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // UBAR-U + double ubaruEF = ubaru_PDF*dsigma_EB; + + double *propagator = propagators (Minv); + + return ubaruEF * propagator[0]; // Multiply the PDFs combination with the correct propagator. +} + +////UBARU EVEN FORWARD Integration +double ReactionAFB::integration_ubaruEF (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double ubaruEF, error_ubaruEF; + // Initialization of the integration + gsl_monte_function Integrate_ubaruEF = { &(ReactionAFB::ubaruEF_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_ubaruEF, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruEF, &error_ubaruEF); + do + { + gsl_monte_vegas_integrate (&Integrate_ubaruEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruEF, &error_ubaruEF); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); - val[0] = results[2]; + return 2*ubaruEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + +////UBARU EVEN BACKWARD Matrix element +double ReactionAFB::ubaruEB_funct (double *entries, size_t dim, void *params) +{ + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1ubar = (ptr->xfx(x1,Q,-2)) / x1; + double f1cbar = (ptr->xfx(x1,Q,-4)) / x1; + double f2u = (ptr->xfx(x2,Q,2)) / x2; + double f2c = (ptr->xfx(x2,Q,4)) / x2; + + // PDF combinations + double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; + + // Angular integration limits + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_min = 0; + + double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_EF = dsigma*angular_integration_EF; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // UBAR-U + double ubaruEB = ubaru_PDF*dsigma_EF; + + double *propagator = propagators (Minv); + + return ubaruEB * propagator[0]; // Multiply the PDFs combination with the correct propagator. +} + +////UUBAR EVEN BACKWARD Integration +double ReactionAFB::integration_ubaruEB (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double ubaruEB, error_ubaruEB; + // Initialization of the integration + gsl_monte_function Integrate_ubaruEB = { &(ReactionAFB::ubaruEB_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_ubaruEB, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruEB, &error_ubaruEB); + do + { + gsl_monte_vegas_integrate (&Integrate_ubaruEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruEB, &error_ubaruEB); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*ubaruEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + +////UBARU ODD FORWARD Matrix element +double ReactionAFB::ubaruOF_funct (double *entries, size_t dim, void *params) +{ + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1ubar = (ptr->xfx(x1,Q,-2)) / x1; + double f1cbar = (ptr->xfx(x1,Q,-4)) / x1; + double f2u = (ptr->xfx(x2,Q,2)) / x2; + double f2c = (ptr->xfx(x2,Q,4)) / x2; + + // PDF combinations + double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; + + // Angular integration limits + double qbarq_cos_theta_max = 0; + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + + double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_OB = dsigma*angular_integration_OB; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // UBAR-U + double ubaruOF = ubaru_PDF*dsigma_OB; + + double *propagator = propagators (Minv); + + return ubaruOF * propagator[1]; // Multiply the PDFs combination with the correct propagator. +} + +////UBARU ODD FORWARD Integration +double ReactionAFB::integration_ubaruOF (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double ubaruOF, error_ubaruOF; + // Initialization of the integration + gsl_monte_function Integrate_ubaruOF = { &(ReactionAFB::ubaruOF_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_ubaruOF, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruOF, &error_ubaruOF); + do + { + gsl_monte_vegas_integrate (&Integrate_ubaruOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruOF, &error_ubaruOF); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*ubaruOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + +////UBARU ODD BACKWARD Matrix element +double ReactionAFB::ubaruOB_funct (double *entries, size_t dim, void *params) +{ + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1ubar = (ptr->xfx(x1,Q,-2)) / x1; + double f1cbar = (ptr->xfx(x1,Q,-4)) / x1; + double f2u = (ptr->xfx(x2,Q,2)) / x2; + double f2c = (ptr->xfx(x2,Q,4)) / x2; + + // PDF combinations + double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; + + // Angular integration limits + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_min = 0; + + double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_OF = dsigma*angular_integration_OF; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // UBAR-U + double ubaruOB = ubaru_PDF*dsigma_OF; + + double *propagator = propagators (Minv); + + return ubaruOB * propagator[1]; // Multiply the PDFs combination with the correct propagator. +} + +////UBARU ODD BACKWARD Integration +double ReactionAFB::integration_ubaruOB (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double ubaruOB, error_ubaruOB; + // Initialization of the integration + gsl_monte_function Integrate_ubaruOB = { &(ReactionAFB::ubaruOB_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_ubaruOB, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruOB, &error_ubaruOB); + do + { + gsl_monte_vegas_integrate (&Integrate_ubaruOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruOB, &error_ubaruOB); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*ubaruOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + +////DDBAR EVEN FORWARD Matrix element +double ReactionAFB::ddbarEF_funct (double *entries, size_t dim, void *params) +{ + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1d = (ptr->xfx(x1,Q,1)) / x1; + double f1s = (ptr->xfx(x1,Q,3)) / x1; + double f1b = (ptr->xfx(x1,Q,5)) / x1; + double f2dbar = (ptr->xfx(x2,Q,-1)) / x2; + double f2sbar = (ptr->xfx(x2,Q,-3)) / x2; + double f2bbar = (ptr->xfx(x2,Q,-5)) / x2; + + // PDF combinations + double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; + + // Angular integration limits + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_min = 0; + + double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_EF = dsigma*angular_integration_EF; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // D-DBAR + double ddbarEF = ddbar_PDF*dsigma_EF; + + double *propagator = propagators (Minv); + + return ddbarEF * propagator[2]; // Multiply the PDFs combination with the correct propagator. +} + +////DDBAR EVEN FORWARD Integration +double ReactionAFB::integration_ddbarEF (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double ddbarEF, error_ddbarEF; + // Initialization of the integration + gsl_monte_function Integrate_ddbarEF = { &(ReactionAFB::ddbarEF_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_ddbarEF, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarEF, &error_ddbarEF); + do + { + gsl_monte_vegas_integrate (&Integrate_ddbarEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarEF, &error_ddbarEF); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*ddbarEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + +////DDBAR EVEN BACKWARD Matrix element +double ReactionAFB::ddbarEB_funct (double *entries, size_t dim, void *params) +{ + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1d = (ptr->xfx(x1,Q,1)) / x1; + double f1s = (ptr->xfx(x1,Q,3)) / x1; + double f1b = (ptr->xfx(x1,Q,5)) / x1; + double f2dbar = (ptr->xfx(x2,Q,-1)) / x2; + double f2sbar = (ptr->xfx(x2,Q,-3)) / x2; + double f2bbar = (ptr->xfx(x2,Q,-5)) / x2; + + // PDF combinations + double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; + + // Angular integration limits + double qbarq_cos_theta_max = 0; + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + + double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_EB = dsigma*angular_integration_EB; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // D-DBAR + double ddbarEB = ddbar_PDF*dsigma_EB; + + double *propagator = propagators (Minv); + + return ddbarEB * propagator[2]; // Multiply the PDFs combination with the correct propagator. +} + +////DDBAR EVEN BACKWARD Integration +double ReactionAFB::integration_ddbarEB (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double ddbarEB, error_ddbarEB; + // Initialization of the integration + gsl_monte_function Integrate_ddbarEB = { &(ReactionAFB::ddbarEB_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_ddbarEB, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarEB, &error_ddbarEB); + do + { + gsl_monte_vegas_integrate (&Integrate_ddbarEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarEB, &error_ddbarEB); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*ddbarEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + +////DDBAR ODD FORWARD Matrix element +double ReactionAFB::ddbarOF_funct (double *entries, size_t dim, void *params) +{ + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1d = (ptr->xfx(x1,Q,1)) / x1; + double f1s = (ptr->xfx(x1,Q,3)) / x1; + double f1b = (ptr->xfx(x1,Q,5)) / x1; + double f2dbar = (ptr->xfx(x2,Q,-1)) / x2; + double f2sbar = (ptr->xfx(x2,Q,-3)) / x2; + double f2bbar = (ptr->xfx(x2,Q,-5)) / x2; + + // PDF combinations + double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; + + // Angular integration limits + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_min = 0; + + double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_OF = dsigma*angular_integration_OF; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // D-DBAR + double ddbarOF = ddbar_PDF*dsigma_OF; + + double *propagator = propagators (Minv); + + return ddbarOF * propagator[3]; // Multiply the PDFs combination with the correct propagator. +} + +////DDBAR ODD FORWARD Integration +double ReactionAFB::integration_ddbarOF (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double ddbarOF, error_ddbarOF; + // Initialization of the integration + gsl_monte_function Integrate_ddbarOF = { &(ReactionAFB::ddbarOF_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_ddbarOF, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarOF, &error_ddbarOF); + do + { + gsl_monte_vegas_integrate (&Integrate_ddbarOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarOF, &error_ddbarOF); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*ddbarOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + +////DDBAR ODD BACKWARD Matrix element +double ReactionAFB::ddbarOB_funct (double *entries, size_t dim, void *params) +{ + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1d = (ptr->xfx(x1,Q,1)) / x1; + double f1s = (ptr->xfx(x1,Q,3)) / x1; + double f1b = (ptr->xfx(x1,Q,5)) / x1; + double f2dbar = (ptr->xfx(x2,Q,-1)) / x2; + double f2sbar = (ptr->xfx(x2,Q,-3)) / x2; + double f2bbar = (ptr->xfx(x2,Q,-5)) / x2; + + // PDF combinations + double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; + + // Angular integration limits + double qbarq_cos_theta_max = 0; + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + + double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_OB = dsigma*angular_integration_OB; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // D-DBAR + double ddbarOB = ddbar_PDF*dsigma_OB; + + double *propagator = propagators (Minv); + + return ddbarOB * propagator[3]; // Multiply the PDFs combination with the correct propagator. +} + +////DDBAR ODD BACKWARD Integration +double ReactionAFB::integration_ddbarOB (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double ddbarOB, error_ddbarOB; + // Initialization of the integration + gsl_monte_function Integrate_ddbarOB = { &(ReactionAFB::ddbarOB_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_ddbarOB, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarOB, &error_ddbarOB); + do + { + gsl_monte_vegas_integrate (&Integrate_ddbarOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarOB, &error_ddbarOB); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*ddbarOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + +////DBARD EVEN FORWARD Matrix element +double ReactionAFB::dbardEF_funct (double *entries, size_t dim, void *params) +{ + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1dbar = (ptr->xfx(x1,Q,-1)) / x1; + double f1sbar = (ptr->xfx(x1,Q,-3)) / x1; + double f1bbar = (ptr->xfx(x1,Q,-5)) / x1; + double f2d = (ptr->xfx(x2,Q,1)) / x2; + double f2s = (ptr->xfx(x2,Q,3)) / x2; + double f2b = (ptr->xfx(x2,Q,5)) / x2; + + // PDF combinations + double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; + + // Angular integration limits + double qbarq_cos_theta_max = 0; + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + + double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_EB = dsigma*angular_integration_EB; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // DBAR-D + double dbardEF = dbard_PDF*dsigma_EB; + + double *propagator = propagators (Minv); + + return dbardEF * propagator[2]; // Multiply the PDFs combination with the correct propagator. +} + +////DBARD EVEN FORWARD Integration +double ReactionAFB::integration_dbardEF (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double dbardEF, error_dbardEF; + // Initialization of the integration + gsl_monte_function Integrate_dbardEF = { &(ReactionAFB::dbardEF_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_dbardEF, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardEF, &error_dbardEF); + do + { + gsl_monte_vegas_integrate (&Integrate_dbardEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardEF, &error_dbardEF); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*dbardEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + +////DBARD EVEN BACKWARD Matrix element +double ReactionAFB::dbardEB_funct (double *entries, size_t dim, void *params) +{ + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1dbar = (ptr->xfx(x1,Q,-1)) / x1; + double f1sbar = (ptr->xfx(x1,Q,-3)) / x1; + double f1bbar = (ptr->xfx(x1,Q,-5)) / x1; + double f2d = (ptr->xfx(x2,Q,1)) / x2; + double f2s = (ptr->xfx(x2,Q,3)) / x2; + double f2b = (ptr->xfx(x2,Q,5)) / x2; + + // PDF combinations + double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; + + // Angular integration limits + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_min = 0; + + double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_EF = dsigma*angular_integration_EF; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // DBAR-D + double dbardEB = dbard_PDF*dsigma_EF; + + double *propagator = propagators (Minv); + + return dbardEB * propagator[2]; // Multiply the PDFs combination with the correct propagator. +} + +////DBARD EVEN BACKWARD Integration +double ReactionAFB::integration_dbardEB (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double dbardEB, error_dbardEB; + // Initialization of the integration + gsl_monte_function Integrate_dbardEB = { &(ReactionAFB::dbardEB_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_dbardEB, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardEB, &error_dbardEB); + do + { + gsl_monte_vegas_integrate (&Integrate_dbardEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardEB, &error_dbardEB); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*dbardEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + +////DBARD ODD FORWARD Matrix element +double ReactionAFB::dbardOF_funct (double *entries, size_t dim, void *params) +{ + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1dbar = (ptr->xfx(x1,Q,-1)) / x1; + double f1sbar = (ptr->xfx(x1,Q,-3)) / x1; + double f1bbar = (ptr->xfx(x1,Q,-5)) / x1; + double f2d = (ptr->xfx(x2,Q,1)) / x2; + double f2s = (ptr->xfx(x2,Q,3)) / x2; + double f2b = (ptr->xfx(x2,Q,5)) / x2; + + // PDF combinations + double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; + + // Angular integration limits + double qbarq_cos_theta_max = 0; + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + + double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_OB = dsigma*angular_integration_OB; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // DBAR-D + double dbardOF = dbard_PDF*dsigma_OB; + + double *propagator = propagators (Minv); + + return dbardOF * propagator[3]; // Multiply the PDFs combination with the correct propagator. +} + +////DBARD ODD FORWARD Integration +double ReactionAFB::integration_dbardOF (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double dbardOF, error_dbardOF; + // Initialization of the integration + gsl_monte_function Integrate_dbardOF = { &(ReactionAFB::dbardOF_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_dbardOF, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardOF, &error_dbardOF); + do + { + gsl_monte_vegas_integrate (&Integrate_dbardOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardOF, &error_dbardOF); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*dbardOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + +////DBARD ODD BACKWARD Matrix element +double ReactionAFB::dbardOB_funct (double *entries, size_t dim, void *params) +{ + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) params; + + (void)(dim); /* avoid unused parameter warnings */ + double yreduced = entries[0]; + double Minv = entries[1]; + + // Partonic cross section parameters + double Q = Minv; + double z = pow(Minv,2)/pow(energy,2); + double y = -(1.0/2.0)*log(z)*(yreduced); + double x1 = sqrt(z)*exp(y); + double x2 = sqrt(z)*exp(-y); + double dsigma_temp = pow(Minv,2)/(96*PI); + double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); + + // Call the PDFs + double f1dbar = (ptr->xfx(x1,Q,-1)) / x1; + double f1sbar = (ptr->xfx(x1,Q,-3)) / x1; + double f1bbar = (ptr->xfx(x1,Q,-5)) / x1; + double f2d = (ptr->xfx(x2,Q,1)) / x2; + double f2s = (ptr->xfx(x2,Q,3)) / x2; + double f2b = (ptr->xfx(x2,Q,5)) / x2; + + // PDF combinations + double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; + + // Angular integration limits + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_min = 0; + + double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); + + // Combination with angular integration (Forward - Backward for q-qbar) + double dsigma_OF = dsigma*angular_integration_OF; + + // Covolution with PDFs (flipping direction for q-qbar & qbar-q) + // DBAR-D + double dbardOB = dbard_PDF*dsigma_OF; + + double *propagator = propagators (Minv); + + return dbardOB * propagator[3]; // Multiply the PDFs combination with the correct propagator. +} + +////DBARD ODD BACKWARD Integration +double ReactionAFB::integration_dbardOB (double Minv_inf, double Minv_sup) +{ + double integration_inf[2] = {yreducedmin, Minv_inf}; + double integration_sup[2] = {yreducedmax, Minv_sup}; + + double dbardOB, error_dbardOB; + // Initialization of the integration + gsl_monte_function Integrate_dbardOB = { &(ReactionAFB::dbardOB_funct), dim_integration, this }; + const gsl_rng_type *T; + gsl_rng *r; + gsl_rng_env_setup (); + T = gsl_rng_default; + r = gsl_rng_alloc (T); + // Integration + { + gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); + gsl_monte_vegas_integrate (&Integrate_dbardOB, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardOB, &error_dbardOB); + do + { + gsl_monte_vegas_integrate (&Integrate_dbardOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardOB, &error_dbardOB); + } + while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); + gsl_monte_vegas_free (s); + } + + gsl_rng_free (r); + + return 2*dbardOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. +} + + +double ReactionAFB::AFB (double Minv_inf, double Minv_sup) +{ + double uubarEF = integration_uubarEF (Minv_inf, Minv_sup); + double uubarEB = integration_uubarEB (Minv_inf, Minv_sup); + double uubarOF = integration_uubarOF (Minv_inf, Minv_sup); + double uubarOB = integration_uubarOB (Minv_inf, Minv_sup); + + double ubaruEF = integration_ubaruEF (Minv_inf, Minv_sup); + double ubaruEB = integration_ubaruEB (Minv_inf, Minv_sup); + double ubaruOF = integration_ubaruOF (Minv_inf, Minv_sup); + double ubaruOB = integration_ubaruOB (Minv_inf, Minv_sup); + + double ddbarEF = integration_ddbarEF (Minv_inf, Minv_sup); + double ddbarEB = integration_ddbarEB (Minv_inf, Minv_sup); + double ddbarOF = integration_ddbarOF (Minv_inf, Minv_sup); + double ddbarOB = integration_ddbarOB (Minv_inf, Minv_sup); + + double dbardEF = integration_dbardEF (Minv_inf, Minv_sup); + double dbardEB = integration_dbardEB (Minv_inf, Minv_sup); + double dbardOF = integration_dbardOF (Minv_inf, Minv_sup); + double dbardOB = integration_dbardOB (Minv_inf, Minv_sup); + + // Reconstructed Forward and Backward + double Forward = uubarEF+ubaruEF+ddbarEF+dbardEF+uubarOF+ubaruOF+ddbarOF+dbardOF; + double Backward = uubarEB+ubaruEB+ddbarEB+dbardEB+uubarOB+ubaruOB+ddbarOB+dbardOB; + + // Reconstructed AFB + double AFB = (Forward - Backward) / (Forward + Backward); + + return AFB; +} + +// the class factories +extern "C" ReactionAFB* create() { + return new ReactionAFB(); +} + +// Initialize at the start of the computation +int ReactionAFB::initAtStart(const string &s) +{ + return 0; +} + + +// Main function to compute results at an iteration +int ReactionAFB::compute(int dataSetID, valarray<double> &val, map<string, valarray<double> > &err) +{ + auto *Minv_min = GetBinValues(dataSetID,"Minv_min"), *Minv_max = GetBinValues(dataSetID,"Minv_max"); + if (Minv_min == nullptr || Minv_max == nullptr) { + std::cout << "\n\nFATAL ERROR: AFB code requires Invariant mass bins to be present !!!" << std::endl; + std::cout << "CHECK THE DATAFILE !!!" << std::endl; + return 1; + } + + auto min = *Minv_min, max = *Minv_max; + + int Npnt_min = min.size(); + int Npnt_max = max.size(); + + if (Npnt_min != Npnt_max) { + std::cout << "\n\nFATAL ERROR: uneven number of Invariant mass min and max !!!" << std::endl; + std::cout << "CHECK THE DATAFILE !!!" << std::endl; + return 1; + } + + // Fill the array "val[i]" with the result of the AFB function + for (int i = 0; i < Npnt_min; i++) { + double AFB_result = AFB (min[i], max[i]); + val[i] = AFB_result; + } return 0; -- GitLab From 52ee7e99985b2765a6b8092b440dc6075c466904 Mon Sep 17 00:00:00 2001 From: Juri Fiaschi <fiaschi@uni-muenster.de> Date: Fri, 24 Aug 2018 10:55:02 +0200 Subject: [PATCH 07/11] Adding Makefile.am for linking with gsl libraries --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index d346d2b78..5d6096258 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,7 @@ SUBDIRS = minuit/src interfaces/src DY/src DIPOLE/src RT/src EW/src common commo genetic/mixmax_r004 genetic/src QEDevol/src \ include interfaces/include FastNLO/include FastNLO/include/fastnlotk DiffDIS/include \ DY/include tools/draw/include \ - pdf2yaml tools/process \ + pdf2yaml tools/process reactions/AFB/src \ reactions/KFactor/src reactions/Fractal_DISNC/src reactions/BaseDISCC/src reactions/Hathor/src reactions/BaseDISNC/src \ reactions/RT_DISNC/src reactions/FFABM_DISNC/src reactions/FFABM_DISCC/src reactions/APPLgrid/src reactions/BaseHVQMNR/src \ reactions/HVQMNR_LHCb_7TeV_beauty/src reactions/HVQMNR_LHCb_7TeV_charm/src reactions/testZMVFNS/src reactions/fastNLO/src/ \ -- GitLab From 6f8119aacaaaf717a288f912ce629e72e6115699 Mon Sep 17 00:00:00 2001 From: Juri Fiaschi <fiaschi@uni-muenster.de> Date: Fri, 7 Sep 2018 12:07:38 +0200 Subject: [PATCH 08/11] updated integration --- reactions/AFB/include/ReactionAFB.h | 117 +- reactions/AFB/src/ReactionAFB.cc | 1906 +++++++++++++++------------ reactions/AFB/yaml/parameters.yaml | 7 + 3 files changed, 1176 insertions(+), 854 deletions(-) diff --git a/reactions/AFB/include/ReactionAFB.h b/reactions/AFB/include/ReactionAFB.h index 9b9b5e86c..05a4d50bc 100644 --- a/reactions/AFB/include/ReactionAFB.h +++ b/reactions/AFB/include/ReactionAFB.h @@ -26,49 +26,92 @@ class ReactionAFB : public ReactionTheory public: virtual string getReactionName() const { return "AFB" ;}; - int initAtStart(const string &); + int initAtStart(const string &); virtual int compute(int dataSetID, valarray<double> &val, map<string, valarray<double> > &err); protected: virtual int parseOptions(){ return 0;}; private: + static double PI; + static double GeVtofb_param, alphaEM_param, stheta2W_param, MZ_param, GammaZ_param; + static double energy_param, eta_cut_param, pT_cut_param, y_min_param, y_max_param; + + static double e_param, gsm_param, smangle_param; + static double foton_Vu, foton_Au, foton_Vd, foton_Ad, foton_Vl, foton_Al, foton_Vnu, foton_Anu; + static double Z_Vu, Z_Au, Z_Vd, Z_Ad, Z_Vl, Z_Al, Z_Vnu, Z_Anu; + static double even_foton_up, even_foton_down, even_interf_up, even_interf_down, even_Z_up, even_Z_down; + static double odd_foton_up, odd_foton_down, odd_interf_up, odd_interf_down, odd_Z_up, odd_Z_down; + static double *propagators (double); - - static double uubarEF_funct (double *, size_t, void *); - double integration_uubarEF (double, double); - static double uubarEB_funct (double *, size_t, void *); - double integration_uubarEB (double, double); - static double uubarOF_funct (double *, size_t, void *); - double integration_uubarOF (double, double); - static double uubarOB_funct (double *, size_t, void *); - double integration_uubarOB (double, double); - - static double ubaruEF_funct (double *, size_t, void *); - double integration_ubaruEF (double, double); - static double ubaruEB_funct (double *, size_t, void *); - double integration_ubaruEB (double, double); - static double ubaruOF_funct (double *, size_t, void *); - double integration_ubaruOF (double, double); - static double ubaruOB_funct (double *, size_t, void *); - double integration_ubaruOB (double, double); - - static double ddbarEF_funct (double *, size_t, void *); - double integration_ddbarEF (double, double); - static double ddbarEB_funct (double *, size_t, void *); - double integration_ddbarEB (double, double); - static double ddbarOF_funct (double *, size_t, void *); - double integration_ddbarOF (double, double); - static double ddbarOB_funct (double *, size_t, void *); - double integration_ddbarOB (double, double); - - static double dbardEF_funct (double *, size_t, void *); - double integration_dbardEF (double, double); - static double dbardEB_funct (double *, size_t, void *); - double integration_dbardEB (double, double); - static double dbardOF_funct (double *, size_t, void *); - double integration_dbardOF (double, double); - static double dbardOB_funct (double *, size_t, void *); - double integration_dbardOB (double, double); + + + static double uubarEF_funct (double, void *); + static double integration_uubarEF_y (double, void *); + double integration_uubarEF (double, double, void *); + + static double uubarEB_funct (double, void *); + static double integration_uubarEB_y (double, void *); + double integration_uubarEB (double, double, void *); + + static double uubarOF_funct (double, void *); + static double integration_uubarOF_y (double, void *); + double integration_uubarOF (double, double, void *); + + static double uubarOB_funct (double, void *); + static double integration_uubarOB_y (double, void *); + double integration_uubarOB (double, double, void *); + + + static double ubaruEF_funct (double, void *); + static double integration_ubaruEF_y (double, void *); + double integration_ubaruEF (double, double, void *); + + static double ubaruEB_funct (double, void *); + static double integration_ubaruEB_y (double, void *); + double integration_ubaruEB (double, double, void *); + + static double ubaruOF_funct (double, void *); + static double integration_ubaruOF_y (double, void *); + double integration_ubaruOF (double, double, void *); + + static double ubaruOB_funct (double, void *); + static double integration_ubaruOB_y (double, void *); + double integration_ubaruOB (double, double, void *); + + + static double ddbarEF_funct (double, void *); + static double integration_ddbarEF_y (double, void *); + double integration_ddbarEF (double, double, void *); + + static double ddbarEB_funct (double, void *); + static double integration_ddbarEB_y (double, void *); + double integration_ddbarEB (double, double, void *); + + static double ddbarOF_funct (double, void *); + static double integration_ddbarOF_y (double, void *); + double integration_ddbarOF (double, double, void *); + + static double ddbarOB_funct (double, void *); + static double integration_ddbarOB_y (double, void *); + double integration_ddbarOB (double, double, void *); + + + static double dbardEF_funct (double, void *); + static double integration_dbardEF_y (double, void *); + double integration_dbardEF (double, double, void *); + + static double dbardEB_funct (double, void *); + static double integration_dbardEB_y (double, void *); + double integration_dbardEB (double, double, void *); + + static double dbardOF_funct (double, void *); + static double integration_dbardOF_y (double, void *); + double integration_dbardOF (double, double, void *); + + static double dbardOB_funct (double, void *); + static double integration_dbardOB_y (double, void *); + double integration_dbardOB (double, double, void *); + double AFB (double, double); }; diff --git a/reactions/AFB/src/ReactionAFB.cc b/reactions/AFB/src/ReactionAFB.cc index 842ce88b9..f6af233a7 100644 --- a/reactions/AFB/src/ReactionAFB.cc +++ b/reactions/AFB/src/ReactionAFB.cc @@ -8,135 +8,83 @@ #include "ReactionAFB.h" #include "iostream" -#include <gsl/gsl_monte_miser.h> -#include <gsl/gsl_monte_vegas.h> +#include <gsl/gsl_integration.h> using namespace std; -// Constants -#define PI 3.14159265 -#define GeVtofb 0.38937966e+12 +// Declaration of static parameters +double ReactionAFB::PI; +double ReactionAFB::GeVtofb_param, ReactionAFB::alphaEM_param, ReactionAFB::stheta2W_param, ReactionAFB::MZ_param, ReactionAFB::GammaZ_param; +double ReactionAFB::energy_param, ReactionAFB::eta_cut_param, ReactionAFB::pT_cut_param, ReactionAFB::y_min_param, ReactionAFB::y_max_param; -// SM parameters -#define MZ 91.19 -#define GammaZ 2.5 -#define alphaEM 0.0078125 -#define sthetaW 0.4817 +double ReactionAFB::e_param, ReactionAFB::gsm_param, ReactionAFB::smangle_param; +double ReactionAFB::foton_Vu, ReactionAFB::foton_Au, ReactionAFB::foton_Vd, ReactionAFB::foton_Ad, ReactionAFB::foton_Vl, ReactionAFB::foton_Al, ReactionAFB::foton_Vnu, ReactionAFB::foton_Anu; +double ReactionAFB::Z_Vu, ReactionAFB::Z_Au, ReactionAFB::Z_Vd, ReactionAFB::Z_Ad, ReactionAFB::Z_Vl, ReactionAFB::Z_Al, ReactionAFB::Z_Vnu, ReactionAFB::Z_Anu; +double ReactionAFB::even_foton_up, ReactionAFB::even_foton_down, ReactionAFB::even_interf_up, ReactionAFB::even_interf_down, ReactionAFB::even_Z_up, ReactionAFB::even_Z_down; +double ReactionAFB::odd_foton_up, ReactionAFB::odd_foton_down, ReactionAFB::odd_interf_up, ReactionAFB::odd_interf_down, ReactionAFB::odd_Z_up, ReactionAFB::odd_Z_down; -// set collider energy -#define energy 13000 +const double epsabs = 0; +const double epsrel = 1e-2; -// define acceptance cuts -#define eta_cut 2.5 -#define pT_cut 20 - -// kinematic cuts -#define ycut 1 - -// PDF set and check -const int iset = 1; -const int ichk = 0; - -// Setting of the integration -const int dim_integration = 2; // Integration on yreduced and Minv -// Integration extremes -double yreducedmin = 0; -double yreducedmax = ycut; - -// Integration number of calls -size_t calls = 10000; +size_t calls; //// Function returning the combination of propagators double *ReactionAFB::propagators (double Minv) { - const double e = sqrt(4*PI*alphaEM); - const double gsm = (e/(sthetaW*sqrt(1-pow(sthetaW,2))))*sqrt(1+pow(sthetaW,4)); - - const double smangle = atan(-pow(sthetaW,2)); - - // SM couplings - static double *couplings_foton = new double[8]; - couplings_foton[0] = e*(2.0/3.0); - couplings_foton[1] = 0; - couplings_foton[2] = e*(-1.0/3.0); - couplings_foton[3] = 0; - couplings_foton[4] = e*(-1.0); - couplings_foton[5] = 0; - couplings_foton[6] = 0; - couplings_foton[7] = 0; - - static double *couplings_Z = new double[8]; - couplings_Z[0] = (1.0/2.0)*gsm*(1.0/6.0)*(3*cos(smangle)+8*sin(smangle)); - couplings_Z[1] = (1.0/2.0)*gsm*(cos(smangle)/2.0); - couplings_Z[2] = (1.0/2.0)*gsm*(1.0/6.0)*(-3*cos(smangle)-4*sin(smangle)); - couplings_Z[3] = (1.0/2.0)*gsm*(-cos(smangle)/2.0); - couplings_Z[4] = (1.0/2.0)*gsm*((-cos(smangle)/2.0)+(-2*sin(smangle))); - couplings_Z[5] = (1.0/2.0)*gsm*(-cos(smangle)/2.0); - couplings_Z[6] = (1.0/2.0)*gsm*(cos(smangle)/2.0); - couplings_Z[7] = (1.0/2.0)*gsm*(cos(smangle)/2.0); - - // Even combination of couplings - double even_foton_up = (pow(couplings_foton[0],2)+pow(couplings_foton[1],2))*(pow(couplings_foton[4],2)+pow(couplings_foton[5],2)); - double even_foton_down = (pow(couplings_foton[2],2)+pow(couplings_foton[3],2))*(pow(couplings_foton[4],2)+pow(couplings_foton[5],2)); - double even_interf_up = ((couplings_foton[0]*couplings_Z[0])+(couplings_foton[1]*couplings_Z[1]))*((couplings_foton[4]*couplings_Z[4])+(couplings_foton[5]*couplings_Z[5])); - double even_interf_down = ((couplings_foton[2]*couplings_Z[2])+(couplings_foton[3]*couplings_Z[3]))*((couplings_foton[4]*couplings_Z[4])+(couplings_foton[5]*couplings_Z[5])); - double even_Z_up = (pow(couplings_Z[0],2)+pow(couplings_Z[1],2))*(pow(couplings_Z[4],2)+pow(couplings_Z[5],2)); - double even_Z_down = (pow(couplings_Z[2],2)+pow(couplings_Z[3],2))*(pow(couplings_Z[4],2)+pow(couplings_Z[5],2)); - - // Odd combination of couplings - double odd_foton_up = 4*couplings_foton[0]*couplings_foton[1]*couplings_foton[4]*couplings_foton[5]; - double odd_foton_down = 4*couplings_foton[2]*couplings_foton[3]*couplings_foton[4]*couplings_foton[5]; - double odd_interf_up = (couplings_foton[0]*couplings_Z[1]+couplings_foton[1]*couplings_Z[0])*(couplings_foton[4]*couplings_Z[5]+couplings_foton[5]*couplings_Z[4]); - double odd_interf_down = (couplings_foton[2]*couplings_Z[3]+couplings_foton[3]*couplings_Z[2])*(couplings_foton[4]*couplings_Z[5]+couplings_foton[5]*couplings_Z[4]); - double odd_Z_up = 4*couplings_Z[0]*couplings_Z[1]*couplings_Z[4]*couplings_Z[5]; - double odd_Z_down = 4*couplings_Z[2]*couplings_Z[3]*couplings_Z[4]*couplings_Z[5]; - // Propagators squared and interference double foton_squared = 1.0/pow(Minv,4); - double interference = 2.0*(-pow(Minv,2)*(pow(MZ,2)-pow(Minv,2)))/(pow(Minv,4)*((pow(pow(MZ,2)-pow(Minv,2),2))+pow(MZ,2)*pow(GammaZ,2))); - double Z_squared = 1.0/(pow(pow(MZ,2)-pow(Minv,2),2)+pow(MZ,2)*pow(GammaZ,2)); - - static double *propagators = new double[4]; - - propagators[0] = (even_foton_up * foton_squared)+(even_interf_up * interference) + (even_Z_up * Z_squared); - propagators[1] = (odd_foton_up * foton_squared)+(odd_interf_up * interference) + (odd_Z_up * Z_squared); - propagators[2] = (even_foton_down * foton_squared)+(even_interf_down * interference) + (even_Z_down * Z_squared); - propagators[3] = (odd_foton_down * foton_squared)+(odd_interf_down * interference) + (odd_Z_down * Z_squared); + double interference = 2.0*(-pow(Minv,2)*(pow(MZ_param,2)-pow(Minv,2)))/(pow(Minv,4)*((pow(pow(MZ_param,2)-pow(Minv,2),2))+pow(MZ_param,2)*pow(GammaZ_param,2))); + double Z_squared = 1.0/(pow(pow(MZ_param,2)-pow(Minv,2),2)+pow(MZ_param,2)*pow(GammaZ_param,2)); + + static double propagators[4]; + propagators[0] = (even_foton_up * foton_squared) + (even_interf_up * interference) + (even_Z_up * Z_squared); + propagators[1] = (odd_foton_up * foton_squared) + (odd_interf_up * interference) + (odd_Z_up * Z_squared); + propagators[2] = (even_foton_down * foton_squared) + (even_interf_down * interference) + (even_Z_down * Z_squared); + propagators[3] = (odd_foton_down * foton_squared) + (odd_interf_down * interference) + (odd_Z_down * Z_squared); return propagators; } +// Define a structure to pass the parameters +struct integration_params { + double Minv; + ReactionTheory* ptr; + +}; + ////UUBAR EVEN FORWARD Matrix element -double ReactionAFB::uubarEF_funct (double *entries, size_t dim, void *params) -{ +double ReactionAFB::uubarEF_funct (double yreduced, void * params) { + // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; - - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; - + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; + // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1u = (ptr->xfx(x1,Q,2)) / x1; - double f1c = (ptr->xfx(x1,Q,4)) / x1; - double f2ubar = (ptr->xfx(x2,Q,-2)) / x2; - double f2cbar = (ptr->xfx(x2,Q,-4)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1u = pdfx1[8] / x1; + double f1c = pdfx1[10] / x1; + double f2ubar = pdfx2[4] / x2; + double f2cbar = pdfx2[2] / x2; // PDF combinations double uubar_PDF = f1u*f2ubar + f1c*f2cbar; // Angular integration limits - double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut_param-y))),sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double qqbar_cos_theta_min = 0; double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); @@ -153,69 +101,83 @@ double ReactionAFB::uubarEF_funct (double *entries, size_t dim, void *params) return uubarEF * propagator[0]; // Multiply the PDFs combination with the correct propagator. } -////UUBAR EVEN FORWARD Integration -double ReactionAFB::integration_uubarEF (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - double uubarEF, error_uubarEF; - - // Initialization of the integration - gsl_monte_function Integrate_uubarEF = { &(ReactionAFB::uubarEF_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_uubarEF, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarEF, &error_uubarEF); - do - { - gsl_monte_vegas_integrate (&Integrate_uubarEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarEF, &error_uubarEF); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); - } +////UUBAR EVEN FORWARD Integration in rapidity +double ReactionAFB::integration_uubarEF_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; - gsl_rng_free (r); + gsl_function F; + F.function = &(ReactionAFB::uubarEF_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); + } - return 2*uubarEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return 2*result; } +////UUBAR EVEN FORWARD Integration in invariant mass +double ReactionAFB::integration_uubarEF (double Minv_inf, double Minv_sup, void* ptr) { + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::integration_uubarEF_y); + F.params = ptr; + + double inf = Minv_inf; + double sup = Minv_sup; + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; +} ////UUBAR EVEN BACKWARD Matrix element -double ReactionAFB::uubarEB_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::uubarEB_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1u = (ptr->xfx(x1,Q,2)) / x1; - double f1c = (ptr->xfx(x1,Q,4)) / x1; - double f2ubar = (ptr->xfx(x2,Q,-2)) / x2; - double f2cbar = (ptr->xfx(x2,Q,-4)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1u = pdfx1[8] / x1; + double f1c = pdfx1[10] / x1; + double f2ubar = pdfx2[4] / x2; + double f2cbar = pdfx2[2] / x2; // PDF combinations double uubar_PDF = f1u*f2ubar + f1c*f2cbar; // Angular integration limits double qbarq_cos_theta_max = 0; - double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut_param-y))),-sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); @@ -227,71 +189,85 @@ double ReactionAFB::uubarEB_funct (double *entries, size_t dim, void *params) double uubarEB = uubar_PDF*dsigma_EB; double *propagator = propagators (Minv); - - return uubarEB * propagator[0]; // Multiply the PDFs combination with the correct propagator. + return uubarEB * propagator[0]; } -////UUBAR EVEN BACKWARD Integration -double ReactionAFB::integration_uubarEB (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double uubarEB, error_uubarEB; - // Initialization of the integration - gsl_monte_function Integrate_uubarEB = { &(ReactionAFB::uubarEB_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_uubarEB, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarEB, &error_uubarEB); - do - { - gsl_monte_vegas_integrate (&Integrate_uubarEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarEB, &error_uubarEB); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////UUBAR EVEN BACKWARD Integration in rapidity +double ReactionAFB::integration_uubarEB_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::uubarEB_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); - gsl_rng_free (r); + return 2*result; +} + +////UUBAR EVEN BACKWARD Integration in invariant mass +double ReactionAFB::integration_uubarEB (double Minv_inf, double Minv_sup, void* ptr) { + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::integration_uubarEB_y); + F.params = ptr; + + double inf = Minv_inf; + double sup = Minv_sup; - return 2*uubarEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////UUBAR ODD FORWARD Matrix element -double ReactionAFB::uubarOF_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::uubarOF_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1u = (ptr->xfx(x1,Q,2)) / x1; - double f1c = (ptr->xfx(x1,Q,4)) / x1; - double f2ubar = (ptr->xfx(x2,Q,-2)) / x2; - double f2cbar = (ptr->xfx(x2,Q,-4)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1u = pdfx1[8] / x1; + double f1c = pdfx1[10] / x1; + double f2ubar = pdfx2[4] / x2; + double f2cbar = pdfx2[2] / x2; // PDF combinations double uubar_PDF = f1u*f2ubar + f1c*f2cbar; // Angular integration limits - double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut_param-y))),sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double qqbar_cos_theta_min = 0; double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); @@ -305,71 +281,86 @@ double ReactionAFB::uubarOF_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return uubarOF * propagator[1]; // Multiply the PDFs combination with the correct propagator. + return uubarOF * propagator[1]; } -////UUBAR ODD FORWARD Integration -double ReactionAFB::integration_uubarOF (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double uubarOF, error_uubarOF; - // Initialization of the integration - gsl_monte_function Integrate_uubarOF = { &(ReactionAFB::uubarOF_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_uubarOF, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarOF, &error_uubarOF); - do - { - gsl_monte_vegas_integrate (&Integrate_uubarOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarOF, &error_uubarOF); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////UUBAR ODD FORWARD Integration in rapidity +double ReactionAFB::integration_uubarOF_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::uubarOF_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return 2*result; +} + +////UUBAR ODD FORWARD Integration in invariant mass +double ReactionAFB::integration_uubarOF (double Minv_inf, double Minv_sup, void* ptr) { + + double result, error; - gsl_rng_free (r); + gsl_function F; + F.function = &(ReactionAFB::integration_uubarOF_y); + F.params = ptr; + + double inf = Minv_inf; + double sup = Minv_sup; - return 2*uubarOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////UUBAR ODD BACKWARD Matrix element -double ReactionAFB::uubarOB_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::uubarOB_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1u = (ptr->xfx(x1,Q,2)) / x1; - double f1c = (ptr->xfx(x1,Q,4)) / x1; - double f2ubar = (ptr->xfx(x2,Q,-2)) / x2; - double f2cbar = (ptr->xfx(x2,Q,-4)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1u = pdfx1[8] / x1; + double f1c = pdfx1[10] / x1; + double f2ubar = pdfx2[4] / x2; + double f2cbar = pdfx2[2] / x2; // PDF combinations double uubar_PDF = f1u*f2ubar + f1c*f2cbar; // Angular integration limits double qbarq_cos_theta_max = 0; - double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut_param-y))),-sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); @@ -382,71 +373,86 @@ double ReactionAFB::uubarOB_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return uubarOB * propagator[1]; // Multiply the PDFs combination with the correct propagator. + return uubarOB * propagator[1]; } -////UUBAR ODD BACKWARD Integration -double ReactionAFB::integration_uubarOB (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double uubarOB, error_uubarOB; - // Initialization of the integration - gsl_monte_function Integrate_uubarOB = { &(ReactionAFB::uubarOB_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_uubarOB, integration_inf, integration_sup, dim_integration, calls, r, s, &uubarOB, &error_uubarOB); - do - { - gsl_monte_vegas_integrate (&Integrate_uubarOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &uubarOB, &error_uubarOB); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////UUBAR ODD BACKWARD Integration in rapidity +double ReactionAFB::integration_uubarOB_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::uubarOB_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); - gsl_rng_free (r); + return 2*result; +} + +////UUBAR ODD BACKWARD Integration in invariant mass +double ReactionAFB::integration_uubarOB (double Minv_inf, double Minv_sup, void* ptr) { + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::integration_uubarOB_y); + F.params = ptr; - return 2*uubarOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + double inf = Minv_inf; + double sup = Minv_sup; + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////UBARU EVEN FORWARD Matrix element -double ReactionAFB::ubaruEF_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::ubaruEF_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1ubar = (ptr->xfx(x1,Q,-2)) / x1; - double f1cbar = (ptr->xfx(x1,Q,-4)) / x1; - double f2u = (ptr->xfx(x2,Q,2)) / x2; - double f2c = (ptr->xfx(x2,Q,4)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1ubar = pdfx1[4] / x1; + double f1cbar = pdfx1[2] / x1; + double f2u = pdfx2[8] / x2; + double f2c = pdfx2[10] / x2; // PDF combinations double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; // Angular integration limits double qbarq_cos_theta_max = 0; - double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut_param-y))),-sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); @@ -459,70 +465,85 @@ double ReactionAFB::ubaruEF_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return ubaruEF * propagator[0]; // Multiply the PDFs combination with the correct propagator. + return ubaruEF * propagator[0]; } -////UBARU EVEN FORWARD Integration -double ReactionAFB::integration_ubaruEF (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double ubaruEF, error_ubaruEF; - // Initialization of the integration - gsl_monte_function Integrate_ubaruEF = { &(ReactionAFB::ubaruEF_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_ubaruEF, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruEF, &error_ubaruEF); - do - { - gsl_monte_vegas_integrate (&Integrate_ubaruEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruEF, &error_ubaruEF); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////UBARU EVEN FORWARD Integration in rapidity +double ReactionAFB::integration_ubaruEF_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::ubaruEF_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return 2*result; +} + +////UBARU EVEN FORWARD Integration in invariant mass +double ReactionAFB::integration_ubaruEF (double Minv_inf, double Minv_sup, void* ptr) { + + double result, error; - gsl_rng_free (r); + gsl_function F; + F.function = &(ReactionAFB::integration_ubaruEF_y); + F.params = ptr; - return 2*ubaruEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + double inf = Minv_inf; + double sup = Minv_sup; + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////UBARU EVEN BACKWARD Matrix element -double ReactionAFB::ubaruEB_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::ubaruEB_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1ubar = (ptr->xfx(x1,Q,-2)) / x1; - double f1cbar = (ptr->xfx(x1,Q,-4)) / x1; - double f2u = (ptr->xfx(x2,Q,2)) / x2; - double f2c = (ptr->xfx(x2,Q,4)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1ubar = pdfx1[4] / x1; + double f1cbar = pdfx1[2] / x1; + double f2u = pdfx2[8] / x2; + double f2c = pdfx2[10] / x2; // PDF combinations double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; // Angular integration limits - double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut_param-y))),sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double qqbar_cos_theta_min = 0; double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); @@ -536,71 +557,86 @@ double ReactionAFB::ubaruEB_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return ubaruEB * propagator[0]; // Multiply the PDFs combination with the correct propagator. + return ubaruEB * propagator[0]; } -////UUBAR EVEN BACKWARD Integration -double ReactionAFB::integration_ubaruEB (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double ubaruEB, error_ubaruEB; - // Initialization of the integration - gsl_monte_function Integrate_ubaruEB = { &(ReactionAFB::ubaruEB_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_ubaruEB, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruEB, &error_ubaruEB); - do - { - gsl_monte_vegas_integrate (&Integrate_ubaruEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruEB, &error_ubaruEB); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////UBARU EVEN BACKWARD Integration in rapidity +double ReactionAFB::integration_ubaruEB_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::ubaruEB_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return 2*result; +} - gsl_rng_free (r); +////UBARU EVEN BACKWARD Integration in invariant mass +double ReactionAFB::integration_ubaruEB (double Minv_inf, double Minv_sup, void* ptr) { - return 2*ubaruEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::integration_ubaruEB_y); + F.params = ptr; + + double inf = Minv_inf; + double sup = Minv_sup; + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////UBARU ODD FORWARD Matrix element -double ReactionAFB::ubaruOF_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::ubaruOF_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1ubar = (ptr->xfx(x1,Q,-2)) / x1; - double f1cbar = (ptr->xfx(x1,Q,-4)) / x1; - double f2u = (ptr->xfx(x2,Q,2)) / x2; - double f2c = (ptr->xfx(x2,Q,4)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1ubar = pdfx1[4] / x1; + double f1cbar = pdfx1[2] / x1; + double f2u = pdfx2[8] / x2; + double f2c = pdfx2[10] / x2; // PDF combinations double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; // Angular integration limits double qbarq_cos_theta_max = 0; - double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut_param-y))),-sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); @@ -613,70 +649,85 @@ double ReactionAFB::ubaruOF_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return ubaruOF * propagator[1]; // Multiply the PDFs combination with the correct propagator. + return ubaruOF * propagator[1]; } -////UBARU ODD FORWARD Integration -double ReactionAFB::integration_ubaruOF (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double ubaruOF, error_ubaruOF; - // Initialization of the integration - gsl_monte_function Integrate_ubaruOF = { &(ReactionAFB::ubaruOF_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_ubaruOF, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruOF, &error_ubaruOF); - do - { - gsl_monte_vegas_integrate (&Integrate_ubaruOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruOF, &error_ubaruOF); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////UBARU ODD FORWARD Integration in rapidity +double ReactionAFB::integration_ubaruOF_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::ubaruOF_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); - gsl_rng_free (r); + return 2*result; +} + +////UBARU ODD FORWARD Integration in invariant mass +double ReactionAFB::integration_ubaruOF (double Minv_inf, double Minv_sup, void* ptr) { + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::integration_ubaruOF_y); + F.params = ptr; + + double inf = Minv_inf; + double sup = Minv_sup; - return 2*ubaruOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////UBARU ODD BACKWARD Matrix element -double ReactionAFB::ubaruOB_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::ubaruOB_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1ubar = (ptr->xfx(x1,Q,-2)) / x1; - double f1cbar = (ptr->xfx(x1,Q,-4)) / x1; - double f2u = (ptr->xfx(x2,Q,2)) / x2; - double f2c = (ptr->xfx(x2,Q,4)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1ubar = pdfx1[4] / x1; + double f1cbar = pdfx1[2] / x1; + double f2u = pdfx2[8] / x2; + double f2c = pdfx2[10] / x2; // PDF combinations double ubaru_PDF = f1ubar*f2u + f1cbar*f2c; // Angular integration limits - double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut_param-y))),sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double qqbar_cos_theta_min = 0; double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); @@ -690,72 +741,87 @@ double ReactionAFB::ubaruOB_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return ubaruOB * propagator[1]; // Multiply the PDFs combination with the correct propagator. + return ubaruOB * propagator[1]; } -////UBARU ODD BACKWARD Integration -double ReactionAFB::integration_ubaruOB (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double ubaruOB, error_ubaruOB; - // Initialization of the integration - gsl_monte_function Integrate_ubaruOB = { &(ReactionAFB::ubaruOB_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_ubaruOB, integration_inf, integration_sup, dim_integration, calls, r, s, &ubaruOB, &error_ubaruOB); - do - { - gsl_monte_vegas_integrate (&Integrate_ubaruOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ubaruOB, &error_ubaruOB); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////UBARU ODD BACKWARD Integration in rapidity +double ReactionAFB::integration_ubaruOB_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::ubaruOB_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); - gsl_rng_free (r); + return 2*result; +} + +////UBARU ODD BACKWARD Integration in invariant mass +double ReactionAFB::integration_ubaruOB (double Minv_inf, double Minv_sup, void* ptr) { - return 2*ubaruOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::integration_ubaruOB_y); + F.params = ptr; + + double inf = Minv_inf; + double sup = Minv_sup; + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////DDBAR EVEN FORWARD Matrix element -double ReactionAFB::ddbarEF_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::ddbarEF_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1d = (ptr->xfx(x1,Q,1)) / x1; - double f1s = (ptr->xfx(x1,Q,3)) / x1; - double f1b = (ptr->xfx(x1,Q,5)) / x1; - double f2dbar = (ptr->xfx(x2,Q,-1)) / x2; - double f2sbar = (ptr->xfx(x2,Q,-3)) / x2; - double f2bbar = (ptr->xfx(x2,Q,-5)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1d = pdfx1[7] / x1; + double f1s = pdfx1[9] / x1; + double f1b = pdfx1[11] / x1; + double f2dbar = pdfx2[5] / x2; + double f2sbar = pdfx2[3] / x2; + double f2bbar = pdfx2[1] / x2; // PDF combinations double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; // Angular integration limits - double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut_param-y))),sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double qqbar_cos_theta_min = 0; double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); @@ -769,73 +835,88 @@ double ReactionAFB::ddbarEF_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return ddbarEF * propagator[2]; // Multiply the PDFs combination with the correct propagator. + return ddbarEF * propagator[2]; } -////DDBAR EVEN FORWARD Integration -double ReactionAFB::integration_ddbarEF (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double ddbarEF, error_ddbarEF; - // Initialization of the integration - gsl_monte_function Integrate_ddbarEF = { &(ReactionAFB::ddbarEF_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_ddbarEF, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarEF, &error_ddbarEF); - do - { - gsl_monte_vegas_integrate (&Integrate_ddbarEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarEF, &error_ddbarEF); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////DDBAR EVEN FORWARD Integration in rapidity +double ReactionAFB::integration_ddbarEF_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::ddbarEF_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); - gsl_rng_free (r); + return 2*result; +} + +////DDBAR EVEN FORWARD Integration in invariant mass +double ReactionAFB::integration_ddbarEF (double Minv_inf, double Minv_sup, void* ptr) { + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::integration_ddbarEF_y); + F.params = ptr; + + double inf = Minv_inf; + double sup = Minv_sup; - return 2*ddbarEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////DDBAR EVEN BACKWARD Matrix element -double ReactionAFB::ddbarEB_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::ddbarEB_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1d = (ptr->xfx(x1,Q,1)) / x1; - double f1s = (ptr->xfx(x1,Q,3)) / x1; - double f1b = (ptr->xfx(x1,Q,5)) / x1; - double f2dbar = (ptr->xfx(x2,Q,-1)) / x2; - double f2sbar = (ptr->xfx(x2,Q,-3)) / x2; - double f2bbar = (ptr->xfx(x2,Q,-5)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1d = pdfx1[7] / x1; + double f1s = pdfx1[9] / x1; + double f1b = pdfx1[11] / x1; + double f2dbar = pdfx2[5] / x2; + double f2sbar = pdfx2[3] / x2; + double f2bbar = pdfx2[1] / x2; // PDF combinations double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; // Angular integration limits double qbarq_cos_theta_max = 0; - double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut_param-y))),-sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); @@ -848,72 +929,87 @@ double ReactionAFB::ddbarEB_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return ddbarEB * propagator[2]; // Multiply the PDFs combination with the correct propagator. + return ddbarEB * propagator[2]; } -////DDBAR EVEN BACKWARD Integration -double ReactionAFB::integration_ddbarEB (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double ddbarEB, error_ddbarEB; - // Initialization of the integration - gsl_monte_function Integrate_ddbarEB = { &(ReactionAFB::ddbarEB_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_ddbarEB, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarEB, &error_ddbarEB); - do - { - gsl_monte_vegas_integrate (&Integrate_ddbarEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarEB, &error_ddbarEB); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////DDBAR EVEN BACKWARD Integration in rapidity +double ReactionAFB::integration_ddbarEB_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::ddbarEB_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return 2*result; +} + +////DDBAR EVEN BACKWARD Integration in invariant mass +double ReactionAFB::integration_ddbarEB (double Minv_inf, double Minv_sup, void* ptr) { + + double result, error; - gsl_rng_free (r); + gsl_function F; + F.function = &(ReactionAFB::integration_ddbarEB_y); + F.params = ptr; + + double inf = Minv_inf; + double sup = Minv_sup; - return 2*ddbarEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////DDBAR ODD FORWARD Matrix element -double ReactionAFB::ddbarOF_funct (double *entries, size_t dim, void *params) -{ +double ReactionAFB::ddbarOF_funct (double yreduced, void * params) { + // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; - - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1d = (ptr->xfx(x1,Q,1)) / x1; - double f1s = (ptr->xfx(x1,Q,3)) / x1; - double f1b = (ptr->xfx(x1,Q,5)) / x1; - double f2dbar = (ptr->xfx(x2,Q,-1)) / x2; - double f2sbar = (ptr->xfx(x2,Q,-3)) / x2; - double f2bbar = (ptr->xfx(x2,Q,-5)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1d = pdfx1[7] / x1; + double f1s = pdfx1[9] / x1; + double f1b = pdfx1[11] / x1; + double f2dbar = pdfx2[5] / x2; + double f2sbar = pdfx2[3] / x2; + double f2bbar = pdfx2[1] / x2; // PDF combinations double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; // Angular integration limits - double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut_param-y))),sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double qqbar_cos_theta_min = 0; double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); @@ -927,73 +1023,88 @@ double ReactionAFB::ddbarOF_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return ddbarOF * propagator[3]; // Multiply the PDFs combination with the correct propagator. + return ddbarOF * propagator[3]; } -////DDBAR ODD FORWARD Integration -double ReactionAFB::integration_ddbarOF (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double ddbarOF, error_ddbarOF; - // Initialization of the integration - gsl_monte_function Integrate_ddbarOF = { &(ReactionAFB::ddbarOF_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_ddbarOF, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarOF, &error_ddbarOF); - do - { - gsl_monte_vegas_integrate (&Integrate_ddbarOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarOF, &error_ddbarOF); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////DDBAR ODD FORWARD Integration in rapidity +double ReactionAFB::integration_ddbarOF_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::ddbarOF_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); - gsl_rng_free (r); + return 2*result; +} + +////DDBAR ODD FORWARD Integration in invariant mass +double ReactionAFB::integration_ddbarOF (double Minv_inf, double Minv_sup, void* ptr) { + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::integration_ddbarOF_y); + F.params = ptr; - return 2*ddbarOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + double inf = Minv_inf; + double sup = Minv_sup; + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////DDBAR ODD BACKWARD Matrix element -double ReactionAFB::ddbarOB_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::ddbarOB_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1d = (ptr->xfx(x1,Q,1)) / x1; - double f1s = (ptr->xfx(x1,Q,3)) / x1; - double f1b = (ptr->xfx(x1,Q,5)) / x1; - double f2dbar = (ptr->xfx(x2,Q,-1)) / x2; - double f2sbar = (ptr->xfx(x2,Q,-3)) / x2; - double f2bbar = (ptr->xfx(x2,Q,-5)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1d = pdfx1[7] / x1; + double f1s = pdfx1[9] / x1; + double f1b = pdfx1[11] / x1; + double f2dbar = pdfx2[5] / x2; + double f2sbar = pdfx2[3] / x2; + double f2bbar = pdfx2[1] / x2; // PDF combinations double ddbar_PDF = f1d*f2dbar + f1s*f2sbar + f1b*f2bbar; // Angular integration limits double qbarq_cos_theta_max = 0; - double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut_param-y))),-sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); @@ -1006,73 +1117,88 @@ double ReactionAFB::ddbarOB_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return ddbarOB * propagator[3]; // Multiply the PDFs combination with the correct propagator. + return ddbarOB * propagator[3]; } -////DDBAR ODD BACKWARD Integration -double ReactionAFB::integration_ddbarOB (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double ddbarOB, error_ddbarOB; - // Initialization of the integration - gsl_monte_function Integrate_ddbarOB = { &(ReactionAFB::ddbarOB_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_ddbarOB, integration_inf, integration_sup, dim_integration, calls, r, s, &ddbarOB, &error_ddbarOB); - do - { - gsl_monte_vegas_integrate (&Integrate_ddbarOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &ddbarOB, &error_ddbarOB); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////DDBAR ODD BACKWARD Integration in rapidity +double ReactionAFB::integration_ddbarOB_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::ddbarOB_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return 2*result; +} + +////DDBAR ODD BACKWARD Integration in invariant mass +double ReactionAFB::integration_ddbarOB (double Minv_inf, double Minv_sup, void* ptr) { + + double result, error; - gsl_rng_free (r); + gsl_function F; + F.function = &(ReactionAFB::integration_ddbarOB_y); + F.params = ptr; - return 2*ddbarOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + double inf = Minv_inf; + double sup = Minv_sup; + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////DBARD EVEN FORWARD Matrix element -double ReactionAFB::dbardEF_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::dbardEF_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1dbar = (ptr->xfx(x1,Q,-1)) / x1; - double f1sbar = (ptr->xfx(x1,Q,-3)) / x1; - double f1bbar = (ptr->xfx(x1,Q,-5)) / x1; - double f2d = (ptr->xfx(x2,Q,1)) / x2; - double f2s = (ptr->xfx(x2,Q,3)) / x2; - double f2b = (ptr->xfx(x2,Q,5)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1dbar = pdfx1[5] / x1; + double f1sbar = pdfx1[3] / x1; + double f1bbar = pdfx1[1] / x1; + double f2d = pdfx2[7] / x2; + double f2s = pdfx2[9] / x2; + double f2b = pdfx2[11] / x2; // PDF combinations double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; // Angular integration limits double qbarq_cos_theta_max = 0; - double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut_param-y))),-sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double angular_integration_EB = (qbarq_cos_theta_max-qbarq_cos_theta_min)+(1.0/3.0)*(pow(qbarq_cos_theta_max,3)-pow(qbarq_cos_theta_min,3)); @@ -1085,72 +1211,87 @@ double ReactionAFB::dbardEF_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return dbardEF * propagator[2]; // Multiply the PDFs combination with the correct propagator. + return dbardEF * propagator[2]; } -////DBARD EVEN FORWARD Integration -double ReactionAFB::integration_dbardEF (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double dbardEF, error_dbardEF; - // Initialization of the integration - gsl_monte_function Integrate_dbardEF = { &(ReactionAFB::dbardEF_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_dbardEF, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardEF, &error_dbardEF); - do - { - gsl_monte_vegas_integrate (&Integrate_dbardEF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardEF, &error_dbardEF); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////DBARD EVEN FORWARD Integration in rapidity +double ReactionAFB::integration_dbardEF_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::dbardEF_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return 2*result; +} - gsl_rng_free (r); +////DBARD EVEN FORWARD Integration in invariant mass +double ReactionAFB::integration_dbardEF (double Minv_inf, double Minv_sup, void* ptr) { - return 2*dbardEF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::integration_dbardEF_y); + F.params = ptr; + + double inf = Minv_inf; + double sup = Minv_sup; + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////DBARD EVEN BACKWARD Matrix element -double ReactionAFB::dbardEB_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::dbardEB_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1dbar = (ptr->xfx(x1,Q,-1)) / x1; - double f1sbar = (ptr->xfx(x1,Q,-3)) / x1; - double f1bbar = (ptr->xfx(x1,Q,-5)) / x1; - double f2d = (ptr->xfx(x2,Q,1)) / x2; - double f2s = (ptr->xfx(x2,Q,3)) / x2; - double f2b = (ptr->xfx(x2,Q,5)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1dbar = pdfx1[5] / x1; + double f1sbar = pdfx1[3] / x1; + double f1bbar = pdfx1[1] / x1; + double f2d = pdfx2[7] / x2; + double f2s = pdfx2[9] / x2; + double f2b = pdfx2[11] / x2; // PDF combinations double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; // Angular integration limits - double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut_param-y))),sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double qqbar_cos_theta_min = 0; double angular_integration_EF = (qqbar_cos_theta_max-qqbar_cos_theta_min)+(1.0/3.0)*(pow(qqbar_cos_theta_max,3)-pow(qqbar_cos_theta_min,3)); @@ -1164,73 +1305,88 @@ double ReactionAFB::dbardEB_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return dbardEB * propagator[2]; // Multiply the PDFs combination with the correct propagator. + return dbardEB * propagator[2]; } -////DBARD EVEN BACKWARD Integration -double ReactionAFB::integration_dbardEB (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double dbardEB, error_dbardEB; - // Initialization of the integration - gsl_monte_function Integrate_dbardEB = { &(ReactionAFB::dbardEB_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_dbardEB, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardEB, &error_dbardEB); - do - { - gsl_monte_vegas_integrate (&Integrate_dbardEB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardEB, &error_dbardEB); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////DBARD EVEN BACKWARD Integration in rapidity +double ReactionAFB::integration_dbardEB_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::dbardEB_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return 2*result; +} + +////DBARD EVEN BACKWARD Integration in invariant mass +double ReactionAFB::integration_dbardEB (double Minv_inf, double Minv_sup, void* ptr) { + + double result, error; - gsl_rng_free (r); + gsl_function F; + F.function = &(ReactionAFB::integration_dbardEB_y); + F.params = ptr; - return 2*dbardEB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + double inf = Minv_inf; + double sup = Minv_sup; + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////DBARD ODD FORWARD Matrix element -double ReactionAFB::dbardOF_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::dbardOF_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1dbar = (ptr->xfx(x1,Q,-1)) / x1; - double f1sbar = (ptr->xfx(x1,Q,-3)) / x1; - double f1bbar = (ptr->xfx(x1,Q,-5)) / x1; - double f2d = (ptr->xfx(x2,Q,1)) / x2; - double f2s = (ptr->xfx(x2,Q,3)) / x2; - double f2b = (ptr->xfx(x2,Q,5)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1dbar = pdfx1[5] / x1; + double f1sbar = pdfx1[3] / x1; + double f1bbar = pdfx1[1] / x1; + double f2d = pdfx2[7] / x2; + double f2s = pdfx2[9] / x2; + double f2b = pdfx2[11] / x2; // PDF combinations double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; // Angular integration limits double qbarq_cos_theta_max = 0; - double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut-y))),-sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qbarq_cos_theta_min = max(cos(PI - 2*atan(exp(-eta_cut_param-y))),-sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double angular_integration_OB = pow(qbarq_cos_theta_max,2) - pow(qbarq_cos_theta_min,2); @@ -1243,72 +1399,87 @@ double ReactionAFB::dbardOF_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return dbardOF * propagator[3]; // Multiply the PDFs combination with the correct propagator. + return dbardOF * propagator[3]; } -////DBARD ODD FORWARD Integration -double ReactionAFB::integration_dbardOF (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double dbardOF, error_dbardOF; - // Initialization of the integration - gsl_monte_function Integrate_dbardOF = { &(ReactionAFB::dbardOF_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_dbardOF, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardOF, &error_dbardOF); - do - { - gsl_monte_vegas_integrate (&Integrate_dbardOF, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardOF, &error_dbardOF); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); +////DBARD ODD FORWARD Integration in rapidity +double ReactionAFB::integration_dbardOF_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::dbardOF_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); } + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return 2*result; +} - gsl_rng_free (r); +////DBARD ODD FORWARD Integration in invariant mass +double ReactionAFB::integration_dbardOF (double Minv_inf, double Minv_sup, void* ptr) { - return 2*dbardOF; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::integration_dbardOF_y); + F.params = ptr; + + double inf = Minv_inf; + double sup = Minv_sup; + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; } ////DBARD ODD BACKWARD Matrix element -double ReactionAFB::dbardOB_funct (double *entries, size_t dim, void *params) -{ - // Pointer to access PDFs - ReactionTheory* ptr = (ReactionTheory*) params; +double ReactionAFB::dbardOB_funct (double yreduced, void * params) { - (void)(dim); /* avoid unused parameter warnings */ - double yreduced = entries[0]; - double Minv = entries[1]; + // Pointer to access PDFs + ReactionTheory* ptr = (ReactionTheory*) ((integration_params*)params)->ptr; + // Pass the invariant mass as parameter + double Minv = ((integration_params*)params)-> Minv; // Partonic cross section parameters double Q = Minv; - double z = pow(Minv,2)/pow(energy,2); + double z = pow(Minv,2)/pow(energy_param,2); double y = -(1.0/2.0)*log(z)*(yreduced); double x1 = sqrt(z)*exp(y); double x2 = sqrt(z)*exp(-y); double dsigma_temp = pow(Minv,2)/(96*PI); - double dsigma = GeVtofb*dsigma_temp*(2*Minv/pow(energy,2))*(-(1.0/2.0)*log(z)); - - // Call the PDFs - double f1dbar = (ptr->xfx(x1,Q,-1)) / x1; - double f1sbar = (ptr->xfx(x1,Q,-3)) / x1; - double f1bbar = (ptr->xfx(x1,Q,-5)) / x1; - double f2d = (ptr->xfx(x2,Q,1)) / x2; - double f2s = (ptr->xfx(x2,Q,3)) / x2; - double f2b = (ptr->xfx(x2,Q,5)) / x2; + double dsigma = GeVtofb_param*dsigma_temp*(2*Minv/pow(energy_param,2))*(-(1.0/2.0)*log(z)); + + // Partons PDFs + std::valarray<double> pdfx1(13); + std::valarray<double> pdfx2(13); + (ptr->xfx(x1,Q,&pdfx1[0])); + (ptr->xfx(x2,Q,&pdfx2[0])); + double f1dbar = pdfx1[5] / x1; + double f1sbar = pdfx1[3] / x1; + double f1bbar = pdfx1[1] / x1; + double f2d = pdfx2[7] / x2; + double f2s = pdfx2[9] / x2; + double f2b = pdfx2[11] / x2; // PDF combinations double dbard_PDF = f1dbar*f2d + f1sbar*f2s + f1bbar*f2b; // Angular integration limits - double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut-y))),sqrt(1-4*(pow(pT_cut,2)/pow(Minv,2)))); + double qqbar_cos_theta_max = min(cos(2*atan(exp(-eta_cut_param-y))),sqrt(1-4*(pow(pT_cut_param,2)/pow(Minv,2)))); double qqbar_cos_theta_min = 0; double angular_integration_OF = pow(qqbar_cos_theta_max,2) - pow(qqbar_cos_theta_min,2); @@ -1322,62 +1493,74 @@ double ReactionAFB::dbardOB_funct (double *entries, size_t dim, void *params) double *propagator = propagators (Minv); - return dbardOB * propagator[3]; // Multiply the PDFs combination with the correct propagator. + return dbardOB * propagator[3]; } -////DBARD ODD BACKWARD Integration -double ReactionAFB::integration_dbardOB (double Minv_inf, double Minv_sup) -{ - double integration_inf[2] = {yreducedmin, Minv_inf}; - double integration_sup[2] = {yreducedmax, Minv_sup}; - - double dbardOB, error_dbardOB; - // Initialization of the integration - gsl_monte_function Integrate_dbardOB = { &(ReactionAFB::dbardOB_funct), dim_integration, this }; - const gsl_rng_type *T; - gsl_rng *r; - gsl_rng_env_setup (); - T = gsl_rng_default; - r = gsl_rng_alloc (T); - // Integration - { - gsl_monte_vegas_state *s = gsl_monte_vegas_alloc (dim_integration); - gsl_monte_vegas_integrate (&Integrate_dbardOB, integration_inf, integration_sup, dim_integration, calls, r, s, &dbardOB, &error_dbardOB); - do - { - gsl_monte_vegas_integrate (&Integrate_dbardOB, integration_inf, integration_sup, dim_integration, calls/5, r, s, &dbardOB, &error_dbardOB); - } - while (fabs (gsl_monte_vegas_chisq (s) - 1.0) > 0.5); - gsl_monte_vegas_free (s); - } +////DBARD ODD BACKWARD Integration in rapidity +double ReactionAFB::integration_dbardOB_y (double Minv, void * ptr) { + + // Pass the necessary parameters (pointer to the PDFs and Minv) + integration_params integrationParams; + integrationParams.Minv = Minv; + integrationParams.ptr = (ReactionTheory*) ptr; + + double result, error; - gsl_rng_free (r); + gsl_function F; + F.function = &(ReactionAFB::dbardOB_funct); + F.params = &integrationParams; + + double inf = y_min_param / log(energy_param/Minv); + double sup; + if (y_max_param == 0.0) { + sup = 1; + } else { + sup = y_max_param / log(energy_param/Minv); + } - return 2*dbardOB; // Factor 2 for the symmetric integration over yreduced: int_-1^1 dyreduced = 2 int_0^1 dyreduced. + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return 2*result; } +////DBARD ODD BACKWARD Integration in invariant mass +double ReactionAFB::integration_dbardOB (double Minv_inf, double Minv_sup, void* ptr) { + + double result, error; + + gsl_function F; + F.function = &(ReactionAFB::integration_dbardOB_y); + F.params = ptr; + + double inf = Minv_inf; + double sup = Minv_sup; + + gsl_integration_qng (&F, inf, sup, epsabs, epsrel, &result, &error, &calls); + + return result; +} double ReactionAFB::AFB (double Minv_inf, double Minv_sup) { - double uubarEF = integration_uubarEF (Minv_inf, Minv_sup); - double uubarEB = integration_uubarEB (Minv_inf, Minv_sup); - double uubarOF = integration_uubarOF (Minv_inf, Minv_sup); - double uubarOB = integration_uubarOB (Minv_inf, Minv_sup); - - double ubaruEF = integration_ubaruEF (Minv_inf, Minv_sup); - double ubaruEB = integration_ubaruEB (Minv_inf, Minv_sup); - double ubaruOF = integration_ubaruOF (Minv_inf, Minv_sup); - double ubaruOB = integration_ubaruOB (Minv_inf, Minv_sup); - - double ddbarEF = integration_ddbarEF (Minv_inf, Minv_sup); - double ddbarEB = integration_ddbarEB (Minv_inf, Minv_sup); - double ddbarOF = integration_ddbarOF (Minv_inf, Minv_sup); - double ddbarOB = integration_ddbarOB (Minv_inf, Minv_sup); + double uubarEF = integration_uubarEF (Minv_inf, Minv_sup, this); + double uubarEB = integration_uubarEB (Minv_inf, Minv_sup, this); + double uubarOF = integration_uubarOF (Minv_inf, Minv_sup, this); + double uubarOB = integration_uubarOB (Minv_inf, Minv_sup, this); + + double ubaruEF = integration_ubaruEF (Minv_inf, Minv_sup, this); + double ubaruEB = integration_ubaruEB (Minv_inf, Minv_sup, this); + double ubaruOF = integration_ubaruOF (Minv_inf, Minv_sup, this); + double ubaruOB = integration_ubaruOB (Minv_inf, Minv_sup, this); + + double ddbarEF = integration_ddbarEF (Minv_inf, Minv_sup, this); + double ddbarEB = integration_ddbarEB (Minv_inf, Minv_sup, this); + double ddbarOF = integration_ddbarOF (Minv_inf, Minv_sup, this); + double ddbarOB = integration_ddbarOB (Minv_inf, Minv_sup, this); - double dbardEF = integration_dbardEF (Minv_inf, Minv_sup); - double dbardEB = integration_dbardEB (Minv_inf, Minv_sup); - double dbardOF = integration_dbardOF (Minv_inf, Minv_sup); - double dbardOB = integration_dbardOB (Minv_inf, Minv_sup); + double dbardEF = integration_dbardEF (Minv_inf, Minv_sup, this); + double dbardEB = integration_dbardEB (Minv_inf, Minv_sup, this); + double dbardOF = integration_dbardOF (Minv_inf, Minv_sup, this); + double dbardOB = integration_dbardOB (Minv_inf, Minv_sup, this); // Reconstructed Forward and Backward double Forward = uubarEF+ubaruEF+ddbarEF+dbardEF+uubarOF+ubaruOF+ddbarOF+dbardOF; @@ -1396,10 +1579,100 @@ extern "C" ReactionAFB* create() { // Initialize at the start of the computation int ReactionAFB::initAtStart(const string &s) -{ - return 0; -} +{ + // Parameters from "/reactions/AFB/yaml/parameters.yaml" + // Check energy parameter: + std::cout << checkParam("energy") << std::endl; + if ( ! checkParam("energy") ) { + std::cout << "\n\n FATAL ERROR: collider energy (energy) is not defined !!! \n\n" <<std::endl; + return 1; + } + // Check eta parameter: + std::cout << checkParam("eta_cut") << std::endl; + if ( ! checkParam("eta_cut") ) { + std::cout << "\n\n FATAL ERROR: lepton pseudorapidity cut (eta_cut_param) is not defined !!! \n\n" <<std::endl; + return 1; + } + // Check pT parameter: + std::cout << checkParam("pT_cut") << std::endl; + if ( ! checkParam("eta_cut") ) { + std::cout << "\n\n FATAL ERROR: lepton transverse momentum cut (pT_cut_param) is not defined !!! \n\n" <<std::endl; + return 1; + } + // Check rapidity lower cut parameter: + std::cout << checkParam("y_min") << std::endl; + if ( ! checkParam("y_min") ) { + std::cout << "\n\n FATAL ERROR: di-lepton rapidity lower cut (y_min) is not defined !!! \n\n" <<std::endl; + return 1; + } + + // Check rapidity upper cut parameter: + std::cout << checkParam("y_max") << std::endl; + if ( ! checkParam("y_max") ) { + std::cout << "\n\n FATAL ERROR: di-lepton rapidity upper cut (y_max) is not defined !!! \n\n" <<std::endl; + return 1; + } + + // Constant + PI = 3.14159265; + + // Read default parameters + GeVtofb_param = pow(10, -3) * GetParam("convFac"); + alphaEM_param = GetParam("alphaem"); + stheta2W_param = GetParam("sin2thW"); + MZ_param = GetParam("Mz"); + GammaZ_param = GetParam("Wz"); + + // Read "reactions/AFB/yaml/params.yaml" + energy_param = GetParam("energy"); + eta_cut_param = GetParam("eta_cut"); + pT_cut_param = GetParam("pT_cut"); + y_min_param = GetParam("y_min"); // not implemented yet + y_max_param = GetParam("y_max"); // not implemented yet + + // Calculate fixed parameters + e_param = sqrt(4*PI*alphaEM_param); + gsm_param = (e_param/(sqrt(stheta2W_param)*sqrt(1-stheta2W_param)))*sqrt(1+pow(stheta2W_param,2)); + smangle_param = atan(-stheta2W_param); + + // Foton couplings + foton_Vu = e_param*(2.0/3.0); + foton_Au = 0; + foton_Vd = e_param*(-1.0/3.0); + foton_Ad = 0; + foton_Vl = e_param*(-1.0); + foton_Al = 0; + foton_Vnu = 0; + foton_Anu = 0; + + // Z-boson couplings + Z_Vu = (1.0/2.0)*gsm_param*(1.0/6.0)*(3*cos(smangle_param)+8*sin(smangle_param)); + Z_Au = (1.0/2.0)*gsm_param*(cos(smangle_param)/2.0); + Z_Vd = (1.0/2.0)*gsm_param*(1.0/6.0)*(-3*cos(smangle_param)-4*sin(smangle_param)); + Z_Ad = (1.0/2.0)*gsm_param*(-cos(smangle_param)/2.0); + Z_Vl = (1.0/2.0)*gsm_param*((-cos(smangle_param)/2.0)+(-2*sin(smangle_param))); + Z_Al = (1.0/2.0)*gsm_param*(-cos(smangle_param)/2.0); + Z_Vnu = (1.0/2.0)*gsm_param*(cos(smangle_param)/2.0); + Z_Anu = (1.0/2.0)*gsm_param*(cos(smangle_param)/2.0); + + // Even combination of couplings + even_foton_up = (pow(foton_Vu,2)+pow(foton_Au,2))*(pow(foton_Vl,2)+pow(foton_Al,2)); + even_foton_down = (pow(foton_Vd,2)+pow(foton_Ad,2))*(pow(foton_Vl,2)+pow(foton_Al,2)); + even_interf_up = ((foton_Vu*Z_Vu)+(foton_Au*Z_Au))*((foton_Vl*Z_Vl)+(foton_Al*Z_Al)); + even_interf_down = ((foton_Vd*Z_Vd)+(foton_Ad*Z_Ad))*((foton_Vl*Z_Vl)+(foton_Al*Z_Al)); + even_Z_up = (pow(Z_Vu,2)+pow(Z_Au,2))*(pow(Z_Vl,2)+pow(Z_Al,2)); + even_Z_down = (pow(Z_Vd,2)+pow(Z_Ad,2))*(pow(Z_Vl,2)+pow(Z_Al,2)); + // Odd combination of couplings + odd_foton_up = 4*foton_Vu*foton_Au*foton_Vl*foton_Al; + odd_foton_down = 4*foton_Vd*foton_Ad*foton_Vl*foton_Al; + odd_interf_up = (foton_Vu*Z_Au+foton_Au*Z_Vu)*(foton_Vl*Z_Al+foton_Al*Z_Vl); + odd_interf_down = (foton_Vd*Z_Ad+foton_Ad*Z_Vd)*(foton_Vl*Z_Al+foton_Al*Z_Vl); + odd_Z_up = 4*Z_Vu*Z_Au*Z_Vl*Z_Al; + odd_Z_down = 4*Z_Vd*Z_Ad*Z_Vl*Z_Al; + + return 0; +} // Main function to compute results at an iteration int ReactionAFB::compute(int dataSetID, valarray<double> &val, map<string, valarray<double> > &err) @@ -1409,18 +1682,18 @@ int ReactionAFB::compute(int dataSetID, valarray<double> &val, map<string, valar std::cout << "\n\nFATAL ERROR: AFB code requires Invariant mass bins to be present !!!" << std::endl; std::cout << "CHECK THE DATAFILE !!!" << std::endl; return 1; - } - + } + auto min = *Minv_min, max = *Minv_max; - + int Npnt_min = min.size(); int Npnt_max = max.size(); - + if (Npnt_min != Npnt_max) { std::cout << "\n\nFATAL ERROR: uneven number of Invariant mass min and max !!!" << std::endl; std::cout << "CHECK THE DATAFILE !!!" << std::endl; return 1; - } + } // Fill the array "val[i]" with the result of the AFB function for (int i = 0; i < Npnt_min; i++) { @@ -1428,6 +1701,5 @@ int ReactionAFB::compute(int dataSetID, valarray<double> &val, map<string, valar val[i] = AFB_result; } - - return 0; + return 0; } diff --git a/reactions/AFB/yaml/parameters.yaml b/reactions/AFB/yaml/parameters.yaml index e69de29bb..c33fa2911 100644 --- a/reactions/AFB/yaml/parameters.yaml +++ b/reactions/AFB/yaml/parameters.yaml @@ -0,0 +1,7 @@ +### Parameters for DY AFB + +energy : 13000.0 +eta_cut : 2.5 +pT_cut : 20.0 +y_min : 0.0 +y_max : 0.0 # if set to 0 no upper y_cut -- GitLab From c04e9aa7e25a5d537d0d12dfc81f52da99441a5c Mon Sep 17 00:00:00 2001 From: Oleksandr Zenaiev <oleksandr.zenaiev@cern.ch> Date: Sat, 8 Sep 2018 00:01:56 +0200 Subject: [PATCH 09/11] fixed Makefile --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index a79644754..ee288f31b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,7 @@ SUBDIRS = minuit/src interfaces/src DY/src DIPOLE/src RT/src EW/src common commo genetic/mixmax_r004 genetic/src QEDevol/src \ include interfaces/include FastNLO/include FastNLO/include/fastnlotk DiffDIS/include \ DY/include tools/draw/include \ - pdf2yaml tools/process + pdf2yaml tools/process \ reactions/AFB/src \ reactions/KFactor/src reactions/Fractal_DISNC/src reactions/BaseDISCC/src reactions/Hathor/src reactions/BaseDISNC/src \ reactions/RT_DISNC/src reactions/FFABM_DISNC/src reactions/FFABM_DISCC/src reactions/APPLgrid/src reactions/BaseHVQMNR/src \ -- GitLab From 1903b8a9151944556e0853b995eea717978bab0f Mon Sep 17 00:00:00 2001 From: Oleksandr Zenaiev <oleksandr.zenaiev@cern.ch> Date: Sat, 8 Sep 2018 00:02:38 +0200 Subject: [PATCH 10/11] updated main parameters.yaml --- parameters.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parameters.yaml b/parameters.yaml index 70fe67cb4..eb6c6e1bb 100644 --- a/parameters.yaml +++ b/parameters.yaml @@ -124,6 +124,10 @@ fcharm: 0. # APPLgrid settings: include : yaml/reactions/APPLgrid/parameters.yaml +# +# AFB settings: +include : yaml/reactions/AFB/parameters.yaml + # # (optional) Fractal module parameters: #---------------------- -- GitLab From 704f9d824bc5b6eabe14c0a399f1bfeedce3ad83 Mon Sep 17 00:00:00 2001 From: Oleksandr Zenaiev <oleksandr.zenaiev@cern.ch> Date: Sat, 8 Sep 2018 00:09:10 +0200 Subject: [PATCH 11/11] removed global variables --- reactions/AFB/include/ReactionAFB.h | 9 +++++++++ reactions/AFB/src/ReactionAFB.cc | 13 +++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/reactions/AFB/include/ReactionAFB.h b/reactions/AFB/include/ReactionAFB.h index 05a4d50bc..7b9a74b0f 100644 --- a/reactions/AFB/include/ReactionAFB.h +++ b/reactions/AFB/include/ReactionAFB.h @@ -32,6 +32,15 @@ class ReactionAFB : public ReactionTheory virtual int parseOptions(){ return 0;}; private: + // Define a structure to pass the parameters + struct integration_params { + double Minv; + ReactionTheory* ptr; + }; + + static size_t calls; + static double epsabs; + static double epsrel; static double PI; static double GeVtofb_param, alphaEM_param, stheta2W_param, MZ_param, GammaZ_param; static double energy_param, eta_cut_param, pT_cut_param, y_min_param, y_max_param; diff --git a/reactions/AFB/src/ReactionAFB.cc b/reactions/AFB/src/ReactionAFB.cc index f6af233a7..a8808fe48 100644 --- a/reactions/AFB/src/ReactionAFB.cc +++ b/reactions/AFB/src/ReactionAFB.cc @@ -23,10 +23,10 @@ double ReactionAFB::Z_Vu, ReactionAFB::Z_Au, ReactionAFB::Z_Vd, ReactionAFB::Z_A double ReactionAFB::even_foton_up, ReactionAFB::even_foton_down, ReactionAFB::even_interf_up, ReactionAFB::even_interf_down, ReactionAFB::even_Z_up, ReactionAFB::even_Z_down; double ReactionAFB::odd_foton_up, ReactionAFB::odd_foton_down, ReactionAFB::odd_interf_up, ReactionAFB::odd_interf_down, ReactionAFB::odd_Z_up, ReactionAFB::odd_Z_down; -const double epsabs = 0; -const double epsrel = 1e-2; +double ReactionAFB::epsabs = 0; +double ReactionAFB::epsrel = 1e-2; -size_t calls; +size_t ReactionAFB::calls; //// Function returning the combination of propagators @@ -46,13 +46,6 @@ double *ReactionAFB::propagators (double Minv) return propagators; } -// Define a structure to pass the parameters -struct integration_params { - double Minv; - ReactionTheory* ptr; - -}; - ////UUBAR EVEN FORWARD Matrix element double ReactionAFB::uubarEF_funct (double yreduced, void * params) { -- GitLab