LArSoft
v09_90_00
Liquid Argon Software toolkit - https://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 112 of file FindAllP.h.
|
protected |
Definition at line 175 of file FindAllP.h.
|
protected |
Type of the cache.
Definition at line 178 of file FindAllP.h.
using lar::util::details::FindAllP< Source, Dest >::Dest_t = Dest |
Definition at line 115 of file FindAllP.h.
using lar::util::details::FindAllP< Source, Dest >::Source_t = Source |
Definition at line 114 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 121 of file FindAllP.h.
References Read().
|
inline |
Constructor: reads one association from the specified event.
Definition at line 124 of file FindAllP.h.
References Read().
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 267 of file FindAllP.h.
References art::ProductRetriever::getByLabel(), and art::errors::ProductNotFound.
|
inline |
Returns whether there are associations from objects in product id.
Definition at line 226 of file FindAllP.h.
|
inline |
Returns if there are associations from objects with product as ptr.
Definition at line 232 of file FindAllP.h.
References art::Ptr< T >::id().
|
protected |
Adds all associations in the specified handle; returns their number.
Definition at line 281 of file FindAllP.h.
References art::Ptr< T >::id(), art::errors::InvalidNumber, art::Ptr< T >::isNonnull(), art::Ptr< T >::isNull(), art::Ptr< T >::key(), MF_LOG_DEBUG, MF_LOG_ERROR, art::Handle< T >::provenance(), and lar::util::details::ResizeToPower2().
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 213 of file FindAllP.h.
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 238 of file FindAllP.h.
References MF_LOG_DEBUG.
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 260 of file FindAllP.h.
|
protected |
set of associations, keyed by product ID and key
Definition at line 180 of file FindAllP.h.