All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 31 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 119 of file HistoStats.cpp.

121 {
122  if ( 0 == histo ) { return s_bad ; } // RETURN
123  if ( 0 == order ) { return 1.0 ; } // RETURN
124  if ( 1 == order ) { return 0.0 ; } // RETURN
125  if ( 2 == order )
126  {
127  const double sigma = histo->rms() ;
128  return sigma * sigma ; // RETURN
129  }
130  // delegate the actual evaluation to another method:
131  return moment ( histo , order , mean ( histo ) ) ;
132 }
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:49
static double mean(const AIDA::IHistogram1D *histo)
get the mean value for the histogram (just for completeness)
Definition: HistoStats.cpp:227
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 144 of file HistoStats.cpp.

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

get the kurtosis for the histogram

Definition at line 192 of file HistoStats.cpp.

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

get the error in kurtosis for the histogram

Definition at line 203 of file HistoStats.cpp.

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

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

Definition at line 227 of file HistoStats.cpp.

228 {
229  if ( 0 == histo ) { return s_bad ; }
230  return histo -> mean() ;
231 }
static double mean(const AIDA::IHistogram1D *histo)
get the mean value for the histogram (just for completeness)
Definition: HistoStats.cpp:227
double Gaudi::Utils::HistoStats::meanErr ( const AIDA::IHistogram1D *  histo)
static

get an error in the mean value

Definition at line 236 of file HistoStats.cpp.

237 {
238  if ( 0 == histo ) { return s_bad ; }
239  const double n = nEff ( histo ) ;
240  return 0 >= n ? 0.0 : rms ( histo ) / std::sqrt ( n ) ;
241 }
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:246
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:218
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 49 of file HistoStats.cpp.

52 {
53  if ( 0 == histo ) { return s_bad ; } // RETURN
54  if ( 0 == order ) { return 1.0 ; } // RETURN
55  if ( 1 == order ) { return mean( histo ) - value ; } // RETURN
56  if ( 2 == order )
57  {
58  const double _r = rms ( histo ) ;
59  const double _d = value - mean ( histo ) ;
60  return _r *_r + _d * _d ; // RETURN
61  }
62  const double n = nEff ( histo ) ;
63  if ( 0 >= n ) { return 0.0 ; } // RETURN
64 
65  const int _order = (int) order ;
66 
67  // get the exis
68  const AIDA::IAxis& axis = histo -> axis () ;
69  // number of bins
70  const int nBins = axis.bins() ;
71  double result = 0 ;
72  double weight = 0 ;
73  // loop over all bins
74  for ( int i = 0 ; i < nBins ; ++i )
75  {
76  const double lE = axis . binLowerEdge ( i ) ;
77  const double uE = axis . binUpperEdge ( i ) ;
78  //
79  const double yBin = histo -> binHeight ( i ) ; // bin weight
80  const double xBin = 0.5 * ( lE + uE ) ; // bin center
81  //
82  weight += yBin ;
83  result += yBin * std::pow ( xBin - value , _order ) ;
84  }
85  if ( 0 != weight ) { result /= weight ; }
86  return result ;
87 }
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:246
static double mean(const AIDA::IHistogram1D *histo)
get the mean value for the histogram (just for completeness)
Definition: HistoStats.cpp:227
list i
Definition: ana.py:128
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:218
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 97 of file HistoStats.cpp.

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

get the effective entries (just for completeness)

Definition at line 218 of file HistoStats.cpp.

219 {
220  if ( 0 == histo ) { return s_bad ; }
221  return histo -> equivalentBinEntries () ;
222 }
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 461 of file HistoStats.cpp.

463 {
464  if ( 0 == histo ) { return s_long_bad ; } // RETURN
465  if ( 0 > imax ) { return 0 ; } // RETURN
466  long result = histo -> binEntries( AIDA::IAxis::UNDERFLOW_BIN ) ;
467 
468  // get the exis
469  const AIDA::IAxis& axis = histo -> axis () ;
470  // number of bins
471  const int nBins = axis.bins() ;
472  // loop over all bins
473  for ( int i = 0 ; i < nBins ; ++i )
474  { if ( i < imax ) { result += histo->binEntries ( i ) ; } }
475  //
476  if ( nBins < imax )
477  { result += histo -> binEntries( AIDA::IAxis::OVERFLOW_BIN ) ; }
478  //
479  return result ;
480 }
list i
Definition: ana.py:128
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 491 of file HistoStats.cpp.

