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 "/cvmfs/nova.opensciencegrid.org/externals/canvas/v3_06_01/source/canvas/Persistency/Common/detail/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 47 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 128 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 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
Float_t e
Definition: plot.C:35

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.

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

167 {
168  IPRHelperDef dummy;
169  return (*this)(aColl, bColl, dummy);
170 }
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.

References hadd_many_files::counter, runNovaSAM::dh, e, art::ensurePointer(), art::detail::DataCollHelper< DATA >::fill(), art::detail::BcollHelper< ProdB >::fill(), MECModelEnuComparisons::i, art::detail::DataCollHelper< DATA >::init(), and art::detail::BcollHelper< ProdB >::init().

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](
243  typename decltype(lookupCache)::const_reference itemPair) {
244  bh.fill(bIndex, itemPair.second.first, bColl);
245  dh.fill(itemPair.second.second, *assnsHandle, bIndex, dColl);
246  });
247  }
248  }
249  return shared_exception_t();
250 }
InputTag const assnsTag_
Definition: IPRHelper.h:153
EVENT const & event_
Definition: IPRHelper.h:152
std::shared_ptr< art::Exception const > shared_exception_t
Definition: IPRHelper.h:131
Float_t e
Definition: plot.C:35
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 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: