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 29 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
histohistogram
orderthe moment parameter
valuecentral value
Returns
the evaluated central moment

Definition at line 118 of file HistoStats.cpp.

120 {
121  if ( 0 == histo ) { return s_bad ; } // RETURN
122  if ( 0 == order ) { return 1.0 ; } // RETURN
123  if ( 1 == order ) { return 0.0 ; } // RETURN
124  if ( 2 == order )
125  {
126  const double sigma = histo->rms() ;
127  return sigma * sigma ; // RETURN
128  }
129  // delegate the actual evaluation to another method:
130  return moment ( histo , order , mean ( histo ) ) ;
131 }
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:48
static double mean(const AIDA::IHistogram1D *histo)
get the mean value for the histogram (just for completeness)
Definition: HistoStats.cpp:226
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
histohistogram
orderthe moment parameter
valuecentral value
Returns
the evaluated uncertanty in the central moment

Definition at line 143 of file HistoStats.cpp.

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

get the kurtosis for the histogram

Definition at line 191 of file HistoStats.cpp.

192 {
193  if ( 0 == histo ) { return s_bad ; } // RETURN
194  const double mu4 = centralMoment ( histo , 4 ) ;
195  const double s4 = std::pow ( rms ( histo ) , 4 ) ;
196  return ( std::fabs(s4)>0 ? mu4/s4 - 3.0 : 0.0 );
197 }
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:118
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:245
T fabs(T...args)
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 202 of file HistoStats.cpp.

203 {
204  if ( 0 == histo ) { return s_bad ; } // RETURN
205  const double n = nEff ( histo ) ;
206  if ( 3 > n ) { return 0.0 ; } // RETURN
207  double result = 24 * n ;
208  result *= ( n - 2 ) * ( n - 3 ) ;
209  result /= ( n + 1 ) * ( n + 1 ) ;
210  result /= ( n + 3 ) * ( n + 5 ) ;
211  return std::sqrt ( result ) ;
212 }
T sqrt(T...args)
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:217
double Gaudi::Utils::HistoStats::mean ( const AIDA::IHistogram1D *  histo)
static

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

Definition at line 226 of file HistoStats.cpp.

227 {
228  if ( 0 == histo ) { return s_bad ; }
229  return histo -> mean() ;
230 }
static double mean(const AIDA::IHistogram1D *histo)
get the mean value for the histogram (just for completeness)
Definition: HistoStats.cpp:226
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 ( 0 == histo ) { return s_bad ; }
238  const double n = nEff ( histo ) ;
239  return 0 >= n ? 0.0 : rms ( histo ) / std::sqrt ( n ) ;
240 }
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:245
T sqrt(T...args)
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:217
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
histohistogram
orderthe moment parameter
valuecentral value
Returns
the evaluated moment

Definition at line 48 of file HistoStats.cpp.

51 {
52  if ( 0 == histo ) { return s_bad ; } // RETURN
53  if ( 0 == order ) { return 1.0 ; } // RETURN
54  if ( 1 == order ) { return mean( histo ) - value ; } // RETURN
55  if ( 2 == order )
56  {
57  const double _r = rms ( histo ) ;
58  const double _d = value - mean ( histo ) ;
59  return _r *_r + _d * _d ; // RETURN
60  }
61  const double n = nEff ( histo ) ;
62  if ( 0 >= n ) { return 0.0 ; } // RETURN
63 
64  const int _order = (int) order ;
65 
66  // get the exis
67  const AIDA::IAxis& axis = histo -> axis () ;
68  // number of bins
69  const int nBins = axis.bins() ;
70  double result = 0 ;
71  double weight = 0 ;
72  // loop over all bins
73  for ( int i = 0 ; i < nBins ; ++i )
74  {
75  const double lE = axis . binLowerEdge ( i ) ;
76  const double uE = axis . binUpperEdge ( i ) ;
77  //
78  const double 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 ) { result /= weight ; }
85  return result ;
86 }
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:245
T pow(T...args)
static double mean(const AIDA::IHistogram1D *histo)
get the mean value for the histogram (just for completeness)
Definition: HistoStats.cpp:226
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:217
double Gaudi::Utils::HistoStats::momentErr ( const AIDA::IHistogram1D *  histo,
const unsigned int  order 
)
static

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

