| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Static Public Member Functions | List of all members
Gaudi::Utils::HistoStats Class Reference

The collection of trivial functions to access the statistical information for the histograms. More...

`#include <GaudiUtils/HistoStats.h>`

## Static Public Member Functions
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" More...
static double | momentErr (const AIDA::IHistogram1D *histo, const unsigned int order)
| evaluate the uncertanty for 'bin-by-bin'-moment More...
static double | centralMoment (const AIDA::IHistogram1D *histo, const unsigned int order)
| evaluate the 'bin-by-bin'-central moment (around the mean value) More...
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 calculated with O(1/n2) precision) More...
static double | skewness (const AIDA::IHistogram1D *histo)
| get the skewness for the histogram More...
static double | skewnessErr (const AIDA::IHistogram1D *histo)
| get the error in skewness for the histogram More...
static double | kurtosis (const AIDA::IHistogram1D *histo)
| get the kurtosis for the histogram More...
static double | kurtosisErr (const AIDA::IHistogram1D *histo)
| get the error in kurtosis for the histogram More...
static double | mean (const AIDA::IHistogram1D *histo)
| get the mean value for the histogram (just for completeness) More...
static double | meanErr (const AIDA::IHistogram1D *histo)
| get an error in the mean value More...
static double | rms (const AIDA::IHistogram1D *histo)
| get the rms value for the histogram (just for completeness) More...
static double | rmsErr (const AIDA::IHistogram1D *histo)
| get an error in the rms value More...
static double | nEff (const AIDA::IHistogram1D *histo)
| get the effective entries (just for completeness) More...
static double | sumBinHeightErr (const AIDA::IHistogram1D *histo)
| get an error in the sum bin height ("in-range integral") More...
static double | sumAllBinHeightErr (const AIDA::IHistogram1D *histo)
| get an error in the sum of all bin height ("integral") More...
static double | overflowEntriesFrac (const AIDA::IHistogram1D *histo)
| the fraction of overflow entries (useful for shape comparison) More...
static double | underflowEntriesFrac (const AIDA::IHistogram1D *histo)
| the fraction of underflow entries (useful for shape comparison) More...
static double | overflowEntriesFracErr (const AIDA::IHistogram1D *histo)
| error on fraction of overflow entries (useful for shape comparison) More...
static double | underflowEntriesFracErr (const AIDA::IHistogram1D *histo)
| the error on fraction of underflow entries (useful for shape comparison) More...
static double | overflowIntegralFrac (const AIDA::IHistogram1D *histo)
| the fraction of overflow intergal (useful for shape comparison) More...
static double | underflowIntegralFrac (const AIDA::IHistogram1D *histo)
| the fraction of underflow integral (useful for shape comparison) More...
static double | overflowIntegralFracErr (const AIDA::IHistogram1D *histo)
| the error on fraction of overflow intergal More...
static double | underflowIntegralFracErr (const AIDA::IHistogram1D *histo)
| the error on fraction of underflow integral More...
static long | nEntries (const AIDA::IHistogram1D *histo, const int imax)
| get number of entries in histogram up to the certain bin (not-included) More...
static long | nEntries (const AIDA::IHistogram1D *histo, const int imin, const int imax)
| get number of entries in histogram form the certain minimal bin up to the certain maximal bin (not-included) More...
static double | nEntriesFrac (const AIDA::IHistogram1D *histo, const int imax)
| get the fraction of entries in histogram up to the certain bin (not-included) More...
static double | nEntriesFrac (const AIDA::IHistogram1D *histo, const int imin, const int imax)
| get fraction of entries in histogram form the certain minimal bin up to the certain maximal bin (not-included) More...
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-included) More...
static double | nEntriesFracErr (const AIDA::IHistogram1D *histo, const int imin, const int imax)
| get the (binomial) error for the fraction of entries in histogram from the certain minimal bin up to the certain maximal bin (not-included) More...

## Detailed Description

The collection of trivial functions to access the statistical information for the histograms.

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u

Date
  2007-08-06

