Falaise  4.0.1
SuperNEMO Software Toolkit
pre_clusterizer.h
Go to the documentation of this file.
1 /// \file falaise/TrackerPreClustering/pre_clusterizer.h
2 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2012-03-30
4  * Last modified: 2014-02-07
5  *
6  * Copyright 2012-2014 F. Mauger
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  * Description:
24  *
25  * Tracker Pre-Clustering algorithm.
26  *
27  * History:
28  *
29  * This set of classes have been ported from the Channel metapackage.
30  */
31 
32 #ifndef FALAISE_TRACKERPRECLUSTERING_PRE_CLUSTERIZER_H
33 #define FALAISE_TRACKERPRECLUSTERING_PRE_CLUSTERIZER_H 1
34 
35 // Third party:
36 // - Bayeux/datatools:
38 
39 // This project:
41 
42 namespace TrackerPreClustering {
43 
44 /// \brief A pre-clusterizer of Geiger hits for the SuperNEMO detector
45 /** This algorithm aims to group the Geiger hits in a given SuperNEMO event record
46  * using some simple clustering criteria:
47  * - prompt hits are grouped within a prompt pre-cluster if they lie on the same side of
48  * the source foil,
49  * - delayed hits are grouped within a delayed pre-cluster if they lie on the same side of
50  * the source foil and are in a 10 us time coincidence window.
51  * Only two prompt clusters can exists (maximum: one per side of the source foil).
52  * There is no limitation on the number of delayed clusters.
53  *
54  * The TrackerPreClustering::pre_clusterizer object is configured through a
55  * TrackerPreClustering::setup_data object.
56  *
57  * The input of the algorithm is implemented through the template
58  * TrackerPreClustering::input_data<> class which is basically a collection of Geiger hits.
59  *
60  * The output of the algorithm is implemented through the template
61  * TrackerPreClustering::output_data<> class which stores collections of prompt and delayed
62  * clusters. By default the tracking chamber is considered as splitted in two parts.
63  *
64  */
66  public:
67  static const int OK;
68  static const int ERROR;
69 
70  /// Check the lock flag
71  bool is_locked() const;
72 
73  /// Return logging threshold
75 
76  /// Set logging threshold
78 
79  /// Default constructor
81 
82  /// Destrctuor
83  virtual ~pre_clusterizer();
84 
85  /// Configure and initialize the algorithm
86  int initialize(const setup_data& setup_);
87 
88  /// Reset
89  void reset();
90 
91  /// Process the list of hits
92  /// A 'Hit' class must be provided with the proper interface (see the TrackerPreClustering::gg_hit
93  /// mock data model)
94  template <typename Hit>
95  int process(const input_data<Hit>& input_, output_data<Hit>& output_);
96 
97  /// Return the cell size
98  double get_cell_size() const;
99 
100  /// Set the cell size
101  void set_cell_size(double cell_size_);
102 
103  /// Set the delayed hit cluster time
104  void set_delayed_hit_cluster_time(double);
105 
106  /// Return the delayed hit cluster time
107  double get_delayed_hit_cluster_time() const;
108 
109  /// Check if prompt hits are processed
110  bool is_processing_prompt_hits() const;
111 
112  /// Set the flag for prompt hits processing
113  void set_processing_prompt_hits(bool);
114 
115  /// Check if delayed hits are processed
116  bool is_processing_delayed_hits() const;
117 
118  /// Set the flag for delayed hits processing
119  void set_processing_delayed_hits(bool);
120 
121  /// Check the flag to split the tracking chamber
122  bool is_split_chamber() const;
123 
124  /// Set the flag to split the tracking chamber
125  void set_split_chamber(bool);
126 
127  protected:
128  /// Set defualt attribute values
129  void _set_defaults();
130 
131  private:
132  bool _locked_; /// Lock flag
133  datatools::logger::priority _logging_; /// Logging flag
134  double _cell_size_; /// Size of a cell (embedded length units)
135  double _delayed_hit_cluster_time_; /// Delayed hit cluster time window (embedded time units)
136  bool _processing_prompt_hits_; /// Activation of the processing of prompt hits
137  bool _processing_delayed_hits_; /// Activation of the processing of delayed hits
138  bool _split_chamber_; /// Split the chamber in two half-chambers to classify the hits and
139  /// time-clusters
140 };
141 
142 /// A functor for handle on tracker hits that perform a comparison by delayed time
143 template <class Hit>
145  public:
146  /// Main comparison method(less than) : require non null handles and non-Nan delayed times
147  bool operator()(const Hit* hit_ptr_i_, const Hit* hit_ptr_j_) const {
148  if (!hit_ptr_i_->has_delayed_time()) return false;
149  if (!hit_ptr_j_->has_delayed_time()) return false;
150  return hit_ptr_i_->get_delayed_time() < hit_ptr_j_->get_delayed_time();
151  }
152 };
153 
154 } // end of namespace TrackerPreClustering
155 
156 #include "falaise/TrackerPreClustering/pre_clusterizer.tpp"
157 
158 #endif // FALAISE_TRACKERPRECLUSTERING_PRE_CLUSTERIZER_H
159 
160 /*
161 ** Local Variables: --
162 ** mode: c++ --
163 ** c-file-style: "gnu" --
164 ** tab-width: 2 --
165 ** End: --
166 */
void _set_defaults()
Set defualt attribute values.
virtual ~pre_clusterizer()
Destrctuor.
void set_processing_delayed_hits(bool)
Set the flag for delayed hits processing.
double get_cell_size() const
Return the cell size.
bool is_locked() const
Check the lock flag.
Output data structure.
Definition: interface.h:109
void set_processing_prompt_hits(bool)
Set the flag for prompt hits processing.
static const int OK
Definition: pre_clusterizer.h:67
void set_split_chamber(bool)
Set the flag to split the tracking chamber.
int process(const input_data< Hit > &input_, output_data< Hit > &output_)
A pre-clusterizer of Geiger hits for the SuperNEMO detector.
Definition: pre_clusterizer.h:65
pre_clusterizer()
Default constructor.
void set_delayed_hit_cluster_time(double)
Set the delayed hit cluster time.
Setup data for the TrackerPreClustering algorithm.
Definition: interface.h:50
bool operator()(const Hit *hit_ptr_i_, const Hit *hit_ptr_j_) const
Main comparison method(less than) : require non null handles and non-Nan delayed times.
Definition: pre_clusterizer.h:147
A functor for handle on tracker hits that perform a comparison by delayed time.
Definition: pre_clusterizer.h:144
void set_logging_priority(datatools::logger::priority logging_)
Set logging threshold.
static const int ERROR
Definition: pre_clusterizer.h:68
Definition: event_display.h:40
double get_delayed_hit_cluster_time() const
Return the delayed hit cluster time.
datatools::logger::priority get_logging_priority() const
Return logging threshold.
bool is_processing_prompt_hits() const
Check if prompt hits are processed.
int initialize(const setup_data &setup_)
Configure and initialize the algorithm.
bool is_processing_delayed_hits() const
Check if delayed hits are processed.
bool is_split_chamber() const
Check the flag to split the tracking chamber.
void set_cell_size(double cell_size_)
Set the cell size.
Input data structure.
Definition: interface.h:80