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::ContinuumExitChannel Class Referenceabstract

Abstract base class for ExitChannel objects that lead to the unbound continuum in the final state. More...

#include <ExitChannel.hh>

Inheritance diagram for marley::ContinuumExitChannel:
marley::ExitChannel marley::FragmentContinuumExitChannel marley::GammaContinuumExitChannel

Classes

struct  SpinParityWidth
 A spin-parity value with its corresponding partial decay width. More...
 

Public Member Functions

 ContinuumExitChannel (double Ec_min, int lmax)
 
virtual void compute_total_width () final override
 
virtual double differential_width (double Exf, bool store_jpi_widths=false) const =0
 
virtual void do_decay (double &Ex, int &two_J, marley::Parity &Pi, const std::shared_ptr< HepMC3::GenParticle > &compound_nucleus, std::shared_ptr< HepMC3::GenParticle > &emitted_particle, std::shared_ptr< HepMC3::GenParticle > &residual_nucleus, int &qIon, marley::Generator &gen) const final override
 Simulates a nuclear decay into this channel.
 
virtual double E_c_max () const =0
 Returns the maximum accessible excitation energy to be used when integrating over the continuum.
 
double E_c_min () const
 Returns the minimum excitation energy bound for the continuum.
 
const SpinParityWidthget_last_sampled_spw () const
 Returns a pointer to the last sampled SpinParityWidth object.
 
const std::vector< std::unique_ptr< SpinParityWidth > > & get_spw_table () const
 Grants const access to the vector of SpinParityWidth objects.
 
virtual bool is_continuum () const final override
 Returns true if this channel accesses the particle-unbound continuum of nuclear levels or false otherwise.
 
double sample_Exf (marley::Generator &gen) const
 
void sample_spin_parity (double Exf, int &two_Jf, marley::Parity &Pf, marley::Generator &gen) const
 
void set_skip_jpi_sampling (bool skip_it) const
 Sets the flag that will skip sampling of a final-state nuclear spin-parity value in do_decay()
 
- Public Member Functions inherited from marley::ExitChannel
 ExitChannel ()=default
 
 ExitChannel (int pdgi, int qi, double Exi, int twoJi, marley::Parity Pi, double rho_i, marley::StructureDatabase &sdb)
 
virtual bool emits_fragment () const =0
 Returns true if this channel involves fragment emission or false if it involves gamma-ray emission.
 
virtual int emitted_particle_pdg () const =0
 Returns the PDG code for the particle (gamma-ray or nuclear fragment) emitted by decays into this ExitChannel.
 
virtual int final_nucleus_pdg () const =0
 Returns the PDG code for the final nucleus.
 
double width () const
 Get the total decay width into this channel (MeV)
 

Protected Member Functions

void clear_jpi_widths () const
 Helper function that resets the table of SpinParityWidth objects.
 
- Protected Member Functions inherited from marley::ExitChannel
virtual void prepare_products (const std::shared_ptr< HepMC3::GenParticle > &compound_nucleus, std::shared_ptr< HepMC3::GenParticle > &emitted_particle, std::shared_ptr< HepMC3::GenParticle > &residual_nucleus, double Exf, int &qf, marley::Generator &gen) const
 Helper function that prepares Particle objects representing the products of the two-body decay.
 

Protected Attributes

double E_c_min_
 Minimum accessible nuclear excitation energy (MeV) in the continuum.
 
std::unique_ptr< marley::ChebyshevInterpolatingFunctionExf_cdf_
 Chebyshev polynomial interpolant to the cumulative density function for the final-state nuclear excitation energy.
 
std::vector< std::unique_ptr< SpinParityWidth > > jpi_widths_table_
 Table of possible final-state spin-parities together with their partial differential decay widths.
 
int l_max_
 
SpinParityWidthlast_sampled_spw_ = nullptr
 Points to the last SpinParityWidth object sampled in a previous call to sample_spin_parity()
 
bool skip_jpi_sampling_ = false
 Flag that allows skipping the sampling of a final nuclear spin-parity (useful only for testing purposes)
 
- Protected Attributes inherited from marley::ExitChannel
double Exi_
 Initial nuclear excitation energy \( E_x \) (MeV)
 
double one_over_two_pi_rho_i_
 
int pdgi_
 PDG code for the initial nucleus.
 
marley::Parity Pi_
 Initial nuclear parity \( \Pi \).
 
int qi_
 
marley::StructureDatabasesdb_
 StructureDatabase to use in calculations.
 