Definition at line 32 of file HistoStats.h.

## Member Function Documentation

double Gaudi::Utils::HistoStats::centralMoment | ( | const AIDA::IHistogram1D * | histo,
|  | const unsigned int | order
| ) |  |
| static

evaluate the 'bin-by-bin'-central moment (around the mean value)

Parameters

  histo | histogram
  order | the moment parameter
  value | central value

Returns
  the evaluated central moment

Definition at line 119 of file HistoStats.cpp.

120 {
121 if ( !histo ) {
122 return s_bad;
123 } // RETURN
124 if ( 0 == order ) {
125 return 1.0;
126 } // RETURN
127 if ( 1 == order ) {
128 return 0.0;
129 } // RETURN
130 if ( 2 == order ) {
131 return std::pow( histo->rms(), 2 ); // RETURN
132 }
133 // delegate the actual evaluation to another method:
134 return moment( histo, order, mean( histo ) );
135 }
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:47
std::pow
T pow(T...args)
Gaudi::Utils::HistoStats::mean
static double mean(const AIDA::IHistogram1D *histo)
get the mean value for the histogram (just for completeness)
Definition: HistoStats.cpp:231

double Gaudi::Utils::HistoStats::centralMomentErr | ( | const AIDA::IHistogram1D * | histo,
|  | const unsigned int | order
| ) |  |
| static

evaluate the uncertanty for 'bin-by-bin'-central moment (around the mean value) ( the uncertanty is calculated with O(1/n2) precision)

Parameters

  histo | histogram
  order | the moment parameter
  value | central value

Returns
  the evaluated uncertanty in the central moment

Definition at line 146 of file HistoStats.cpp.

147 {
148 if ( !histo ) {
149 return s_bad;
150 } // RETURN
151 const auto n = nEff( histo );
152 if ( 0 >= n ) {
153 return 0.0;
154 } // RETURN
155 const auto mu2 = centralMoment( histo, 2 ); // mu(2)
156 const auto muo = centralMoment( histo, order ); // mu(o)
157 const auto mu2o = centralMoment( histo, 2 * order ); // mu(2o)
158 const auto muom = centralMoment( histo, order - 1 ); // mu(o-1)
159 const auto muop = centralMoment( histo, order + 1 ); // mu(o+1)
160 const auto result =
161 ( mu2o - ( 2.0 * order * muom * muop ) - std::pow( muo, 2 ) + ( order * order * mu2 * muom * muom ) ) / n;
162 return std::sqrt( std::max( 0.0, result ) ); // RETURN
163 }
Gaudi::Utils::HistoStats::centralMoment
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:119
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
std::max
T max(T...args)
std::pow
T pow(T...args)
std::sqrt
T sqrt(T...args)
Gaudi::Utils::HistoStats::nEff
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:224

double Gaudi::Utils::HistoStats::kurtosis | ( | const AIDA::IHistogram1D * | histo | ) |
| static

get the kurtosis for the histogram

Definition at line 194 of file HistoStats.cpp.

195 {
196 if ( !histo ) {
197 return s_bad;
198 } // RETURN
199 const auto mu4 = centralMoment( histo, 4 );
200 const auto s4 = std::pow( rms( histo ), 4 );
201 return ( std::fabs( s4 ) > 0 ? mu4 / s4 - 3.0 : 0.0 );
202 }
Gaudi::Utils::HistoStats::centralMoment
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:119
Gaudi::Utils::HistoStats::rms
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:246
std::fabs
T fabs(T...args)
std::pow
T pow(T...args)

double Gaudi::Utils::HistoStats::kurtosisErr | ( | const AIDA::IHistogram1D * | histo | ) |
| static

get the error in kurtosis for the histogram

Definition at line 206 of file HistoStats.cpp.

