Class RMGConvertLH5¶
Defined in File RMGConvertLH5.hh
Class Documentation¶
-
class RMGConvertLH5¶
Converter class for converting between HDF5 and LH5 file formats.
This class provides methods to convert Geant4 HDF5 output files into the LH5 format and also to convert LH5 input files back to HDF5. It supports conversion of ntuple data.
Public Static Functions
-
static bool ConvertToLH5(std::string, std::string, std::set<std::string>, const std::map<int, std::pair<int, std::string>>&, bool, bool part_of_batch = false, int n_ev = -1, std::string output_group = "")¶
Convert a Geant4 HDF5 output file to LH5 format.
This function converts the specified HDF5 file to the LH5 format, reformatting the ntuple data into table format.
- Parameters:
hdf5_file_name – The input HDF5 file name.
ntuple_group_name – The name of the ntuple group in the HDF5 file.
aux_ntuples – A set of auxiliary ntuple names.
ntuple_meta – A mapping of detector uids to a pair of ntuple id and ntuple name.
dry_run – If true, the conversion is performed in-memory without writing to disk.
part_of_batch – Indicates if this conversion is part of a batch operation.
n_ev – number of events to write as an additional attribute into the file.
output_group – group the whole output is moved into; empty to keep it in the file root.
- Returns:
True if the conversion is successful, false otherwise.
-
static bool CopyMissingObjects(std::string src_file_name, std::string dst_file_name)¶
Copy the top-level objects of an LH5 file into another one.
Objects already present in the destination file are not copied, i.e. the contents of the destination file win over the ones of the source file.
- Parameters:
src_file_name – The file to copy from.
dst_file_name – The file to copy into.
- Returns:
True if all objects could be copied, false otherwise.
-
static bool ConvertFromLH5(std::string, std::string, bool, bool part_of_batch, std::map<std::string, std::map<std::string, std::string>>&)¶
Convert an LH5 input file to HDF5 format.
This function converts the specified LH5 file to HDF5 format suitable for reading by Geant4, reformatting ntuple tables into ntuple datasets.
- Parameters:
lh5_file_name – The input LH5 file name.
ntuple_group_name – The name of the ntuple group in the LH5 file.
dry_run – If true, the conversion is performed in-memory without writing to disk.
part_of_batch – Indicates if this conversion is part of a batch operation.
units_map – Output parameter: a mapping from ntuple names to their unit dictionaries.
- Returns:
True if the conversion is successful, false otherwise.
Public Static Attributes
-
static bool fIsStandalone = false¶
-
static bool ConvertToLH5(std::string, std::string, std::set<std::string>, const std::map<int, std::pair<int, std::string>>&, bool, bool part_of_batch = false, int n_ev = -1, std::string output_group = "")¶