Namespaces | Classes | Typedefs | Functions
proxy Namespace Reference

Namespaces

 details
 

Classes

class  AssociatedDataProxyMaker
 Creates an associated data wrapper for the specified types. More...
 
struct  AssociatedDataProxyMakerBase
 Creates an associated data wrapper for the specified types. More...
 
struct  ChargedSpacePoints
 Proxy tag for a recob::SpacePoint collection with charge. More...
 
class  ChargedSpacePointsCollectionProxy
 Proxy collection class for space points associated to charge. More...
 
class  CollectionProxyBase
 Base representation of a collection of proxied objects. More...
 
struct  CollectionProxyElement
 An element of a collection proxy. More...
 
struct  CollectionProxyMaker
 Class to assemble the required proxy. More...
 
struct  CollectionProxyMaker< Tracks >
 Specialization to create a proxy for recob::Track collection. More...
 
struct  CollectionProxyMakerBase
 Class to assemble the required proxy. More...
 
struct  CollectionProxyMakerTraits
 Collection of data type definitions for collection proxies. More...
 
struct  CollectionProxyMakerTraits< ChargedSpacePoints >
 Traits of proxy::ChargedSpacePoints proxy. More...
 
struct  CollectionProxyMakerTraits< CollectionProxy< MainColl > >
 
struct  CollectionProxyMakerTraits< std::vector< T > >
 
struct  CollectionProxyMakerTraits< Tracks >
 Define the traits of proxy::Tracks proxy. More...
 
class  OneTo01DataProxyMaker
 Creates an one-to-(zero-or-one) wrapper for the specified types. More...
 
struct  OneTo01DataProxyMakerBase
 Creates an one-to-(zero-or-one) wrapper for the specified types. More...
 
class  ParallelDataProxyMaker
 Creates an associated data wrapper for the specified types. More...
 
struct  ParallelDataProxyMakerBase
 Creates an parallel data wrapper for the specified types. More...
 
class  ProxyAsAuxProxyMaker
 Creates an auxiliary proxy wrapper for the specified proxy. More...
 
struct  ProxyAsAuxProxyMakerBase
 Creates a proxy wrapper for merging into another proxy ("main"). More...
 
struct  SpacePointWithCharge
 Proxy class for charged space point proxy elements. More...
 
struct  TrackCollectionProxyElement
 Class for track proxy elements. More...
 
struct  TrackPoint
 Type of track point information. More...
 
class  TrackPointIterator
 
class  TrackPointWrapper
 Wrapper for a track data proxy. More...
 
struct  Tracks
 Proxy tag for a recob::Track collection proxy. More...
 

Typedefs

template<typename MainColl , typename... AuxColls>
using CollectionProxy = CollectionProxyBase< CollectionProxyElement, MainColl, AuxColls... >
 Base representation of a collection of proxied objects. More...
 
template<typename... Args>
using CollectionProxyFromArgs = typename details::TemplateAdaptorOnePlus< CollectionProxy, Args... >::type
 
using TrackPointData = std::tuple< recob::Track const *, art::Ptr< recob::Hit >, recob::TrackFitHitInfo const *, std::size_t >
 Container of track point information. More...
 
template<typename TrackCollProxy >
using Track = TrackCollectionProxyElement< TrackCollProxy >
 Proxy to an element of a proxy collection of recob::Track objects. More...
 

Functions

template<typename Tag = proxy::ChargedSpacePoints::ChargeTag>
auto withCharge (art::InputTag inputTag)
 Adds additional recob::PointCharge information to the proxy. More...
 
template<typename Event , typename... Args>
auto getChargedSpacePoints (Event const &event, art::InputTag inputTag, Args &&...withArgs)
 Creates and returns a proxy to space points with associated charge. More...
 
template<typename CollProxy , typename Event , typename... OptionalArgs>
auto getCollection (Event const &event, OptionalArgs &&...optionalArgs)
 Creates a proxy to a data product collection. More...
 
template<typename Tag , typename Assns >
auto makeAssociatedDataFrom (Assns const &assns, std::size_t minSize=0)
 
template<typename Assns >
auto makeAssociatedDataFrom (Assns const &assns, std::size_t minSize=0)
 
template<typename Main , typename Aux , typename Metadata , typename Tag , typename Event >
auto makeAssociatedDataFrom (Event const &event, art::InputTag const &tag, std::size_t minSize=0)
 Creates and returns an associated data object. More...
 
template<typename Main , typename Aux , typename Metadata , typename Event >
auto makeAssociatedDataFrom (Event const &event, art::InputTag const &tag, std::size_t minSize=0)
 
template<typename Main , typename Aux , typename Event >
auto makeAssociatedDataFrom (Event const &event, art::InputTag const &tag, std::size_t minSize=0)
 
template<typename Aux , typename Metadata , typename Tag , typename Handle , typename Event >
auto makeAssociatedDataFrom (Handle &&handle, Event const &event, art::InputTag const &tag)
 Creates and returns an associated data object. More...
 
template<typename Aux , typename Metadata , typename Handle , typename Event >
auto makeAssociatedDataFrom (Handle &&handle, Event const &event, art::InputTag const &tag)
 
template<typename Aux , typename Handle , typename Event >
auto makeAssociatedDataFrom (Handle &&handle, Event const &event, art::InputTag const &tag)
 
template<typename Tag , typename MainColl , typename Assns >
auto makeAssociatedDataFrom (MainColl const &mainColl, Assns const &assns)
 Creates and returns an associated data object. More...
 
template<typename MainColl , typename Assns >
auto makeAssociatedDataFrom (MainColl const &mainColl, Assns const &assns)
 
template<typename Tag , typename Assns >
auto makeOneTo01dataFrom (Assns const &assns, std::size_t minSize=0)
 Processes and returns an one-to-(zero/one) associated data object. More...
 
template<typename Assns >
auto makeOneTo01dataFrom (Assns const &assns, std::size_t minSize=0)
 
template<typename Main , typename Aux , typename Metadata , typename Tag , typename Event >
auto makeOneTo01dataFrom (Event const &event, art::InputTag const &tag, std::size_t minSize=0)
 Creates and returns an one-to-(zero/one) associated data object. More...
 
template<typename Main , typename Aux , typename Metadata , typename Event >
auto makeOneTo01dataFrom (Event const &event, art::InputTag const &tag, std::size_t minSize=0)
 
template<typename Aux , typename Metadata , typename Tag , typename Handle , typename Event >
auto makeOneTo01dataFrom (Handle &&handle, Event const &event, art::InputTag const &tag)
 Creates and returns an one-to-(zero/one) associated data object. More...
 
template<typename Aux , typename Metadata , typename Handle , typename Event >
auto makeOneTo01dataFrom (Handle &&handle, Event const &event, art::InputTag const &tag)
 
template<typename Tag , typename MainColl , typename Assns >
auto makeOneTo01dataFrom (MainColl const &mainColl, Assns const &assns)
 Creates and returns an one-to-(zero/one) associated data object. More...
 
template<typename MainColl , typename Assns >
auto makeOneTo01dataFrom (MainColl const &mainColl, Assns const &assns)
 
template<typename AuxColl , typename Aux = util::collection_value_t<AuxColl>, typename Tag = Aux>
auto makeParallelDataFrom (AuxColl const &data)
 Wraps a collection into a parallel data collection object. More...
 
template<typename AuxColl , typename Aux , typename Tag , typename Event >
auto makeParallelDataFrom (Event const &event, art::InputTag const &tag)
 Creates and returns a parallel data collection object. More...
 
template<typename AuxColl , typename Aux , typename Event >
auto makeParallelDataFrom (Event const &event, art::InputTag const &tag)
 
template<typename AuxColl , typename Event >
auto makeParallelDataFrom (Event const &event, art::InputTag const &tag)
 
template<typename AuxColl , typename Aux = util::collection_value_t<AuxColl>, typename Tag = Aux>
auto makeParallelData (AuxColl const &data)
 Wraps a collection into a parallel data collection object. More...
 
template<typename Tag , typename Aux , typename AuxProxyColl >
auto makeProxyAsParallelData (AuxProxyColl &&auxProxy)
 
template<typename AuxProxy , typename AuxTag , typename... Args>
auto withCollectionProxyAs (Args &&...args)
 
template<typename AuxProxy , typename... Args>
auto withCollectionProxy (Args &&...args)
 Helper function to merge an auxiliary proxy into the proxy. More...
 
template<typename TrackProxy >
TrackPointData makeTrackPointData (TrackProxy const &track, std::size_t index)
 Returns an object with information about the specified track point. More...
 
template<typename Data >
auto wrapTrackPoint (Data const &wrappedData)
 "Converts" point data into a proxy::TrackPointWrapper. More...
 
template<typename Tag , typename Assns >
auto makeAssociatedData (Assns const &assns, std::size_t minSize=0)
 Processes and returns an associated data object. More...
 
template<typename Assns >
auto makeAssociatedData (Assns const &assns, std::size_t minSize=0)
 
template<typename Tag , typename MainColl , typename Assns >
auto makeAssociatedData (MainColl const &mainColl, Assns const &assns)
 Creates and returns an associated data object. More...
 
template<typename MainColl , typename Assns >
auto makeAssociatedData (MainColl const &mainColl, Assns const &assns)
 
template<typename Tag , typename Assns >
auto makeOneTo01data (Assns const &assns, std::size_t minSize=0)
 Processes and returns an one-to-(zero/one) associated data object. More...
 
template<typename Assns >
auto makeOneTo01data (Assns const &assns, std::size_t minSize=0)
 
template<typename Tag , typename MainColl , typename Assns >
auto makeOneTo01data (MainColl const &mainColl, Assns const &assns)
 Creates and returns an one-to-(zero/one) associated data object. More...
 
template<typename MainColl , typename Assns >
auto makeOneTo01data (MainColl const &mainColl, Assns const &assns)
 
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 proxy::withAssociated() called proxy::withAssociatedMeta() allow merging the metadata of an association too. The proxy::wrapAssociated() functions always merge the metadata if the wrapped association has it.

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 withAssociatedMetaAs (Args &&...args)
 Helper function to merge associated data with metadata. More...
 
template<typename Aux , typename AuxTag , typename... Args>
auto withAssociatedAs (Args &&...args)
 Helper function to merge associated data with no metadata. More...
 
template<typename Aux , typename Metadata , typename... Args>
auto withAssociatedMeta (Args &&...args)
 Helper function to merge associated data. More...
 
template<typename Aux , typename... Args>
auto withAssociated (Args &&...args)
 Helper function to merge associated data with no metadata. More...
 
template<typename AuxTag , typename Assns >
auto wrapAssociatedAs (Assns const &assns)
 Helper function to merge associated data from a given association. More...
 
template<typename Assns >
auto wrapAssociated (Assns const &assns)
 Helper function to merge associated data from a given association. More...
 
template<typename AuxTag , typename Assns >
auto 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 withParallelDataAs (Args &&...args)
 Helper function to merge an auxiliary data product into the proxy. More...
 
template<typename Aux , typename... Args>
auto withParallelData (Args &&...args)
 Helper function to merge an auxiliary data product into the proxy. More...
 
template<typename AuxTag , typename AuxColl >
auto wrapParallelDataAs (AuxColl const &auxColl)
 Uses a collection as auxiliary data for a collection proxy. More...
 
template<typename AuxColl >
auto 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 proxy::withZeroOrOne() called proxy::withZeroOrOneMeta() will allow merging the metadata of an association too. This feature is not supported yet, though.

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 withZeroOrOneMetaAs (Args &&...args)
 
template<typename Aux , typename AuxTag , typename... Args>
auto withZeroOrOneAs (Args &&...args)
 
template<typename Aux , typename Metadata , typename... Args>
auto withZeroOrOneMeta (Args &&...args)
 Helper function to merge one-to-(zero-or-one) associated data. More...
 
template<typename Aux , typename... Args>
auto withZeroOrOne (Args &&...args)
 
Auxiliary data

These functions may be used as arguments to proxy::getCollection<proxy::Tracks>() call to merge of some data associated to the tracks.

auto withOriginalTrajectory (art::InputTag const &inputTag)
 Adds recob::TrackTrajectory information to the proxy. More...
 
auto withOriginalTrajectory ()
 Adds recob::TrackTrajectory information to the proxy. More...
 
auto withFitHitInfo (art::InputTag const &inputTag)
 Adds recob::TrackFitHitInfo information to the proxy. More...
 
auto withFitHitInfo ()
 Adds recob::TrackFitHitInfo information to the proxy. More...
 

Function Documentation

template<typename CollProxy , typename Event , typename... OptionalArgs>
auto proxy::getCollection ( Event const &  event,
OptionalArgs &&...  optionalArgs 
)

Creates a proxy to a data product collection.

Template Parameters
CollProxytype of target main collection proxy
Eventtype of event to read data from
OptionalArgstype of optional arguments
Parameters
eventevent to read data from
optionalArgsoptional arguments for construction of the proxy
Returns
a collection proxy object
See also
ways to merge more data into a 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.:

auto tracks = proxy::getCollection<proxy::Tracks>
(event, tag, withAssociated<recob::Hits>());

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:

auto tracks = proxy::getCollection<std::vector<recob::Track>>
(event, tag, withAssociated<recob::Hits>());

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.

Customization

To control which type of collection proxy is produced for the type CollProxy, the class CollectionProxyMaker may be specialised.

Definition at line 82 of file getCollection.h.

83  {
85  (event, std::forward<OptionalArgs>(optionalArgs)...);
86  }
unique_ptr< InputSource > make(ParameterSet const &conf, InputSourceDescription &desc)
Event finding and building.
template<typename Tag , typename Assns >
auto proxy::makeAssociatedData ( Assns const &  assns,
std::size_t  minSize = 0 
)

Processes and returns an associated data object.

Template Parameters
Tagthe tag labelling this associated data (if omitted: second type of the association: right_t)
Assnstype of association to be processed
Parameters
assnsassociation object to be processed
minSizeminimum number of entries in the produced association data
Returns
a new AssociatedData filled with associations from tag

The content of the association object must fulfill the requirements of one-to-many sequential association. The Assns type is expected to be a art::Assns instance. At least, the Assns type is required to have left_t and right_t definitions representing respectively the main data type and the associated one, and to respond to begin() and end() functions. The iterated object must also respond to std::get<0>() with a art::Ptr<left_t> and to std::get<1>() with a art::Ptr<right_t>.

Elements in the main collection not associated with any object will be recorded as such. If there is information for less than minSize main objects, more records will be added to mark the missing objects as not associated to anything.

Example:

// ...
auto assData = proxy::makeAssociatedData(assns);

will have assData tagged as recob::Hit.

Definition at line 1040 of file AssociatedData.h.

