Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT > Class Template Reference

#include <IPRHelper.h>

Public Types

using shared_exception_t = std::shared_ptr< art::Exception const >
 

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

using dataColl_t = std::conditional_t< std::is_void_v< Data >, IPRHelperDef, DATACOLL >
 

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 50 of file IPRHelper.h.

Member Typedef Documentation

template<typename ProdA , typename ProdB , typename Data , typename DATACOLL , typename EVENT >
using art::detail::IPRHelper< ProdA, ProdB, Data, DATACOLL, EVENT >::dataColl_t = std::conditional_t<std::is_void_v<Data>, IPRHelperDef, DATACOLL>
private

Definition at line 128 of file IPRHelper.h.

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

Definition at line 131 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 133 of file IPRHelper.h.

133 : event_{e}, assnsTag_{tag} {}
InputTag const assnsTag_
Definition: IPRHelper.h:153
EVENT const & event_
Definition: IPRHelper.h:152
const double e

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 164 of file IPRHelper.h.

167 {
168  IPRHelperDef dummy;
169  return (*this)(aColl, bColl, dummy);
170 }
cet::LibraryManager dummy("noplugin")
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 206 of file IPRHelper.h.

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

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 153 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 152 of file IPRHelper.h.


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