Bayeux  3.4.1
Core Foundation library for SuperNEMO
combined_particle_generator.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Xavier Garrido <garrido@lal.in2p3.fr>
4  * Creation date: 2010-10-03
5  * Last modified: 2014-12-12
6  *
7  * License:
8  * Copyright 2007-2014 F. Mauger, Xavier Garrido
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or (at
13  * your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
23  * Boston, MA 02110-1301, USA.
24  *
25  * Description:
26  *
27  * A generator of GENBB-like event with a combined particle
28  *
29  * History:
30  *
31  */
32 
33 #ifndef GENBB_HELP_COMBINED_PARTICLE_GENERATOR_H
34 #define GENBB_HELP_COMBINED_PARTICLE_GENERATOR_H 1
35 
36 // Standard library:
37 #include <string>
38 
39 // Third party:
40 // - Bayeux/datatools:
41 #include <datatools/properties.h>
42 #include <datatools/units.h>
43 // - Bayeux/mygsl:
44 #include <mygsl/rng.h>
45 // - Bayeux/geomtools:
46 #include <geomtools/utils.h>
47 
48 // This project:
49 #include <genbb_help/i_genbb.h>
50 
51 namespace genbb {
52 
55  : public i_genbb
56  {
57  public:
58 
67  };
68 
70  struct entry_type
71  {
73  entry_type();
75  bool is_valid() const;
76  std::string label;
77  std::string name;
78  double prob;
79  double cumul_prob;
81  double time;
82  double time_width;
83  i_genbb * pg;
84  };
85 
87  typedef std::vector<entry_type> pg_col_type;
88 
90  enum mode_type {
94  MODE_TIME = 3
95  };
96 
98  void set_mode(int mode_);
99 
101  bool is_mode_time() const;
102 
104  bool is_mode_plain_probability() const;
105 
107  bool is_mode_activity() const;
108 
110  virtual bool can_external_random() const;
111 
113  const mygsl::rng & get_random() const;
114 
117 
120 
123 
125  virtual void initialize(const datatools::properties & setup_,
126  datatools::service_manager & service_manager_,
127  detail::pg_dict_type & dictionary_);
128 
130  virtual void reset();
131 
133  virtual bool has_next();
134 
136  virtual bool is_initialized() const;
137 
139  void dump(std::ostream & out_, const std::string & title_, const std::string & indent_ = "") const;
140 
141  protected:
142 
144  virtual void _load_next(primary_event & event_,
145  bool compute_classification_ = true);
146 
147  private:
148 
150  void _at_init_();
151 
153  void _at_reset_();
154 
155  private:
156 
157  bool _initialized_;
158  int _mode_;
159  unsigned long _seed_;
160  mygsl::rng _random_;
161  pg_col_type _generators_info_;
163 
164  };
165 
166 } // end of namespace genbb
167 
168 /***************
169  * OCD support *
170  ***************/
171 #include <datatools/ocd_macros.h>
173 
174 #endif // GENBB_HELP_COMBINED_PARTICLE_GENERATOR_H
175 
176 // Local Variables: --
177 // mode: c++ --
178 // End: --
void set_mode(int mode_)
Set the generation mode.
std::string name
Name.
Definition: combined_particle_generator.h:77
virtual void _load_next(primary_event &event_, bool compute_classification_=true)
Main generation function.
Particle generator entry.
Definition: combined_particle_generator.h:70
Fixed time delay.
Definition: combined_particle_generator.h:62
GENBB particle generator abstract base class.
Definition: i_genbb.h:59
bool is_mode_plain_probability() const
Check if generation mode is based on plain probability.
Branching ratios given by absolute activity.
Definition: combined_particle_generator.h:93
double time_width
Time delay constant (only range or gaussian)
Definition: combined_particle_generator.h:82
Gaussian ranged time delay.
Definition: combined_particle_generator.h:65
Definition: combined_particle_generator.h:66
Cascade of events from a time sequence.
Definition: combined_particle_generator.h:94
bool is_mode_activity() const
Check if generation mode is based on activity.
virtual bool is_initialized() const
Check initialization status.
double prob
Probability.
Definition: combined_particle_generator.h:78
virtual void initialize(const datatools::properties &setup_, datatools::service_manager &service_manager_, detail::pg_dict_type &dictionary_)
Main initialization interface method.
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
Undefined mode.
Definition: combined_particle_generator.h:91
const mygsl::rng & get_random() const
Return a non-mutable random generator.
mode_type
Generation mode.
Definition: combined_particle_generator.h:90
#define GENBB_PG_REGISTRATION_INTERFACE(GENBB_CLASS_NAME)
Definition: genbb_macros.h:22
double time
Time delay constant.
Definition: combined_particle_generator.h:81
Top-level namespace of the Bayeux/genbb_help module library.
Definition: alpha_decay.h:51
time_delay_type time_mode
Time delay mode.
Definition: combined_particle_generator.h:80
Random exponential time delay.
Definition: combined_particle_generator.h:63
A primary event from a Monte-Carlo generator.
Definition: primary_event.h:60
i_genbb * pg
Reference to a particle generator.
Definition: combined_particle_generator.h:83
double cumul_prob
Cumulated probability.
Definition: combined_particle_generator.h:79
void dump(std::ostream &out_, const std::string &title_, const std::string &indent_="") const
Smart dump.
virtual bool has_next()
Check next generation event.
Random ranged time delay.
Definition: combined_particle_generator.h:64
time_delay_type
Time delay mode.
Definition: combined_particle_generator.h:60
bool is_mode_time() const
Check if generation mode is based on time generation.
virtual bool can_external_random() const
Check existence of external random.
std::map< std::string, pg_entry_type > pg_dict_type
Definition: pg_tools.h:134
std::string label
Label.
Definition: combined_particle_generator.h:76
mygsl::rng & grab_random()
Return a mutable random generator.
Undefined time delay mode.
Definition: combined_particle_generator.h:61
Service management class.
Definition: service_manager.h:57
Branching ratios given by probability.
Definition: combined_particle_generator.h:92
Generator for combined generators.
Definition: combined_particle_generator.h:54
virtual ~combined_particle_generator()
Destructor.
Pseudo random number generator.
Definition: rng.h:53
std::vector< entry_type > pg_col_type
Collection of particle generator entry type.
Definition: combined_particle_generator.h:87
A dictionary of arbitrary properties.
Definition: properties.h:125