1041  {
1042  using Main_t = typename Assns::left_t;
1043  using Aux_t = typename Assns::right_t;
1044  using Metadata_t = lar::util::assns_metadata_t<Assns>;
1045  using AssociatedData_t
1046  = details::AssociatedData<Main_t, Aux_t, Metadata_t, Tag>;
1047 
1048  // associationRangeBoundaries() produces iterators to association elements,
1049  // (i.e. tuples)
1050  using std::begin;
1051  using std::end;
1052  auto ranges = details::associationRangeBoundaries<0U>
1053  (begin(assns), end(assns), minSize);
1054  // we convert those iterators into iterators to the right associated item
1055  // (it takes a few steps)
1056  using group_ranges_t = typename AssociatedData_t::group_ranges_t;
1057  return AssociatedData_t(
1058  group_ranges_t
1059  (typename group_ranges_t::boundaries_t(ranges.begin(), ranges.end()))
1060  );
1061  } // makeAssociatedDataFrom(assns)
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
typename assns_metadata_type< Assns >::type assns_metadata_t
Trait: type of metadata in Assns (association or its node).
Definition: AssnsTraits.h:62
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
template<typename Assns >
auto proxy::makeAssociatedData ( Assns const &  assns,
std::size_t  minSize = 0 
)

Definition at line 880 of file AssociatedData.h.

881  { return makeAssociatedData<typename Assns::right_t>(assns, minSize); }
template<typename Tag , typename MainColl , typename Assns >
auto proxy::makeAssociatedData ( MainColl const &  mainColl,
Assns const &  assns 
)

Creates and returns an associated data object.

Template Parameters
Tagthe tag labelling this associated data (if omitted: second type of the association: right_t)
MainColltype of the main collection object
Assnstype of the association object
Parameters
mainCollthe main collection object
assnsassociation data object
Returns
a new AssociatedData wrapping the information in assns
See also
makeAssociatedData(Assns const&, std::size_t)

This function operates like makeAssociatedData(Assns const&, std::size_t), where the size is extracted from the main data collection.

Definition at line 902 of file AssociatedData.h.

903  { return makeAssociatedData<Tag>(assns, mainColl.size()); }
template<typename MainColl , typename Assns >
auto proxy::makeAssociatedData ( MainColl const &  mainColl,
Assns const &  assns 
)

Definition at line 906 of file AssociatedData.h.

907  { return makeAssociatedData<typename Assns::right_t>(mainColl, assns); }
template<typename Tag , typename Assns >
auto proxy::makeOneTo01data ( Assns const &  assns,
std::size_t  minSize = 0 
)

Processes and returns an one-to-(zero/one) associated data object.

Template Parameters
Tagthe tag labelling this associated data (if omitted: second type of the association: right_t)
Assnstype of association to be processed
Parameters
assnsassociation object to be processed
minSizeminimum number of entries in the produced association data
Returns
a new OneTo01Data filled with associations from tag

The content of the association object must fulfill the requirements of one-to-(zero or one) sequential association. The Assns type is expected to be a art::Assns instance. At least, the Assns type is required to have left_t and right_t definitions representing respectively the main data type and the associated one, and to respond to begin() and end() functions. The iterated object must also respond to std::get<0>() with a art::Ptr<left_t> and to std::get<1>() with a art::Ptr<right_t>.

Elements in the main collection not associated with any object will present an invalid art pointer (isNull() true). If there is information for less than minSize main objects, more records will be added to mark the missing objects as not associated to anything.

Example:

// ...
auto assData = proxy::makeOneTo01data(assns);

will have assData tagged as recob::Vertex.

If Tag type is omitted, the class to the right side of the association is used as tag.

Definition at line 270 of file OneTo01Data.h.

271  {
272  using Main_t = typename Assns::left_t;
273  using Aux_t = typename Assns::right_t;
274  using Metadata_t = lar::util::assns_metadata_t<Assns>;
275  using AssociatedData_t
276  = details::OneTo01Data<Main_t, Aux_t, Metadata_t, Tag>;
277 
278  using std::cbegin;
279  using std::cend;
280  return AssociatedData_t(
281  details::associationOneToOneFullSequence<0U, 1U>
282  (cbegin(assns), cend(assns), minSize)
283  );
284  } // makeOneTo01data(assns)
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:87
typename assns_metadata_type< Assns >::type assns_metadata_t
Trait: type of metadata in Assns (association or its node).
Definition: AssnsTraits.h:62
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
Definition: StdUtils.h:82
template<typename Assns >
auto proxy::makeOneTo01data ( Assns const &  assns,
std::size_t  minSize = 0 
)

Definition at line 168 of file OneTo01Data.h.

169  { return makeOneTo01data<typename Assns::right_t>(assns, minSize); }
template<typename Tag , typename MainColl , typename Assns >
auto proxy::makeOneTo01data ( MainColl const &  mainColl,
Assns const &  assns 
)

Creates and returns an one-to-(zero/one) associated data object.

Template Parameters
Tagthe tag labelling this associated data (if omitted: second type of the association: right_t)
MainColltype of the main collection object
Assnstype of the association object
Parameters
mainCollthe main collection object
assnsassociation data object
Returns
a new OneTo01Data wrapping the information in assns
See also
makeOneTo01data(Assns const&, std::size_t)

