18#include "marley/Error.hh"
19#include "marley/JSON.hh"
20#include "marley/JSONConfig.hh"
21#include "marley/NucleonFormFactors.hh"
22#include "marley/marley_utils.hh"
25 return marley_utils::g_V * this->
dipole( Q2 );
29 return marley_utils::mu_p * this->
dipole( Q2 );
33 return marley_utils::mu_n * this->
dipole( Q2 );
39 const std::vector< double >& a_coeffs,
40 const std::vector< double >& b_coeffs )
46 for (
const auto& a : a_coeffs ) {
52 for (
const auto& b : b_coeffs ) {
57 double ff_G = numer / denom;
62 double tau = this->tau( Q2 );
64 return marley_utils::g_V * this->
bbba05_G(
tau, { 1., -0.0578 },
65 { 11.1, 13.6, 33. } );
69 double tau = this->tau( Q2 );
71 return marley_utils::mu_p * this->
bbba05_G(
tau, { 1., 0.150 },
72 { 11.1, 19.6, 7.54 } );
76 double tau = this->tau( Q2 );
79 { -9.86, 305., -758., 802. } );
83 double tau = this->tau( Q2 );
85 return marley_utils::mu_n * this->
bbba05_G(
tau, { 1., 1.81 },
86 { 14.1, 20.7, 68.7 } );
90 {
return marley_utils::g_V; }
95 {
return marley_utils::mu_p; }
98 {
return marley_utils::mu_n; }
101 {
return -marley_utils::g_A; }
104 return -2. * marley_utils::g_A * marley_utils::m_nucleon
105 / marley_utils::m_pion / marley_utils::m_pion;
109 double tau = sachs_ff_->tau( Q2 );
110 double GEp = sachs_ff_->GEp( Q2 );
111 double GMp = sachs_ff_->GMp( Q2 );
112 double F1p = ( GEp + tau*GMp ) / ( 1. + tau );
117 double tau = sachs_ff_->tau( Q2 );
118 double GEn = sachs_ff_->GEn( Q2 );
119 double GMn = sachs_ff_->GMn( Q2 );
120 double F1n = ( GEn + tau*GMn ) / ( 1. + tau );
125 double tau = sachs_ff_->tau( Q2 );
126 double GEp = sachs_ff_->GEp( Q2 );
127 double GMp = sachs_ff_->GMp( Q2 );
128 double F2p = ( GMp - GEp ) / ( 1. + tau ) / 2. / marley_utils::m_nucleon;
133 double tau = sachs_ff_->tau( Q2 );
134 double GEn = sachs_ff_->GEn( Q2 );
135 double GMn = sachs_ff_->GMn( Q2 );
136 double F2n = ( GMn - GEn ) / ( 1. + tau ) / 2. / marley_utils::m_nucleon;
140marley::NucleonFormFactors::NucleonFormFactors(
const marley::JSON& config ) {
145 static bool need_to_log =
true;
151 sachs_ff_ = std::make_shared< TrivialSachsFormFactors >();
152 axial_ff_ = std::make_shared< TrivialAxialFormFactors >();
157 if ( !config.has_key(
"sachs_model") ) {
158 throw marley::Error(
"Missing Sachs form factor model configuration" );
160 const auto& sachs_json = config.at(
"sachs_model" );
161 if ( !sachs_json.is_string() ) {
162 throw marley::Error(
"Invalid Sachs form factor model "
163 + sachs_json.dump_string() );
165 std::string sachs_ff_model = sachs_json.to_string();
167 if ( !config.has_key(
"axial_model") ) {
168 throw marley::Error(
"Missing axial form factor model configuration" );
170 const auto& axial_json = config.at(
"axial_model" );
171 if ( !axial_json.is_string() ) {
172 throw marley::Error(
"Invalid axial form factor model "
173 + axial_json.dump_string() );
175 std::string axial_ff_model = axial_json.to_string();
178 if ( sachs_ff_model ==
"trivial" ) {
179 sachs_ff_ = std::make_shared< TrivialSachsFormFactors >();
181 MARLEY_LOG( INFO,
"physics.formfactor" ) <<
"Using trivial Sachs form factors";
184 else if ( sachs_ff_model ==
"dipole" ) {
185 sachs_ff_ = std::make_shared< DipoleSachsFormFactors >( marley_utils::M_V );
187 MARLEY_LOG( INFO,
"physics.formfactor" ) <<
"Using dipole Sachs form factors";
190 else if ( sachs_ff_model ==
"bbba05" ) {
191 sachs_ff_ = std::make_shared< BBBA05SachsFormFactors >();
193 MARLEY_LOG( INFO,
"physics.formfactor" ) <<
"Using BBBA05 Sachs form factors";
196 else throw marley::Error(
"Unrecognized Sachs form factor model name \""
197 + sachs_ff_model +
"\" in constructor of marley::NucleonFormFactors" );
200 if ( axial_ff_model ==
"trivial" ) {
201 axial_ff_ = std::make_shared< TrivialAxialFormFactors >();
203 MARLEY_LOG( INFO,
"physics.formfactor" ) <<
"Using trivial axial form factors";
206 else if ( axial_ff_model ==
"dipole" ) {
207 axial_ff_ = std::make_shared< DipoleAxialFormFactors >( marley_utils::g_A,
210 MARLEY_LOG( INFO,
"physics.formfactor" ) <<
"Using dipole axial form factors";
213 else throw marley::Error(
"Unrecognized axial form factor model name \""
214 + axial_ff_model +
"\" in constructor of marley::NucleonFormFactors" );
220 return Q2 / 4. / marley_utils::m_nucleon / marley_utils::m_nucleon;
224 return 2. * marley_utils::m_nucleon * this->
FA( Q2 )
225 / ( marley_utils::m_pion*marley_utils::m_pion + Q2 );
Base class for all exceptions thrown by MARLEY functions.
static bool check_for_allowed_approximation(const marley::JSON &ff_config)