int twoJi_
 Two times the initial nuclear spin \( J \).
 
double width_
 Total decay width into this channel (MeV)
 

Additional Inherited Members

- Static Public Member Functions inherited from marley::ExitChannel
template<typename It>
static marley::IteratorToPointerMember< It, double > make_width_iterator (It it)
 Convert an iterator that points to an ExitChannel object into an iterator to the ExitChannel's width_ member variable.
 

Detailed Description

Abstract base class for ExitChannel objects that lead to the unbound continuum in the final state.

Definition at line 250 of file ExitChannel.hh.

Constructor & Destructor Documentation

◆ ContinuumExitChannel()

marley::ContinuumExitChannel::ContinuumExitChannel ( double Ec_min,
int lmax )
inline
Parameters
Ec_minMinimum accessible nuclear excitation energy in the continuum. Below this value, only discrete nuclear levels are assumed to be present.
lmaxThe maximum value of the orbital angular momentum (multipolarity) \( \ell \) to consider when computing differential decay widths for fragment (gamma-ray) emission to the continuum

Definition at line 260 of file ExitChannel.hh.

260 : E_c_min_( Ec_min ),
261 l_max_( lmax ) {}
double E_c_min_
Minimum accessible nuclear excitation energy (MeV) in the continuum.

References E_c_min_, and l_max_.

Referenced by marley::FragmentContinuumExitChannel::FragmentContinuumExitChannel(), and marley::GammaContinuumExitChannel::GammaContinuumExitChannel().

Member Function Documentation

◆ clear_jpi_widths()

void marley::ContinuumExitChannel::clear_jpi_widths ( ) const
protected

Helper function that resets the table of SpinParityWidth objects.

Definition at line 530 of file ExitChannel.cc.

530 {
531 jpi_widths_table_.clear();
532 last_sampled_spw_ = nullptr;
533}
std::vector< std::unique_ptr< SpinParityWidth > > jpi_widths_table_
Table of possible final-state spin-parities together with their partial differential decay widths.
SpinParityWidth * last_sampled_spw_
Points to the last SpinParityWidth object sampled in a previous call to sample_spin_parity()

References jpi_widths_table_, and last_sampled_spw_.

◆ compute_total_width()

void marley::ContinuumExitChannel::compute_total_width ( )
finaloverridevirtual

Helper function that initializes the width_ member variable upon construction

Implements marley::ExitChannel.

Definition at line 297 of file ExitChannel.cc.

297 {
298
299 // Initialize the total width to zero
300 width_ = 0.;
301
302 double Ec_max = this->E_c_max();
303
304 if ( Ec_max < E_c_min_ ) {
305 throw_continuum_bounds_error( E_c_min_, Ec_max );
306 return;
307 }
308
309 // Create a function object to use for integration of the differential decay
310 // width
311 std::function<double(double)> dw = [this](double Exf) -> double {
312 return this->differential_width( Exf );
313 };
314
315 // Numerically integrate over the bounds of the continuum using the
316 // function object prepared above
317 width_ = marley_utils::num_integrate( dw, E_c_min_, Ec_max );
318
319 // Guard against numerical issues by capping the total width at zero
320 width_ = std::max( 0., width_ );
321
322 // TODO: consider switching to doing the integration with a
323 // ChebyshevInterpolatingFunction object. This avoids needing to create one
324 // later (and may be comparable in terms of computational cost)
325}
virtual double E_c_max() const =0
Returns the maximum accessible excitation energy to be used when integrating over the continuum.
double width_
Total decay width into this channel (MeV)

References E_c_min_, and marley::ExitChannel::width_.

Referenced by marley::FragmentContinuumExitChannel::FragmentContinuumExitChannel(), and marley::GammaContinuumExitChannel::GammaContinuumExitChannel().

◆ do_decay()

void marley::ContinuumExitChannel::do_decay ( double & Exf,
int & two_Jf,
marley::Parity & Pf,
const std::shared_ptr< HepMC3::GenParticle > & compound_nucleus,
std::shared_ptr< HepMC3::GenParticle > & emitted_particle,
std::shared_ptr< HepMC3::GenParticle > & residual_nucleus,
int & qIon,
marley::Generator & gen ) const
finaloverridevirtual

Simulates a nuclear decay into this channel.

Parameters
[out]ExfThe final nuclear excitation energy
[out]two_JfTwo times the final nuclear spin
[out]PfThe final nuclear parity
[in]compound_nucleusParticle object representing the initial nucleus
[out]emitted_particleParticle emitted in the de-excitation
[out]residual_nucleusFinal-state nucleus after particle emission
[out]qIonCharge (in units of the elementary charge) of the final-state nucleus (ion) after particle emission
genGenerator to use for random sampling

