Public Member Functions | Private Types | Private Attributes | Friends | List of all members
art::PtrRemapper Class Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/art/v2_13_00/source/art/Framework/Core/PtrRemapper.h"

Public Member Functions

 PtrRemapper ()=default
 
template<typename PROD , typename SIZE_TYPE >
Ptr< PROD > operator() (Ptr< PROD > const &oldPtr, SIZE_TYPE offset) const
 
template<typename PROD , typename SIZE_TYPE >
PtrVector< PROD > operator() (PtrVector< PROD > const &old, SIZE_TYPE offset) const
 
template<typename InIter , typename OutIter , typename SIZE_TYPE >
void operator() (InIter beg, InIter end, OutIter out, SIZE_TYPE offset) const
 
template<typename OutIter , typename PROD , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets) const
 
template<typename CONT , typename OutIter , typename PROD , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CONT const &(*extractor)(PROD const *)) const
 
template<typename CONT , typename OutIter , typename PROD , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CONT const &(PROD::*extractor)() const) const
 
template<typename CONT , typename OutIter , typename PROD , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CONT PROD::*const data) const
 
template<typename PROD , typename OutIter , typename CONT , typename X , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CONT const &(X::*extractor)(PROD const *), X &x) const
 
template<typename PROD , typename OutIter , typename CONT , typename X , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CONT const &(X::*extractor)(PROD const *) const, X const &x) const
 
template<typename CONT , typename CALLBACK , typename OutIter , typename PROD , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CALLBACK extractor) const
 
template<typename PROD , typename SIZE_TYPE >
art::Ptr< PROD > operator() (Ptr< PROD > const &oldPtr, SIZE_TYPE const offset) const
 
template<typename PROD , typename SIZE_TYPE >
art::PtrVector< PROD > operator() (PtrVector< PROD > const &old, SIZE_TYPE const offset) const
 
template<typename PROD , typename OutIter , typename CONT , typename X , typename OFFSETS >
void operator() (std::vector< PROD const * > const &in, OutIter out, OFFSETS const &offsets, CONT const &(X::*)(PROD const *), X &x) const
 

Private Types

using ProdTransMap_t = std::map< ProductID, ProductID >
 

Private Attributes

ProdTransMap_t prodTransMap_ {}
 
cet::exempt_ptr< Event const > event_ {nullptr}
 

Friends

class ProdToProdMapBuilder
 

Detailed Description

Definition at line 241 of file PtrRemapper.h.

Member Typedef Documentation

Definition at line 325 of file PtrRemapper.h.

Constructor & Destructor Documentation

art::PtrRemapper::PtrRemapper ( )
default

Member Function Documentation

template<typename PROD , typename SIZE_TYPE >
Ptr<PROD> art::PtrRemapper::operator() ( Ptr< PROD > const &  oldPtr,
SIZE_TYPE  offset 
) const
template<typename PROD , typename SIZE_TYPE >
PtrVector<PROD> art::PtrRemapper::operator() ( PtrVector< PROD > const &  old,
SIZE_TYPE  offset 
) const
template<typename InIter , typename OutIter , typename SIZE_TYPE >
void art::PtrRemapper::operator() ( InIter  beg,
InIter  end,
OutIter  out,
SIZE_TYPE  offset 
) const

Definition at line 374 of file PtrRemapper.h.

References febshutoff_auto::end, MECModelEnuComparisons::i, and art::PtrRemapperDetail::ContReturner< CONT, PROD, CALLBACK >::operator()().

378 {
379  // Need to assume that all Ptr containers and consistent internally
380  // and with each other due to a lack of productGetters.
381 
382  // Not using transform here allows instantiation for iterator to
383  // collection of Ptr or collection of PtrVector.
384  for (auto i = beg; i != end; ++i) {
385  // Note: this could be signature 1 OR 2 of operator(). If the user
386  // calls this signature (3) with iterators into a collection of
387  // PtrVector, then the call order will be 3, 2, 3, 1 due to the
388  // templates that will be instantiated i.e. the relationship
389  // between signatures 2 and 3 is *not* infinitely recursive.
390  *out++ = this->operator()(*i, offset); // 1 OR 2.
391  }
392 }
Ptr< PROD > operator()(Ptr< PROD > const &oldPtr, SIZE_TYPE offset) const
template<typename OutIter , typename PROD , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets 
) const

Definition at line 397 of file PtrRemapper.h.

References art::PtrRemapperDetail::ContReturner< CONT, PROD, CALLBACK >::operator()().

400 {
401  this->operator()(in,
402  out,
403  offsets,
404  PtrRemapperDetail::simpleProdReturner<PROD>); // 5.
405 }
ifstream in
Definition: comparison.C:7
Ptr< PROD > operator()(Ptr< PROD > const &oldPtr, SIZE_TYPE offset) const
template<typename CONT , typename OutIter , typename PROD , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CONT const &(*)(PROD const *)  extractor 
) const

Definition at line 410 of file PtrRemapper.h.

414 {
415  this->operator()<CONT, CONT const& (*)(PROD const*)>(
416  in, out, offsets, extractor); // 10.
417 }
ifstream in
Definition: comparison.C:7
template<typename CONT , typename OutIter , typename PROD , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CONT const &(PROD::*)() const  extractor 
) const

Definition at line 422 of file PtrRemapper.h.

References in, and confusionMatrixTree::out.

