Bayeux  3.4.1
Core Foundation library for SuperNEMO
primary_event.h
Go to the documentation of this file.
1 /* Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2010-04-11
4  * Last modified: 2015-12-04
5  *
6  * License:
7  * Copyright 2007-2015 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  * Primary event from the GENBB generator.
27  *
28  *
29  * History:
30  *
31  * 2012-06-21 FM :
32  * - support 'weighted' MC event in case
33  * of user energy range for DBD events
34  * - serialization version 2 supports new 'weight' attributes
35  *
36  */
37 
38 #ifndef GENBB_HELP_PRIMARY_EVENT_H
39 #define GENBB_HELP_PRIMARY_EVENT_H 1
40 
41 // Standard library:
42 #include <string>
43 #include <list>
44 
45 // Third party:
46 // - Bayeux/datatools:
48 #include <datatools/units.h>
49 #include <datatools/properties.h>
50 #include <datatools/i_tree_dump.h>
51 // - Bayeux/geomtools:
52 #include <geomtools/utils.h>
53 
54 // This project:
56 
57 namespace genbb {
58 
63  {
64 
65  public:
66 
68  typedef std::list<primary_particle> particles_col_type;
69 
70  public:
71 
73  bool is_valid() const;
74 
76  void reset();
77 
79  bool has_time() const;
80 
82  void set_time(double);
83 
85  double get_time() const;
86 
88  bool has_vertex() const;
89 
91  void set_vertex(const geomtools::vector_3d &);
92 
94  const geomtools::vector_3d & get_vertex() const;
95 
97  void set_genbb_weight(double genbb_weight_);
98 
100  double get_genbb_weight() const;
101 
103  bool is_genbb_weighted() const;
104 
106  const particles_col_type & get_particles() const;
107 
110 
112  void add_particle(const primary_particle &);
113 
116 
118  unsigned int get_number_of_particles() const;
119 
121  const primary_particle & get_particle(int) const;
122 
125 
127  const primary_particle * get_particle_of_type(int type_, int occurence_ = 0) const;
128 
130  void remove_particle(int type_, int occurence_ = 0);
131 
133  bool has_label() const;
134 
136  const std::string & get_label() const;
137 
139  void set_label(const std::string & l_);
140 
142  void reset_label();
143 
145  bool has_classification() const;
146 
148  const std::string & get_classification() const;
149 
151  void set_classification(const std::string & c_);
152 
154  void reset_classification();
155 
157  void compute_classification();
158 
160  void rotate(double a_phi, double a_theta, double a_delta);
161 
163  double get_total_kinetic_energy() const;
164 
166  const datatools::properties & get_auxiliaries() const;
167 
170 
173 
175  void shift_particles_time(double delta_time_, int from_ = 0);
176 
178  primary_event();
179 
181  virtual ~primary_event();
182 
184  virtual void
185  tree_dump(std::ostream & out_ = std::clog,
186  const std::string & title_ = "",
187  const std::string & indent_ = "",
188  bool inherit_ = false) const;
189 
191  void dump(std::ostream & a_out = std::clog,
192  const std::string & a_indent = "") const;
193 
195  void dump(std::ostream & a_out,
196  const std::string & a_title,
197  const std::string & a_indent) const;
198 
200  void assign_generation_ids();
201 
203  void remove_generation_ids();
204 
205  protected:
206 
208  void _set_defaults();
209 
210  private:
211 
212  double _time_;
213  geomtools::vector_3d _vertex_;
214  particles_col_type _particles_;
215  std::string _label_;
216  std::string _classification_;
217  double _genbb_weight_;
218  datatools::properties _auxiliaries_;
219 
222 
223 
225 
226 
227  DR_CLASS_RTTI()
228 
229  };
230 
231 } // end of namespace genbb
232 
233 #include <boost/serialization/export.hpp>
234 BOOST_CLASS_EXPORT_KEY2(genbb::primary_event, "genbb::primary_event")
235 
237 
238 // Activate reflection layer for the genbb::primary_event class :
240 
241 // Explicit class version:
242 #include <boost/serialization/version.hpp>
243 BOOST_CLASS_VERSION(genbb::primary_event, 5)
244 
245 #endif // GENBB_HELP_PRIMARY_EVENT_H
246 
247 // Local Variables: --
248 // mode: c++ --
249 // End: --
#define DR_CLASS_INIT(Introspectable)
Inform Camp that class Introspectable exists and trigger the automatic registration of dedicated refl...
Definition: reflection_interface.h:149
void rotate(double a_phi, double a_theta, double a_delta)
Rotate the event.
void set_genbb_weight(double genbb_weight_)
Set the weight.
std::list< primary_particle > particles_col_type
Collection of primary particles.
Definition: primary_event.h:68
Base abstract class of all serializable (and possibly introspectable) classes.
Definition: i_serializable.h:51
void set_classification(const std::string &c_)
Set the classification string.
particles_col_type & grab_particles()
Return a mutable reference to the list of primary particles.
void set_auxiliaries(const datatools::properties &)
Set auxiliary properties.
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
void shift_particles_time(double delta_time_, int from_=0)
Shift the time of the particles by a delay.
#define DATATOOLS_SERIALIZATION_DECLARATION_ADVANCED(ClassName)
Definition: i_serializable.h:371
double get_genbb_weight() const
Return the weight.
void remove_particle(int type_, int occurence_=0)
Remove particle.
bool is_valid() const
Check the validity of the primary event.
void reset()
Reset the primary event.
primary_particle & add_particle()
Add a primary particle.
unsigned int get_number_of_particles() const
Return the number of primary particles.
void _set_defaults()
Set default attibutes values.
void assign_generation_ids()
Assign generation Ids to all particle.
bool has_time() const
Check if time is defined.
bool has_classification() const
Check if classification is set.
void set_time(double)
Set the time.
const primary_particle & get_particle(int) const
Return a const reference to primary particle at given index.
const primary_particle * get_particle_of_type(int type_, int occurence_=0) const
Return a const pointer to primary particle of a certain type with given occurence.
#define DATATOOLS_SERIALIZATION_EXT_BACKWARD_SERIAL_TAG_DECLARATION(ClassName)
Definition: i_serializable.h:180
void compute_classification()
Compute the classification string.
bool has_vertex() const
Check if vertex is defined.
double get_time() const
Return the time.
const geomtools::vector_3d & get_vertex() const
Return the time.
bool has_label() const
Check if label is set.
void reset_classification()
Reset the classification string.
void remove_generation_ids()
Remove generation Ids from all particle.
void set_label(const std::string &l_)
Set the label.
primary_event()
Default constructor.
#define DATATOOLS_SERIALIZATION_BACKWARD_SERIAL_TAG_SUPPORT()
Definition: i_serializable.h:174
Top-level namespace of the Bayeux/genbb_help module library.
Definition: alpha_decay.h:51
virtual ~primary_event()
Destructor.
double get_total_kinetic_energy() const
Return the total kinetic energy of the event.
void dump(std::ostream &a_out=std::clog, const std::string &a_indent="") const
Print.
const datatools::properties & get_auxiliaries() const
Return a const reference to the auxiliary properties.
primary_particle & grab_particle(int)
Return a mutable reference to primary particle at given index.
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
const std::string & get_classification() const
Return the classification string.
A primary event from a Monte-Carlo generator.
Definition: primary_event.h:60
void set_vertex(const geomtools::vector_3d &)
Set the vertex.
bool is_genbb_weighted() const
Check if the event is weighted.
datatools::properties & grab_auxiliaries()
Return a mutable reference to the auxiliary properties.
#define DR_CLASS_RTTI()
Declare Camp RTTI within class declaration.
Definition: reflection_interface.h:46
const particles_col_type & get_particles() const
Return a const reference to the list of primary particles.
A primary particle generated by a Monte Carlo generator process.
Definition: primary_particle.h:61
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
const std::string & get_label() const
Return the label.
void reset_label()
Reset the label.
A dictionary of arbitrary properties.
Definition: properties.h:125