Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::RHist< DIMENSIONS, PRECISION > Class Template Reference

template<int DIMENSIONS, class PRECISION>
class ROOT::Experimental::RHist< DIMENSIONS, PRECISION >

RHist with no STAT parameter uses RHistStatContent by default.

Definition at line 202 of file RHist.hxx.

Public Types

using AxisRange_t
 Range.
 
using const_iterator
 
using CoordArray_t
 The coordinates type: a DIMENSIONS-dimensional std::array of double.
 
using FillFunc_t
 Pointer type to HistImpl_t::Fill, for faster access.
 
using ImplBase_t
 The type of the Detail::RHistImplBase of this histogram.
 
using Weight_t
 The type of weights.
 
- Public Types inherited from ROOT::Experimental::RHist< DIMENSIONS, PRECISION, RHistStatContent >
using AxisRange_t
 Range.
 
using const_iterator
 
using CoordArray_t
 The coordinates type: a DIMENSIONS-dimensional std::array of double.
 
using FillFunc_t
 Pointer type to HistImpl_t::Fill, for faster access.
 
using ImplBase_t
 The type of the Detail::RHistImplBase of this histogram.
 
using Weight_t
 The type of weights.
 

Public Member Functions

 RHist ()=default
 
 RHist (const RAxisConfig &xaxis)
 Constructor overload that's only available for a 1-dimensional histogram.
 
 RHist (const RAxisConfig &xaxis, const RAxisConfig &yaxis)
 Constructor overload that's only available for a 2-dimensional histogram.
 
 RHist (const RAxisConfig &xaxis, const RAxisConfig &yaxis, const RAxisConfig &zaxis)
 Constructor overload that's only available for a 3-dimensional histogram.
 
 RHist (const RHist &other)
 
 RHist (RHist &&)=default
 
 RHist (std::array< RAxisConfig, DIMENSIONS > axes)
 Create a histogram from an array of axes (RAxisConfigs).
 
 RHist (std::string_view histTitle, const RAxisConfig &xaxis)
 Constructor overload that's only available for a 1-dimensional histogram, also passing the histogram title.
 
 RHist (std::string_view histTitle, const RAxisConfig &xaxis, const RAxisConfig &yaxis)
 Constructor overload that's only available for a 2-dimensional histogram, also passing the histogram title.
 
 RHist (std::string_view histTitle, const RAxisConfig &xaxis, const RAxisConfig &yaxis, const RAxisConfig &zaxis)
 Constructor overload that's only available for a 3-dimensional histogram, also passing the histogram title.
 
 RHist (std::string_view histTitle, std::array< RAxisConfig, DIMENSIONS > axes)
 Constructor overload taking the histogram title.
 
const_iterator begin () const
 
const_iterator end () const
 
void Fill (const CoordArray_t &x, Weight_t weight=(Weight_t) 1) noexcept
 Add weight to the bin containing coordinate x.
 
void FillN (const std::span< const CoordArray_t > xN) noexcept
 Convenience overload: FillN() with weight 1.
 
void FillN (const std::span< const CoordArray_t > xN, const std::span< const Weight_t > weightN) noexcept
 For each coordinate in xN, add weightN[i] to the bin at coordinate xN[i].
 
void FillN (std::initializer_list< const CoordArray_t > xN) noexcept
 Convenience overload: FillN() with weight 1.
 
void FillN (std::initializer_list< const CoordArray_t > xN, std::initializer_list< const Weight_t > weightN) noexcept
 For each coordinate in xN, add weightN[i] to the bin at coordinate xN[i].
 
Weight_t GetBinContent (const CoordArray_t &x) const
 Get the content of the bin at x.
 
double GetBinUncertainty (const CoordArray_t &x) const
 Get the uncertainty on the content of the bin at x.
 
int64_t GetEntries () const noexcept
 Get the number of entries this histogram was filled with.
 
ImplBase_tGetImpl () const noexcept
 Access the ImplBase_t this RHist points to.
 