This function operates like makeOneTo01data(Assns const&, std::size_t), where the size is extracted from the main data collection.

If Tag type is omitted, the class to the right side of the association is used as tag.

Definition at line 192 of file OneTo01Data.h.

193  { return makeOneTo01data<Tag>(assns, mainColl.size()); }
template<typename MainColl , typename Assns >
auto proxy::makeOneTo01data ( MainColl const &  mainColl,
Assns const &  assns 
)

Definition at line 196 of file OneTo01Data.h.

197  { return makeOneTo01data<typename Assns::right_t>(mainColl, assns); }
template<typename TrackProxy >
TrackPointData proxy::makeTrackPointData ( TrackProxy const &  track,
std::size_t  index 
)

Returns an object with information about the specified track point.

Template Parameters
TrackProxyan instance of proxy::Track template
Parameters
trackthe track (proxy) the points belong to
indexthe index of the point within the track
Returns
a TrackPointData object with information on that point

For an interface to the point information, see TrackPointWrapper.

Definition at line 709 of file Track.h.

710  {
711  static_assert(details::isTrackProxy<TrackProxy>(), "Not a proxy::Track!");
712  return {
713  &(track.track()),
714  track.hitAtPoint(index),
715  track.fitInfoAtPoint(index),
716  index
717  };
718  } // makeTrackPointData()
template<typename Aux , typename... Args>
auto proxy::withAssociated ( Args &&...  args)

Helper function to merge associated data with no metadata.

Template Parameters
Auxtype of associated data requested
Argstypes of constructor arguments for associated data collection
Parameters
argsconstructor arguments for the associated data collection
Returns
a temporary object that getCollection() knows to handle
See also
withAssociatedMeta(), withAssociatedMetaAs(), wrapAssociated()

This function is equivalent to withAssociatedMeta() but with the request of no associated metadata (Metadata be void). Example of usage:

auto tracks = proxy::getCollection<proxy::Tracks>
(event, trackTag, withAssociated<recob::Cluster>(clusterTag));

The cluster association ("clusterTag") will be accessed by using the type recob::Cluster as tag:

for (auto const& track: tracks) {
auto const& clusters = track.get<recob::Cluster>();
for (art::Ptr<recob::Cluster> const& cluster: clusters) {
// ...
} // for clusters
} // for tracks

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 378 of file withAssociated.h.

379  { return withAssociatedMeta<Aux, void>(std::forward<Args>(args)...); }
static QCString args
Definition: declinfo.cpp:674
template<typename Aux , typename AuxTag , typename... Args>
auto proxy::withAssociatedAs ( Args &&...  args)

Helper function to merge associated data with no metadata.

Template Parameters
Auxtype of associated data requested
AuxTagtag to access the associated data within the proxy
Argstypes of constructor arguments for associated data collection
Parameters
argsconstructor arguments for the associated data collection
Returns
a temporary object that getCollection() knows to handle
See also
withAssociatedMeta(), withAssociatedAs(), wrapAssociatedAs()

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:

struct MyClusters {};
void analyze(art::Event const& event) {
// ...
auto tracks = proxy::getCollection<proxy::Tracks>
(event, trackTag, withAssociatedAs<MyCluster>(clusterTag));
// ...
for (auto const& track: tracks) {
auto const& clusters = track.get<MyCluster>();
for (auto const& clusterInfo: clusters) {
// implicit conversion:
art::Ptr<recob::Cluster> const& clusterPtr = clusterInfo;
// access to the cluster itself
recob::Cluster const& cluster = *clusterInfo;
} // for clusters
} // for tracks

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 206 of file withAssociated.h.

207  {
208  return withAssociatedMetaAs<Aux, void, AuxTag>
209  (std::forward<Args>(args)...);
210  }
static QCString args
Definition: declinfo.cpp:674
template<typename Aux , typename Metadata , typename... Args>
auto proxy::withAssociatedMeta ( Args &&...  args)

Helper function to merge associated data.

Template Parameters
Auxtype of associated data requested
Metadatatype of associated metadata requested
Argstypes of constructor arguments for associated data collection
Parameters
argsconstructor arguments for the associated data collection
Returns
a temporary object that getCollection() knows to handle
See also
withAssociated(), withAssociatedAs(), withAssociatedMetaAs()

This 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.:

struct DubiousClusters {};
auto tracks = proxy::getCollection<proxy::Tracks>(event, trackTag,
withAssociatedMeta<recob::Cluster, void>(defaultClusterTag),
withAssociatedMetaAs<recob::Cluster, void, DubiousClusters>
(maybeClusterTag)
);

or, equivalently (because we asked for no metadata):

struct DubiousClusters {};
auto tracks = proxy::getCollection<proxy::Tracks>(event, trackTag,
withAssociated<recob::Cluster>(defaultClusterTag),
withAssociatedAs<recob::Cluster, DubiousClusters>(maybeClusterTag)
);

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):

for (auto const& track: tracks) {
auto const& clusters = track.get<recob::Clusters>();
auto const& maybeClusters = track.get<DubiousClusters>();
// ...
}

