Bayeux  3.4.1
Core Foundation library for SuperNEMO
base_step_hit.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: 2018-08-04
5  *
6  * License: GPL3
7  *
8  * Description:
9  *
10  * Generic base step hit data model built from a Geant4 a sensitive detector
11  *
12  */
13 
14 #ifndef MCTOOLS_BASE_STEP_HIT_H
15 #define MCTOOLS_BASE_STEP_HIT_H
16 
17 // Standard library:
18 #include <iostream>
19 #include <string>
20 
21 // Third party:
22 // - Bayeux/datatools :
23 #include <datatools/bit_mask.h>
24 // - Bayeux/geomtools :
26 #include <geomtools/utils.h>
27 #include <geomtools/base_hit.h>
28 
29 // This project:
30 #include <mctools/utils.h>
31 
32 namespace mctools {
33 
35 
48  : public geomtools::base_hit
49  {
50 
51  public:
52 
55  // Version 0:
64 
65  // Added in version 1:
67 
68  // Added in version 2:
87  };
88 
89  // Extract specific properties from the 'auxiliaries' container:
90 
91  /* Track ID */
92 
94  bool has_track_id() const;
95 
97  int get_track_id() const;
98 
100  void set_track_id(const int id_);
101 
103  void invalidate_track_id();
104 
105  /* Parent track ID */
106 
108  bool has_parent_track_id() const;
109 
111  int get_parent_track_id() const;
112 
114  void set_parent_track_id(const int id_);
115 
118 
119  /* Position start */
120 
121  bool has_position_start() const;
122 
125 
128 
131 
132  /* Position stop */
133 
134  bool has_position_stop() const;
135 
137  const geomtools::vector_3d & get_position_stop() const;
138 
141 
144 
145  /* Momentum stop */
146 
147  bool has_momentum_stop() const;
148 
150  const geomtools::vector_3d & get_momentum_stop() const;
151 
154 
157 
158  /* Momentum start */
159 
160  bool has_momentum_start() const;
161 
164 
167 
170 
171  /* Time start */
172 
173  bool has_time_start() const;
174 
176  double get_time_start() const;
177 
179  void set_time_start(const double);
180 
182  void invalidate_time_start();
183 
184  /* Time stop */
185 
186  bool has_time_stop() const;
187 
189  double get_time_stop() const;
190 
192  void set_time_stop(const double);
193 
195  void invalidate_time_stop();
196 
197  /* Energy deposit */
198 
199  bool has_energy_deposit() const;
200 
202  double get_energy_deposit() const;
203 
205  void set_energy_deposit(const double);
206 
209 
210  /* Particle name */
211  bool has_particle_name() const;
212 
214  const std::string & get_particle_name() const;
215 
217  void set_particle_name(const std::string &);
218 
221 
222  /* Biasing weight */
223 
225  bool has_biasing_weight() const;
226 
228  void set_biasing_weight(double);
229 
231  double get_biasing_weight() const;
232 
235 
236  /* kinetic energy start */
237 
238  bool has_kinetic_energy_start() const;
239  double get_kinetic_energy_start() const;
240  void set_kinetic_energy_start(const double ke_);
242 
243  /* kinetic energy stop */
244 
245  bool has_kinetic_energy_stop() const;
246  double get_kinetic_energy_stop() const;
247  void set_kinetic_energy_stop(const double ke_);
249 
250  /* Step length */
251  bool has_step_length() const;
252  double get_step_length() const;
253  void set_step_length(const double);
254  void invalidate_step_length();
255 
256  /* Entering volume */
257  bool has_entering_volume() const;
258  bool is_entering_volume() const;
259  void set_entering_volume(const bool flag_);
261 
262  /* Leaving volume */
263  bool has_leaving_volume() const;
264  bool is_leaving_volume() const;
265  void set_leaving_volume(const bool flag_);
267 
268  /* Creator process name */
269  bool has_creator_process_name() const;
270  const std::string & get_creator_process_name() const;
271  void set_creator_process_name(const std::string &);
273 
275  bool has_primary_particle() const;
276  bool is_primary_particle() const;
277  void set_primary_particle(const bool flag_);
279 
280  /* Major track */
281  bool has_major_track() const;
282  bool is_major_track() const;
283  void set_major_track(const bool flag_);
284  void invalidate_major_track();
285 
286  /* Delta-ray from alpha particle */
287  bool has_delta_ray_from_alpha() const;
288  bool is_delta_ray_from_alpha() const;
289  void set_delta_ray_from_alpha(const bool flag_);
291 
292  /* Material */
293  bool has_material_name() const;
294  const std::string & get_material_name() const;
295  void set_material_name(const std::string &);
297 
298  /* Sensitive category */
299  bool has_sensitive_category() const;
300  const std::string & get_sensitive_category() const;
301  void set_sensitive_category(const std::string &);
303 
304  /* Hit processor */
305  bool has_hit_processor() const;
306  const std::string & get_hit_processor() const;
307  void set_hit_processor(const std::string &);
309 
310  /* Geant4 volume name (debug) */
311  bool has_g4_volume_name() const;
312  const std::string & get_g4_volume_name() const;
313  void set_g4_volume_name(const std::string &);
315 
316  /* Geant4 volume copy number (debug) */
317  bool has_g4_volume_copy_number() const;
318  int get_g4_volume_copy_number() const;
319  void set_g4_volume_copy_number(const int);
321 
322  /* Visu highlight */
323  bool has_visu_highlight() const;
324  bool is_visu_highlight() const;
325  void set_visu_highlight(const bool flag_);
327 
329 
335  virtual bool is_valid() const;
336 
338  virtual void invalidate();
339 
341  base_step_hit();
342 
343  // Destructor
344  virtual ~base_step_hit();
345 
347  void reset();
348 
350  virtual void clear();
351 
353  virtual void tree_dump(std::ostream & out_ = std::clog,
354  const std::string & title_ = "",
355  const std::string & indent_ = "",
356  bool inherit_ = false) const;
357 
368  void print_tree(std::ostream & out_ = std::clog,
369  const boost::property_tree::ptree & options_ = datatools::i_tree_dumpable::empty_options()) const override;
370 
372  void dump() const;
373 
374  private:
375 
376  // Attributes :
377 
378  // Original attributes in version 0:
379  geomtools::vector_3d _position_start_;
380  geomtools::vector_3d _position_stop_;
381  double _time_start_;
382  double _time_stop_;
383  geomtools::vector_3d _momentum_start_;
384  geomtools::vector_3d _momentum_stop_;
385  double _energy_deposit_;
386  std::string _particle_name_;
387 
388  // Original attributes in version 1:
389  double _biasing_weight_;
390 
391  // Added attributes in version 2:
392  double _kinetic_energy_start_;
393  double _kinetic_energy_stop_;
394  double _step_length_;
395  bool _entering_volume_flag_ = false;
396  bool _leaving_volume_flag_ = false;
397  std::string _creator_process_name_;
398  bool _primary_particle_flag_ = false;
399  bool _major_track_flag_ = false;
400  bool _delta_ray_from_alpha_flag_ = false;
401  int _track_id_ = -1;
402  int _parent_track_id_ = -1;
403  std::string _material_name_;
404  std::string _sensitive_category_;
405  std::string _g4_volume_name_;
406  int _g4_volume_copy_number_ = -1;
407  std::string _hit_processor_;
408  bool _visu_highlight_ = false;
409 
411 
413 
414 #if MCTOOLS_WITH_REFLECTION == 1
415  DR_CLASS_RTTI()
417 #endif
418 
419  };
420 
421 } // end of namespace mctools
422 
423 // #ifdef __clang__
424 // #pragma clang diagnostic push
425 // #pragma clang diagnostic ignored "-Wunused-local-typedef"
426 // #endif
427 // #include <boost/serialization/export.hpp>
428 // #ifdef __clang__
429 // #pragma clang diagnostic pop
430 // #endif
431 #include <boost/serialization/export.hpp>
432 BOOST_CLASS_EXPORT_KEY2(mctools::base_step_hit, "mctools::base_step_hit")
433 
434 #if MCTOOLS_WITH_REFLECTION == 1
435 // Activate reflection layer for the mctools::base_step_hit class :
437 #endif // MCTOOLS_WITH_REFLECTION
438 
439 // Class version:
440 #include <boost/serialization/version.hpp>
441 BOOST_CLASS_VERSION(mctools::base_step_hit, 2)
442 
443 #endif // MCTOOLS_BASE_STEP_HIT_H
444 
445 // Local Variables: --
446 // mode: c++ --
447 // c-file-style: "gnu" --
448 // tab-width: 2 --
449 // End: --
static const boost::property_tree::ptree & empty_options()
base_step_hit()
Default constructor.
#define DR_CLASS_INIT(Introspectable)
Inform Camp that class Introspectable exists and trigger the automatic registration of dedicated refl...
Definition: reflection_interface.h:149
The base class for all Monte-Carlo (MC) hit objects.
Definition: base_step_hit.h:47
static const uint32_t bit18
Definition: bit_mask.h:45
void invalidate_energy_deposit()
Reset/invalidate the energy deposit along the hit.
bool has_particle_name() const
void set_creator_process_name(const std::string &)
void set_sensitive_category(const std::string &)
int get_g4_volume_copy_number() const
void set_kinetic_energy_stop(const double ke_)
void invalidate_momentum_stop()
Reset/invalidate the stop momentum of the hit.
void reset()
Reset/invalidate the internal structure of the hit.
bool has_material_name() const
static const uint32_t bit08
Definition: bit_mask.h:35
void set_track_id(const int id_)
Set the track ID.
Serialization mask for the leaving volume flag.
Definition: base_step_hit.h:73
Serialization mask for the time start attribute.
Definition: base_step_hit.h:58
void invalidate_track_id()
Invalidate the track ID.
Serialization mask for the delta-ray from alpha flag.
Definition: base_step_hit.h:77
const std::string & get_sensitive_category() const
Definition: base_step_hit.h:32
virtual void clear()
Reset/invalidate the internal structure of the hit.
static const uint32_t bit07
Definition: bit_mask.h:34
bool is_primary_particle() const
Definition: base_step_hit.h:86
const geomtools::vector_3d & get_momentum_stop() const
Get the stop momentum of the hit (units are arbitrary)
double get_kinetic_energy_stop() const
void invalidate_creator_process_name()
static const uint32_t bit22
Definition: bit_mask.h:49
const std::string & get_creator_process_name() const
bool has_hit_processor() const
void invalidate_sensitive_category()
static const uint32_t bit09
Definition: bit_mask.h:36
static const uint32_t bit03
Definition: bit_mask.h:30
void invalidate_kinetic_energy_start()
void set_visu_highlight(const bool flag_)
void invalidate_delta_ray_from_alpha()
const geomtools::vector_3d & get_position_start() const
Get the start position of the hit (the coordinate system and units are arbitrary)
static const uint32_t bit20
Definition: bit_mask.h:47
bool has_position_stop() const
static const uint32_t bit17
Definition: bit_mask.h:44
bool has_position_start() const
Serialization mask for the momentum stop attribute.
Definition: base_step_hit.h:61
bool has_time_stop() const
bool is_delta_ray_from_alpha() const
static const uint32_t bit04
Definition: bit_mask.h:31
Serialization mask for the biasing weight attribute (BUG 2015-02-26: was datatools::bit_mask::bit20)
Definition: base_step_hit.h:66
void set_position_stop(const geomtools::vector_3d &)
Set the stop position of the hit (the coordinate system and units are arbitrary)
static const uint32_t bit06
Definition: bit_mask.h:33
double get_kinetic_energy_start() const
bool has_entering_volume() const
static const uint32_t bit23
Definition: bit_mask.h:50
void invalidate_position_stop()
Reset/invalidate the stop position of the hit.
static const uint32_t bit27
Definition: bit_mask.h:54
#define DATATOOLS_SERIALIZATION_DECLARATION()
Definition: i_serializable.h:266
void set_time_stop(const double)
Set the stop time of the hit (units are arbitrary)
bool is_leaving_volume() const
static const uint32_t bit14
Definition: bit_mask.h:41
void set_material_name(const std::string &)
Serialization mask for the entering volume flag.
Definition: base_step_hit.h:72
bool is_entering_volume() const
double get_time_stop() const
Get the stop time of the hit (units are arbitrary)
Serialization mask for the energy deposit attribute.
Definition: base_step_hit.h:62
const std::string & get_g4_volume_name() const
void set_position_start(const geomtools::vector_3d &)
Set the start position of the hit (the coordinate system and units are arbitrary)
static const uint32_t bit24
Definition: bit_mask.h:51
int get_parent_track_id() const
Get the parent track ID.
static const uint32_t bit11
Definition: bit_mask.h:38
Serialization mask for the major track flag.
Definition: base_step_hit.h:76
bool has_time_start() const
The base class for hit objects that locate events in a geometry model.
Definition: base_hit.h:38
Serialization mask for the Geant4 volume copy number.
Definition: base_step_hit.h:83
Serialization mask for the Geant4 volume name.
Definition: base_step_hit.h:82
const geomtools::vector_3d & get_momentum_start() const
Get the start momentum of the hit (units are arbitrary)
const std::string & get_material_name() const
Serialization mask for the position stop attribute.
Definition: base_step_hit.h:57
void set_momentum_start(const geomtools::vector_3d &)
Set the start momentum of the hit (units are arbitrary)
bool has_momentum_start() const
void set_g4_volume_name(const std::string &)
void invalidate_kinetic_energy_stop()
Serialization mask for the sensitive category.
Definition: base_step_hit.h:81
void set_parent_track_id(const int id_)
Set the parent track ID.
bool has_step_length() const
bool has_delta_ray_from_alpha() const
bool has_kinetic_energy_start() const
static const uint32_t bit10
Definition: bit_mask.h:37
bool is_major_track() const
void invalidate_position_start()
Reset/invalidate the start position of the hit.
bool has_leaving_volume() const
static const uint32_t bit05
Definition: bit_mask.h:32
bool has_track_id() const
Check if the hit records the track ID.
void dump() const
Smart print (default behaviour/shortcut)
void invalidate_time_stop()
Reset/invalidate the stop time of the hit.
bool has_energy_deposit() const
const geomtools::vector_3d & get_position_stop() const
Get the stop position of the hit (the coordinate system and units are arbitrary)
void invalidate_parent_track_id()
Invalidate the parent track ID.
void set_primary_particle(const bool flag_)
double get_biasing_weight() const
Return the current biasing weight of the particle track.
int get_track_id() const
Get the track ID.
static const uint32_t bit25
Definition: bit_mask.h:52
Serialization mask for the visu highlight flag.
Definition: base_step_hit.h:85
virtual void invalidate()
Reset/invalidate the internal structure of the hit.
bool has_visu_highlight() const
Serialization mask for the time stop attribute.
Definition: base_step_hit.h:59
bool has_creator_process_name() const
void set_entering_volume(const bool flag_)
void set_delta_ray_from_alpha(const bool flag_)
Serialization mask for the primary particle flag.
Definition: base_step_hit.h:75
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
static const uint32_t bit16
Definition: bit_mask.h:43
const std::string & get_hit_processor() const
void print_tree(std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=datatools::i_tree_dumpable::empty_options()) const override
double get_time_start() const
Get the start time of the hit (units are arbitrary)
void set_kinetic_energy_start(const double ke_)
bool has_g4_volume_name() const
Serialization mask for the track ID.
Definition: base_step_hit.h:78
Serialization mask for the step length.
Definition: base_step_hit.h:71
bool has_parent_track_id() const
Check if the hit records the parent track ID.
bool has_sensitive_category() const
bool has_primary_particle() const
Primary particle flag : check if the MC hit has been generated by a primary particle.
static const uint32_t bit13
Definition: bit_mask.h:40
static const uint32_t bit21
Definition: bit_mask.h:48
static const uint32_t bit19
Definition: bit_mask.h:46
Serialization mask for the step hit processor.
Definition: base_step_hit.h:84
void set_hit_processor(const std::string &)
void set_step_length(const double)
bool has_momentum_stop() const
static const uint32_t bit28
Definition: bit_mask.h:55
bool has_major_track() const
Serialization mask for the momentum start attribute.
Definition: base_step_hit.h:60
void set_particle_name(const std::string &)
Set the particle name associated to the hit.
Serialization mask for the parent track ID.
Definition: base_step_hit.h:79
void set_time_start(const double)
Set the start time of the hit (units are arbitrary)
void set_g4_volume_copy_number(const int)
static const uint32_t bit12
Definition: bit_mask.h:39
bool has_g4_volume_copy_number() const
Serialization mask for the position start attribute.
Definition: base_step_hit.h:56
Serialization mask for the particle name attribute.
Definition: base_step_hit.h:63
double get_step_length() const
void set_major_track(const bool flag_)
virtual bool is_valid() const
Check if the hit has a valid internal structure.
bool has_kinetic_energy_stop() const
void invalidate_particle_name()
Reset/invalidate the particle name associated to the hit.
const std::string & get_particle_name() const
Get the particle name associated to the hit.
#define DR_CLASS_RTTI()
Declare Camp RTTI within class declaration.
Definition: reflection_interface.h:46
void set_momentum_stop(const geomtools::vector_3d &)
Set the stop momentum of the hit (units are arbitrary)
bool is_visu_highlight() const
void invalidate_momentum_start()
Reset/invalidate the start momentum of the hit.
static const uint32_t bit15
Definition: bit_mask.h:42
double get_energy_deposit() const
Get the energy deposit along the hit (units are arbitrary)
Serialization mask for the material name.
Definition: base_step_hit.h:80
Serialization mask for the creator process name.
Definition: base_step_hit.h:74
void invalidate_primary_particle()
store_mask_type
Masks to automatically tag the attributes to be stored.
Definition: base_hit.h:46
Serialization mask for the start kinetic energy attribute.
Definition: base_step_hit.h:69
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
#define GEOMTOOLS_HIT_REGISTRATION_INTERFACE(HitClassName)
Definition: base_hit.h:393
void set_energy_deposit(const double)
Set the energy deposit along the hit (units are arbitrary)
void set_biasing_weight(double)
Set the current biasing weight of the particle track.
Serialization mask for the stop kinetic energy attribute.
Definition: base_step_hit.h:70
void invalidate_time_start()
Reset/invalidate the start time of the hit.
static const uint32_t bit26
Definition: bit_mask.h:53
bool has_biasing_weight() const
Check if a biasing weight is associated to the hit.
void invalidate_biasing_weight()
Reset/invalidate the current biasing weight.
void invalidate_g4_volume_copy_number()
void set_leaving_volume(const bool flag_)