207 {
208 if ( !histo ) {
209 return s_bad;
210 } // RETURN
211 const auto n = nEff( histo );
212 if ( 3 > n ) {
213 return 0.0;
214 } // RETURN
215 auto result = 24.0 * n;
216 result *= ( n - 2 ) * ( n - 3 );
217 result /= ( n + 1 ) * ( n + 1 );
218 result /= ( n + 3 ) * ( n + 5 );
219 return std::sqrt( result );
220 }
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
std::sqrt
T sqrt(T...args)
Gaudi::Utils::HistoStats::nEff
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:224

double Gaudi::Utils::HistoStats::mean | ( | const AIDA::IHistogram1D * | histo | ) |
| static

get the mean value for the histogram (just for completeness)

Definition at line 231 of file HistoStats.cpp.

231 { return ( histo ? histo->mean() : s_bad ); }

double Gaudi::Utils::HistoStats::meanErr | ( | const AIDA::IHistogram1D * | histo | ) |
| static

get an error in the mean value

Definition at line 235 of file HistoStats.cpp.

236 {
237 if ( !histo ) {
238 return s_bad;
239 }
240 const auto n = nEff( histo );
241 return ( 0 >= n ? 0.0 : rms( histo ) / std::sqrt( n ) );
242 }
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
Gaudi::Utils::HistoStats::rms
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:246
std::sqrt
T sqrt(T...args)
Gaudi::Utils::HistoStats::nEff
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:224

double Gaudi::Utils::HistoStats::moment | ( | const AIDA::IHistogram1D * | histo,
|  | const unsigned int | order,
|  | const double | value = `0`
| ) |  |
| static

get the "bin-by-bin"-moment around the specified "value"

Parameters

  histo | histogram
  order | the moment parameter
  value | central value

Returns
  the evaluated moment

Definition at line 47 of file HistoStats.cpp.

48 {
49 if ( !histo ) {
50 return s_bad;
51 } // RETURN
52 if ( 0 == order ) {
53 return 1.0;
54 } // RETURN
55 if ( 1 == order ) {
56 return mean( histo ) - value;
57 } // RETURN
58 if ( 2 == order ) {
59 const auto _r = rms( histo );
60 const auto _d = value - mean( histo );
61 return std::pow( _r, 2 ) + std::pow( _d, 2 ); // RETURN
62 }
63 const auto n = nEff( histo );
64 if ( 0 >= n ) {
65 return 0.0;
66 } // RETURN
67
68 // get the exis
69 const auto& axis = histo->axis();
70 // number of bins
71 const auto nBins = axis.bins();
72 double result{0}, weight{0};
73 // loop over all bins
74 for ( int i = 0; i < nBins; ++i ) {
75 const auto lE = axis.binLowerEdge( i );
76 const auto uE = axis.binUpperEdge( i );
77 //
78 const auto yBin = histo->binHeight( i ); // bin weight
79 const double xBin = 0.5 * ( lE + uE ); // bin center
80 //
81 weight += yBin;
82 result += yBin * std::pow( xBin - value, order );
83 }
84 if ( 0 != weight ) {
85 result /= weight;
86 }
87 return result;
88 }
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
Gaudi::Utils::HistoStats::rms
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:246
std::pow
T pow(T...args)
Gaudi::Utils::HistoStats::mean
static double mean(const AIDA::IHistogram1D *histo)
get the mean value for the histogram (just for completeness)
Definition: HistoStats.cpp:231
Gaudi::Utils::HistoStats::nEff
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:224

double Gaudi::Utils::HistoStats::momentErr | ( | const AIDA::IHistogram1D * | histo,
|  | const unsigned int | order
| ) |  |
| static

evaluate the uncertanty for 'bin-by-bin'-moment

Parameters

  histo | histogram
  order | the moment parameter
  value | central value

Returns
  the evaluated uncertanty in the moment

Definition at line 97 of file HistoStats.cpp.

