Namespaces | Classes | Functions
Associated data infrastructure

Infrastructure for support of associated data. More...

Namespaces

 proxy::details
 

Classes

struct  proxy::AssociatedDataProxyMakerBase< Main, Aux, Metadata, AuxTag >
 Creates an associated data wrapper for the specified types. More...
 
class  proxy::AssociatedDataProxyMaker< Main, Aux, Metadata, CollProxy, Tag >
 Creates an associated data wrapper for the specified types. More...
 
struct  proxy::OneTo01DataProxyMakerBase< Main, Aux, Metadata, AuxTag >
 Creates an one-to-(zero-or-one) wrapper for the specified types. More...
 
class  proxy::OneTo01DataProxyMaker< Main, Aux, Metadata, CollProxy, Tag >
 Creates an one-to-(zero-or-one) wrapper for the specified types. More...
 
class  WithAssociatedStruct
 Helper to create associated data proxy. More...
 

Functions

template<typename Tag , typename Assns >
auto proxy::makeAssociatedDataFrom (Assns const &assns, std::size_t minSize=0)
 
template<typename Assns >
auto proxy::makeAssociatedDataFrom (Assns const &assns, std::size_t minSize=0)
 
template<typename Main , typename Aux , typename Metadata , typename Tag , typename Event >
auto proxy::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 proxy::makeAssociatedDataFrom (Event const &event, art::InputTag const &tag, std::size_t minSize=0)
 
template<typename Main , typename Aux , typename Event >
auto proxy::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 proxy::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 proxy::makeAssociatedDataFrom (Handle &&handle, Event const &event, art::InputTag const &tag)
 
template<typename Aux , typename Handle , typename Event >
auto proxy::makeAssociatedDataFrom (Handle &&handle, Event const &event, art::InputTag const &tag)
 
template<typename Tag , typename MainColl , typename Assns >
auto proxy::makeAssociatedDataFrom (MainColl const &mainColl, Assns const &assns)
 Creates and returns an associated data object. More...
 
template<typename MainColl , typename Assns >
auto proxy::makeAssociatedDataFrom (MainColl const &mainColl, Assns const &assns)
 
template<typename Tag , typename Assns >
auto proxy::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 proxy::makeOneTo01dataFrom (Assns const &assns, std::size_t minSize=0)
 
template<typename Main , typename Aux , typename Metadata , typename Tag , typename Event >
auto proxy::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 proxy::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 proxy::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 proxy::makeOneTo01dataFrom (Handle &&handle, Event const &event, art::InputTag const &tag)
 
template<typename Tag , typename MainColl , typename Assns >
auto proxy::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 proxy::makeOneTo01dataFrom (MainColl const &mainColl, Assns const &assns)
 

Detailed Description

Infrastructure for support of associated data.

Associated data is auxiliary data connected to the main data via art associations. The following associated data are currently supported:

Function Documentation

template<typename Tag , typename Assns >
auto proxy::makeAssociatedDataFrom ( Assns const &  assns,
std::size_t  minSize = 0 
)

Definition at line 35 of file makeAssociatedDataFrom.h.

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

Definition at line 39 of file makeAssociatedDataFrom.h.

40  { return makeAssociatedDataFrom<typename Assns::right_t>(assns, minSize); }
template<typename Main , typename Aux , typename Metadata , typename Tag , typename Event >
auto proxy::makeAssociatedDataFrom ( Event const &  event,
art::InputTag const &  tag,
std::size_t  minSize = 0 
)

Creates and returns an associated data object.

Template Parameters
Maintype of main object to be associated
Auxtype of data to be associated to the main objects
Metadatatype of metadata in the association (if omitted: void)
Tagthe tag labelling this associated data (if omitted: Aux)
Eventtype of event to read associations from
Parameters
eventevent to read associations from
taginput tag of the association object
minSizeminimum number of entries in the produced association data
Returns
a new AssociatedData filled with associations from tag

The association being retrieved must fulfill the requirements of one-to-many sequential association.

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.

Two template types must be explicitly specified, e.g.

auto assData = makeAssociatedDataFrom<recob::Track, recob::Hit>(event, tag);

Definition at line 184 of file makeAssociatedDataFrom.h.

