Bayeux  3.4.1
Core Foundation library for SuperNEMO
base_step_hit_processor.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2010-05-26
4  * Last modified: 2013-03-08
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Abstract MC base step hit processor.
11  *
12  */
13 
14 #ifndef MCTOOLS_BASE_STEP_HIT_PROCESSOR_H
15 #define MCTOOLS_BASE_STEP_HIT_PROCESSOR_H 1
16 
17 // Standard library:
18 #include <sstream>
19 #include <string>
20 #include <map>
21 #include <stdexcept>
22 #include <vector>
23 
24 // Third party:
25 // - Bayeux/datatools:
26 #include <datatools/handle_pool.h>
28 #include <datatools/i_tree_dump.h>
29 #include <datatools/logger.h>
31 
32 // - Bayeux/mygsl:
33 #include <mygsl/rng.h>
34 // - Bayeux/geomtools:
35 #include <geomtools/manager.h>
36 
37 // This project:
38 #include <mctools/base_step_hit.h>
39 #include <mctools/simulated_data.h>
40 
41 namespace datatools {
42  class service_manager;
43 }
44 
45 namespace mctools {
46 
52  {
53  public:
54 
55  typedef std::vector<base_step_hit *> step_hit_ptr_collection_type;
57 
58  static const size_t DEFAULT_POOL_CAPACITY = 100;
59 
61  bool is_debug() const;
62 
64  void set_debug(bool);
65 
67  void set_pool(pool_type &);
68 
70  bool has_pool() const;
71 
73  pool_type & get_pool() const;
74 
75  bool using_private_pool() const;
76 
77  void setup_private_pool(size_t capacity_ = DEFAULT_POOL_CAPACITY);
78 
80 
81  const std::string & get_name() const;
82 
83  void set_name(const std::string &);
84 
87 
89  virtual ~base_step_hit_processor();
90 
91  const std::string & get_hit_category() const;
92 
93  void set_hit_category(const std::string & hc_);
94 
95  const std::string & get_sensitive_category() const;
96 
97  void set_sensitive_category(const std::string & sc_);
98 
99  bool has_geom_manager() const;
100 
101  void set_geom_manager(const geomtools::manager & gmgr_);
102 
103  const geomtools::manager & get_geom_manager() const;
104 
105  const datatools::properties & get_auxiliaries() const;
106 
108 
109  virtual bool accept_external_rng() const;
110 
111  virtual void set_external_rng(mygsl::rng & rng_);
112 
114  void initialize(const datatools::properties & config_);
115 
117  virtual void initialize(const datatools::properties & config_,
118  datatools::service_manager & service_mgr_);
119 
126  void process(const step_hit_ptr_collection_type & base_step_hits_,
127  simulated_data & sim_data_);
128 
134  virtual void process(const step_hit_ptr_collection_type & base_step_hits_,
136 
137  virtual void process(const step_hit_ptr_collection_type & base_step_hit_s,
139 
141  virtual void tree_dump(std::ostream & out_ = std::clog,
142  const std::string & title_ = "",
143  const std::string & indent_ = "",
144  bool inherit_ = false) const;
145 
148 
151 
154 
155  protected:
156 
157  void _initialize(const datatools::properties & config_,
158  datatools::service_manager & service_mgr_);
159 
160  /*
162  virtual void _process(const i_step_hit_processor::step_hit_ptr_collection_type & the_base_step_hits,
163  simulated_data::hit_handle_collection_type * the_gg_hits,
164  simulated_data::hit_collection_type * the_plain_gg_hits);
165  */
166 
167  protected:
168 
170  std::string _name;
171  std::string _hit_category;
175  std::string _sensitive_category;
180  const geomtools::manager * _geom_manager = nullptr;
182  pool_type * _private_pool = nullptr;
183  bool _pool_owner;
184  pool_type * _pool = nullptr;
185 
186  // Factory stuff :
188 
189  };
190 
191 } // end of namespace mctools
192 
193 
195 
196 namespace mctools {
197 
202  : public base_step_hit_processor
203  {
204  public:
205 
208 
211 
213  virtual void initialize(const ::datatools::properties & config_,
214  ::datatools::service_manager & service_mgr_);
215 
217  virtual void process(const ::mctools::base_step_hit_processor::step_hit_ptr_collection_type & base_step_hits_,
219 
221  virtual void process(const ::mctools::base_step_hit_processor::step_hit_ptr_collection_type & base_step_hits_,
223 
224  void set_visu_highlighted_hits(bool);
225 
226  bool are_visu_highlighted_hits() const;
227 
228  bool is_record_mc_step_hit_processor() const;
229 
231 
232  private:
233 
234  bool _visu_highlighted_hits_;
237  bool _record_mc_step_hit_processor_;
239  // Registration macro :
241 
242  };
243 
244 
249  : public base_step_hit_processor
250  {
251  public:
252 
255 
258 
260  virtual void initialize(const ::datatools::properties & config_,
261  ::datatools::service_manager & service_mgr_);
262 
264  virtual void process(const ::mctools::base_step_hit_processor::step_hit_ptr_collection_type & base_step_hits_,
266 
268  virtual void process(const ::mctools::base_step_hit_processor::step_hit_ptr_collection_type & base_step_hits_,
270 
271  // Registration macro :
273 
274  };
275 
276 } // end of namespace mctools
277 
278 #include <datatools/ocd_macros.h>
281 
282 #endif // MCTOOLS_BASE_STEP_HIT_PROCESSOR_H
283 
284 // Local Variables: --
285 // mode: c++ --
286 // c-file-style: "gnu" --
287 // tab-width: 2 --
288 // End: --
Definition: base_step_hit_processor.h:201
const geomtools::manager & get_geom_manager() const
virtual ~base_step_hit_processor()
Destructor.
bool has_pool() const
Check for a pool of hits.
void set_name(const std::string &)
virtual void initialize(const ::datatools::properties &config_, ::datatools::service_manager &service_mgr_)
Main setup routine.
datatools::properties & grab_auxiliaries()
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
virtual void process(const ::mctools::base_step_hit_processor::step_hit_ptr_collection_type &base_step_hits_, ::mctools::simulated_data::hit_handle_collection_type &handle_hits_)
Main processing routine :
Definition: base_step_hit.h:32
pool_type * _private_pool
A private embedded pool of hits.
Definition: base_step_hit_processor.h:182
virtual void initialize(const ::datatools::properties &config_, ::datatools::service_manager &service_mgr_)
Main setup routine.
const geomtools::manager * _geom_manager
The geometry manager.
Definition: base_step_hit_processor.h:180
static void init_ocd(datatools::object_configuration_description &)
OCD support.
The container of collections of MC hits.
Definition: simulated_data.h:43
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
void set_sensitive_category(const std::string &sc_)
std::string _name
Name of the step hit processor.
Definition: base_step_hit_processor.h:170
pool_type * _pool
Reference to an external pool of hits.
Definition: base_step_hit_processor.h:184
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
base_step_hit_processor()
Default constructor.
void setup_private_pool(size_t capacity_=DEFAULT_POOL_CAPACITY)
bool is_debug() const
Check the debug flag.
virtual void process(const ::mctools::base_step_hit_processor::step_hit_ptr_collection_type &base_step_hits_, ::mctools::simulated_data::hit_handle_collection_type &handle_hits_)
Main processing routine :
std::vector< base_step_hit * > step_hit_ptr_collection_type
Definition: base_step_hit_processor.h:55
void set_pool(pool_type &)
Set the pool of hits.
virtual bool accept_external_rng() const
std::vector< base_step_hit > hit_collection_type
Alias for the collection of MC base step hits.
Definition: simulated_data.h:72
const datatools::properties & get_auxiliaries() const
Definition: base_step_hit_processor.h:50
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
static const size_t DEFAULT_POOL_CAPACITY
Definition: base_step_hit_processor.h:58
virtual void set_external_rng(mygsl::rng &rng_)
std::vector< hit_handle_type > hit_handle_collection_type
Alias for the collection of MC base step hit handles.
Definition: simulated_data.h:69
void set_geom_manager(const geomtools::manager &gmgr_)
void initialize(const datatools::properties &config_)
Initialization from a set of configuration properties.
const std::string & get_name() const
void process(const step_hit_ptr_collection_type &base_step_hits_, simulated_data &sim_data_)
const std::string & get_hit_category() const
void set_hit_category(const std::string &hc_)
bool _pool_owner
Pool of hits ownership flag.
Definition: base_step_hit_processor.h:183
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
std::string _sensitive_category
Definition: base_step_hit_processor.h:175
virtual ~push_all_step_hit_processor()
Destructor.
datatools::handle_pool< base_step_hit > pool_type
Definition: base_step_hit_processor.h:56
datatools::properties _auxiliaries
Some auxiliary properties.
Definition: base_step_hit_processor.h:181
#define MCTOOLS_STEP_HIT_PROCESSOR_REGISTRATION_INTERFACE(SHP_CLASS_NAME)
Definition: step_hit_processor_macros.h:35
void add_new_hit(simulated_data::hit_handle_collection_type &hits_)
std::string _hit_category
Definition: base_step_hit_processor.h:171
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
void _initialize(const datatools::properties &config_, datatools::service_manager &service_mgr_)
A pool of handles on a given class.
Definition: handle_pool.h:45
void set_debug(bool)
Set the debug flag.
Definition: base_step_hit_processor.h:248
datatools::logger::priority get_logging_priority() const
Return the logging priority threshold.
virtual ~kill_all_step_hit_processor()
Destructor.
#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
const std::string & get_sensitive_category() const
datatools::logger::priority _logging_priority
Logging priority threshold.
Definition: base_step_hit_processor.h:169
Service management class.
Definition: service_manager.h:57
Pseudo random number generator.
Definition: rng.h:53
pool_type & get_pool() const
Return a reference to a mutable pool of hits.
A dictionary of arbitrary properties.
Definition: properties.h:125