All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
cluster::ClusterParamsAlgBase Class Referenceabstract

Algorithm collection class computing cluster parameters. More...

#include <ClusterParamsAlgBase.h>

Inheritance diagram for cluster::ClusterParamsAlgBase:
cluster::LazyClusterParamsAlg cluster::OverriddenClusterParamsAlg< AlgoBase > cluster::StandardClusterParamsAlg

Public Types

using Measure_t = details::Measure_t< float >
 Type used to return values with errors. More...
 

Public Member Functions

virtual ~ClusterParamsAlgBase ()=default
 
virtual void Clear ()
 Restores the class to post-configuration, pre-initialization state. More...
 
virtual void SetHits (util::GeometryUtilities const &gser, std::vector< recob::Hit const * > const &hits)=0
 Sets the list of input hits. More...
 
virtual void SetHits (util::GeometryUtilities const &gser, std::vector< recob::Hit > const &hits)
 Sets the list of input hits. More...
 
virtual void SetVerbose (int level=1)
 Set the verbosity level. More...
 
virtual size_t NHits ()
 Returns the number of hits in the cluster. More...
 
virtual float MultipleHitDensity ()
 Fraction of wires in the cluster with more than one hit. More...
 
virtual float Width (util::GeometryUtilities const &)
 Computes the width of the cluster. More...
 
virtual Measure_t StartCharge (util::GeometryUtilities const &gser)
 Computes the charge on the first and last wire of the track. More...
 
virtual Measure_t EndCharge (util::GeometryUtilities const &gser)
 
virtual Measure_t StartAngle ()
 Computes the angle at the start or end of the cluster. More...
 
virtual Measure_t EndAngle ()
 
virtual Measure_t StartOpeningAngle ()
 Computes the opening angle at the start or end of the cluster. More...
 
virtual Measure_t EndOpeningAngle ()
 
Cluster charge
virtual Measure_t Integral ()
 Computes the total charge of the cluster from Hit::Integral() More...
 
virtual Measure_t IntegralStdDev ()
 Computes the standard deviation on the charge of the cluster hits. More...
 
virtual Measure_t SummedADC ()
 Computes the total charge of the cluster from Hit::SummedADC() More...
 
virtual Measure_t SummedADCStdDev ()
 Computes the standard deviation on the charge of the cluster hits. More...
 

Static Protected Member Functions

static std::logic_error NotImplemented (std::string function_name)
 

Protected Attributes

int verbose = 0
 verbosity level: 0 is normal, negative is even quieter More...
 

Detailed Description

Algorithm collection class computing cluster parameters.

See Also
ClusterParamsAlg

This class is an interface only. The implementing classes should implement constructors able to read the necessary information from hit lists, and any of the virtual algorithms.

The interface allows for the single extraction of the information required in recob::Cluster version 14. The implementation can compute and cache different variables at once. The accessor functions are non-const, allowing the caching of the quantity after computation (without using mutable cache members).

The default algorithm functions throw an exception.

The algorithms require a list of hits as input. The structure chosen for this interface is recob::Hit from LArSoft, since it is complete by definition and it does not carry deep dependences (in fact, recob::Hit version 14 has only larreco/SimpleTypesAndConstants.h as compile-time dependency, and no external link-time dependency beside standard C++).

Definition at line 102 of file ClusterParamsAlgBase.h.

Member Typedef Documentation

Type used to return values with errors.

Definition at line 105 of file ClusterParamsAlgBase.h.

Constructor & Destructor Documentation

virtual cluster::ClusterParamsAlgBase::~ClusterParamsAlgBase ( )
virtualdefault

Member Function Documentation

virtual void cluster::ClusterParamsAlgBase::Clear ( )
inlinevirtual

Restores the class to post-configuration, pre-initialization state.

This function is expected to be called before SetHits(), and the implementation might call it in SetHits() itself.

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::LazyClusterParamsAlg, and cluster::StandardClusterParamsAlg.

Definition at line 116 of file ClusterParamsAlgBase.h.

117  {}
virtual Measure_t cluster::ClusterParamsAlgBase::EndAngle ( )
inlinevirtual

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 203 of file ClusterParamsAlgBase.h.

