ATLAS Offline Software
Loading...
Searching...
No Matches
Merger.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef HDF5Utils_Merger_H
6#define HDF5Utils_Merger_H
7
8#include "H5Cpp.h"
9namespace H5Utils::hist { class HistogramMerger; }
10
11#include <memory>
12
19
20namespace H5Utils {
24 class Merger {
25 public:
38 Merger(
39 hsize_t mergeAxis = 0,
40 int chunkSize = -1,
41 bool requireSameFormat = true,
42 std::size_t bufferSize = -1,
43 bool bufferInRows = false);
44
45 ~Merger();
46
52 void merge(H5::Group& target, const H5::Group& source);
53
59 void merge(H5::DataSet& target, const H5::DataSet& source);
60
71 void merge(auto& target, const auto& source)
72 {
73 H5::Group targetGroup = convert(target);
74 H5::Group sourceGroup = convert(source);
75 merge(targetGroup, sourceGroup);
76 }
77
82 void flush(H5::Group& dst);
83
84 private:
86 static H5::Group convert(const H5::Group& group);
89 static H5::Group convert(const H5::H5File& file);
90
91 protected:
93 hsize_t m_mergeAxis;
99 std::size_t m_bufferSize;
103 std::unique_ptr<H5Utils::hist::HistogramMerger> m_histMerger;
104 }; //> end class Merger
105} //> end namespace H5Utils
106
107#endif //> !HDF5Utils_Merger_H
void merge(auto &target, const auto &source)
Merge a source file/group into a target file/group.
Definition Merger.h:71
Merger(hsize_t mergeAxis=0, int chunkSize=-1, bool requireSameFormat=true, std::size_t bufferSize=-1, bool bufferInRows=false)
Create the merger.
Definition Merger.cxx:14
int m_chunkSize
The chunk size to apply.
Definition Merger.h:95
bool m_measureBufferInRows
Whether to measure the buffer in bytes or rows.
Definition Merger.h:101
std::unique_ptr< H5Utils::hist::HistogramMerger > m_histMerger
Accumulator for UHI histogram groups.
Definition Merger.h:103
void flush(H5::Group &dst)
Write all accumulated histogram data to the output.
Definition Merger.cxx:132
hsize_t m_mergeAxis
The axis to merge along.
Definition Merger.h:93
std::size_t m_bufferSize
The size of the buffer.
Definition Merger.h:99
bool m_requireSameFormat
Whether to require the same group structure.
Definition Merger.h:97
static H5::Group convert(const H5::Group &group)
convert() is a no-op for a Group, used by the merge() template
Definition Merger.cxx:122
Accumulates UHI histogram groups from multiple source files and writes the merged result once all inp...
HDF5 Tuple Writer.
Definition merge.py:1
TFile * file