LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
cluster::OverriddenClusterParamsAlg< AlgoBase > Class Template Reference

Algorithm collection class computing cluster parameters. More...

#include "OverriddenClusterParamsAlg.h"

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

Public Types

enum  ParameterType_t {
  cpStartAngle, cpEndAngle, cpStartCharge, cpEndCharge,
  cpStartOpeningAngle, cpEndOpeningAngle, cpIntegral, cpIntegralStdDev,
  cpSummedADC, cpSummedADCStdDev, cpNHits, cpMultipleHitDensity,
  cpWidth, NParameters
}
 
using Algo_t = AlgoBase
 
using This_t = OverriddenClusterParamsAlg< AlgoBase >
 
using Measure_t = typename AlgoBase::Measure_t
 

Public Member Functions

template<typename... Args>
 OverriddenClusterParamsAlg (Args &&...args)
 Constructor; just forwards the arguments to the base class. More...
 
This_tOverrideParameter (ParameterType_t param, Measure_t value)
 Overrides the specified cluster parameter. More...
 
This_tReleaseParameter (ParameterType_t param)
 Cancels the override of the specified cluster parameter. More...
 
bool isOverridden (ParameterType_t param) const
 Returns whether the specified parameter is currently overridden. More...
 
size_t NHits () override
 Returns the number of hits in the cluster. More...
 
float MultipleHitDensity () override
 Fraction of wires in the cluster with more than one hit. More...
 
float Width (util::GeometryUtilities const &gser) override
 Computes the width of the cluster. More...
 
Standard ClusterParamsAlgBase interface

The following methods replicate the ones of the templated Algo_t class. Except, of course, when they are overridden.

void Clear () override
 Restores the class to post-configuration, pre-initialization state. More...
 
void SetHitsFromPointers (util::GeometryUtilities const &gser, std::vector< recob::Hit const * > const &hits) override
 Sets the list of input hits. More...
 
void SetHits (util::GeometryUtilities const &gser, std::vector< recob::Hit > const &hits) override
 Sets the list of input hits. More...
 
void SetVerbose (int level=1) override
 Set the verbosity level;. More...
 
Algorithm results
Measure_t StartCharge (util::GeometryUtilities const &gser) override
 Computes the charge on the first and last wire of the track. More...
 
Measure_t EndCharge (util::GeometryUtilities const &gser) override
 Computes the charge on the first and last wire of the track. More...
 
Measure_t StartAngle () override
 Computes the angle of the cluster. More...
 
Measure_t EndAngle () override
 Computes the angle of the cluster. More...
 
Measure_t StartOpeningAngle () override
 Computes the opening angle at the start or end of the cluster. More...
 
Measure_t EndOpeningAngle () override
 Computes the opening angle at the start or end of the cluster. More...
 
Cluster charge
Measure_t Integral () override
 Computes the total charge of the cluster from Hit::Integral() More...
 
Measure_t IntegralStdDev () override
 Computes the standard deviation on the charge of the cluster hits. More...
 
Measure_t SummedADC () override
 Computes the total charge of the cluster from Hit::SummedADC() More...
 
Measure_t SummedADCStdDev () override
 Computes the standard deviation on the charge of the cluster hits. More...
 

Protected Types