void swap (RHist< DIMENSIONS, PRECISION, STAT... > &other) noexcept
 Swap *this and other.
 
std::unique_ptr< ImplBase_tTakeImpl () &&noexcept
 "Steal" the ImplBase_t this RHist points to.
 
- Public Member Functions inherited from ROOT::Experimental::RHist< DIMENSIONS, PRECISION, RHistStatContent >
 RHist ()=default
 
 RHist (const RAxisConfig &xaxis)
 Constructor overload that's only available for a 1-dimensional histogram.
 
 RHist (const RAxisConfig &xaxis, const RAxisConfig &yaxis)
 Constructor overload that's only available for a 2-dimensional histogram.
 
 RHist (const RAxisConfig &xaxis, const RAxisConfig &yaxis, const RAxisConfig &zaxis)
 Constructor overload that's only available for a 3-dimensional histogram.
 
 RHist (const RHist &other)
 
 RHist (RHist &&)=default
 
 RHist (std::array< RAxisConfig, DIMENSIONS > axes)
 Create a histogram from an array of axes (RAxisConfigs).
 
 RHist (std::string_view histTitle, const RAxisConfig &xaxis)
 Constructor overload that's only available for a 1-dimensional histogram, also passing the histogram title.
 
 RHist (std::string_view histTitle, const RAxisConfig &xaxis, const RAxisConfig &yaxis)
 Constructor overload that's only available for a 2-dimensional histogram, also passing the histogram title.
 
 RHist (std::string_view histTitle, const RAxisConfig &xaxis, const RAxisConfig &yaxis, const RAxisConfig &zaxis)
 Constructor overload that's only available for a 3-dimensional histogram, also passing the histogram title.
 
 RHist (std::string_view histTitle, std::array< RAxisConfig, DIMENSIONS > axes)
 Constructor overload taking the histogram title.
 
const_iterator begin () const
 
const_iterator end () const
 
void Fill (const CoordArray_t &x, Weight_t weight=(Weight_t) 1) noexcept
 Add weight to the bin containing coordinate x.
 
void FillN (const std::span< const CoordArray_t > xN) noexcept
 Convenience overload: FillN() with weight 1.
 
void FillN (const std::span< const CoordArray_t > xN, const std::span< const Weight_t > weightN) noexcept
 For each coordinate in xN, add weightN[i] to the bin at coordinate xN[i].
 
void FillN (std::initializer_list< const CoordArray_t > xN) noexcept
 Convenience overload: FillN() with weight 1.
 
void FillN (std::initializer_list< const CoordArray_t > xN, std::initializer_list< const Weight_t > weightN) noexcept
 For each coordinate in xN, add weightN[i] to the bin at coordinate xN[i].
 
Weight_t GetBinContent (const CoordArray_t &x) const
 Get the content of the bin at x.
 
double GetBinUncertainty (const CoordArray_t &x) const
 Get the uncertainty on the content of the bin at x.
 
int64_t GetEntries () const noexcept
 Get the number of entries this histogram was filled with.
 
ImplBase_tGetImpl () const noexcept
 Access the ImplBase_t this RHist points to.
 
void swap (RHist< DIMENSIONS, PRECISION, RHistStatContent... > &other) noexcept
 Swap *this and other.
 
std::unique_ptr< ImplBase_tTakeImpl () &&noexcept
 "Steal" the ImplBase_t this RHist points to.
 

Static Public Member Functions

static constexpr int GetNDim () noexcept
 Number of dimensions of the coordinates.
 
- Static Public Member Functions inherited from ROOT::Experimental::RHist< DIMENSIONS, PRECISION, RHistStatContent >
static constexpr int GetNDim () noexcept
 Number of dimensions of the coordinates.
 

Private Attributes

FillFunc_t fFillFunc
 Pointer to RHistImpl::Fill() member function.
 
std::unique_ptr< ImplBase_tfImpl
 The actual histogram implementation.
 

Friends

