24template <
typename Hist,
typename T>
25std::unique_ptr<Hist> ConvertToTH1Impl(
const RHistEngine<T> &engine)
28 throw std::invalid_argument(
"TH1 requires one dimension");
31 auto ret = std::make_unique<Hist>();
32 ret->SetDirectory(
nullptr);
34 const auto &axis = engine.
GetAxes()[0];
40 if constexpr (std::is_same_v<T, RBinWithError>) {
41 if (sumw2 ==
nullptr) {
43 sumw2 = ret->GetSumw2()->GetArray();
46 ret->GetArray()[i] =
c.fSum;
50 ret->GetArray()[i] = engine.GetBinContent(
index);
55 for (
auto index : axis.GetFullRange()) {
56 if (
index.IsUnderflow()) {
57 copyBinContent(0,
index);
58 }
else if (
index.IsOverflow()) {
59 copyBinContent(axis.GetNNormalBins() + 1,
index);
61 assert(
index.IsNormal());
69template <
typename Hist>
98 return ConvertToTH1Impl<TH1C>(engine);
103 return ConvertToTH1Impl<TH1S>(engine);
108 return ConvertToTH1Impl<TH1I>(engine);
113 return ConvertToTH1Impl<TH1L>(engine);
118 return ConvertToTH1Impl<TH1L>(engine);
123 return ConvertToTH1Impl<TH1F>(engine);
128 return ConvertToTH1Impl<TH1D>(engine);
133 return ConvertToTH1Impl<TH1D>(engine);
139 ConvertGlobalStatistics(*ret, hist.
GetStats());
146 ConvertGlobalStatistics(*ret, hist.
GetStats());
153 ConvertGlobalStatistics(*ret, hist.
GetStats());
160 ConvertGlobalStatistics(*ret, hist.
GetStats());
167 ConvertGlobalStatistics(*ret, hist.
GetStats());
174 ConvertGlobalStatistics(*ret, hist.
GetStats());
181 ConvertGlobalStatistics(*ret, hist.
GetStats());
188 ConvertGlobalStatistics(*ret, hist.
GetStats());
int Int_t
Signed integer 4 bytes (int)
double Double_t
Double 8 bytes.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
A bin index with special values for underflow and overflow bins.
A histogram data structure to bin data along multiple dimensions.
const std::vector< RAxisVariant > & GetAxes() const
std::size_t GetNDimensions() const
Histogram statistics of unbinned values.
const RDimensionStats & GetDimensionStats(std::size_t dim=0) const
Get the statistics object for one dimension.
std::uint64_t GetNEntries() const
bool IsEnabled(std::size_t dim) const
A histogram for aggregation of data along multiple dimensions.
const RHistStats & GetStats() const
const RHistEngine< BinContentType > & GetEngine() const
void ConvertAxis(TAxis &dst, const RAxisVariant &src)
Convert a single axis object to TAxis.
std::unique_ptr< TH1I > ConvertToTH1I(const RHistEngine< int > &engine)
Convert a one-dimensional histogram to TH1I.
std::unique_ptr< TH1S > ConvertToTH1S(const RHistEngine< short > &engine)
Convert a one-dimensional histogram to TH1S.
std::unique_ptr< TH1L > ConvertToTH1L(const RHistEngine< long > &engine)
Convert a one-dimensional histogram to TH1L.
std::unique_ptr< TH1F > ConvertToTH1F(const RHistEngine< float > &engine)
Convert a one-dimensional histogram to TH1F.
std::unique_ptr< TH1C > ConvertToTH1C(const RHistEngine< char > &engine)
Convert a one-dimensional histogram to TH1C.
std::unique_ptr< TH1D > ConvertToTH1D(const RHistEngine< double > &engine)
Convert a one-dimensional histogram to TH1D.
Namespace for ROOT features in testing.