Bayeux  3.4.1
Core Foundation library for SuperNEMO
save_to_file_wrapper.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2014-06-05
4  * Last modified: 2014-06-05
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 save them on the fly in some
28  * files using an embedded dpp::output_module.
29  *
30  * History:
31  *
32  */
33 
34 #ifndef GENBB_HELP_SAVE_TO_FILE_WRAPPER_H
35 #define GENBB_HELP_SAVE_TO_FILE_WRAPPER_H 1
36 
37 // This project:
38 #include <genbb_help/i_genbb.h>
39 
40 namespace genbb {
41 
44  {
45  public:
46 
47  // Forward PIMPL declaration
48  struct pimpl_imp;
49 
51  static const std::string & default_pe_label();
52 
54  void set_primary_event_bank_label(const std::string &);
55 
57  void set_generator(i_genbb &);
58 
61 
63  virtual ~save_to_file_wrapper();
64 
66  virtual void initialize(const datatools::properties & setup_,
67  datatools::service_manager & service_manager_,
68  detail::pg_dict_type & dictionary_);
69 
71  virtual void reset();
72 
74  virtual bool has_next();
75 
77  virtual bool is_initialized() const;
78 
79  protected:
80 
82  virtual void _load_next(primary_event & event_,
83  bool compute_classification_ = true);
84 
85  private:
86 
87  bool _initialized_;
88  i_genbb * _pg_;
89  std::string _PE_label_;
90  boost::scoped_ptr<pimpl_imp> _pimpl_;
91 
93 
94  };
95 
96 } // end of namespace genbb
97 
98 /***************
99  * OCD support *
100  ***************/
101 #include <datatools/ocd_macros.h>
103 
104 #endif // GENBB_HELP_SAVE_TO_FILE_WRAPPER_H
105 
106 // Local Variables: --
107 // mode: c++ --
108 // End: --
virtual bool has_next()
Check if the generator has a next event.
static const std::string & default_pe_label()
Return the default label for the "primary event" bank.
GENBB particle generator abstract base class.
Definition: i_genbb.h:59
void set_generator(i_genbb &)
Set the particle generator.
virtual bool is_initialized() const
Check initialization status.
virtual void _load_next(primary_event &event_, bool compute_classification_=true)
Load next primary event from the generator algorithm.
void set_primary_event_bank_label(const std::string &)
Set the label of the primary event bank.
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
save_to_file_wrapper()
Default constructor.
#define GENBB_PG_REGISTRATION_INTERFACE(GENBB_CLASS_NAME)
Definition: genbb_macros.h:22
Top-level namespace of the Bayeux/genbb_help module library.
Definition: alpha_decay.h:51
Wrapper for another generator.
Definition: save_to_file_wrapper.h:43
virtual void initialize(const datatools::properties &setup_, datatools::service_manager &service_manager_, detail::pg_dict_type &dictionary_)
Main initialization interface method.
virtual ~save_to_file_wrapper()
Destructor.
A primary event from a Monte-Carlo generator.
Definition: primary_event.h:60
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 reset()
Reset.
A dictionary of arbitrary properties.
Definition: properties.h:125