Namespaces | Functions
AssociationUtil.h File Reference

Utility object to perform functions of association. More...

#include <string>
#include <utility>
#include <vector>
#include "art/Framework/Principal/Event.h"
#include "art/Persistency/Common/PtrMaker.h"
#include "canvas/Persistency/Common/Assns.h"
#include "canvas/Persistency/Common/FindMany.h"
#include "canvas/Persistency/Common/FindManyP.h"
#include "canvas/Persistency/Common/FindOne.h"
#include "canvas/Persistency/Common/FindOneP.h"
#include "canvas/Persistency/Common/Ptr.h"
#include "canvas/Persistency/Common/PtrVector.h"
#include "messagefacility/MessageLogger/MessageLogger.h"
#include "art/Framework/Core/EDProducer.h"

Go to the source code of this file.

Namespaces

 util
 Namespace for general, non-LArSoft-specific utilities.
 

Functions

template<class T , class U >
bool util::CreateAssn (art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
 Creates a single one-to-one association. More...
 
template<class T , class U >
bool util::CreateAssn (art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, size_t index=UINT_MAX)
 Creates a single one-to-one association. More...
 
template<class T , class U >
bool util::CreateAssn (art::Event &evt, art::Ptr< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn)
 Creates a single one-to-one association. More...
 
template<class T , class U >
bool util::CreateAssn (art::Event &evt, std::vector< T > const &a, art::PtrVector< U > const &b, art::Assns< T, U > &assn, size_t index=UINT_MAX)
 Creates a single one-to-many association. More...
 
template<class T , class U >
bool util::CreateAssn (art::Event &evt, art::Ptr< T > const &a, std::vector< art::Ptr< U >> const &b, art::Assns< T, U > &assn)
 Creates a single one-to-many association. More...
 
template<class T , class U >
bool util::CreateAssn (art::Event &evt, std::vector< T > const &a, std::vector< art::Ptr< U >> const &b, art::Assns< T, U > &assn, size_t index=UINT_MAX)
 Creates a single one-to-many association. More...
 
template<class T , class U >
bool util::CreateAssn (art::Event &evt, std::vector< T > const &a, std::vector< U > const &b, art::Assns< T, U > &assn, size_t startU, size_t endU, size_t index=UINT_MAX)
 Creates a single one-to-many association. More...
 
template<class T , class U >
bool util::CreateAssn (art::Event &evt, std::vector< T > const &a, std::vector< U > const &b, art::Assns< T, U > &assn, std::vector< size_t > const &indices, size_t index=UINT_MAX)
 Creates a single one-to-many association. More...
 
template<typename T , typename U , typename Iter >
bool util::CreateAssn (art::Event &evt, art::Assns< T, U > &assn, size_t first_index, Iter from_second_index, Iter to_second_index)
 Creates a single one-to-many association. More...
 
template<class T , class U >
std::vector< const U * > util::FindUNotAssociatedToT (art::Handle< U > b, art::Event const &evt, std::string const &label)
 
template<class T , class U >
std::vector< art::Ptr< U > > util::FindUNotAssociatedToTP (art::Handle< U > b, art::Event const &evt, std::string const &label)
 
template<class T , class U >
std::vector< size_t > util::GetAssociatedVectorOneI (art::Handle< art::Assns< T, U > > h, art::Handle< std::vector< T > > index_p)
 
template<class T , class U >
std::vector< const U * > util::GetAssociatedVectorOneP (art::Handle< art::Assns< T, U > > h, art::Handle< std::vector< T > > index_p)
 
template<class T , class U >
std::vector< std::vector< size_t > > util::GetAssociatedVectorManyI (art::Handle< art::Assns< T, U > > h, art::Handle< std::vector< T > > index_p)
 
template<class T , class U >
std::vector< std::vector< const U * > > util::GetAssociatedVectorManyP (art::Handle< art::Assns< T, U > > h, art::Handle< std::vector< T > > index_p)
 
template<typename Producer , typename... Args>
std::enable_if_t< std::is_base_of_v< art::EDProducer, Producer >, boolutil::CreateAssn (Producer const &, Args &&...args)
 
template<typename Producer , typename... Args>
std::enable_if_t< std::is_base_of_v< art::EDProducer, Producer >, boolutil::CreateAssnD (Producer const &, Args &&...args)
 
template<typename T , typename U , typename D >
bool util::CreateAssnD (art::Event &evt, art::Assns< T, U, D > &assn, size_t first_index, size_t second_index, typename art::Assns< T, U, D >::data_t &&data)
 Creates a single one-to-one association with associated data. More...
 
template<typename T , typename U , typename D >
bool util::CreateAssnD (art::Event &evt, art::Assns< T, U, D > &assn, size_t first_index, size_t second_index, typename art::Assns< T, U, D >::data_t const &data)
 

Detailed Description

Utility object to perform functions of association.

Author
brebe.nosp@m.l@fn.nosp@m.al.go.nosp@m.v
Attention
Please considering using the lightweight utility art::PtrMaker instead.

This library provides a number of util::CreateAssn() functions; for convenience, the ones supported as of January 2015 are listed here:

  1. CreateAssn(art::Event&, std::vector<T> const&, art::Ptr<U> const&b, art::Assns<U,T> &, std::string, size_t) one-to-one association, between a element of a vector (future data product) and a art-pointed object; allows for a instance name for the vector
  2. CreateAssn(art::Event&, std::vector<T> const&, art::Ptr<U> const&b, art::Assns<U,T> &, size_t) one-to-one association, between a element of a vector (future data product) and a art-pointed object
  3. CreateAssn(art::Event&, art::Ptr<T> const&, art::Ptr<U> const&, art::Assns<U,T>&) one-to-one association, between two art-pointed objects
  4. CreateAssn(art::Event&, std::vector<T> const&, art::PtrVector<U> const&, art::Assns<T,U>&, size_t) one-to-many association, between a element of a vector (future data product) and a list of art-pointed objects in a art::PtrVector list
  5. CreateAssn(art::Event&, art::Ptr<T> const&, std::vector<art::Ptr<U>> const&, art::Assns<T,U>&) one-to-many association, between an art-pointed object and all the elements in a std::vector of art-pointed objects
  6. CreateAssn(art::Event&, std::vector<T> const&, std::vector<art::Ptr<U>>&, art::Assns<T,U>&, size_t) one-to-many association, between an element of a vector (future data product) and all the elements in a std::vector of art-pointed objects
  7. CreateAssn(art::Event&, std::vector<T> const&, std::vector<U> const&, art::Assns<T,U>&, size_t, size_t, size_t) one-to-many association, between an element of a vector (future data product) and the elements in a subrange of a std::vector (also future data product)
  8. CreateAssn(art::Event&, art::Assns<T,U>&, size_t, Iter, Iter) one-to-many association, between an element of a collection and the elements of another collection, whose indices are specified by the values in a subrange of a third collection (of indices)
  9. CreateAssnD(art::Event&, art::Assns<T,U>&, size_t, size_t, typename art::Assns<T,U,D>::data_t const&)
    , one-to-one association, between an element of a collection and the element of another collection, both specified by index, with additional data

For all the associated objects, either side, that are not specified by art::Ptr, the index of the object in its collection must be (or stay) the same as the index in the final data product collection.

One-to-one associations

the one (T) the other one (U) special notes function
element of std::vector art pointer allows instance name for T CreateAssn(art::Event &, std::vector< T > const &, art::Ptr< U > const &, art::Assns< U, T > &, std::string, size_t)
element of std::vector art pointer CreateAssn(art::Event&, std::vector<T> const&, art::Ptr<U> const&, art::Assns<U,T> &, size_t)
art pointer art pointer CreateAssn(art::Event&, art::Ptr<T> const&, art::Ptr<U> const&, art::Assns<U,T>&)
element by index element by index associates data too CreateAssnD(art::Event&, art::Ptr<T> const&, art::Ptr<U> const&, art::Assns<U,T,D>&, size_t, size_t, typename art::Assns<T,U,D>::data_t const&)
element by index element by index associates data too (moved) CreateAssnD(art::Event&, art::Ptr<T> const&, art::Ptr<U> const&, art::Assns<U,T,D>&, size_t, size_t, typename art::Assns<T,U,D>::data_t&&)

One-to-many associations

the one (T) the many (U) special notes function
element of std::vector art::PtrVector CreateAssn(art::Event&, std::vector<T> const&, art::PtrVector<U> const&, art::Assns<T,U>&, size_t)
art pointer std::vector<art::Ptr<U>> CreateAssn(art::Event&, art::Ptr<T> const&, std::vector<art::Ptr<U>> const&, art::Assns<T,U>&)
element of std::vector std::vector<art::Ptr<U>> CreateAssn(art::Event&, std::vector<T> const&, std::vector<art::Ptr<U>>&, art::Assns<T,U>&, size_t)
element of std::vector std::vector<U> CreateAssn(art::Event&, std::vector<T> const&, std::vector<U> const&, art::Assns<T,U>&, size_t, size_t, size_t)
element by index range of indices does not need object lists CreateAssn(art::Event&, art::Assns<T,U>&, size_t, Iter, Iter)

Definition in file AssociationUtil.h.