98 {
99 if ( !histo ) {
100 return s_bad;
101 } // RETURN
102 const auto n = nEff( histo );
103 if ( 0 >= n ) {
104 return 0.0;
105 } // RETURN
106 const auto a2o = moment( histo, 2 * order ); // a(2o)
107 const auto ao = moment( histo, order ); // a(o)
108 const auto result = std::max( 0.0, ( a2o - std::pow( ao, 2 ) ) / n );
109 return std::sqrt( result ); // RETURN
110 }
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:47
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
std::max
T max(T...args)
std::pow
T pow(T...args)
std::sqrt
T sqrt(T...args)
Gaudi::Utils::HistoStats::nEff
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:224

double Gaudi::Utils::HistoStats::nEff | ( | const AIDA::IHistogram1D * | histo | ) |
| static

get the effective entries (just for completeness)

Definition at line 224 of file HistoStats.cpp.

225 {
226 return ( histo ? histo->equivalentBinEntries() : s_bad );
227 }

long Gaudi::Utils::HistoStats::nEntries | ( | const AIDA::IHistogram1D * | histo,
|  | const int | imax
| ) |  |
| static

get number of entries in histogram up to the certain bin (not-included)

Attention
  underflow bin is included!

Parameters

  histo | the pointer to the histogram
  imax | the bin number (not included)
  number | of entries

Definition at line 497 of file HistoStats.cpp.

498 {
499 if ( !histo ) {
500 return s_long_bad;
501 } // RETURN
502 if ( 0 > imax ) {
503 return 0;
504 } // RETURN
505 long result = histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN );
506
507 // get the exis
508 const auto& axis = histo->axis();
509 // number of bins
510 const auto nBins = axis.bins();
511 // loop over all bins
512 for ( int i = 0; i < nBins; ++i ) {
513 if ( i < imax ) {
514 result += histo->binEntries( i );
515 }
516 }
517 //
518 if ( nBins < imax ) {
519 result += histo->binEntries( AIDA::IAxis::OVERFLOW_BIN );
520 }
521 //
522 return result;
523 }

long Gaudi::Utils::HistoStats::nEntries | ( | const AIDA::IHistogram1D * | histo,
|  | const int | imin,
|  | const int | imax
| ) |  |
| static

get number of entries in histogram form the certain minimal bin up to the certain maximal bin (not-included)

Parameters

  histo | the pointer to the histogram
  imin | the minimal bin number (included)
  imax | the maximal bin number (not included)
  number | of entries

Definition at line 533 of file HistoStats.cpp.

536 {
537 if ( !histo ) {
538 return s_long_bad;
539 } // RETURN
540 if ( imin == imax ) {
541 return 0;
542 } // RETURN
543 if ( imax < imin ) {
544 return nEntries( histo, imax, imin );
545 } // RETURN
546 //
547 long result = 0;
548 if ( 0 > imin ) {
549 result += histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN );
550 }
551 // get the exis
552 const auto& axis = histo->axis();
553 // number of bins
554 const auto nBins = axis.bins();
555 if ( nBins < imin ) {
556 return 0;
557 } // RETURN
558 // loop over all bins
559 for ( int i = 0; i < nBins; ++i ) {
560 if ( imin <= i && i < imax ) {
561 result += histo->binEntries( i );
562 }
563 }
564 //
565 if ( nBins < imax ) {
566 result += histo->binEntries( AIDA::IAxis::OVERFLOW_BIN );
567 }
568 //
569 return result; // RETURN
570 }
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:497

double Gaudi::Utils::HistoStats::nEntriesFrac | ( | const AIDA::IHistogram1D * | histo,
|  | const int | imax
| ) |  |
| static

get the fraction of entries in histogram up to the certain bin (not-included)

Attention
  underflow bin is included!

Parameters

  histo | the pointer to the histogram
  imax | the bin number (not included)
  fraction | of entries

Definition at line 580 of file HistoStats.cpp.

581 {
582 if ( !histo ) {
583 return s_bad;
584 } // RETURN
585 //
586 const auto N = histo->allEntries();
587 if ( 0 >= N ) {
588 return s_bad;
589 } // RETURN
590 const auto n = nEntries( histo, imax );
591 if ( 0 > n ) {
592 return s_bad;
593 } // RETURN
594 if ( n > N ) {
595 return s_bad;
596 } // RETURN
597 //
598 return (double)n / (double)N; // REUTRN
599 }
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:497
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
IOTest.N
int N
Definition: IOTest.py:101