RHist HistFromImpl (std::unique_ptr< ImplBase_t >)
 

#include <ROOT/RHist.hxx>

Inheritance diagram for ROOT::Experimental::RHist< DIMENSIONS, PRECISION >:
[legend]

Member Typedef Documentation

◆ AxisRange_t

using ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::AxisRange_t

Range.

Definition at line 65 of file RHist.hxx.

◆ const_iterator

using ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::const_iterator

Definition at line 67 of file RHist.hxx.

◆ CoordArray_t

using ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::CoordArray_t

The coordinates type: a DIMENSIONS-dimensional std::array of double.

Definition at line 59 of file RHist.hxx.

◆ FillFunc_t

using ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::FillFunc_t

Pointer type to HistImpl_t::Fill, for faster access.

Definition at line 63 of file RHist.hxx.

◆ ImplBase_t

using ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::ImplBase_t

The type of the Detail::RHistImplBase of this histogram.

Definition at line 56 of file RHist.hxx.

◆ Weight_t

using ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::Weight_t

The type of weights.

Definition at line 61 of file RHist.hxx.

Constructor & Destructor Documentation

◆ RHist() [1/11]

ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::RHist ( )
default

◆ RHist() [2/11]

ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::RHist ( RHist< DIMENSIONS, PRECISION > && )
default

◆ RHist() [3/11]

ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::RHist ( const RHist< DIMENSIONS, PRECISION > & other)
inline

Definition at line 74 of file RHist.hxx.

◆ RHist() [4/11]

ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::RHist ( std::array< RAxisConfig, DIMENSIONS > axes)
explicit

Create a histogram from an array of axes (RAxisConfigs).

Example code:

Construct a 1-dimensional histogram that can be filled with floatss. The axis has 10 bins between 0. and 1. The two outermost sets of curly braces are to reach the initialization of the std::array elements; the inner one is for the initialization of a RAxisCoordinate.

RHist<1,float> h1f({{ {10, 0., 1.} }});

Construct a 2-dimensional histogram, with the first axis as before, and the second axis having non-uniform ("irregular") binning, where all bin- edges are specified. As this is itself an array it must be enclosed by double curlies.

RHist<2,int> h2i({{ {10, 0., 1.}, {{-1., 0., 1., 10., 100.}} }}); 

Definition at line 92 of file RHist.hxx.

◆ RHist() [5/11]

ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::RHist ( std::string_view histTitle,
std::array< RAxisConfig, DIMENSIONS > axes )

Constructor overload taking the histogram title.

Definition at line 95 of file RHist.hxx.

◆ RHist() [6/11]

ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::RHist ( const RAxisConfig & xaxis)
inlineexplicit

Constructor overload that's only available for a 1-dimensional histogram.

Definition at line 99 of file RHist.hxx.

◆ RHist() [7/11]

ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::RHist ( std::string_view histTitle,
const RAxisConfig & xaxis )
inline

Constructor overload that's only available for a 1-dimensional histogram, also passing the histogram title.

Definition at line 105 of file RHist.hxx.

◆ RHist() [8/11]

ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::RHist ( const RAxisConfig & xaxis,
const RAxisConfig & yaxis )
inline

Constructor overload that's only available for a 2-dimensional histogram.

Definition at line 110 of file RHist.hxx.

◆ RHist() [9/11]

ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::RHist ( std::string_view histTitle,
const RAxisConfig & xaxis,
const RAxisConfig & yaxis )
inline

Constructor overload that's only available for a 2-dimensional histogram, also passing the histogram title.

Definition at line 116 of file RHist.hxx.

◆ RHist() [10/11]

ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::RHist ( const RAxisConfig & xaxis,
const RAxisConfig & yaxis,
const RAxisConfig & zaxis )
inline

Constructor overload that's only available for a 3-dimensional histogram.

Definition at line 122 of file RHist.hxx.

◆ RHist() [11/11]

ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::RHist ( std::string_view histTitle,
const RAxisConfig & xaxis,
const RAxisConfig & yaxis,
const RAxisConfig & zaxis )
inline

