Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
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 Types inherited from cluster::ClusterParamsAlgBase
using Measure_t = details::Measure_t< float >
 Type used to return values with errors. More...
 

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 SetHits (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
 
Measure_t StartAngle () override
 Computes the angle of the cluster. More...
 
Measure_t EndAngle () override
 
Measure_t StartOpeningAngle () override
 Computes the opening angle at the start or end of the cluster. More...
 
Measure_t EndOpeningAngle () override
 
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...
 
- Public Member Functions inherited from cluster::ClusterParamsAlgBase
virtual ~ClusterParamsAlgBase ()=default
 

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...))
 

Protected Attributes

Algo_t algo
 an instance of the wrapped algorithm class More...
 
std::vector< details::MultiValue > values
 the overridden values More...
 
std::bitset< NParametersoverridden_set
 bits for overriding More...
 
- Protected Attributes inherited from cluster::ClusterParamsAlgBase
int verbose = 0
 verbosity level: 0 is normal, negative is even quieter More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from cluster::ClusterParamsAlgBase
static std::logic_error NotImplemented (std::string function_name)
 

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

Member Typedef Documentation

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

Definition at line 76 of file OverriddenClusterParamsAlg.h.

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

Definition at line 78 of file OverriddenClusterParamsAlg.h.

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

Definition at line 338 of file OverriddenClusterParamsAlg.h.

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

Definition at line 77 of file OverriddenClusterParamsAlg.h.

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

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

80  {
81  cpStartAngle, ///< StartAngle()
82  cpEndAngle, ///< EndAngle()
83  cpStartCharge, ///< StartCharge()
84  cpEndCharge, ///< EndCharge()
85  cpStartOpeningAngle, ///< StartOpeningAngle()
86  cpEndOpeningAngle, ///< EndOpeningAngle()
87  cpIntegral, ///< Integral()
88  cpIntegralStdDev, ///< IntegralStdDev()
89  cpSummedADC, ///< SummedADC()
90  cpSummedADCStdDev, ///< SummedADCStdDev()
91  cpNHits, ///< NHits()
92  cpMultipleHitDensity, ///< MultipleHitDensity()
93  cpWidth, ///< Width()
94  NParameters ///< total number of supported parameters
95  }; ///< type of cluster parameters

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

100  : algo(std::forward<Args>(args)...), values(NParameters)
101  {}
std::vector< details::MultiValue > values
the overridden values
static QCString args
Definition: declinfo.cpp:674
Algo_t algo
an instance of the wrapped algorithm class

Member Function Documentation

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

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

See also
Algo_t::Clear()

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 151 of file OverriddenClusterParamsAlg.h.

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

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 227 of file OverriddenClusterParamsAlg.h.

228  {
229  return ReturnValue(cpEndAngle, &Algo_t::EndAngle);
230  }
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

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 204 of file OverriddenClusterParamsAlg.h.

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

Reimplemented from cluster::ClusterParamsAlgBase.

Definition at line 245 of file OverriddenClusterParamsAlg.h.

246  {
247  return ReturnValue(cpEndOpeningAngle, &Algo_t::EndOpeningAngle);
248  }
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 260 of file OverriddenClusterParamsAlg.h.

261  {
262  return ReturnValue(cpIntegral, &Algo_t::Integral);
263  }
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 272 of file OverriddenClusterParamsAlg.h.

273  {
274  return ReturnValue(cpIntegralStdDev, &Algo_t::IntegralStdDev);
275  }
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 135 of file OverriddenClusterParamsAlg.h.

136  {
137  return overridden_set.test((size_t)param);
138  }
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 316 of file OverriddenClusterParamsAlg.h.

317  {
318  return ReturnValue(cpMultipleHitDensity, &Algo_t::MultipleHitDensity);
319  }
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 305 of file OverriddenClusterParamsAlg.h.

306  {
307  return ReturnValue(cpNHits, &Algo_t::NHits);
308  }
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
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 113 of file OverriddenClusterParamsAlg.h.

114  {
115  overridden_set.set((size_t)param);
116  values[(size_t)param] = value;
117  return *this;
118  } // OverrideParameter()
std::bitset< NParameters > overridden_set
bits for overriding
std::vector< details::MultiValue > values
the overridden values
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 127 of file OverriddenClusterParamsAlg.h.

128  {
129  overridden_set.set((size_t)param);
130  return *this;
131  }
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 347 of file OverriddenClusterParamsAlg.h.

348  {
349  if (isOverridden(param)) {
350  // convert here to the return type of the function
351  // (even if we are not using that function, it still defines the type)
352  return values[(size_t)param];
353  }
354  else
355  return (algo.*func)(args...);
356  } // ReturnValue()
bool isOverridden(ParameterType_t param) const
Returns whether the specified parameter is currently overridden.
std::vector< details::MultiValue > values
the overridden values
static QCString args
Definition: declinfo.cpp:674
Algo_t algo
an instance of the wrapped algorithm class
def func()
Definition: docstring.py:7
template<typename AlgoBase >
void cluster::OverriddenClusterParamsAlg< AlgoBase >::SetHits ( 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 163 of file OverriddenClusterParamsAlg.h.

165  {
166  algo.SetHits(gser, hits);
167  }
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 176 of file OverriddenClusterParamsAlg.h.

177  {
178  algo.SetHits(gser, hits);
179  }
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 183 of file OverriddenClusterParamsAlg.h.

184  {
186  algo.SetVerbose(level);
187  }
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 221 of file OverriddenClusterParamsAlg.h.

222  {
223  return ReturnValue(cpStartAngle, &Algo_t::StartAngle);
224  }
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 199 of file OverriddenClusterParamsAlg.h.

200  {
201  return ReturnValue(cpStartCharge, &Algo_t::StartCharge, gser);
202  }
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 240 of file OverriddenClusterParamsAlg.h.

241  {
242  return ReturnValue(cpStartOpeningAngle, &Algo_t::StartOpeningAngle);
243  }
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 284 of file OverriddenClusterParamsAlg.h.

285  {
286  return ReturnValue(cpSummedADC, &Algo_t::SummedADC);
287  }
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 296 of file OverriddenClusterParamsAlg.h.

297  {
298  return ReturnValue(cpSummedADCStdDev, &Algo_t::SummedADCStdDev);
299  }
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 327 of file OverriddenClusterParamsAlg.h.

328  {
329  return ReturnValue(cpWidth, &Algo_t::Width, gser);
330  }
double Width(Resonance_t res)
resonance width (GeV)
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 340 of file OverriddenClusterParamsAlg.h.

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

bits for overriding

Definition at line 343 of file OverriddenClusterParamsAlg.h.

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

the overridden values

Definition at line 342 of file OverriddenClusterParamsAlg.h.


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