The full interface of track is documented in lar::CollectionView. The interface of clusters and maybeClusters is documented in proxy::details::AssnsNode.

Customization of the association proxy

To have a call like:

auto tracks = getCollection<SpecialTracks>
(event, tag, withAssociatedMeta<recob::Hit, void>(hitAssnTag, "special"));

create something different than the standard association proxy, specialize proxy::AssociatedDataProxyMaker, e.g.:

namespace proxy {
template <>
struct AssociatedDataProxyMaker
<recob::Track, recob::Hit, void, SpecialTracks>
: public AssociatedDataProxyMakerBase
<recob::Track, recob::Hit, void, SpecialTracks>
{
template<typename Event, typename MainArgs>
static auto make(
Event const& event,
MainArgs const&,
art::InputTag assnTag,
std::string quality
)
{
::SpecialTrackHitsProxy myAuxProxy;
// ... make it, and make it right
return myAuxProxy;
}
}; // struct AssociatedDataProxyMaker<..., SpecialTracks>
} // namespace proxy

(the void template type signifies the association has no metadata).

Technical details

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:

auto tracks = getCollection<proxy::Tracks>
(event, tag, withAssociated<recob::Hit>(hitAssnTag));

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 335 of file withAssociated.h.

336  {
337  return withAssociatedMetaAs<Aux, Metadata, Aux>
338  (std::forward<Args>(args)...);
339  }
static QCString args
Definition: declinfo.cpp:674
template<typename Aux , typename Metadata , typename AuxTag , typename... Args>
auto proxy::withAssociatedMetaAs ( Args &&...  args)

Helper function to merge associated data with metadata.

Template Parameters
Auxtype of associated data requested
Metadatatype of associated metadata requested
AuxTagtag to access the associated data within the proxy
Argstypes of constructor arguments for associated data collection
Parameters
argsconstructor arguments for the associated data collection
Returns
a temporary object that getCollection() knows to handle
See also
withAssociatedMeta(), withAssociatedMetaAs(), wrapAssociated()

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:

struct MyClusters {};
void analyze(art::Event const& event) {
// ...
auto tracks = proxy::getCollection<proxy::Tracks>
(event, trackTag, withAssociatedMetaAs<int, MyCluster>(clusterTag));
// ...
for (auto const& track: tracks) {
auto const& clusters = track.get<MyCluster>();
for (auto const& clusterInfo: clusters) {
// implicit conversion:
art::Ptr<recob::Cluster> const& clusterPtr = clusterInfo;
// access to the cluster itself
recob::Cluster const& cluster = *clusterInfo;
// access to the metadata
int index = clusterInfo.data();
} // for clusters
} // for tracks

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 149 of file withAssociated.h.

149  {
150  using ArgTuple_t = std::tuple<Args&&...>;
151  ArgTuple_t argsTuple(std::forward<Args>(args)...);
152  return details::WithAssociatedStruct<Aux, Metadata, ArgTuple_t, AuxTag>
153  (std::move(argsTuple));
154  } // withAssociatedMetaAs()
static QCString args
Definition: declinfo.cpp:674
def move(depos, offset)
Definition: depos.py:107
template<typename Aux , typename... Args>
auto proxy::withParallelData ( Args &&...  args)

Helper function to merge an auxiliary data product into the proxy.

Template Parameters
Auxtype of parallel data product requested
Argstypes of constructor arguments for parallel data proxy
Parameters
argsconstructor arguments for the parallel data collection proxy
Returns
a temporary object that getCollection() knows to handle

This 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.:

struct MCS {};
auto tracks = proxy::getCollection<proxy::Tracks>(event, trackTag,
withParallelData<recob::TrackMomentum>(defaultMomTag),
withParallelDataAs<recob::TrackMomentum, MCS>(MCSmomTag)
);

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):

for (auto&& track: tracks) {
decltype(auto) trackMom = track.get<recob::TrackMomentum>();
decltype(auto) trackMCSmom = track.get<MCS>();
// ...
}

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.

Customization of the parallel data proxy

To have a call like:

auto tracks = getCollection<SpecialTracks>
(event, tag, withParallelData<recob::TrackMomentum>(momTag, "special"));

to create something different than the standard parallel data proxy, one needs to specialize proxy::ParallelDataProxyMaker, e.g.:

namespace proxy {
template <>
struct ParallelDataProxyMaker<recob::Track, recob::TrackMomentum, SpecialTracks>
: public ParallelDataProxyMakerBase<recob::Track, std::vector<recob::TrackMomentum>, recob::TrackMomentum>
{
template<typename Event, typename MainArgs>
static auto make(
Event const& event,
MainArgs const&,
art::InputTag assnTag,
std::string quality = "default"
)
{
::SpecialTrackHitsProxy myAuxProxy;
// ... make it, and make it right
return myAuxProxy;
}
}; // struct ParallelDataProxyMaker<recob::Track, recob::TrackMomentum, SpecialTracks>
} // namespace proxy

Definition at line 182 of file withParallelData.h.