double Gaudi::Utils::HistoStats::nEntriesFrac | ( | const AIDA::IHistogram1D * | histo,
|  | const int | imin,
|  | const int | imax
| ) |  |
| static

get fraction of entries in histogram form the certain minimal bin up to the certain maximal bin (not-included)

Parameters

  histo | the pointer to the histogram
  imin | the minimal bin number (included)
  imax | the maximal bin number (not included)
  fraction | of entries

Definition at line 609 of file HistoStats.cpp.

612 {
613 if ( !histo ) {
614 return s_bad;
615 } // RETURN
616 const auto N = histo->allEntries();
617 if ( 0 >= N ) {
618 return s_bad;
619 } // RETURN
620 const auto n = nEntries( histo, imin, imax );
621 if ( 0 > n ) {
622 return s_bad;
623 } // RETURN
624 if ( n > N ) {
625 return s_bad;
626 } // RETURN
627 //
628 return (double)n / (double)N; // REUTRN
629 }
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:497
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
IOTest.N
int N
Definition: IOTest.py:101

double Gaudi::Utils::HistoStats::nEntriesFracErr | ( | const AIDA::IHistogram1D * | histo,
|  | const int | imax
| ) |  |
| static

get the (binominal) error for the fraction of entries in histogram up to the certain bin (not-included)

Attention
  underflow bin is included!

Parameters

  histo | the pointer to the histogram
  imax | the bin number (not included)
  error | for the fraction of entries

Definition at line 639 of file HistoStats.cpp.

640 {
641 if ( !histo ) {
642 return s_bad;
643 } // RETURN
644 //
645 const auto N = histo->allEntries();
646 if ( 0 >= N ) {
647 return s_bad;
648 } // RETURN
649 const auto n = nEntries( histo, imax );
650 if ( 0 > n ) {
651 return s_bad;
652 } // RETURN
653 if ( n > N ) {
654 return s_bad;
655 } // RETURN
656 //
657 const double _n1 = std::max( (double)n, 1.0 );
658 const double _n2 = std::max( (double)( N - n ), 1.0 );
659 //
660 return std::sqrt( _n1 * ( _n2 / N ) ) / N; // RETURN
661 }
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:497
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
IOTest.N
int N
Definition: IOTest.py:101
std::max
T max(T...args)
std::sqrt
T sqrt(T...args)

double Gaudi::Utils::HistoStats::nEntriesFracErr | ( | const AIDA::IHistogram1D * | histo,
|  | const int | imin,
|  | const int | imax
| ) |  |
| static

get the (binomial) error for the fraction of entries in histogram from the certain minimal bin up to the certain maximal bin (not-included)

Parameters

  histo | the pointer to the histogram
  imin | the minimal bin number (included)
  imax | the maximal bin number (not included)
  error | for the fraction of entries

Definition at line 671 of file HistoStats.cpp.

674 {
675 if ( !histo ) {
676 return s_bad;
677 } // RETURN
678 //
679 const auto N = histo->allEntries();
680 if ( 0 >= N ) {
681 return s_bad;
682 } // RETURN
683 const auto n = nEntries( histo, imin, imax );
684 if ( 0 > n ) {
685 return s_bad;
686 } // RETURN
687 if ( n > N ) {
688 return s_bad;
689 } // RETURN
690 //
691 const double _n1 = std::max( (double)n, 1.0 );
692 const double _n2 = std::max( (double)( N - n ), 1.0 );
693 //
694 return std::sqrt( _n1 * ( _n2 / N ) ) / N; // RETURN
695 }
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:497
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
IOTest.N
int N
Definition: IOTest.py:101
std::max
T max(T...args)
std::sqrt
T sqrt(T...args)

double Gaudi::Utils::HistoStats::overflowEntriesFrac | ( | const AIDA::IHistogram1D * | histo | ) |
| static

