LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
|
Query object reading all the associations between two classes. More...
#include "FindAllP.h"
Public Types | |
using | Source_t = Source |
using | Dest_t = Dest |
Public Member Functions | |
FindAllP ()=default | |
Default constructor: empty query, read information with Read() More... | |
FindAllP (art::Event &event) | |
Constructor: reads all associations from the specified event. More... | |
FindAllP (art::Event &event, art::InputTag assnTag) | |
Constructor: reads one association from the specified event. More... | |
art::Ptr< Dest_t > const & | operator[] (art::Ptr< Dest_t > const &src) const |
Returns the object associated to the specified one. More... | |
bool | hasProduct (art::ProductID const &id) const |
Returns whether there are associations from objects in product id. More... | |
bool | hasProduct (art::Ptr< Source_t > const &ptr) const |
Returns if there are associations from objects with product as ptr. More... | |
unsigned int | Read (art::Event &event) |
Reads all the associations from the event. More... | |
unsigned int | Read (art::Event &event, art::InputTag const &assnTag) |
Reads the specified association from the event. More... | |
unsigned int | Add (art::Event &event, art::InputTag const &assnTag) |
Reads the specified association from the event. More... | |
Protected Types | |
using | Assns_t = art::Assns< Source_t, Dest_t > |
using | Cache_t = UniqueAssociationCache< Source_t, Dest_t > |
Type of the cache. More... | |
Protected Member Functions | |
unsigned int | Merge (art::Handle< Assns_t > &handle) |
Adds all associations in the specified handle; returns their number. More... | |
Protected Attributes | |
Cache_t | cache |
set of associations, keyed by product ID and key More... | |
Query object reading all the associations between two classes.
Source | type of the object we use as query key (indexing object) |
Dest | type of the object we query for |
When assigned an event, this object reads all the associations from Source type classes to Dest type classes in the event, and stores their information in a map to track a Dest object from its Source one. In fact, it assumes that only one Dest object is associated, event-wise, to each single Source object.
Definition at line 117 of file FindAllP.h.
|
protected |
Definition at line 185 of file FindAllP.h.
|
protected |
Type of the cache.
Definition at line 188 of file FindAllP.h.
using lar::util::details::FindAllP< Source, Dest >::Dest_t = Dest |
Definition at line 120 of file FindAllP.h.
using lar::util::details::FindAllP< Source, Dest >::Source_t = Source |
Definition at line 119 of file FindAllP.h.
|
default |
Default constructor: empty query, read information with Read()
|
inline |
Constructor: reads all associations from the specified event.
Definition at line 126 of file FindAllP.h.
|
inline |
Constructor: reads one association from the specified event.
Definition at line 129 of file FindAllP.h.
unsigned int lar::util::details::FindAllP< Source, Dest >::Add | ( | art::Event & | event, |
art::InputTag const & | assnTag | ||
) |
Reads the specified association from the event.
event | the event to read the associations from |
assnTag | the input tag for the association |
art::Exception | if multiple dest objects are found for one source object |
The existing associations already in cache are not removed.
The input tag for the association is usually simply a string with the name of the module that produced the association, and often the same module has also produced the source objects as well.
Definition at line 291 of file FindAllP.h.
References art::DataViewImpl::getByLabel(), lar::util::details::FindAllP< Source, Dest >::Merge(), and art::errors::ProductNotFound.
Referenced by lar::util::details::FindAllP< Source, Dest >::Read().
|
inline |
Returns whether there are associations from objects in product id.
Definition at line 244 of file FindAllP.h.
Referenced by lar::util::details::FindAllP< Source, Dest >::operator[]().
|
inline |
Returns if there are associations from objects with product as ptr.
Definition at line 250 of file FindAllP.h.
References art::Ptr< T >::id(), and lar::util::details::FindAllP< Source, Dest >::Read().
|
protected |
Adds all associations in the specified handle; returns their number.
Definition at line 307 of file FindAllP.h.
References art::Ptr< T >::id(), art::errors::InvalidNumber, art::Ptr< T >::isNonnull(), art::Ptr< T >::isNull(), art::Ptr< T >::key(), LOG_DEBUG, LOG_ERROR, art::Handle< T >::provenance(), and lar::util::details::ResizeToPower2().
Referenced by lar::util::details::FindAllP< Source, Dest >::Add().
auto lar::util::details::FindAllP< Source, Dest >::operator[] | ( | art::Ptr< Dest_t > const & | src | ) | const |
Returns the object associated to the specified one.
src | a art pointer to the source object |
Definition at line 230 of file FindAllP.h.
References lar::util::details::FindAllP< Source, Dest >::hasProduct().
unsigned int lar::util::details::FindAllP< Source, Dest >::Read | ( | art::Event & | event | ) |
Reads all the associations from the event.
art::Exception | if multiple dest objects are found for one source object |
Definition at line 256 of file FindAllP.h.
References LOG_DEBUG.
Referenced by lar::util::details::FindAllP< Source, Dest >::hasProduct().
unsigned int lar::util::details::FindAllP< Source, Dest >::Read | ( | art::Event & | event, |
art::InputTag const & | assnTag | ||
) |
Reads the specified association from the event.
event | the event to read the associations from |
assnTag | the input tag for the association |
art::Exception | if multiple dest objects are found for one source object |
The input tag for the association is usually simply a string with the name of the module that produced the association, and often the same module has also produced the source objects as well.
Definition at line 281 of file FindAllP.h.
References lar::util::details::FindAllP< Source, Dest >::Add().
|
protected |
set of associations, keyed by product ID and key
Definition at line 190 of file FindAllP.h.