LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ClusterParamsImportWrapper.h
Go to the documentation of this file.
1 
10 #ifndef CLUSTERPARAMSARTWRAPPER_H
11 #define CLUSTERPARAMSARTWRAPPER_H
12 
13 // C/C++ standard libraries
14 #include <stdexcept> // std::logic_error
15 #include <utility> // std::forward()
16 
17 
18 // LArSoft libraries
19 #include "lardata/Utilities/Dereference.h" // util::make_pointer()
20 
22 namespace cluster {
23 
36  template <class Algo>
37  class ClusterParamsImportWrapper: public Algo {
38  public:
39  using ClusterParamsAlg_t = Algo;
40 
41 
43  template <typename... Args>
45  ClusterParamsAlg_t(std::forward<Args>(args)...) {}
46 
52 
62  template <typename Iter>
63  void ImportHits(Iter begin, Iter end)
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()
70 
87  template <typename Iter, typename Convert>
88  void ImportHits(Iter begin, Iter end, Convert converter)
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()
97 
98 
107  template <typename Cont>
108  void ImportHits(Cont cont)
109  { ImportHits(std::begin(cont), std::end(cont)); }
110 
126  template <typename Cont, typename Convert>
127  void ImportHits(Cont cont, Convert converter)
128  { ImportHits(std::begin(cont), std::end(cont), converter); }
129 
131 
132  }; //class ClusterParamsImportWrapper
133 
134 
135 } //namespace cluster
136 
137 #endif // CLUSTERPARAMSARTWRAPPER_H
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 ImportHits(Cont cont)
Calls SetHits() with the hits in the sequence.
STL namespace.
Cluster finding and building.
void hits()
Definition: readHits.C:15
void ImportHits(Cont cont, Convert converter)
Calls SetHits() with the result of converted hits.
Wrapper for ClusterParamsAlgBase objects to accept diverse input.
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
std::string value(boost::any const &)
void ImportHits(Iter begin, Iter end, Convert converter)
Calls SetHits() with the result of converted hits.
ClusterParamsImportWrapper(Args...args)
Constructor: just forwards all the stuff to the wrapped class.
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)