494 {
495  if ( 0 == histo ) { return s_long_bad ; } // RETURN
496  if ( imin == imax ) { return 0 ; } // RETURN
497  if ( imax < imin ) { return nEntries ( histo , imax ,imin ) ; } // RETURN
498  //
499  long result = 0 ;
500  if ( 0 > imin )
501  { result += histo -> binEntries( AIDA::IAxis::UNDERFLOW_BIN ) ; }
502  // get the exis
503  const AIDA::IAxis& axis = histo -> axis () ;
504  // number of bins
505  const int nBins = axis.bins() ;
506  if ( nBins < imin ) { return 0 ; } // RETURN
507  // loop over all bins
508  for ( int i = 0 ; i < nBins ; ++i )
509  { if ( imin <= i && i < imax ) { result += histo->binEntries ( i ) ; } }
510  //
511  if ( nBins < imax )
512  { result += histo -> binEntries( AIDA::IAxis::OVERFLOW_BIN ) ; }
513  //
514  return result ; // RETURN
515 }
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:461
list i
Definition: ana.py:128
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 526 of file HistoStats.cpp.

528 {
529  if ( 0 == histo ) { return s_bad ; } // RETURN
530  //
531  const double N = histo->allEntries () ;
532  if ( 0 >= N ) { return s_bad ; } // RETURN
533  const long n = nEntries ( histo , imax ) ;
534  if ( 0 > n ) { return s_bad ; } // RETURN
535  if ( n > N ) { return s_bad ; } // RETURN
536  //
537  return n / N ; // REUTRN
538 }
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:461
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 549 of file HistoStats.cpp.

552 {
553  if ( 0 == histo ) { return s_bad ; } // RETURN
554  const double N = histo->allEntries () ;
555  if ( 0 >= N ) { return s_bad ; } // RETURN
556  const long n = nEntries ( histo , imin , imax ) ;
557  if ( 0 > n ) { return s_bad ; } // RETURN
558  if ( n > N ) { return s_bad ; } // RETURN
559  //
560  return n / N ; // REUTRN
561 }
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:461
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 572 of file HistoStats.cpp.

574 {
575  if ( 0 == histo ) { return s_bad ; } // RETURN
576  //
577  const double N = histo->allEntries () ;
578  if ( 0 >= N ) { return s_bad ; } // RETURN
579  const long n = nEntries ( histo , imax ) ;
580  if ( 0 > n ) { return s_bad ; } // RETURN
581  if ( n > N ) { return s_bad ; } // RETURN
582  //
583  const double _n1 = std::max ( (double) n , 1.0 ) ;
584  const double _n2 = std::max ( ( N - n ) , 1.0 ) ;
585  //
586  return std::sqrt ( _n1 * _n2 / N ) / N ; // RETURN
587 }
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:461
int N
Definition: IOTest.py:90
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 598 of file HistoStats.cpp.

601 {
602  if ( 0 == histo ) { return s_bad ; } // RETURN
603  //
604  const double N = histo->allEntries () ;
605  if ( 0 >= N ) { return s_bad ; } // RETURN
606  const long n = nEntries ( histo , imin , imax ) ;
607  if ( 0 > n ) { return s_bad ; } // RETURN
608  if ( n > N ) { return s_bad ; } // RETURN
609  //
610  const double _n1 = std::max ( (double) n , 1.0 ) ;
611  const double _n2 = std::max ( ( N - n ) , 1.0 ) ;
612  //
613  return std::sqrt ( _n1 * _n2 / N ) / N ; // RETURN
614 }
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:461
int N
Definition: IOTest.py:90
double Gaudi::Utils::HistoStats::overflowEntriesFrac ( const AIDA::IHistogram1D *  histo)
static

the fraction of overflow entries (useful for shape comparison)

Definition at line 309 of file HistoStats.cpp.

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

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

Definition at line 373 of file HistoStats.cpp.

374 {
375  if ( 0 == histo ) { return s_bad ; } // RETURN
376  //
377  const double overflow = histo -> binEntries ( AIDA::IAxis::OVERFLOW_BIN );
378  const double all = histo -> allEntries () ;
379  //
380  if ( 0 > overflow || 0 >= all || overflow > all ) { return s_bad ; }
381  //
382  const double n = std::max ( overflow , 1.0 ) ;
383  const double N = all ;
384  const double n1 = std::max ( N - n , 1.0 ) ;
385  //
386  return std::sqrt ( n * n1 / N ) / N ; // use the binomial formula
387 }
int N
Definition: IOTest.py:90
double Gaudi::Utils::HistoStats::overflowIntegralFrac ( const AIDA::IHistogram1D *  histo)
static

