diff --git a/CepGen/IO/MSTWGridHandler.cpp b/CepGen/IO/MSTWGridHandler.cpp index 5adf50c..e59add0 100644 --- a/CepGen/IO/MSTWGridHandler.cpp +++ b/CepGen/IO/MSTWGridHandler.cpp @@ -1,104 +1,104 @@ #include "MSTWGridHandler.h" namespace MSTW { GridHandler& GridHandler::get( const char* filename ) { static GridHandler instance( filename ); return instance; } GridHandler::GridHandler( const char* filename ) #ifdef GOOD_GSL : xacc_( 0 ), yacc_( 0 ), values_( { 0, 0 } ) #endif { gsl_set_error_handler_off(); #ifdef GOOD_GSL const gsl_interp2d_type* T = gsl_interp2d_bilinear; std::ifstream file( filename, std::ios::binary | std::ios::in ); if ( !file.is_open() ) { FatalError( Form( "Impossible to load grid file \"%s\"!", filename ) ); } header_t hdr; file.read( reinterpret_cast<char*>( &hdr ), sizeof( header_t ) ); if ( hdr.magic != good_magic ) { FatalError( Form( "Wrong magic number retrieved: %u, expecting %u!", hdr.magic, good_magic ) ); } - Information( Form( "Sample order: %u", hdr.order ) ); sfval_t val; // first loop to evaluate the limits std::set<double> q2_vals, xbj_vals; while ( file.read( reinterpret_cast<char*>( &val ), sizeof( sfval_t ) ) ) { q2_vals.insert( val.q2 ); xbj_vals.insert( val.xbj ); } if ( q2_vals.size() < 2 || xbj_vals.size() < 2 ) { FatalError( "Invalid grid retrieved!" ); } Information( Form( "MSTW structure functions grid evaluator built\n\t" + "order: %u\n\t" " Q² in range [%.3e:%.3e]\n\t" "xBj in range [%.3e:%.3e]", - *q2_vals.begin(), *q2_vals.rbegin(), *xbj_vals.begin(), *xbj_vals.rbegin() ) ); + hdr.order, *q2_vals.begin(), *q2_vals.rbegin(), *xbj_vals.begin(), *xbj_vals.rbegin() ) ); for ( unsigned short i = 0; i < 2; ++i ) { values_[i] = new double[q2_vals.size()*xbj_vals.size()]; splines_[i] = gsl_spline2d_alloc( T, q2_vals.size(), xbj_vals.size() ); } xacc_ = gsl_interp_accel_alloc(); yacc_ = gsl_interp_accel_alloc(); // second loop to populate the grid file.clear(); file.seekg( 0, std::ios::beg ); file.read( reinterpret_cast<char*>( &hdr ), sizeof( header_t ) ); while ( file.read( reinterpret_cast<char*>( &val ), sizeof( sfval_t ) ) ) { unsigned short id_q2 = std::distance( q2_vals.begin(), q2_vals.lower_bound( val.q2 ) ), id_xbj = std::distance( xbj_vals.begin(), xbj_vals.lower_bound( val.xbj ) ); gsl_spline2d_set( splines_[0], values_[0], id_q2, id_xbj, val.f2 ); gsl_spline2d_set( splines_[1], values_[1], id_q2, id_xbj, val.fl ); } // initialise the splines object std::vector<double> q2_vec( q2_vals.begin(), q2_vals.end() ), xbj_vec( xbj_vals.begin(), xbj_vals.end() ); double* xa = &q2_vec[0], *ya = &xbj_vec[0]; for ( unsigned short i = 0; i < 2; ++i ) { gsl_spline2d_init( splines_[i], xa, ya, values_[i], q2_vals.size(), xbj_vals.size() ); } #else FatalError( Form( "GSL version ≥ 2.1 is required for bilinear interpolation.\n\tVersion %s is installed on this system!", GSL_VERSION ) ); #endif } GridHandler::~GridHandler() { #ifdef GOOD_GSL for ( unsigned short i = 0; i < 2; ++i ) { gsl_spline2d_free( splines_[i] ); if ( values_[i] ) delete[] values_[i]; } if ( xacc_ ) gsl_interp_accel_free( xacc_ ); if ( yacc_ ) gsl_interp_accel_free( yacc_ ); #endif } CepGen::StructureFunctions GridHandler::eval( double q2, double xbj ) const { CepGen::StructureFunctions ev; #ifdef GOOD_GSL if ( gsl_spline2d_eval_e( splines_[0], q2, xbj, xacc_, yacc_, &ev.F2 ) == GSL_EDOM || gsl_spline2d_eval_e( splines_[1], q2, xbj, xacc_, yacc_, &ev.FL ) == GSL_EDOM ) { InWarning( Form( "Failed to evaluate the structure functions for Q² = %.5e GeV² / xbj = %.5e", q2, xbj ) ); return ev; } #else FatalError( Form( "GSL version ≥ 2.1 is required for bilinear interpolation.\n\tVersion %s is installed on this system!", GSL_VERSION ) ); #endif return ev; } } diff --git a/CepGen/IO/MSTWGridHandler.h b/CepGen/IO/MSTWGridHandler.h index 6ffdda9..0a547e5 100644 --- a/CepGen/IO/MSTWGridHandler.h +++ b/CepGen/IO/MSTWGridHandler.h @@ -1,62 +1,62 @@ #ifndef CepGen_IO_MSTWGridHandler_h #define CepGen_IO_MSTWGridHandler_h #include <gsl/gsl_version.h> #if GSL_MAJOR_VERSION > 2 || ( GSL_MAJOR_VERSION == 2 && GSL_MINOR_VERSION >= 1 ) #define GOOD_GSL 1 #endif #include "CepGen/Core/Exception.h" #include "CepGen/Core/utils.h" #include "CepGen/StructureFunctions/StructureFunctions.h" #include <gsl/gsl_errno.h> #include <gsl/gsl_math.h> #ifdef GOOD_GSL #include <gsl/gsl_interp2d.h> #include <gsl/gsl_spline2d.h> #endif #include <fstream> #include <array> #include <vector> #include <set> namespace MSTW { class GridHandler { public: static GridHandler& get( const char* filename ); ~GridHandler(); CepGen::StructureFunctions eval( double q2, double xbj ) const; private: GridHandler( const char* ); struct sfval_t { float q2, xbj; double f2, fl; }; struct header_t { unsigned int magic; enum { lo = 0, nlo = 1, nnlo = 2 } order; }; - static constexpr unsigned int good_magic = 0x4d535457; // MSTW in ASCII + static constexpr unsigned int good_magic = 0x5754534d; // MSTW in ASCII #ifdef GOOD_GSL std::array<gsl_spline2d*,2> splines_; gsl_interp_accel* xacc_, *yacc_; std::array<double*,2> values_; #endif public: GridHandler( const GridHandler& ) = delete; void operator=( const GridHandler& ) = delete; }; } #endif diff --git a/CepGen/StructureFunctions/ALLM.cpp b/CepGen/StructureFunctions/ALLM.cpp index 3fb6d98..10d091f 100644 --- a/CepGen/StructureFunctions/ALLM.cpp +++ b/CepGen/StructureFunctions/ALLM.cpp @@ -1,162 +1,162 @@ #include "ALLM.h" #include "CepGen/Physics/ParticleProperties.h" #include <cmath> namespace CepGen { namespace SF { ALLM::Parameterisation ALLM::Parameterisation::allm91() { Parameterisation p; p.pomeron = Parameters( { { 0.26550, 0.04856, 1.04682 }, { -0.04503, -0.36407, 8.17091 }, { 0.49222, 0.52116, 3.5515 } } ); p.reggeon = Parameters( { { 0.67639, 0.49027, 2.66275 }, { 0.60408, 0.17353, 1.61812 }, { 1.26066, 1.83624, 0.81141 } } ); p.m02 = 0.30508; p.mp2 = 10.676; p.mr2 = 0.20623; p.q02 = 0.27799; p.lambda2 = 0.06527; return p; } ALLM::Parameterisation ALLM::Parameterisation::allm97() { Parameterisation p; p.pomeron = Parameters( { { 0.28067, 0.22291, 2.1979 }, { -0.0808, -0.44812, 1.1709 }, { 0.36292, 1.8917, 1.8439 } } ); p.reggeon = Parameters( { { 0.80107, 0.97307, 3.4924 }, { 0.58400, 0.37888, 2.6063 }, { 0.01147, 3.7582, 0.49338 } } ); p.m02 = 0.31985; p.mp2 = 49.457; p.mr2 = 0.15052; p.q02 = 0.52544; p.lambda2 = 0.06526; return p; } ALLM::Parameterisation ALLM::Parameterisation::hht_allm() { Parameterisation p; p.pomeron = Parameters( { { 0.412, 0.164, 17.7 }, { -0.835, -0.446, 10.6 }, { -45.8, 55.7, -0.031 } } ); p.reggeon = Parameters( { { -1.04, 2.97, 0.163 }, { 0.706, 0.185, -16.4 }, { -1.29, 4.51, 1.16 } } ); p.m02 = 0.446; p.mp2 = 74.2; p.mr2 = 29.3; p.q02 = 4.74e-5; p.lambda2 = 2.2e-8; return p; } ALLM::Parameterisation ALLM::Parameterisation::hht_allm_ft() { Parameterisation p; p.pomeron = Parameters( { { 0.356, 0.171, 18.6 }, { -0.075, -0.470, 9.2 }, { -0.477, 54.0, 0.073 } } ); p.reggeon = Parameters( { { -0.636, 3.37, -0.660 }, { 0.882, 0.082, -8.5 }, { 0.339, 3.38, 1.07 } } ); p.m02 = 0.388; p.mp2 = 50.8; p.mr2 = 0.838; p.q02 = 1.87e-5; p.lambda2 = 4.4e-9; return p; } ALLM::Parameterisation ALLM::Parameterisation::gd07p() { Parameterisation p; p.pomeron = Parameters( { { 0.339, 0.127, 1.16 }, { -0.105, -0.495, 1.29 }, { -1.42, 4.51, 0.551 } } ); p.reggeon = Parameters( { { 0.838, 2.36, 1.77 }, { 0.374, 0.998, 0.775 }, { 2.71, 1.83, 1.26 } } ); p.m02 = 0.454; p.mp2 = 30.7; p.mr2 = 0.117; p.q02 = 1.15; p.lambda2 = 0.06527; return p; } ALLM::Parameterisation ALLM::Parameterisation::gd11p() { Parameterisation p; p.pomeron = Parameters( { { 0.3638, 0.1211, 1.166 }, // c { -0.11895, -0.4783, 1.353 }, // a { 1.0833, 2.656, 1.771 } } ); // b p.reggeon = Parameters( { { 1.3633, 2.256, 2.209 }, { 0.3425, 1.0603, 0.5164 }, { -10.408, 14.857, 0.07739 } } ); p.m02 = 0.5063; p.mp2 = 34.75; p.mr2 = 0.03190; p.q02 = 1.374; p.lambda2 = 0.06527; return p; } ALLM - ALLM::operator()( double q2, double xbj ) const + ALLM::operator()( double q2, double xbj, const SigmaRatio& rcomp ) const { const double factor = q2/( q2+params_.m02 ); const double W2_eff = q2*( 1.-xbj )/xbj; const double xp = ( q2+params_.mp2 )/( q2+W2_eff+params_.mp2 ), xr = ( q2+params_.mr2 )/( q2+W2_eff+params_.mr2 ); const double xlog1 = log( ( q2+params_.q02 )/ params_.lambda2 ), xlog2 = log( params_.q02/params_.lambda2 ); const double t = log( xlog1/xlog2 ); const double apom = params_.pomeron.a[0] + ( params_.pomeron.a[0]-params_.pomeron.a[1] )*( 1./( 1.+pow( t, params_.pomeron.a[2] ) ) - 1. ); const double bpom = params_.pomeron.b[0] + params_.pomeron.b[1]*pow( t, params_.pomeron.b[2] ); const double cpom = params_.pomeron.c[0] + ( params_.pomeron.c[0]-params_.pomeron.c[1] )*( 1./( 1.+pow( t, params_.pomeron.c[2] ) ) - 1. ); const double areg = params_.reggeon.a[0] + params_.reggeon.a[1]*pow( t, params_.reggeon.a[2] ); const double breg = params_.reggeon.b[0] + params_.reggeon.b[1]*pow( t, params_.reggeon.b[2] ); const double creg = params_.reggeon.c[0] + params_.reggeon.c[1]*pow( t, params_.reggeon.c[2] ); const double F2_Pom = cpom*pow( xp, apom )*pow( 1.-xbj, bpom ), F2_Reg = creg*pow( xr, areg )*pow( 1.-xbj, breg ); ALLM allm; allm.F2 = factor * ( F2_Pom + F2_Reg ); - const double R = ratio_comp_( q2, xbj ); + const double R = rcomp( q2, xbj ); const double mp2 = ParticleProperties::mass( Proton )*ParticleProperties::mass( Proton ); - const double tau = 4.*xbj*xbj+mp2/q2; + const double tau = 4.*xbj*xbj*mp2/q2; allm.FL = allm.F2 * ( 1.+tau ) * ( R/( 1.+R ) ); return allm; } } } diff --git a/CepGen/StructureFunctions/ALLM.h b/CepGen/StructureFunctions/ALLM.h index e15703e..7acd2e0 100644 --- a/CepGen/StructureFunctions/ALLM.h +++ b/CepGen/StructureFunctions/ALLM.h @@ -1,62 +1,61 @@ #ifndef CepGen_StructureFunctions_ALLM_h #define CepGen_StructureFunctions_ALLM_h #include "StructureFunctions.h" #include "SigmaRatio.h" #include <vector> namespace CepGen { namespace SF { class ALLM : public StructureFunctions { public: class Parameterisation { private: struct Parameters { Parameters() : a( { 0., 0., 0. } ), b( { 0., 0., 0. } ), c( { 0., 0., 0. } ) {} Parameters( std::vector<double> c, std::vector<double> a, std::vector<double> b ) : a( a ), b( b ), c( c ) {} std::vector<double> a, b, c; }; public: Parameterisation() : m02( 0. ), mp2( 0. ), mr2( 0. ), q02( 0. ), lambda2( 0. ) {} /// Pre-HERA data fit (694 data points) static Parameterisation allm91(); /// Fixed target and HERA photoproduction total cross sections (1356 points) static Parameterisation allm97(); static Parameterisation hht_allm(); static Parameterisation hht_allm_ft(); static Parameterisation gd07p(); static Parameterisation gd11p(); Parameters pomeron, reggeon; /// Effective photon squared mass double m02; /// Effective pomeron squared mass double mp2; /// Effective reggeon squared mass double mr2; double q02; /// Squared QCD scale double lambda2; }; - ALLM( const ALLM::Parameterisation& param = ALLM::Parameterisation::allm97(), const SigmaRatio& sr = E143Ratio() ) : - params_( param ), ratio_comp_( sr ) {} - ALLM operator()( double q2, double xbj ) const; + ALLM( const ALLM::Parameterisation& param = ALLM::Parameterisation::allm97() ) : + params_( param ) {} + ALLM operator()( double q2, double xbj, const SigmaRatio& rcomp = E143Ratio() ) const; private: Parameterisation params_; - SigmaRatio ratio_comp_; }; } } #endif diff --git a/CepGen/StructureFunctions/SigmaRatio.cpp b/CepGen/StructureFunctions/SigmaRatio.cpp index 2548fd4..a938d7f 100644 --- a/CepGen/StructureFunctions/SigmaRatio.cpp +++ b/CepGen/StructureFunctions/SigmaRatio.cpp @@ -1,44 +1,45 @@ #include "SigmaRatio.h" #include <math.h> +#include <iostream> namespace CepGen { namespace SF { E143Ratio::Parameterisation E143Ratio::Parameterisation::standard() { Parameterisation out; out.q2_b = 0.34; out.a = { { 0.0485, 0.5470, 2.0621, -0.3804, 0.5090, -0.0285 } }; out.b = { { 0.0481, 0.6114, -0.3509, -0.4611, 0.7172, -0.0317 } }; out.c = { { 0.0577, 0.4644, 1.8288, 12.3708, -43.1043, 41.7415 } }; return out; } double E143Ratio::operator()( double q2, double xbj ) const { const double u = q2/params_.q2_b; const double xl = log( 25.*q2 ); const double pa = ( 1.+params_.a[3]*xbj+params_.a[4]*xbj*xbj )*pow( xbj, params_.a[5] ); const double pb = ( 1.+params_.b[3]*xbj+params_.b[4]*xbj*xbj )*pow( xbj, params_.b[5] ); const double tt = theta( q2, xbj ); const double q2_thr = params_.c[3]*xbj + params_.c[4]*xbj*xbj+params_.c[5]*xbj*xbj*xbj; const double ra = params_.a[0]/xl*tt + params_.a[1]/pow( pow( q2, 4 )+pow( params_.a[2], 4 ), 0.25 )*pa, rb = params_.b[0]/xl*tt + ( params_.b[1]/q2+params_.b[2]/( q2*q2+0.3*0.3 ) )*pb, rc = params_.c[0]/xl*tt + params_.c[1]*pow( pow( q2-q2_thr, 2 )+pow( params_.c[2], 2 ), -0.5 ); const double r = ( ra+rb+rc ) / 3.; if ( q2 > params_.q2_b ) return r; return r * 0.5 * ( 3.*u-u*u*u ); } double E143Ratio::theta( double q2, double xbj ) const { return 1.+12.*( q2/( q2+1. ) )*( 0.125*0.125/( 0.125*0.125+xbj*xbj ) ); } } } diff --git a/CepGen/StructureFunctions/SigmaRatio.h b/CepGen/StructureFunctions/SigmaRatio.h index 2ba63fd..1e6c72c 100644 --- a/CepGen/StructureFunctions/SigmaRatio.h +++ b/CepGen/StructureFunctions/SigmaRatio.h @@ -1,37 +1,37 @@ #ifndef CepGen_StructureFunctions_SigmaRatio_h #define CepGen_StructureFunctions_SigmaRatio_h #include <array> namespace CepGen { namespace SF { class SigmaRatio { public: SigmaRatio() {} - virtual double operator()( double q2, double xbj ) const { return 0.; } + virtual double operator()( double q2, double xbj ) const = 0; }; class E143Ratio : public SigmaRatio { public: struct Parameterisation { double q2_b; std::array<double,6> a, b, c; static Parameterisation standard(); }; E143Ratio( const Parameterisation& param = Parameterisation::standard() ) : params_( param ) {} double operator()( double q2, double xbj ) const override; private: double theta( double q2, double xbj ) const; Parameterisation params_; }; } } #endif diff --git a/External/F2_Luxlike_fit/F2_luxlike_minimal.f b/External/F2_Luxlike_fit/F2_luxlike_minimal.f index a6a9041..e393445 100644 --- a/External/F2_Luxlike_fit/F2_luxlike_minimal.f +++ b/External/F2_Luxlike_fit/F2_luxlike_minimal.f @@ -1,121 +1,74 @@ +c -------------------------------------------------- subroutine F2_fit_luxlike(xbj,q2,F2,FL) +c -------------------------------------------------- c input: x,q2 c output: F2,F1 implicit real*8 (a-h,o-z) common/luxlike_params/amp,am_pi,alpha_em, & q2_cut,w2_lo,w2_hi, & ires_model,icont_model c ----------------------------- w_thr = amp+am_pi w2 = amp**2 + q2*(1.d0-xbj)/xbj w = dsqrt(w2) c ----------------------------- omega = (w2-w2_lo)/(w2_hi-w2_lo) rho = 2.d0*omega**2 - omega**4 if(q2.ge.q2_cut) then if(w2.gt.w2_hi) then ! MSTW grid call CepGen_Structure_Functions(205,Q2,xbj,F2p,FLp) F2 = F2p FL = FLp - elseif(w2.le.w2_hi) then + else call F2_cont(xbj,q2,F2c,FLc) F2 = F2c FL = FLc endif else ! Q2 < Q2cut if(w2.le.w2_lo) then if(ires_model.eq.1) then ! Christy-Bosted call CepGen_Structure_Functions(102,Q2,xbj,F2r,FLr) elseif(ires_model.eq.2) then ! Fiore-Brasse call CepGen_Structure_Functions(101,Q2,xbj,F2r,FLr) endif F2 = F2r FL = FLr elseif(w2.gt.w2_lo.and.w2.le.w2_hi) then if(ires_model.eq.1) then ! Christy-Bosted call CepGen_Structure_Functions(102,Q2,xbj,F2r,FLr) elseif(ires_model.eq.2) then ! Fiore-Brasse call CepGen_Structure_Functions(101,Q2,xbj,F2r,FLr) endif call F2_cont(xbj,q2,F2c,FLc) F2 = (1.d0-rho)*F2r + rho*F2c FL = (1.d0-rho)*FLr + rho*FLc elseif(w2.gt.w2_hi) then call F2_cont(xbj,q2,F2c,FLc) F2 = F2c FL = FLc endif endif return end c --------------------------------------------------------- subroutine F2_CONT(xbj,q2,F2c,FLc) implicit real*8 (a-h,o-z) common/luxlike_params/amp,am_pi,alpha_em, & q2_cut,w2_lo,w2_hi, & ires_model,icont_model if(icont_model.eq.1) then ! GD11p call CepGen_Structure_Functions(204,Q2,xbj,F2,FL) elseif(icont_model.eq.2) then ! ALLM91 call CepGen_Structure_Functions(201,Q2,xbj,F2,FL) elseif(icont_model.eq.3) then ! ALLM97 call CepGen_Structure_Functions(202,Q2,xbj,F2,FL) endif F2c = F2 - R = R_1998(xbj,Q2) - tau = 4.d0*xbj**2*amp**2/q2 - FLc = F2c*(1+tau)*R/(1.d0+R) - - return - end -c ------------------------------------------------- - double precision function R_1998(x,q2) - implicit real*8 (a-h,o-z) - -c from hep-ex/9808028v1, K.Abe et al.(SLAC) - - data a1,a2,a3/0.0485d0,0.5470d0,2.0621d0/ - data a4,a5,a6/-0.3804d0,0.5090d0,-0.0285d0/ - data b1,b2,b3/0.0481d0,0.6114d0,-0.3509d0/ - data b4,b5,b6/-0.4611d0,0.7172d0,-0.0317d0/ - data c1,c2,c3/0.0577d0,0.4644d0,1.8288d0/ - data c4,c5,c6/12.3708d0,-43.1043d0,41.7415d0/ - - q2_b = 0.34 - u = q2/q2_b - xl = dlog(q2/0.04d0) - - pa = (1.d0 + a4*x +a5*x**2)*x**a6 - pb = (1.d0 + b4*x +b5*x**2)*x**b6 - tt = theta(x,q2) - q2_thr = c4*x +c5*x**2+c6*x**3 - - ra = a1/xl*tt+a2/(q2**4.d0+a3**4.d0)**.25d0*pa - rb = b1/xl*tt+(b2/q2+b3/(q2**2+.3d0**2))*pb - rc = c1/xl*tt+c2*((q2-q2_thr)**2 +c3**2)**(-.5d0) - - - R =(ra+rb+rc)/3.d0 - - if(q2.gt.q2_b) then - R_1998 = R - else - R_1998 = R*(3.d0*u - u**3)/2.d0 - endif + FLc = F2c return end - -c ------------------------------------------------- - double precision function theta(x,q2) -c -c function needed for the 1998 parametrisation of R=sigma_L/sigma_T -c - implicit real*8(a-h,o-z) - theta = 1.d0 + 12.d0*q2/(q2+1.d0) - > *(0.125d0**2/(.125d0**2 +x**2)) - return - end c -------------------------------------------------- + diff --git a/External/F2_Luxlike_fit/mstw_f2_scan_nnlo.dat b/External/F2_Luxlike_fit/mstw_f2_scan_nnlo.dat index ca2ff95..96cecc5 100644 Binary files a/External/F2_Luxlike_fit/mstw_f2_scan_nnlo.dat and b/External/F2_Luxlike_fit/mstw_f2_scan_nnlo.dat differ