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