Bayeux  3.4.1
Core Foundation library for SuperNEMO
vertex_validation.h
Go to the documentation of this file.
1 /* Author(s) : Xavier Garrido <garrido@lal.in2p3.fr>
3  * Francois Mauger <mauger@lpccaen.in2p3.fr>
4  * Creation date: 2014-07-06
5  * Last modified: 2014-07-13
6  *
7  * License: GPL 3.0
8  *
9  * Description:
10  *
11  * History:
12  *
13  */
14 
15 #ifndef GENVTX_VERTEX_VALIDATION_H
16 #define GENVTX_VERTEX_VALIDATION_H 1
17 
18 // Standard library:
19 #include <iostream>
20 #include <string>
21 
22 // Third party:
23 // - Boost:
24 #include <boost/scoped_ptr.hpp>
25 // - Bayeux/datatools:
26 #include <datatools/logger.h>
27 #include <datatools/i_tree_dump.h>
29 // - Bayeux/geomtools:
30 #include <geomtools/utils.h>
31 
32 namespace datatools {
33  // Forward declaration:
34  class properties;
35 }
36 
37 namespace cuts {
38  // Forward declaration:
39  class i_cut;
40 }
41 
42 namespace geomtools {
43  // Forward declarations:
44  class logical_volume;
45  class geom_info;
46  class geom_id;
47 }
48 
49 namespace genvtx {
50 
53  {
54  public:
55 
57 
63  public:
64 
66  bool has_ginfo() const;
67 
69  bool has_gid() const;
70 
72  bool has_logical_volume() const;
73 
75  bool has_local_candidate_vertex() const;
76 
78  bool has_global_candidate_vertex() const;
79 
81  const geomtools::geom_info & get_ginfo() const;
82 
84  const geomtools::geom_id & get_gid() const;
85 
88 
90  void set_ginfo(const geomtools::geom_info &);
91 
93  void set_gid(const geomtools::geom_id &);
94 
97 
100 
103 
106 
109 
112 
114  void reset();
115 
117  bool is_valid() const;
118 
121 
122  private:
123 
124  const geomtools::geom_info * _ginfo_;
125  const geomtools::geom_id * _gid_;
126  const geomtools::logical_volume * _log_volume_;
127  const geomtools::vector_3d * _global_candidate_vertex_;
128  geomtools::vector_3d _local_candidate_vertex_;
129  };
130 
132  static const size_t DEFAULT_MAX_NUMBER_OF_TRIES = 1000;
133 
140  };
141 
144 
146  virtual ~vertex_validation();
147 
150 
153 
155  void set_maximum_number_of_tries(const size_t tries_);
156 
158  size_t get_maximum_number_of_tries() const;
159 
161  bool is_owned_validator() const;
162 
164  void set_validator(cuts::i_cut & validator_);
165 
167  void set_validator(cuts::i_cut * validator_);
168 
170  void reset_validator();
171 
173  bool has_validator() const;
174 
176  bool is_initialized() const;
177 
179  void initialize(const datatools::properties & config_);
180 
182  void reset();
183 
185  void reset_geometry_context();
186 
188  geometry_context & grab_geometry_context();
189 
191  const geometry_context & get_geometry_context() const;
192 
194  void tree_dump(std::ostream & out = std::clog,
195  const std::string & title_ = "",
196  const std::string & indent_ = "",
197  bool inherit_ = false) const;
198 
201 
203  void reset_number_of_tries();
204 
206  size_t get_number_of_tries() const;
207 
210 
212  static void ocd_support(datatools::object_configuration_description &, const std::string & label_ = "");
213 
214  private:
215 
216  bool _initialized_; //<! Initialization flag
217  datatools::logger::priority _logging_; //<! Logging priority
218  bool _owned_validator_; //<! Flag to own the validator cut (if any)
219  cuts::i_cut * _validator_; //<! Validator cut
220  boost::scoped_ptr<geometry_context> _geo_context_; //<! Current geometry context
221  size_t _maximum_number_of_tries_; //<! Maximum number of tries before escaping
222  size_t _number_of_tries_; //<! Current number of tries
223 
224  };
225 
226 } // end of namespace genvtx
227 
228 #endif // GENVTX_VERTEX_VALIDATION_H
229 
230 /*
231 ** Local Variables: --
232 ** mode: c++ --
233 ** c-file-style: "gnu" --
234 ** tab-width: 2 --
235 ** End: --
236 */
void set_maximum_number_of_tries(const size_t tries_)
Set the maximum number of tries.
bool has_validator() const
Check if there is a vertex validator.
void set_local_candidate_vertex(const geomtools::vector_3d &)
Set the local candidate vertex.
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
size_t get_maximum_number_of_tries() const
Return the maximum number of tries.
static datatools::factory_register< cuts::i_cut > & validator_factory_system_register()
Return a handle to the validator factory register (system singleton)
Top-level namespace of the Bayeux/genvtx module library.
Definition: box_model_vg.h:32
bool is_initialized() const
Check initialization status.
Vertex validation status is not defined.
Definition: vertex_validation.h:136
static const size_t DEFAULT_MAX_NUMBER_OF_TRIES
The default maximum number of tries.
Definition: vertex_validation.h:132
void initialize(const datatools::properties &config_)
Initialize the validation system.
const geomtools::vector_3d & get_global_candidate_vertex() const
Return the non mutable referecence to the global candidate vertex.
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
The cut abstract base class (interface)
Definition: i_cut.h:62
const geomtools::vector_3d & get_local_candidate_vertex() const
Return the non mutable referecence to the local candidate vertex.
const geomtools::geom_id & get_gid() const
Check geometry Id.
Vertex is rejected.
Definition: vertex_validation.h:138
bool has_ginfo() const
Check geometry info.
A record for geometry information about a physical volume in a virtual geometry.
Definition: geom_info.h:38
A logical geometry volume (ala GDML)
Definition: logical_volume.h:40
Top-level namespace of the Bayeux/cuts module library.
Definition: accept_cut.h:21
An object that describes the way an object of a given class can be configured through properties.
Definition: object_configuration_description.h:234
void reset_number_of_tries()
Reset the current number of tries.
const geomtools::geom_info & get_ginfo() const
Check geometry info.
validate_status_type validate()
Validation.
void set_global_candidate_vertex(const geomtools::vector_3d &)
Set the global candidate vertex.
void tree_dump(std::ostream &out=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
void set_validator(cuts::i_cut &validator_)
Set the vertex validator by reference.
Template factory registration class.
Definition: factory.h:51
void reset_geometry_context()
Reset the current geometry context.
bool has_logical_volume() const
Check logical volume.
validate_status_type
Status of the validation.
Definition: vertex_validation.h:135
void set_gid(const geomtools::geom_id &)
Set the referenced geometry Id.
The vertex validation.
Definition: vertex_validation.h:52
void set_logging_priority(datatools::logger::priority)
Set logging priority.
bool is_maximum_number_of_tries_reached() const
Check if the maximum number of tries is reached.
bool has_local_candidate_vertex() const
Check local candidate vertex.
void set_logical_volume(const geomtools::logical_volume &)
Set the referenced logical volume.
size_t get_number_of_tries() const
Return the current number of tries.
Object which embeds the geometry context of a given vertex.
Definition: vertex_validation.h:62
bool is_valid() const
Check validity.
vertex_validation()
Default constructor.
const geomtools::logical_volume & get_logical_volume() const
Return a non mutable reference to the logical volume.
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
bool has_global_candidate_vertex() const
Check global candidate vertex.
void reset_validator()
Reset the vertex validator.
geometry_context & grab_geometry_context()
Return a reference to the mutable current geometry context.
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
Utilities for logging information.
datatools::logger::priority get_logging_priority() const
Returns logging priority.
bool has_gid() const
Check geometry id.
Definition: geom_id.h:41
Vertex validation reaches max number of tries.
Definition: vertex_validation.h:139
bool is_owned_validator() const
Check the vertex validator cut ownership.
virtual ~vertex_validation()
Destructor.
void set_ginfo(const geomtools::geom_info &)
Set the referenced geometry info.
void reset()
Reset the internals.
const geometry_context & get_geometry_context() const
Return a reference to the current geometry context.
Vertex is accepted.
Definition: vertex_validation.h:137
static void ocd_support(datatools::object_configuration_description &, const std::string &label_="")
OCD support.
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125