LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
makeOneTo01dataFrom.h
Go to the documentation of this file.
1 
11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_MAKEONETO01DATAFROM_H
12 #define LARDATA_RECOBASEPROXY_PROXYBASE_MAKEONETO01DATAFROM_H
13 
14 // LArSoft libraries
16 #include "larcorealg/CoreUtils/ContainerMeta.h" // util::collection_value_t
17 
18 // framework libraries
20 
21 // C/C++ standard libraries
22 #include <utility> // std::forward()
23 #include <cstdlib> // std::size_t
24 
25 
26 namespace proxy {
27 
28  // --- BEGIN LArSoftProxiesAssociatedData ------------------------------------
31 
32  //----------------------------------------------------------------------------
33  //--- one-to-(zero/one) associations
34  //----------------------------------------------------------------------------
66  template <typename Tag, typename Assns>
67  auto makeOneTo01dataFrom(Assns const& assns, std::size_t minSize = 0)
68  { return proxy::makeOneTo01data<Tag>(assns, minSize); }
69 
70  template <typename Assns>
71  auto makeOneTo01dataFrom(Assns const& assns, std::size_t minSize = 0)
72  { return proxy::makeOneTo01data(assns, minSize); }
73 
95  template <
96  typename Main, typename Aux, typename Metadata, typename Tag, typename Event
97  >
99  (Event const& event, art::InputTag const& tag, std::size_t minSize = 0);
100 
101  template <typename Main, typename Aux, typename Metadata, typename Event>
103  (Event const& event, art::InputTag const& tag, std::size_t minSize = 0)
104  {
105  return makeOneTo01dataFrom<Main, Aux, Metadata, Aux, Event>
106  (event, tag, minSize);
107  }
108 
133  template <
134  typename Aux, typename Metadata, typename Tag,
135  typename Handle, typename Event
136  >
138  (Handle&& handle, Event const& event, art::InputTag const& tag);
139 
140  template <typename Aux, typename Metadata, typename Handle, typename Event>
142  (Handle&& handle, Event const& event, art::InputTag const& tag)
143  {
144  return makeOneTo01dataFrom<Aux, Metadata, Aux, Handle, Event>
145  (std::forward<Handle>(handle), event, tag);
146  }
147 
148 
163  template <typename Tag, typename MainColl, typename Assns>
164  auto makeOneTo01dataFrom(MainColl const& mainColl, Assns const& assns)
165  { return proxy::makeOneTo01data<Tag>(assns, mainColl.size()); }
166 
167  template <typename MainColl, typename Assns>
168  auto makeOneTo01dataFrom(MainColl const& mainColl, Assns const& assns)
169  { return proxy::makeOneTo01data<typename Assns::right_t>(mainColl, assns); }
170 
171 
173  // --- END LArSoftProxiesAssociatedData --------------------------------------
174 
175 
176 } // namespace proxy
177 
178 
179 //------------------------------------------------------------------------------
180 //--- template implementation
181 //------------------------------------------------------------------------------
182 namespace proxy {
183 
184  //----------------------------------------------------------------------------
185  //--- makeOneTo01dataFrom() implementations
186  //----------------------------------------------------------------------------
187  template <
188  typename Main, typename Aux, typename Metadata,
189  typename Tag,
190  typename Event
191  >
193  Event const& event, art::InputTag const& tag, std::size_t minSize /* = 0 */
194  )
195  {
196  using Main_t = Main;
197  using Aux_t = Aux;
198  using Metadata_t = Metadata;
199  using AssociatedData_t
201  using Assns_t = typename AssociatedData_t::assns_t;
202 
203  return makeOneTo01dataFrom<Tag>
204  (*(event.template getValidHandle<Assns_t>(tag)), minSize);
205 
206  } // makeOneTo01dataFrom(tag)
207 
208 
209  //----------------------------------------------------------------------------
210  template <
211  typename Aux, typename Metadata,
212  typename Tag,
213  typename Handle, typename Event
214  >
216  (Handle&& handle, Event const& event, art::InputTag const& tag)
217  {
218  // Handle::value_type is the main data product type (a collection)
220  using Aux_t = Aux;
221  using Metadata_t = Metadata;
222  return makeOneTo01dataFrom<Main_t, Aux_t, Metadata_t, Tag>
223  (event, tag, handle->size());
224  } // makeOneTo01dataFrom(handle)
225 
226 
227  //----------------------------------------------------------------------------
228 
229 } // namespace proxy
230 
231 
232 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_MAKEONETO01DATAFROM_H
auto makeOneTo01dataFrom(Assns const &assns, std::size_t minSize=0)
Processes and returns an one-to-(zero/one) associated data object.
auto makeOneTo01data(Assns const &assns, std::size_t minSize=0)
Processes and returns an one-to-(zero/one) associated data object.
Definition: OneTo01Data.h:270
Auxiliary data from one-to-(zero-or-one) sequential association.
Object for one-to-zero/or/one associated data interface.
Definition: OneTo01Data.h:71
Encloses LArSoft data product proxy objects and utilities.See this doxygen module for an introduction...
typename collection_value_type< Coll >::type collection_value_t
Type contained in the collection Coll.
Definition: ContainerMeta.h:65
C++ metaprogramming utilities for dealing with containers.
Event finding and building.