10 #ifndef OVERRIDDENCLUSTERPARAMSALG_H 11 #define OVERRIDDENCLUSTERPARAMSALG_H 16 #include <type_traits> 81 template <
typename AlgoBase>
84 "OverriddenClusterParamsAlg template parameter must derive" 85 " from ClusterParamsAlgBase" 110 template <
typename... Args>
112 algo(
std::forward<Args>(args)...),
131 overridden_set.set((
size_t) param);
132 values[(size_t) param] = value;
144 { overridden_set.set((
size_t) param);
return *
this; }
149 {
return overridden_set.test((
size_t) param); }
162 virtual void Clear()
override { algo.Clear(); }
171 virtual void SetHits(std::vector<recob::Hit const*>
const&
hits)
override 172 { algo.SetHits(hits); }
180 virtual void SetHits(std::vector<recob::Hit>
const&
hits)
override 181 { algo.SetHits(hits); }
199 {
return ReturnValue(cpStartCharge, &Algo_t::StartCharge); }
201 {
return ReturnValue(cpEndCharge, &Algo_t::EndCharge); }
215 {
return ReturnValue(cpStartAngle, &Algo_t::StartAngle); }
218 {
return ReturnValue(cpEndAngle, &Algo_t::EndAngle); }
228 {
return ReturnValue(cpStartOpeningAngle, &Algo_t::StartOpeningAngle); }
230 {
return ReturnValue(cpEndOpeningAngle, &Algo_t::EndOpeningAngle); }
243 {
return ReturnValue(cpIntegral, &Algo_t::Integral); }
252 {
return ReturnValue(cpIntegralStdDev, &Algo_t::IntegralStdDev); }
261 {
return ReturnValue(cpSummedADC, &Algo_t::SummedADC); }
270 {
return ReturnValue(cpSummedADCStdDev, &Algo_t::SummedADCStdDev); }
277 {
return ReturnValue(cpNHits, &Algo_t::NHits); }
286 {
return ReturnValue(cpMultipleHitDensity, &Algo_t::MultipleHitDensity); }
294 {
return ReturnValue(cpWidth, &Algo_t::Width); }
302 using ValueFunction_t = float (
Algo_t::*) ();
310 template <
typename Func>
312 -> decltype((algo.*func)())
314 if (isOverridden(param)) {
317 return values[(size_t) param];
320 return (algo.*func)();
343 MultiValue::operator size_t ()
const {
return size_t_value; }
351 MultiValue::operator float ()
const {
return float_value; }
366 #endif // OVERRIDDENCLUSTERPARAMSALG_H virtual Measure_t EndAngle() override
Computes the angle of the cluster.
virtual void SetVerbose(int level=1) override
Set the verbosity level;.
std::bitset< NParameters > overridden_set
bits for overriding
bool isOverridden(ParameterType_t param) const
Returns whether the specified parameter is currently overridden.
virtual Measure_t StartOpeningAngle() override
Computes the opening angle at the start or end of the cluster.
virtual Measure_t SummedADCStdDev() override
Computes the standard deviation on the charge of the cluster hits.
virtual Measure_t IntegralStdDev() override
Computes the standard deviation on the charge of the cluster hits.
std::vector< details::MultiValue > values
the overridden values
Class holding a value of one among some selected types...
virtual void SetVerbose(int level=1)
Set the verbosity level.
virtual void Clear() override
Restores the class to post-configuration, pre-initialization state.
Cluster finding and building.
virtual float Width() override
Computes the width of the cluster.
Algo_t algo
an instance of the wrapped algorithm class
virtual Measure_t StartCharge() override
Computes the charge on the first and last wire of the track.
Algorithm collection class computing cluster parameters.
virtual Measure_t StartAngle() override
Computes the angle of the cluster.
auto ReturnValue(ParameterType_t param, Func func) -> decltype((algo.*func)())
virtual Measure_t SummedADC() override
Computes the total charge of the cluster from Hit::SummedADC()
virtual void SetHits(std::vector< recob::Hit > const &hits) override
Sets the list of input hits.
This_t & ReleaseParameter(ParameterType_t param)
Cancels the override of the specified cluster parameter.
virtual void SetHits(std::vector< recob::Hit const * > const &hits) override
Sets the list of input hits.
cluster::details::Measure_t< float > Measure_t
MultiValue & operator=(T)
Sets the value from a value of type T; undefined by default.
std::string value(boost::any const &)
OverriddenClusterParamsAlg(Args &&...args)
Constructor; just forwards the arguments to the base class.
Interface for a algorithm class computing cluster parameters.
virtual size_t NHits() override
Returns the number of hits in the cluster.
virtual Measure_t EndCharge() override
Computes the charge on the first and last wire of the track.
virtual Measure_t EndOpeningAngle() override
Computes the opening angle at the start or end of the cluster.
virtual float MultipleHitDensity() override
Fraction of wires in the cluster with more than one hit.
virtual Measure_t Integral() override
Computes the total charge of the cluster from Hit::Integral()
Algorithm collection class computing cluster parameters.
This_t & OverrideParameter(ParameterType_t param, Measure_t value)
Overrides the specified cluster parameter.