All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | List of all members
cluster::ClusterParamsImportWrapper< Algo > Class Template Reference

Wrapper for ClusterParamsAlgBase objects to accept diverse input. More...

#include <ClusterParamsImportWrapper.h>

Inheritance diagram for cluster::ClusterParamsImportWrapper< Algo >:

Public Types

using ClusterParamsAlg_t = Algo
 type of wrapped class More...
 

Public Member Functions

template<typename... Args>
 ClusterParamsImportWrapper (Args...args)
 Constructor: just forwards all the stuff to the wrapped class. More...
 
Hit import functions

Methods to import hits int the algorithm.

template<typename Iter >
void ImportHits (util::GeometryUtilities const &gser, Iter begin, Iter end)
 Calls SetHits() with the hits in the sequence. More...
 
template<typename Iter , typename Convert >
void ImportHits (Iter begin, Iter end, Convert converter)
 Calls SetHits() with the result of converted hits. More...
 
template<typename Cont >
void ImportHits (util::GeometryUtilities const &gser, Cont cont)
 Calls SetHits() with the hits in the sequence. More...
 
template<typename Cont , typename Convert >
void ImportHits (util::GeometryUtilities const &gser, Cont cont, Convert converter)
 Calls SetHits() with the result of converted hits. More...
 

Detailed Description

template<class Algo>
class cluster::ClusterParamsImportWrapper< Algo >

Wrapper for ClusterParamsAlgBase objects to accept diverse input.

Template Parameters
Algothe ClusterParamsAlgBase-derived class to be wrapped
See Also
ClusterParamsAlgBase

This simple wrapper class adds a non-virtual ImportHits() method that can import Hits from different formats than std::vector<recob::Hit const*>.

This also allows the algorithms derived from ClusterParamsAlgBase to stay framework-agnostic.

Definition at line 44 of file ClusterParamsImportWrapper.h.

Member Typedef Documentation

template<class Algo>
using cluster::ClusterParamsImportWrapper< Algo >::ClusterParamsAlg_t = Algo

type of wrapped class

Definition at line 46 of file ClusterParamsImportWrapper.h.

Constructor & Destructor Documentation

template<class Algo>
template<typename... Args>
cluster::ClusterParamsImportWrapper< Algo >::ClusterParamsImportWrapper ( Args...  args)
inline

Constructor: just forwards all the stuff to the wrapped class.

Definition at line 50 of file ClusterParamsImportWrapper.h.

50  : ClusterParamsAlg_t(std::forward<Args>(args)...)
51  {}

Member Function Documentation

template<class Algo>
template<typename Iter >
void cluster::ClusterParamsImportWrapper< Algo >::ImportHits ( util::GeometryUtilities const &  gser,
Iter  begin,
Iter  end 
)
inline

Calls SetHits() with the hits in the sequence.

Template Parameters
Itertype of iterator to source hits
Parameters
beginiterator to the first hit source
enditerator to after-the-last hit source

The type in the sequence should contain either recob::Hit or some sort of pointer to it.

Definition at line 70 of file ClusterParamsImportWrapper.h.

71  {
72  std::vector<recob::Hit const*> hits;
73  std::transform(begin, end, std::back_inserter(hits), [](auto value) {
75  });
76  ClusterParamsAlg_t::SetHits(gser, hits);
77  } // ImportHits()
details::make_pointer_class< T, details::has_dereference_class< T >::value >::pointer_type make_pointer(T &v)
Returns a pointer to the value of argument, or the argument itself.
Definition: Dereference.h:293
static constexpr Sample_t transform(Sample_t sample)
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573
temporary value
template<class Algo>
template<typename Iter , typename Convert >
void cluster::ClusterParamsImportWrapper< Algo >::ImportHits ( Iter  begin,
Iter  end,
Convert  converter 
)
inline

Calls SetHits() with the result of converted hits.

Template Parameters
Itertype of iterator to source hits
Converttype of operation to convert to recob::Hit const*
Parameters
beginiterator to the first hit source
enditerator to after-the-last hit source
converterpredicate to convert the pointed values to recob::Hit

The converter should respect either of the forms:

recob::Hit converter(typename Iter::value_type)
recob::Hit const* converter(typename Iter::value_type)

The hit produced by the converter will be moved into a vector, and the complete vector will be used to initialize the algorithm.

Definition at line 97 of file ClusterParamsImportWrapper.h.

98  {
99  std::vector<recob::Hit const*> hits;
100  std::transform(begin, end, std::back_inserter(hits), [converter](auto value) {
101  return lar::util::make_pointer(converter(value));
102  });
103  ClusterParamsAlg_t::SetHits(hits);
104  } // ImportHits()
details::make_pointer_class< T, details::has_dereference_class< T >::value >::pointer_type make_pointer(T &v)
Returns a pointer to the value of argument, or the argument itself.
Definition: Dereference.h:293
static constexpr Sample_t transform(Sample_t sample)
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573
temporary value
template<class Algo>
template<typename Cont >
void cluster::ClusterParamsImportWrapper< Algo >::ImportHits ( util::GeometryUtilities const &  gser,
Cont  cont 
)
inline

Calls SetHits() with the hits in the sequence.

Template Parameters
Conttype of container to source hits
Parameters
contcontainer of source hits

The type in the container should contain either recob::Hit or some sort of pointer to it.

Definition at line 116 of file ClusterParamsImportWrapper.h.

117  {
118  ImportHits(gser, std::begin(cont), std::end(cont));
119  }
void ImportHits(util::GeometryUtilities const &gser, Iter begin, Iter end)
Calls SetHits() with the hits in the sequence.
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573
template<class Algo>
template<typename Cont , typename Convert >
void cluster::ClusterParamsImportWrapper< Algo >::ImportHits ( util::GeometryUtilities const &  gser,
Cont  cont,
Convert  converter 
)
inline

Calls SetHits() with the result of converted hits.

Template Parameters
Conttype of container to source hits
Converttype of operation to convert to recob::Hit const*
Parameters
contcontainer of source hits
converterpredicate to convert the pointed values to recob::Hit

The converter should respect either of the forms:

recob::Hit converter(typename Iter::value_type)
recob::Hit const* converter(typename Iter::value_type)

The hit produced by the converter will be moved into a vector, and the complete vector will be used to initialize the algorithm.

Definition at line 138 of file ClusterParamsImportWrapper.h.

139  {
140  ImportHits(gser, std::begin(cont), std::end(cont), converter);
141  }
void ImportHits(util::GeometryUtilities const &gser, Iter begin, Iter end)
Calls SetHits() with the hits in the sequence.
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573

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