All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LazyClusterParamsAlg.h
Go to the documentation of this file.
1 /** ****************************************************************************
2  * @file LazyClusterParamsAlg.h
3  * @brief Algorithm class inheriting pre-computed results
4  * @author petrillo@fnal.gov
5  * @date February 3rd, 2015
6  * @see LazyClusterParamsAlg.cxx
7  *
8  * ****************************************************************************/
9 
10 #ifndef LAZYCLUSTERPARAMSALG_H
11 #define LAZYCLUSTERPARAMSALG_H
12 
13 // C/C++ standard library
14 #include <cstddef>
15 #include <vector>
16 
17 // LArSoft libraries
19 namespace recob {
20  class Hit;
21 }
22 
23 /// Cluster reconstruction namespace
24 namespace cluster {
25 
26  class cluster_params;
27 
28  /**
29  * @brief Algorithm class inheriting cluster parameters
30  * @see ClusterParamsAlg
31  *
32  * This class wraps ClusterParamsAlg class, designed in the context of shower
33  * reconstruction, to expose a standard ClusterParamsBaseAlg interface.
34  * All the information is supposed to have been computed already.
35  *
36  * In addition to the standard interface, GetParams() is also available.
37  */
39  public:
41 
42  /// Constructor: references to the parameters (no copy is performed!)
43  LazyClusterParamsAlg(cluster_params const& new_params) : params(new_params) {}
44 
45  /// Restores the class to post-configuration, pre-initialization state; dummy
46  void
47  Clear() override
48  {}
49 
50  /**
51  * @brief Sets the list of input hits
52  * @param hits list of hits
53  * @throw undefined in case of error, this method can throw (anything)
54  *
55  * The parameters have already been computed.
56  * This function is dummy.
57  */
58  void
60  std::vector<recob::Hit const*> const& hits) override
61  {}
62 
63  //@{
64  /**
65  * @brief Computes the charge on the first and last wire of the track
66  * @return the charge in ADC counts, with uncertainty
67  *
68  * The implementation in ClusterParamsAlg provides an estimation of the
69  * charge collected in the first or last 1 cm of the cluster, using a linear
70  * fit on the deposited charge to reduce fluctuations.
71  */
72  Measure_t StartCharge(util::GeometryUtilities const& gser) override;
73  Measure_t EndCharge(util::GeometryUtilities const& gser) override;
74  //@}
75 
76  //@{
77  /**
78  * @brief Computes the angle of the cluster
79  * @return angle of the cluster in the wire x time space, in radians
80  *
81  * Uses the coordinates from the hits, weighted by charge (Hit::Integral())
82  * to compute a slope in the homogenized wire x time space.
83  * The homogenized space has both wires and ticks converted into a distance
84  * (by using detector parameters: wire pitch and drift velocity).
85  *
86  * The angle is in the @f$ [ -\pi, \pi ] @f$ range, with 0 corresponding to
87  * a cluster parallel to the wire plane and @f$ \pi @f$ to a cluster
88  * orthogonal to the wire plane, going farther from it.
89  *
90  * @note Both the methods return the same value.
91  */
92  Measure_t StartAngle() override;
93  Measure_t EndAngle() override;
94  //@}
95 
96  //@{
97  /**
98  * @brief Computes the opening angle at the start or end of the cluster
99  * @return angle at the start of the cluster, in radians
100  *
101  * This algorithm returns an opening angle after weighting the hits by
102  * their charge (as defined bu Hit::Integral());
103  */
104  Measure_t StartOpeningAngle() override;
105  Measure_t EndOpeningAngle() override;
106  //@}
107 
108  /// @name Cluster charge
109  /// @{
110  /**
111  * @brief Computes the total charge of the cluster from Hit::Integral()
112  * @return total charge of the cluster, in ADC count units
113  * @see IntegralStdDev(), SummedADC()
114  *
115  * ClusterParamsAlg computes the sum from all hits.
116  */
117  Measure_t Integral() override;
118 
119  /**
120  * @brief Computes the standard deviation on the charge of the cluster hits
121  * @return the standard deviation of charge of hits, in ADC count units
122  * @see Integral()
123  *
124  * ClusterParamsAlg computes the standard deviation of the sample of charges
125  * from all hits.
126  * Hit charge is obtained by recob::Hit::Integral().
127  */
128  Measure_t IntegralStdDev() override;
129 
130  /**
131  * @brief Computes the total charge of the cluster from Hit::SummedADC()
132  * @return total charge of the cluster, in ADC count units
133  * @see SummedADCStdDev(), Integral()
134  *
135  * ClusterParamsAlg computes the sum from all hits.
136  */
137  Measure_t SummedADC() override;
138 
139  /**
140  * @brief Computes the standard deviation on the charge of the cluster hits
141  * @return the standard deviation of charge of hits, in ADC count units
142  * @see SummedADC()
143  *
144  * ClusterParamsAlg computes the standard deviation of the sample of charges
145  * from all hits.
146  * Hit charge is obtained by recob::Hit::SummedADC().
147  */
148  Measure_t SummedADCStdDev() override;
149 
150  /// @}
151 
152  /// Returns the number of hits in the cluster
153  size_t NHits() override;
154 
155  /**
156  * @brief Fraction of wires in the cluster with more than one hit
157  * @return fraction of wires with more than one hit, or 0 if no wires
158  *
159  * Returns a quantity defined as NMultiHitWires / NWires,
160  * where NWires is the number of wires hosting at least one hit of this
161  * cluster, and NMultiHitWires is the number of wires which have more
162  * than just one hit.
163  */
164  float MultipleHitDensity() override;
165 
166  /**
167  * @brief Computes the width of the cluster
168  * @return width of the cluster
169  *
170  * @todo provide a description of the algorithm by words
171  */
172  float Width(util::GeometryUtilities const&) override;
173 
174  /// Returns the original precomputed parameters
175  cluster_params const&
176  GetParams() const
177  {
178  return params;
179  }
180 
181  protected:
182  cluster_params const& params; ///< the parameters, already computed
183 
184  }; //class LazyClusterParamsAlg
185 
186 } // namespace cluster
187 
188 #endif // LAZYCLUSTERPARAMSALG_H
Algorithm class inheriting cluster parameters.
size_t NHits() override
Returns the number of hits in the cluster.
process_name cluster
Definition: cheaterreco.fcl:51
ClusterParamsAlgBase::Measure_t Measure_t
Measure_t SummedADC() override
Computes the total charge of the cluster from Hit::SummedADC()
cluster_params const & params
the parameters, already computed
Measure_t Integral() override
Computes the total charge of the cluster from Hit::Integral()
Algorithm collection class computing cluster parameters.
Measure_t SummedADCStdDev() override
Computes the standard deviation on the charge of the cluster hits.
float MultipleHitDensity() override
Fraction of wires in the cluster with more than one hit.
Measure_t IntegralStdDev() override
Computes the standard deviation on the charge of the cluster hits.
details::Measure_t< float > Measure_t
Type used to return values with errors.
Measure_t StartOpeningAngle() override
Computes the opening angle at the start or end of the cluster.
Measure_t StartAngle() override
Computes the angle of the cluster.
Interface for a algorithm class computing cluster parameters.
Measure_t StartCharge(util::GeometryUtilities const &gser) override
Computes the charge on the first and last wire of the track.
cluster_params const & GetParams() const
Returns the original precomputed parameters.
void SetHits(util::GeometryUtilities const &gser, std::vector< recob::Hit const * > const &hits) override
Sets the list of input hits.
Measure_t EndCharge(util::GeometryUtilities const &gser) override
LazyClusterParamsAlg(cluster_params const &new_params)
Constructor: references to the parameters (no copy is performed!)
float Width(util::GeometryUtilities const &) override
Computes the width of the cluster.
void Clear() override
Restores the class to post-configuration, pre-initialization state; dummy.