LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT > Class Template Reference

#include "IPRHelper.h"

Public Types

typedef std::shared_ptr< art::Exception const > shared_exception_t
 

Public Member Functions

 IPRHelper (EVENT const &e, InputTag const &tag)
 
template<typename Acoll , typename Bcoll >
shared_exception_t operator() (Acoll const &aColl, Bcoll &bColl) const
 
template<typename Acoll , typename Bcoll >
shared_exception_t operator() (Acoll const &aColl, Bcoll &bColl, dataColl_t &dColl) const
 
template<typename Acoll , typename Bcoll >
auto operator() (Acoll const &aColl, Bcoll &bColl) const -> shared_exception_t
 
template<typename Acoll , typename Bcoll >
auto operator() (Acoll const &aColl, Bcoll &bColl, dataColl_t &dColl) const -> shared_exception_t
 

Private Types

typedef std::conditional_t< std::is_void< Data >::value, IPRHelperDef, DATACOLL > dataColl_t
 

Private Attributes

EVENT const & event_
 
InputTag const assnsTag_
 

Detailed Description

template<typename ProdA, typename ProdB, typename Data, typename DATACOLL, typename EVENT>
class art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >

Definition at line 48 of file IPRHelper.h.

Member Typedef Documentation

template<typename ProdA , typename ProdB , typename Data , typename DATACOLL , typename EVENT >
typedef std::conditional_t<std::is_void<Data>::value, IPRHelperDef, DATACOLL> art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >::dataColl_t
private

Definition at line 129 of file IPRHelper.h.

template<typename ProdA , typename ProdB , typename Data , typename DATACOLL , typename EVENT >
typedef std::shared_ptr<art::Exception const> art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >::shared_exception_t

Definition at line 132 of file IPRHelper.h.

Constructor & Destructor Documentation

template<typename ProdA , typename ProdB , typename Data , typename DATACOLL , typename EVENT >
art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >::IPRHelper ( EVENT const &  e,
InputTag const &  tag 
)
inline

Definition at line 134 of file IPRHelper.h.

134 : event_(e), assnsTag_(tag) {}
InputTag const assnsTag_
Definition: IPRHelper.h:154
EVENT const & event_
Definition: IPRHelper.h:153
Float_t e
Definition: plot.C:34

Member Function Documentation

template<typename ProdA , typename ProdB , typename Data , typename DATACOLL , typename EVENT >
template<typename Acoll , typename Bcoll >
shared_exception_t art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >::operator() ( Acoll const &  aColl,
Bcoll &  bColl 
) const
template<typename ProdA , typename ProdB , typename Data , typename DATACOLL , typename EVENT >
template<typename Acoll , typename Bcoll >
shared_exception_t art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >::operator() ( Acoll const &  aColl,
Bcoll &  bColl,
dataColl_t dColl 
) const
template<typename ProdA , typename ProdB , typename Data , typename DATACOLL , typename EVENT >
template<typename Acoll , typename Bcoll >
auto art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >::operator() ( Acoll const &  aColl,
Bcoll &  bColl 
) const -> shared_exception_t
inline

Definition at line 165 of file IPRHelper.h.

References art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >::operator()().

168 {
169  IPRHelperDef dummy;
170  return (*this)(aColl, bColl, dummy);
171 }
template<typename ProdA , typename ProdB , typename Data , typename DATACOLL , typename EVENT >
template<typename Acoll , typename Bcoll >
auto art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >::operator() ( Acoll const &  aColl,
Bcoll &  bColl,
dataColl_t dColl 
) const -> shared_exception_t

Definition at line 207 of file IPRHelper.h.

References e, art::ensurePointer(), art::detail::DataCollHelper< DATA >::fill(), art::detail::BcollHelper< ProdB >::fill(), art::detail::DataCollHelper< DATA >::init(), and art::detail::BcollHelper< ProdB >::init().

209 {
210  detail::BcollHelper<ProdB> bh(assnsTag_);
211  detail::DataCollHelper<Data> dh;
212  typename EVENT::template HandleT<Assns<ProdA, ProdB, Data>> assnsHandle;
213  event_.getByLabel(assnsTag_, assnsHandle);
214  if (!assnsHandle.isValid()) {
215  return assnsHandle.whyFailed(); // Failed to get Assns product.
216  }
217  bh.init(aColl.size(), bColl);
218  dh.init(aColl.size(), dColl);
219  // Answer cache.
220  std::unordered_multimap<typename Ptr<ProdA>::const_pointer,
221  std::pair<Ptr<ProdB>, ptrdiff_t>>
222  lookupCache;
223  ptrdiff_t counter{0};
224  for (auto const& apair : *assnsHandle) {
225  if (apair.first.isAvailable()) {
226  lookupCache.emplace(
227  apair.first.get(),
228  typename decltype(lookupCache)::mapped_type(apair.second, counter));
229  }
230  ++counter;
231  }
232  // Now use the cache.
233  size_t bIndex{0};
234  for (typename Acoll::const_iterator i = aColl.begin(), e = aColl.end();
235  i != e;
236  ++i, ++bIndex) {
237  auto foundItems = lookupCache.equal_range(
239  if (foundItems.first != lookupCache.cend()) {
240  std::for_each(
241  foundItems.first,
242  foundItems.second,
243  [&bh, &dh, &bColl, bIndex, &assnsHandle, &dColl](
244  typename decltype(lookupCache)::const_reference itemPair) {
245  bh.fill(bIndex, itemPair.second.first, bColl);
246  dh.fill(itemPair.second.second, *assnsHandle, bIndex, dColl);
247  });
248  }
249  }
250  return shared_exception_t();
251 }
InputTag const assnsTag_
Definition: IPRHelper.h:154
EVENT const & event_
Definition: IPRHelper.h:153
intermediate_table::const_iterator const_iterator
std::shared_ptr< art::Exception const > shared_exception_t
Definition: IPRHelper.h:132
Float_t e
Definition: plot.C:34
WANTED_POINTER ensurePointer(InputIterator it)
Definition: ensurePointer.h:77
T const * const_pointer
Definition: Ptr.h:104

Member Data Documentation

template<typename ProdA , typename ProdB , typename Data , typename DATACOLL , typename EVENT >
InputTag const art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >::assnsTag_
private

Definition at line 154 of file IPRHelper.h.

template<typename ProdA , typename ProdB , typename Data , typename DATACOLL , typename EVENT >
EVENT const& art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >::event_
private

Definition at line 153 of file IPRHelper.h.


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