204  {
205  throw NotImplemented(__func__);
206  }
static std::logic_error NotImplemented(std::string function_name)
virtual Measure_t cluster::ClusterParamsAlgBase::EndCharge ( util::GeometryUtilities const &  gser)
inlinevirtual

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 186 of file ClusterParamsAlgBase.h.

187  {
188  throw NotImplemented(__func__);
189  }
static std::logic_error NotImplemented(std::string function_name)
virtual Measure_t cluster::ClusterParamsAlgBase::EndOpeningAngle ( )
inlinevirtual

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 220 of file ClusterParamsAlgBase.h.

221  {
222  throw NotImplemented(__func__);
223  }
static std::logic_error NotImplemented(std::string function_name)
virtual Measure_t cluster::ClusterParamsAlgBase::Integral ( )
inlinevirtual

Computes the total charge of the cluster from Hit::Integral()

Returns
total charge of the cluster, in ADC count units
See Also
IntegralStdDev(), SummedADC()

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 234 of file ClusterParamsAlgBase.h.

235  {
236  throw NotImplemented(__func__);
237  }
static std::logic_error NotImplemented(std::string function_name)
virtual Measure_t cluster::ClusterParamsAlgBase::IntegralStdDev ( )
inlinevirtual

Computes the standard deviation on the charge of the cluster hits.

Returns
the standard deviation of charge of hits, in ADC count units
See Also
Integral()

Hit charge is obtained by recob::Hit::Integral().

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 247 of file ClusterParamsAlgBase.h.

248  {
249  throw NotImplemented(__func__);
250  }
static std::logic_error NotImplemented(std::string function_name)
virtual float cluster::ClusterParamsAlgBase::MultipleHitDensity ( )
inlinevirtual

Fraction of wires in the cluster with more than one hit.

Returns
fraction of wires with more than one hit, or 0 if no wires

Returns a quantity defined as NMultiHitWires / NWires, where NWires is the number of wires hosting at least one hit of this cluster, and NMultiHitWires is the number of wires which have more than just one hit.

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 295 of file ClusterParamsAlgBase.h.

296  {
297  throw NotImplemented(__func__);
298  }
static std::logic_error NotImplemented(std::string function_name)
virtual size_t cluster::ClusterParamsAlgBase::NHits ( )
inlinevirtual

Returns the number of hits in the cluster.

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 280 of file ClusterParamsAlgBase.h.

281  {
282  throw NotImplemented(__func__);
283  }
static std::logic_error NotImplemented(std::string function_name)
static std::logic_error cluster::ClusterParamsAlgBase::NotImplemented ( std::string  function_name)
inlinestaticprotected

Definition at line 315 of file ClusterParamsAlgBase.h.

316  {
317  return std::logic_error(function_name + "() not implemented.");
318  }
virtual void cluster::ClusterParamsAlgBase::SetHits ( util::GeometryUtilities const &  gser,
std::vector< recob::Hit const * > const &  hits 
)
pure virtual

Sets the list of input hits.

Parameters
hitslist of pointers to hits
Exceptions
undefinedin case of error, this method can throw (anything)

The hits are in the LArSoft format of recob::Hits, that should have enough information for all the algorithms. The hits are passed as constant pointers. The implementation is expected to either copy the vector (not just to keep a reference to it, since the vector might be temporary) or to translated the required information from the hits into its own internal format. The hits are expected to exist as long as this object is used, until the next Clear() call. It is recommended that this method call Clear() at the beginning. This is left to the implementation, that might still implement a different strategy.

Implemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::LazyClusterParamsAlg, and cluster::StandardClusterParamsAlg.

virtual void cluster::ClusterParamsAlgBase::SetHits ( util::GeometryUtilities const &  gser,
std::vector< recob::Hit > const &  hits 
)
inlinevirtual

Sets the list of input hits.

Parameters
hitslist of hits (hits will not be modified)
Exceptions
undefinedin case of error, this method can throw (anything)

The same general directions apply as for SetHits() version with pointers. This version takes a list of recob::Hit, rather than their pointers. It can simplify upstream handling when the original list is not recob::Hit and creation of temporary recob::Hit is needed. In that case, managing to obtain pointers to these temporary objects can be inefficient.

