MARLEY (Model of Argon Reaction Low Energy Yields)  v1.2.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
DecayScheme.hh
1 //
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 <iostream>
19 #include <memory>
20 #include <vector>
21 
22 #include "marley/Level.hh"
23 
24 namespace marley {
25 
26  class Event;
27  class Generator;
28 
30  class DecayScheme {
31 
32  public:
33 
41  enum class FileFormat { native, talys };
42 
43  inline DecayScheme() : Z_(0), A_(0) {}
44 
48  DecayScheme(int Z, int A);
49 
56  DecayScheme(int Z, int A, const std::string& filename,
57  FileFormat format = FileFormat::talys);
58 
61  inline const std::vector<std::unique_ptr<marley::Level> >&
62  get_levels() const;
63 
66  marley::Level& add_level(const marley::Level& level);
67 
74 
85  void do_cascade(marley::Level& initial_level, marley::Event& event,
86  marley::Generator& gen, int qIon);
87 
89  inline int Z() const;
90 
92  inline int A() const;
93 
95  void print(std::ostream& out = std::cout) const;
96 
101  void read_from_stream(std::istream& in);
102 
105  void print_latex_table(std::ostream& ostr = std::cout);
106 
109  void print_report(std::ostream& ostr = std::cout) const;
110 
112  int pdg() const;
113 
114  protected:
115 
116  int Z_;
117  int A_;
118 
120  std::vector< std::unique_ptr<marley::Level> > levels_;
121 
126  size_t level_lower_bound_index(double Ex);
127 
128  private:
129 
132  void parse(const std::string& filename,
133  FileFormat ff = FileFormat::talys);
134 
135  // Functions called by the constructor to parse the
136  // different nuclear data formats accepted by this class
137 
140  void parse_talys(const std::string& filename);
141 
144  void parse_native(const std::string& filename);
145  // Add more formats as needed
146  };
147 
148  // Inline function definitions
149  inline int DecayScheme::Z() const { return Z_; }
150  inline int DecayScheme::A() const { return A_; }
151 
152  inline const std::vector<std::unique_ptr<marley::Level> >&
153  DecayScheme::get_levels() const { return levels_; }
154 }
155 
156 inline std::istream& operator>>(std::istream& in, marley::DecayScheme& ds)
157 {
158  ds.read_from_stream(in);
159  return in;
160 }
161 
162 inline std::ostream& operator<<(std::ostream& out,
163  const marley::DecayScheme& ds)
164 {
165  ds.print(out);
166  return out;
167 }
Discrete level and γ-ray data for a specific nuclide.
Definition: DecayScheme.hh:30
void read_from_stream(std::istream &in)
Use a std::istream to initialize this DecayScheme object, replacing any previous data.
Definition: DecayScheme.cc:404
void do_cascade(marley::Level &initial_level, marley::Event &event, marley::Generator &gen, int qIon)
Simulates nuclear de-excitation via γ-ray emission(s)
Definition: DecayScheme.cc:71
int pdg() const
Returns the nuclear PDG code corresponding to Z and A.
Definition: DecayScheme.cc:67
std::vector< std::unique_ptr< marley::Level > > levels_
Level objects owned by this DecayScheme.
Definition: DecayScheme.hh:120
int Z_
Atomic number.
Definition: DecayScheme.hh:116
marley::Level & add_level(const marley::Level &level)
Add a level to the DecayScheme.
Definition: DecayScheme.cc:367
void print_latex_table(std::ostream &ostr=std::cout)
Print LaTeX source code that gives a tabular representation of the DecayScheme object.
Definition: DecayScheme.cc:291
int A_
Mass number.
Definition: DecayScheme.hh:117
const std::vector< std::unique_ptr< marley::Level > > & get_levels() const
Get a const reference to the vector that holds the Level objects.
Definition: DecayScheme.hh:153
size_t level_lower_bound_index(double Ex)
Get the index of the first level whose energy is not less than Ex.
Definition: DecayScheme.cc:358
FileFormat
The FileFormat type is used to tell the DecayScheme class which format to assume when parsing a discr...
Definition: DecayScheme.hh:41
int A() const
Get the mass number.
Definition: DecayScheme.hh:150
int Z() const
Get the atomic number.
Definition: DecayScheme.hh:149
void print(std::ostream &out=std::cout) const
Print this DecayScheme object to a std::ostream.
Definition: DecayScheme.cc:380
void print_report(std::ostream &ostr=std::cout) const
Print a human-readable text representation of the DecayScheme object.
Definition: DecayScheme.cc:264
marley::Level * get_pointer_to_closest_level(double E_level)
Gets a pointer to the Level in the DecayScheme whose excitation energy is closest to E_level.
Definition: DecayScheme.cc:35
Container for ingoing and outgoing momentum 4-vectors from a reaction.
Definition: Event.hh:66
The MARLEY Event generator.
Definition: Generator.hh:42
A discrete nuclear energy level.
Definition: Level.hh:29