Parameters
histohistogram
orderthe moment parameter
valuecentral value
Returns
the evaluated uncertanty in the moment

Definition at line 96 of file HistoStats.cpp.

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

get the effective entries (just for completeness)

Definition at line 217 of file HistoStats.cpp.

218 {
219  if ( 0 == histo ) { return s_bad ; }
220  return histo -> equivalentBinEntries () ;
221 }
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
histothe pointer to the histogram
imaxthe bin number (not included)
numberof entries

Definition at line 460 of file HistoStats.cpp.

462 {
463  if ( 0 == histo ) { return s_long_bad ; } // RETURN
464  if ( 0 > imax ) { return 0 ; } // RETURN
465  long result = histo -> binEntries( AIDA::IAxis::UNDERFLOW_BIN ) ;
466 
467  // get the exis
468  const AIDA::IAxis& axis = histo -> axis () ;
469  // number of bins
470  const int nBins = axis.bins() ;
471  // loop over all bins
472  for ( int i = 0 ; i < nBins ; ++i )
473  { if ( i < imax ) { result += histo->binEntries ( i ) ; } }
474  //
475  if ( nBins < imax )
476  { result += histo -> binEntries( AIDA::IAxis::OVERFLOW_BIN ) ; }
477  //
478  return result ;
479 }
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
histothe pointer to the histogram
iminthe minimal bin number (included)
imaxthe maximal bin number (not included)
numberof entries

Definition at line 490 of file HistoStats.cpp.

493 {
494  if ( 0 == histo ) { return s_long_bad ; } // RETURN
495  if ( imin == imax ) { return 0 ; } // RETURN
496  if ( imax < imin ) { return nEntries ( histo , imax ,imin ) ; } // RETURN
497  //
498  long result = 0 ;
499  if ( 0 > imin )
500  { result += histo -> binEntries( AIDA::IAxis::UNDERFLOW_BIN ) ; }
501  // get the exis
502  const AIDA::IAxis& axis = histo -> axis () ;
503  // number of bins
504  const int nBins = axis.bins() ;
505  if ( nBins < imin ) { return 0 ; } // RETURN
506  // loop over all bins
507  for ( int i = 0 ; i < nBins ; ++i )
508  { if ( imin <= i && i < imax ) { result += histo->binEntries ( i ) ; } }
509  //
510  if ( nBins < imax )
511  { result += histo -> binEntries( AIDA::IAxis::OVERFLOW_BIN ) ; }
512  //
513  return result ; // RETURN
514 }
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:460
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
histothe pointer to the histogram
imaxthe bin number (not included)
fractionof entries

Definition at line 525 of file HistoStats.cpp.

527 {
528  if ( 0 == histo ) { return s_bad ; } // RETURN
529  //
530  const double N = histo->allEntries () ;
531  if ( 0 >= N ) { return s_bad ; } // RETURN
532  const long n = nEntries ( histo , imax ) ;
533  if ( 0 > n ) { return s_bad ; } // RETURN
534  if ( n > N ) { return s_bad ; } // RETURN
535  //
536  return n / N ; // REUTRN
537 }
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:460
int N
Definition: IOTest.py:90
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
histothe pointer to the histogram
iminthe minimal bin number (included)
imaxthe maximal bin number (not included)
fractionof entries

Definition at line 548 of file HistoStats.cpp.

551 {
552  if ( 0 == histo ) { return s_bad ; } // RETURN
553  const double N = histo->allEntries () ;
554  if ( 0 >= N ) { return s_bad ; } // RETURN
555  const long n = nEntries ( histo , imin , imax ) ;
556  if ( 0 > n ) { return s_bad ; } // RETURN
557  if ( n > N ) { return s_bad ; } // RETURN
558  //
559  return n / N ; // REUTRN
560 }
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:460
int N
Definition: IOTest.py:90
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
histothe pointer to the histogram
imaxthe bin number (not included)
errorfor the fraction of entries

