LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
OneTo01DataProxyMaker.h
Go to the documentation of this file.
1 
11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_ONETO01DATAPROXYMAKER_H
12 #define LARDATA_RECOBASEPROXY_PROXYBASE_ONETO01DATAPROXYMAKER_H
13 
14 // LArSoft libraries
17 
18 // framework libraries
20 
21 // C/C++ standard libraries
22 #include <type_traits> // std::is_convertible<>
23 #include <utility> // std::forward()
24 
25 namespace proxy {
26 
27  // --- BEGIN LArSoftProxiesAssociatedData ------------------------------------
30 
31  //----------------------------------------------------------------------------
32  //--- one-to-(zero/one) associations
33  //----------------------------------------------------------------------------
48  template <typename Main, typename Aux, typename Metadata = void, typename AuxTag = Aux>
50 
52  using data_tag = AuxTag;
53 
55  using main_element_t = Main;
56 
58  using aux_element_t = Aux;
59 
61  using metadata_t = Metadata;
62 
66 
69 
88  template <typename Event, typename Handle, typename MainArgs>
89  static auto make(Event const& event, Handle&& mainHandle, MainArgs const& mainArgs)
90  {
91  return createFromTag(event, std::forward<Handle>(mainHandle), art::InputTag(mainArgs));
92  }
93 
108  template <typename Event, typename Handle, typename MainArgs>
109  static auto make(Event const& event,
110  Handle&& mainHandle,
111  MainArgs const&,
112  art::InputTag const& auxInputTag)
113  {
114  return createFromTag(event, std::forward<Handle>(mainHandle), auxInputTag);
115  }
116 
130  template <typename Event, typename Handle, typename MainArgs, typename Assns>
131  static auto make(Event const&, Handle&& handle, MainArgs const&, Assns const& assns)
132  {
133  static_assert(std::is_convertible<typename Assns::right_t, aux_element_t>(),
134  "Improper right type for one-to-(zero-or-one) association.");
135  return makeOneTo01dataFrom<data_tag>(assns, handle->size());
136  }
137 
138  private:
139  template <typename Event, typename Handle>
140  static auto createFromTag(Event const& event,
141  Handle&& mainHandle,
142  art::InputTag const& auxInputTag)
143  {
144  return makeOneTo01dataFrom<main_element_t, aux_element_t, metadata_t, data_tag>(
145  event, auxInputTag, mainHandle->size());
146  }
147 
148  }; // struct OneTo01DataProxyMakerBase<>
149 
150  //--------------------------------------------------------------------------
184  template <typename Main, typename Aux, typename Metadata, typename CollProxy, typename Tag = Aux>
185  class OneTo01DataProxyMaker : public OneTo01DataProxyMakerBase<Main, Aux, Metadata, Tag> {
186  //
187  // Note that this implementation is here only to document how to derive
188  // a OneTo01DataProxyMaker (specialization) from
189  // OneTo01DataProxyMakerBase. It's just mirroring the base class.
190  //
192 
193  public:
195  using typename base_t::main_element_t;
196 
198  using typename base_t::aux_element_t;
199 
201  using typename base_t::metadata_t;
202 
204  using typename base_t::aux_collection_proxy_t;
205 
207  using typename base_t::assns_t;
208 
229  template <typename Event, typename Handle, typename MainArgs, typename... Args>
230  static auto make(Event const& event, Handle&& mainHandle, MainArgs const& margs, Args&&... args)
231  {
232  return base_t::make(
233  event, std::forward<Handle>(mainHandle), margs, std::forward<Args>(args)...);
234  }
235 
236  }; // struct OneTo01DataProxyMaker<>
237 
239  // --- END LArSoftProxiesAssociatedData --------------------------------------
240 
241  namespace details {
242 
243  //--------------------------------------------------------------------------
244  //--- Stuff for one-to-(zero or one) associated data
245  //--------------------------------------------------------------------------
246  template <typename Aux, typename Metadata /* = void */, typename AuxTag /* = Aux */
247  >
249  template <typename CollProxy>
250  using maker_t =
252  };
253 
254  } // namespace details
255 
256 } // namespace proxy
257 
258 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_ONETO01DATAPROXYMAKER_H
static auto make(Event const &event, Handle &&mainHandle, MainArgs const &mainArgs)
Create a association proxy collection using main collection tag.
static auto make(Event const &, Handle &&handle, MainArgs const &, Assns const &assns)
Create a association proxy collection using the specified tag.
art::Assns< main_t, aux_t > assns_t
Type of the source association.
Definition: OneTo01Data.h:94
std::unique_ptr< InputSource > make(fhicl::ParameterSet const &conf, InputSourceDescription &desc)
static auto createFromTag(Event const &event, Handle &&mainHandle, art::InputTag const &auxInputTag)
Auxiliary data from one-to-(zero-or-one) sequential association.
Aux aux_element_t
Type of the auxiliary associated datum ("right").
static auto make(Event const &event, Handle &&mainHandle, MainArgs const &, art::InputTag const &auxInputTag)
Create a association proxy collection using the specified tag.
Creates an one-to-(zero-or-one) wrapper for the specified types.
Object for one-to-zero/or/one associated data interface.
Definition: OneTo01Data.h:68
static auto make(Event const &event, Handle &&mainHandle, MainArgs const &margs, Args &&...args)
Create a association proxy collection using main collection tag.
Encloses LArSoft data product proxy objects and utilities.See this doxygen module for an introduction...
typename aux_collection_proxy_t::assns_t assns_t
Type of art association being used as input.
Helper functions to create data structures associated to a proxy.
Tag data_tag
Tag labelling the associated data we are going to produce.
Creates an one-to-(zero-or-one) wrapper for the specified types.
Event finding and building.