Bayeux  3.4.1
Core Foundation library for SuperNEMO
i_genbb.h
Go to the documentation of this file.
1 /* Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2010-09-28
4  * Last modified: 2014-12-18
5  *
6  * License:
7  * Copyright 2007-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  * GENBB generator abstract class
26  *
27  */
28 
29 #ifndef GENBB_HELP_I_GENBB_H
30 #define GENBB_HELP_I_GENBB_H 1
31 
32 // Third party:
33 // - Bayeux/datatools:
35 #include <datatools/logger.h>
36 #include <datatools/i_tree_dump.h>
37 
38 // This project:
40 
41 namespace datatools {
42  // Forward declarations:
43  class properties;
44  class service_manager;
45  class object_configuration_description;
46 }
47 
48 namespace mygsl {
49  // Forward declaration:
50  class rng;
51 }
52 
53 namespace genbb {
54 
55  // Forward declaration:
56  class primary_event;
57 
60  {
61  public:
62 
64  bool has_name() const;
65 
67  const std::string & get_name() const;
68 
70  void set_name(const std::string &);
71 
73  void reset_name();
74 
76  i_genbb();
77 
79  virtual ~i_genbb();
80 
82  virtual void load_next(primary_event & event_,
83  bool compute_classification_ = true);
84 
86  virtual bool can_external_random() const;
87 
89  virtual bool has_external_random() const;
90 
92  virtual void set_external_random(mygsl::rng &);
93 
95  virtual void reset_external_random();
96 
99 
101  const mygsl::rng & get_external_random() const;
102 
104  virtual void initialize_simple();
105 
107  virtual void initialize_standalone(const datatools::properties & setup_);
108 
110  virtual void initialize_with_service_only(const datatools::properties & setup_,
111  datatools::service_manager & service_manager_);
112 
114  virtual void initialize_with_dictionary_only(const datatools::properties & setup_,
115  detail::pg_dict_type & dictionary_);
116 
118  virtual bool is_initialized() const = 0;
119 
121  virtual void initialize(const datatools::properties & setup_,
122  datatools::service_manager & service_manager_,
123  detail::pg_dict_type & dictionary_) = 0;
124 
126  virtual void reset() = 0;
127 
129  virtual bool has_next() = 0;
130 
133 
136 
138  bool is_debug() const;
139 
141  void set_assign_generation_ids(bool);
142 
144  bool is_assign_generation_ids() const;
145 
147  virtual void tree_dump(std::ostream& out = std::clog,
148  const std::string& title = "",
149  const std::string& indent = "",
150  bool inherit = false) const;
151 
154 
155  protected:
156 
158  virtual void _load_next(primary_event & event_,
159  bool compute_classification_) = 0;
160 
162  void _initialize_base(const datatools::properties & setup_);
163 
164  protected:
165 
167 
168  private:
169 
170  std::string _name_;
171  mygsl::rng * _external_random_;
172  bool _assign_generation_ids_;
173 
174  // Factory stuff :
176 
177  };
178 
179 } // end of namespace genbb
180 
181 #include <genbb_help/genbb_macros.h>
182 
183 #endif // GENBB_HELP_I_GENBB_H
184 
185 // Local Variables: --
186 // mode: c++ --
187 // End: --
void _initialize_base(const datatools::properties &setup_)
Base initialization.
void set_assign_generation_ids(bool)
Set the flag to assign unique generation Ids to primary particles.
void set_logging_priority(datatools::logger::priority p)
Set the logging priority threshold.
virtual bool can_external_random() const
Check if the generator accepts an external PRNG.
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
bool is_debug() const
Check the debug logging.
virtual void initialize_with_dictionary_only(const datatools::properties &setup_, detail::pg_dict_type &dictionary_)
Initialization from a container of properties, a service manager and a dictionnary of vertex generato...
bool has_name() const
Check for a non-empty name.
void reset_name()
Reset the name of the event generator.
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
GENBB particle generator abstract base class.
Definition: i_genbb.h:59
const std::string & get_name() const
Return the name of the event generator.
virtual void _load_next(primary_event &event_, bool compute_classification_)=0
Protected abstract interface to be invoked by the public 'load_next' method.
datatools::logger::priority get_logging_priority() const
Return the logging priority threshold.
bool is_assign_generation_ids() const
Check the flag to assign unique generation Ids to primary particles.
void set_name(const std::string &)
Set the name of the event generator.
virtual void load_next(primary_event &event_, bool compute_classification_=true)
Load a new 'primary_event' object.
An object that describes the way an object of a given class can be configured through properties.
Definition: object_configuration_description.h:234
virtual bool is_initialized() const =0
Check initialization status.
static void base_initialize_ocd(datatools::object_configuration_description &)
OCD interface.
i_genbb()
Constructor.
virtual void reset()=0
Reset method.
virtual void set_external_random(mygsl::rng &)
Set an external PRNG.
virtual bool has_next()=0
Returns true if the generator can provide one more generated event.
virtual void initialize_simple()
Simple initialization (no external resource)
virtual void initialize(const datatools::properties &setup_, datatools::service_manager &service_manager_, detail::pg_dict_type &dictionary_)=0
Main initialization interface method.
mygsl::rng & grab_external_random()
Return a mutable reference to the external PRNG.
Top-level namespace of the Bayeux/genbb_help module library.
Definition: alpha_decay.h:51
virtual bool has_external_random() const
Check if the generator uses an external PRNG.
datatools::logger::priority _logging_priority
Definition: i_genbb.h:166
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
virtual void initialize_with_service_only(const datatools::properties &setup_, datatools::service_manager &service_manager_)
Initialization from a container of properties and a service manager.
A primary event from a Monte-Carlo generator.
Definition: primary_event.h:60
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
Utilities for logging information.
virtual void initialize_standalone(const datatools::properties &setup_)
Initialization from a container of properties.
virtual ~i_genbb()
Destructor.
const mygsl::rng & get_external_random() const
Return a non-mutable reference to the external PRNG.
virtual void tree_dump(std::ostream &out=std::clog, const std::string &title="", const std::string &indent="", bool inherit=false) const
Smart print.
#define DATATOOLS_FACTORY_SYSTEM_REGISTER_INTERFACE(BaseType)
Declaration of a system (allocator/functor) factory register as a static member of a base class and s...
Definition: factory_macros.h:52
std::map< std::string, pg_entry_type > pg_dict_type
Definition: pg_tools.h:134
virtual void reset_external_random()
Reset an external PRNG.
Service management class.
Definition: service_manager.h:57
Pseudo random number generator.
Definition: rng.h:53
A dictionary of arbitrary properties.
Definition: properties.h:125