426 {
427  this->operator()<CONT, CONT const& (PROD::*)() const>(
428  in, out, offsets, extractor); // 10.
429 }
ifstream in
Definition: comparison.C:7
template<typename CONT , typename OutIter , typename PROD , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CONT PROD::*const  data 
) const

Definition at line 434 of file PtrRemapper.h.

References in, confusionMatrixTree::out, and X.

438 {
439  this->operator()<CONT, CONT PROD::*const>(in, out, offsets, data); // 10.
440 }
const XML_Char const XML_Char * data
Definition: expat.h:268
ifstream in
Definition: comparison.C:7
template<typename PROD , typename OutIter , typename CONT , typename X , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CONT const &(X::*)(PROD const *)  extractor,
X x 
) const
template<typename PROD , typename OutIter , typename CONT , typename X , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CONT const &(X::*)(PROD const *) const  extractor,
X const &  x 
) const

Definition at line 466 of file PtrRemapper.h.

References in, confusionMatrixTree::out, and submit_syst::x.

471 {
472  this->operator()<CONT>(
473  in, out, offsets, [&x](auto& elem) { elem.extractor(x); }); // 10.
474 }
ifstream in
Definition: comparison.C:7
template<typename CONT , typename CALLBACK , typename OutIter , typename PROD , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CALLBACK  extractor 
) const

Definition at line 483 of file PtrRemapper.h.

References e, MECModelEnuComparisons::i, art::errors::LogicError, art::PtrRemapperDetail::ContReturner< CONT, PROD, CALLBACK >::operator()(), and confusionMatrixTree::out.

487 {
488  if (in.size() != offsets.size()) {
490  << "Collection size of " << in.size()
491  << " disagrees with offset container size of " << offsets.size() << ".\n";
492  }
493  auto i = in.begin();
494  auto const e = in.end();
495  auto off_iter = offsets.begin();
497  extractor);
498  for (; i != e; ++i, ++off_iter) {
499  CONT const& cont(returner.operator()(*i));
500  this->operator()(cont.begin(), cont.end(), out, *off_iter); // 3.
501  }
502 }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
ifstream in
Definition: comparison.C:7
Ptr< PROD > operator()(Ptr< PROD > const &oldPtr, SIZE_TYPE offset) const
Float_t e
Definition: plot.C:35
template<typename PROD , typename SIZE_TYPE >
art::Ptr<PROD> art::PtrRemapper::operator() ( Ptr< PROD > const &  oldPtr,
SIZE_TYPE const  offset 
) const

Definition at line 336 of file PtrRemapper.h.

References art::Ptr< T >::id(), art::Ptr< T >::isNonnull(), art::Ptr< T >::key(), art::errors::LogicError, and PandAna.reco_validation.add_data::offset.

338 {
339  if (oldPtr.id().isValid()) {
340  auto iter = prodTransMap_.find(oldPtr.id());
341  if (iter == prodTransMap_.end()) {
343  << "PtrRemapper: could not find old ProductID " << oldPtr.id()
344  << " in translation table: already translated?\n";
345  }
346  return oldPtr.isNonnull() ? Ptr<PROD>{iter->second,
347  oldPtr.key() + offset,
348  event_->productGetter(iter->second)} :
349  Ptr<PROD>{iter->second};
350  }
351 
352  // Default-constructed.
353  return Ptr<PROD>{};
354 }
cet::exempt_ptr< Event const > event_
Definition: PtrRemapper.h:330
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
ProdTransMap_t prodTransMap_
Definition: PtrRemapper.h:329
template<typename PROD , typename SIZE_TYPE >
art::PtrVector<PROD> art::PtrRemapper::operator() ( PtrVector< PROD > const &  old,
SIZE_TYPE const  offset 
) const

Definition at line 359 of file PtrRemapper.h.

References art::PtrVector< T >::begin(), art::PtrVector< T >::end(), PandAna.reco_validation.add_data::offset, art::PtrRemapperDetail::ContReturner< CONT, PROD, CALLBACK >::operator()(), art::PtrVector< T >::reserve(), fillBadChanDBTables::result, and art::PtrVector< T >::size().

361 {
362  PtrVector<PROD> result;
363  result.reserve(old.size());
364  this->operator()(old.begin(),
365  old.end(),
366  std::back_inserter(result),
367  offset); // 3.
368  return result;
369 }
Ptr< PROD > operator()(Ptr< PROD > const &oldPtr, SIZE_TYPE offset) const
template<typename PROD , typename OutIter , typename CONT , typename X , typename OFFSETS >
void art::PtrRemapper::operator() ( std::vector< PROD const * > const &  in,
OutIter  out,
OFFSETS const &  offsets,
CONT const &  X::*)(PROD const *,
X x 
) const

Definition at line 449 of file PtrRemapper.h.

References in, confusionMatrixTree::out, X, and submit_syst::x.

454 {
455  this->operator()<CONT>(
456  in, out, offsets, [&x](auto& elem) { elem.extractor(x); }); // 10.
457 }
ifstream in
Definition: comparison.C:7

Friends And Related Function Documentation

friend class ProdToProdMapBuilder
friend

Definition at line 324 of file PtrRemapper.h.

Member Data Documentation

cet::exempt_ptr<Event const> art::PtrRemapper::event_ {nullptr}
private

Definition at line 330 of file PtrRemapper.h.

ProdTransMap_t art::PtrRemapper::prodTransMap_ {}
private

Definition at line 329 of file PtrRemapper.h.


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