183  { return withParallelDataAs<Aux, Aux>(std::forward<Args>(args)...); }
static QCString args
Definition: declinfo.cpp:674
template<typename Aux , typename AuxTag , typename... Args>
auto proxy::withParallelDataAs ( Args &&...  args)

Helper function to merge an auxiliary data product into the proxy.

Template Parameters
Auxtype of parallel data product requested
AuxTagthe tag type to refer this auxiliary data as
Argstypes of constructor arguments for parallel data proxy
Parameters
argsconstructor arguments for the parallel data collection proxy
Returns
a temporary object that getCollection() knows to handle
See also
proxy::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 96 of file withParallelData.h.

96  {
97  using ArgTuple_t = std::tuple<Args&&...>;
98  ArgTuple_t argsTuple(std::forward<Args>(args)...);
99  return details::WithParallelCollectionStruct<Aux, ArgTuple_t, AuxTag>
100  (std::move(argsTuple));
101  } // withParallelDataAs()
static QCString args
Definition: declinfo.cpp:674
def move(depos, offset)
Definition: depos.py:107
template<typename Aux , typename... Args>
auto proxy::withZeroOrOne ( Args &&...  args)

Works like withZeroOrOneMeta(), but for associations with no metadata.

See also
withZeroOrOneAs(), withZeroOrOneMeta()

Definition at line 161 of file withZeroOrOne.h.

162  { return withZeroOrOneMeta<Aux, void>(std::forward<Args>(args)...); }
static QCString args
Definition: declinfo.cpp:674
template<typename Aux , typename AuxTag , typename... Args>
auto proxy::withZeroOrOneAs ( Args &&...  args)

The same as withZeroOrOne(), but it also specified a tag for the data.

Definition at line 81 of file withZeroOrOne.h.

82  {
83  return
84  withZeroOrOneMetaAs<Aux, void, AuxTag>(std::forward<Args>(args)...);
85  }
static QCString args
Definition: declinfo.cpp:674
template<typename Aux , typename Metadata , typename... Args>
auto proxy::withZeroOrOneMeta ( Args &&...  args)

Helper function to merge one-to-(zero-or-one) associated data.

Template Parameters
Auxtype of associated data requested
Metadatatype of metadata coming with the associated data
Argstypes of constructor arguments for associated data collection
Parameters
argsconstructor arguments for the associated data collection
Returns
a temporary object that getCollection() knows to handle
See also
withZeroOrOneMetaAs(), withZeroOrOne()

This 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.:

struct QuestionableVertex {};
auto tracks = proxy::getCollection<proxy::Tracks>(event, trackTag,
withZeroOrOneMeta<recob::Vertex, void>(defaultVertexTag),
withZeroOrOneMetaAs<recob::Vertex, void, QuestionableVertex>
(stinkyVertexTag)
);

and, since we are not requesting any metadata, this is equivalent to

struct QuestionableVertex {};
auto tracks = proxy::getCollection<proxy::Tracks>(event, trackTag,
withZeroOrOne<recob::Vertex>(defaultVertexTag),
withZeroOrOneAs<recob::Vertex, QuestionableVertex>(stinkyVertexTag)
);

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):

for (auto&& track: tracks) {
decltype(auto) vertex = track.get<recob::Vertex>();
decltype(auto) maybeVertex = track.get<QuestionableVertex>();
// ...
}

Customization of the association proxy

See the technical details about withAssociated(), which hold for this function and related classes too.

Technical details

See the technical details about withAssociated(), which hold for this function and related classes too.

Todo:
Metadata is not supported yet (the interface is apparently there though).

Definition at line 151 of file withZeroOrOne.h.

152  {
153  return
154  withZeroOrOneMetaAs<Aux, Metadata, Aux>(std::forward<Args>(args)...);
155  }
static QCString args
Definition: declinfo.cpp:674
template<typename Aux , typename Metadata , typename AuxTag , typename... Args>
auto proxy::withZeroOrOneMetaAs ( Args &&...  args)

The same as withZeroOrOneMeta(), but it also specified a tag.

Todo:
Metadata is not supported yet.

Definition at line 69 of file withZeroOrOne.h.

69  {
70  using ArgTuple_t = std::tuple<Args&&...>;
71  ArgTuple_t argsTuple(std::forward<Args>(args)...);
72  return
73  details::WithOneTo01AssociatedStruct<Aux, Metadata, ArgTuple_t, AuxTag>
74  (std::move(argsTuple));
75  } // withZeroOrOneAs()
static QCString args
Definition: declinfo.cpp:674
def move(depos, offset)
Definition: depos.py:107
template<typename Assns >
auto proxy::wrapAssociated ( Assns const &  assns)

Helper function to merge associated data from a given association.

Template Parameters
Assnstype of the association being merged; needs art::Assns interface
Parameters
assnsthe association being merged
Returns
a temporary object that getCollection() knows to handle
See also
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:

void checkClusters
{
auto tracks = proxy::getCollection<proxy::Tracks>
(event, trackTag, wrapAssociated(clusters));
for (auto const& track: tracks) {
auto const& clusters = track.get<recob::Cluster>();
for (art::Ptr<recob::Cluster> const& cluster: clusters) {
// ...
} // for clusters
} // for tracks
} // checkClusters()

