StandardClusterParamsAlg.h
Go to the documentation of this file.
1 /** ****************************************************************************
2  * @file StandardClusterParamsAlg.h
3  * @brief Interface to class computing cluster parameters
4  * @author petrillo@fnal.gov
5  * @date January 21, 2015
6  * @see StandardClusterParamsAlg.cxx
7  *
8  * Changes:
9  * 20150121 Gianluca Petrillo (petrillo@fnal.gov)
10  * structure shaped on ClusterParamsAlg class by Andrzej Szelc
11  *
12  * ****************************************************************************/
13 
14 #ifndef STANDARDCLUSTERPARAMSALG_H
15 #define STANDARDCLUSTERPARAMSALG_H
16 
17 // C/C++ standard library
18 #include <vector>
19 
20 // LArSoft libraries
23 
24 /// Cluster reconstruction namespace
25 namespace cluster {
26 
27  /**
28  * @brief Algorithm collection class computing cluster parameters
29  * @see ClusterParamsAlg
30  *
31  * This class wraps ClusterParamsAlg class, designed in the context of shower
32  * reconstruction, to expose a standard ClusterParamsBaseAlg interface.
33  */
35  public:
37 
38  /// Constructor
40 
41  /// Destructor
42  virtual ~StandardClusterParamsAlg() = default;
43 
44  /// Restores the class to post-configuration, pre-initialization state
45  void Clear() override;
46 
47  /**
48  * @brief Sets the list of input hits
49  * @param hits list of hits
50  * @throw undefined in case of error, this method can throw (anything)
51  *
52  * Hits are translated into our own internal format.
53  * The original hits are not used afterward, and their distruction will not
54  * affect this object.
55  * This method calls Clear() at the beginning (although the protocol does
56  * not requires it).
57  */
58  void SetHits(util::GeometryUtilities const& gser,
59  std::vector<recob::Hit const*> const& hits) override;
60 
61  /**
62  * @brief Sets the list of input hits
63  * @param hits list of hits (hits will not be modified)
64  * @throw undefined in case of error, this method can throw (anything)
65  * @see ClusterParamsAlgBase::SetHits(std::vector<recob::Hit> const&)
66  */
67  void
68  SetHits(util::GeometryUtilities const& gser, std::vector<recob::Hit> const& hits) override
69  {
71  }
72 
73  /// Set the verbosity level
74  void SetVerbose(int level = 1) override;
75 
76  //@{
77  /**
78  * @brief Computes the charge on the first and last wire of the track
79  * @return the charge in ADC counts, with uncertainty
80  *
81  * The implementation in ClusterParamsAlg provides an estimation of the
82  * charge collected in the first or last 1 cm of the cluster, using a linear
83  * fit on the deposited charge to reduce fluctuations.
84  */
85  Measure_t StartCharge(util::GeometryUtilities const& gser) override;
86  Measure_t EndCharge(util::GeometryUtilities const& gser) override;
87  //@}
88 
89  //@{
90  /**
91  * @brief Computes the angle of the cluster
92  * @return angle of the cluster in the wire x time space, in radians
93  *
94  * Uses the coordinates from the hits, weighted by charge (Hit::Integral())
95  * to compute a slope in the homogenized wire x time space.
96  * The homogenized space has both wires and ticks converted into a distance
97  * (by using detector parameters: wire pitch and drift velocity).
98  *
99  * The angle is in the @f$ [ -\pi, \pi ] @f$ range, with 0 corresponding to
100  * a cluster parallel to the wire plane and @f$ \pi @f$ to a cluster
101  * orthogonal to the wire plane, going farther from it.
102  *
103  * @note Both the methods return the same value.
104  */
105  Measure_t StartAngle() override;
106  Measure_t EndAngle() override;
107  //@}
108 
109  //@{
110  /**
111  * @brief Computes the opening angle at the start or end of the cluster
112  * @return angle at the start of the cluster, in radians
113  *
114  * This algorithm returns an opening angle after weighting the hits by
115  * their charge (as defined bu Hit::Integral());
116  */
117  Measure_t StartOpeningAngle() override;
118  Measure_t EndOpeningAngle() override;
119  //@}
120 
121  /// @name Cluster charge
122  /// @{
123  /**
124  * @brief Computes the total charge of the cluster from Hit::Integral()
125  * @return total charge of the cluster, in ADC count units
126  * @see IntegralStdDev(), SummedADC()
127  *
128  * ClusterParamsAlg computes the sum from all hits.
129  */
130  Measure_t Integral() override;
131 
132  /**
133  * @brief Computes the standard deviation on the charge of the cluster hits
134  * @return the standard deviation of charge of hits, in ADC count units
135  * @see Integral()
136  *
137  * ClusterParamsAlg computes the standard deviation of the sample of charges
138  * from all hits.
139  * Hit charge is obtained by recob::Hit::Integral().
140  */
141  Measure_t IntegralStdDev() override;
142 
143  /**
144  * @brief Computes the total charge of the cluster from Hit::SummedADC()
145  * @return total charge of the cluster, in ADC count units
146  * @see SummedADCStdDev(), Integral()
147  *
148  * ClusterParamsAlg computes the sum from all hits.
149  */
150  Measure_t SummedADC() override;
151 
152  /**
153  * @brief Computes the standard deviation on the charge of the cluster hits
154  * @return the standard deviation of charge of hits, in ADC count units
155  * @see SummedADC()
156  *
157  * ClusterParamsAlg computes the standard deviation of the sample of charges
158  * from all hits.
159  * Hit charge is obtained by recob::Hit::SummedADC().
160  */
161  Measure_t SummedADCStdDev() override;
162 
163  /// @}
164 
165  /// Returns the number of hits in the cluster
166  size_t NHits() override;
167 
168  /**
169  * @brief Fraction of wires in the cluster with more than one hit
170  * @return fraction of wires with more than one hit, or 0 if no wires
171  *
172  * Returns a quantity defined as NMultiHitWires / NWires,
173  * where NWires is the number of wires hosting at least one hit of this
174  * cluster, and NMultiHitWires is the number of wires which have more
175  * than just one hit.
176  */
177  float MultipleHitDensity() override;
178 
179  /**
180  * @brief Computes the width of the cluster
181  * @return width of the cluster
182  *
183  * @todo provide a description of the algorithm by words
184  */
185  float Width(util::GeometryUtilities const& gser) override;
186 
187  /// Returns the number of input hits
188  size_t NInputHits() const;
189 
190  protected:
191  ClusterParamsAlg algo; ///< the actual algorithm class
192 
193  }; //class StandardClusterParamsAlg
194 
195 } // namespace cluster
196 
197 #endif // STANDARDCLUSTERPARAMSALG_H
virtual ~StandardClusterParamsAlg()=default
Destructor.
Measure_t IntegralStdDev() override
Computes the standard deviation on the charge of the cluster hits.
void SetVerbose(int level=1) override
Set the verbosity level.
Measure_t StartAngle() override
Computes the angle of the cluster.
Algorithm collection class computing cluster parameters.
Cluster finding and building.
Measure_t StartOpeningAngle() override
Computes the opening angle at the start or end of the cluster.
Algorithm collection class computing cluster parameters.
Measure_t SummedADCStdDev() override
Computes the standard deviation on the charge of the cluster hits.
float Width(util::GeometryUtilities const &gser) override
Computes the width of the cluster.
ClusterParamsAlg algo
the actual algorithm class
Measure_t Integral() override
Computes the total charge of the cluster from Hit::Integral()
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
virtual void SetHits(util::GeometryUtilities const &gser, std::vector< recob::Hit const * > const &hits)=0
Sets the list of input hits.
details::Measure_t< float > Measure_t
Type used to return values with errors.
void SetHits(util::GeometryUtilities const &gser, std::vector< recob::Hit > const &hits) override
Sets the list of input hits.
float MultipleHitDensity() override
Fraction of wires in the cluster with more than one hit.
Interface for a algorithm class computing cluster parameters.
Measure_t SummedADC() override
Computes the total charge of the cluster from Hit::SummedADC()
size_t NHits() override
Returns the number of hits in the cluster.
void Clear() override
Restores the class to post-configuration, pre-initialization state.
size_t NInputHits() const
Returns the number of input hits.
Measure_t StartCharge(util::GeometryUtilities const &gser) override
Computes the charge on the first and last wire of the track.