Project

General

Profile

SamplingInput products

For processes that use the SamplingInput source, access to event products is supported in the same manner as it is for (e.g.) the RootInput source.

art::Sampled<T> products

For any job that uses the SamplingInput source, only one run and one subrun will be generated. However, to access (sub)run products from the input datasets, the art::Sampled<T> template is provided. Consider the following input datasets:

Dataset Run SubRun Products
Type Module label Instance name Process name
Signal 1 EventCount makeEventCount Gen
Calibration storeCalibration Reco
2 DetIndices activeDets calo Sim
3 DetIndices activeDets calo Sim
Background 7 EventCount makeEventCount Gen
Calibration storeCalibration Reco
9 DetIndices activeDets calo Sim
DetIndices activeDets tracker Sim

If the "Signal" and "Background" datasets were inputs to a job using SamplingInput, (sub)run products can be accessed by using the get interface.

// For run products:
cet::exempt_ptr<T const> 
art::Sampled<T>::get(std::string const& dataset, RunID const& on_disk_id);

// For subrun products:
cet::exempt_ptr<T const> 
art::Sampled<T>::get(std::string const& dataset, SubRunID const& on_disk_id);

Note that the return type of exempt_ptr denotes that the returned type is a pointer that is non-owning. A null pointer is returned if a product corresponding to the provided dataset and on-disk ID is not available. This means that users must check the validity of the returned pointer before using it.

See below for examples of the use of art::Sampled<T>::get for the products and (sub)runs listed above.

Constraints

The art::Sampled<T> class template is not able to support art::Assns- or art::Ptr-based products due to Ptr-reseeding issues. A run-time exception will be thrown if an attempt is made to create a product that explicitly mentions either art::Assns or art::Ptr in its name. No diagnostic error can be emitted for attempts to created a sampled product that implicitly depends on art::Assns or art::Ptrs. Please contact for guidance.

Persistence

Due to the complicated nature of forming sampled products, for each art::Sampled<MyProduct> object to be persisted to disk, additional dictionaries must be formed. For those who use classes_def.xml files, the following should be added:

<lcgdict>
  ...
  <class name="std::map<art::SubRunID,MyProduct>"/>
  <class name="std::map<std::string,std::map<art::SubRunID,MyProduct>>"/>
  <class name="art::Sampled<MyProduct>"/>
  <class name="art::Wrapper<art::Sampled<MyProduct>>"/>
  ...
</lcgdict>

In the classes.h file the following line header dependencies should appear:

#include "canvas/Persistency/Common/Sampled.h" 
#include "canvas/Persistency/Common/Wrapper.h"