Implements marley::ExitChannel.

Definition at line 476 of file ExitChannel.cc.

481{
482 Exf = this->sample_Exf( gen );
483
484 // Sample a final nuclear spin-parity, unless the user has
485 // explicitly turned this off (presumably in unit tests
486 // where we only care about the final excitation energy).
487 if ( !skip_jpi_sampling_ ) sample_spin_parity( Exf, two_Jf, Pf, gen );
488
489 // TODO: sample a sub-Jpi variable set (e.g., l + j)
490
491 this->prepare_products( compound_nucleus, emitted_particle,
492 residual_nucleus, Exf, qIon, gen );
493}
bool skip_jpi_sampling_
Flag that allows skipping the sampling of a final nuclear spin-parity (useful only for testing purpos...
virtual void prepare_products(const std::shared_ptr< HepMC3::GenParticle > &compound_nucleus, std::shared_ptr< HepMC3::GenParticle > &emitted_particle, std::shared_ptr< HepMC3::GenParticle > &residual_nucleus, double Exf, int &qf, marley::Generator &gen) const
Helper function that prepares Particle objects representing the products of the two-body decay.

References marley::ExitChannel::prepare_products(), and skip_jpi_sampling_.

◆ E_c_max()

virtual double marley::ContinuumExitChannel::E_c_max ( ) const
pure virtual

Returns the maximum accessible excitation energy to be used when integrating over the continuum.

Implemented in marley::FragmentContinuumExitChannel, and marley::GammaContinuumExitChannel.

◆ E_c_min()

double marley::ContinuumExitChannel::E_c_min ( ) const
inline

Returns the minimum excitation energy bound for the continuum.

Definition at line 310 of file ExitChannel.hh.

310{ return E_c_min_; }

References E_c_min_.

◆ get_last_sampled_spw()

const SpinParityWidth * marley::ContinuumExitChannel::get_last_sampled_spw ( ) const
inline

Returns a pointer to the last sampled SpinParityWidth object.

Definition at line 317 of file ExitChannel.hh.

318 { return last_sampled_spw_; }

References last_sampled_spw_.

Referenced by marley::NucleusDecayer::process_event().

◆ get_spw_table()

const std::vector< std::unique_ptr< SpinParityWidth > > & marley::ContinuumExitChannel::get_spw_table ( ) const
inline

Grants const access to the vector of SpinParityWidth objects.

Definition at line 322 of file ExitChannel.hh.

322{ return jpi_widths_table_; }

References jpi_widths_table_.

◆ is_continuum()

virtual bool marley::ContinuumExitChannel::is_continuum ( ) const
inlinefinaloverridevirtual

Returns true if this channel accesses the particle-unbound continuum of nuclear levels or false otherwise.

Implements marley::ExitChannel.

Definition at line 277 of file ExitChannel.hh.

277{ return true; }

References is_continuum().

Referenced by is_continuum().

◆ sample_Exf()

double marley::ContinuumExitChannel::sample_Exf ( marley::Generator & gen) const

Definition at line 450 of file ExitChannel.cc.

451{
452 // The maximum accessible excitation energy for this exit channel. It
453 // will be used when creating the ChebyshevInterpolatingFunction below
454 double Emax = this->E_c_max();
455
456 // If we haven't built a CDF for sampling the final nuclear excitation
457 // energy yet, then build it before continuing
458 if ( !Exf_cdf_ ) {
459 // Build a polynomial approximant (at Chebyshev points) to the PDF for the
460 // final nuclear excitation energy
461 marley::ChebyshevInterpolatingFunction pdf_cheb( [this](double Exf)
462 -> double { return this->differential_width(Exf); }, E_c_min_, Emax,
463 marley::DEFAULT_N_CHEBYSHEV );
464
465 // Store the cumulative density function for possible re-use
466 Exf_cdf_ = std::make_unique<marley::ChebyshevInterpolatingFunction>(
467 pdf_cheb.cdf() );
468 }
469
470 // Sample a final nuclear excitation energy using the Chebyshev polynomial
471 // approximant to the CDF
472 double Exf = gen.inverse_transform_sample( *Exf_cdf_, E_c_min_, Emax );
473 return Exf;
474}
std::unique_ptr< marley::ChebyshevInterpolatingFunction > Exf_cdf_
Chebyshev polynomial interpolant to the cumulative density function for the final-state nuclear excit...
double inverse_transform_sample(const marley::InterpolatingFunction &cdf, double xmin, double xmax, double bisection_tolerance=1e-12)
Sample from a given 1D cumulative density function cdf(x) on the interval [xmin, xmax] using bisectio...
Definition Generator.cc:552

◆ sample_spin_parity()

void marley::ContinuumExitChannel::sample_spin_parity ( double Exf,
int & two_Jf,
marley::Parity & Pf,
marley::Generator & gen ) const

Definition at line 495 of file ExitChannel.cc.

497{
498 // Clear any previous table entries of spin-parities and decay widths
499 this->clear_jpi_widths();
500
501 // Load table of partial differential widths via a call to
502 // differential_width()
503 double diff_width = this->differential_width( Exf, true );
504
505 // Throw an error if all decays are impossible
506 if ( diff_width <= 0. ) throw marley::Error( "Cannot "
507 "continue Hauser-Feshbach decay. All partial differential decay widths "
508 "are zero." );
509
510 // Sample a final spin and parity
511 const auto begin = marley::IteratorToPointerMember<
512 std::vector< std::unique_ptr<SpinParityWidth> >::const_iterator,
513 const double>( jpi_widths_table_.cbegin(),
515
516 const auto end = marley::IteratorToPointerMember<
517 std::vector< std::unique_ptr<SpinParityWidth> >::const_iterator,
518 const double>( jpi_widths_table_.cend(),
520
521 std::discrete_distribution<size_t> jpi_dist( begin, end );
522 size_t jpi_index = gen.sample_from_distribution( jpi_dist );
523
524 // Store the results
525 last_sampled_spw_ = jpi_widths_table_.at( jpi_index ).get();
526 twoJ = last_sampled_spw_->twoJf;
527 Pi = last_sampled_spw_->Pf;
528}
void clear_jpi_widths() const
Helper function that resets the table of SpinParityWidth objects.
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
double diff_width
Partial differential decay width (MeV)

◆ set_skip_jpi_sampling()

void marley::ContinuumExitChannel::set_skip_jpi_sampling ( bool skip_it) const
inline

Sets the flag that will skip sampling of a final-state nuclear spin-parity value in do_decay()

The skipping functionality should only be used for testing purposes!

Definition at line 283 of file ExitChannel.hh.

284 { skip_jpi_sampling_ = skip_it; }

References skip_jpi_sampling_.

Member Data Documentation

◆ E_c_min_

double marley::ContinuumExitChannel::E_c_min_
protected

Minimum accessible nuclear excitation energy (MeV) in the continuum.

Definition at line 327 of file ExitChannel.hh.

Referenced by ContinuumExitChannel(), compute_total_width(), and E_c_min().

◆ Exf_cdf_

std::unique_ptr<marley::ChebyshevInterpolatingFunction> marley::ContinuumExitChannel::Exf_cdf_
mutableprotected

Chebyshev polynomial interpolant to the cumulative density function for the final-state nuclear excitation energy.

This pointer will be initialized lazily during the first call to do_decay()

Definition at line 346 of file ExitChannel.hh.

◆ jpi_widths_table_

std::vector< std::unique_ptr< SpinParityWidth > > marley::ContinuumExitChannel::jpi_widths_table_
mutableprotected

Table of possible final-state spin-parities together with their partial differential decay widths.

Definition at line 336 of file ExitChannel.hh.

Referenced by clear_jpi_widths(), and get_spw_table().

◆ l_max_

int marley::ContinuumExitChannel::l_max_
protected

Maximum orbital angular momentum (multipolarity) to consider when computing differential fragment (gamma-ray) decay widths

Definition at line 331 of file ExitChannel.hh.

Referenced by ContinuumExitChannel().

◆ last_sampled_spw_

SpinParityWidth* marley::ContinuumExitChannel::last_sampled_spw_ = nullptr
mutableprotected

Points to the last SpinParityWidth object sampled in a previous call to sample_spin_parity()

Definition at line 350 of file ExitChannel.hh.

Referenced by clear_jpi_widths(), and get_last_sampled_spw().

◆ skip_jpi_sampling_

bool marley::ContinuumExitChannel::skip_jpi_sampling_ = false
mutableprotected

Flag that allows skipping the sampling of a final nuclear spin-parity (useful only for testing purposes)

Definition at line 340 of file ExitChannel.hh.

Referenced by do_decay(), and set_skip_jpi_sampling().


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