Constructor overload that's only available for a 3-dimensional histogram, also passing the histogram title.

Definition at line 129 of file RHist.hxx.

Member Function Documentation

◆ begin()

const_iterator ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::begin ( ) const
inline

Definition at line 177 of file RHist.hxx.

◆ end()

const_iterator ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::end ( ) const
inline

Definition at line 179 of file RHist.hxx.

◆ Fill()

void ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::Fill ( const CoordArray_t & x,
Weight_t weight = (Weight_t)1 )
inlinenoexcept

Add weight to the bin containing coordinate x.

Definition at line 140 of file RHist.hxx.

◆ FillN() [1/4]

void ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::FillN ( const std::span< const CoordArray_t > xN)
inlinenoexcept

Convenience overload: FillN() with weight 1.

Definition at line 160 of file RHist.hxx.

◆ FillN() [2/4]

void ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::FillN ( const std::span< const CoordArray_t > xN,
const std::span< const Weight_t > weightN )
inlinenoexcept

For each coordinate in xN, add weightN[i] to the bin at coordinate xN[i].

The sizes of xN and weightN must be the same. This is more efficient than many separate calls to Fill().

Definition at line 145 of file RHist.hxx.

◆ FillN() [3/4]

void ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::FillN ( std::initializer_list< const CoordArray_t > xN)
inlinenoexcept

Convenience overload: FillN() with weight 1.

Overload for passing initializer lists.

Definition at line 164 of file RHist.hxx.

◆ FillN() [4/4]

void ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::FillN ( std::initializer_list< const CoordArray_t > xN,
std::initializer_list< const Weight_t > weightN )
inlinenoexcept

For each coordinate in xN, add weightN[i] to the bin at coordinate xN[i].

The sizes of xN and weightN must be the same. This is more efficient than many separate calls to Fill(). Overload for passing initializer lists.

Definition at line 154 of file RHist.hxx.

◆ GetBinContent()

Weight_t ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::GetBinContent ( const CoordArray_t & x) const
inline

Get the content of the bin at x.

Definition at line 172 of file RHist.hxx.

◆ GetBinUncertainty()

double ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::GetBinUncertainty ( const CoordArray_t & x) const
inline

Get the uncertainty on the content of the bin at x.

Definition at line 175 of file RHist.hxx.

◆ GetEntries()

int64_t ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::GetEntries ( ) const
inlinenoexcept

Get the number of entries this histogram was filled with.

Definition at line 169 of file RHist.hxx.

◆ GetImpl()

ImplBase_t * ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::GetImpl ( ) const
inlinenoexcept

Access the ImplBase_t this RHist points to.

Definition at line 134 of file RHist.hxx.

◆ GetNDim()

static constexpr int ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::GetNDim ( )
inlinestaticconstexprnoexcept

Number of dimensions of the coordinates.

Definition at line 70 of file RHist.hxx.

◆ swap()

void ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::swap ( RHist< DIMENSIONS, PRECISION, STAT... > & other)
inlinenoexcept

Swap *this and other.

Very efficient; swaps the fImpl pointers.

Definition at line 184 of file RHist.hxx.

◆ TakeImpl()

std::unique_ptr< ImplBase_t > ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::TakeImpl ( ) &&
inlinenoexcept

"Steal" the ImplBase_t this RHist points to.

Definition at line 137 of file RHist.hxx.

Friends And Related Symbol Documentation

◆ HistFromImpl

RHist HistFromImpl ( std::unique_ptr< ImplBase_t > )
friend

Member Data Documentation

◆ fFillFunc

FillFunc_t ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::fFillFunc
private

Pointer to RHistImpl::Fill() member function.

Definition at line 195 of file RHist.hxx.

◆ fImpl

std::unique_ptr<ImplBase_t> ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT >::fImpl
private

The actual histogram implementation.

Definition at line 192 of file RHist.hxx.

  • hist/histv7/inc/ROOT/RHist.hxx