Falaise  4.0.1
SuperNEMO Software Toolkit
event_header_utils_module.h
Go to the documentation of this file.
1 // -*- mode: c++ ; -*-
2 /* event_header_utils_module.h
3  * Author (s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
4  * Creation date: 2011-01-09
5  * Last modified: 2014-10-23
6  *
7  * License:
8  *
9  * Description:
10  *
11  * Basic module to add info to event header bank
12  *
13  */
14 
15 #ifndef FALAISE_SNEMO_PROCESSING_EVENT_HEADER_UTILS_MODULE_H
16 #define FALAISE_SNEMO_PROCESSING_EVENT_HEADER_UTILS_MODULE_H 1
17 
18 // Third party:
19 // - Bayeux/dpp:
20 #include <dpp/base_module.h>
21 
22 // This project:
24 
25 namespace snemo {
26 
27 namespace processing {
28 
29 /// \brief A basic module to add informations into the event header bank
31  public:
32  /// Processing mode
33  enum mode_type { MODE_INVALID = 0, MODE_ADD_HEADER = 0x1 };
34 
35  /// Constructor
37 
38  /// Destructor
40 
41  /// Initialization
42  virtual void initialize(const datatools::properties& setup_,
43  datatools::service_manager& service_manager_,
44  dpp::module_handle_dict_type& module_dict_);
45 
46  /// Reset
47  virtual void reset();
48 
49  /// Data record processing
51 
52  /// Check add header mode
53  bool is_add_header_mode() const;
54 
55  /// Increment run number by one unit
56  void ah_increment_run_number(int incr_ = 1);
57 
58  /// Increment event number by one unit
59  void ah_increment_event_number(int incr_ = 1);
60 
61  /// Check real event type
62  bool ah_is_real() const;
63 
64  /// Check simulated event type
65  bool ah_is_simulated() const;
66 
67  protected:
68  /// Set default values for attributes
69  void _set_defaults();
70 
71  /// Process for the 'add header' mode
72  void _process_add_header(datatools::things& data_record_);
73 
74  private:
75  // Configuration:
76  mode_type _mode_; //!< Processing mode
77  std::string _add_header_bank_label_; //!< Header bank label
78  bool _add_header_update_; //!< Update the bank itself
79  int _add_header_run_number_; //!< Run number of data record
80  int _add_header_event_number_; //!< Event number of data record
81  snemo::datamodel::event_header::generation_type _add_header_gentype_; //!< Event generation type
82  bool _add_header_use_genbb_weight_; //!< Store event weight
83  bool _add_header_use_genbb_label_; //!< Store event label
84  std::string _add_header_properties_path_; //!< Additional properties to be stored
85  std::string _add_header_properties_prefix_; //!< Only store properties
86  //!< starting with this prefix
87 
88  // Working:
89  // For "add header" mode:
90  int _ah_current_run_number_;
91  int _ah_current_event_number_;
92 
93  // Macro to automate the registration of the module :
95 };
96 
97 } // end of namespace processing
98 
99 } // end of namespace snemo
100 
101 /***************************
102  * OCD support : interface *
103  ***************************/
104 
105 #include <datatools/ocd_macros.h>
106 
107 // @arg snemo::processing::event_header_utils_module the name the registered class
109 
110 #endif // FALAISE_SNEMO_PROCESSING_EVENT_HEADER_UTILS_MODULE_H
111 
112 // end of event_header_utils_module.h
Definition: event_header_utils_module.h:33
void _process_add_header(datatools::things &data_record_)
Process for the 'add header' mode.
Definition: event_header_utils_module.h:33
virtual void initialize(const datatools::properties &setup_, datatools::service_manager &service_manager_, dpp::module_handle_dict_type &module_dict_)
Initialization.
bool ah_is_simulated() const
Check simulated event type.
bool ah_is_real() const
Check real event type.
DOCD_CLASS_DECLARATION(my::algo)
std::map< std::string, module_entry_type > module_handle_dict_type
bool is_add_header_mode() const
Check add header mode.
Definition: calo_tapered_scin_box_model.h:54
mode_type
Processing mode.
Definition: event_header_utils_module.h:33
#define DPP_MODULE_REGISTRATION_INTERFACE(T)
virtual process_status process(datatools::things &data_)
Data record processing.
void ah_increment_event_number(int incr_=1)
Increment event number by one unit.
event_header_utils_module(datatools::logger::priority=datatools::logger::PRIO_FATAL)
Constructor.
void _set_defaults()
Set default values for attributes.
A basic module to add informations into the event header bank.
Definition: event_header_utils_module.h:30
generation_type
Generation type of the event record.
Definition: event_header.h:42
void ah_increment_run_number(int incr_=1)
Increment run number by one unit.