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