the fraction of overflow entries (useful for shape comparison)

Definition at line 307 of file HistoStats.cpp.

308 {
309 if ( !histo ) {
310 return s_bad;
311 } // REUTRN
312 const auto overflow = histo->binEntries( AIDA::IAxis::OVERFLOW_BIN );
313 if ( 0 == overflow ) {
314 return 0;
315 } // REUTRN
316 const auto all = histo->allEntries();
317 if ( 0 == all ) {
318 return 0;
319 } // "CONVENTION?" RETURN
320 if ( 0 > all ) {
321 return s_bad;
322 } // Lets be a bit paranoic, RETURN
323 //
324 return (double)overflow / (double)all;
325 }

double Gaudi::Utils::HistoStats::overflowEntriesFracErr | ( | const AIDA::IHistogram1D * | histo | ) |
| static

error on fraction of overflow entries (useful for shape comparison)

Definition at line 389 of file HistoStats.cpp.

390 {
391 if ( !histo ) {
392 return s_bad;
393 } // RETURN
394 //
395 const auto overflow = histo->binEntries( AIDA::IAxis::OVERFLOW_BIN );
396 const auto all = histo->allEntries();
397 //
398 if ( 0 > overflow || 0 >= all || overflow > all ) {
399 return s_bad;
400 }
401 //
402 const double n = std::max( (double)overflow, 1.0 );
403 const double N = all;
404 const double n1 = std::max( N - n, 1.0 );
405 //
406 return std::sqrt( n * ( n1 / N ) ) / N; // use the binomial formula
407 }
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
IOTest.N
int N
Definition: IOTest.py:101
std::max
T max(T...args)
std::sqrt
T sqrt(T...args)

double Gaudi::Utils::HistoStats::overflowIntegralFrac | ( | const AIDA::IHistogram1D * | histo | ) |
| static

the fraction of overflow intergal (useful for shape comparison)

Definition at line 351 of file HistoStats.cpp.

352 {
353 if ( !histo ) {
354 return s_bad;
355 } // REUTRN
356 const auto overflow = histo->binHeight( AIDA::IAxis::OVERFLOW_BIN );
357 if ( 0 == overflow ) {
358 return 0;
359 } // REUTRN
360 const auto all = histo->sumAllBinHeights();
361 if ( 0 == all ) {
362 return 0;
363 } // "CONVENTION?" RETURN
364 //
365 return (double)overflow / (double)all;
366 }

double Gaudi::Utils::HistoStats::overflowIntegralFracErr | ( | const AIDA::IHistogram1D * | histo | ) |
| static

the error on fraction of overflow intergal

Definition at line 433 of file HistoStats.cpp.

434 {
435 if ( !histo ) {
436 return s_bad;
437 } // RETURN
438 //
439 const auto all = histo->sumAllBinHeights();
440 if ( 0 == all ) {
441 return s_bad;
442 } // RETURN
443 const auto overflow = histo->binHeight( AIDA::IAxis::OVERFLOW_BIN );
444 const auto oErr = histo->binError( AIDA::IAxis::OVERFLOW_BIN );
445 if ( 0 > oErr ) {
446 return s_bad;
447 } // RETURN
448 const auto aErr = sumAllBinHeightErr( histo );
449 if ( 0 > aErr ) {
450 return s_bad;
451 } // RETURN
452 //
453 double error2 = std::pow( (double)oErr, 2 );
454 error2 += ( std::pow( (double)aErr, 2 ) * std::pow( (double)overflow, 2 ) / std::pow( (double)all, 2 ) );
455 error2 /= std::pow( (double)all, 2 );
456 //
457 return std::sqrt( error2 );
458 }
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:288
std::pow
T pow(T...args)
std::sqrt
T sqrt(T...args)

double Gaudi::Utils::HistoStats::rms | ( | const AIDA::IHistogram1D * | histo | ) |
| static

get the rms value for the histogram (just for completeness)

Definition at line 246 of file HistoStats.cpp.

246 { return ( histo ? histo->rms() : s_bad ); }