187  {
188  using Main_t = Main;
189  using Aux_t = Aux;
190  using Metadata_t = Metadata;
191  using AssociatedData_t
192  = details::AssociatedData<Main_t, Aux_t, Metadata_t, Tag>;
193  using Assns_t = typename AssociatedData_t::assns_t;
194 
195  return
196  makeAssociatedDataFrom<Tag>(*(event.template getValidHandle<Assns_t>(tag)));
197 
198  } // makeAssociatedDataFrom(tag)
template<typename Main , typename Aux , typename Metadata , typename Event >
auto proxy::makeAssociatedDataFrom ( Event const &  event,
art::InputTag const &  tag,
std::size_t  minSize = 0 
)

Definition at line 76 of file makeAssociatedDataFrom.h.

77  {
78  return makeAssociatedDataFrom<Main, Aux, Metadata, Aux, Event>
79  (event, tag, minSize);
80  }
template<typename Main , typename Aux , typename Event >
auto proxy::makeAssociatedDataFrom ( Event const &  event,
art::InputTag const &  tag,
std::size_t  minSize = 0 
)

Definition at line 84 of file makeAssociatedDataFrom.h.

85  {
86  return makeAssociatedDataFrom<Main, Aux, void, Aux, Event>
87  (event, tag, minSize);
88  }
template<typename Aux , typename Metadata , typename Tag , typename Handle , typename Event >
auto proxy::makeAssociatedDataFrom ( Handle &&  handle,
Event const &  event,
art::InputTag const &  tag 
)

Creates and returns an associated data object.

Template Parameters
Auxtype of data to be associated to the main objects
Metadatatype of metadata in the association (if omitted: void)
Tagthe tag labelling this associated data (if omitted: Aux)
Handletype of handle to the main collection object
Eventtype of event to read associations from
Parameters
handlehandle to the main collection object
eventevent to read associations from
taginput tag of the association object
Returns
a new AssociatedData filled with associations from tag
See also
makeAssociatedDataFrom(Event const&, art::InputTag, std::size_t)

This function operates like makeAssociatedDataFrom(Event const&, art::InputTag, std::size_t), but it extracts the information about the type of main object and the minimum number of them from a handle. The handle object is expected to behave as a smart pointer to a collection of elements of the associated type.

One template type must be explicitly specified, e.g.

auto assData = makeAssociatedDataFrom<recob::Hit>(handle, event, tag);

Definition at line 207 of file makeAssociatedDataFrom.h.

208  {
209  // Handle::value_type is the main data product type (a collection)
211  using Aux_t = Aux;
212  using Metadata_t = Metadata;
213  return makeAssociatedDataFrom<Main_t, Aux_t, Metadata_t, Tag>
214  (event, tag, handle->size());
215  } // makeAssociatedDataFrom(handle)
typename collection_value_type< Coll >::type collection_value_t
Type contained in the collection Coll.
Definition: ContainerMeta.h:65
template<typename Aux , typename Metadata , typename Handle , typename Event >
auto proxy::makeAssociatedDataFrom ( Handle &&  handle,
Event const &  event,
art::InputTag const &  tag 
)

Definition at line 124 of file makeAssociatedDataFrom.h.

125  {
126  return makeAssociatedDataFrom<Aux, Metadata, Aux, Handle, Event>
127  (std::forward<Handle>(handle), event, tag);
128  }
Event finding and building.
template<typename Aux , typename Handle , typename Event >
auto proxy::makeAssociatedDataFrom ( Handle &&  handle,
Event const &  event,
art::InputTag const &  tag 
)

Definition at line 132 of file makeAssociatedDataFrom.h.

133  {
134  return makeAssociatedDataFrom<Aux, void, Aux, Handle, Event>
135  (std::forward<Handle>(handle), event, tag);
136  }
Event finding and building.
template<typename Tag , typename MainColl , typename Assns >
auto proxy::makeAssociatedDataFrom ( MainColl const &  mainColl,
Assns const &  assns 
)

Creates and returns an associated data object.

Template Parameters
Tagthe tag labelling this associated data (if omitted: Aux)
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
makeAssociatedDataFrom(Assns const&, std::size_t)

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

Definition at line 154 of file makeAssociatedDataFrom.h.

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

Definition at line 158 of file makeAssociatedDataFrom.h.

