HEPnOS client API: DataStore and DataSet
Let's dive into the HEPnOS client-side API. This API is in C++ and provides a number of classes, among which DataStore and DataSet, which are discussed in this section.
The HEPnOS API is located in
hepnos.hpp, which is a small file including other files containing class definitions. In the following, we assume that
#include <hepnos.hpp> is present at the top of your file, and will not explicitly write it.
All the classes and functions of the HEPnOS API are in the
hepnos namespace. To simplify codes, we assume that
using namespace hepnos; is present, and we will not be using the
The DataStore class is the main class to instantiate to point to a running HEPnOS service.
DataStore can be instantiated in two ways:
// using the path to the configuration file generated by the service DataStore datastore("/path/to/config.yml"); // using the HEPNOS_CONFIG_FILE environment variable, which should point to the file DataStore datastore();
Important note: the created DataStore instance must outlive any instances of other HEPnOS classes (DataSet, Run, SubRun, Event, etc.), since instances of these classes hold a pointer to the DataStore object to which they belong.
New DataSets can be created at the root of the datastore using the following method:
DataSet ds = datastore.createDataSet("mydataset");
This function creates a new dataset at the root of the datastore and returns a handle to it. If a dataset with the same name already exists, this function does nothing but returns a handle to the existing dataset.
Important note: the name of the created DataSet should not have
# characters, since those are reserved by HEPnOS.
The DataStore class presents an interface similar to that of an