LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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 69 of file ClusterParamsImportWrapper.h.

References hits(), lar::util::make_pointer(), and value.

Referenced by lar_cluster3d::Cluster3D::ConvertToArtOutput(), cluster::HoughBaseAlg::FastTransform(), cluster::ClusterCheater::produce(), and cluster::DBcluster::produce().

70  {
71  std::vector<recob::Hit const*> hits;
72  std::transform(begin, end, std::back_inserter(hits), [](auto value) {
74  });
75  ClusterParamsAlg_t::SetHitsFromPointers(gser, hits);
76  } // 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:279
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
void hits()
Definition: readHits.C:15
double value
Definition: spectrum.C:18
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
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 95 of file ClusterParamsImportWrapper.h.

References hits(), lar::util::make_pointer(), and value.

96  {
97  std::vector<recob::Hit const*> hits;
98  std::transform(begin, end, std::back_inserter(hits), [converter](auto value) {
99  return lar::util::make_pointer(converter(value));
100  });
101  ClusterParamsAlg_t::SetHits(hits);
102  } // 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:279
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
void hits()
Definition: readHits.C:15
double value
Definition: spectrum.C:18
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
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 113 of file ClusterParamsImportWrapper.h.

References util::begin(), and util::end().

114  {
115  ImportHits(gser, std::begin(cont), std::end(cont));
116  }
void ImportHits(util::GeometryUtilities const &gser, Iter begin, Iter end)
Calls SetHits() with the hits in the sequence.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
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 134 of file ClusterParamsImportWrapper.h.

References util::begin(), and util::end().

135  {
136  ImportHits(gser, std::begin(cont), std::end(cont), converter);
137  }
void ImportHits(util::GeometryUtilities const &gser, Iter begin, Iter end)
Calls SetHits() with the hits in the sequence.
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69

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