25 #include <initializer_list> 28 namespace Experimental {
32 template <
int D_,
class P_,
template <
class P__>
class S_>
class... STAT>
37 template <
int D_,
class P_,
template <
class P__>
class S_>
class... STAT>
38 class THist<DIMENSIONS, PRECISION, STAT...>
39 HistFromImpl(
std::unique_ptr<typename THist<DIMENSIONS, PRECISION, STAT...>::ImplBase_t> pHistImpl);
53 template<int DIMENSIONS, class PRECISION,
54 template <int D_, class P_, template <class P__> class S_> class... STAT>
73 static constexpr
int GetNDim() noexcept {
return DIMENSIONS; }
93 explicit THist(std::array<TAxisConfig, DIMENSIONS> axes);
99 template <
int ENABLEIF_NDIM = DIMENSIONS,
107 template <
int ENABLEIF_NDIM = DIMENSIONS,
114 template<
int ENABLEIF_NDIM = DIMENSIONS,
122 template<
int ENABLEIF_NDIM = DIMENSIONS,
129 template<
int ENABLEIF_NDIM = DIMENSIONS,
137 template<
int ENABLEIF_NDIM = DIMENSIONS,
149 std::unique_ptr<ImplBase_t>&&
TakeImpl() noexcept {
return std::move(
fImpl); }
157 void FillN(
const std::array_view <CoordArray_t> xN,
158 const std::array_view <Weight_t> weightN) noexcept {
fImpl->FillN(xN, weightN); }
161 void FillN(
const std::array_view <CoordArray_t> xN) noexcept {
fImpl->FillN(xN); }
188 friend THist HistFromImpl<>(std::unique_ptr<ImplBase_t>);
194 template<
int DIMENSIONS,
class PRECISION,
195 template <
int D_,
class P_,
template <
class P__>
class S_>
class... STAT>
207 template<
int NDIM,
int IDIM,
class DATA,
class... PROCESSEDAXISCONFIG>
211 template<TAxisConfig::EKind KIND>
212 std::unique_ptr<Detail::THistImplBase<DATA>>
214 PROCESSEDAXISCONFIG... processedAxisArgs)
218 using HistImpl_t =
THistImplGen<NDIM, IDIM + 1, DATA, PROCESSEDAXISCONFIG..., NextAxis_t>;
219 return HistImpl_t()(title, axes, processedAxisArgs..., nextAxis);
234 std::unique_ptr<Detail::THistImplBase<DATA>>
236 PROCESSEDAXISCONFIG... processedAxisArgs)
238 switch (axes[IDIM].GetKind()) {
240 return MakeNextAxis<TAxisConfig::kEquidistant>(title, axes, processedAxisArgs...);
242 return MakeNextAxis<TAxisConfig::kGrow>(title, axes, processedAxisArgs...);
244 return MakeNextAxis<TAxisConfig::kIrregular>(title, axes, processedAxisArgs...);
253 template<
int NDIM,
class DATA,
class... PROCESSEDAXISCONFIG>
258 std::unique_ptr<HistImplBase_t>
262 return std::make_unique<HistImplt_t>(title, axisArgs...);
268 template<
int DIMENSIONS,
class PRECISION,
269 template <
int D_,
class P_,
template <
class P__>
class S_>
class... STAT>
278 template<
int DIMENSIONS,
class PRECISION,
279 template <
int D_,
class P_,
template <
class P__>
class S_>
class... STAT>
285 template<
int DIMENSIONS,
class PRECISION,
286 template <
int D_,
class P_,
template <
class P__>
class S_>
class... STAT>
291 ret.fFillFunc = pHistImpl->GetFillFunc();
323 template<
int DIMENSIONS,
324 class PRECISION_TO,
class PRECISION_FROM,
325 template <
int D_,
class P_,
template <
class P__>
class S_>
class... STAT_TO,
326 template <
int D_,
class P_,
template <
class P__>
class S_>
class... STAT_FROM>
332 using HistFrom_t =
THist<DIMENSIONS, PRECISION_FROM, STAT_FROM...>;
334 using FromWeight_t =
typename HistFrom_t::Weight_t;
335 auto add = [fillFuncTo, toImpl](
const FromCoord_t&
x, FromWeight_t
c)
337 (toImpl->*fillFuncTo)(x,
c);
345 template<
int DIMENSIONS,
class PRECISION,
346 template <
int D_,
class P_,
template <
class P__>
class S_>
class... STAT>
347 std::unique_ptr <Internal::TDrawable>
351 return std::make_unique<Internal::THistDrawable<DIMENSIONS>>(hist, opts);
355 template<
int DIMENSIONS,
class PRECISION,
356 template <
int D_,
class P_,
template <
class P__>
class S_>
class... STAT>
357 std::unique_ptr <Internal::TDrawable>
361 return std::make_unique<Internal::THistDrawable<DIMENSIONS>>(std::move(hist), opts);
std::vector< PRECISION > THistDataDefaultStorage
std::vector has more template arguments; for the default storage we don't care about them...
virtual void ApplyXC(std::function< void(const CoordArray_t &, Weight_t)>) const =0
Apply a function (lambda) to all bins of the histogram.
std::array< double, DIMENSIONS > CoordArray_t
static constexpr int GetNDim() noexcept
Number of dimensions of the coordinates.
std::unique_ptr< ImplBase_t > fImpl
The actual histogram implementation.
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Interface class for THistImpl.
typename ImplBase_t::FillFunc_t FillFunc_t
Pointer type to HistImpl_t::Fill, for faster access.
Generate THist::fImpl from THist constructor arguments.
Iterates over the bins of a THist or THistImpl.
std::unique_ptr< ImplBase_t > && TakeImpl() noexcept
"Steal" the ImplBase_t this THist points to.
const_iterator begin() const
void swap(THist< DIMENSIONS, PRECISION, STAT... > &other) noexcept
Swap *this and other.
const_iterator end() const
THist(const TAxisConfig &xaxis)
Constructor overload that's only available for a 1-dimensional histogram.
Detail::THistBinIter< ImplBase_t > const_iterator
Weight_t GetBinContent(const CoordArray_t &x) const
Get the content of the bin at x.
int64_t GetEntries() const noexcept
Get the number of entries this histogram was filled with.
friend THist HistFromImpl(std::unique_ptr< ImplBase_t >)
THist(std::string_view histTitle, const TAxisConfig &xaxis, const TAxisConfig &yaxis, const TAxisConfig &zaxis)
Constructor overload that's only available for a 3-dimensional histogram, also passing the histogram ...
represents a TAxisEquidistant
THist(std::string_view histTitle, const TAxisConfig &xaxis, const TAxisConfig &yaxis)
Constructor overload that's only available for a 2-dimensional histogram, also passing the histogram ...
void Add(THist< DIMENSIONS, PRECISION_TO, STAT_TO... > &to, THist< DIMENSIONS, PRECISION_FROM, STAT_FROM... > &from)
Add two histograms.
std::unique_ptr< HistImplBase_t > operator()(std::string_view title, const std::array< TAxisConfig, DATA::GetNDim()> &, PROCESSEDAXISCONFIG... axisArgs)
double GetBinUncertainty(const CoordArray_t &x) const
Get the uncertainty on the content of the bin at x.
PRECISION Weight_t
The type of weights.
THist(const TAxisConfig &xaxis, const TAxisConfig &yaxis)
Constructor overload that's only available for a 2-dimensional histogram.
std::unique_ptr< Detail::THistImplBase< DATA > > MakeNextAxis(std::string_view title, const std::array< TAxisConfig, NDIM > &axes, PROCESSEDAXISCONFIG... processedAxisArgs)
Select the template argument for the next axis type, and "recurse" into THistImplGen for the next axi...
Objects used to configure the different axis types.
THist(const TAxisConfig &xaxis, const TAxisConfig &yaxis, const TAxisConfig &zaxis)
Constructor overload that's only available for a 3-dimensional histogram.
void FillN(const std::array_view< CoordArray_t > xN) noexcept
Convenience overload: FillN() with weight 1.
A THistImplBase's data, provides accessors to all its statistics.
THist(std::string_view histTitle, const TAxisConfig &xaxis)
Constructor overload that's only available for a 1-dimensional histogram, also passing the histogram ...
represents a TAxisIrregular
void FillN(const std::array_view< CoordArray_t > xN, const std::array_view< Weight_t > weightN) noexcept
For each coordinate in xN, add weightN[i] to the bin at coordinate xN[i].
Hist::CoordArray_t< DATA::GetNDim()> CoordArray_t
Type of the coordinate: a DIMENSIONS-dimensional array of doubles.
Histogram class for histograms with DIMENSIONS dimensions, where each bin count is stored by a value ...
void swap(THist< DIMENSIONS, PRECISION, STAT... > &a, THist< DIMENSIONS, PRECISION, STAT... > &b) noexcept
Swap two histograms.
void(THistImplBase::*)(const CoordArray_t &x, Weight_t w) FillFunc_t
Type of the Fill(x, w) function.
ImplBase_t * GetImpl() const noexcept
Access the ImplBase_t this THist points to.
virtual FillFunc_t GetFillFunc() const =0
Retrieve the pointer to the overridden Fill(x, w) function.
Hist::AxisIterRange_t< DIMENSIONS > AxisIterRange_t
Range type.
FillFunc_t fFillFunc
! Pinter to THistImpl::Fill() member function
Converts a TAxisConfig of whatever kind to the corresponding TAxisBase-derived object.
typename ImplBase_t::CoordArray_t CoordArray_t
The coordinates type: a DIMENSIONS-dimensional std::array of double.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
class THist< DIMENSIONS, PRECISION, STAT... > HistFromImpl(std::unique_ptr< typename THist< DIMENSIONS, PRECISION, STAT... >::ImplBase_t > pHistImpl)
Adopt an external, stand-alone THistImpl. The THist will take ownership.
void Fill(const CoordArray_t &x, Weight_t weight=(Weight_t) 1) noexcept
Add weight to the bin containing coordinate x.
std::unique_ptr< Internal::TDrawable > GetDrawable(const std::shared_ptr< THist< DIMENSIONS, PRECISION, STAT... >> &hist, THistDrawOptions< DIMENSIONS > opts={})
Interface to graphics taking a unique_ptr<THist>.
typename ImplBase_t::AxisIterRange_t AxisRange_t
Range.
#define R__ERROR_HERE(GROUP)
std::unique_ptr< Detail::THistImplBase< DATA > > operator()(std::string_view title, const std::array< TAxisConfig, NDIM > &axes, PROCESSEDAXISCONFIG... processedAxisArgs)
Make a THistImpl-derived object reflecting the TAxisConfig array.