Definition at line 571 of file HistoStats.cpp.

573 {
574  if ( 0 == histo ) { return s_bad ; } // RETURN
575  //
576  const double N = histo->allEntries () ;
577  if ( 0 >= N ) { return s_bad ; } // RETURN
578  const long n = nEntries ( histo , imax ) ;
579  if ( 0 > n ) { return s_bad ; } // RETURN
580  if ( n > N ) { return s_bad ; } // RETURN
581  //
582  const double _n1 = std::max ( (double) n , 1.0 ) ;
583  const double _n2 = std::max ( ( N - n ) , 1.0 ) ;
584  //
585  return std::sqrt ( _n1 * _n2 / N ) / N ; // RETURN
586 }
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:460
int N
Definition: IOTest.py:90
T max(T...args)
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
histothe pointer to the histogram
iminthe minimal bin number (included)
imaxthe maximal bin number (not included)
errorfor the fraction of entries

Definition at line 597 of file HistoStats.cpp.

600 {
601  if ( 0 == histo ) { return s_bad ; } // RETURN
602  //
603  const double N = histo->allEntries () ;
604  if ( 0 >= N ) { return s_bad ; } // RETURN
605  const long n = nEntries ( histo , imin , imax ) ;
606  if ( 0 > n ) { return s_bad ; } // RETURN
607  if ( n > N ) { return s_bad ; } // RETURN
608  //
609  const double _n1 = std::max ( (double) n , 1.0 ) ;
610  const double _n2 = std::max ( ( N - n ) , 1.0 ) ;
611  //
612  return std::sqrt ( _n1 * _n2 / N ) / N ; // RETURN
613 }
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:460
int N
Definition: IOTest.py:90
T max(T...args)
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 308 of file HistoStats.cpp.

309 {
310  if ( 0 == histo ) { return s_bad ; } // REUTRN
311  const long overflow = histo -> binEntries ( AIDA::IAxis::OVERFLOW_BIN ) ;
312  if ( 0 == overflow ) { return 0 ; } // REUTRN
313  const long all = histo->allEntries() ;
314  if ( 0 == all ) { return 0 ; } // "CONVENTION?" RETURN
315  if ( 0 > all ) { return s_bad ; } // Lets be a bit paranoic, RETURN
316  //
317  double _tmp = (double) overflow ;
318  _tmp /= all ;
319  //
320  return _tmp ;
321 }
double Gaudi::Utils::HistoStats::overflowEntriesFracErr ( const AIDA::IHistogram1D *  histo)
static

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

Definition at line 372 of file HistoStats.cpp.

373 {
374  if ( 0 == histo ) { return s_bad ; } // RETURN
375  //
376  const double overflow = histo -> binEntries ( AIDA::IAxis::OVERFLOW_BIN );
377  const double all = histo -> allEntries () ;
378  //
379  if ( 0 > overflow || 0 >= all || overflow > all ) { return s_bad ; }
380  //
381  const double n = std::max ( overflow , 1.0 ) ;
382  const double N = all ;
383  const double n1 = std::max ( N - n , 1.0 ) ;
384  //
385  return std::sqrt ( n * n1 / N ) / N ; // use the binomial formula
386 }
int N
Definition: IOTest.py:90
T max(T...args)
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 344 of file HistoStats.cpp.

345 {
346  if ( 0 == histo ) { return s_bad ; } // REUTRN
347  const double overflow = histo -> binHeight ( AIDA::IAxis::OVERFLOW_BIN ) ;
348  if ( 0 == overflow ) { return 0 ; } // REUTRN
349  const double all = histo -> sumAllBinHeights() ;
350  if ( 0 == all ) { return 0 ; } // "CONVENTION?" RETURN
351  //
352  return overflow / all ;
353 }
double Gaudi::Utils::HistoStats::overflowIntegralFracErr ( const AIDA::IHistogram1D *  histo)
static

