LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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...
 
virtual ~OverriddenClusterParamsAlg ()=default
 Destructor. 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...
 
virtual size_t NHits () override
 Returns the number of hits in the cluster. More...
 
virtual float MultipleHitDensity () override
 Fraction of wires in the cluster with more than one hit. More...
 
virtual float Width () 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.

virtual void Clear () override
 Restores the class to post-configuration, pre-initialization state. More...
 
virtual void SetHits (std::vector< recob::Hit const * > const &hits) override
 Sets the list of input hits. More...
 
virtual void SetHits (std::vector< recob::Hit > const &hits) override
 Sets the list of input hits. More...
 
virtual void SetVerbose (int level=1) override
 Set the verbosity level;. More...
 
Algorithm results
virtual Measure_t StartCharge () override
 Computes the charge on the first and last wire of the track. More...
 
virtual Measure_t EndCharge () override
 Computes the charge on the first and last wire of the track. More...
 
virtual Measure_t StartAngle () override
 Computes the angle of the cluster. More...
 
virtual Measure_t EndAngle () override
 Computes the angle of the cluster. More...
 
virtual Measure_t StartOpeningAngle () override
 Computes the opening angle at the start or end of the cluster. More...
 
virtual Measure_t EndOpeningAngle () override
 Computes the opening angle at the start or end of the cluster. More...
 
Cluster charge
virtual Measure_t Integral () override
 Computes the total charge of the cluster from Hit::Integral() More...
 
virtual Measure_t IntegralStdDev () override
 Computes the standard deviation on the charge of the cluster hits. More...
 
virtual Measure_t SummedADC () override
 Computes the total charge of the cluster from Hit::SummedADC() More...
 
virtual 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 >
auto ReturnValue (ParameterType_t param, Func func) -> decltype((algo.*func)())
 

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 82 of file OverriddenClusterParamsAlg.h.

Member Typedef Documentation

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

Definition at line 88 of file OverriddenClusterParamsAlg.h.

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

Definition at line 90 of file OverriddenClusterParamsAlg.h.

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

Definition at line 303 of file OverriddenClusterParamsAlg.h.

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

Definition at line 89 of file OverriddenClusterParamsAlg.h.

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

Definition at line 302 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 92 of file OverriddenClusterParamsAlg.h.

92  {
93  cpStartAngle,
94  cpEndAngle,
96  cpEndCharge,
99  cpIntegral,
101  cpSummedADC,
103  cpNHits,
105  cpWidth,
106  NParameters
107  } ParameterType_t;

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 111 of file OverriddenClusterParamsAlg.h.

111  :
112  algo(std::forward<Args>(args)...),
114  {}
std::vector< details::MultiValue > values
the overridden values
Algo_t algo
an instance of the wrapped algorithm class
template<typename AlgoBase >
virtual cluster::OverriddenClusterParamsAlg< AlgoBase >::~OverriddenClusterParamsAlg ( )
virtualdefault

Destructor.

Member Function Documentation

template<typename AlgoBase >
virtual 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 162 of file OverriddenClusterParamsAlg.h.

162 { algo.Clear(); }
Algo_t algo
an instance of the wrapped algorithm class
template<typename AlgoBase >
virtual 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 217 of file OverriddenClusterParamsAlg.h.

218  { return ReturnValue(cpEndAngle, &Algo_t::EndAngle); }
auto ReturnValue(ParameterType_t param, Func func) -> decltype((algo.*func)())
template<typename AlgoBase >
virtual Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::EndCharge ( )
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 200 of file OverriddenClusterParamsAlg.h.

201  { return ReturnValue(cpEndCharge, &Algo_t::EndCharge); }
auto ReturnValue(ParameterType_t param, Func func) -> decltype((algo.*func)())
template<typename AlgoBase >
virtual 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 229 of file OverriddenClusterParamsAlg.h.

230  { return ReturnValue(cpEndOpeningAngle, &Algo_t::EndOpeningAngle); }
auto ReturnValue(ParameterType_t param, Func func) -> decltype((algo.*func)())
template<typename AlgoBase >
virtual 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 242 of file OverriddenClusterParamsAlg.h.

243  { return ReturnValue(cpIntegral, &Algo_t::Integral); }
auto ReturnValue(ParameterType_t param, Func func) -> decltype((algo.*func)())
template<typename AlgoBase >
virtual 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 251 of file OverriddenClusterParamsAlg.h.

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

Returns whether the specified parameter is currently overridden.

Definition at line 148 of file OverriddenClusterParamsAlg.h.

