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::ContinuumNuclearReaction Class Reference

Generates inclusive scattering events and computes cross sections using tabulated nuclear responses. More...

#include <ContinuumNuclearReaction.hh>

Inheritance diagram for marley::ContinuumNuclearReaction:
marley::NuclearReaction marley::Reaction

Public Types

enum class  SubContinuumMode { IGNORE , MIRROR , ACCUMULATE }
 
- Public Types inherited from marley::Reaction
enum  DataFormat { DiscreteStrengths = 0 , MultipoleResponses = 1 }
 Enumerated type describing the file format for reaction data. More...
 
enum  ProcessType {
  Unknown = -1 , NeutrinoCC_Discrete = 0 , AntiNeutrinoCC_Discrete = 1 , NC_Discrete = 2 ,
  NuElectronElastic = 3 , NeutrinoCC_Continuum = 4 , AntiNeutrinoCC_Continuum = 5 , NC_Continuum = 6 ,
  StandaloneDecay = 7
}
 Enumerated type describing the kind of scattering process represented by a Reaction. More...
 

Public Member Functions

 ContinuumNuclearReaction (Reaction::ProcessType pt, int pdg_a, int pdg_b, int pdg_c, int pdg_d, int q_d, const std::shared_ptr< TabulatedXSec > &txsec, const std::string &source_file)
 
virtual std::shared_ptr< HepMC3::GenEventcreate_event (int particle_id_a, double KEa, marley::Generator &gen) const override
 Create an event object for this reaction.
 
const TabulatedXSecget_tabulated_xsec () const
 
virtual double total_xs (int pdg_a, double KEa) const override
 Compute the reaction's total cross section (MeV -2)
 
- Public Member Functions inherited from marley::NuclearReaction
 NuclearReaction (ProcessType pt, int pdg_a, int pdg_b, int pdg_c, int pdg_d, int q_d, const std::string &source_file)
 
virtual marley::TargetAtom atomic_target () const override final
 Returns the target atom involved in this reaction.
 
double max_level_energy (double KEa) const
 Get the maximum possible excitation energy (MeV) of the final-state residue that is kinematically allowed.
 
double threshold_kinetic_energy () const override
 Get the minimum lab-frame kinetic energy (MeV) of the projectile that allows this reaction to proceed via a transition to the residue's ground state.
 
double weak_nuclear_charge () const
 
- Public Member Functions inherited from marley::Reaction
 Reaction (const std::string &source_file)
 Construct a Reaction with the resolved path of the data file.
 
const std::string & get_description () const
 Get a string that contains the formula for this reaction.
 
int pdg_a () const
 Get the projectile PDG code.
 
int pdg_b () const
 Get the target PDG code.
 
ProcessType process_type () const
 Get the process type for this reaction.
 
const std::string & source_file () const
 Get the resolved path of the reaction data file used to construct this Reaction.
 

Static Public Member Functions

static void set_sub_continuum_mode (SubContinuumMode scm)
 Sets the approach to handling sub-continuum cross-section strength.
 
static std::string string_from_sub_continuum_mode (const SubContinuumMode sc_mode)
 
static SubContinuumMode sub_continuum_mode ()
 Gets the approach to handling sub-continuum cross-section strength.
 
static SubContinuumMode sub_continuum_mode_from_string (const std::string &sc_mode_str)
 
- Static Public Member Functions inherited from marley::Reaction
static int get_ejectile_pdg (int pdg_a, ProcessType proc_type)
 
static void get_residue_pdg_and_charge (ProcessType proc_type, int pdg_b, int &pdg_d, int &q_d)
 
static std::vector< std::unique_ptr< Reaction > > load_from_file (const std::string &filename, StructureDatabase &db, CoulombCorrector::CoulombMode coulomb_mode, const JSON &ff_config)
 
static std::string proc_type_to_string (const ProcessType &pt)
 

Protected Member Functions

double get_Ec_from_Ex (const double Ex, const double cos_theta, const double KEa, double *jacobian=nullptr) const
 Helper function for reassign_sub_continuum() that solves for the outgoing lepton total energy that corresponds to the input kinematic variables.
 
bool reassign_sub_continuum (double &w, const double ctl, const double KEa) const
 Helper function for create_event() that potentially reassigns the value of the energy transfer.
 
virtual void set_description () override
 Creates the description string based on the PDG code values for the initial and final particles.
 
