Bayeux  3.4.1
Core Foundation library for SuperNEMO
nuclear_level.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2014-06-08
4  * Last modified: 2014-06-08
5  *
6  * License:
7  * Copyright 2014 F. Mauger
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or (at
12  * your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  *
24  * Description:
25  *
26  * Description of a nuclear level.
27  *
28  * History:
29  *
30  */
31 
32 #ifndef GENBB_HELP_NUCLEAR_LEVEL_H
33 #define GENBB_HELP_NUCLEAR_LEVEL_H 1
34 
35 // Standard library:
36 #include <string>
37 #include <vector>
38 
39 // Third party:
40 // - Boost:
41 #include <boost/scoped_ptr.hpp>
42 // - Bayeux/datatools:
43 #include <datatools/properties.h>
44 #include <datatools/handle.h>
45 #include <datatools/i_tree_dump.h>
46 
47 namespace genbb {
48 
49  // Forward declaration
50  class nuclear_decay;
51 
54  {
55  public:
56 
61 
63  enum parity_type {
68  };
69 
71  class decay_channel {
72  public:
73 
75  decay_channel();
76 
78  virtual ~decay_channel();
79 
81  void initialize(const nuclear_decay &, double, double);
82 
84  void reset();
85 
87  bool is_valid() const;
88 
90  void set_decay(const nuclear_decay &);
91 
93  void set_branching_ratio(double);
94 
96  void set_cumul_prob(double);
97 
99  const nuclear_decay & get_decay() const;
100 
102  double get_branching_ratio() const;
103 
105  double get_cumul_prob() const;
106 
107  private:
108 
109  const nuclear_decay * _decay_;
110  double _branching_ratio_;
111  double _cumul_prob_;
112 
113  };
114 
116  typedef std::vector<decay_channel> decay_channels_col_type;
117 
119  static std::string label_from_parity(parity_type);
120 
122  static parity_type parity_from_label(const std::string &);
123 
125  static std::string label_from_spin(double);
126 
128  static double spin_from_label(const std::string &);
129 
131  nuclear_level();
132 
134  virtual ~nuclear_level();
135 
137  bool is_valid() const;
138 
140  void set_A(int);
141 
143  void set_Z(int);
144 
146  void set_spin(double);
147 
149  void set_parity(parity_type);
150 
152  void set_half_life(double);
153 
155  void set_width(double);
156 
158  void set_stable();
159 
161  void set_energy(double);
162 
164  void set_fundamental();
165 
167  int get_A() const;
168 
170  int get_Z() const;
171 
173  const std::string & get_element_symbol() const;
174 
176  int get_N() const;
177 
179  bool spin_is_known() const;
180 
182  bool parity_is_known() const;
183 
185  double get_spin() const;
186 
188  parity_type get_parity() const;
189 
191  double get_half_life() const;
192 
194  double get_mean_life_time() const;
195 
197  double get_width() const;
198 
200  bool is_stable() const;
201 
203  double get_energy() const;
204 
206  bool is_fundamental() const;
207 
209  bool has_decay_table() const;
210 
212  void add_decay_channel(const nuclear_decay & decay_, double branching_ratio_);
213 
215  size_t get_number_of_decay_channels() const;
216 
218  const decay_channel & get_decay_channel(int i_) const;
219 
221  const datatools::properties & get_auxiliaries() const;
222 
225 
228 
231 
233  std::string to_string(unsigned int = 0) const;
234 
236  virtual void tree_dump(std::ostream & out_ = std::clog,
237  const std::string & title_ = "",
238  const std::string & indent_ = "",
239  bool inherit_ = false) const;
240 
242  bool is_initialized() const;
243 
245  void initialize(const datatools::properties & config_);
246 
248  void initialize_simple();
249 
251  void reset();
252 
254  void install_decay_table(const datatools::properties & config_,
255  const std::map<std::string, datatools::handle<nuclear_decay> > & decays_);
256 
258  void reset_decay_table();
259 
262 
263  protected:
264 
266  void _set_defaults();
267 
269  void _compute_decay_weights();
270 
271  private:
272 
273  bool _initialized_;
274  int _A_;
275  int _Z_;
276  double _spin_;
277  parity_type _parity_;
278  double _half_life_;
279  double _energy_;
280  datatools::properties _auxiliaries_;
281  datatools::properties _decay_table_config_;
282  decay_channels_col_type _decay_channels_;
283 
284  };
285 
286 } // end of namespace genbb
287 
288 #endif // GENBB_HELP_NUCLEAR_LEVEL_H
289 
290 // Local Variables: --
291 // mode: c++ --
292 // End: --
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
int get_N() const
Return the number of neutrons.
void set_stable()
Make the level stable.
bool is_valid() const
Check validity.
size_t get_number_of_decay_channels() const
Return the number of decay channels.
decay_channel()
Default constructor.
double get_mean_life_time() const
Return the mean life time.
Positive parity.
Definition: nuclear_level.h:66
Unknown parity.
Definition: nuclear_level.h:67
datatools::properties & grab_decay_table_config()
Return decay table configuration properties.
void _compute_decay_weights()
Compute the weights associated to the decay.
static std::string label_from_spin(double)
Return a label associated to a spin value.
static parity_type parity_from_label(const std::string &)
Return the parity value associated to a label.
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
static double spin_from_label(const std::string &)
Return the spin value associated to a label.
A decay channel attached to the level.
Definition: nuclear_level.h:71
double get_energy() const
Return the excitation energy.
const decay_channel & get_decay_channel(int i_) const
Return the decay channel at a given index.
void set_parity(parity_type)
Set the parity.
void reset()
Reset.
std::vector< decay_channel > decay_channels_col_type
A collection of decay modes.
Definition: nuclear_level.h:116
void set_cumul_prob(double)
Set the cumulative probability.
nuclear_level()
Default constructor.
void set_energy(double)
Set the energy.
int get_Z() const
Return the number of protons.
void set_A(int)
Set the number of nucleons.
Negative parity.
Definition: nuclear_level.h:65
parity_type get_parity() const
Return the parity.
virtual ~nuclear_level()
Desstructor.
bool is_fundamental() const
Check if the level is fundamental.
void set_fundamental()
Set the fundamental energy.
void add_decay_channel(const nuclear_decay &decay_, double branching_ratio_)
Add a decay channel.
void reset_decay_table()
Reset decay table.
bool parity_is_known() const
Check if the parity is known.
const nuclear_decay & get_decay() const
Return the decay.
bool is_initialized() const
Check initialization flag.
bool is_valid() const
Check validity.
int get_A() const
Return the number of nucleons.
void set_Z(int)
Set the number of protons.
double get_branching_ratio() const
Return the branching ratio.
void initialize(const datatools::properties &config_)
Initialize from a list of parameters and a dictionary of nuclear decays.
const std::string & get_element_symbol() const
Return the element symbol.
void install_decay_table(const datatools::properties &config_, const std::map< std::string, datatools::handle< nuclear_decay > > &decays_)
Install the decay table.
parity_type
Parity values.
Definition: nuclear_level.h:63
Top-level namespace of the Bayeux/genbb_help module library.
Definition: alpha_decay.h:51
const datatools::properties & get_decay_table_config() const
Return decay table configuration properties.
void set_decay(const nuclear_decay &)
Set the nuclear decay.
Invalid value.
Definition: nuclear_level.h:64
double get_cumul_prob() const
Return the cumulative probability.
bool is_stable() const
Check if the level is stable.
void set_branching_ratio(double)
Set the branching ratio.
double get_width() const
Return the level width.
std::string to_string(unsigned int=0) const
Return a descriptive string.
datatools::properties & grab_auxiliaries()
Return auxiliary properties.
static std::string label_from_parity(parity_type)
Return a label associated to a parity value.
datatools::handle< nuclear_level > handle_type
Handle to a nuclear level.
Definition: nuclear_level.h:58
void initialize(const nuclear_decay &, double, double)
Initialization.
Description of a nuclear decay.
Definition: nuclear_decay.h:54
double get_half_life() const
Return the half_life.
bool has_decay_table() const
Check the decay table.
void _set_defaults()
Set defaults.
double get_spin() const
Return the spin.
const datatools::properties & get_auxiliaries() const
Return auxiliary properties.
const decay_channels_col_type & get_decay_channels() const
Return the decay channel table.
datatools::handle< nuclear_decay > decay_handle_type
Handle to a nuclear decay.
Definition: nuclear_level.h:60
Description of a nuclear level.
Definition: nuclear_level.h:53
bool spin_is_known() const
Check if the spin is known.
virtual ~decay_channel()
Destructor.
void set_half_life(double)
Set the half_life.
void set_width(double)
Set the width.
void initialize_simple()
Standalone initialization.
void set_spin(double)
Set the spin.
A dictionary of arbitrary properties.
Definition: properties.h:125