149  { return overridden_set.test((size_t) param); }
std::bitset< NParameters > overridden_set
bits for overriding
template<typename AlgoBase >
virtual 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 285 of file OverriddenClusterParamsAlg.h.

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

Returns the number of hits in the cluster.

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 276 of file OverriddenClusterParamsAlg.h.

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

Definition at line 243 of file ClusterParamsAlgBase.h.

244  { return std::logic_error(function_name + "() not implemented."); }
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 129 of file OverriddenClusterParamsAlg.h.

130  {
131  overridden_set.set((size_t) param);
132  values[(size_t) param] = value;
133  return *this;
134  } // OverrideParameter()
std::bitset< NParameters > overridden_set
bits for overriding
std::vector< details::MultiValue > values
the overridden values
std::string value(boost::any const &)
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 143 of file OverriddenClusterParamsAlg.h.

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

Definition at line 311 of file OverriddenClusterParamsAlg.h.

313  {
314  if (isOverridden(param)) {
315  // convert here to the return type of the function
316  // (even if we are not using that function, it still defines the type)
317  return values[(size_t) param];
318  }
319  else
320  return (algo.*func)();
321  } // 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 >
virtual void cluster::OverriddenClusterParamsAlg< AlgoBase >::SetHits ( 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 171 of file OverriddenClusterParamsAlg.h.

172  { algo.SetHits(hits); }
Algo_t algo
an instance of the wrapped algorithm class
template<typename AlgoBase >
virtual void cluster::OverriddenClusterParamsAlg< AlgoBase >::SetHits ( 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 180 of file OverriddenClusterParamsAlg.h.

181  { algo.SetHits(hits); }
Algo_t algo
an instance of the wrapped algorithm class
template<typename AlgoBase >
virtual 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 185 of file OverriddenClusterParamsAlg.h.

References cluster::ClusterParamsAlgBase::SetVerbose().

186  { ClusterParamsAlgBase::SetVerbose(level); algo.SetVerbose(level); }
virtual void SetVerbose(int level=1)
Set the verbosity level.
Algo_t algo
an instance of the wrapped algorithm class
template<typename AlgoBase >
virtual 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 214 of file OverriddenClusterParamsAlg.h.

215  { return ReturnValue(cpStartAngle, &Algo_t::StartAngle); }
auto ReturnValue(ParameterType_t param, Func func) -> decltype((algo.*func)())
template<typename AlgoBase >
virtual Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::StartCharge ( )
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 198 of file OverriddenClusterParamsAlg.h.

199  { return ReturnValue(cpStartCharge, &Algo_t::StartCharge); }
auto ReturnValue(ParameterType_t param, Func func) -> decltype((algo.*func)())
template<typename AlgoBase >
virtual 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 227 of file OverriddenClusterParamsAlg.h.

228  { return ReturnValue(cpStartOpeningAngle, &Algo_t::StartOpeningAngle); }
auto ReturnValue(ParameterType_t param, Func func) -> decltype((algo.*func)())
template<typename AlgoBase >
virtual Measure_t cluster::OverriddenClusterParamsAlg< AlgoBase >::SummedADC ( void  )
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 260 of file OverriddenClusterParamsAlg.h.

261  { return ReturnValue(cpSummedADC, &Algo_t::SummedADC); }
auto ReturnValue(ParameterType_t param, Func func) -> decltype((algo.*func)())
template<typename AlgoBase >
virtual 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 269 of file OverriddenClusterParamsAlg.h.

270  { return ReturnValue(cpSummedADCStdDev, &Algo_t::SummedADCStdDev); }
auto ReturnValue(ParameterType_t param, Func func) -> decltype((algo.*func)())
template<typename AlgoBase >
virtual float cluster::OverriddenClusterParamsAlg< AlgoBase >::Width ( )
inlineoverridevirtual

Computes the width of the cluster.

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

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 293 of file OverriddenClusterParamsAlg.h.

294  { return ReturnValue(cpWidth, &Algo_t::Width); }
auto ReturnValue(ParameterType_t param, Func func) -> decltype((algo.*func)())

Member Data Documentation

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

an instance of the wrapped algorithm class

Definition at line 305 of file OverriddenClusterParamsAlg.h.

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

bits for overriding

Definition at line 308 of file OverriddenClusterParamsAlg.h.

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

the overridden values

Definition at line 307 of file OverriddenClusterParamsAlg.h.

int cluster::ClusterParamsAlgBase::verbose = 0
protectedinherited

verbosity level: 0 is normal, negative is even quieter

Definition at line 241 of file ClusterParamsAlgBase.h.


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