ClusterCreator.h
Go to the documentation of this file.
1 /** ****************************************************************************
2  * @file ClusterCreator.h
3  * @brief Helper functions to create a cluster
4  * @date January 21, 2015
5  * @author petrillo@fnal.gov
6  * @see Cluster.h ClusterCreator.cxx
7  *
8  * ****************************************************************************/
9 
10 #ifndef CLUSTERCREATOR_H
11 #define CLUSTERCREATOR_H
12 
13 // C/C++ standard library
14 #include <utility> // std::move()
15 
16 // LArSoft libraries
19 
20 namespace util {
21  class GeometryUtilities;
22 }
23 
24 namespace cluster {
25 
26  class ClusterParamsAlgBase;
27 
28  /** **************************************************************************
29  * @brief Class managing the creation of a new recob::Cluster object
30  *
31  * A Creator is a class that creates a temporary data product, and at the
32  * end it yields it to the caller for storage.
33  * This last step should be by move construction, although a copy method is
34  * also provided.
35  *
36  * An example of creating a Cluster object:
37  * @todo Add the example!
38  *
39  * cluster::ClusterCreator cluster(...);
40  * cluster.push_back(cluster.move()); // cluster content becomes invalid
41  *
42  * This is a one-step creation object: the cluster is constructed at the same
43  * time the ClusterCreator is, and no facility is offered to modify the
44  * constructed cluster, or to create another one.
45  */
47  public:
48  // destructor, copy and move constructor and assignment as default
49 
50  /**
51  * @brief Constructor: computes some information from hit list
52  * @param algo a configured and initialized algorithm set
53  * @param start_wire wire coordinate of the start of the cluster
54  * @param sigma_start_wire uncertainty on start_wire
55  * @param start_tick tick coordinate of the start of the cluster
56  * @param sigma_start_tick uncertainty on start_tick
57  * @param end_wire wire coordinate of the end of the cluster
58  * @param sigma_end_wire uncertainty on end_wire
59  * @param end_tick tick coordinate of the end of the cluster
60  * @param sigma_end_tick uncertainty on end_tick
61  * @param ID cluster ID
62  * @param view view for this cluster
63  * @param plane location of the start of the cluster
64  * @param sentry a check-point variable, optional
65  *
66  * The algorithm set algo will compute and return:
67  * - `start_charge`: charge on the start wire
68  * - `start_angle`: angle of the start of the cluster,
69  * in @f$ [ -\pi, \pi ] @f$
70  * - `start_opening`: opening angle at the start of the cluster
71  * - `sigma_end_tick`: uncertainty on end_tick
72  * - `end_charge`: charge on the end wire
73  * - `end_angle`: angle of the end of the cluster,
74  * in @f$ [ -\pi, \pi ] @f$
75  * - `end_opening`: opening angle at the end of the cluster
76  * - `integral`: total charge from fitted shape of hits
77  * - `integral_stddev`: standard deviation of hit charge from fitted shape
78  * - `summedADC`: total charge from signal ADC of hits
79  * - `summedADC_stddev`: standard deviation of signal ADC of hits
80  * - `n_hits`: number of hits in the cluster
81  * - `multiple_hit_density`: wires covered by cluster divided by number of hits
82  * - `width`: a measure of the cluster width
83  *
84  */
87  float start_wire,
88  float sigma_start_wire,
89  float start_tick,
90  float sigma_start_tick,
91  float end_wire,
92  float sigma_end_wire,
93  float end_tick,
94  float sigma_end_tick,
96  geo::View_t view,
97  geo::PlaneID const& plane,
99 
100  /**
101  * @brief Prepares the constructed hit to be moved away
102  * @return a right-value reference to the constructed hit
103  *
104  * Despite the name, no move happens in this function.
105  * Move takes place in the caller code as proper; for example:
106  *
107  * // be cluster a ClusterCreator instance:
108  * std::vector<recob::Cluster> Clusters;
109  * cluster.move(); // nothing happens
110  * Clusters.push_back(cluster.move()); // here the move happens
111  * recob::Cluster single_cluster(cluster.move()); // wrong! cluster is empty now
112  *
113  */
116  {
117  return std::move(cluster);
118  }
119 
120  /**
121  * @brief Returns the constructed wire
122  * @return a constant reference to the constructed wire
123  *
124  * Despite the name, no copy happens in this function.
125  * Copy takes place in the caller code as proper; for example:
126  *
127  * // be cluster a ClusterCreator instance:
128  * std::vector<recob::Cluster> Clusters;
129  * cluster.copy(); // nothing happens
130  * Clusters.push_back(cluster.copy()); // here a copy happens
131  * recob::Cluster single_cluster(cluster.copy()); // copied again
132  *
133  */
134  recob::Cluster const&
135  copy() const
136  {
137  return cluster;
138  }
139 
140  protected:
141  /// Local instance of the cluster being constructed
143 
144  /**
145  * @brief Creates a cluster from direct information and a hit list
146  * @param algo a configured and initialized algorithm set
147  * @param start_wire wire coordinate of the start of the cluster
148  * @param sigma_start_wire uncertainty on start_wire
149  * @param start_tick tick coordinate of the start of the cluster
150  * @param sigma_start_tick uncertainty on start_tick
151  * @param end_wire wire coordinate of the end of the cluster
152  * @param sigma_end_wire uncertainty on end_wire
153  * @param end_tick tick coordinate of the end of the cluster
154  * @param sigma_end_tick uncertainty on end_tick
155  * @param ID cluster ID
156  * @param view view for this cluster
157  * @param plane location of the start of the cluster
158  * @param sentry a check-point variable, optional
159  *
160  * The algorithm set algo will compute and return:
161  * - `start_charge`: charge on the start wire
162  * - `start_angle`: angle of the start of the cluster,
163  * in @f$ [ -\pi, \pi ] @f$
164  * - `start_opening`: opening angle at the start of the cluster
165  * - `sigma_end_tick`: uncertainty on end_tick
166  * - `end_charge`: charge on the end wire
167  * - `end_angle`: angle of the end of the cluster,
168  * in @f$ [ -\pi, \pi ] @f$
169  * - `end_opening`: opening angle at the end of the cluster
170  * - `integral`: total charge from fitted shape of hits
171  * - `integral_stddev`: standard deviation of hit charge from fitted shape
172  * - `summedADC`: total charge from signal ADC of hits
173  * - `summedADC_stddev`: standard deviation of signal ADC of hits
174  * - `n_hits`: number of hits in the cluster
175  * - `multiple_hit_density`: wires covered by cluster divided by number of hits
176  * - `width`: a measure of the cluster width
177  *
178  */
179  recob::Cluster CreateCluster(util::GeometryUtilities const& gser,
180  ClusterParamsAlgBase& algo,
181  float start_wire,
182  float sigma_start_wire,
183  float start_tick,
184  float sigma_start_tick,
185  float end_wire,
186  float sigma_end_wire,
187  float end_tick,
188  float sigma_end_tick,
190  geo::View_t view,
191  geo::PlaneID const& plane,
193 
194  }; // class ClusterCreator
195 
196 } // namespace cluster
197 
198 #endif // CLUSTERCREATOR_H
Namespace for general, non-LArSoft-specific utilities.
void cluster(In first, In last, Out result, Pred *pred)
Definition: NNClusters.h:41
Class managing the creation of a new recob::Cluster object.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
unsigned int ID
recob::Cluster const & copy() const
Returns the constructed wire.
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
recob::Cluster cluster
Local instance of the cluster being constructed.
Set of hits with a 2D structure.
Definition: Cluster.h:71
Cluster finding and building.
Type of sentry argument.
Definition: Cluster.h:176
static const SentryArgument_t Sentry
An instance of the sentry object.
Definition: Cluster.h:182
Algorithm collection class computing cluster parameters.
def move(depos, offset)
Definition: depos.py:107
Definition of data types for geometry description.
recob::Cluster && move()
Prepares the constructed hit to be moved away.
int ID_t
Type of cluster ID.
Definition: Cluster.h:74