Bayeux  3.4.1
Core Foundation library for SuperNEMO
random_cut.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2013-02-18
4  * Last modified: 2013-04-22
5  *
6  * License:
7  *
8  * Description:
9  * Cut that accepts randomly
10  *
11  * History:
12  *
13  */
14 
15 #ifndef CUTS_RANDOM_CUT_H
16 #define CUTS_RANDOM_CUT_H 1
17 
18 // Third party:
19 // - Boost:
20 #include <boost/random/mersenne_twister.hpp>
21 #include <boost/random/uniform_real.hpp>
22 #include <boost/random/variate_generator.hpp>
23 
24 // This project:
25 #include <cuts/i_cut.h>
26 
27 namespace cuts {
28 
30  class random_cut : public i_cut
31  {
32 
33  public:
34  typedef boost::mt19937 base_generator_type;
35 
37  random_cut(datatools::logger::priority a_logging_priority =
39 
41  virtual ~random_cut();
42 
44  virtual void initialize(const datatools::properties &,
47 
49  virtual void reset();
50 
51  protected :
52 
54  virtual int _accept();
55 
56  private:
57 
58  int _seed_;
59  double _accept_probability_;
60  boost::scoped_ptr<base_generator_type> _bg_;
61  boost::scoped_ptr<boost::uniform_real<> > _uni_dist_;
62  boost::scoped_ptr<boost::variate_generator<base_generator_type&, boost::uniform_real<> > > _uni_;
63 
64  // Macro to automate the registration of the cut :
66 
67  };
68 
69 } // end of namespace cuts
70 
71 #endif // CUTS_RANDOM_CUT_H
72 
73 /*
74 ** Local Variables: --
75 ** mode: c++ --
76 ** c-file-style: "gnu" --
77 ** tab-width: 2 --
78 ** End: --
79 */
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
A fatal error. The application will most likely terminate. This is the highest priority.
Definition: logger.h:85
The cut abstract base class (interface)
Definition: i_cut.h:62
virtual int _accept()
Selection.
Top-level namespace of the Bayeux/cuts module library.
Definition: accept_cut.h:21
random_cut(datatools::logger::priority a_logging_priority=datatools::logger::PRIO_FATAL)
Constructor.
virtual void initialize(const datatools::properties &, datatools::service_manager &, cuts::cut_handle_dict_type &)
Initialization.
#define CUT_REGISTRATION_INTERFACE(T)
Definition: i_cut.h:411
virtual ~random_cut()
Destructor.
virtual void reset()
Reset.
std::map< std::string, cut_entry_type > cut_handle_dict_type
Alias type of a dictionary of cut entry.
Definition: cut_tools.h:175
boost::mt19937 base_generator_type
Definition: random_cut.h:34
A cut that randomly accepts.
Definition: random_cut.h:30
Service management class.
Definition: service_manager.h:57
A dictionary of arbitrary properties.
Definition: properties.h:125