Class podio::SIOReader
-
class SIOReader
The SIOReader can be used to read files that have been written with the SIO backend.
The SIOReader provides the data as SIOFrameData from which a podio::Frame can be constructed. It can be used to read files written by the SIOWriter.
Public Functions
-
SIOReader()
Create an SIOReader.
-
~SIOReader() = default
SIOReader destructor.
-
std::unique_ptr<podio::SIOFrameData> readNextEntry(const std::string &name, const std::vector<std::string> &collsToRead = {})
Read the next data entry for a given category.
Note
Given how the SIO files are currently laid out it is in fact not possible to only read a subset of a Frame. Rather the subset of collections to read will be an artificial limit on the returned SIOFrameData. Limiting the collections to read will not improve I/O performance.
- Parameters:
name – The category name for which to read the next entry
collsToRead – (optional) the collection names that should be read. If not provided (or empty) all collections will be read
- Returns:
FrameData from which a podio::Frame can be constructed if the category exists and if there are still entries left to read. Otherwise a nullptr
-
std::unique_ptr<podio::SIOFrameData> readEntry(const std::string &name, const unsigned entry, const std::vector<std::string> &collsToRead = {})
Read the desired data entry for a given category.
Note
Given how the SIO files are currently laid out it is in fact not possible to only read a subset of a Frame. Rather the subset of collections to read will be an artificial limit on the returned SIOFrameData. Limiting the collections to read will not improve I/O performance.
- Parameters:
name – The category name for which to read the next entry
entry – The entry number to read
collsToRead – (optional) the collection names that should be read. If not provided (or empty) all collections will be read
- Returns:
FrameData from which a podio::Frame can be constructed if the category and the desired entry exist. Otherwise a nullptr
-
unsigned getEntries(const std::string &name) const
Get the number of entries for the given name.
- Parameters:
name – The name of the category
- Returns:
The number of entries that are available for the category
-
void openFile(const std::string &filename)
Open the passed file for reading.
- Parameters:
filename – The path to the file to read from
-
inline podio::version::Version currentFileVersion() const
Get the build version of podio that has been used to write the current file.
- Returns:
The podio build version
-
inline std::optional<podio::version::Version> currentFileVersion(const std::string &name) const
Get the (build) version of a datamodel that has been used to write the current file.
- Parameters:
name – The name of the datamodel
- Returns:
The (build) version of the datamodel if available or an empty optional
-
std::vector<std::string_view> getAvailableCategories() const
Get the names of all the available Frame categories in the current file.
- Returns:
The names of the available categores from the file
-
inline const std::string_view getDatamodelDefinition(const std::string &name) const
Get the datamodel definition for the given name.
- Parameters:
name – The name of the datamodel
- Returns:
The high level definition of the datamodel in JSON format
-
inline std::vector<std::string> getAvailableDatamodels() const
Get all names of the datamodels that are available from this reader.
- Returns:
The names of the datamodels
-
SIOReader()