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
Level.hh
1
4//
5// This file is part of MARLEY (Model of Argon Reaction Low Energy Yields)
6//
7// MARLEY is free software: you can redistribute it and/or modify it under the
8// terms of version 3 of the GNU General Public License as published by the
9// Free Software Foundation.
10//
11// For the full text of the license please see COPYING or
12// visit http://opensource.org/licenses/GPL-3.0
13//
14// Please respect the MCnet academic usage guidelines. See GUIDELINES
15// or visit https://www.montecarlonet.org/GUIDELINES for details.
16
17#pragma once
18#include <random>
19
20#include "marley/Gamma.hh"
21#include "marley/IteratorToPointerMember.hh"
22#include "marley/Parity.hh"
23
24namespace marley {
25
26 class Generator;
27
29 class Level {
30 public:
31
36 Level( double E, int twoJ, marley::Parity pi, double half_life );
37
40 inline const std::vector<marley::Gamma>& gammas() const;
41
43 inline std::vector<marley::Gamma>& gammas();
44
46 inline double energy() const;
48 inline void set_energy(double E);
49
51 inline int twoJ() const;
53 inline void set_twoJ(int twoJ);
54
56 inline marley::Parity parity() const;
58 inline void set_parity(marley::Parity pi);
59
61 inline double half_life() const;
63 inline void set_half_life( double half_life );
64
66 inline bool has_gammas() const;
67
71
78 marley::Gamma& add_gamma(double energy, double branching_ratio,
79 marley::Level* end_lev = nullptr);
80
82 void clear_gammas();
83
93 double* prob_ptr = nullptr );
94
96 std::string spin_parity_string() const;
97
104 template<typename It> inline static marley::IteratorToPointerMember<It,
105 double> make_energy_iterator(It it);
106
107 private:
108
109 double energy_;
110
114 int twoJ_;
115
116 marley::Parity parity_;
117
120 double half_life_;
121
123 std::vector< marley::Gamma > gammas_;
124
127 std::discrete_distribution< size_t > gamma_dist_;
128
131 void update_gamma_distribution();
132 };
133
134 // Inline function definitions
135 inline double Level::energy() const { return energy_; }
136 inline void Level::set_energy( double E ) { energy_ = E; }
137
138 inline int Level::twoJ() const { return twoJ_; }
139 inline void Level::set_twoJ(int twoJ) { twoJ_ = twoJ; }
140
141 inline marley::Parity Level::parity() const { return parity_; }
142 inline void Level::set_parity( marley::Parity pi ) { parity_ = pi; }
143
144 inline double Level::half_life() const { return half_life_; }
145 inline void Level::set_half_life( double half_life )
146 { half_life_ = half_life; }
147
148 inline const std::vector< marley::Gamma >& Level::gammas() const
149 { return gammas_; }
150 inline std::vector< marley::Gamma >& Level::gammas() { return gammas_; }
151
152 inline bool Level::has_gammas() const { return !gammas_.empty(); }
153
154 template< typename It > inline marley::IteratorToPointerMember< It,
156 {
158 &marley::Level::energy_ );
159 }
160}
A gamma-ray transition between two nuclear levels.
Definition Gamma.hh:25
The MARLEY Event generator.
Definition Generator.hh:54
Template class that creates an iterator to a class member based on an iterator to a pointer (either b...
A discrete nuclear energy level.
Definition Level.hh:29
void set_twoJ(int twoJ)
Set two times the level spin.
Definition Level.hh:139
bool has_gammas() const
Definition Level.hh:152
static marley::IteratorToPointerMember< It, double > make_energy_iterator(It it)
Convert an iterator that points to a marley::Level* (or a smart pointer to a marley::Level) into an i...
Definition Level.hh:155
double half_life() const
Get the level half-life (s)
Definition Level.hh:144
marley::Gamma & add_gamma(const marley::Gamma &gamma)
Add a new gamma-ray transition to this level.
Definition Level.cc:55
const std::vector< marley::Gamma > & gammas() const
Retrieve a const reference to the vector of gamma rays owned by this level.
Definition Level.hh:148
void set_parity(marley::Parity pi)
Set the level parity.
Definition Level.hh:142
Level(double E, int twoJ, marley::Parity pi, double half_life)
Definition Level.cc:26
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.
Definition Level.cc:30
marley::Parity parity() const
Get the level parity.
Definition Level.hh:141
int twoJ() const
Get two times the level spin.
Definition Level.hh:138
void clear_gammas()
Remove all gamma ray information from this level.
Definition Level.cc:79
void set_energy(double E)
Set the excitation energy of this level (MeV)
Definition Level.hh:136
std::string spin_parity_string() const
Returns the level spin-parity as a string.
Definition Level.cc:87
double energy() const
Get the excitation energy of this level (MeV)
Definition Level.hh:135
void set_half_life(double half_life)
Set the level half-life (s)
Definition Level.hh:145
Type-safe representation of a parity value (either +1 or -1)
Definition Parity.hh:25