double Gaudi::Utils::HistoStats::rmsErr | ( | const AIDA::IHistogram1D * | histo | ) |
| static

get an error in the rms value

Definition at line 250 of file HistoStats.cpp.

251 {
252 if ( !histo ) {
253 return s_bad;
254 }
255 const auto n = nEff( histo );
256 if ( 1 >= n ) {
257 return 0.0;
258 }
259 auto result = 2.0 + kurtosis( histo );
260 result += 2.0 / ( n - 1 );
261 result /= 4.0 * n;
262 return histo->rms() * std::sqrt( std::max( result, 0.0 ) );
263 }
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
std::max
T max(T...args)
std::sqrt
T sqrt(T...args)
Gaudi::Utils::HistoStats::kurtosis
static double kurtosis(const AIDA::IHistogram1D *histo)
get the kurtosis for the histogram
Definition: HistoStats.cpp:194
Gaudi::Utils::HistoStats::nEff
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:224

double Gaudi::Utils::HistoStats::skewness | ( | const AIDA::IHistogram1D * | histo | ) |
| static

get the skewness for the histogram

Definition at line 167 of file HistoStats.cpp.

168 {
169 if ( !histo ) {
170 return s_bad;
171 } // RETURN
172 const auto mu3 = centralMoment( histo, 3 );
173 const auto s3 = std::pow( rms( histo ), 3 );
174 return ( std::fabs( s3 ) > 0 ? mu3 / s3 : 0.0 );
175 }
Gaudi::Utils::HistoStats::centralMoment
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:119
Gaudi::Utils::HistoStats::rms
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:246
std::fabs
T fabs(T...args)
std::pow
T pow(T...args)

double Gaudi::Utils::HistoStats::skewnessErr | ( | const AIDA::IHistogram1D * | histo | ) |
| static

get the error in skewness for the histogram

Definition at line 179 of file HistoStats.cpp.

180 {
181 if ( !histo ) {
182 return s_bad;
183 } // RETURN
184 const auto n = nEff( histo );
185 if ( 2 > n ) {
186 return 0.0;
187 } // RETURN
188 const auto result = 6.0 * ( n - 2 ) / ( ( n + 1 ) * ( n + 3 ) );
189 return std::sqrt( result );
190 }
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
std::sqrt
T sqrt(T...args)
Gaudi::Utils::HistoStats::nEff
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:224

double Gaudi::Utils::HistoStats::sumAllBinHeightErr | ( | const AIDA::IHistogram1D * | histo | ) |
| static

get an error in the sum of all bin height ("integral")

Definition at line 288 of file HistoStats.cpp.

289 {
290 if ( !histo ) {
291 return s_bad;
292 }
293 //
294 const auto error = sumBinHeightErr( histo );
295 if ( 0 > error ) {
296 return s_bad;
297 }
299 const auto err1 = histo->binError( AIDA::IAxis::UNDERFLOW_BIN );
300 const auto err2 = histo->binError( AIDA::IAxis::OVERFLOW_BIN );
301 //
302 return std::sqrt( std::pow( error, 2 ) + std::pow( err1, 2 ) + std::pow( err2, 2 ) );
303 }
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:267
std::pow
T pow(T...args)
std::sqrt
T sqrt(T...args)

double Gaudi::Utils::HistoStats::sumBinHeightErr | ( | const AIDA::IHistogram1D * | histo | ) |
| static

get an error in the sum bin height ("in-range integral")

Definition at line 267 of file HistoStats.cpp.

268 {
269 if ( !histo ) {
270 return s_bad;
271 }
272 //
273 double error2 = 0;
274 // get the exis
275 const auto& axis = histo->axis();
276 // number of bins
277 const auto nBins = axis.bins();
278 // loop over all bins
279 for ( int i = 0; i < nBins; ++i ) {
280 // accumulate the errors in each bin
281 error2 += std::pow( histo->binError( i ), 2 );
282 }
283 return std::sqrt( error2 );
284 }
std::pow
T pow(T...args)
std::sqrt
T sqrt(T...args)