- Protected Member Functions inherited from marley::NuclearReaction
virtual std::shared_ptr< HepMC3::GenEventmake_nuclear_event_object (double KEa, const std::shared_ptr< HepMC3::GenParticle > &ejectile, const std::shared_ptr< HepMC3::GenParticle > &residue, double E_level, int twoJ, const marley::Parity &P) const
 Helper function that makes a complete event object for a nuclear reaction.
 
virtual std::shared_ptr< HepMC3::GenEventmake_nuclear_event_object (double KEa, double pc_cm, double cos_theta_c_cm, double phi_c_cm, double Ec_cm, double Ed_cm, double E_level, int twoJ, const marley::Parity &P) const
 Helper function that makes a complete event object for a nuclear reaction.
 
void set_charge_attributes (std::shared_ptr< HepMC3::GenEvent > &event) const
 Helper function that sets the charges of the target and residue in an otherwise complete event record.
 
void set_nuclear_residue_attributes (const std::shared_ptr< HepMC3::GenParticle > &residue, double E_level, int twoJ, const marley::Parity &P) const
 Helper function that adds the nuclear level attributes ( \( E_x \), \( 2J \), and parity) needed to keep track of the residue's de-excitation state to an otherwise complete event record.
 
- Protected Member Functions inherited from marley::Reaction
virtual std::shared_ptr< HepMC3::GenEventmake_event_object (double KEa, const std::shared_ptr< HepMC3::GenParticle > &ejectile, const std::shared_ptr< HepMC3::GenParticle > &residue) const
 Helper function that makes an event object.
 
virtual std::shared_ptr< HepMC3::GenEventmake_event_object (double KEa, double pc_cm, double cos_theta_c_cm, double phi_c_cm, double Ec_cm, double Ed_cm, int residue_status) const
 Helper function that makes an event object.
 
void two_two_scatter (double KEa, double &s, double &Ec_cm, double &pc_cm, double &Ed_cm) const
 Helper function that handles CM frame kinematics for the reaction.
 

Protected Attributes

std::shared_ptr< TabulatedXSecxsec_
 Helper object that handles cross section calculations.
 
- Protected Attributes inherited from marley::NuclearReaction
int Af_
 Residue mass number.
 
int Ai_
 Target mass number.
 
double KEa_threshold_
 Lab-frame kinetic energy of the projectile at threshold for this reaction (i.e., the residue is produced in its ground state, and all final-state particles are at rest in the CM frame)
 
double md_gs_
 Ground state mass (MeV) of the residue.
 
int q_d_
 Net charge of the residue (in units of the proton charge) following this reaction.
 
int Zf_
 Residue atomic number.
 
int Zi_
 Target atomic number.
 
- Protected Attributes inherited from marley::Reaction
std::string description_
 String that contains a formula describing the reaction.
 
double ma_
 Projectile mass (MeV)
 
double mb_
 Target mass (MeV)
 
double mc_
 Ejectile mass (MeV)
 
double md_
 Residue mass (MeV)
 
int pdg_a_
 PDG code for the projectile.
 
int pdg_b_
 PDG code for the target.
 
int pdg_c_
 PDG code for the ejectile.
 
int pdg_d_
 PDG code for the residue.
 
ProcessType process_type_
 Type of scattering process (CC, NC) represented by this reaction.
 
const std::string source_file_
 Resolved path of the reaction data file.
 

Static Protected Attributes

static SubContinuumMode sc_mode_ = SubContinuumMode::ACCUMULATE
 Indicates the desired method for handling events with excitation energies originally sampled below the continuum threshold.
 
static const std::map< SubContinuumMode, std::string > sc_mode_string_map_
 Helper map used for conversions between a SubContinuumMode value and a std::string.
 

Additional Inherited Members

- Static Protected Member Functions inherited from marley::Reaction
static const std::vector< int > & get_projectiles (ProcessType proc_type)
 

Detailed Description

Generates inclusive scattering events and computes cross sections using tabulated nuclear responses.

Definition at line 30 of file ContinuumNuclearReaction.hh.

Member Enumeration Documentation

◆ SubContinuumMode

Defines the approach to handling possible reassignment of cross-section strength that falls below the excitation energy threshold for the continuum

Definition at line 37 of file ContinuumNuclearReaction.hh.

37{ IGNORE, MIRROR, ACCUMULATE };

Constructor & Destructor Documentation

◆ ContinuumNuclearReaction()

