Bayeux  3.4.1
Core Foundation library for SuperNEMO
i_vertex_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-02-12
5  * Last modified: 2014-07-15
6  *
7  * License:
8  *
9  * Description:
10  *
11  * History:
12  *
13  */
14 
15 #ifndef GENVTX_I_VERTEX_GENERATOR_H
16 #define GENVTX_I_VERTEX_GENERATOR_H 1
17 
18 // Standard library:
19 #include <string>
20 #include <iostream>
21 
22 // Third party:
23 // - Boost
24 #include <boost/scoped_ptr.hpp>
25 #include <boost/noncopyable.hpp>
26 // - Bayeux/datatools
28 #include <datatools/handle.h>
29 #include <datatools/i_tree_dump.h>
30 #include <datatools/logger.h>
32 // - Bayeux/geomtools
33 #include <geomtools/utils.h>
35 
36 // This project:
37 #include <genvtx/detail/vg_tools.h>
38 #include <genvtx/utils.h>
39 
40 namespace datatools {
41  class properties;
42  class service_manager;
43 }
44 
45 namespace geomtools {
46  class manager;
47 }
48 
49 namespace mygsl {
50  class rng;
51 }
52 
53 namespace genvtx {
54 
55  // Forward declaration:
56  class vertex_validation;
57 
59  class i_vertex_generator : private boost::noncopyable,
61  {
62  public:
63 
65  bool is_debug() const;
66 
68  void set_debug(bool debug_);
69 
71  bool has_name() const;
72 
74  const std::string & get_name() const;
75 
77  void set_name(const std::string &);
78 
80  bool has_geo_label() const;
81 
83  void set_geo_label(const std::string & geo_label_);
84 
86  const std::string & get_geo_label() const;
87 
89  bool has_geom_setup_requirement() const;
90 
92  void set_geom_setup_requirement(const std::string & geom_setup_requirement_);
93 
95  std::string get_geom_setup_requirement() const;
96 
98  void check_geom_setup_requirement(const geomtools::manager * gmgr_) const;
99 
101  bool has_external_prng() const;
102 
105 
107  virtual bool is_vertex_validation_supported() const;
108 
110  bool has_vertex_validation() const;
111 
113  void set_external_prng(mygsl::rng & prng_);
114 
116  bool has_prng() const;
117 
119  mygsl::rng & grab_prng();
120 
122  bool has_geom_manager() const;
123 
125  void set_geom_manager(const geomtools::manager & gmgr_);
126 
128  const geomtools::manager & get_geom_manager() const;
129 
131  bool has_total_weight() const;
132 
134  const weight_info & get_total_weight() const;
135 
137  bool is_time_generator() const;
138 
140  virtual bool has_next_vertex() const;
141 
143  void shoot_vertex(mygsl::rng & random_, geomtools::vector_3d & vertex_);
144 
146  void shoot_vertex(geomtools::vector_3d & vertex_);
147 
150 
152  void shoot_vertex_and_time(mygsl::rng & random_, geomtools::vector_3d & vertex_, double & time_);
153 
155  void shoot_vertex_and_time(geomtools::vector_3d & vertex_, double & time_);
156 
158  virtual void initialize_simple();
159 
161  virtual void initialize_standalone(const datatools::properties & setup_);
162 
164  virtual void initialize_with_service_only(const datatools::properties & setup_,
165  datatools::service_manager & service_manager_);
166 
168  virtual void initialize_with_dictionary_only(const datatools::properties & setup_,
169  vg_dict_type & dictionary_);
170 
173 
175  virtual ~i_vertex_generator();
176 
178  virtual bool is_initialized() const = 0;
179 
181  virtual void initialize(const datatools::properties & setup_,
182  datatools::service_manager & service_manager_,
183  vg_dict_type & dictionary_) = 0;
184 
186  virtual void reset() = 0;
187 
189  virtual void tree_dump(std::ostream & out_ = std::clog,
190  const std::string & title_ = "",
191  const std::string & indent_ = "",
192  bool inherit_ = false) const;
193 
196 
199 
201  static void ocd_support(datatools::object_configuration_description &, const std::string & label_ = "");
202 
203  protected:
204 
206  void _set_time_generator(bool);
207 
209  void _initialize(const datatools::properties & setup_,
210  datatools::service_manager & service_manager_);
211 
213  void _reset();
214 
217 
219  void _set_total_weight(const weight_info & a_info);
220 
221  void _initialize_basics(const datatools::properties & setup_,
222  datatools::service_manager & service_manager_);
223 
225  datatools::service_manager & service_manager_);
226 
228  datatools::service_manager & service_manager_);
229 
232 
234  virtual void _shoot_vertex(mygsl::rng & random_,
235  geomtools::vector_3d & vertex_);
236 
238  virtual void _shoot_vertex_and_time(mygsl::rng & random_,
239  geomtools::vector_3d & vertex_,
240  double & time_);
241 
242  private:
243 
245  void _shoot_vertex_(mygsl::rng & random_, geomtools::vector_3d & vertex_);
246 
248  void _shoot_vertex_and_time_(mygsl::rng & random_, geomtools::vector_3d & vertex_, double & time_);
249 
250  protected:
251 
253 
254  private:
255 
256  std::string _name_;
257  bool _time_generator_;
258  std::string _geo_label_;
259  std::string _geom_setup_requirement_;
260  const ::geomtools::manager * _geom_manager_;
261  weight_info _total_weight_;
262  mygsl::rng * _external_prng_;
263  bool _vertex_validation_support_;
264  boost::scoped_ptr<vertex_validation> _vertex_validation_;
265 
266  // Factory declaration :
268 
269  };
270 
271 } // end of namespace genvtx
272 
273 #include <genvtx/vg_macros.h>
274 
275 #endif // GENVTX_I_VERTEX_GENERATOR_H
276 
277 /*
278 ** Local Variables: --
279 ** mode: c++ --
280 ** c-file-style: "gnu" --
281 ** tab-width: 2 --
282 ** End: --
283 */
const weight_info & get_total_weight() const
Get the weight info attached to the vertex generator.
void set_vertex_validation_support(bool)
Set vertex validation support flag.
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
void set_geo_label(const std::string &geo_label_)
Set the geometry service's label.
Top-level namespace of the Bayeux/genvtx module library.
Definition: box_model_vg.h:32
bool has_geom_manager() const
Check if a geometry manager is attached to the vertex generator.
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
const std::string & get_name() const
Return the name.
virtual void initialize(const datatools::properties &setup_, datatools::service_manager &service_manager_, vg_dict_type &dictionary_)=0
Main initialization interface method.
void check_geom_setup_requirement(const geomtools::manager *gmgr_) const
Check the geometry setup requirement with respect to a geometry manager.
virtual void _shoot_vertex_and_time(mygsl::rng &random_, geomtools::vector_3d &vertex_, double &time_)
Main vertex randomization interface method (default: throw exception)
bool has_name() const
Check if a name is defined.
void _initialize_vertex_validation(const datatools::properties &setup_, datatools::service_manager &service_manager_)
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.
bool has_total_weight() const
Check if some weight info is attached to the vertex generator.
void _set_time_generator(bool)
Set the time generator flag.
void set_logging_priority(datatools::logger::priority)
Set the logging priority threshold.
An object that describes the way an object of a given class can be configured through properties.
Definition: object_configuration_description.h:234
weight_info & _grab_total_weight()
Return a mutable total weight information.
void shoot_vertex_and_time(mygsl::rng &random_, geomtools::vector_3d &vertex_, double &time_)
Wrapper method for vertex/time randomization.
void _reset()
Internal reset.
std::string get_geom_setup_requirement() const
Return has a geometry setup requirement.
void set_external_prng(mygsl::rng &prng_)
Set the reference to an external PRNG.
datatools::logger::priority get_logging_priority() const
Return the logging priority threshold.
void set_debug(bool debug_)
Set the debug flag.
void _initialize_basics(const datatools::properties &setup_, datatools::service_manager &service_manager_)
bool has_geom_setup_requirement() const
Check if the generator has a geometry setup requirement.
bool has_external_prng() const
Check is an external PRNG is used.
bool is_debug() const
Check the debug flag.
The vertex validation.
Definition: vertex_validation.h:52
i_vertex_generator()
Constructor.
void set_geom_manager(const geomtools::manager &gmgr_)
Set a geometry manager.
const std::string & get_geo_label() const
Return the geometry service's label.
void _set_total_weight(const weight_info &a_info)
Set a total weight information.
virtual void initialize_simple()
Simple initialization(no external resource)
static void ocd_support(datatools::object_configuration_description &, const std::string &label_="")
OCD support.
mygsl::rng & grab_prng()
Return a mutable reference to the available PRNG.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
virtual void initialize_with_dictionary_only(const datatools::properties &setup_, vg_dict_type &dictionary_)
Initialization from a container of properties, a service manager and a dictionnary of vertex generato...
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
bool has_prng() const
Check if a PRNG is available.
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
Utilities for logging information.
Geometry manager for virtual geometry modelling. Main geometry manager for the modelisation of variou...
Definition: manager.h:70
The base interface class for all vertex generator classes.
Definition: i_vertex_generator.h:59
void set_name(const std::string &)
Set the name.
virtual bool is_initialized() const =0
Check initialization status.
void _initialize(const datatools::properties &setup_, datatools::service_manager &service_manager_)
Internal initialization.
Information about the weighting of combined vertex generators.
Definition: utils.h:84
Macros to automatically register vertex generator class.
vertex_validation & _grab_vertex_validation()
Return a reference to the embedded mutable vertex validation.
void _initialize_geo_manager(const datatools::properties &setup_, datatools::service_manager &service_manager_)
virtual void reset()=0
Reset method.
bool has_vertex_validation() const
Check vertex validation.
virtual ~i_vertex_generator()
Destructor.
virtual void _shoot_vertex(mygsl::rng &random_, geomtools::vector_3d &vertex_)
Main vertex randomization interface method.
const geomtools::manager & get_geom_manager() const
Get the geometry manager attached to the vertex generator.
std::map< std::string, vg_entry_type > vg_dict_type
Definition: vg_tools.h:125
#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
bool has_geo_label() const
Check if the generator has a geometry service's label.
void set_geom_setup_requirement(const std::string &geom_setup_requirement_)
Set has a geometry setup requirement.
virtual void initialize_standalone(const datatools::properties &setup_)
Initialization from a container of properties.
virtual bool has_next_vertex() const
Check if another vertex is available.
Service management class.
Definition: service_manager.h:57
Pseudo random number generator.
Definition: rng.h:53
virtual bool is_vertex_validation_supported() const
Check if vertex validation is supported.
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125
bool is_time_generator() const
Check if the generator also generates a random time associated to the vertex.
datatools::logger::priority _logging_priority
Logging priority threshold.
Definition: i_vertex_generator.h:252
void shoot_vertex(mygsl::rng &random_, geomtools::vector_3d &vertex_)
Wrapper method for vertex randomization.