double Gaudi::Utils::HistoStats::underflowEntriesFrac | ( | const AIDA::IHistogram1D * | histo | ) |
| static

the fraction of underflow entries (useful for shape comparison)

Definition at line 329 of file HistoStats.cpp.

330 {
331 if ( !histo ) {
332 return s_bad;
333 } // REUTRN
334 const auto underflow = histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN );
335 if ( 0 == underflow ) {
336 return 0;
337 } // REUTRN
338 const auto all = histo->allEntries();
339 if ( 0 == all ) {
340 return 0;
341 } // "CONVENTION?" RETURN
342 if ( 0 > all ) {
343 return s_bad;
344 } // Lets be a bit paranoic, RETURN
345 //
346 return (double)underflow / (double)all;
347 }

double Gaudi::Utils::HistoStats::underflowEntriesFracErr | ( | const AIDA::IHistogram1D * | histo | ) |
| static

the error on fraction of underflow entries (useful for shape comparison)

Definition at line 411 of file HistoStats.cpp.

412 {
413 if ( !histo ) {
414 return s_bad;
415 } // RETURN
416 //
417 const auto underflow = histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN );
418 const auto all = histo->allEntries();
419 //
420 if ( 0 > underflow || 0 >= all || underflow > all ) {
421 return s_bad;
422 }
423 //
424 const double n = std::max( (double)underflow, 1.0 );
425 const double N = all;
426 const double n1 = std::max( N - n, 1.0 );
427 //
428 return std::sqrt( n * ( n1 / N ) ) / N; // use the binomial formula
429 }
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
IOTest.N
int N
Definition: IOTest.py:101
std::max
T max(T...args)
std::sqrt
T sqrt(T...args)

double Gaudi::Utils::HistoStats::underflowIntegralFrac | ( | const AIDA::IHistogram1D * | histo | ) |
| static

the fraction of underflow integral (useful for shape comparison)

Definition at line 370 of file HistoStats.cpp.

371 {
372 if ( !histo ) {
373 return s_bad;
374 } // REUTRN
375 const auto underflow = histo->binHeight( AIDA::IAxis::UNDERFLOW_BIN );
376 if ( 0 == underflow ) {
377 return 0;
378 } // REUTRN
379 const auto all = histo->sumAllBinHeights();
380 if ( 0 == all ) {
381 return 0;
382 } // "CONVENTION?" RETURN
383 //
384 return (double)underflow / (double)all;
385 }

double Gaudi::Utils::HistoStats::underflowIntegralFracErr | ( | const AIDA::IHistogram1D * | histo | ) |
| static

the error on fraction of underflow integral

Definition at line 462 of file HistoStats.cpp.

463 {
464 if ( !histo ) {
465 return s_bad;
466 } // RETURN
467 //
468 const auto all = histo->sumAllBinHeights();
469 if ( 0 == all ) {
470 return s_bad;
471 } // RETURN
472 const auto underflow = histo->binHeight( AIDA::IAxis::UNDERFLOW_BIN );
473 const auto oErr = histo->binError( AIDA::IAxis::UNDERFLOW_BIN );
474 if ( 0 > oErr ) {
475 return s_bad;
476 } // RETURN
477 const auto aErr = sumAllBinHeightErr( histo );
478 if ( 0 > aErr ) {
479 return s_bad;
480 } // RETURN
481 //
482 double error2 = std::pow( (double)oErr, 2 );
483 error2 += ( std::pow( (double)aErr, 2 ) * std::pow( (double)underflow, 2 ) / std::pow( (double)all, 2 ) );
484 error2 /= std::pow( (double)all, 2 );
485 //
486 return std::sqrt( error2 );
487 }
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:288
std::pow
T pow(T...args)
std::sqrt
T sqrt(T...args)

The documentation for this class was generated from the following files:

- GaudiUtils/GaudiUtils/HistoStats.h
- GaudiUtils/src/Lib/HistoStats.cpp