Bayeux  3.4.1
Core Foundation library for SuperNEMO
combined_vg.h
Go to the documentation of this file.
1 /* Author (s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2011-04-22
4  * Last modified: 2014-04-09
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Vertex generator that combines several weighted vertex generators
11  *
12  * History:
13  *
14  */
15 
16 #ifndef GENVTX_COMBINED_VG_H
17 #define GENVTX_COMBINED_VG_H 1
18 
19 // Standard library:
20 #include <vector>
21 
22 // Third party:
23 // - Bayeux/datatools
24 #include <datatools/logger.h>
25 
26 // This project:
27 #include <genvtx/vg_macros.h>
28 #include <genvtx/utils.h>
29 
30 namespace genvtx {
31 
34  {
35 
36  public:
37 
39  struct entry_type
40  {
41  std::string name;
42  double weight;
45  entry_type ();
47  };
48 
51  const std::string & a_name,
52  double a_weight = 1.0);
53 
55  virtual void tree_dump (std::ostream & out_ = std::clog,
56  const std::string & title_ = "",
57  const std::string & indent_ = "",
58  bool inherit_ = false) const;
59 
61  combined_vg();
62 
64  virtual ~combined_vg();
65 
67  virtual void initialize(const ::datatools::properties &,
70 
72  virtual void reset();
73 
75  virtual bool is_initialized() const;
76 
77  protected:
78 
80  virtual void _shoot_vertex(::mygsl::rng & random_,
81  ::geomtools::vector_3d & vertex_);
82 
84  void _shoot_vertex_combined (mygsl::rng & random_,
85  geomtools::vector_3d & vertex_);
86 
87  private:
88 
90  void _init_ ();
91 
93  void _reset_ ();
94 
96  void _set_defaults_ ();
97 
98  private:
99 
100  bool _initialized_;
101  std::vector<entry_type> _entries_;
102 
106 
107  };
108 
109 } // end of namespace genvtx
110 
111 /***************
112  * OCD support *
113  ***************/
114 #include <datatools/ocd_macros.h>
116 
117 #endif // GENVTX_COMBINED_VG_H
118 
119 /*
120 ** Local Variables: --
121 ** mode: c++ --
122 ** c-file-style: "gnu" --
123 ** tab-width: 2 --
124 ** End: --
125 */
double cumulated_weight
Cumulated weight of the generator.
Definition: combined_vg.h:43
virtual void initialize(const ::datatools::properties &, ::datatools::service_manager &, ::genvtx::vg_dict_type &)
Initialization.
Top-level namespace of the Bayeux/genvtx module library.
Definition: box_model_vg.h:32
virtual void _shoot_vertex(::mygsl::rng &random_, ::geomtools::vector_3d &vertex_)
Randomize vertex.
entry_type()
Default constructor.
combined_vg()
Constructor.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
virtual bool is_initialized() const
Check initialization status.
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
genvtx::vg_handle_type vg_handle
Definition: combined_vg.h:44
virtual ~combined_vg()
Destructor.
virtual void reset()
Reset.
double weight
Weight of the generator (branching ratio)
Definition: combined_vg.h:42
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
Utilities for logging information.
The base interface class for all vertex generator classes.
Definition: i_vertex_generator.h:59
#define GENVTX_VG_REGISTRATION_INTERFACE(GENVTX_CLASS_NAME)
Definition: vg_macros.h:46
Macros to automatically register vertex generator class.
Entry for a vertex generator to be combined.
Definition: combined_vg.h:39
void _shoot_vertex_combined(mygsl::rng &random_, geomtools::vector_3d &vertex_)
Main algorithm.
std::map< std::string, vg_entry_type > vg_dict_type
Definition: vg_tools.h:125
A vertex generator that combined several vertex generators wuth specific weighting rules.
Definition: combined_vg.h:33
Service management class.
Definition: service_manager.h:57
void add_generator(genvtx::vg_handle_type &a_vg, const std::string &a_name, double a_weight=1.0)
Add a generator to be combined.
Pseudo random number generator.
Definition: rng.h:53
std::string name
Name of the generator.
Definition: combined_vg.h:41