Falaise  4.0.1
SuperNEMO Software Toolkit
event_header_cut.h
Go to the documentation of this file.
1 /// \file falaise/snemo/cuts/event_header_cut.h
2 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date : 2011-09-18
4  * Last modified : 2015-06-20
5  *
6  * Copyright (C) 2011-2015 Francois Mauger <mauger@lpccaen.in2p3.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or (at
11  * your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  *
24  *
25  * Description:
26  *
27  * Utility cut.
28  *
29  * History:
30  *
31  */
32 
33 #ifndef FALAISE_SNEMO_CUT_EVENT_HEADER_CUT_H
34 #define FALAISE_SNEMO_CUT_EVENT_HEADER_CUT_H 1
35 
36 // Standard library:
37 #include <iostream>
38 #include <set>
39 #include <string>
40 
41 // Third party:
42 // - Boost:
43 #include <boost/cstdint.hpp>
44 // - Bayeux/datatools:
45 #include <datatools/event_id.h>
47 // - Bayeux/cuts:
48 #include <cuts/i_cut.h>
49 
50 namespace datatools {
51 class service_manager;
52 class properties;
53 } // namespace datatools
54 
55 namespace snemo {
56 
57 namespace cut {
58 
59 /// \brief A cut performed on the event record's 'event header' bank
60 class event_header_cut : public cuts::i_cut {
61  public:
62  /// \brief Mode of the cut
63  enum mode_type {
65  MODE_FLAG = 0x1,
69  };
70 
71  /// Set the 'Event header' bank label/name
72  void set_EH_label(const std::string& EH_label_);
73 
74  /// Return the 'Event header' bank label/name
75  const std::string& get_EH_label() const;
76 
77  /// Return the cut mode
78  uint32_t get_mode() const;
79 
80  /// Check mode FLAG:
81  bool is_mode_flag() const;
82 
83  /// Check mode RUN_NUMBER:
84  bool is_mode_run_number() const;
85 
86  /// Check mode EVENT_NUMBER:
87  bool is_mode_event_number() const;
88 
89  /// Check mode LIST_OF_EVENT_IDS:
90  bool is_mode_list_of_event_ids() const;
91 
92  void set_flag_name(const std::string& flag_name_);
93 
94  const std::string& get_flag_name() const;
95 
96  void set_run_number_min(int run_number_min_);
97 
98  void set_run_number_max(int run_number_max_);
99 
100  void set_event_number_min(int event_number_min_);
101 
102  void set_event_number_max(int event_number_max_);
103 
104  void list_of_event_ids_dump(std::ostream& out_ = std::clog) const;
105 
106  void list_of_event_ids_load(const std::string& filename_);
107 
108  /// Constructor
110 
111  /// Destructor
112  virtual ~event_header_cut();
113 
114  /// Initilization
115  virtual void initialize(const datatools::properties& configuration_,
116  datatools::service_manager& service_manager_,
117  cuts::cut_handle_dict_type& cut_dict_);
118 
119  /// Reset
120  virtual void reset();
121 
122  protected:
123  /// Default values
124  void _set_defaults();
125 
126  /// Selection
127  virtual int _accept();
128 
129  private:
130  std::string _EH_label_; //!< Name of the "Event header" bank
131  uint32_t _mode_; //!< Mode of the cut
132 
133  std::string _flag_name_; //!< Name of the boolean property in the event header
134 
135  int _run_number_min_;
136  int _run_number_max_;
137 
138  int _event_number_min_;
139  int _event_number_max_;
140 
141  std::set<datatools::event_id> _list_of_events_ids_;
142 
143  // Macro to automate the registration of the cut :
145 };
146 
147 } // end of namespace cut
148 
149 } // end of namespace snemo
150 
151 // OCD support::
152 #include <datatools/ocd_macros.h>
153 
154 // @arg snemo::cut::event_header_cut the name the registered class in the OCD system
156 
157 #endif // FALAISE_SNEMO_CUT_EVENT_HEADER_CUT_H
158 
159 /*
160 ** Local Variables: --
161 ** mode: c++ --
162 ** c-file-style: "gnu" --
163 ** End: --
164 */
virtual int _accept()
Selection.
const std::string & get_flag_name() const
bool is_mode_flag() const
Check mode FLAG:
void set_flag_name(const std::string &flag_name_)
bool is_mode_event_number() const
Check mode EVENT_NUMBER:
void set_event_number_max(int event_number_max_)
void list_of_event_ids_dump(std::ostream &out_=std::clog) const
void _set_defaults()
Default values.
void set_EH_label(const std::string &EH_label_)
Set the 'Event header' bank label/name.
void set_event_number_min(int event_number_min_)
Definition: event_header_cut.h:64
virtual ~event_header_cut()
Destructor.
const std::string & get_EH_label() const
Return the 'Event header' bank label/name.
Definition: event_header_cut.h:65
DOCD_CLASS_DECLARATION(my::algo)
Definition: event_header_cut.h:67
#define CUT_REGISTRATION_INTERFACE(T)
Definition: calo_tapered_scin_box_model.h:54
virtual void reset()
Reset.
virtual void initialize(const datatools::properties &configuration_, datatools::service_manager &service_manager_, cuts::cut_handle_dict_type &cut_dict_)
Initilization.
event_header_cut(datatools::logger::priority logging_priority_=datatools::logger::PRIO_FATAL)
Constructor.
void set_run_number_max(int run_number_max_)
void list_of_event_ids_load(const std::string &filename_)
uint32_t get_mode() const
Return the cut mode.
mode_type
Mode of the cut.
Definition: event_header_cut.h:63
std::map< std::string, cut_entry_type > cut_handle_dict_type
void set_run_number_min(int run_number_min_)
bool is_mode_run_number() const
Check mode RUN_NUMBER:
Definition: event_header_cut.h:66
bool is_mode_list_of_event_ids() const
Check mode LIST_OF_EVENT_IDS:
A cut performed on the event record's 'event header' bank.
Definition: event_header_cut.h:60