MARLEY (Model of Argon Reaction Low Energy Yields) v2.0.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Loading...
Searching...
No Matches
marley::NuclearFormFactor Class Referenceabstract

Base class for nuclear form factor models. More...

#include <NuclearFormFactor.hh>

Inheritance diagram for marley::NuclearFormFactor:
marley::HelmNuclearFormFactor marley::KleinNystrandNuclearFormFactor marley::TrivialNuclearFormFactor

Public Member Functions

 NuclearFormFactor (int Z, int A)
 
int A () const
 
virtual double F (double kappa) const =0
 
int Z () const
 

Static Public Member Functions

static std::shared_ptr< marley::NuclearFormFactorcreate (int Z, int A, const JSON &ff_config)
 

Protected Attributes

int A_
 Nucleon number.
 
int Z_
 Proton number.
 

Detailed Description

Base class for nuclear form factor models.

Definition at line 33 of file NuclearFormFactor.hh.

Constructor & Destructor Documentation

◆ NuclearFormFactor()

marley::NuclearFormFactor::NuclearFormFactor ( int Z,
int A )
inline
Parameters
ZProton number
ANucleon number

Definition at line 38 of file NuclearFormFactor.hh.

38: Z_( Z ), A_( A ) {}

References A_, and Z_.

Member Function Documentation

◆ A()

int marley::NuclearFormFactor::A ( ) const
inline

Definition at line 47 of file NuclearFormFactor.hh.

47{ return A_; }

◆ create()

std::shared_ptr< marley::NuclearFormFactor > marley::NuclearFormFactor::create ( int Z,
int A,
const JSON & ff_config )
static

Factory method to create derived class objects

Parameters
ZProton number
ANucleon number
ff_configJSON object containing the model configuration to use when initializing the new object

Definition at line 24 of file NuclearFormFactor.cc.

26{
27 static bool need_to_log_nuc_ff_info = true;
28
29 // If the user has requested use of the allowed approximation, then configure
30 // the trivial nuclear form factor model and return without logging this
31 // choice (it will be handled elsewhere)
33 auto tnff = std::make_shared< marley::TrivialNuclearFormFactor >( Z, A );
34 need_to_log_nuc_ff_info = false;
35 return tnff;
36 }
37
38 if ( !ff_config.has_key("nuclear_model") ) {
39 throw marley::Error( "Missing nuclear form factor model configuration" );
40 }
41 const auto& nucl_json = ff_config.at( "nuclear_model" );
42 if ( !nucl_json.is_string() ) {
43 throw marley::Error( "Invalid nuclear form factor model "
44 + nucl_json.dump_string() );
45 }
46 std::string nucl_ff_model = nucl_json.to_string();
47
48 std::shared_ptr< marley::NuclearFormFactor > nuclear_ff;
49
50 // Choose the model to use for the nuclear form factor
51 if ( nucl_ff_model == "trivial" ) {
52 nuclear_ff = std::make_shared< marley::TrivialNuclearFormFactor >( Z, A );
53 if ( need_to_log_nuc_ff_info ) {
54 MARLEY_LOG( INFO, "physics.formfactor" ) << "Using trivial nuclear form factor";
55 }
56 }
57 else if ( nucl_ff_model == "helm" ) {
58 nuclear_ff = std::make_shared< marley::HelmNuclearFormFactor >( Z, A );
59 if ( need_to_log_nuc_ff_info ) {
60 MARLEY_LOG( INFO, "physics.formfactor" ) << "Using Helm nuclear form factor";
61 }
62 }
63 else if ( nucl_ff_model == "klein" ) {
64
65 // Retrieve the optional "nucl_options" JSON object if it is present
66 bool ok; // dummy flag used when parsing the JSON configuration
67 marley::JSON nucl_opt = assign_from_json< marley::JSON >(
68 "nucl_options", ff_config, ok, marley::JSON::object() );
69
70 // Set the "adapted" option from the parameters if it is present
71 bool adapted = assign_from_json< bool >( "adapted", nucl_opt, ok, true );
72
73 nuclear_ff = std::make_shared< marley
74 ::KleinNystrandNuclearFormFactor >( Z, A, adapted );
75
76 if ( need_to_log_nuc_ff_info ) {
77 std::string kn_name;
78 if ( adapted ) kn_name += "adapted ";
79 kn_name += "Klein-Nystrand";
80 MARLEY_LOG( INFO, "physics.formfactor" ) << "Using " << kn_name << " nuclear form factor";
81 }
82 }
83 else throw marley::Error( "Unrecognized nuclear form factor model name \""
84 + nucl_ff_model + "\" in marley::NuclearFormFactor::create()" );
85
86 need_to_log_nuc_ff_info = false;
87 return nuclear_ff;
88}
static bool check_for_allowed_approximation(const marley::JSON &ff_config)

References marley::JSONConfig::check_for_allowed_approximation().

Referenced by marley::DiscreteNuclearReaction::DiscreteNuclearReaction().

◆ F()

virtual double marley::NuclearFormFactor::F ( double kappa) const
pure virtual

Evaluate the nuclear form factor at a given 3-momentum transfer

Parameters
kappaMagnitude of the 3-momentum transfer (MeV)

Implemented in marley::HelmNuclearFormFactor, marley::KleinNystrandNuclearFormFactor, and marley::TrivialNuclearFormFactor.

References Z_.

◆ Z()

int marley::NuclearFormFactor::Z ( ) const
inline

Definition at line 46 of file NuclearFormFactor.hh.

46{ return Z_; }

Member Data Documentation

◆ A_

int marley::NuclearFormFactor::A_
protected

Nucleon number.

Definition at line 63 of file NuclearFormFactor.hh.

Referenced by NuclearFormFactor().

◆ Z_

int marley::NuclearFormFactor::Z_
protected

Proton number.

Definition at line 60 of file NuclearFormFactor.hh.

Referenced by NuclearFormFactor(), and F().


The documentation for this class was generated from the following files: