All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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::MultiValuevalues
 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 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 337 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 336 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, ///< StartAngle()
81  cpEndAngle, ///< EndAngle()
82  cpStartCharge, ///< StartCharge()
83  cpEndCharge, ///< EndCharge()
84  cpStartOpeningAngle, ///< StartOpeningAngle()
85  cpEndOpeningAngle, ///< EndOpeningAngle()
86  cpIntegral, ///< Integral()
87  cpIntegralStdDev, ///< IntegralStdDev()
88  cpSummedADC, ///< SummedADC()
89  cpSummedADCStdDev, ///< SummedADCStdDev()
90  cpNHits, ///< NHits()
91  cpMultipleHitDensity, ///< MultipleHitDensity()
92  cpWidth, ///< Width()
93  NParameters ///< total number of supported parameters
94  }; ///< 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 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 150 of file OverriddenClusterParamsAlg.h.

151  {
152  algo.Clear();
153  }
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 226 of file OverriddenClusterParamsAlg.h.

227  {
228  return ReturnValue(cpEndAngle, &Algo_t::EndAngle);
229  }
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 203 of file OverriddenClusterParamsAlg.h.

204  {
205  return ReturnValue(cpEndCharge, &Algo_t::EndCharge, gser);
206  }
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 244 of file OverriddenClusterParamsAlg.h.

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

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

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

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

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

305  {
306  return ReturnValue(cpNHits, &Algo_t::NHits);
307  }
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 112 of file OverriddenClusterParamsAlg.h.

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

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

347  {
348  if (isOverridden(param)) {
349  // convert here to the return type of the function
350  // (even if we are not using that function, it still defines the type)
351  return values[(size_t)param];
352  }
353  else
354  return (algo.*func)(args...);
355  } // 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 * > 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 162 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 >::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 175 of file OverriddenClusterParamsAlg.h.

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

183  {
185  algo.SetVerbose(level);
186  }
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 220 of file OverriddenClusterParamsAlg.h.

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

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

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

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

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

327  {
328  return ReturnValue(cpWidth, &Algo_t::Width, gser);
329  }
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 339 of file OverriddenClusterParamsAlg.h.

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

bits for overriding

Definition at line 342 of file OverriddenClusterParamsAlg.h.

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

the overridden values

Definition at line 341 of file OverriddenClusterParamsAlg.h.


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