Bayeux  3.4.1
Core Foundation library for SuperNEMO
time_slicer_generator.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2018-04-09
4  * Last modified: 2018-04-09
5  *
6  * License:
7  * Copyright 2018 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  *
26  * A generator of GENBB-like event that use another generator and
27  * clusterize primary particles in special time slices.
28  *
29  * History:
30  *
31  */
32 
33 #ifndef GENBB_HELP_TIME_SLICER_GENERATOR_H
34 #define GENBB_HELP_TIME_SLICER_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 
44 // This project:
45 #include <genbb_help/i_genbb.h>
47 
48 namespace genbb {
49 
70  : public i_genbb
71  {
72  public:
73 
76  SM_UNDEF = 0,
80  };
81 
82  bool has_mode() const;
83 
84  void set_mode(const slice_mode_type);
85 
86  slice_mode_type get_mode() const;
87 
88  bool has_generator() const;
89 
90  void set_generator(i_genbb &);
91 
93 
94  const i_genbb & get_generator() const;
95 
96  bool has_time_threshold() const;
97 
98  double get_time_threshold() const;
99 
100  void set_time_threshold(const double t_);
101 
102  bool has_time_cut() const;
103 
104  double get_time_cut() const;
105 
106  void set_time_cut(const double t_);
107 
108  void set_record_original_event_id(bool flag_);
109 
110  bool is_record_original_event_id() const;
111 
113  virtual bool can_external_random() const;
114 
117 
119  virtual ~time_slicer_generator();
120 
122  virtual bool is_initialized() const;
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 
135  protected:
136 
138  virtual void _load_next(primary_event & event_,
139  bool compute_classification_ = true);
140 
141  private:
142 
143  void _at_init_();
144 
145  void _at_reset_();
146 
147  private:
148 
149  // Management:
150  bool _initialized_ = false;
151 
152  // Configuration:
153  i_genbb * _pg_ = nullptr;
154  double _time_threshold_;
155  double _time_cut_;
156  slice_mode_type _mode_ = SM_UNDEF;
157  bool _record_original_event_id_ = true;
158 
159  // Working data:
160  primary_event _buffer_event_;
161  std::size_t _original_event_counter_ = 0;
162 
164 
165  };
166 
167 } // end of namespace genbb
168 
169 /***************
170  * OCD support *
171  ***************/
172 #include <datatools/ocd_macros.h>
174 
175 #endif // GENBB_HELP_TIME_SLICER_GENERATOR_H
176 
177 // Local Variables: --
178 // mode: c++ --
179 // End: --
virtual bool can_external_random() const
Check if the generator accepts an external PRNG.
slice_mode_type get_mode() const
void set_generator(i_genbb &)
const i_genbb & get_generator() const
Time slicer generator.
Definition: time_slicer_generator.h:69
GENBB particle generator abstract base class.
Definition: i_genbb.h:59
virtual void _load_next(primary_event &event_, bool compute_classification_=true)
Main generation function.
Undefined event time slice mode.
Definition: time_slicer_generator.h:76
time_slicer_generator()
Constructor.
Select only the prompt event (particles in the prompt time interval)
Definition: time_slicer_generator.h:77
void set_time_threshold(const double t_)
void set_time_cut(const double t_)
void set_mode(const slice_mode_type)
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
void set_record_original_event_id(bool flag_)
#define GENBB_PG_REGISTRATION_INTERFACE(GENBB_CLASS_NAME)
Definition: genbb_macros.h:22
Select both prompt and delayed events (particles in both time intervals)
Definition: time_slicer_generator.h:79
Top-level namespace of the Bayeux/genbb_help module library.
Definition: alpha_decay.h:51
virtual bool has_next()
Check if a next primary event is available.
Select only the delayed event (particles in the delayed time interval)
Definition: time_slicer_generator.h:78
A primary event from a Monte-Carlo generator.
Definition: primary_event.h:60
virtual void reset()
Reset.
slice_mode_type
Event slice mode.
Definition: time_slicer_generator.h:75
virtual bool is_initialized() const
Check initialization status.
double get_time_threshold() const
std::map< std::string, pg_entry_type > pg_dict_type
Definition: pg_tools.h:134
virtual ~time_slicer_generator()
Destructor.
virtual void initialize(const datatools::properties &setup_, datatools::service_manager &service_manager_, detail::pg_dict_type &dictionary_)
Main initialization interface method.
bool is_record_original_event_id() const
Service management class.
Definition: service_manager.h:57
A dictionary of arbitrary properties.
Definition: properties.h:125