For more extensive information, see proxy::withAssociatedMeta().

Definition at line 479 of file withAssociated.h.

480  { return wrapAssociatedAs<typename Assns::right_t>(assns); }
template<typename AuxTag , typename Assns >
auto proxy::wrapAssociated ( Assns const &  assns)

Helper function to merge associated data from a given association.

Template Parameters
AuxTagtag to access the associated data within the proxy
Assnstype of the association being merged; needs art::Assns interface
Parameters
assnsthe association being merged
Returns
a temporary object that getCollection() knows to handle
See also
withAssociatedMeta(), wrapAssociatedAs()

This function instructs the proxy to use the specified association assns directly. It is fully equivalent to proxy::wrapAssociatedAs().

Definition at line 497 of file withAssociated.h.

498  { return wrapAssociatedAs<AuxTag>(assns); }
template<typename AuxTag , typename Assns >
auto proxy::wrapAssociatedAs ( Assns const &  assns)

Helper function to merge associated data from a given association.

Template Parameters
AuxTagtag to access the associated data within the proxy
Assnstype of the association being merged; needs art::Assns interface
Parameters
assnsthe association being merged
Returns
a temporary object that getCollection() knows to handle
See also
withAssociatedMeta(), withAssociatedMetaAs(), wrapAssociated()

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:

struct Clusters {};
void checkClusters
{
auto tracks = proxy::getCollection<proxy::Tracks>
(event, trackTag, wrapAssociatedAs<::Clusters>(clusters));
for (auto const& track: tracks) {
auto const& clusters = track.get<::Clusters>();
for (art::Ptr<recob::Cluster> const& cluster: clusters) {
// ...
} // for clusters
} // for tracks
} // checkClusters()

For more extensive information, see proxy::withAssociatedMeta().

Definition at line 426 of file withAssociated.h.

427  {
428  using Aux_t = typename Assns::right_t;
429  using Metadata_t = lar::util::assns_metadata_t<Assns>;
430  return
431  details::WithAssociatedStruct<Aux_t, Metadata_t, std::tuple<>, AuxTag>
432  ({});
433  } // wrapAssociatedAs()
typename assns_metadata_type< Assns >::type assns_metadata_t
Trait: type of metadata in Assns (association or its node).
Definition: AssnsTraits.h:62
template<typename AuxColl >
auto proxy::wrapParallelData ( AuxColl const &  auxColl)

Uses a collection as auxiliary data for a collection proxy.

Template Parameters
AuxColltype of the auxiliary data collection
Parameters
auxCollthe data collection to be used as auxiliary data
Returns
an object making getCollection() add such auxiliary data
See also
proxy::withParallelData(), proxy::wrapParallelDataAs()

This 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 261 of file withParallelData.h.

262  { return wrapParallelDataAs<util::collection_value_t<AuxColl>>(auxColl); }
template<typename AuxTag , typename AuxColl >
auto proxy::wrapParallelDataAs ( AuxColl const &  auxColl)

Uses a collection as auxiliary data for a collection proxy.

Template Parameters
AuxTagthe tag type to refer this auxiliary data as
AuxColltype of the auxiliary data collection
Parameters
auxCollthe data collection to be used as auxiliary data
Returns
an object making getCollection() add such auxiliary data
See also
withParallelDataAs(), 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:

struct MCS {};
void checkMomenta(
std::vector<recob::TrackMomentum> const& mom,
std::vector<recob::TrackMomentum> const& MCSmom
) {
auto tracks = proxy::getCollection<proxy::Tracks>(event, trackTag,
wrapParallelData<recob::TrackMomentum>(defaultMomTag),
wrapParallelDataAs<recob::TrackMomentum, MCS>(MCSmomTag)
);
for (auto const& track: tracks) {
auto const& trackMom = track.get<recob::TrackMomentum>();
auto const& trackMCSmom = track.get<MCS>();
// ...
} // for tracks
} // checkMomenta()

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 233 of file withParallelData.h.

233  {
234  std::tuple<AuxColl const&> args = { auxColl };
236  <util::collection_value_t<AuxColl>, decltype(args), AuxColl, AuxTag>
237  (std::move(args));
238  } // wrapParallelDataAs()
static QCString args
Definition: declinfo.cpp:674
def move(depos, offset)
Definition: depos.py:107
WithAssociatedStructBase< Aux, void, ArgTuple, ParallelDataProxyMakerWrapper< Aux, AuxTag, AuxColl >::template maker_t, AuxTag > WithWrappedParallelCollectionStruct
typename collection_value_type< Coll >::type collection_value_t
Type contained in the collection Coll.
Definition: ContainerMeta.h:65
template<typename Data >
auto proxy::wrapTrackPoint ( Data const &  wrappedData)

"Converts" point data into a proxy::TrackPointWrapper.

Definition at line 1263 of file Track.h.

1264  {
1265  (void) details::StaticAsserts<TrackPointWrapper<Data>>();
1266  return reinterpret_cast<TrackPointWrapper<Data> const&>(wrappedData);
1267  }