Falaise  4.0.1
SuperNEMO Software Toolkit
simulated_data_cut.h
Go to the documentation of this file.
1 /** \file falaise/snemo/cuts/simulated_data_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  * Simulated data cut.
28  *
29  * History:
30  *
31  */
32 
33 #ifndef FALAISE_SNEMO_CUT_SIMULATED_DATA_CUT_H
34 #define FALAISE_SNEMO_CUT_SIMULATED_DATA_CUT_H 1
35 
36 // Standard library:
37 #include <string>
38 
39 // Third party:
40 // - Boost:
41 #include <boost/cstdint.hpp>
42 // - Bayeux/datatools:
43 #include <datatools/bit_mask.h>
44 // - Bayeux/cuts:
45 #include <cuts/i_cut.h>
46 
47 namespace datatools {
48 class service_manager;
49 class properties;
50 } // namespace datatools
51 
52 namespace snemo {
53 
54 namespace cut {
55 
57  public:
58  /// \brief The cut mode
59  enum mode_type {
62  MODE_HAS_HIT_CATEGORY = datatools::bit_mask::bit01, // simulated_data::has_step_hits
64  datatools::bit_mask::bit02, // simulated_data::get_number_of_step_hits
66  };
67 
68  /// Set the SD bank key
69  void set_SD_label(const std::string& SD_label_);
70 
71  /// Return the SD bank key
72  const std::string& get_SD_label() const;
73 
74  /// Return the cut mode
75  uint32_t get_mode() const;
76 
77  /// Check mode MODE_FLAG:
78  bool is_mode_flag() const;
79 
80  /// Check mode MODE_HAS_HIT_CATEGORY:
81  bool is_mode_has_hit_category() const;
82 
83  /// Check mode MODE_RANGE_HIT_CATEGORY:
84  bool is_mode_range_hit_category() const;
85 
86  /// Check mode MODE_HAS_HIT_PROPERTY:
87  bool is_mode_has_hit_property() const;
88 
89  /// Set the name of cut mode MODE_FLAG
90  void set_flag_name(const std::string& flag_name_);
91 
92  /// Return the name of cut mode MODE_FLAG
93  const std::string& get_flag_name() const;
94 
95  /// Constructor
97 
98  /// Destructor
99  virtual ~simulated_data_cut();
100 
101  /// Initilization
102  virtual void initialize(const datatools::properties& configuration_,
103  datatools::service_manager& service_manager_,
104  cuts::cut_handle_dict_type& cut_dict_);
105 
106  /// Reset
107  virtual void reset();
108 
109  protected:
110  /// Default values
111  void _set_defaults();
112 
113  /// Selection
114  virtual int _accept();
115 
116  private:
117  std::string _SD_label_; //!< Name of the "Simulated data" bank
118  uint32_t _mode_; //!< Mode of the cut
119 
120  std::string _flag_name_; //!< Name of the boolean property in the simulated data
121 
122  std::string _hit_category_; //!< Name of the hit category to be checked
123  int _hit_category_range_min_; //!< Minimal number of hits in a category
124  int _hit_category_range_max_; //!< Maximal number of hits in a category
125 
126  std::string _hit_property_logic_; //!< Logic operation between property selection
127  typedef std::map<std::string, std::vector<std::string> > property_values_dict_type;
128  property_values_dict_type
129  _hit_property_values_; //!< Values of the 'step_hit' property to look for
130 
131  // Macro to automate the registration of the cut :
133 };
134 
135 } // end of namespace cut
136 
137 } // end of namespace snemo
138 
139 // OCD support::
140 #include <datatools/ocd_macros.h>
141 
142 // @arg snemo::cut::simulated_data_cut the name the registered class in the OCD system
144 
145 #endif // FALAISE_SNEMO_CUT_SIMULATED_DATA_CUT_H
146 
147 /*
148 ** Local Variables: --
149 ** mode: c++ --
150 ** c-file-style: "gnu" --
151 ** End: --
152 */
Definition: simulated_data_cut.h:61
void set_SD_label(const std::string &SD_label_)
Set the SD bank key.
const std::string & get_SD_label() const
Return the SD bank key.
void _set_defaults()
Default values.
virtual void initialize(const datatools::properties &configuration_, datatools::service_manager &service_manager_, cuts::cut_handle_dict_type &cut_dict_)
Initilization.
static const uint32_t bit01
static const uint32_t bit03
virtual int _accept()
Selection.
simulated_data_cut(datatools::logger::priority logging_priority_=datatools::logger::PRIO_FATAL)
Constructor.
bool is_mode_has_hit_property() const
Check mode MODE_HAS_HIT_PROPERTY:
const std::string & get_flag_name() const
Return the name of cut mode MODE_FLAG.
virtual ~simulated_data_cut()
Destructor.
mode_type
The cut mode.
Definition: simulated_data_cut.h:59
DOCD_CLASS_DECLARATION(my::algo)
Definition: simulated_data_cut.h:56
bool is_mode_range_hit_category() const
Check mode MODE_RANGE_HIT_CATEGORY:
#define CUT_REGISTRATION_INTERFACE(T)
static const uint32_t bit02
Definition: calo_tapered_scin_box_model.h:54
uint32_t get_mode() const
Return the cut mode.
void set_flag_name(const std::string &flag_name_)
Set the name of cut mode MODE_FLAG.
Definition: simulated_data_cut.h:60
std::map< std::string, cut_entry_type > cut_handle_dict_type
static const uint32_t bit00
bool is_mode_has_hit_category() const
Check mode MODE_HAS_HIT_CATEGORY:
bool is_mode_flag() const
Check mode MODE_FLAG:
virtual void reset()
Reset.