51#define STATCLASSES Experimental::RHistStatContent, Experimental::RHistStatUncertainty
55 using TimePoint_t =
decltype(std::chrono::high_resolution_clock::now());
61 Timer(
const char *title,
size_t count)
67 using namespace std::chrono;
68 auto end = high_resolution_clock::now();
69 duration<double> time_span = duration_cast<duration<double>>(end -
fStart);
73 std::cout <<
fCount <<
" * " <<
fTitle <<
": " << time_span.count() <<
" seconds, \t";
74 std::cout <<
fCount / (1e6) / time_span.count() <<
" millions per seconds \n";
88 if (maxValue < minValue)
89 swap(minValue, maxValue);
90 double range = maxValue - minValue;
92 double x[
fNBinsX] = {0., 0.1, 0.3, 1.};
93 double y[
fNBinsY] = {0., 0.1, 0.2, 0.3, 1.};
95 for (
size_t i = 0; i <
fNBinsX; ++i)
96 fXBins[i] = minValue + range *
x[i];
97 for (
size_t i = 0; i <
fNBinsY; ++i)
98 fYBins[i] = minValue + range *
y[i];
110 Timer t(
"GenerateInput", numbers.size());
111 if (minVal > maxVal) {
112 std::swap(minVal, maxVal);
114 T range = maxVal - minVal;
116 size_t len = numbers.size();
117 for (
auto c = numbers.begin();
c != numbers.end(); ++
c) {
118 *
c = minVal + range *
r.Rndm();
123MakeTitle(std::string_view version, std::string_view histname, std::string_view title, std::string_view axis)
126 std::string(version) +
" " + std::string(histname) +
" " + std::string(title) +
" [" + std::string(axis) +
"]";
130template <
int dim,
typename type>
158template <
typename T,
unsigned short kNDim>
164 constexpr static unsigned short kNDim = 2;
170 static constexpr const char *
const gType =
"regular bin size ";
172 template <FillFunc_t filler>
173 static long Execute(std::vector<double> &
input,
double minVal,
double maxVal)
176 ExpTH2 hist({100, minVal, maxVal}, {5, minVal, maxVal});
182 static constexpr const char *
const gType =
"irregular bin size";
184 template <FillFunc_t filler>
185 static long Execute(std::vector<double> &
input,
double minVal,
double maxVal)
198 array_t *values = (array_t *)(&
input[0]);
199 constexpr size_t stride =
gStride;
204 for (
size_t i = 0; i < (
input.size() - (stride * 2 - 1)); i += (stride * 2), values += 32) {
205 std::span<array_t> coords(values, 32);
209 return hist.GetNDim();
218 for (
size_t i = 0; i <
input.size() - 1; i += 2)
219 filler.
Fill({input[i], input[i + 1]});
221 return hist.GetNDim();
229 for (
size_t i = 0; i <
input.size() - 1; i += 2)
230 hist.Fill({input[i], input[i + 1]});
232 return hist.GetNDim();
239 constexpr static unsigned short kNDim = 1;
245 static constexpr const char *
const gType =
"regular bin size ";
247 template <FillFunc_t filler>
248 static long Execute(std::vector<double> &
input,
double minVal,
double maxVal)
251 for (
unsigned short i = 0; i <
gRepeat; ++i) {
252 ExpTH1 hist({100, minVal, maxVal});
260 static constexpr const char *
const gType =
"irregular bin size";
262 template <FillFunc_t filler>
263 static long Execute(std::vector<double> &
input,
double minVal,
double maxVal)
268 for (
unsigned short i = 0; i <
gRepeat; ++i) {
280 array_t *values = (array_t *)(&
input[0]);
281 constexpr size_t stride =
gStride;
286 for (
size_t i = 0; i < (
input.size() - (stride - 1)); i += (stride), values += 32) {
287 std::span<array_t> coords(values, 32);
291 return hist.GetNDim();
300 for (
size_t i = 0; i <
input.size(); ++i)
301 filler.
Fill({input[i]});
303 return hist.GetNDim();
311 for (
size_t i = 0; i <
input.size(); ++i)
312 hist.Fill({input[i]});
314 return hist.GetNDim();
323template <
int ndim,
typename T>
342template <
typename T,
int kNDim>
348 constexpr static unsigned short kNDim = 2;
355 static constexpr const char *
const gType =
"regular bin size ";
357 template <FillFunc_t filler>
358 static long Execute(std::vector<double> &
input,
double minVal,
double maxVal)
362 for (
unsigned short i = 0; i <
gRepeat; ++i) {
363 HistType_t hist(
"a",
"a hist", 100, minVal, maxVal, 5, minVal, maxVal);
372 static constexpr const char *
const gType =
"irregular bin size";
374 template <FillFunc_t filler>
375 static long Execute(std::vector<double> &
input,
double minVal,
double maxVal)
379 for (
unsigned short i = 0; i <
gRepeat; ++i) {
394 for (
size_t i = 0; i <
input.size() - 1; i += 2)
397 return (
long)hist.GetEntries();
403 constexpr size_t stride =
gStride;
407 for (
size_t i = 0; i < (
input.size() - (stride * 2 - 1)); i += (stride * 2))
410 return (
long)hist.GetEntries();
419 for (
size_t i = 0; i <
input.size() - 1; i += 2)
422 return (
long)hist.GetEntries();
429 constexpr static unsigned short kNDim = 1;
436 static constexpr const char *
const gType =
"regular bin size ";
438 template <FillFunc_t filler>
439 static long Execute(std::vector<double> &
input,
double minVal,
double maxVal)
443 for (
unsigned short i = 0; i <
gRepeat; ++i) {
444 HistType_t hist(
"a",
"a hist", 100, minVal, maxVal);
453 static constexpr const char *
const gType =
"irregular bin size";
455 template <FillFunc_t filler>
456 static long Execute(std::vector<double> &
input,
double minVal,
double maxVal)
460 for (
unsigned short i = 0; i <
gRepeat; ++i) {
475 for (
size_t i = 0; i <
input.size() - 1; ++i)
478 return (
long)hist.GetEntries();
484 constexpr size_t stride =
gStride;
488 for (
size_t i = 0; i < (
input.size() - (stride - 1)); i += (stride))
491 return (
long)hist.GetEntries();
500 for (
size_t i = 0; i <
input.size(); ++i)
503 return (
long)hist.GetEntries();
508template <
typename T,
unsigned short kNDim>
514 using DataType_t =
double;
515 static constexpr unsigned short kNDim = 2;
519 std::vector<double>
input;
522 double minVal = -5.0;
523 double maxVal = +5.0;
574 using DataType_t = float;
575 constexpr unsigned short kNDim = 2;
579 std::vector<double>
input;
582 double minVal = -5.0;
583 double maxVal = +5.0;
630 using DataType_t =
double;
631 static constexpr unsigned short kNDim = 1;
635 std::vector<double>
input;
638 double minVal = -5.0;
639 double maxVal = +5.0;
686 using DataType_t = float;
687 static constexpr unsigned short kNDim = 1;
691 std::vector<double>
input;
694 double minVal = -5.0;
695 double maxVal = +5.0;
755 int what = 1 | 2 | 4 | 8;
757 iter = atof(argv[1]);
759 what = atoi(argv[2]);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
void Fill(const CoordArray_t &x, Weight_t weight=1.)
Objects used to configure the different axis types.
Histogram class for histograms with DIMENSIONS dimensions, where each bin count is stored by a value ...
1-D histogram with a double per channel (see TH1 documentation)}
1-D histogram with a float per channel (see TH1 documentation)}
static Int_t GetDefaultBufferSize()
Static function return the default buffer size for automatic histograms the parameter fgBufferSize ma...
static void AddDirectory(Bool_t add=kTRUE)
Sets the flag controlling the automatic add of histograms in memory.
2-D histogram with a double per channel (see TH1 documentation)}
2-D histogram with a float per channel (see TH1 documentation)}
Random number generator class based on M.
const char * GetHist< 1, double >()
void speedtest(size_t count=(size_t)(1e6))
const char * GetHist< 2, double >()
void speedtest< double, 1 >(size_t count)
constexpr unsigned short gRepeat
void speedtest< float, 1 >(size_t count)
const char * GetHist< 2, float >()
const char * GetHist< 1, float >()
void histspeedtest(size_t iter=1e6, int what=255)
void GenerateInput(std::vector< T > &numbers, double minVal, double maxVal, UInt_t seed)
std::string MakeTitle(std::string_view version, std::string_view histname, std::string_view title, std::string_view axis)
void speedtest< double, 2 >(size_t count)
void speedtest< float, 2 >(size_t count)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
static constexpr size_t fNBinsY
Experimental::RAxisConfig AConf_t
BinEdges(double minValue, double maxValue)
static constexpr size_t fNBinsX
AConf_t GetConfigY() const
AConf_t GetConfigX() const
static long Execute(std::vector< double > &input, double minVal, double maxVal)
static long Execute(std::vector< double > &input, double minVal, double maxVal)
static long fill(HistType_t &hist, std::vector< double > &input, std::string_view gType)
typename Redirect< kNDim, T >::HistType_t HistType_t
static long fillN(HistType_t &hist, std::vector< double > &input, std::string_view gType)
std::add_pointer_t< long(HistType_t &hist, std::vector< double > &input, std::string_view type)> FillFunc_t
static long fillBuffered(HistType_t &hist, std::vector< double > &input, std::string_view gType)
static long Execute(std::vector< double > &input, double minVal, double maxVal)
static long Execute(std::vector< double > &input, double minVal, double maxVal)
std::add_pointer_t< long(HistType_t &hist, std::vector< double > &input, std::string_view type)> FillFunc_t
static long fillBuffered(HistType_t &hist, std::vector< double > &input, std::string_view gType)
typename Redirect< kNDim, T >::HistType_t HistType_t
static long fillN(HistType_t &hist, std::vector< double > &input, std::string_view gType)
static long fill(HistType_t &hist, std::vector< double > &input, std::string_view gType)
static long Execute(std::vector< double > &input, double minVal, double maxVal)
static long Execute(std::vector< double > &input, double minVal, double maxVal)
static long fillN(ExpTH1 &hist, std::vector< double > &input, std::string_view gType)
static long fillBuffered(ExpTH1 &hist, std::vector< double > &input, std::string_view gType)
static long fill(ExpTH1 &hist, std::vector< double > &input, std::string_view gType)
std::add_pointer_t< long(ExpTH1 &hist, std::vector< double > &input, std::string_view type)> FillFunc_t
Experimental::RHist< kNDim, T, Experimental::RHistStatContent, Experimental::RHistStatUncertainty > ExpTH1
static long Execute(std::vector< double > &input, double minVal, double maxVal)
static long Execute(std::vector< double > &input, double minVal, double maxVal)
std::add_pointer_t< long(ExpTH2 &hist, std::vector< double > &input, std::string_view type)> FillFunc_t
static long fillBuffered(ExpTH2 &hist, std::vector< double > &input, std::string_view gType)
Experimental::RHist< kNDim, T, Experimental::RHistStatContent, Experimental::RHistStatUncertainty > ExpTH2
static long fillN(ExpTH2 &hist, std::vector< double > &input, std::string_view gType)
static long fill(ExpTH2 &hist, std::vector< double > &input, std::string_view gType)
Timer(const char *title, size_t count)
decltype(std::chrono::high_resolution_clock::now()) TimePoint_t