Bayeux  3.4.1
Core Foundation library for SuperNEMO
lorentz_boost_wrapper.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2014-12-22
4  * Last modified: 2014-12-22
5  *
6  * License:
7  * Copyright 2014 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 wrapper that use another generator to
27  * shoot primary events but apply a Lorentz boost to
28  * them.
29  *
30  * History:
31  *
32  */
33 
34 #ifndef GENBB_HELP_LORENTZ_BOOST_WRAPPER_H
35 #define GENBB_HELP_LORENTZ_BOOST_WRAPPER_H 1
36 
37 // Third party:
38 // - Bayeux/datatools:
40 // - Bayeux/geomtools:
41 #include <geomtools/utils.h>
42 
43 // This project:
44 #include <genbb_help/i_genbb.h>
45 
46 namespace datatools {
47  // Forward declarations:
48  class properties;
49  class service_manager;
50 }
51 
52 namespace genbb {
53 
54  // Forward declaration:
55  class primary_event;
56 
59  {
60  public:
63 
66 
68  virtual bool has_next() = 0;
69 
71  virtual void add_metadata(primary_event & pe_);
72 
74  virtual bool is_initialized() const = 0;
75 
77  virtual void initialize(const datatools::properties &) = 0;
78 
80  virtual void reset() = 0;
81 
83  void initialize_simple();
84 
86  void generate(geomtools::vector_3d & speed_, geomtools::vector_3d & vtx_);
87 
89  void generate(geomtools::vector_3d & speed_, geomtools::vector_3d & vtx_, double & time_);
90 
92  static i_lorentz_boost_generator * create(const std::string & class_id_,
93  const datatools::properties & config_);
94 
95  protected:
96 
98  virtual void _generate(geomtools::vector_3d & speed_, geomtools::vector_3d & vtx_, double & time_) = 0;
99 
100  // Factory stuff :
102 
103  };
104 
105 
108  {
109  public:
110 
112  void set_generator(i_genbb &);
113 
116 
119 
122 
124  virtual ~lorentz_boost_wrapper();
125 
127  virtual void initialize(const datatools::properties & setup_,
128  datatools::service_manager & service_manager_,
129  detail::pg_dict_type & dictionary_);
130 
132  virtual void reset();
133 
135  virtual bool has_next();
136 
138  virtual bool is_initialized() const;
139 
140  protected:
141 
143  virtual void _load_next(primary_event & event_,
144  bool compute_classification_ = true);
145 
146  private:
147 
148  bool _initialized_;
149  i_genbb * _pg_;
150  i_lorentz_boost_generator * _lbg_;
151  bool _lbg_owned_;
153 
154  };
155 
156 } // end of namespace genbb
157 
158 /***************
159  * OCD support *
160  ***************/
161 #include <datatools/ocd_macros.h>
163 
164 #endif // GENBB_HELP_LORENTZ_BOOST_WRAPPER_H
165 
166 // Local Variables: --
167 // mode: c++ --
168 // End: --
i_lorentz_boost_generator()
Default constructor.
virtual void _generate(geomtools::vector_3d &speed_, geomtools::vector_3d &vtx_, double &time_)=0
Generate Lorentz Boost information.
Wrapper for another generator.
Definition: lorentz_boost_wrapper.h:107
virtual void initialize(const datatools::properties &setup_, datatools::service_manager &service_manager_, detail::pg_dict_type &dictionary_)
Main initialization interface method.
GENBB particle generator abstract base class.
Definition: i_genbb.h:59
void generate(geomtools::vector_3d &speed_, geomtools::vector_3d &vtx_)
Generate Lorentz Boost information.
Abstract mother class to fetch Lorentz Boost data.
Definition: lorentz_boost_wrapper.h:58
static i_lorentz_boost_generator * create(const std::string &class_id_, const datatools::properties &config_)
Factory method.
void set_generator(i_genbb &)
Set the particle generator.
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
virtual bool has_next()=0
Check if the generator can provide more Lorentz Boost information.
void initialize_simple()
Simple initialization.
virtual void reset()=0
Reset.
#define GENBB_PG_REGISTRATION_INTERFACE(GENBB_CLASS_NAME)
Definition: genbb_macros.h:22
virtual bool is_initialized() const =0
Check initialization status.
virtual ~i_lorentz_boost_generator()
Destructor.
virtual ~lorentz_boost_wrapper()
Destructor.
virtual void reset()
Reset.
Top-level namespace of the Bayeux/genbb_help module library.
Definition: alpha_decay.h:51
virtual bool has_next()
Check if the generator has a next event.
CLHEP::Hep3Vector vector_3d
Alias for the CLHEP 3D-vector class.
Definition: clhep.h:63
void set_lorentz_boost_generator(i_lorentz_boost_generator &lbg_)
Set the Lorentz boost generator.
A primary event from a Monte-Carlo generator.
Definition: primary_event.h:60
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
virtual void add_metadata(primary_event &pe_)
Add metadata.
virtual bool is_initialized() const
Check initialization status.
virtual void initialize(const datatools::properties &)=0
Main initialization.
#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
std::map< std::string, pg_entry_type > pg_dict_type
Definition: pg_tools.h:134
Service management class.
Definition: service_manager.h:57
virtual void _load_next(primary_event &event_, bool compute_classification_=true)
Load next primary event from the generator algorithm.
lorentz_boost_wrapper()
Default constructor.
A dictionary of arbitrary properties.
Definition: properties.h:125