marley::ContinuumNuclearReaction::ContinuumNuclearReaction ( Reaction::ProcessType pt,
int pdg_a,
int pdg_b,
int pdg_c,
int pdg_d,
int q_d,
const std::shared_ptr< TabulatedXSec > & txsec,
const std::string & source_file )

Definition at line 45 of file ContinuumNuclearReaction.cc.

49 : marley::NuclearReaction( pt, pdg_a, pdg_b, pdg_c, pdg_d, q_d,
51 xsec_( txsec )
52{
53}
std::shared_ptr< TabulatedXSec > xsec_
Helper object that handles cross section calculations.
const std::string & source_file() const
Get the resolved path of the reaction data file used to construct this Reaction.
Definition Reaction.hh:104
int pdg_a() const
Get the projectile PDG code.
Definition Reaction.hh:109
int pdg_b() const
Get the target PDG code.
Definition Reaction.hh:112

Member Function Documentation

◆ create_event()

std::shared_ptr< HepMC3::GenEvent > marley::ContinuumNuclearReaction::create_event ( int pdg_a,
double KEa,
marley::Generator & gen ) const
overridevirtual

Create an event object for this reaction.

Parameters
pdg_aPDG code for the incident projectile
KEaLab-frame kinetic energy of the projectile
genReference to the Generator to use for random sampling
Note
Functions that override create_event() should throw an Error if pdg_a != pdg_a_.

Implements marley::Reaction.

Definition at line 62 of file ContinuumNuclearReaction.cc.

64{
65 // TODO: reduce code duplication here with DiscreteNuclearReaction using the
66 // common base class NuclearReaction
67
68 // Check that the projectile supplied to this event is correct. If not, alert
69 // the user that this event does not use the requested projectile.
70 if ( pdg_a != pdg_a_ ) throw marley::Error( "Could not create this event."
71 " The requested projectile particle ID, " + std::to_string( pdg_a )
72 + ", does not match the projectile particle ID, "
73 + std::to_string( pdg_a_ ) + ", in the reaction dataset." );
74
75 // Sample a final residue energy level. First, check to make sure the given
76 // projectile energy is above threshold for this reaction.
77 if ( KEa < KEa_threshold_ ) throw std::range_error( "Could"
78 " not create this event. Projectile kinetic energy "
79 + std::to_string( KEa ) + " MeV is below the threshold value "
80 + std::to_string( KEa_threshold_ ) + " MeV." );
81
82 // Select a specific multipole to use for the current event using the
83 // individual total cross sections
84 std::vector< double > multipole_weights;
85 std::vector< marley::TabulatedXSec::MultipoleLabel > multipoles;
86 std::vector< double > diff_max_values;
87 const auto& table_map = xsec_->get_table_map();
88 double sum_of_xsecs = 0.;
89 for ( const auto& pair : table_map ) {
90 const auto& ml = pair.first;
91 double diff_max;
92 double total_xsec = xsec_->integral( pdg_a_, KEa, ml, diff_max );
93
94 sum_of_xsecs += total_xsec;
95
96 multipole_weights.push_back( total_xsec );
97 multipoles.push_back( ml );
98 diff_max_values.push_back( diff_max );
99 }
100
101 // If there are no multipole weights, we can't go on. Complain if this
102 // is the case.
103 if ( multipole_weights.empty() ) {
104 throw marley::Error( "Could not create this event. The TabulatedXSec"
105 " object associated with this reaction does not own any nuclear response"
106 " tables." );
107 }
108
109 // Complain if the total cross section (the sum of all partial cross
110 // sections) is zero or negative (the latter is just to cover all
111 // possibilities).
112 if ( sum_of_xsecs <= 0. ) {
113 throw marley::Error( "Could not create this event. All multipole total"
114 " cross sections are nonpositive." );
115 }
116
117 // Create a discrete distribution based on the weights. This will be
118 // used to choose a single multipole for the current event.
119 std::discrete_distribution< size_t > multipole_dist(
120 multipole_weights.begin(), multipole_weights.end() );
121
122 // Sample a matrix_element using our discrete distribution and the
123 // current set of weights
124 size_t multipole_index = gen.sample_from_distribution( multipole_dist );
125
126 // Label of the multipole chosen for this event
127 const auto& sampled_ml = multipoles.at( multipole_index );
128 // Maximum value of the differential cross section for this multipole.
129 // This will be used for rejection sampling of inclusive kinematics below.
130 double diff_max = diff_max_values.at( multipole_index );
131
132 // ResponseTable object to use for computing the differential cross section
133 // during kinematic sampling below
134 const auto& rt = xsec_->get_table( sampled_ml );
135
136 // Get the values of the energy transfer that correspond to the edges
137 // of the table of nuclear responses. Note that the table is actually given
138 // in terms of the effective energy transfer, which differs by delta_ias
139 // from the actual energy transfer. We therefore apply a shift here
140 // to correct for this.
141 double table_wmin = rt.w_min() - xsec_->delta_ias();
142 double table_wmax = rt.w_max() - xsec_->delta_ias();
143
144 // Choose a reasonable sampling interval for the energy transfer
145 double Ea = KEa + ma_; // Projectile total energy
146
147 // Set the lower bound for the energy transfer to be either zero or
148 // the lowest tabulated value (whichever is larger)
149 double wmin = std::max( 0., table_wmin );
150
151 // Set the upper bound for the energy transfer to be either the projectile
152 // energy minus the final lepton mass or the highest tabulated value
153 // (whichever is lower)
154 double wmax = std::min( Ea - mc_, table_wmax );
155
156 // Sample values for the energy transfer and scattering cosine using the
157 // differential cross section for the chosen multipole.
158 // Use a simple rejection sampling technique.
159 double w, ctl, diff, y;
160 int sampling_attempts = 0;
161 bool recomputed_diff_max = false;
162 do {
163 // Occasionally the value of diff_max retrieved above can be extremely
164 // overestimated when using an optimized version of the total cross
165 // section calculation (which relies on interpolation). This typically
166 // happens very close to threshold and leads to sampling getting stuck
167 // due to a very low acceptance efficiency.
168 //
169 // To guard against this situation, when the number of sampling attempts
170 // exceeds a large value, the estimate of the maximum differential cross
171 // section diff_max is recalculated at exactly the input projectile kinetic
172 // energy rather than relying on the precomputed value. The updated
173 // estimate is then used in a new set of sampling attempts.
174 if ( sampling_attempts > marley_utils::LARGE_NUMBER_OF_ITERATIONS ) {
175
176 if ( recomputed_diff_max ) {
177 // If we make it here, then we are still hitting a huge number of
178 // iterations in this sampling loop despite recalculating the maximum
179 // differential cross section. This suggests that we are stuck in an
180 // infinite loop, so abort with an exception indicating the problem.
181 throw marley::Error( "Reached maximum iteration count for rejection"
182 " sampling in marley::ContinuumNuclearReaction::create_event()" );
183 }
184
185 // The value of diff_max is updated by this call to
186 // marley::TabulatedXSec::compute_integral()
187 xsec_->compute_integral( pdg_a_, KEa, sampled_ml, diff_max );
188 sampling_attempts = 0;
189 recomputed_diff_max = true;
190 }
191
192 w = gen.uniform_random_double( wmin, wmax, true );
193 ctl = gen.uniform_random_double( -1., 1., true );
194 diff = xsec_->diff_xsec( pdg_a_, KEa, w, ctl, sampled_ml );
195 y = gen.uniform_random_double( 0., diff_max, true );
196 ++sampling_attempts;
197
198 // If reassignment is enabled and the excitation energy corresponding to the
199 // sampled energy transfer w falls below the continuum, reassign the value
200 // of the energy transfer to lie within the continuum. The scattering cosine
201 // ctl and projectile kinetic energy are needed for the calculation but are
202 // never altered. If reassignment is attempted but fails due to kinematic
203 // limits, then force another iteration of this rejection sampling loop even
204 // if the event would have been accepted without reassignment.
205 //
206 // NOTE: The reassignment operation is included in the condition of the
207 // do-while loop for efficiency. There is no need to perform the
208 // reassignment for w values that would be rejected anyway. Use of the
209 // logical OR operation (||) will only evaluate the first condition if it
210 // is false, thus skipping the reassignment when it is obviously
211 // unnecessary.
212 } while ( y > diff || !this->reassign_sub_continuum(w, ctl, KEa) );
213
214 // Sample a lab-frame azimuthal scattering angle uniformly
215 double phi_c = gen.uniform_random_double( 0., marley_utils::two_pi, false );
216
217 // Load the initial residue twoJ and parity values into twoJ and P. These
218 // variables are included in the event record and used by NucleusDecayer to
219 // start the Hauser-Feshbach decay cascade.
220 // NOTE: right now, these are taken directly from the multipole involved in
221 // the current event. This is only valid for scattering on a 0+ target
222 // nucleus
223 // TODO: revisit this assumption and do something better
224 int twoJ = 2 * sampled_ml.J_;
225 marley::Parity P = sampled_ml.Pi_; // defaults to positive parity
226
227 // Sine of the ejectile scattering angle
228 double stl = marley_utils::real_sqrt( 1. - std::pow(ctl, 2) );
229
230 // Calculate the full kinematics of the primary interaction based on the
231 // lepton scattering cosine (ctl) and energy transfer (w) sampled above.
232
233 // Determine the components of the ejectile's lab-frame 4-momentum
234 double Ec = Ea - w;
235 double pc = marley_utils::real_sqrt( Ec*Ec - mc_*mc_ );
236 double pc_x = stl * std::cos( phi_c ) * pc;
237 double pc_y = stl * std::sin( phi_c ) * pc;
238 double pc_z = ctl * pc;
239
240 // Determine the magnitude of the lab-frame 3-momentum of the projectile
241 double pa = marley_utils::real_sqrt( Ea*Ea - ma_*ma_ );
242
243 // Construct the lab-frame 4-momenta of the projectile, target, and ejectile
244 HepMC3::FourVector pro_mom4( 0., 0., pa, Ea );
245 HepMC3::FourVector tar_mom4( 0., 0., 0., mb_ );
246 HepMC3::FourVector eje_mom4( pc_x, pc_y, pc_z, Ec );
247
248 // Get the 4-momentum of the residue in the lab frame using conservation
249 double Ed = pro_mom4.e() + tar_mom4.e() - eje_mom4.e();
250 double pd_x = pro_mom4.px() + tar_mom4.px() - eje_mom4.px();
251 double pd_y = pro_mom4.py() + tar_mom4.py() - eje_mom4.py();
252 double pd_z = pro_mom4.pz() + tar_mom4.pz() - eje_mom4.pz();
253
254 // Determine the residue mass from its 4-momentum
255 md_ = marley_utils::real_sqrt( Ed*Ed - pd_x*pd_x - pd_y*pd_y - pd_z*pd_z );
256
257 // The excitation energy is the mass difference between this mass and
258 // the residue's ground-state mass
259 double Ex = md_ - md_gs_;
260
261 // Create particle objects representing the ejectile and residue
262 auto ejectile = marley_hepmc3::make_particle( eje_mom4, pdg_c_,
263 marley_hepmc3::NUHEPMC_FINAL_STATE_STATUS, mc_ );
264
265 auto residue = marley_hepmc3::make_particle( pdg_d_, pd_x, pd_y, pd_z, Ed,
266 marley_hepmc3::NUHEPMC_UNDECAYED_RESIDUE_STATUS, md_ );
267
268 // Make the event object (this also sets the charge and nuclear level
269 // attributes)
270 auto event = this->make_nuclear_event_object( KEa, ejectile, residue, Ex,
271 twoJ, P );
272
273 return event;
274}
bool reassign_sub_continuum(double &w, const double ctl, const double KEa) const
Helper function for create_event() that potentially reassigns the value of the energy transfer.
double uniform_random_double(double min, double max, bool inclusive)
Sample a random number uniformly on either [min, max) or [min, max].
Definition Generator.cc:235
auto sample_from_distribution(RandomNumberDistribution &rnd) -> decltype(std::declval< RandomNumberDistribution & >().operator()(std::declval< std::mt19937_64 & >()))
Sample from an arbitrary probability distribution (defined here as any object that implements an oper...
Definition Generator.hh:193
virtual std::shared_ptr< HepMC3::GenEvent > make_nuclear_event_object(double KEa, double pc_cm, double cos_theta_c_cm, double phi_c_cm, double Ec_cm, double Ed_cm, double E_level, int twoJ, const marley::Parity &P) const
Helper function that makes a complete event object for a nuclear reaction.
double KEa_threshold_
Lab-frame kinetic energy of the projectile at threshold for this reaction (i.e., the residue is produ...
double md_gs_
Ground state mass (MeV) of the residue.
int pdg_a_
PDG code for the projectile.
Definition Reaction.hh:142
double md_
Residue mass (MeV)
Definition Reaction.hh:154
double mc_
Ejectile mass (MeV)
Definition Reaction.hh:149
int pdg_c_
PDG code for the ejectile.
Definition Reaction.hh:144
int pdg_d_
PDG code for the residue.
Definition Reaction.hh:145
double ma_
Projectile mass (MeV)
Definition Reaction.hh:147
double mb_
Target mass (MeV)
Definition Reaction.hh:148

References HepMC3::FourVector::e(), marley::NuclearReaction::KEa_threshold_, marley::Reaction::ma_, marley::NuclearReaction::make_nuclear_event_object(), marley::Reaction::mb_, marley::Reaction::mc_, marley::Reaction::md_, marley::NuclearReaction::md_gs_, marley::Reaction::pdg_a(), marley::Reaction::pdg_a_, marley::Reaction::pdg_c_, marley::Reaction::pdg_d_, HepMC3::FourVector::px(), HepMC3::FourVector::py(), HepMC3::FourVector::pz(), reassign_sub_continuum(), marley::Generator::sample_from_distribution(), marley::Generator::uniform_random_double(), and xsec_.

◆ get_Ec_from_Ex()

double marley::ContinuumNuclearReaction::get_Ec_from_Ex ( const double Ex,
const double cos_theta,
const double KEa,
double * jacobian = nullptr ) const
protected

Helper function for reassign_sub_continuum() that solves for the outgoing lepton total energy that corresponds to the input kinematic variables.

Parameters
[in]ExNuclear excitation energy (MeV)
[in]cos_thetaLepton scattering cosine
[in]KEaProjectile kinetic energy
[out]jacobianIf this argument is not nullptr, then the target double will be filled with the value of the Jacobian needed to convert from \( d\sigma/dE_\ell \) to \( d\sigma/dE_x \).

Definition at line 366 of file ContinuumNuclearReaction.cc.

368{
369 // Mass of the final-state ion (including excitation energy)
370 double md = md_gs_ + Ex;
371
372 // Total energy of the projectile
373 double Ea = KEa + ma_;
374
375 // Total energy of the two-body system in the lab frame
376 double Etot = Ea + mb_;
377
378 // Construct helper variables
379 double pa = marley_utils::real_sqrt( Ea*Ea - ma_*ma_ );
380 double help = md*md - mc_*mc_ + pa*pa - Etot*Etot;
381 double other_help = 4.*pa*pa*cos_theta*cos_theta;
382
383 // Quadratic coefficients (a*Ec^2 + b*Ec + c == 0)
384 double a = 4.*Etot*Etot - other_help;
385 double b = 4.*Etot*help;
386 double c = help*help + other_help*mc_*mc_;
387
388 // Get both solutions to the quadratic equation
389 double sol_plus, sol_minus;
390 marley_utils::solve_quadratic_equation( a, b, c,
391 sol_plus, sol_minus );
392
393 // Now for a trick: due to the way we derived the results above,
394 // the two solutions correspond to positive (sol_plus) and
395 // negative (sol_minus) values of cos_theta, with the two
396 // solutions exactly equal when cos_theta == 0. Choose the
397 // appropriate one to return here.
398 double Ec = sol_plus;
399 if ( cos_theta < 0. ) Ec = sol_minus;
400
401 if ( jacobian ) {
402 double pc = marley_utils::real_sqrt( Ec*Ec - mc_*mc_ );
403 *jacobian = md / ( Ea + mb_ - pa*Ec*cos_theta/pc );
404 }
405
406 return Ec;
407}

References marley::Reaction::ma_, marley::Reaction::mb_, marley::Reaction::mc_, and marley::NuclearReaction::md_gs_.

Referenced by reassign_sub_continuum().

◆ get_tabulated_xsec()

const TabulatedXSec & marley::ContinuumNuclearReaction::get_tabulated_xsec ( ) const
inline

Definition at line 49 of file ContinuumNuclearReaction.hh.

50 { return *xsec_; }

◆ reassign_sub_continuum()

bool marley::ContinuumNuclearReaction::reassign_sub_continuum ( double & w,
const double ctl,
const double KEa ) const
protected

Helper function for create_event() that potentially reassigns the value of the energy transfer.

If reassignment is enabled, moves cross-section strength falling below the unbound threshold to the continuum by updating the value of the energy transfer. Returns true if the reassignment was successful and is kinematically allowed. Returns false otherwise.

Parameters
[in,out]wEnergy transfer (MeV, not shifted by \( \Delta_\mathrm{IAS} \))
[in]ctlLepton scattering cosine
[in]KEaProjectile kinetic energy (MeV)
Returns
Returns true if the reassignment procedure was successful (or skipped because it was unnecessary or disabled). Returns false otherwise.

Definition at line 290 of file ContinuumNuclearReaction.cc.

292{
293 // If reassignment of the sub-continuum strength is disabled, then this
294 // function returns immediately without doing anything
295 if ( sc_mode_ == SubContinuumMode::IGNORE ) return true;
296
297 // Lab-frame total energy and 3-momentum of the projectile
298 double Ea = KEa + ma_;
299 double pa = marley_utils::real_sqrt( Ea*Ea - ma_*ma_ );
300
301 // Lab-frame total energy and 3-momentum of the ejectile
302 double Ec = Ea - w;
303 double pc = marley_utils::real_sqrt( Ec*Ec - mc_*mc_ );
304
305 // Squared magnitude of the 3-momentum transfer
306 double kappa2 = pa*pa + pc*pc - 2.*pa*pc*ctl;
307
308 // Total energy and excitation energy of the residue
309 double Ed = mb_ + w;
310 double Ex = marley_utils::real_sqrt( Ed*Ed - kappa2 ) - md_gs_;
311
312 // Get the "unbound threshold" used to determine the start of the continuum
313 const auto& mt = marley::MassTable::Instance();
314 double unbound_threshold = mt.unbound_threshold( pdg_d_ );
315
316 // If the excitation energy corresponding to the sampled energy transfer
317 // is already within the continuum, no special action is needed. Just return
318 // without making any modifications.
319 if ( Ex >= unbound_threshold ) return true;
320
321 // If we've made it here, then we need to reassign the excitation energy
322 // and compute a new value of the energy transfer. First choose the new
323 // excitation energy based on the recipe selected by the user configuration.
324 if ( sc_mode_ == SubContinuumMode::ACCUMULATE ) {
325 // For the "accumulate" option, just update the excitation energy to be
326 // exactly at the unbound threshold
327 Ex = unbound_threshold;
328
329 MARLEY_LOG( DEBUG, "physics.reaction" ) << "Excitation energy " << Ex
330 << " MeV is below the unbound threshold " << unbound_threshold
331 << " MeV. Sampling exactly at the unbound threshold.";
332 }
333 else if ( sc_mode_ == SubContinuumMode::MIRROR ) {
334 // For the "mirror" option, "reflect" the original excitation energy to the
335 // upper side of the unbound threshold so it is the same distance above
336 // as it was originally below.
337 Ex = 2.*unbound_threshold - Ex;
338
339 MARLEY_LOG( DEBUG, "physics.reaction" ) << "Excitation energy " << Ex
340 << " MeV is below the unbound threshold " << unbound_threshold
341 << " MeV. Mirroring the energy transfer around the unbound"
342 << " threshold.";
343 }
344 else {
345 throw marley::Error( "Unrecognized sub-continuum mode encountered"
346 " in marley::ContinuumNuclearReaction::reassign_sub_continuum()" );
347 return false;
348 }
349
350 // Solve for the new outgoing lepton total energy given the updated
351 // excitation energy value. Update the value of Ec with the solution.
352 Ec = this->get_Ec_from_Ex( Ex, ctl, KEa );
353
354 // Now update the energy transfer accordingly
355 w = Ea - Ec;
356
357 // If the total energy of the outgoing lepton is now below its rest mass,
358 // then the reassignment procedure failed due to the kinematic threshold.
359 // Indicate this failure in the return value.
360 if ( Ec < mc_ ) return false;
361
362 // Otherwise, everything worked out, so indicate success.
363 return true;
364}
static SubContinuumMode sc_mode_
Indicates the desired method for handling events with excitation energies originally sampled below th...
double get_Ec_from_Ex(const double Ex, const double cos_theta, const double KEa, double *jacobian=nullptr) const
Helper function for reassign_sub_continuum() that solves for the outgoing lepton total energy that co...
static const MassTable & Instance()
Get a const reference to the singleton instance of the MassTable.
Definition MassTable.cc:69

References get_Ec_from_Ex(), marley::MassTable::Instance(), marley::Reaction::ma_, marley::Reaction::mb_, marley::Reaction::mc_, marley::NuclearReaction::md_gs_, marley::Reaction::pdg_d_, and sc_mode_.

Referenced by create_event().

◆ set_description()

void marley::ContinuumNuclearReaction::set_description ( )
overrideprotectedvirtual

Creates the description string based on the PDG code values for the initial and final particles.

Reimplemented from marley::NuclearReaction.

Definition at line 281 of file ContinuumNuclearReaction.cc.

281 {
283 description_ += '*';
284}
virtual void set_description()
Creates the description string based on the PDG code values for the initial and final particles.
std::string description_
String that contains a formula describing the reaction.
Definition Reaction.hh:157

References marley::Reaction::description_, and marley::NuclearReaction::set_description().

◆ set_sub_continuum_mode()

static void marley::ContinuumNuclearReaction::set_sub_continuum_mode ( SubContinuumMode scm)
inlinestatic

Sets the approach to handling sub-continuum cross-section strength.

Definition at line 56 of file ContinuumNuclearReaction.hh.

57 { sc_mode_ = scm; }

References sc_mode_.

◆ string_from_sub_continuum_mode()

std::string marley::ContinuumNuclearReaction::string_from_sub_continuum_mode ( const SubContinuumMode sc_mode)
static

Definition at line 421 of file ContinuumNuclearReaction.cc.

423{
424 auto it = sc_mode_string_map_.find( mode );
425 if ( it != sc_mode_string_map_.end() ) return it->second;
426 else throw marley::Error( "Unrecognized sub-continuum mode value encountered"
427 " in marley::ContinuumNuclearReaction::string_from_sub_continuum_mode()" );
428}
static const std::map< SubContinuumMode, std::string > sc_mode_string_map_
Helper map used for conversions between a SubContinuumMode value and a std::string.

◆ sub_continuum_mode()

static SubContinuumMode marley::ContinuumNuclearReaction::sub_continuum_mode ( )
inlinestatic

Gets the approach to handling sub-continuum cross-section strength.

Definition at line 53 of file ContinuumNuclearReaction.hh.

53{ return sc_mode_; }

References sc_mode_.

◆ sub_continuum_mode_from_string()

SubContinuumMode marley::ContinuumNuclearReaction::sub_continuum_mode_from_string ( const std::string & sc_mode_str)
static

Definition at line 410 of file ContinuumNuclearReaction.cc.

412{
413 for ( const auto& pair : sc_mode_string_map_ ) {
414 if ( str == pair.second ) return pair.first;
415 }
416 throw marley::Error( "The string \"" + str + "\" was not recognized"
417 " as a valid sub-continuum mode setting" );
418}

◆ total_xs()

double marley::ContinuumNuclearReaction::total_xs ( int pdg_a,
double KEa ) const
overridevirtual

Compute the reaction's total cross section (MeV -2)

Parameters
pdg_aProjectile's PDG code
KEaLab-frame kinetic energy of the incident projectile
Returns
Reaction total cross section (MeV -2)
Note
Functions that override total_xs() should always return zero if pdg_a != pdg_a_.

Implements marley::Reaction.

Definition at line 55 of file ContinuumNuclearReaction.cc.

57{
58 if ( pdg_a != pdg_a_ ) return 0.;
59 return xsec_->integral( pdg_a, KEa );
60}

References marley::Reaction::pdg_a(), marley::Reaction::pdg_a_, and xsec_.

Member Data Documentation

◆ sc_mode_

SubContinuumMode marley::ContinuumNuclearReaction::sc_mode_ = SubContinuumMode::ACCUMULATE
staticprotected

Indicates the desired method for handling events with excitation energies originally sampled below the continuum threshold.

Definition at line 102 of file ContinuumNuclearReaction.hh.

Referenced by reassign_sub_continuum(), set_sub_continuum_mode(), and sub_continuum_mode().

◆ sc_mode_string_map_

const std::map< SubContinuumMode, std::string > marley::ContinuumNuclearReaction::sc_mode_string_map_
staticprotected
Initial value:
= {
{ SubContinuumMode::IGNORE, "ignore" },
{ SubContinuumMode::MIRROR, "mirror" },
{ SubContinuumMode::ACCUMULATE, "accumulate" }
}

Helper map used for conversions between a SubContinuumMode value and a std::string.

Definition at line 39 of file ContinuumNuclearReaction.hh.

◆ xsec_

std::shared_ptr< TabulatedXSec > marley::ContinuumNuclearReaction::xsec_
protected

Helper object that handles cross section calculations.

Definition at line 98 of file ContinuumNuclearReaction.hh.

Referenced by create_event(), and total_xs().


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