10 #ifndef OVERRIDDENCLUSTERPARAMSALG_H 11 #define OVERRIDDENCLUSTERPARAMSALG_H 15 #include <type_traits> 68 template <
typename AlgoBase>
71 "OverriddenClusterParamsAlg template parameter must derive" 72 " from ClusterParamsAlgBase");
97 template <
typename... Args>
99 : algo(
std::forward<Args>(args)...),
values(NParameters)
113 overridden_set.set((
size_t)param);
114 values[(size_t)param] = value;
126 overridden_set.set((
size_t)param);
143 void Clear()
override { algo.Clear(); }
152 std::vector<recob::Hit const*>
const&
hits)
override 154 algo.SetHitsFromPointers(gser, hits);
165 algo.SetHits(gser, hits);
172 algo.SetVerbose(level);
186 return ReturnValue(cpStartCharge, &Algo_t::StartCharge, gser);
190 return ReturnValue(cpEndCharge, &Algo_t::EndCharge, gser);
217 return ReturnValue(cpStartOpeningAngle, &Algo_t::StartOpeningAngle);
221 return ReturnValue(cpEndOpeningAngle, &Algo_t::EndOpeningAngle);
243 return ReturnValue(cpIntegralStdDev, &Algo_t::IntegralStdDev);
262 return ReturnValue(cpSummedADCStdDev, &Algo_t::SummedADCStdDev);
268 size_t NHits()
override {
return ReturnValue(cpNHits, &Algo_t::NHits); }
277 return ReturnValue(cpMultipleHitDensity, &Algo_t::MultipleHitDensity);
287 return ReturnValue(cpWidth, &Algo_t::Width, gser);
295 using ValueFunction_t = float (
Algo_t::*)();
303 template <
typename Func,
typename... Args>
305 -> decltype((algo.*func)(args...))
307 if (isOverridden(param)) {
310 return values[(size_t)param];
313 return (algo.*func)(args...);
337 MultiValue::operator size_t()
const 351 MultiValue::operator float()
const 373 #endif // OVERRIDDENCLUSTERPARAMSALG_H float Width(util::GeometryUtilities const &gser) override
Computes the width of the cluster.
void SetHits(util::GeometryUtilities const &gser, std::vector< recob::Hit > const &hits) override
Sets the list of input hits.
Measure_t EndCharge(util::GeometryUtilities const &gser) override
Computes the charge on the first and last wire of the track.
std::bitset< NParameters > overridden_set
bits for overriding
bool isOverridden(ParameterType_t param) const
Returns whether the specified parameter is currently overridden.
Measure_t StartCharge(util::GeometryUtilities const &gser) override
Computes the charge on the first and last wire of the track.
std::vector< details::MultiValue > values
the overridden values
Class holding a value of one among some selected types...
Measure_t Integral() override
Computes the total charge of the cluster from Hit::Integral()
virtual void SetVerbose(int level=1)
Set the verbosity level.
Measure_t StartOpeningAngle() override
Computes the opening angle at the start or end of the cluster.
void SetHitsFromPointers(util::GeometryUtilities const &gser, std::vector< recob::Hit const * > const &hits) override
Sets the list of input hits.
Cluster finding and building.
Measure_t StartAngle() override
Computes the angle of the cluster.
Algo_t algo
an instance of the wrapped algorithm class
Measure_t EndAngle() override
Computes the angle of the cluster.
Algorithm collection class computing cluster parameters.
auto ReturnValue(ParameterType_t param, Func func, Args &&...args) -> decltype((algo.*func)(args...))
Measure_t EndOpeningAngle() override
Computes the opening angle at the start or end of the cluster.
float MultipleHitDensity() override
Fraction of wires in the cluster with more than one hit.
size_t NHits() override
Returns the number of hits in the cluster.
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
Measure_t IntegralStdDev() override
Computes the standard deviation on the charge of the cluster hits.
This_t & ReleaseParameter(ParameterType_t param)
Cancels the override of the specified cluster parameter.
cluster::details::Measure_t< float > Measure_t
MultiValue & operator=(T)
Sets the value from a value of type T; undefined by default.
OverriddenClusterParamsAlg(Args &&...args)
Constructor; just forwards the arguments to the base class.
Interface for a algorithm class computing cluster parameters.
Measure_t SummedADC() override
Computes the total charge of the cluster from Hit::SummedADC()
void SetVerbose(int level=1) override
Set the verbosity level;.
Algorithm collection class computing cluster parameters.
Measure_t SummedADCStdDev() override
Computes the standard deviation on the charge of the cluster hits.
void Clear() override
Restores the class to post-configuration, pre-initialization state.
This_t & OverrideParameter(ParameterType_t param, Measure_t value)
Overrides the specified cluster parameter.