the fraction of overflow intergal (useful for shape comparison)

Definition at line 345 of file HistoStats.cpp.

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

the error on fraction of overflow intergal

Definition at line 411 of file HistoStats.cpp.

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

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

get an error in the rms value

Definition at line 255 of file HistoStats.cpp.

256 {
257  if ( 0 == histo ) { return s_bad ; }
258  const double n = nEff ( histo ) ;
259  if ( 1 >= n ) { return 0.0 ; }
260  double result = 2 + kurtosis ( histo ) ;
261  result += 2.0 /( n - 1 ) ;
262  result /= 4.0 * n ;
263  result = std::max ( result , 0.0 ) ;
264  return histo -> rms() * std::sqrt ( result ) ;
265 }
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:246
static double kurtosis(const AIDA::IHistogram1D *histo)
get the kurtosis for the histogram
Definition: HistoStats.cpp:192
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
Definition: HistoStats.cpp:218
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 ( 0 == histo ) { return s_bad ; } // RETURN
170  const double mu3 = centralMoment ( histo , 3 ) ;
171  const double s3 = std::pow ( rms ( histo ) , 3 ) ;
172  return ( std::fabs(s3)>0 ? mu3/s3 : 0.0 );
173 }
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:119
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
Definition: HistoStats.cpp:246
double Gaudi::Utils::HistoStats::skewnessErr ( const AIDA::IHistogram1D *  histo)
static

get the error in skewness for the histogram

Definition at line 178 of file HistoStats.cpp.

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

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

Definition at line 293 of file HistoStats.cpp.

294 {
295  if ( 0 == histo ) { return s_bad ; }
296  //
297  const double error = sumBinHeightErr( histo ) ;
298  if ( 0 > error ) { return s_bad ; }
300  const double err1 = histo->binError ( AIDA::IAxis::UNDERFLOW_BIN ) ;
301  const double err2 = histo->binError ( AIDA::IAxis::OVERFLOW_BIN ) ;
302  //
303  return std::sqrt ( error * error + err1 * err1 + err2 * err2 ) ;
304 }
static double sumBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum bin height ("in-range integral")
Definition: HistoStats.cpp:270
double Gaudi::Utils::HistoStats::sumBinHeightErr ( const AIDA::IHistogram1D *  histo)
static

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

Definition at line 270 of file HistoStats.cpp.

271 {
272  if ( 0 == histo ) { return s_bad ; }
273  //
274  double error2 = 0 ;
275  // get the exis
276  const AIDA::IAxis& axis = histo -> axis () ;
277  // number of bins
278  const int nBins = axis.bins() ;
279  // loop over all bins
280  for ( int i = 0 ; i < nBins ; ++i )
281  {
282  // get the error in each bin
283  const double berr = histo->binError ( i ) ;
284  // accumulate the errors:
285  error2 += berr * berr ;
286  }
287  return std::sqrt ( error2 ) ;
288 }
list i
Definition: ana.py:128
double Gaudi::Utils::HistoStats::underflowEntriesFrac ( const AIDA::IHistogram1D *  histo)
static

the fraction of underflow entries (useful for shape comparison)

Definition at line 327 of file HistoStats.cpp.

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

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

Definition at line 392 of file HistoStats.cpp.

393 {
394  if ( 0 == histo ) { return s_bad ; } // RETURN
395  //
396  const double underflow = histo -> binEntries ( AIDA::IAxis::UNDERFLOW_BIN );
397  const double all = histo -> allEntries () ;
398  //
399  if ( 0 > underflow || 0 >= all || underflow > all ) { return s_bad ; }
400  //
401  const double n = std::max ( underflow , 1.0 ) ;
402  const double N = all ;
403  const double n1 = std::max ( N - n , 1.0 ) ;
404  //
405  return std::sqrt ( n * n1 / N ) / N ; // use the binomial formula
406 }
int N
Definition: IOTest.py:90
double Gaudi::Utils::HistoStats::underflowIntegralFrac ( const AIDA::IHistogram1D *  histo)
static

the fraction of underflow integral (useful for shape comparison)

Definition at line 359 of file HistoStats.cpp.

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

the error on fraction of underflow integral

Definition at line 433 of file HistoStats.cpp.

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

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