LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ClusterParamsAlgBase.h
Go to the documentation of this file.
1 
14 #ifndef CLUSTERPARAMSALGBASE_H
15 #define CLUSTERPARAMSALGBASE_H
16 
17 // C/C++ standard libraries
18 #include <stdexcept> // std::logic_error
19 #include <vector>
20 #include <algorithm> // std::transform()
21 
22 // LArSoft libraries
24 
26 namespace cluster {
27 
29  namespace details {
30 
32  template <typename T>
33  class Measure_t: public std::pair<T, T> {
34  using Base_t = std::pair<T, T>;
35  public:
36  using Data_t = T;
37 
39  Measure_t(): Base_t(Data_t(0), Data_t(0)) {}
40 
43 
45  Measure_t(Data_t value, Data_t error): Base_t(value, error) {}
46 
47  Data_t value() const { return Base_t::first; }
48  Data_t& value() { return Base_t::first; }
49 
50  Data_t error() const { return Base_t::second; }
51  Data_t& error() { return Base_t::second; }
52  }; // Measure_t
53 
54  } // namespace details
55 
56 
81  public:
82 
85 
86  // no constructor provided for the abstract class
87 
89  virtual ~ClusterParamsAlgBase() {}
90 
91 
98  virtual void Clear() {}
99 
100 
118  virtual void SetHits(std::vector<recob::Hit const*> const& hits) = 0;
119 
137  virtual void SetHits(std::vector<recob::Hit> const& hits)
138  {
139  std::vector<recob::Hit const*> hitptrs;
140  hitptrs.reserve(hits.size());
141  std::transform(hits.begin(), hits.end(), std::back_inserter(hitptrs),
142  [] (recob::Hit const& hit) { return &hit; });
143  SetHits(hitptrs);
144  }
145 
146 
148  virtual void SetVerbose(int level = 1) { verbose = level; }
149 
150 
152 
156  virtual Measure_t StartCharge() { throw NotImplemented(__func__); }
157  virtual Measure_t EndCharge() { throw NotImplemented(__func__); }
159 
161 
165  virtual Measure_t StartAngle() { throw NotImplemented(__func__); }
166  virtual Measure_t EndAngle() { throw NotImplemented(__func__); }
168 
170 
174  virtual Measure_t StartOpeningAngle() { throw NotImplemented(__func__); }
175  virtual Measure_t EndOpeningAngle() { throw NotImplemented(__func__); }
177 
178 
181 
186  virtual Measure_t Integral() { throw NotImplemented(__func__); }
187 
195  virtual Measure_t IntegralStdDev() { throw NotImplemented(__func__); }
196 
202  virtual Measure_t SummedADC() { throw NotImplemented(__func__); }
203 
211  virtual Measure_t SummedADCStdDev() { throw NotImplemented(__func__); }
212 
214 
215 
217  virtual size_t NHits() { throw NotImplemented(__func__); }
218 
219 
229  virtual float MultipleHitDensity() { throw NotImplemented(__func__); }
230 
236  virtual float Width() { throw NotImplemented(__func__); }
237 
238 
239  protected:
240 
241  int verbose = 0;
242 
243  static std::logic_error NotImplemented(std::string function_name)
244  { return std::logic_error(function_name + "() not implemented."); }
245 
246  }; //class ClusterParamsAlgBase
247 
248 } //namespace cluster
249 
250 #endif // CLUSTERPARAMSALGBASE_H
virtual Measure_t EndCharge()
Computes the charge on the first and last wire of the track.
virtual Measure_t IntegralStdDev()
Computes the standard deviation on the charge of the cluster hits.
static std::logic_error NotImplemented(std::string function_name)
Declaration of signal hit object.
virtual void SetVerbose(int level=1)
Set the verbosity level.
virtual float Width()
Computes the width of the cluster.
virtual Measure_t StartCharge()
Computes the charge on the first and last wire of the track.
Cluster finding and building.
virtual void Clear()
Restores the class to post-configuration, pre-initialization state.
virtual Measure_t EndAngle()
Computes the angle at the start or end of the cluster.
Algorithm collection class computing cluster parameters.
virtual ~ClusterParamsAlgBase()
Virtual destructor. Override freely.
virtual Measure_t SummedADCStdDev()
Computes the standard deviation on the charge of the cluster hits.
void hits()
Definition: readHits.C:15
Measure_t()
Default constructor: initializes to 0.
virtual Measure_t StartOpeningAngle()
Computes the opening angle at the start or end of the cluster.
Type for a simple measurement: value and error.
virtual Measure_t StartAngle()
Computes the angle at the start or end of the cluster.
virtual void SetHits(std::vector< recob::Hit > const &hits)
Sets the list of input hits.
virtual float MultipleHitDensity()
Fraction of wires in the cluster with more than one hit.
Detector simulation of raw signals on wires.
virtual Measure_t Integral()
Computes the total charge of the cluster from Hit::Integral()
virtual Measure_t SummedADC()
Computes the total charge of the cluster from Hit::SummedADC()
Measure_t(Data_t value)
Constructor: initializes to the specified value, error is 0.
Measure_t(Data_t value, Data_t error)
Constructor: initializes to the specified value and error.
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:49
virtual Measure_t EndOpeningAngle()
Computes the opening angle at the start or end of the cluster.
virtual size_t NHits()
Returns the number of hits in the cluster.