3.7. Data-Product Providers¶
Data-product providers are framework components that provide data products to downstream configured HOFs. They take as input data cell indices. A user-supplied provider invokes a user-supplied provider algorithm. There are also framework-supplied providers that use framework IO subsystem to read data products from framework supported data files. These providers communicate with the IO system through a specified API that is implemented by each IO back end. Providers communicate with the IO system only through this API. This allows the framework to support multiple IO back ends, including ROOT [DUNE 74] and HDF5 [DUNE 141], and ensure that new back ends can be added without modifying the framework code [DUNE 73].
Providers are responsible for reading data written by earlier code versions, subject to policy decisions made by the experiment [DUNE 76].
Providers are also responsible for reading some types of data (such as calibration data, or geometry descriptions) from sources other than files written by the IO system. The workflow shown in Fig. 3.1 shows an example of one such provider algorithm, which reads geometry data from a GDML file.
3.7.1. Provider Function Signature¶
The provider function take a data cell index as input and returns a data product.
return_type function_name(data_cell_index const& id)
The reurn_type must model the created data-product type described in Section 3.3.2.
Only a single data product can be returned by a provider function.
3.7.2. Provider Registration¶
To illustrate the how a provider function is registered with Phlex, we use the following class and function, which are presumably defined in some experiment libraries.
class SimDepos { ... };
SimDepos provide_sim_depos(data_cell_index const&) { ... }
Provider function that returns SimDepos
PHLEX_REGISTER_PROVIDERS(s)
{
s.provide("fake_sim_depos", provide_sim_depos, concurrency::unlimited)
.output_product_suffixes("");
}
Provider registration
This registers a provider that inserts a \(\textit{SimDepos}\) data product into each data cell in the data layer indicated by the data cell index.
In this example, the data product suffix provided to output_product_suffixes is an empty string.
The same affect can be achieved by omitting the output_product_suffixes call entirely.