Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
HistoStats.cpp
Go to the documentation of this file.
1 #ifdef __ICC
2 // disable icc remark #1572: floating-point equality and inequality comparisons are unreliable
3 // The comparisons are meant
4 # pragma warning( disable : 1572 )
5 #endif
6 // ============================================================================
7 // Include files
8 // ============================================================================
9 // STD & STL
10 // ============================================================================
11 #include <climits>
12 #include <cmath>
13 #include <limits>
14 // ============================================================================
15 // AIDA
16 // ============================================================================
17 #include "AIDA/IAxis.h"
18 #include "AIDA/IHistogram1D.h"
19 #include "AIDA/IProfile1D.h"
20 // ============================================================================
21 // GaudiUtils
22 // ============================================================================
23 #include "GaudiUtils/HistoStats.h"
24 // ============================================================================
30 // ============================================================================
31 namespace {
32  // ==========================================================================
34  const constexpr double s_bad = std::numeric_limits<float>::lowest();
36  const constexpr long s_long_bad = std::numeric_limits<int>::min();
37  // ==========================================================================
38  // implementations
39  // ============================================================================
40  // effective entries
41  // ============================================================================
42  double _nEff( const AIDA::IHistogram1D* histo ) { return ( histo ? histo->equivalentBinEntries() : s_bad ); }
43  double _nEff( const AIDA::IProfile1D* histo ) {
44  // best guess at equivalent method ...
45  return ( histo ? histo->sumBinHeights() : s_bad );
46  }
47  // ============================================================================
48  // rms
49  // ============================================================================
50  template <typename HISTO>
51  double _rms( const HISTO* histo ) {
52  return ( histo ? histo->rms() : s_bad );
53  }
54  // ============================================================================
55  // mean
56  // ============================================================================
57  template <typename HISTO>
58  double _mean( const HISTO* histo ) {
59  return ( histo ? histo->mean() : s_bad );
60  }
61  // ============================================================================
62  // moment
63  // ============================================================================
64  template <typename HISTO>
65  double _moment( const HISTO* histo, const unsigned int order, const double value = 0 ) {
66  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
67  if ( 0 == order ) { return 1.0; } // RETURN
68  if ( 1 == order ) { return _mean( histo ) - value; } // RETURN
69  if ( 2 == order ) {
70  const auto _r = _rms( histo );
71  const auto _d = value - _mean( histo );
72  return std::pow( _r, 2 ) + std::pow( _d, 2 ); // RETURN
73  }
74  const auto n = _nEff( histo );
75  if ( 0 >= n ) { return 0.0; } // RETURN
76  // get the exis
77  const auto& axis = histo->axis();
78  // number of bins
79  const auto nBins = axis.bins();
80  double result{0}, weight{0};
81  // loop over all bins
82  for ( int i = 0; i < nBins; ++i ) {
83  const auto lE = axis.binLowerEdge( i );
84  const auto uE = axis.binUpperEdge( i );
85  //
86  const auto yBin = histo->binHeight( i ); // bin weight
87  const auto xBin = 0.5 * double( lE + uE ); // bin center
88  //
89  weight += yBin;
90  result += yBin * std::pow( xBin - value, order );
91  }
92  if ( 0 != weight ) { result /= weight; }
93  return result;
94  }
95  // ============================================================================
96  // moment error
97  // ============================================================================
98  template <typename HISTO>
99  double _momentErr( const HISTO* histo, const unsigned int order ) {
100  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
101  const auto n = _nEff( histo );
102  if ( 0 >= n ) { return 0.0; } // RETURN
103  const auto a2o = _moment( histo, 2 * order ); // a(2o)
104  const auto ao = _moment( histo, order ); // a(o)
105  const auto result = std::max( 0.0, ( a2o - std::pow( ao, 2 ) ) / n );
106  return std::sqrt( result ); // RETURN
107  }
108  // ============================================================================
109  // central moment
110  // ============================================================================
111  template <typename HISTO>
112  double _centralMoment( const HISTO* histo, const unsigned int order ) {
113  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
114  if ( 0 == order ) { return 1.0; } // RETURN
115  if ( 1 == order ) { return 0.0; } // RETURN
116  if ( 2 == order ) {
117  return std::pow( _rms( histo ), 2 ); // RETURN
118  }
119  // delegate the actual evaluation to another method:
120  return _moment( histo, order, _mean( histo ) );
121  }
122  // ============================================================================
123  // central moment error
124  // ============================================================================
125  template <typename HISTO>
126  double _centralMomentErr( const HISTO* histo, const unsigned int order ) {
127  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
128  const auto n = _nEff( histo );
129  if ( 0 >= n ) { return 0.0; } // RETURN
130  const auto mu2 = _centralMoment( histo, 2 ); // mu(2)
131  const auto muo = _centralMoment( histo, order ); // mu(o)
132  const auto mu2o = _centralMoment( histo, 2 * order ); // mu(2o)
133  const auto muom = _centralMoment( histo, order - 1 ); // mu(o-1)
134  const auto muop = _centralMoment( histo, order + 1 ); // mu(o+1)
135  const auto result =
136  ( mu2o - ( 2.0 * order * muom * muop ) - std::pow( muo, 2 ) + ( order * order * mu2 * muom * muom ) ) / n;
137  return std::sqrt( std::max( 0.0, result ) ); // RETURN
138  }
139  // ============================================================================
140  // get the skewness for the histogram
141  // ============================================================================
142  template <typename HISTO>
143  double _skewness( const HISTO* histo ) {
144  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
145  const auto mu3 = _centralMoment( histo, 3 );
146  const auto s3 = std::pow( _rms( histo ), 3 );
147  return ( std::fabs( s3 ) > 0 ? mu3 / s3 : 0.0 );
148  }
149  // ============================================================================
150  // get the error in skewness
151  // ============================================================================
152  template <typename HISTO>
153  double _skewnessErr( const HISTO* histo ) {
154  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
155  const auto n = _nEff( histo );
156  if ( 2 > n ) { return 0.0; } // RETURN
157  const auto result = 6.0 * ( n - 2 ) / ( ( n + 1 ) * ( n + 3 ) );
158  return std::sqrt( result );
159  }
160  // ============================================================================
161  // get the kurtosis for the histogram
162  // ============================================================================
163  template <typename HISTO>
164  double _kurtosis( const HISTO* histo ) {
165  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
166  const auto mu4 = _centralMoment( histo, 4 );
167  const auto s4 = std::pow( _rms( histo ), 4 );
168  return ( std::fabs( s4 ) > 0 ? mu4 / s4 - 3.0 : 0.0 );
169  }
170  // ============================================================================
171  // get the error in kurtosis
172  // ============================================================================
173  template <typename HISTO>
174  double _kurtosisErr( const HISTO* histo ) {
175  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
176  const auto n = _nEff( histo );
177  if ( 3 > n ) { return 0.0; } // RETURN
178  auto result = 24.0 * n;
179  result *= ( n - 2 ) * ( n - 3 );
180  result /= ( n + 1 ) * ( n + 1 );
181  result /= ( n + 3 ) * ( n + 5 );
182  return std::sqrt( result );
183  }
184  // ============================================================================
185  // get an error in the mean value
186  // ============================================================================
187  template <typename HISTO>
188  double _meanErr( const HISTO* histo ) {
189  if ( UNLIKELY( !histo ) ) { return s_bad; }
190  const auto n = _nEff( histo );
191  return ( 0 >= n ? 0.0 : _rms( histo ) / std::sqrt( n ) );
192  }
193  // ============================================================================
194  // get the error in rms
195  // ============================================================================
196  template <typename HISTO>
197  double _rmsErr( const HISTO* histo ) {
198  if ( UNLIKELY( !histo ) ) { return s_bad; }
199  const auto n = _nEff( histo );
200  if ( 1 >= n ) { return 0.0; }
201  auto result = 2.0 + _kurtosis( histo );
202  result += 2.0 / ( n - 1 );
203  result /= 4.0 * n;
204  return _rms( histo ) * std::sqrt( std::max( result, 0.0 ) );
205  }
206  // ============================================================================
207  // get an error in the sum bin height ("in range integral")
208  // ============================================================================
209  template <typename HISTO>
210  double _sumBinHeightErr( const HISTO* histo ) {
211  if ( UNLIKELY( !histo ) ) { return s_bad; }
212  //
213  double error2 = 0;
214  // get the exis
215  const auto& axis = histo->axis();
216  // number of bins
217  const auto nBins = axis.bins();
218  // loop over all bins
219  for ( int i = 0; i < nBins; ++i ) {
220  // accumulate the errors in each bin
221  error2 += std::pow( histo->binError( i ), 2 );
222  }
223  return std::sqrt( error2 );
224  }
225  // ============================================================================
226  // get an error in the sum all bin height ("integral")
227  // ============================================================================
228  template <typename HISTO>
229  double _sumAllBinHeightErr( const HISTO* histo ) {
230  if ( UNLIKELY( !histo ) ) { return s_bad; }
231  //
232  const auto error = _sumBinHeightErr( histo );
233  if ( 0 > error ) { return s_bad; }
235  const auto err1 = histo->binError( AIDA::IAxis::UNDERFLOW_BIN );
236  const auto err2 = histo->binError( AIDA::IAxis::OVERFLOW_BIN );
237  //
238  return std::sqrt( std::pow( error, 2 ) + std::pow( err1, 2 ) + std::pow( err2, 2 ) );
239  }
240  // ============================================================================
241  // the fraction of overflow entries (useful for shape comparison)
242  // ============================================================================
243  template <typename HISTO>
244  double _overflowEntriesFrac( const HISTO* histo ) {
245  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
246  const auto overflow = histo->binEntries( AIDA::IAxis::OVERFLOW_BIN );
247  if ( 0 == overflow ) { return 0; } // RETURN
248  const auto all = histo->allEntries();
249  if ( 0 == all ) { return 0; } // "CONVENTION?" RETURN
250  if ( 0 > all ) { return s_bad; } // Lets be a bit paranoic, RETURN
251  //
252  return (double)overflow / (double)all;
253  }
254  // ============================================================================
255  // the fraction of underflow entries (useful for shape comparison)
256  // ============================================================================
257  template <typename HISTO>
258  double _underflowEntriesFrac( const HISTO* histo ) {
259  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
260  const auto underflow = histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN );
261  if ( 0 == underflow ) { return 0; } // RETURN
262  const auto all = histo->allEntries();
263  if ( 0 == all ) { return 0; } // "CONVENTION?" RETURN
264  if ( 0 > all ) { return s_bad; } // Lets be a bit paranoic, RETURN
265  //
266  return (double)underflow / (double)all;
267  }
268  // ============================================================================
269  // the fraction of overflow integral (useful for shape comparison)
270  // ============================================================================
271  template <typename HISTO>
272  double _overflowIntegralFrac( const HISTO* histo ) {
273  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
274  const auto overflow = histo->binHeight( AIDA::IAxis::OVERFLOW_BIN );
275  if ( 0 == overflow ) { return 0; } // RETURN
276  const auto all = histo->sumAllBinHeights();
277  if ( 0 == all ) { return 0; } // "CONVENTION?" RETURN
278  //
279  return (double)overflow / (double)all;
280  }
281  // ============================================================================
282  // the fraction of underflow entries (useful for shape comparison)
283  // ============================================================================
284  template <typename HISTO>
285  double _underflowIntegralFrac( const HISTO* histo ) {
286  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
287  const auto underflow = histo->binHeight( AIDA::IAxis::UNDERFLOW_BIN );
288  if ( 0 == underflow ) { return 0; } // RETURN
289  const auto all = histo->sumAllBinHeights();
290  if ( 0 == all ) { return 0; } // "CONVENTION?" RETURN
291  //
292  return (double)underflow / (double)all;
293  }
294  // ============================================================================
295  // error on fraction of overflow entries (useful for shape comparison)
296  // ============================================================================
297  template <typename HISTO>
298  double _overflowEntriesFracErr( const HISTO* histo ) {
299  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
300  //
301  const auto overflow = histo->binEntries( AIDA::IAxis::OVERFLOW_BIN );
302  const auto all = histo->allEntries();
303  //
304  if ( 0 > overflow || 0 >= all || overflow > all ) { return s_bad; }
305  //
306  const double n = std::max( (double)overflow, 1.0 );
307  const double N = all;
308  const double n1 = std::max( N - n, 1.0 );
309  //
310  return std::sqrt( n * ( n1 / N ) ) / N; // use the binomial formula
311  }
312  // ============================================================================
313  // error on fraction of underflow entries (useful for shape comparison)
314  // ============================================================================
315  template <typename HISTO>
316  double _underflowEntriesFracErr( const HISTO* histo ) {
317  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
318  //
319  const auto underflow = histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN );
320  const auto all = histo->allEntries();
321  //
322  if ( 0 > underflow || 0 >= all || underflow > all ) { return s_bad; }
323  //
324  const double n = std::max( (double)underflow, 1.0 );
325  const double N = all;
326  const double n1 = std::max( N - n, 1.0 );
327  //
328  return std::sqrt( n * ( n1 / N ) ) / N; // use the binomial formula
329  }
330  // ============================================================================
331  // the error on fraction of overflow intergal
332  // ============================================================================
333  template <typename HISTO>
334  double _overflowIntegralFracErr( const HISTO* histo ) {
335  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
336  //
337  const auto all = histo->sumAllBinHeights();
338  if ( 0 == all ) { return s_bad; } // RETURN
339  const auto overflow = histo->binHeight( AIDA::IAxis::OVERFLOW_BIN );
340  const auto oErr = histo->binError( AIDA::IAxis::OVERFLOW_BIN );
341  if ( 0 > oErr ) { return s_bad; } // RETURN
342  const auto aErr = _sumAllBinHeightErr( histo );
343  if ( 0 > aErr ) { return s_bad; } // RETURN
344  //
345  auto error2 = std::pow( (double)oErr, 2 );
346  error2 += ( std::pow( (double)aErr, 2 ) * std::pow( (double)overflow, 2 ) / std::pow( (double)all, 2 ) );
347  error2 /= std::pow( (double)all, 2 );
348  //
349  return std::sqrt( error2 );
350  }
351  // ============================================================================
352  // the error on fraction of overflow intergal
353  // ============================================================================
354  template <typename HISTO>
355  double _underflowIntegralFracErr( const HISTO* histo ) {
356  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
357  //
358  const auto all = histo->sumAllBinHeights();
359  if ( 0 == all ) { return s_bad; } // RETURN
360  const auto underflow = histo->binHeight( AIDA::IAxis::UNDERFLOW_BIN );
361  const auto oErr = histo->binError( AIDA::IAxis::UNDERFLOW_BIN );
362  if ( 0 > oErr ) { return s_bad; } // RETURN
363  const auto aErr = _sumAllBinHeightErr( histo );
364  if ( 0 > aErr ) { return s_bad; } // RETURN
365  //
366  auto error2 = std::pow( (double)oErr, 2 );
367  error2 += ( std::pow( (double)aErr, 2 ) * std::pow( (double)underflow, 2 ) / std::pow( (double)all, 2 ) );
368  error2 /= std::pow( (double)all, 2 );
369  //
370  return std::sqrt( error2 );
371  }
372  // ============================================================================
373  // # entries
374  // ============================================================================
375  template <typename HISTO>
376  long _nEntries( const HISTO* histo, const int imax ) {
377  if ( UNLIKELY( !histo ) ) { return s_long_bad; } // RETURN
378  if ( 0 > imax ) { return 0; } // RETURN
379  long result = histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN );
380 
381  // get the exis
382  const auto& axis = histo->axis();
383  // number of bins
384  const auto nBins = axis.bins();
385  // loop over bins
386  for ( int i = 0; i < nBins && i < imax; ++i ) { result += histo->binEntries( i ); }
387  //
388  if ( nBins < imax ) { result += histo->binEntries( AIDA::IAxis::OVERFLOW_BIN ); }
389  //
390  return result;
391  }
392  // ============================================================================
393  // # entries
394  // ============================================================================
395  template <typename HISTO>
396  long _nEntries( const HISTO* histo,
397  const int imin, // minimal bin number (included)
398  const int imax ) // maximal bin number (not included)
399  {
400  if ( UNLIKELY( !histo ) ) { return s_long_bad; } // RETURN
401  if ( imin == imax ) { return 0; } // RETURN
402  if ( imax < imin ) { return _nEntries( histo, imax, imin ); } // RETURN
403  //
404  long result = 0;
405  if ( 0 > imin ) { result += histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN ); }
406  // get the exis
407  const auto& axis = histo->axis();
408  // number of bins
409  const auto nBins = axis.bins();
410  if ( nBins < imin ) { return 0; } // RETURN
411  // loop over bins
412  for ( int i = imin; i < nBins && imin <= i && i < imax; ++i ) { result += histo->binEntries( i ); }
413  //
414  if ( nBins < imax ) { result += histo->binEntries( AIDA::IAxis::OVERFLOW_BIN ); }
415  //
416  return result; // RETURN
417  }
418  // ============================================================================
419  // get the fraction of entries in histogram up to the given bin (not-included)
420  // ============================================================================
421  template <typename HISTO>
422  double _nEntriesFrac( const HISTO* histo, const int imax ) {
423  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
424  //
425  const auto N = histo->allEntries();
426  if ( 0 >= N ) { return s_bad; } // RETURN
427  const auto n = _nEntries( histo, imax );
428  if ( 0 > n ) { return s_bad; } // RETURN
429  if ( n > N ) { return s_bad; } // RETURN
430  //
431  return (double)n / (double)N; // RETURN
432  }
433  // ============================================================================
434  /* get fraction of entries in histogram form the certain
435  * minimal bin up to the certain maximal bin (not-included) */
436  // ============================================================================
437  template <typename HISTO>
438  double _nEntriesFrac( const HISTO* histo,
439  const int imin, // minimal bin number (included)
440  const int imax ) // maximal bin number (not included)
441  {
442  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
443  const auto N = histo->allEntries();
444  if ( 0 >= N ) { return s_bad; } // RETURN
445  const auto n = _nEntries( histo, imin, imax );
446  if ( 0 > n ) { return s_bad; } // RETURN
447  if ( n > N ) { return s_bad; } // RETURN
448  //
449  return (double)n / (double)N; // RETURN
450  }
451  // ============================================================================
452  // # entries fraction error
453  // ============================================================================
454  template <typename HISTO>
455  double _nEntriesFracErr( const HISTO* histo, const int imax ) {
456  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
457  //
458  const auto N = histo->allEntries();
459  if ( 0 >= N ) { return s_bad; } // RETURN
460  const auto n = _nEntries( histo, imax );
461  if ( 0 > n ) { return s_bad; } // RETURN
462  if ( n > N ) { return s_bad; } // RETURN
463  //
464  const auto _n1 = std::max( (double)n, 1.0 );
465  const auto _n2 = std::max( (double)( N - n ), 1.0 );
466  //
467  return std::sqrt( _n1 * ( _n2 / N ) ) / N; // RETURN
468  }
469  // ============================================================================
470  // get the (binomial) error for the fraction of entries in histogram
471  // ============================================================================
472  template <typename HISTO>
473  double _nEntriesFracErr( const HISTO* histo,
474  const int imin, // minimal bin number (included)
475  const int imax ) // maximal bin number (not included)
476  {
477  if ( UNLIKELY( !histo ) ) { return s_bad; } // RETURN
478  //
479  const auto N = histo->allEntries();
480  if ( 0 >= N ) { return s_bad; } // RETURN
481  const auto n = _nEntries( histo, imin, imax );
482  if ( 0 > n ) { return s_bad; } // RETURN
483  if ( n > N ) { return s_bad; } // RETURN
484  //
485  const auto _n1 = std::max( (double)n, 1.0 );
486  const auto _n2 = std::max( (double)( N - n ), 1.0 );
487  //
488  return std::sqrt( _n1 * ( _n2 / N ) ) / N; // RETURN
489  }
490 } // namespace
491 // ============================================================================
492 /* get the moment of the certain around the specified "value"
493  * @param histo histogram
494  * @param order the moment order
495  * @param value central value
496  * @return the evaluated moment
497  */
498 // ============================================================================
499 double Gaudi::Utils::HistoStats::moment( const AIDA::IHistogram1D* histo, const unsigned int order,
500  const double value ) {
501  return _moment( histo, order, value );
502 }
503 // ============================================================================
504 /* get the moment of the certain around the specified "value"
505  * @param histo histogram
506  * @param order the moment order
507  * @param value central value
508  * @return the evaluated moment
509  */
510 // ============================================================================
511 double Gaudi::Utils::HistoStats::moment( const AIDA::IProfile1D* histo, const unsigned int order, const double value ) {
512  return _moment( histo, order, value );
513 }
514 // ============================================================================
521 // ============================================================================
522 double Gaudi::Utils::HistoStats::momentErr( const AIDA::IHistogram1D* histo, const unsigned int order ) {
523  return _momentErr( histo, order );
524 }
525 // ============================================================================
532 // ============================================================================
533 double Gaudi::Utils::HistoStats::momentErr( const AIDA::IProfile1D* histo, const unsigned int order ) {
534  return _momentErr( histo, order );
535 }
536 // ============================================================================
537 /* evaluate the central momentum (around the mean value)
538  * @param histo histogram
539  * @param order the momentm order
540  * @param value central value
541  * @return the evaluated central moment
542  */
543 // ============================================================================
544 double Gaudi::Utils::HistoStats::centralMoment( const AIDA::IHistogram1D* histo, const unsigned int order ) {
545  return _centralMoment( histo, order );
546 }
547 // ============================================================================
548 /* evaluate the central momentum (around the mean value)
549  * @param histo histogram
550  * @param order the momentm order
551  * @param value central value
552  * @return the evaluated central moment
553  */
554 // ============================================================================
555 double Gaudi::Utils::HistoStats::centralMoment( const AIDA::IProfile1D* histo, const unsigned int order ) {
556  return _centralMoment( histo, order );
557 }
558 // ============================================================================
559 /* evaluate the uncertanty for 'bin-by-bin'-central momentum
560  * (around the mean value)
561  * ( the uncertanty is calculated with O(1/n2) precision)
562  * @param histo histogram
563  * @param order the moment parameter
564  * @param value central value
565  * @return the evaluated uncertanty in the central moment
566  */
567 // ============================================================================
568 double Gaudi::Utils::HistoStats::centralMomentErr( const AIDA::IHistogram1D* histo, const unsigned int order ) {
569  return _centralMomentErr( histo, order );
570 }
571 // ============================================================================
572 /* evaluate the uncertanty for 'bin-by-bin'-central momentum
573  * (around the mean value)
574  * ( the uncertanty is calculated with O(1/n2) precision)
575  * @param histo histogram
576  * @param order the moment parameter
577  * @param value central value
578  * @return the evaluated uncertanty in the central moment
579  */
580 // ============================================================================
581 double Gaudi::Utils::HistoStats::centralMomentErr( const AIDA::IProfile1D* histo, const unsigned int order ) {
582  return _centralMomentErr( histo, order );
583 }
584 // ============================================================================
585 // get the skewness for the histogram
586 // ============================================================================
587 double Gaudi::Utils::HistoStats::skewness( const AIDA::IHistogram1D* histo ) { return _skewness( histo ); }
588 // ============================================================================
589 // get the skewness for the profile
590 // ============================================================================
591 double Gaudi::Utils::HistoStats::skewness( const AIDA::IProfile1D* histo ) { return _skewness( histo ); }
592 // ============================================================================
593 // get the error in skewness
594 // ============================================================================
595 double Gaudi::Utils::HistoStats::skewnessErr( const AIDA::IHistogram1D* histo ) { return _skewnessErr( histo ); }
596 // ============================================================================
597 // get the error in skewness
598 // ============================================================================
599 double Gaudi::Utils::HistoStats::skewnessErr( const AIDA::IProfile1D* histo ) { return _skewnessErr( histo ); }
600 // ============================================================================
601 // get the kurtosis for the histogram
602 // ============================================================================
603 double Gaudi::Utils::HistoStats::kurtosis( const AIDA::IHistogram1D* histo ) { return _kurtosis( histo ); }
604 // ============================================================================
605 // get the kurtosis for the histogram
606 // ============================================================================
607 double Gaudi::Utils::HistoStats::kurtosis( const AIDA::IProfile1D* histo ) { return _kurtosis( histo ); }
608 // ============================================================================
609 // get the error in kurtosis
610 // ============================================================================
611 double Gaudi::Utils::HistoStats::kurtosisErr( const AIDA::IHistogram1D* histo ) { return _kurtosisErr( histo ); }
612 // ============================================================================
613 // get the error in kurtosis
614 // ============================================================================
615 double Gaudi::Utils::HistoStats::kurtosisErr( const AIDA::IProfile1D* histo ) { return _kurtosisErr( histo ); }
616 // ============================================================================
617 // get the effective entries
618 // ============================================================================
619 double Gaudi::Utils::HistoStats::nEff( const AIDA::IHistogram1D* histo ) { return _nEff( histo ); }
620 // ============================================================================
621 // get the effective entries
622 // ============================================================================
623 double Gaudi::Utils::HistoStats::nEff( const AIDA::IProfile1D* histo ) { return _nEff( histo ); }
624 // ============================================================================
625 // get the mean value for the histogram
626 // ============================================================================
627 double Gaudi::Utils::HistoStats::mean( const AIDA::IHistogram1D* histo ) { return _mean( histo ); }
628 // ============================================================================
629 // get the mean value for the histogram
630 // ============================================================================
631 double Gaudi::Utils::HistoStats::mean( const AIDA::IProfile1D* histo ) { return _mean( histo ); }
632 // ============================================================================
633 // get an error in the mean value
634 // ============================================================================
635 double Gaudi::Utils::HistoStats::meanErr( const AIDA::IHistogram1D* histo ) { return _meanErr( histo ); }
636 // ============================================================================
637 // get an error in the mean value
638 // ============================================================================
639 double Gaudi::Utils::HistoStats::meanErr( const AIDA::IProfile1D* histo ) { return _meanErr( histo ); }
640 // ============================================================================
641 // get the rms value for the histogram
642 // ============================================================================
643 double Gaudi::Utils::HistoStats::rms( const AIDA::IHistogram1D* histo ) { return _rms( histo ); }
644 // ============================================================================
645 // get the rms value for the histogram
646 // ============================================================================
647 double Gaudi::Utils::HistoStats::rms( const AIDA::IProfile1D* histo ) { return _rms( histo ); }
648 // ============================================================================
649 // get the error in rms
650 // ============================================================================
651 double Gaudi::Utils::HistoStats::rmsErr( const AIDA::IHistogram1D* histo ) { return _rmsErr( histo ); }
652 // ============================================================================
653 // get the error in rms
654 // ============================================================================
655 double Gaudi::Utils::HistoStats::rmsErr( const AIDA::IProfile1D* histo ) { return _rmsErr( histo ); }
656 // ============================================================================
657 // get an error in the sum bin height ("in range integral")
658 // ============================================================================
659 double Gaudi::Utils::HistoStats::sumBinHeightErr( const AIDA::IHistogram1D* histo ) {
660  return _sumBinHeightErr( histo );
661 }
662 // ============================================================================
663 // get an error in the sum bin height ("in range integral")
664 // ============================================================================
665 double Gaudi::Utils::HistoStats::sumBinHeightErr( const AIDA::IProfile1D* histo ) { return _sumBinHeightErr( histo ); }
666 // ============================================================================
667 // get an error in the sum all bin height ("integral")
668 // ============================================================================
669 double Gaudi::Utils::HistoStats::sumAllBinHeightErr( const AIDA::IHistogram1D* histo ) {
670  return _sumAllBinHeightErr( histo );
671 }
672 // ============================================================================
673 // get an error in the sum all bin height ("integral")
674 // ============================================================================
675 double Gaudi::Utils::HistoStats::sumAllBinHeightErr( const AIDA::IProfile1D* histo ) {
676  return _sumAllBinHeightErr( histo );
677 }
678 // ============================================================================
679 // the fraction of overflow entries (useful for shape comparison)
680 // ============================================================================
681 double Gaudi::Utils::HistoStats::overflowEntriesFrac( const AIDA::IHistogram1D* histo ) {
682  return _overflowEntriesFrac( histo );
683 }
684 // ============================================================================
685 // the fraction of overflow entries (useful for shape comparison)
686 // ============================================================================
687 double Gaudi::Utils::HistoStats::overflowEntriesFrac( const AIDA::IProfile1D* histo ) {
688  return _overflowEntriesFrac( histo );
689 }
690 // ============================================================================
691 // the fraction of underflow entries (useful for shape comparison)
692 // ============================================================================
693 double Gaudi::Utils::HistoStats::underflowEntriesFrac( const AIDA::IHistogram1D* histo ) {
694  return _underflowEntriesFrac( histo );
695 }
696 // ============================================================================
697 // the fraction of underflow entries (useful for shape comparison)
698 // ============================================================================
699 double Gaudi::Utils::HistoStats::underflowEntriesFrac( const AIDA::IProfile1D* histo ) {
700  return _underflowEntriesFrac( histo );
701 }
702 // ============================================================================
703 // the fraction of overflow integral (useful for shape comparison)
704 // ============================================================================
705 double Gaudi::Utils::HistoStats::overflowIntegralFrac( const AIDA::IHistogram1D* histo ) {
706  return _overflowIntegralFrac( histo );
707 }
708 // ============================================================================
709 // the fraction of overflow integral (useful for shape comparison)
710 // ============================================================================
711 double Gaudi::Utils::HistoStats::overflowIntegralFrac( const AIDA::IProfile1D* histo ) {
712  return _overflowIntegralFrac( histo );
713 }
714 // ============================================================================
715 // the fraction of underflow entries (useful for shape comparison)
716 // ============================================================================
717 double Gaudi::Utils::HistoStats::underflowIntegralFrac( const AIDA::IHistogram1D* histo ) {
718  return _underflowIntegralFrac( histo );
719 }
720 // ============================================================================
721 // the fraction of underflow entries (useful for shape comparison)
722 // ============================================================================
723 double Gaudi::Utils::HistoStats::underflowIntegralFrac( const AIDA::IProfile1D* histo ) {
724  return _underflowIntegralFrac( histo );
725 }
726 // ============================================================================
727 // error on fraction of overflow entries (useful for shape comparison)
728 // ============================================================================
729 double Gaudi::Utils::HistoStats::overflowEntriesFracErr( const AIDA::IHistogram1D* histo ) {
730  return _overflowEntriesFracErr( histo );
731 }
732 // ============================================================================
733 // error on fraction of overflow entries (useful for shape comparison)
734 // ============================================================================
735 double Gaudi::Utils::HistoStats::overflowEntriesFracErr( const AIDA::IProfile1D* histo ) {
736  return _overflowEntriesFracErr( histo );
737 }
738 // ============================================================================
739 // error on fraction of underflow entries (useful for shape comparison)
740 // ============================================================================
741 double Gaudi::Utils::HistoStats::underflowEntriesFracErr( const AIDA::IHistogram1D* histo ) {
742  return _underflowEntriesFracErr( histo );
743 }
744 // ============================================================================
745 // error on fraction of underflow entries (useful for shape comparison)
746 // ============================================================================
747 double Gaudi::Utils::HistoStats::underflowEntriesFracErr( const AIDA::IProfile1D* histo ) {
748  return _underflowEntriesFracErr( histo );
749 }
750 // ============================================================================
751 // the error on fraction of overflow intergal
752 // ============================================================================
753 double Gaudi::Utils::HistoStats::overflowIntegralFracErr( const AIDA::IHistogram1D* histo ) {
754  return _overflowIntegralFracErr( histo );
755 }
756 // ============================================================================
757 // the error on fraction of overflow intergal
758 // ============================================================================
759 double Gaudi::Utils::HistoStats::overflowIntegralFracErr( const AIDA::IProfile1D* histo ) {
760  return _overflowIntegralFracErr( histo );
761 }
762 // ============================================================================
763 // the error on fraction of overflow intergal
764 // ============================================================================
765 double Gaudi::Utils::HistoStats::underflowIntegralFracErr( const AIDA::IHistogram1D* histo ) {
766  return _underflowIntegralFracErr( histo );
767 }
768 // ============================================================================
769 // the error on fraction of overflow intergal
770 // ============================================================================
771 double Gaudi::Utils::HistoStats::underflowIntegralFracErr( const AIDA::IProfile1D* histo ) {
772  return _underflowIntegralFracErr( histo );
773 }
774 // ============================================================================
775 /* get number of entries in histogram up to the certain
776  * bin (not-included)
777  * @attention underflow bin is included!
778  * @param histo the pointer to the histogram
779  * @param imax the bin number (not included)
780  * @param number of entries
781  */
782 // ============================================================================
783 long Gaudi::Utils::HistoStats::nEntries( const AIDA::IHistogram1D* histo, const int imax ) {
784  return _nEntries( histo, imax );
785 }
786 // ============================================================================
787 /* get number of entries in histogram up to the certain
788  * bin (not-included)
789  * @attention underflow bin is included!
790  * @param histo the pointer to the histogram
791  * @param imax the bin number (not included)
792  * @param number of entries
793  */
794 // ============================================================================
795 long Gaudi::Utils::HistoStats::nEntries( const AIDA::IProfile1D* histo, const int imax ) {
796  return _nEntries( histo, imax );
797 }
798 // ============================================================================
799 /* get number of entries in histogram form the certain
800  * minimal bin up to the certain maximal bin (not-included)
801  * @param histo the pointer to the histogram
802  * @param imin the minimal bin number (included)
803  * @param imax the maximal bin number (not included)
804  * @param number of entries
805  */
806 // ============================================================================
807 long Gaudi::Utils::HistoStats::nEntries( const AIDA::IHistogram1D* histo,
808  const int imin, // minimal bin number (included)
809  const int imax ) // maximal bin number (not included)
810 {
811  return _nEntries( histo, imin, imax );
812 }
813 // ============================================================================
814 /* get number of entries in histogram form the certain
815  * minimal bin up to the certain maximal bin (not-included)
816  * @param histo the pointer to the histogram
817  * @param imin the minimal bin number (included)
818  * @param imax the maximal bin number (not included)
819  * @param number of entries
820  */
821 // ============================================================================
822 long Gaudi::Utils::HistoStats::nEntries( const AIDA::IProfile1D* histo,
823  const int imin, // minimal bin number (included)
824  const int imax ) // maximal bin number (not included)
825 {
826  return _nEntries( histo, imin, imax );
827 }
828 // ============================================================================
829 /* get the fraction of entries in histogram up to the certain
830  * bin (not-included)
831  * @attention underflow bin is included!
832  * @param histo the pointer to the histogram
833  * @param imax the bin number (not included)
834  * @param fraction of entries
835  */
836 // ============================================================================
837 double Gaudi::Utils::HistoStats::nEntriesFrac( const AIDA::IHistogram1D* histo, const int imax ) {
838  return _nEntriesFrac( histo, imax );
839 }
840 // ============================================================================
841 /* get the fraction of entries in histogram up to the certain
842  * bin (not-included)
843  * @attention underflow bin is included!
844  * @param histo the pointer to the histogram
845  * @param imax the bin number (not included)
846  * @param fraction of entries
847  */
848 // ============================================================================
849 double Gaudi::Utils::HistoStats::nEntriesFrac( const AIDA::IProfile1D* histo, const int imax ) {
850  return _nEntriesFrac( histo, imax );
851 }
852 // ============================================================================
853 /* get fraction of entries in histogram form the certain
854  * minimal bin up to the certain maximal bin (not-included)
855  * @param histo the pointer to the histogram
856  * @param imin the minimal bin number (included)
857  * @param imax the maximal bin number (not included)
858  * @param fraction of entries
859  */
860 // ============================================================================
861 double Gaudi::Utils::HistoStats::nEntriesFrac( const AIDA::IHistogram1D* histo,
862  const int imin, // minimal bin number (included)
863  const int imax ) // maximal bin number (not included)
864 {
865  return _nEntriesFrac( histo, imin, imax );
866 }
867 // ============================================================================
868 /* get fraction of entries in histogram form the certain
869  * minimal bin up to the certain maximal bin (not-included)
870  * @param histo the pointer to the histogram
871  * @param imin the minimal bin number (included)
872  * @param imax the maximal bin number (not included)
873  * @param fraction of entries
874  */
875 // ============================================================================
876 double Gaudi::Utils::HistoStats::nEntriesFrac( const AIDA::IProfile1D* histo,
877  const int imin, // minimal bin number (included)
878  const int imax ) // maximal bin number (not included)
879 {
880  return _nEntriesFrac( histo, imin, imax );
881 }
882 // ============================================================================
883 /* get the (binominal) error for the fraction of entries
884  * in histogram up to the certain bin (not-included)
885  * @attention underflow bin is included!
886  * @param histo the pointer to the histogram
887  * @param imax the bin number (not included)
888  * @param error for the fraction of entries
889  */
890 // ============================================================================
891 double Gaudi::Utils::HistoStats::nEntriesFracErr( const AIDA::IHistogram1D* histo, const int imax ) {
892  return _nEntriesFracErr( histo, imax );
893 }
894 // ============================================================================
895 /* get the (binominal) error for the fraction of entries
896  * in histogram up to the certain bin (not-included)
897  * @attention underflow bin is included!
898  * @param histo the pointer to the histogram
899  * @param imax the bin number (not included)
900  * @param error for the fraction of entries
901  */
902 // ============================================================================
903 double Gaudi::Utils::HistoStats::nEntriesFracErr( const AIDA::IProfile1D* histo, const int imax ) {
904  return _nEntriesFracErr( histo, imax );
905 }
906 // ============================================================================
907 /* get the (binomial) error for the fraction of entries in histogram
908  * from the certain minimal bin up to the certain maximal bin (not-included)
909  * @param histo the pointer to the histogram
910  * @param imin the minimal bin number (included)
911  * @param imax the maximal bin number (not included)
912  * @param error for the fraction of entries
913  */
914 // ============================================================================
915 double Gaudi::Utils::HistoStats::nEntriesFracErr( const AIDA::IHistogram1D* histo,
916  const int imin, // minimal bin number (included)
917  const int imax ) // maximal bin number (not included)
918 {
919  return _nEntriesFracErr( histo, imin, imax );
920 }
921 // ============================================================================
922 /* get the (binomial) error for the fraction of entries in histogram
923  * from the certain minimal bin up to the certain maximal bin (not-included)
924  * @param histo the pointer to the histogram
925  * @param imin the minimal bin number (included)
926  * @param imax the maximal bin number (not included)
927  * @param error for the fraction of entries
928  */
929 // ============================================================================
930 double Gaudi::Utils::HistoStats::nEntriesFracErr( const AIDA::IProfile1D* histo,
931  const int imin, // minimal bin number (included)
932  const int imax ) // maximal bin number (not included)
933 {
934  return _nEntriesFracErr( histo, imin, imax );
935 }
936 // ============================================================================
937 // The END
938 // ============================================================================
static double underflowIntegralFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of underflow integral
Definition: HistoStats.cpp:765
#define UNLIKELY(x)
Definition: Kernel.h:89
static double overflowIntegralFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of overflow intergal
Definition: HistoStats.cpp:753
static double momentErr(const AIDA::IHistogram1D *histo, const unsigned int order)
evaluate the uncertanty for &#39;bin-by-bin&#39;-moment
Definition: HistoStats.cpp:522
static double underflowEntriesFrac(const AIDA::IHistogram1D *histo)
the fraction of underflow entries (useful for shape comparison)
Definition: HistoStats.cpp:693
static long nEntries(const AIDA::IHistogram1D *histo, const int imax)
get number of entries in histogram up to the certain bin (not-included)
Definition: HistoStats.cpp:783
static double rmsErr(const AIDA::IHistogram1D *histo)
get an error in the rms value
Definition: HistoStats.cpp:651
static double underflowIntegralFrac(const AIDA::IHistogram1D *histo)
the fraction of underflow integral (useful for shape comparison)
Definition: HistoStats.cpp:717
static double moment(const AIDA::IHistogram1D *histo, const unsigned int order, const double value=0)
get the "bin-by-bin"-moment around the specified "value"
Definition: HistoStats.cpp:499
static double meanErr(const AIDA::IHistogram1D *histo)
get an error in the mean value
Definition: HistoStats.cpp:635
static double nEntriesFrac(const AIDA::IHistogram1D *histo, const int imax)
get the fraction of entries in histogram up to the certain bin (not-included)
Definition: HistoStats.cpp:837
static double overflowIntegralFrac(const AIDA::IHistogram1D *histo)
the fraction of overflow intergal (useful for shape comparison)
Definition: HistoStats.cpp:705
static double centralMoment(const AIDA::IHistogram1D *histo, const unsigned int order)
evaluate the &#39;bin-by-bin&#39;-central moment (around the mean value)
Definition: HistoStats.cpp:544
static double centralMomentErr(const AIDA::IHistogram1D *histo, const unsigned int order)
evaluate the uncertanty for &#39;bin-by-bin&#39;-central moment (around the mean value) ( the uncertanty is c...
Definition: HistoStats.cpp:568
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:643
int N
Definition: IOTest.py:99
T lowest(T...args)
static double overflowEntriesFrac(const AIDA::IHistogram1D *histo)
the fraction of overflow entries (useful for shape comparison)
Definition: HistoStats.cpp:681
static double nEntriesFracErr(const AIDA::IHistogram1D *histo, const int imax)
get the (binominal) error for the fraction of entries in histogram up to the certain bin (not-include...
Definition: HistoStats.cpp:891
T fabs(T...args)
T max(T...args)
static double sumBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum bin height ("in-range integral")
Definition: HistoStats.cpp:659
static double overflowEntriesFracErr(const AIDA::IHistogram1D *histo)
error on fraction of overflow entries (useful for shape comparison)
Definition: HistoStats.cpp:729
static double sumAllBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum of all bin height ("integral")
Definition: HistoStats.cpp:669
static double kurtosisErr(const AIDA::IHistogram1D *histo)
get the error in kurtosis for the histogram
Definition: HistoStats.cpp:611
T pow(T...args)
static double mean(const AIDA::IHistogram1D *histo)
get the mean value for the histogram (just for completeness)
Definition: HistoStats.cpp:627
static double skewnessErr(const AIDA::IHistogram1D *histo)
get the error in skewness for the histogram
Definition: HistoStats.cpp:595
T sqrt(T...args)
static double underflowEntriesFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of underflow entries (useful for shape comparison)
Definition: HistoStats.cpp:741
static double kurtosis(const AIDA::IHistogram1D *histo)
get the kurtosis for the histogram
Definition: HistoStats.cpp:603
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:619
static double skewness(const AIDA::IHistogram1D *histo)
get the skewness for the histogram
Definition: HistoStats.cpp:587