Falaise  4.0.1
SuperNEMO Software Toolkit
tracker_clustering_data.h
Go to the documentation of this file.
1 /// \file falaise/snemo/datamodels/tracker_clustering_data.h
2 /* Author (s) : François Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2012-03-05
4  * Last modified: 2014-01-27
5  *
6  * Description: SuperNEMO Tracker clustering data model
7  *
8  * History:
9  *
10  */
11 
12 #ifndef FALAISE_SNEMO_DATAMODELS_TRACKER_CLUSTERING_DATA_H
13 #define FALAISE_SNEMO_DATAMODELS_TRACKER_CLUSTERING_DATA_H 1
14 
15 // Standard library:
16 #include <sstream>
17 #include <stdexcept>
18 #include <typeinfo>
19 #include <vector>
20 
21 // Third party:
22 // - Boost:
23 #include <boost/cstdint.hpp>
24 #include <boost/serialization/access.hpp>
25 // - Bayeux/datatools:
26 #include <datatools/i_clear.h>
28 #include <datatools/i_tree_dump.h>
29 #include <datatools/properties.h>
30 #include <datatools/utils.h>
31 
32 // This project:
34 
35 namespace snemo {
36 
37 namespace datamodel {
38 
39 /// \brief SuperNEMO tracker clustering data model
40 //
41 // The tracker hits are initialy sorted, by the so-called tracker
42 // pre-clustering algorithm, within time bunches of typical
43 // duration ~10 us (see the configuration of the
44 // snemo::processing::base_tracker_clusterizer class).
45 //
46 // The first expected bunch is the so-called *prompt* pre-cluster
47 // which contains all the trackeer prompt hits that are collected
48 // by the prompt trigger within a ~10 us time coincidence
49 // window. Then comes eventually *delayed* pre-clusters that are
50 // also collected by bunches of ~10 us some arbitrary delay after
51 // the prompt bunch. An event should contains one and only one
52 // prompt pre-cluster and event can have zero or several *delayed*
53 // pre-clusters.
54 //
55 // ~10 us ~10 us ~10 us
56 // <-----> <----> <------>
57 // --[o-oo-oo]-----------[o-o--o]-------[o---oo-o]------------> time
58 // "prompt" "delayed" "delayed"
59 // (id==0) (id==1)
60 //
61 // The prompt pre-cluster generally gathers all prompt hits from
62 // both sides of the source frame. This is because we expect
63 // several prompt charged particle tracks traversing any location
64 // within the tracking chamber, and triggering tracker drift cells
65 // everywhere in the detector, regardless of the side with respect
66 // to the source frame. It is expected that the full event
67 // topology should be reconstructed taking into account tracks
68 // from both sides. This is obviously the case when we search for
69 // double-beta decay candidate events.
70 //
71 // side==0 side==1
72 // +---------+---------+
73 // | o ! |
74 // | ! |
75 // | ! |
76 // | !o |
77 // | ! oo |
78 // | ooo! ooooo |
79 // | ooo ! oooo|
80 // |ooo ! o|
81 // | ! |
82 // | ! |
83 // | ! |
84 // | ! |
85 // | ! o |
86 // | ! |
87 // | ! o |
88 // | ! |
89 // | ! |
90 // | ! |
91 // +---------+---------+
92 //
93 // Delayed clusters are built independantly on their own side of
94 // the source frame. The purpose of these clusters is the search
95 // for delayed tracks mainly from the Bi214-Po214 decays which are
96 // one of the more critical background in hte experiment. Each
97 // delay cluster has its own delayed cluster Id.
98 //
99 // The tracker clustering algorithm aims to gathered some tracker
100 // hits within a given pre-cluster and build from them a
101 // collection of tracker clusters. However, several clustering
102 // solutions may exist so the final product of the clustering
103 // algorithm consists in a collection of clustering solutions
104 // (a.k.a. scenarii). The tracker clustering data model thus
105 // stores a collection of solutions. A subset of these solutions
106 // corresponds to the clusterization of the prompt pre-cluster:
107 // they are tagged with a dedicated *prompt* flag. Other subset of
108 // clustering solutions may have been built for the various
109 // delayed pre-clusters. In such case, each solution is tagged
110 // with a dedicated *delayed* flag and an unique *delayed cluster
111 // Id*.
112 //
113 // The contents of a typical tracker clustering data object may
114 // looks the following, where the prompt pre-clustered has been
115 // processed by the clustering algorithm which produced three
116 // different clustering scenarii, namely solution 0, 1 and
117 // 2. Then, the two delayed pre-clusters have also been processed,
118 // the first one being associated with two possible solution (3
119 // and 4) and the second one with only one solution (5):
120 //
121 // [solution #0] prompt
122 // [solution #1] prompt
123 // [solution #2] prompt
124 // [solution #3] delayed cluster Id = 0
125 // [solution #4] delayed cluster Id = 0
126 // [solution #5] delayed cluster Id = 1
127 //
128 //
131  public datatools::i_clear {
132  public:
133  /// Key for the boolean property associated to prompt clustering solutions
134  static const std::string& prompt_key();
135 
136  /// Key for the boolean property associated to delayed clustering solutions
137  static const std::string& delayed_key();
138 
139  /// Key for the integer property associated to delayed clustering solutions
140  static const std::string& delayed_id_key();
141 
142  /// Key for the string Id property documenting the clustering algorithm used to build a given
143  /// clustering solution
144  static const std::string& clusterizer_id_key();
145 
146  /// Collection of handles on tracker clustering solutions
147  typedef std::vector<tracker_clustering_solution::handle_type> solution_col_type;
148 
149  /// Default constructor
151 
152  /// Destructor:
153  virtual ~tracker_clustering_data();
154 
155  /// Check if there are some clustering solutions
156  bool has_solutions() const;
157 
158  /// Returns the number of solutions
159  size_t get_number_of_solutions() const;
160 
161  /// Add a clustering solution
163  bool default_solution_ = false);
164 
165  /// Return a non mutable reference to a clustering solution by index
166  const tracker_clustering_solution& get_solution(int i_) const;
167 
168  /// Reset the clustering solutions
169  void invalidate_solutions();
170 
171  /// Check if there is some default clustering solution
172  bool has_default_solution() const;
173 
174  /// Return the non mutable reference to the collection of clustering solutions
176 
177  /// Return the mutable reference to the collection of clustering solutions
179 
180  /// Return a non mutable reference to the default clustering solution is any
182 
183  /// Return a mutable reference to the default clustering solution is any
185 
186  /// Reset the default clustering solution is any
188 
189  /// Set the default clustering solution
190  void set_default_solution(int index_);
191 
192  /// Reset the internals
193  void reset();
194 
195  /// Check if the object has a valid internal structure
196  bool is_valid() const;
197 
198  /// Return a mutable reference on the container of auxiliary properties
199  const datatools::properties& get_auxiliaries() const;
200 
201  /// Return a non mutable reference on the container of auxiliary properties
203 
204  /// Clear the object
205  virtual void clear();
206 
207  /// Smart print
208  virtual void tree_dump(std::ostream& out_ = std::clog, const std::string& title_ = "",
209  const std::string& indent_ = "", bool inherit_ = false) const;
210 
211  private:
212  solution_col_type _solutions_; //!< Collection of Geiger cluster solution handles
214  _default_solution_; //!< Handle to the default/best solution
215  datatools::properties _auxiliaries_; //!< Auxiliary properties
216 
218 };
219 
220 } // end of namespace datamodel
221 
222 } // end of namespace snemo
223 
224 #include <boost/serialization/export.hpp>
225 BOOST_CLASS_EXPORT_KEY2(snemo::datamodel::tracker_clustering_data,
226  "snemo::datamodel::tracker_clustering_data")
227 
228 #endif // FALAISE_SNEMO_DATAMODELS_TRACKER_CLUSTERING_DATA_H
229 
230 /*
231 ** Local Variables: --
232 ** mode: c++ --
233 ** c-file-style: "gnu" --
234 ** tab-width: 2 --
235 ** End: --
236 */
const tracker_clustering_data::solution_col_type & get_solutions() const
Return the non mutable reference to the collection of clustering solutions.
virtual ~tracker_clustering_data()
Destructor:
void set_default_solution(int index_)
Set the default clustering solution.
const tracker_clustering_solution & get_default_solution() const
Return a non mutable reference to the default clustering solution is any.
std::vector< tracker_clustering_solution::handle_type > solution_col_type
Collection of handles on tracker clustering solutions.
Definition: tracker_clustering_data.h:147
void invalidate_default_solution()
Reset the default clustering solution is any.
static const std::string & delayed_key()
Key for the boolean property associated to delayed clustering solutions.
#define DATATOOLS_SERIALIZATION_DECLARATION()
static const std::string & delayed_id_key()
Key for the integer property associated to delayed clustering solutions.
bool is_valid() const
Check if the object has a valid internal structure.
A collection of tracker clusters.
Definition: tracker_clustering_solution.h:88
void invalidate_solutions()
Reset the clustering solutions.
const tracker_clustering_solution & get_solution(int i_) const
Return a non mutable reference to a clustering solution by index.
static const std::string & prompt_key()
Key for the boolean property associated to prompt clustering solutions.
bool has_solutions() const
Check if there are some clustering solutions.
bool has_default_solution() const
Check if there is some default clustering solution.
void reset()
Reset the internals.
Definition: calo_tapered_scin_box_model.h:54
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
datatools::properties & grab_auxiliaries()
Return a non mutable reference on the container of auxiliary properties.
tracker_clustering_data()
Default constructor.
const datatools::properties & get_auxiliaries() const
Return a mutable reference on the container of auxiliary properties.
void add_solution(const tracker_clustering_solution::handle_type &handle_, bool default_solution_=false)
Add a clustering solution.
tracker_clustering_solution & grab_default_solution()
Return a mutable reference to the default clustering solution is any.
SuperNEMO tracker clustering data model.
Definition: tracker_clustering_data.h:129
size_t get_number_of_solutions() const
Returns the number of solutions.
static const std::string & clusterizer_id_key()
virtual void clear()
Clear the object.
tracker_clustering_data::solution_col_type & grab_solutions()
Return the mutable reference to the collection of clustering solutions.