LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 (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 (Cont cont)
 Calls SetHits() with the hits in the sequence. More...
 
template<typename Cont , typename Convert >
void ImportHits (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 37 of file ClusterParamsImportWrapper.h.

Member Typedef Documentation

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

type of wrapped class

Definition at line 39 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 44 of file ClusterParamsImportWrapper.h.

44  :
45  ClusterParamsAlg_t(std::forward<Args>(args)...) {}

Member Function Documentation

template<class Algo>
template<typename Iter >
void cluster::ClusterParamsImportWrapper< Algo >::ImportHits ( 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 63 of file ClusterParamsImportWrapper.h.

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

Referenced by lar_cluster3d::Cluster3D::ConvertToArtOutput(), cluster::HoughBaseAlg::FastTransform(), cluster::ClusterParamsImportWrapper< Algo >::ImportHits(), cluster::ClusterCheater::produce(), cluster::DBcluster::produce(), cluster::LineMerger::produce(), cluster::fuzzyCluster::produce(), and cluster::SmallClusterFinder::produce().

64  {
65  std::vector<recob::Hit const*> hits;
66  std::transform(begin, end, std::back_inserter(hits),
67  [](auto value) { return lar::util::make_pointer(value); });
68  ClusterParamsAlg_t::SetHits(hits);
69  } // 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
void hits()
Definition: readHits.C:15
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
std::string value(boost::any const &)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
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 88 of file ClusterParamsImportWrapper.h.

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

89  {
90  std::vector<recob::Hit const*> hits;
91  std::transform(begin, end, std::back_inserter(hits),
92  [converter](auto value)
93  { return lar::util::make_pointer(converter(value)); }
94  );
95  ClusterParamsAlg_t::SetHits(hits);
96  } // 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
void hits()
Definition: readHits.C:15
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
std::string value(boost::any const &)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
template<class Algo>
template<typename Cont >
void cluster::ClusterParamsImportWrapper< Algo >::ImportHits ( 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 108 of file ClusterParamsImportWrapper.h.

References evd::details::begin(), evd::details::end(), and cluster::ClusterParamsImportWrapper< Algo >::ImportHits().

109  { ImportHits(std::begin(cont), std::end(cont)); }
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
void ImportHits(Iter begin, Iter end)
Calls SetHits() with the hits in the sequence.
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
template<class Algo>
template<typename Cont , typename Convert >
void cluster::ClusterParamsImportWrapper< Algo >::ImportHits ( 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 127 of file ClusterParamsImportWrapper.h.

References evd::details::begin(), evd::details::end(), and cluster::ClusterParamsImportWrapper< Algo >::ImportHits().

128  { ImportHits(std::begin(cont), std::end(cont), converter); }
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
void ImportHits(Iter begin, Iter end)
Calls SetHits() with the hits in the sequence.
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)

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