LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ParallelDataProxyMaker.h
Go to the documentation of this file.
1 
11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_PARALLELDATAPROXYMAKER_H
12 #define LARDATA_RECOBASEPROXY_PROXYBASE_PARALLELDATAPROXYMAKER_H
13 
14 // LArSoft libraries
15 #include "larcorealg/CoreUtils/ContainerMeta.h" // util::collection_value_t, ...
18 
19 // framework libraries
21 
22 // C/C++ standard
23 #include <utility> // std::forward()
24 #include <vector>
25 
26 namespace proxy {
27 
28  // -- BEGIN Parallel data infrastructure -------------------------------------
60  template <typename Main,
61  typename AuxColl,
62  typename Aux,
63  typename AuxTag = util::collection_value_t<AuxColl>>
65 
67  using data_tag = AuxTag;
68 
70  using main_element_t = Main;
71 
73  using aux_collection_t = AuxColl;
74 
76  using aux_element_t = Aux;
77 
80 
99  template <typename Event, typename Handle, typename MainArgs>
100  static auto make(Event const& event, Handle&& mainHandle, MainArgs const& mainArgs)
101  {
102  return createFromTag(event, std::forward<Handle>(mainHandle), art::InputTag(mainArgs));
103  }
104 
119  template <typename Event, typename Handle, typename MainArgs>
120  static auto make(Event const& event,
121  Handle&& mainHandle,
122  MainArgs const&,
123  art::InputTag const& auxInputTag)
124  {
125  return createFromTag(event, std::forward<Handle>(mainHandle), auxInputTag);
126  }
127 
140  template <typename Event, typename Handle, typename MainArgs>
141  static auto make(Event const&, Handle&&, MainArgs const&, aux_collection_t const& auxColl)
142  {
143  return makeParallelDataFrom<aux_collection_t, aux_element_t, data_tag>(auxColl);
144  }
145 
146  private:
147  template <typename Event, typename Handle>
148  static auto createFromTag(Event const& event, Handle&&, art::InputTag const& auxInputTag)
149  {
150  return makeParallelDataFrom<aux_collection_t, aux_element_t, data_tag>(event, auxInputTag);
151  }
152 
153  }; // struct ParallelDataProxyMakerBase<>
154 
155  //--------------------------------------------------------------------------
188  template <typename Main,
189  typename Aux,
190  typename CollProxy,
191  typename Tag = Aux,
192  typename AuxColl = std::vector<Aux>>
193  class ParallelDataProxyMaker : public ParallelDataProxyMakerBase<Main, AuxColl, Aux, Tag> {
194  //
195  // Note that this implementation is here only to document how to derive
196  // a ParallelDataProxyMaker (specialization) from
197  // ParallelDataProxyMakerBase. It's just mirroring the base class.
198  //
200 
201  public:
203  using typename base_t::main_element_t;
204 
206  using typename base_t::aux_collection_t;
207 
209  using typename base_t::aux_element_t;
210 
212  using typename base_t::aux_collection_proxy_t;
213 
234  template <typename Event, typename Handle, typename MainArgs, typename... Args>
235  static auto make(Event const& event, Handle&& mainHandle, MainArgs const& margs, Args&&... args)
236  {
237  return base_t::make(
238  event, std::forward<Handle>(mainHandle), margs, std::forward<Args>(args)...);
239  }
240 
241  }; // struct ParallelDataProxyMaker<>
242 
244  // -- END Parallel data infrastructure ---------------------------------------
245 
246  //----------------------------------------------------------------------------
247  namespace details {
248 
249  //--------------------------------------------------------------------------
250  //--- stuff for parallel data collection (a form of auxiliary data)
251  //--------------------------------------------------------------------------
252  template <typename Aux, typename AuxTag, typename AuxColl = void>
254  template <typename CollProxy>
255  using maker_t =
257  }; // struct ParallelDataProxyMakerWrapper<Aux, AuxTag, AuxColl>
258 
259  template <typename Aux, typename AuxTag>
260  struct ParallelDataProxyMakerWrapper<Aux, AuxTag, void> {
261  template <typename CollProxy>
262  using maker_t =
264  }; // struct ParallelDataProxyMakerWrapper<Aux, AuxTag>
265 
266  } // namespace details
267 
268 } // namespace proxy
269 
270 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_PARALLELDATAPROXYMAKER_H
Object to draft parallel data interface.
Definition: ParallelData.h:74
Helper functions to create proxy::ParallelData objects.
std::unique_ptr< InputSource > make(fhicl::ParameterSet const &conf, InputSourceDescription &desc)
Creates an associated data wrapper for the specified types.
static auto make(Event const &, Handle &&, MainArgs const &, aux_collection_t const &auxColl)
Create a parallel data proxy collection using the specified tag.
static auto make(Event const &event, Handle &&mainHandle, MainArgs const &margs, Args &&...args)
Create a association proxy collection using main collection tag.
Auxiliary data from parallel data products.
AuxColl aux_collection_t
Type of the auxiliary data product.
Encloses LArSoft data product proxy objects and utilities.See this doxygen module for an introduction...
Creates an parallel data wrapper for the specified types.
static auto createFromTag(Event const &event, Handle &&, art::InputTag const &auxInputTag)
Tag data_tag
Tag labelling the associated data we are going to produce.
static auto make(Event const &event, Handle &&mainHandle, MainArgs const &mainArgs)
Create a parallel data proxy collection using main collection tag.
static auto make(Event const &event, Handle &&mainHandle, MainArgs const &, art::InputTag const &auxInputTag)
Create a parallel data proxy collection using the specified tag.
typename collection_value_type< Coll >::type collection_value_t
Type contained in the collection Coll.
Definition: ContainerMeta.h:62
C++ metaprogramming utilities for dealing with containers.
Event finding and building.