LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
Interfaces to create instances of LArSoft data proxies. More...
Modules | |
LArSoft data proxy infrastructure | |
Classes for implementation and customization of LArsoft proxies. | |
Functions | |
template<typename CollProxy , typename Event , typename... OptionalArgs> | |
auto | proxy::getCollection (Event const &event, OptionalArgs &&...optionalArgs) |
Creates a proxy to a data product collection. More... | |
One-to-many sequential associations | |
These functions allow to merge into a data collection proxy auxiliary data via an art association fulfilling the one-to-many sequential association requirement. Two categories of functions are available depending on the data source:
Variants of Also, variants are available to customize the tag class. The implementation of this feature is documented in its own doxygen module. | |
template<typename Aux , typename Metadata , typename AuxTag , typename... Args> | |
auto | proxy::withAssociatedMetaAs (Args &&...args) |
Helper function to merge associated data with metadata. More... | |
template<typename Aux , typename AuxTag , typename... Args> | |
auto | proxy::withAssociatedAs (Args &&...args) |
Helper function to merge associated data with no metadata. More... | |
template<typename Aux , typename Metadata , typename... Args> | |
auto | proxy::withAssociatedMeta (Args &&...args) |
Helper function to merge associated data. More... | |
template<typename Aux , typename... Args> | |
auto | proxy::withAssociated (Args &&...args) |
Helper function to merge associated data with no metadata. More... | |
template<typename AuxTag , typename Assns > | |
auto | proxy::wrapAssociatedAs (Assns const &assns) |
Helper function to merge associated data from a given association. More... | |
template<typename Assns > | |
auto | proxy::wrapAssociated (Assns const &assns) |
Helper function to merge associated data from a given association. More... | |
template<typename AuxTag , typename Assns > | |
auto | proxy::wrapAssociated (Assns const &assns) |
Helper function to merge associated data from a given association. More... | |
Parallel data collections | |
These functions allow to merge into a data collection proxy some auxiliary data from other collections fulfilling the parallel data product requirement. Two categories of functions are available depending on the data source:
Also, variants are available to customize the tag class. The implementation of this feature is documented in its own doxygen module. | |
template<typename Aux , typename AuxTag , typename... Args> | |
auto | proxy::withParallelDataAs (Args &&...args) |
Helper function to merge an auxiliary data product into the proxy. More... | |
template<typename Aux , typename... Args> | |
auto | proxy::withParallelData (Args &&...args) |
Helper function to merge an auxiliary data product into the proxy. More... | |
template<typename AuxTag , typename AuxColl > | |
auto | proxy::wrapParallelDataAs (AuxColl const &auxColl) |
Uses a collection as auxiliary data for a collection proxy. More... | |
template<typename AuxColl > | |
auto | proxy::wrapParallelData (AuxColl const &auxColl) |
Uses a collection as auxiliary data for a collection proxy. More... | |
One-to-one (optional) associations | |
These functions allow to merge into a data collection proxy some auxiliary data via an art association fulfilling the one-to-(zero-or-one) sequential association requirement. One category of functions is currently available:
Variants of Also, variants are available to customize the tag class. The implementation of this feature is documented in its own doxygen module. | |
template<typename Aux , typename Metadata , typename AuxTag , typename... Args> | |
auto | proxy::withZeroOrOneMetaAs (Args &&...args) |
template<typename Aux , typename AuxTag , typename... Args> | |
auto | proxy::withZeroOrOneAs (Args &&...args) |
template<typename Aux , typename Metadata , typename... Args> | |
auto | proxy::withZeroOrOneMeta (Args &&...args) |
Helper function to merge one-to-(zero-or-one) associated data. More... | |
template<typename Aux , typename... Args> | |
auto | proxy::withZeroOrOne (Args &&...args) |
Interfaces to create instances of LArSoft data proxies.
This section contains documentation about the main tools to instantiate a data collection proxy in LArSoft. Some prepackaged data proxies are provided by LArSoft and documented in the recostructed object data proxy section.
The starting point is the documentation of proxy::getCollection()
. That function is the way to create a proxy object in your code. Auxiliary data can me merged to that proxy on creation, and only then. Different functions help with merging different auxiliary data:
proxy::withAssociated()
class of functions, or just merged, is already fetched, with proxy::wrapAssociated()
functionsproxy::withZeroOrOne()
class of functionsproxy::withParallelData()
class of functions, or directly used with proxy::wrapParallelData()
functionsEach auxiliary data is identified by a "tag", which is for example used when asking for that auxiliary data with get<Tag>()
member of the proxy. Most of the withXxx()
functions have a variant, usually withXxxAs()
, that allows that tag to be explicitly chosen.
For the supported associated data, a variant withXxxMeta()
(and withXxxMetaAs()
) is offered which allows to access also the metadata of the association.
auto proxy::getCollection | ( | Event const & | event, |
OptionalArgs &&... | optionalArgs | ||
) |
Creates a proxy to a data product collection.
CollProxy | type of target main collection proxy |
Event | type of event to read data from |
OptionalArgs | type of optional arguments |
event | event to read data from |
optionalArgs | optional arguments for construction of the proxy |
This function delivers a collection proxy related to CollProxy
.
The type of proxy delivered is arbitrary and usually not CollProxy
. The type of the collection proxy must be explicitly specified, e.g.:
In this case, two optional arguments are passed: the input tag to the main collection, and then withAssociated<recob::Hits>()
. The meaning of both is decided depending on the collection proxy being created, but it's common to have the first argument be the input tag to the main collection, as in this example. withAssociated()
is one of the ways for a proxy to have auxiliary data "merged" into. The options to merge this data are collected in the proxy interface documentation.
The collection proxy name is arbitrary, but it's custom to have it live in proxy
namespace and have the same name as the base object, made plural: a proxy to a recob::Track
collection data product will have a proxy called proxy::Tracks
.
Note that a proxy need to be explicitly supported in order to be available. Nevertheless, a generic implementation is supported to create a proxy of a data product which is a C++ vector, so that:
will have an outcome similar to the previous example. In this case, though, all the specific track interface that went into proxy::Tracks
proxy will not be available.
The implementation of this feature is documented in its own doxygen module.
To control which type of collection proxy is produced for the type CollProxy
, the class CollectionProxyMaker
may be specialised.
Definition at line 81 of file getCollection.h.
References proxy::CollectionProxyMakerBase< CollProxy >::make().
auto proxy::withAssociated | ( | Args &&... | args | ) |
Helper function to merge associated data with no metadata.
Aux | type of associated data requested |
Args | types of constructor arguments for associated data collection |
args | constructor arguments for the associated data collection |
getCollection()
knows to handle This function is equivalent to withAssociatedMeta()
but with the request of no associated metadata (Metadata
be void
). Example of usage:
The cluster association ("clusterTag"
) will be accessed by using the type recob::Cluster
as tag:
The interface of clusters
is documented in lar::CollectionView
. The interface of cluster
is documented in proxy::details::AssnsNode
.
For more extensive information, see proxy::withAssociatedMeta()
.
Definition at line 367 of file withAssociated.h.
auto proxy::withAssociatedAs | ( | Args &&... | args | ) |
Helper function to merge associated data with no metadata.
Aux | type of associated data requested |
AuxTag | tag to access the associated data within the proxy |
Args | types of constructor arguments for associated data collection |
args | constructor arguments for the associated data collection |
getCollection()
knows to handle This function is similar to withAssociated()
, but it defines a tag for the data. In this example we fetch from event
an association between recob::Track
(which is the main type of the collection proxy proxy::Tracks
) and recob::Cluster
objects:
The interface of clusters
is documented in lar::CollectionView
. The interface of clusterInfo
is documented in proxy::details::AssnsNode
.
For more extensive information, see proxy::withAssociatedMeta()
.
Definition at line 199 of file withAssociated.h.
auto proxy::withAssociatedMeta | ( | Args &&... | args | ) |
Helper function to merge associated data.
Aux | type of associated data requested |
Metadata | type of associated metadata requested |
Args | types of constructor arguments for associated data collection |
args | constructor arguments for the associated data collection |
getCollection()
knows to handleThis function is meant to convey to getCollection()
function the request for the delivered collection proxy to carry data from an association. This association must fulfil the one-to-many sequential association requirement. The associated data is normally extracted from an art association art::Assns<Main, Aux, Metadata>
, where Main
is the main type of the proxy collection. If no metadata is required, Metadata
can be set to void
, or withAssociated()
can be used instead.
The function also transfers the information required to create a proxy to that auxiliary data.
This data will be tagged with the type Aux
. To use a different type as tag, use withAssociatedAs()
or withAssociatedMetaAs()
instead, specifying the tag as second template argument, e.g.:
or, equivalently (because we asked for no metadata):
The first cluster association ("defaultClusterTag"
) will be accessed by using the type recob::Cluster
as tag, while the second one will be accessed by the DubiousClusters
tag (which is better not be defined in a local scope):
The full interface of track
is documented in lar::CollectionView
. The interface of clusters
and maybeClusters
is documented in proxy::details::AssnsNode
.
To have a call like:
create something different than the standard association proxy, specialize proxy::AssociatedDataProxyMaker
, e.g.:
(the void
template type signifies the association has no metadata).
The main purpose of this function and the related WithAssociatedStruct
class is to save the user from specifying the main type the auxiliary data is associated with, when using it as getCollection()
argument:
While parsing the withAssociated()
argument (or any argument), the information of which is the proxy collection type (proxy::Tracks
in the example) is not known. In principle, to fully define the association, two template arguments are needed, e.g. withAssociated<recob::Track, recob::Hit>(hitAssnTag)
. The class WithAssociatedStruct
holds the information of which associated type is requested (recob::Hit
) and the information needed to create a proxy to such association (all arguments, here just hitAssnTag
). The function getCollection()
will have this object as argument, and when executing will be able to supply the missing information, that recob::Track
is the main data product element we are associating to.
Definition at line 326 of file withAssociated.h.
auto proxy::withAssociatedMetaAs | ( | Args &&... | args | ) |
Helper function to merge associated data with metadata.
Aux | type of associated data requested |
Metadata | type of associated metadata requested |
AuxTag | tag to access the associated data within the proxy |
Args | types of constructor arguments for associated data collection |
args | constructor arguments for the associated data collection |
getCollection()
knows to handle This function is similar to withAssociated()
, but it also merges the specified metadata and defines a tag for the data. In this example we fetch from event
an association between recob::Track
(which is the main type of the collection proxy proxy::Tracks
) and recob::Cluster
objects, each one with an index as metadata:
The interface of clusters
is documented in lar::CollectionView
. The interface of clusterInfo
is documented in proxy::details::AssnsNode
.
For more extensive information, see proxy::withAssociatedMeta()
.
Definition at line 143 of file withAssociated.h.
auto proxy::withParallelData | ( | Args &&... | args | ) |
Helper function to merge an auxiliary data product into the proxy.
Aux | type of parallel data product requested |
Args | types of constructor arguments for parallel data proxy |
args | constructor arguments for the parallel data collection proxy |
getCollection()
knows to handleThis function is meant to convey to getCollection()
function the request to merge auxiliary data structured as a collection parallel into the collection proxy.
This data will be tagged with the type Aux
. To use a different type as tag, use withParallelDataAs()
instead, specifying the tag as second template argument, e.g.:
The first momentum association ("defaultMomTag"
) will be accessed by using the type recob::TrackMomentum
as tag, while the second one will be accessed by the MCS
tag (which is better not be defined in a local scope):
The default implementation of parallel data proxy returns for each element query an object with the same interface as the element of the parallel data collection. In the previous examples, that would be a constant reference to an object with recob::TrackMomentum
interface.
To have a call like:
to create something different than the standard parallel data proxy, one needs to specialize proxy::ParallelDataProxyMaker
, e.g.:
Definition at line 175 of file withParallelData.h.
Referenced by NuGraphAnalyzer::analyze().
auto proxy::withParallelDataAs | ( | Args &&... | args | ) |
Helper function to merge an auxiliary data product into the proxy.
Aux | type of parallel data product requested |
AuxTag | the tag type to refer this auxiliary data as |
Args | types of constructor arguments for parallel data proxy |
args | constructor arguments for the parallel data collection proxy |
getCollection()
knows to handleproxy::withParallelData()
This function is meant to convey to getCollection()
function the request for merging a auxiliary data structured as a collection parallel into the collection proxy.
It is functionally equivalent to withParallelData()
, with the difference that here the auxiliary data tag must be specified. withParallelData()
documentation also contains examples on how to use this function and the proxy resulting from that.
Definition at line 89 of file withParallelData.h.
auto proxy::withZeroOrOne | ( | Args &&... | args | ) |
Works like withZeroOrOneMeta()
, but for associations with no metadata.
Definition at line 153 of file withZeroOrOne.h.
auto proxy::withZeroOrOneAs | ( | Args &&... | args | ) |
The same as withZeroOrOne()
, but it also specified a tag for the data.
Definition at line 75 of file withZeroOrOne.h.
auto proxy::withZeroOrOneMeta | ( | Args &&... | args | ) |
Helper function to merge one-to-(zero-or-one) associated data.
Aux | type of associated data requested |
Metadata | type of metadata coming with the associated data |
Args | types of constructor arguments for associated data collection |
args | constructor arguments for the associated data collection |
getCollection()
knows to handleThis function is meant to convey to getCollection()
function the request for the delivered collection proxy to carry auxiliary data from an association fulfilling the one-to-many sequential association requirements.
This data will be tagged with the type Aux
. To use a different type as tag, use withZeroOrOneAs()
instead, specifying the tag as second template argument, e.g.:
and, since we are not requesting any metadata, this is equivalent to
The first vertex association ("defaultVertexTag"
) will be accessed by using the type recob::Vertex
as tag, while the second one will be accessed by the QuestionableVertex
tag (which is better not be defined in a local scope):
See the technical details about withAssociated()
, which hold for this function and related classes too.
See the technical details about withAssociated()
, which hold for this function and related classes too.
Definition at line 144 of file withZeroOrOne.h.
auto proxy::withZeroOrOneMetaAs | ( | Args &&... | args | ) |
The same as withZeroOrOneMeta()
, but it also specified a tag.
Definition at line 64 of file withZeroOrOne.h.
auto proxy::wrapAssociated | ( | Assns const & | assns | ) |
Helper function to merge associated data from a given association.
Assns | type of the association being merged; needs art::Assns interface |
assns | the association being merged |
getCollection()
knows to handle withAssociatedMeta()
, wrapAssociatedAs()
This function instructs the proxy to use the specified association assns
directly. The specified association assns
must remain valid for all the lifetime of the proxy.
The difference with wrapAssociated()
is only that the tag is implicitly assigned to be the one of the associated data.
If Assns
contains metadata, that is also merged into the proxy.
Usage example:
For more extensive information, see proxy::withAssociatedMeta()
.
Definition at line 466 of file withAssociated.h.
auto proxy::wrapAssociated | ( | Assns const & | assns | ) |
Helper function to merge associated data from a given association.
AuxTag | tag to access the associated data within the proxy |
Assns | type of the association being merged; needs art::Assns interface |
assns | the association being merged |
getCollection()
knows to handle withAssociatedMeta()
, wrapAssociatedAs()
This function instructs the proxy to use the specified association assns
directly. It is fully equivalent to proxy::wrapAssociatedAs()
.
Definition at line 485 of file withAssociated.h.
auto proxy::wrapAssociatedAs | ( | Assns const & | assns | ) |
Helper function to merge associated data from a given association.
AuxTag | tag to access the associated data within the proxy |
Assns | type of the association being merged; needs art::Assns interface |
assns | the association being merged |
getCollection()
knows to handle This function instructs the proxy to use the specified association assns
directly. The specified association assns
must remain valid for all the lifetime of the proxy.
If Assns
contains metadata, that is also merged into the proxy.
Usage example:
For more extensive information, see proxy::withAssociatedMeta()
.
Definition at line 416 of file withAssociated.h.
auto proxy::wrapParallelData | ( | AuxColl const & | auxColl | ) |
Uses a collection as auxiliary data for a collection proxy.
AuxColl | type of the auxiliary data collection |
auxColl | the data collection to be used as auxiliary data |
getCollection()
add such auxiliary dataThis function is meant to convey to getCollection()
function the request for merging an existing auxiliary data collection structured as a collection parallel into the collection proxy.
It is functionally equivalent to wrapParallelDataAs()
, with the difference that here the auxiliary data tag is automatically defined after the type of the data in the container. withParallelDataAs()
documentation also contains examples on how to use this function and the proxy resulting from that.
Definition at line 256 of file withParallelData.h.
auto proxy::wrapParallelDataAs | ( | AuxColl const & | auxColl | ) |
Uses a collection as auxiliary data for a collection proxy.
AuxTag | the tag type to refer this auxiliary data as |
AuxColl | type of the auxiliary data collection |
auxColl | the data collection to be used as auxiliary data |
getCollection()
add such auxiliary datawithParallelDataAs()
, wrapParallelData()
The specified collection is used directly as auxiliary data in a collection proxy. It is required to fulfil the parallel data product requirements, but it does not have to actually be a data product (that is, it does not have to be a collection read from art).
The usage of the resulting proxy is the same as the ones created using proxy::withParallelDataAs()
, but the object auxColl
must remain valid as long as that proxy is being used. Example of usage:
The first momentum (mom
) will be accessed by using the type recob::TrackMomentum
as tag, while the second one (MCSmom
) will be accessed by the MCS
tag (which is better not be defined in a local scope).
Definition at line 227 of file withParallelData.h.