159  { return makeAssociatedDataFrom<typename Assns::right_t>(mainColl, assns); }
template<typename Tag , typename Assns >
auto proxy::makeOneTo01dataFrom ( 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 = makeOneTo01dataFrom(assns);

will have assData tagged as recob::Vertex.

Definition at line 67 of file makeOneTo01dataFrom.h.

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

Definition at line 71 of file makeOneTo01dataFrom.h.

72  { return proxy::makeOneTo01data(assns, minSize); }
auto makeOneTo01data(Assns const &assns, std::size_t minSize=0)
Processes and returns an one-to-(zero/one) associated data object.
Definition: OneTo01Data.h:270
template<typename Main , typename Aux , typename Metadata , typename Tag , typename Event >
auto proxy::makeOneTo01dataFrom ( Event const &  event,
art::InputTag const &  tag,
std::size_t  minSize = 0 
)

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

Template Parameters
Maintype of main object to be associated
Auxtype of data to be associated to the main objects
Metadatatype of metadata in the association
Tagthe tag labelling this associated data (if omitted: Aux)
Eventtype of event to read associations from
Parameters
eventevent to read associations from
taginput tag of the association object
minSizeminimum number of entries in the produced association data
Returns
a new OneTo01Data filled with associations from tag
See also
makeOneTo01dataFrom(Assns, std::size_t)

The association being retrieved must fulfill the requirements of one-to-(zero or one) sequential association.

Two template types must be explicitly specified, e.g.

auto assData = makeOneTo01dataFrom<recob::Track, recob::Vertex>(event, tag);

Definition at line 192 of file makeOneTo01dataFrom.h.

195  {
196  using Main_t = Main;
197  using Aux_t = Aux;
198  using Metadata_t = Metadata;
199  using AssociatedData_t
200  = details::OneTo01Data<Main_t, Aux_t, Metadata_t, Tag>;
201  using Assns_t = typename AssociatedData_t::assns_t;
202 
203  return makeOneTo01dataFrom<Tag>
204  (*(event.template getValidHandle<Assns_t>(tag)), minSize);
205 
206  } // makeOneTo01dataFrom(tag)
template<typename Main , typename Aux , typename Metadata , typename Event >
auto proxy::makeOneTo01dataFrom ( Event const &  event,
art::InputTag const &  tag,
std::size_t  minSize = 0 
)

Definition at line 103 of file makeOneTo01dataFrom.h.

104  {
105  return makeOneTo01dataFrom<Main, Aux, Metadata, Aux, Event>
106  (event, tag, minSize);
107  }
template<typename Aux , typename Metadata , typename Tag , typename Handle , typename Event >
auto proxy::makeOneTo01dataFrom ( Handle &&  handle,
Event const &  event,
art::InputTag const &  tag 
)

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

Template Parameters
Auxtype of data to be associated to the main objects
Tagthe tag labelling this associated data (if omitted: Aux)
Handletype of handle to the main collection object
Eventtype of event to read associations from
Parameters
handlehandle to the main collection object
eventevent to read associations from
taginput tag of the association object
Returns
a new OneTo01Data wrapping the information in assns
See also
makeAssociatedDataFrom(Event const&, art::InputTag, std::size_t)

This function operates like makeOneTo01dataFrom(Event const&, art::InputTag, std::size_t), but it extracts the information about the type of main object and the minimum number of them from a handle. The handle object is expected to behave as a smart pointer to a collection of elements of the associated type.

One template type must be explicitly specified, e.g.

auto assData = makeOneTo01dataFrom<recob::Vertex>(handle, event, tag);

Definition at line 216 of file makeOneTo01dataFrom.h.

217  {
218  // Handle::value_type is the main data product type (a collection)
220  using Aux_t = Aux;
221  using Metadata_t = Metadata;
222  return makeOneTo01dataFrom<Main_t, Aux_t, Metadata_t, Tag>
223  (event, tag, handle->size());
224  } // makeOneTo01dataFrom(handle)
typename collection_value_type< Coll >::type collection_value_t
Type contained in the collection Coll.
Definition: ContainerMeta.h:65
template<typename Aux , typename Metadata , typename Handle , typename Event >
auto proxy::makeOneTo01dataFrom ( Handle &&  handle,
Event const &  event,
art::InputTag const &  tag 
)

Definition at line 142 of file makeOneTo01dataFrom.h.

143  {
144  return makeOneTo01dataFrom<Aux, Metadata, Aux, Handle, Event>
145  (std::forward<Handle>(handle), event, tag);
146  }
Event finding and building.
template<typename Tag , typename MainColl , typename Assns >
auto proxy::makeOneTo01dataFrom ( 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: Aux)
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
makeOneTo01dataFrom(Assns const&, std::size_t)

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

Definition at line 164 of file makeOneTo01dataFrom.h.

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

Definition at line 168 of file makeOneTo01dataFrom.h.

169  { return proxy::makeOneTo01data<typename Assns::right_t>(mainColl, assns); }