the error on fraction of overflow intergal

Definition at line 410 of file HistoStats.cpp.

411 {
412  if ( 0 == histo ) { return s_bad ; } // RETURN
413  //
414  const double all = histo -> sumAllBinHeights () ;
415  if ( 0 == all ) { return s_bad ; } // RETURN
416  const double overflow = histo -> binHeight ( AIDA::IAxis::OVERFLOW_BIN ) ;
417  const double oErr = histo -> binError ( AIDA::IAxis::OVERFLOW_BIN ) ;
418  if ( 0 > oErr ) { return s_bad ; } // RETURN
419  const double aErr = sumAllBinHeightErr ( histo ) ;
420  if ( 0 > aErr ) { return s_bad ; } // RETURN
421  //
422  double error2 = oErr * oErr ;
423  error2 += aErr * aErr * overflow * overflow / all / all ;
424  error2 /= all * all ;
425 
426  return std::sqrt ( error2 ) ;
427 }
static double sumAllBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum of all bin height ("integral")
Definition: HistoStats.cpp:292
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 245 of file HistoStats.cpp.

246 {
247  if ( 0 == histo ) { return s_bad ; }
248  return histo -> rms () ;
249 }
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:245
double Gaudi::Utils::HistoStats::rmsErr ( const AIDA::IHistogram1D *  histo)
static

get an error in the rms value

Definition at line 254 of file HistoStats.cpp.

255 {
256  if ( 0 == histo ) { return s_bad ; }
257  const double n = nEff ( histo ) ;
258  if ( 1 >= n ) { return 0.0 ; }
259  double result = 2 + kurtosis ( histo ) ;
260  result += 2.0 /( n - 1 ) ;
261  result /= 4.0 * n ;
262  result = std::max ( result , 0.0 ) ;
263  return histo -> rms() * std::sqrt ( result ) ;
264 }
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:245
T max(T...args)
T sqrt(T...args)
static double kurtosis(const AIDA::IHistogram1D *histo)
get the kurtosis for the histogram
Definition: HistoStats.cpp:191
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:217
double Gaudi::Utils::HistoStats::skewness ( const AIDA::IHistogram1D *  histo)
static

get the skewness for the histogram

Definition at line 166 of file HistoStats.cpp.

167 {
168  if ( 0 == histo ) { return s_bad ; } // RETURN
169  const double mu3 = centralMoment ( histo , 3 ) ;
170  const double s3 = std::pow ( rms ( histo ) , 3 ) ;
171  return ( std::fabs(s3)>0 ? mu3/s3 : 0.0 );
172 }
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:118
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:245
T fabs(T...args)
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 177 of file HistoStats.cpp.

178 {
179  if ( 0 == histo ) { return s_bad ; } // RETURN
180  const double n = nEff ( histo ) ;
181  if ( 2 > n ) { return 0.0 ; } // RETURN
182  double result = 6 ;
183  result *= ( n - 2 ) ;
184  result /= ( n + 1 ) * ( n + 3 ) ;
185  return std::sqrt ( result ) ;
186 }
T sqrt(T...args)
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:217
double Gaudi::Utils::HistoStats::sumAllBinHeightErr ( const AIDA::IHistogram1D *  histo)
static

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

Definition at line 292 of file HistoStats.cpp.

293 {
294  if ( 0 == histo ) { return s_bad ; }
295  //
296  const double error = sumBinHeightErr( histo ) ;
297  if ( 0 > error ) { return s_bad ; }
299  const double err1 = histo->binError ( AIDA::IAxis::UNDERFLOW_BIN ) ;
300  const double err2 = histo->binError ( AIDA::IAxis::OVERFLOW_BIN ) ;
301  //
302  return std::sqrt ( error * error + err1 * err1 + err2 * err2 ) ;
303 }
static double sumBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum bin height ("in-range integral")
Definition: HistoStats.cpp:269
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 269 of file HistoStats.cpp.