using ValueFunction_t) = float(Algo_t::*)(
 
using MeasureFunction_t) = Measure_t(Algo_t::*)(
 

Protected Member Functions

template<typename Func , typename... Args>
auto ReturnValue (ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
 

Static Protected Member Functions

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

Protected Attributes

Algo_t algo
 an instance of the wrapped algorithm class More...
 
std::vector< details::MultiValuevalues
 the overridden values More...
 
std::bitset< NParametersoverridden_set
 bits for overriding More...
 
int verbose = 0
 verbosity level: 0 is normal, negative is even quieter More...
 

Detailed Description

template<typename AlgoBase>
class cluster::OverriddenClusterParamsAlg< AlgoBase >

Algorithm collection class computing cluster parameters.


Template Parameters
AlgoBaseclass of algorithms to be overridden
See also
ClusterParamsAlg

This class wraps a ClusterParamsAlgBase class, and overrides selected methods with constant values. The same effect can be obtained explicitly creating a new class with the proper methods overridden. This one is a more convenient way to get the same result, but it's slower and less flexible.

Definition at line 69 of file OverriddenClusterParamsAlg.h.

Member Typedef Documentation

template<typename AlgoBase >
using cluster::OverriddenClusterParamsAlg< AlgoBase >::Algo_t = AlgoBase

Definition at line 75 of file OverriddenClusterParamsAlg.h.

template<typename AlgoBase >
using cluster::OverriddenClusterParamsAlg< AlgoBase >::Measure_t = typename AlgoBase::Measure_t

Definition at line 77 of file OverriddenClusterParamsAlg.h.

template<typename AlgoBase >
using cluster::OverriddenClusterParamsAlg< AlgoBase >::MeasureFunction_t = Measure_t (Algo_t::*)(
protected

Definition at line 296 of file OverriddenClusterParamsAlg.h.

template<typename AlgoBase >
using cluster::OverriddenClusterParamsAlg< AlgoBase >::This_t = OverriddenClusterParamsAlg<AlgoBase>

Definition at line 76 of file OverriddenClusterParamsAlg.h.

template<typename AlgoBase >
using cluster::OverriddenClusterParamsAlg< AlgoBase >::ValueFunction_t = float (Algo_t::*)(
protected

Definition at line 295 of file OverriddenClusterParamsAlg.h.

Member Enumeration Documentation

template<typename AlgoBase >
enum cluster::OverriddenClusterParamsAlg::ParameterType_t
Enumerator
cpStartAngle 

StartAngle()

cpEndAngle 

EndAngle()

cpStartCharge 

StartCharge()

cpEndCharge 

EndCharge()

cpStartOpeningAngle 

StartOpeningAngle()

cpEndOpeningAngle 

EndOpeningAngle()

cpIntegral 

Integral()

cpIntegralStdDev 

IntegralStdDev()

cpSummedADC 

SummedADC()

cpSummedADCStdDev 

SummedADCStdDev()

cpNHits 

NHits()

cpMultipleHitDensity 

MultipleHitDensity()

cpWidth 

Width()

NParameters 

total number of supported parameters

Definition at line 79 of file OverriddenClusterParamsAlg.h.

79  {
80  cpStartAngle,
81  cpEndAngle,
83  cpEndCharge,
86  cpIntegral,
88  cpSummedADC,
90  cpNHits,
92  cpWidth,
94  };

Constructor & Destructor Documentation

template<typename AlgoBase >
template<typename... Args>
cluster::OverriddenClusterParamsAlg< AlgoBase >::OverriddenClusterParamsAlg ( Args &&...  args)
inlineexplicit

Constructor; just forwards the arguments to the base class.

Definition at line 98 of file OverriddenClusterParamsAlg.h.

99  : algo(std::forward<Args>(args)...), values(NParameters)
100  {}
std::vector< details::MultiValue > values
the overridden values
Algo_t algo
an instance of the wrapped algorithm class

Member Function Documentation

template<typename AlgoBase >
void cluster::OverriddenClusterParamsAlg< AlgoBase >::Clear ( )
inlineoverridevirtual

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

See also
Algo_t::Clear()

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 143 of file OverriddenClusterParamsAlg.h.

143 { algo.Clear(); }
Algo_t algo
an instance of the wrapped algorithm class
template<typename AlgoBase >
Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::EndAngle ( )
inlineoverridevirtual

Computes the angle of the cluster.

Returns
angle of the cluster in the wire x time space, in radians
See also
Algo_t::StartAngle(), Algo_t::EndAngle()

The angle is in the $ [ -\pi, \pi ] $ range, with 0 corresponding to a cluster parallel to the wire plane and $ \pi $ to a cluster orthogonal to the wire plane, going farther from it.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 206 of file OverriddenClusterParamsAlg.h.

206 { return ReturnValue(cpEndAngle, &Algo_t::EndAngle); }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
template<typename AlgoBase >
Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::EndCharge ( util::GeometryUtilities const &  gser)
inlineoverridevirtual

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

Returns
the charge in ADC counts, with uncertainty
See also
Algo_t::StartCharge(), Algo_t::EndCharge()

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 188 of file OverriddenClusterParamsAlg.h.

189  {
190  return ReturnValue(cpEndCharge, &Algo_t::EndCharge, gser);
191  }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
template<typename AlgoBase >
Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::EndOpeningAngle ( )
inlineoverridevirtual

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

Returns
angle at the start of the cluster, in radians
See also
Algo_t::StartOpeningAngle(), Algo_t::EndOpeningAngle()

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 219 of file OverriddenClusterParamsAlg.h.

220  {
221  return ReturnValue(cpEndOpeningAngle, &Algo_t::EndOpeningAngle);
222  }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
template<typename AlgoBase >
Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::Integral ( )
inlineoverridevirtual

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

Returns
total charge of the cluster, in ADC count units
See also
IntegralStdDev(), SummedADC()
Algo_t::Integral()

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 233 of file OverriddenClusterParamsAlg.h.

233 { return ReturnValue(cpIntegral, &Algo_t::Integral); }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
template<typename AlgoBase >
Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::IntegralStdDev ( )
inlineoverridevirtual

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()
Algo_t::IntegralStdDev()

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 241 of file OverriddenClusterParamsAlg.h.

242  {
243  return ReturnValue(cpIntegralStdDev, &Algo_t::IntegralStdDev);
244  }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
template<typename AlgoBase >
bool cluster::OverriddenClusterParamsAlg< AlgoBase >::isOverridden ( ParameterType_t  param) const
inline

Returns whether the specified parameter is currently overridden.

Definition at line 131 of file OverriddenClusterParamsAlg.h.

131 { return overridden_set.test((size_t)param); }
std::bitset< NParameters > overridden_set
bits for overriding
template<typename AlgoBase >
float cluster::OverriddenClusterParamsAlg< AlgoBase >::MultipleHitDensity ( )
inlineoverridevirtual

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
See also
Algo_t::MultipleHitDensity()

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 275 of file OverriddenClusterParamsAlg.h.

276  {
277  return ReturnValue(cpMultipleHitDensity, &Algo_t::MultipleHitDensity);
278  }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
template<typename AlgoBase >
size_t cluster::OverriddenClusterParamsAlg< AlgoBase >::NHits ( )
inlineoverridevirtual

Returns the number of hits in the cluster.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 268 of file OverriddenClusterParamsAlg.h.

268 { return ReturnValue(cpNHits, &Algo_t::NHits); }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
static std::logic_error cluster::ClusterParamsAlgBase::NotImplemented ( std::string  function_name)
inlinestaticprotectedinherited

Definition at line 242 of file ClusterParamsAlgBase.h.

243  {
244  return std::logic_error(function_name + "() not implemented.");
245  }
template<typename AlgoBase >
This_t& cluster::OverriddenClusterParamsAlg< AlgoBase >::OverrideParameter ( ParameterType_t  param,
Measure_t  value 
)
inline

Overrides the specified cluster parameter.

Parameters
paramwhich cluster parameter to override
valuethe value of the cluster parameter to be returned
Returns
this object
See also
ReleaseParameter()

For parameters without uncertainty, the uncertainty will be ignored.

Definition at line 111 of file OverriddenClusterParamsAlg.h.

References util::values().

112  {
113  overridden_set.set((size_t)param);
114  values[(size_t)param] = value;
115  return *this;
116  } // OverrideParameter()
std::bitset< NParameters > overridden_set
bits for overriding
std::vector< details::MultiValue > values
the overridden values
double value
Definition: spectrum.C:18
template<typename AlgoBase >
This_t& cluster::OverriddenClusterParamsAlg< AlgoBase >::ReleaseParameter ( ParameterType_t  param)
inline

Cancels the override of the specified cluster parameter.

Parameters
paramwhich cluster parameter not to override any more
Returns
this object
See also
OverrideParameter()

Definition at line 124 of file OverriddenClusterParamsAlg.h.

125  {
126  overridden_set.set((size_t)param);
127  return *this;
128  }
std::bitset< NParameters > overridden_set
bits for overriding
template<typename AlgoBase >
template<typename Func , typename... Args>
auto cluster::OverriddenClusterParamsAlg< AlgoBase >::ReturnValue ( ParameterType_t  param,
Func  func,
Args &&...  args 
) -> decltype((algo.*func)(args...))
inlineprotected

Definition at line 304 of file OverriddenClusterParamsAlg.h.

306  {
307  if (isOverridden(param)) {
308  // convert here to the return type of the function
309  // (even if we are not using that function, it still defines the type)
310  return values[(size_t)param];
311  }
312  else
313  return (algo.*func)(args...);
314  } // ReturnValue()
bool isOverridden(ParameterType_t param) const
Returns whether the specified parameter is currently overridden.
std::vector< details::MultiValue > values
the overridden values
Algo_t algo
an instance of the wrapped algorithm class
template<typename AlgoBase >
void cluster::OverriddenClusterParamsAlg< AlgoBase >::SetHits ( util::GeometryUtilities const &  gser,
std::vector< recob::Hit > const &  hits 
)
inlineoverridevirtual

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)
See also
Algo_t::SetHits().

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 163 of file OverriddenClusterParamsAlg.h.

164  {
165  algo.SetHits(gser, hits);
166  }
Algo_t algo
an instance of the wrapped algorithm class
template<typename AlgoBase >
void cluster::OverriddenClusterParamsAlg< AlgoBase >::SetHitsFromPointers ( util::GeometryUtilities const &  gser,
std::vector< recob::Hit const * > const &  hits 
)
inlineoverridevirtual

Sets the list of input hits.

Parameters
hitslist of pointers to hits
Exceptions
undefinedin case of error, this method can throw (anything)
See also
Algo_t::SetHits().

Implements cluster::ClusterParamsAlgBase.

Definition at line 151 of file OverriddenClusterParamsAlg.h.

153  {
154  algo.SetHitsFromPointers(gser, hits);
155  }
Algo_t algo
an instance of the wrapped algorithm class
template<typename AlgoBase >
void cluster::OverriddenClusterParamsAlg< AlgoBase >::SetVerbose ( int  level = 1)
inlineoverridevirtual

Set the verbosity level;.

See also
Algo_t::SetVerbose().

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 169 of file OverriddenClusterParamsAlg.h.

References cluster::ClusterParamsAlgBase::SetVerbose().

170  {
172  algo.SetVerbose(level);
173  }
virtual void SetVerbose(int level=1)
Set the verbosity level.
Algo_t algo
an instance of the wrapped algorithm class
template<typename AlgoBase >
Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::StartAngle ( )
inlineoverridevirtual

Computes the angle of the cluster.

Returns
angle of the cluster in the wire x time space, in radians
See also
Algo_t::StartAngle(), Algo_t::EndAngle()

The angle is in the $ [ -\pi, \pi ] $ range, with 0 corresponding to a cluster parallel to the wire plane and $ \pi $ to a cluster orthogonal to the wire plane, going farther from it.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 204 of file OverriddenClusterParamsAlg.h.

204 { return ReturnValue(cpStartAngle, &Algo_t::StartAngle); }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
template<typename AlgoBase >
Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::StartCharge ( util::GeometryUtilities const &  gser)
inlineoverridevirtual

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

Returns
the charge in ADC counts, with uncertainty
See also
Algo_t::StartCharge(), Algo_t::EndCharge()

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 184 of file OverriddenClusterParamsAlg.h.

185  {
186  return ReturnValue(cpStartCharge, &Algo_t::StartCharge, gser);
187  }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
template<typename AlgoBase >
Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::StartOpeningAngle ( )
inlineoverridevirtual

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

Returns
angle at the start of the cluster, in radians
See also
Algo_t::StartOpeningAngle(), Algo_t::EndOpeningAngle()

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 215 of file OverriddenClusterParamsAlg.h.

216  {
217  return ReturnValue(cpStartOpeningAngle, &Algo_t::StartOpeningAngle);
218  }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
template<typename AlgoBase >
Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::SummedADC ( )
inlineoverridevirtual

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

Returns
total charge of the cluster, in ADC count units
See also
SummedADCStdDev(), Integral()
Algo_t::SummedADC()

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 252 of file OverriddenClusterParamsAlg.h.

252 { return ReturnValue(cpSummedADC, &Algo_t::SummedADC); }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
template<typename AlgoBase >
Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::SummedADCStdDev ( )
inlineoverridevirtual

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()
Algo_t::SummedADCStdDev()

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 260 of file OverriddenClusterParamsAlg.h.

261  {
262  return ReturnValue(cpSummedADCStdDev, &Algo_t::SummedADCStdDev);
263  }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
template<typename AlgoBase >
float cluster::OverriddenClusterParamsAlg< AlgoBase >::Width ( util::GeometryUtilities const &  gser)
inlineoverridevirtual

Computes the width of the cluster.

Returns
width of the cluster
See also
Algo_t::Width()

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 285 of file OverriddenClusterParamsAlg.h.

286  {
287  return ReturnValue(cpWidth, &Algo_t::Width, gser);
288  }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))

Member Data Documentation

template<typename AlgoBase >
Algo_t cluster::OverriddenClusterParamsAlg< AlgoBase >::algo
protected

an instance of the wrapped algorithm class

Definition at line 298 of file OverriddenClusterParamsAlg.h.

template<typename AlgoBase >
std::bitset<NParameters> cluster::OverriddenClusterParamsAlg< AlgoBase >::overridden_set
protected

bits for overriding

Definition at line 301 of file OverriddenClusterParamsAlg.h.

template<typename AlgoBase >
std::vector<details::MultiValue> cluster::OverriddenClusterParamsAlg< AlgoBase >::values
protected

the overridden values

Definition at line 300 of file OverriddenClusterParamsAlg.h.

int cluster::ClusterParamsAlgBase::verbose = 0
protectedinherited

verbosity level: 0 is normal, negative is even quieter

Definition at line 240 of file ClusterParamsAlgBase.h.


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