The default implementation provided here is not efficient either, since it just creates an additional vector of recob::Hit pointers and uses it. If an implementation is concerned with efficiency, it can reimplement this to initialize the algorithm in a more direct way.

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, and cluster::StandardClusterParamsAlg.

Definition at line 157 of file ClusterParamsAlgBase.h.

158  {
159  std::vector<recob::Hit const*> hitptrs;
160  hitptrs.reserve(hits.size());
161  std::transform(hits.begin(),
162  hits.end(),
163  std::back_inserter(hitptrs),
164  [](recob::Hit const& hit) { return &hit; });
165  SetHits(gser, hitptrs);
166  }
static constexpr Sample_t transform(Sample_t sample)
process_name hit
Definition: cheaterreco.fcl:51
virtual void SetHits(util::GeometryUtilities const &gser, std::vector< recob::Hit const * > const &hits)=0
Sets the list of input hits.
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
virtual void cluster::ClusterParamsAlgBase::SetVerbose ( int  level = 1)
inlinevirtual

Set the verbosity level.

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, and cluster::StandardClusterParamsAlg.

Definition at line 170 of file ClusterParamsAlgBase.h.

171  {
172  verbose = level;
173  }
int verbose
verbosity level: 0 is normal, negative is even quieter
virtual Measure_t cluster::ClusterParamsAlgBase::StartAngle ( )
inlinevirtual

Computes the angle at the start or end of the cluster.

Returns
angle at the start of the cluster, in radians

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 198 of file ClusterParamsAlgBase.h.

199  {
200  throw NotImplemented(__func__);
201  }
static std::logic_error NotImplemented(std::string function_name)
virtual Measure_t cluster::ClusterParamsAlgBase::StartCharge ( util::GeometryUtilities const &  gser)
inlinevirtual

Computes the charge on the first and last wire of the track.

Returns
the charge in ADC counts, with uncertainty

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 181 of file ClusterParamsAlgBase.h.

182  {
183  throw NotImplemented(__func__);
184  }
static std::logic_error NotImplemented(std::string function_name)
virtual Measure_t cluster::ClusterParamsAlgBase::StartOpeningAngle ( )
inlinevirtual

Computes the opening angle at the start or end of the cluster.

Returns
angle at the start of the cluster, in radians

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 215 of file ClusterParamsAlgBase.h.

216  {
217  throw NotImplemented(__func__);
218  }
static std::logic_error NotImplemented(std::string function_name)
virtual Measure_t cluster::ClusterParamsAlgBase::SummedADC ( )
inlinevirtual

Computes the total charge of the cluster from Hit::SummedADC()

Returns
total charge of the cluster, in ADC count units
See Also
SummedADCStdDev(), Integral()

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 258 of file ClusterParamsAlgBase.h.

259  {
260  throw NotImplemented(__func__);
261  }
static std::logic_error NotImplemented(std::string function_name)
virtual Measure_t cluster::ClusterParamsAlgBase::SummedADCStdDev ( )
inlinevirtual

Computes the standard deviation on the charge of the cluster hits.

Returns
the standard deviation of charge of hits, in ADC count units
See Also
SummedADC()

Hit charge is obtained by recob::Hit::SummedADC().

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 271 of file ClusterParamsAlgBase.h.

272  {
273  throw NotImplemented(__func__);
274  }
static std::logic_error NotImplemented(std::string function_name)
virtual float cluster::ClusterParamsAlgBase::Width ( util::GeometryUtilities const &  )
inlinevirtual

Computes the width of the cluster.

Returns
width of the cluster

Reimplemented in cluster::OverriddenClusterParamsAlg< AlgoBase >, cluster::StandardClusterParamsAlg, and cluster::LazyClusterParamsAlg.

Definition at line 306 of file ClusterParamsAlgBase.h.

307  {
308  throw NotImplemented(__func__);
309  }
static std::logic_error NotImplemented(std::string function_name)

Member Data Documentation

int cluster::ClusterParamsAlgBase::verbose = 0
protected

verbosity level: 0 is normal, negative is even quieter

Definition at line 312 of file ClusterParamsAlgBase.h.


The documentation for this class was generated from the following file: