21#include "marley/marley_utils.hh"
22#include "marley/Generator.hh"
23#include "marley/Level.hh"
24#include "marley/Parity.hh"
27 : energy_( E ), twoJ_(
twoJ ), parity_( pi ), half_life_(
half_life )
34 if ( prob_ptr ) *prob_ptr = 0.;
36 if ( gammas_.empty() )
return nullptr;
46 std::vector< double > probs = gamma_dist_.probabilities();
47 *prob_ptr = probs.at( g_index );
51 return &( gammas_[ g_index ] );
57 gammas_.push_back( gamma );
60 update_gamma_distribution();
63 return gammas_.back();
70 gammas_.emplace_back(
energy, branching_ratio,
this, end_lev );
73 update_gamma_distribution();
76 return gammas_.back();
84 update_gamma_distribution();
88 std::string str = std::to_string( twoJ_ / 2 );
90 if ( twoJ_ % 2 ) str +=
"/2";
91 return str + parity_.to_char();
94void marley::Level::update_gamma_distribution() {
101 std::discrete_distribution< size_t >::param_type params( ri_begin, ri_end );
102 gamma_dist_.param( params );
A gamma-ray transition between two nuclear levels.
static marley::IteratorToMember< It, double > make_intensity_iterator(It it)
Convert an iterator that points to a Gamma object into an iterator that points to the Gamma's relativ...
The MARLEY Event generator.
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...
A discrete nuclear energy level.
double half_life() const
Get the level half-life (s)
marley::Gamma & add_gamma(const marley::Gamma &gamma)
Add a new gamma-ray transition to this level.
Level(double E, int twoJ, marley::Parity pi, double half_life)
const marley::Gamma * sample_gamma(marley::Generator &gen, double *prob_ptr=nullptr)
Choose a gamma owned by this level randomly based on the relative intensities of all of the gammas.
int twoJ() const
Get two times the level spin.
void clear_gammas()
Remove all gamma ray information from this level.
std::string spin_parity_string() const
Returns the level spin-parity as a string.
double energy() const
Get the excitation energy of this level (MeV)
Type-safe representation of a parity value (either +1 or -1)