270 {
271  if ( 0 == histo ) { return s_bad ; }
272  //
273  double error2 = 0 ;
274  // get the exis
275  const AIDA::IAxis& axis = histo -> axis () ;
276  // number of bins
277  const int nBins = axis.bins() ;
278  // loop over all bins
279  for ( int i = 0 ; i < nBins ; ++i )
280  {
281  // get the error in each bin
282  const double berr = histo->binError ( i ) ;
283  // accumulate the errors:
284  error2 += berr * berr ;
285  }
286  return std::sqrt ( error2 ) ;
287 }
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 326 of file HistoStats.cpp.

327 {
328  if ( 0 == histo ) { return s_bad ; } // REUTRN
329  const long underflow = histo -> binEntries ( AIDA::IAxis::UNDERFLOW_BIN ) ;
330  if ( 0 == underflow ) { return 0 ; } // REUTRN
331  const long all = histo->allEntries() ;
332  if ( 0 == all ) { return 0 ; } // "CONVENTION?" RETURN
333  if ( 0 > all ) { return s_bad ; } // Lets be a bit paranoic, RETURN
334  //
335  double _tmp = (double) underflow ;
336  _tmp /= all ;
337  //
338  return _tmp ;
339 }
double Gaudi::Utils::HistoStats::underflowEntriesFracErr ( const AIDA::IHistogram1D *  histo)
static

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

Definition at line 391 of file HistoStats.cpp.

392 {
393  if ( 0 == histo ) { return s_bad ; } // RETURN
394  //
395  const double underflow = histo -> binEntries ( AIDA::IAxis::UNDERFLOW_BIN );
396  const double all = histo -> allEntries () ;
397  //
398  if ( 0 > underflow || 0 >= all || underflow > all ) { return s_bad ; }
399  //
400  const double n = std::max ( underflow , 1.0 ) ;
401  const double N = all ;
402  const double n1 = std::max ( N - n , 1.0 ) ;
403  //
404  return std::sqrt ( n * n1 / N ) / N ; // use the binomial formula
405 }
int N
Definition: IOTest.py:90
T max(T...args)
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 358 of file HistoStats.cpp.

359 {
360  if ( 0 == histo ) { return s_bad ; } // REUTRN
361  const double underflow = histo -> binHeight ( AIDA::IAxis::UNDERFLOW_BIN ) ;
362  if ( 0 == underflow ) { return 0 ; } // REUTRN
363  const double all = histo -> sumAllBinHeights() ;
364  if ( 0 == all ) { return 0 ; } // "CONVENTION?" RETURN
365  //
366  return underflow / all ;
367 }
double Gaudi::Utils::HistoStats::underflowIntegralFracErr ( const AIDA::IHistogram1D *  histo)
static

the error on fraction of underflow integral

Definition at line 432 of file HistoStats.cpp.

433 {
434  if ( 0 == histo ) { return s_bad ; } // RETURN
435  //
436  const double all = histo -> sumAllBinHeights () ;
437  if ( 0 == all ) { return s_bad ; } // RETURN
438  const double underflow = histo -> binHeight ( AIDA::IAxis::UNDERFLOW_BIN ) ;
439  const double oErr = histo -> binError ( AIDA::IAxis::UNDERFLOW_BIN ) ;
440  if ( 0 > oErr ) { return s_bad ; } // RETURN
441  const double aErr = sumAllBinHeightErr ( histo ) ;
442  if ( 0 > aErr ) { return s_bad ; } // RETURN
443  //
444  double error2 = oErr * oErr ;
445  error2 += aErr * aErr * underflow * underflow / all / all ;
446  error2 /= all * all ;
447  //
448  return std::sqrt ( error2 ) ;
449 }
static double sumAllBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum of all bin height ("integral")
Definition: HistoStats.cpp:292
T sqrt(T...args)

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