MARLEY (Model of Argon Reaction Low Energy Yields)  v1.2.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
StructureDatabase.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 <map>
19 #include <memory>
20 #include <set>
21 #include <string>
22 #include <unordered_map>
23 
24 #include "marley/DecayScheme.hh"
25 
26 namespace marley {
27 
28  class GammaStrengthFunctionModel;
29  class Fragment;
30  class LevelDensityModel;
31  class OpticalModel;
32 
40 
41  public:
42 
45 
52  void emplace_decay_scheme(int pdg, const std::string& filename,
53  DecayScheme::FileFormat format = DecayScheme::FileFormat::talys);
54 
60  void add_decay_scheme(int pdg, std::unique_ptr<marley::DecayScheme>& ds);
61 
68  std::set<int> find_all_nuclides(const std::string& filename,
69  DecayScheme::FileFormat format = DecayScheme::FileFormat::talys);
70 
72  void clear();
73 
80  void remove_decay_scheme(int pdg);
81 
86  marley::DecayScheme* get_decay_scheme(const int particle_id);
87 
93  marley::DecayScheme* get_decay_scheme(const int Z, const int A);
94 
98  marley::OpticalModel& get_optical_model(int nucleus_pid);
99 
105  const int A);
106 
110  marley::LevelDensityModel& get_level_density_model(const int nucleus_pid);
111 
117  const int A);
118 
124  const int Z, const int A);
125 
130  const int nuc_pdg);
131 
133  inline const std::unordered_map<int,
134  std::unique_ptr<marley::DecayScheme> >& decay_schemes() const
135  {
136  return decay_scheme_table_;
137  }
138 
140  static inline const std::map<int, marley::Fragment>& fragments() {
141  if ( !initialized_gs_spin_parity_table_ ) initialize_jpi_table();
142  return fragment_table_;
143  }
144 
149  static const marley::Fragment* get_fragment(const int fragment_pdg);
150 
156  static const marley::Fragment* get_fragment(const int Z, const int A);
157 
160  inline int get_fragment_l_max() const { return fragment_l_max_; }
161 
164  inline int get_gamma_l_max() const { return gamma_l_max_; }
165 
168  inline void set_fragment_l_max( int ell ) { fragment_l_max_ = ell; }
169 
172  inline void set_gamma_l_max( int ell ) { gamma_l_max_ = ell; }
173 
178  static void get_gs_spin_parity(int nuc_pdg, int& twoJ,
179  marley::Parity& Pi);
180 
186  static void get_gs_spin_parity(const int Z, const int A, int& twoJ,
187  marley::Parity& Pi);
188 
189  private:
190 
193  std::unordered_map<int, std::unique_ptr<marley::DecayScheme> >
194  decay_scheme_table_;
195 
198  std::unordered_map<int, std::unique_ptr<marley::OpticalModel> >
199  optical_model_table_;
200 
204  std::unordered_map<int, std::unique_ptr<marley::LevelDensityModel> >
205  level_density_table_;
206 
210  std::unordered_map<int, std::unique_ptr<
211  marley::GammaStrengthFunctionModel> > gamma_strength_function_table_;
212 
215  static std::map<int, marley::Fragment> fragment_table_;
216 
218  static constexpr int DEFAULT_FRAGMENT_L_MAX = 5;
219 
221  static constexpr int DEFAULT_GAMMA_L_MAX = DEFAULT_FRAGMENT_L_MAX;
222 
226  int fragment_l_max_ = DEFAULT_FRAGMENT_L_MAX;
227 
231  int gamma_l_max_ = DEFAULT_GAMMA_L_MAX;
232 
235  static bool initialized_gs_spin_parity_table_;
236 
238  const std::string structure_index_filename_ = "nuclide_index.txt";
239 
242  bool loaded_structure_index_ = false;
243 
246  std::map< int, std::string > decay_scheme_filenames_;
247 
250  static const std::string jpi_data_file_name_;
251 
253  static std::map< int, std::pair<int, marley::Parity> > jpi_table_;
254 
257  static void initialize_jpi_table();
258 
261  void load_structure_index();
262  };
263 
264 }
Discrete level and γ-ray data for a specific nuclide.
Definition: DecayScheme.hh:30
FileFormat
The FileFormat type is used to tell the DecayScheme class which format to assume when parsing a discr...
Definition: DecayScheme.hh:41
Simple container for storing reference data about each of the nuclear fragments considered by MARLEY'...
Definition: Fragment.hh:27
Abstract base class for models of gamma-ray strength functions.
Definition: GammaStrengthFunctionModel.hh:30
Abstract base class for models of nuclear level densities.
Definition: LevelDensityModel.hh:23
Abstract base class for nuclear optical model implementations.
Definition: OpticalModel.hh:23
Type-safe representation of a parity value (either +1 or -1)
Definition: Parity.hh:25
Container for nuclear structure information organized by nuclide.
Definition: StructureDatabase.hh:39
marley::GammaStrengthFunctionModel & get_gamma_strength_function_model(const int Z, const int A)
Retrieves a gamma-ray strength function model object from the database, creating it if one did not al...
Definition: StructureDatabase.cc:263
void remove_decay_scheme(int pdg)
Deletes the discrete level data in the database associated with a given nuclide.
Definition: StructureDatabase.cc:281
static const marley::Fragment * get_fragment(const int fragment_pdg)
Retrieves nuclear fragment data from the database.
Definition: StructureDatabase.cc:292
const std::unordered_map< int, std::unique_ptr< marley::DecayScheme > > & decay_schemes() const
Retrieves a const reference to the table of DecayScheme objects.
Definition: StructureDatabase.hh:134
void set_fragment_l_max(int ell)
Sets the maximum orbital angular momentum to consider when simulating fragment emission to the contin...
Definition: StructureDatabase.hh:168
marley::OpticalModel & get_optical_model(int nucleus_pid)
Retrieves an optical model object from the database, creating it if one did not already exist.
Definition: StructureDatabase.cc:192
void add_decay_scheme(int pdg, std::unique_ptr< marley::DecayScheme > &ds)
Add a DecayScheme object to the database that contains discrete level data for a specific nuclide.
Definition: StructureDatabase.cc:52
std::set< int > find_all_nuclides(const std::string &filename, DecayScheme::FileFormat format=DecayScheme::FileFormat::talys)
Create a set of Particle Data Group codes for every nuclide in a discrete level data file.
Definition: StructureDatabase.cc:73
static void get_gs_spin_parity(int nuc_pdg, int &twoJ, marley::Parity &Pi)
Looks up the ground-state spin-parity for a particular nuclide.
Definition: StructureDatabase.cc:317
StructureDatabase()
Creates an empty database.
Definition: StructureDatabase.cc:50
void set_gamma_l_max(int ell)
Sets the maximum multipolarity to consider when simulating gamma-ray emission to the continuum.
Definition: StructureDatabase.hh:172
void emplace_decay_scheme(int pdg, const std::string &filename, DecayScheme::FileFormat format=DecayScheme::FileFormat::talys)
Construct and add a DecayScheme object to the database that contains discrete level data for a specif...
Definition: StructureDatabase.cc:59
int get_gamma_l_max() const
Returns the maximum multipolarity to consider when simulating gamma-ray emission to the continuum.
Definition: StructureDatabase.hh:164
int get_fragment_l_max() const
Returns the maximum orbital angular momentum to consider when simulating fragment emission to the con...
Definition: StructureDatabase.hh:160
static const std::map< int, marley::Fragment > & fragments()
Retrieves a const reference to the table of Fragment objects.
Definition: StructureDatabase.hh:140
marley::DecayScheme * get_decay_scheme(const int particle_id)
Retrieves discrete level data from the database.
Definition: StructureDatabase.cc:125
marley::LevelDensityModel & get_level_density_model(const int nucleus_pid)
Retrieves a level density model object from the database, creating it if one did not already exist.
Definition: StructureDatabase.cc:228
void clear()
Removes all previously stored data from the database.
Definition: StructureDatabase.cc:288