| # Gaudi Framework, version v21r6 |

Home |  | Generated: 11 Nov 2009

# Gaudi::Utils::HistoStats Class Reference

`#include <GaudiUtils/HistoStats.h>`

List of all members.

## Detailed Description

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

Author:
  Vanya BELYAEV ibelyaev@physics.syr.edu

Date:
  2007-08-06

Definition at line 31 of file 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"
static double | momentErr (const AIDA::IHistogram1D *histo, const unsigned int order)
| evaluate the uncertanty for 'bin-by-bin'-moment
static double | centralMoment (const AIDA::IHistogram1D *histo, const unsigned int order)
| evaluate the 'bin-by-bin'-central moment (around the mean value)
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)
static double | skewness (const AIDA::IHistogram1D *histo)
| get the skewness for the histogram
static double | skewnessErr (const AIDA::IHistogram1D *histo)
| get the error in skewness for the histogram
static double | kurtosis (const AIDA::IHistogram1D *histo)
| get the kurtosis for the histogram
static double | kurtosisErr (const AIDA::IHistogram1D *histo)
| get the error in kurtosis for the histogram
static double | mean (const AIDA::IHistogram1D *histo)
| get the mean value for the histogram (just for completeness)
static double | meanErr (const AIDA::IHistogram1D *histo)
| get an error in the mean value
static double | rms (const AIDA::IHistogram1D *histo)
| get the rms value for the histogram (just for completeness)
static double | rmsErr (const AIDA::IHistogram1D *histo)
| get an error in the rms value
static double | nEff (const AIDA::IHistogram1D *histo)
| get the effective entries (just for completeness)
static double | sumBinHeightErr (const AIDA::IHistogram1D *histo)
| get an error in the sum bin height ("in-range integral")
static double | sumAllBinHeightErr (const AIDA::IHistogram1D *histo)
| get an error in the sum of all bin height ("integral")
static double | overflowEntriesFrac (const AIDA::IHistogram1D *histo)
| the fraction of overflow entries (useful for shape comparison)
static double | underflowEntriesFrac (const AIDA::IHistogram1D *histo)
| the fraction of underflow entries (useful for shape comparison)
static double | overflowEntriesFracErr (const AIDA::IHistogram1D *histo)
| error on fraction of overflow entries (useful for shape comparison)
static double | underflowEntriesFracErr (const AIDA::IHistogram1D *histo)
| the error on fraction of underflow entries (useful for shape comparison)
static double | overflowIntegralFrac (const AIDA::IHistogram1D *histo)
| the fraction of overflow intergal (useful for shape comparison)
static double | underflowIntegralFrac (const AIDA::IHistogram1D *histo)
| the fraction of underflow integral (useful for shape comparison)
static double | overflowIntegralFracErr (const AIDA::IHistogram1D *histo)
| the error on fraction of overflow intergal
static double | underflowIntegralFracErr (const AIDA::IHistogram1D *histo)
| the error on fraction of underflow integral
static long | nEntries (const AIDA::IHistogram1D *histo, const int imax)
| get number of entries in histogram up to the certain bin (not-included)
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)
static double | nEntriesFrac (const AIDA::IHistogram1D *histo, const int imax)
| get the fraction of entries in histogram up to the certain bin (not-included)
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)
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)
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)

## Member Function Documentation

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 44 of file HistoStats.cpp.

    00047 {
    00048   if ( 0 == histo ) { return s_bad ; }                       // RETURN
    00049   if ( 0 == order ) { return 1.0   ; }                       // RETURN
    00050   if ( 1 == order ) { return mean( histo ) - value ; }       // RETURN
    00051   if ( 2 == order )
    00052   {
    00053     const double _r =         rms  ( histo ) ;
    00054     const double _d = value - mean ( histo ) ;
    00055     return _r *_r + _d * _d ;                            // RETURN
    00056   }
    00057   const double n = nEff ( histo )  ;
    00058   if ( 0 >= n     ) { return 0.0   ; }                    // RETURN
    00059
    00060   const int _order = (int) order ;
    00061
    00062   // get the exis
    00063   const AIDA::IAxis& axis = histo -> axis () ;
    00064   // number of bins
    00065   const int nBins = axis.bins() ;
    00066   double result = 0 ;
    00067   double weight = 0 ;
    00068   // loop over all bins
    00069   for ( int i = 0 ; i < nBins ; ++i )
    00070   {
    00071     const double lE   = axis . binLowerEdge ( i ) ;
    00072     const double uE   = axis . binUpperEdge ( i ) ;
    00073     //
    00074     const double yBin = histo -> binHeight    ( i ) ;   // bin weight
    00075     const double xBin = 0.5 * ( lE + uE ) ;             // bin center
    00076     //
    00077     weight += yBin ;
    00078     result += yBin * std::pow ( xBin - value , _order ) ;
    00079   }
    00080   if ( 0 != weight ) { result /= weight ; }
    00081   return result ;
    00082 }

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

Parameters:

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

Returns:
  the evaluated uncertanty in the moment

Definition at line 92 of file HistoStats.cpp.

    00094 {
    00095   if ( 0 == histo ) { return s_bad ; }                   // RETURN
    00096   const double n = nEff ( histo ) ;
    00097   if ( 0 >= n     ) { return 0.0   ; }                   // RETURN
    00098   const double a2o = moment ( histo , 2 * order ) ;      // a(2o)
    00099   const double ao  = moment ( histo ,     order ) ;      // a(o)
    00100   double result = a2o - ao*ao ;
    00101   result        /= n ;
    00102   result = std::max ( 0.0 , result ) ;
    00103   return std:: sqrt ( result ) ;                            // RETURN
    00104 }

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 114 of file HistoStats.cpp.

    00116 {
    00117   if ( 0 == histo ) { return s_bad ; }                        // RETURN
    00118   if ( 0 == order ) { return 1.0   ; }                        // RETURN
    00119   if ( 1 == order ) { return 0.0   ; }                        // RETURN
    00120   if ( 2 == order )
    00121   {
    00122     const double sigma = histo->rms() ;
    00123     return sigma * sigma ;                                    // RETURN
    00124   }
    00125   // delegate the actual evaluation to another method:
    00126   return moment ( histo , order , mean ( histo ) ) ;
    00127 }

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 139 of file HistoStats.cpp.

    00141 {
    00142   if ( 0 == histo ) { return s_bad ; }                    // RETURN
    00143   const double n    = nEff ( histo ) ;
    00144   if ( 0 >= n     ) { return 0.0   ; }                    // RETURN
    00145   const double mu2  = centralMoment ( histo , 2             ) ; // mu(2)
    00146   const double muo  = centralMoment ( histo ,     order     ) ; // mu(o)
    00147   const double mu2o = centralMoment ( histo , 2 * order     ) ; // mu(2o)
    00148   const double muom = centralMoment ( histo ,     order - 1 ) ; // mu(o-1)
    00149   const double muop = centralMoment ( histo ,     order + 1 ) ; // mu(o+1)
    00150   double result  =  mu2o  ;
    00151   result        -=  2.0   * order * muom * muop ;
    00152   result        -=  muo   * muo   ;
    00153   result        +=  order * order * mu2  * muom * muom ;
    00154   result        /=  n     ;
    00155   result = std::max ( 0.0 , result ) ;
    00156   return std:: sqrt ( result ) ;                            // RETURN
    00157 }

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

get the skewness for the histogram

Definition at line 162 of file HistoStats.cpp.

    00163 {
    00164   if ( 0 == histo ) { return s_bad ; }                      // RETURN
    00165   const double mu3 = centralMoment ( histo , 3 ) ;
    00166   const double s3  = std::pow ( rms ( histo ) , 3 ) ;
    00167   return ( std::fabs(s3)>0 ? mu3/s3 : 0.0 );
    00168 }

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

get the error in skewness for the histogram

Definition at line 173 of file HistoStats.cpp.

    00174 {
    00175   if ( 0 == histo ) { return s_bad ; }                     // RETURN
    00176   const double n = nEff ( histo ) ;
    00177   if ( 2 > n      ) { return 0.0   ; }                     // RETURN
    00178   double result = 6 ;
    00179   result *= ( n - 2 )  ;
    00180   result /= ( n + 1 ) * ( n + 3 ) ;
    00181   return std::sqrt ( result ) ;
    00182 }

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

get the kurtosis for the histogram

Definition at line 187 of file HistoStats.cpp.

    00188 {
    00189   if ( 0 == histo ) { return s_bad ; }                    // RETURN
    00190   const double mu4 = centralMoment ( histo , 4 ) ;
    00191   const double s4  = std::pow ( rms ( histo ) , 4 ) ;
    00192   return ( std::fabs(s4)>0 ? mu4/s4 - 3.0 : 0.0 );
    00193 }

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

get the error in kurtosis for the histogram

Definition at line 198 of file HistoStats.cpp.

    00199 {
    00200   if ( 0 == histo ) { return s_bad ; }                    // RETURN
    00201   const double n = nEff ( histo ) ;
    00202   if ( 3 > n      ) { return 0.0 ; }                      // RETURN
    00203   double result = 24 * n ;
    00204   result *= ( n - 2 ) * ( n - 3 ) ;
    00205   result /= ( n + 1 ) * ( n + 1 ) ;
    00206   result /= ( n + 3 ) * ( n + 5 ) ;
    00207   return std::sqrt ( result ) ;
    00208 }

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

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

Definition at line 222 of file HistoStats.cpp.

    00223 {
    00224   if ( 0 == histo ) { return s_bad ; }
    00225   return histo -> mean() ;
    00226 }

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

get an error in the mean value

Definition at line 231 of file HistoStats.cpp.

    00232 {
    00233   if ( 0 == histo ) { return s_bad ; }
    00234   const double n = nEff ( histo ) ;
    00235   return 0 >= n ? 0.0 : rms ( histo ) / std::sqrt ( n ) ;
    00236 }

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

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

Definition at line 241 of file HistoStats.cpp.

    00242 {
    00243   if ( 0 == histo ) { return s_bad ; }
    00244   return histo -> rms () ;
    00245 }

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.

    00251 {
    00252   if ( 0 == histo ) { return s_bad ; }
    00253   const double n = nEff ( histo ) ;
    00254   if ( 1 >=  n ) { return 0.0 ; }
    00255   double result = 2 + kurtosis ( histo ) ;
    00256   result += 2.0 /( n - 1 ) ;
    00257   result /= 4.0 * n ;
    00258   result = std::max ( result , 0.0 ) ;
    00259   return histo -> rms() * std::sqrt ( result ) ;
    00260 }

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

get the effective entries (just for completeness)

Definition at line 213 of file HistoStats.cpp.

    00214 {
    00215   if ( 0 == histo ) { return s_bad ; }
    00216   return histo -> equivalentBinEntries () ;
    00217 }

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

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

Definition at line 265 of file HistoStats.cpp.

    00266 {
    00267   if ( 0 == histo ) { return s_bad ; }
    00268   //
    00269   double error2 = 0 ;
    00270   // get the exis
    00271   const AIDA::IAxis& axis = histo -> axis () ;
    00272   // number of bins
    00273   const int nBins = axis.bins() ;
    00274   // loop over all bins
    00275   for ( int i = 0 ; i < nBins ; ++i )
    00276   {
    00277     // get the error in each bin
    00278     const double berr = histo->binError ( i ) ;
    00279     // accumulate the errors:
    00280     error2 += berr * berr ;
    00281   }
    00282   return std::sqrt ( error2 ) ;
    00283 }

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.

    00289 {
    00290   if ( 0 == histo ) { return s_bad ; }
    00291   //
    00292   const double error = sumBinHeightErr( histo ) ;
    00293   if ( 0 > error ) { return s_bad ; }
    00295   const double err1 = histo->binError ( AIDA::IAxis::UNDERFLOW_BIN ) ;
    00296   const double err2 = histo->binError ( AIDA::IAxis::OVERFLOW_BIN  ) ;
    00297   //
    00298   return std::sqrt ( error * error + err1 * err1 + err2 * err2 ) ;
    00299 }

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

the fraction of overflow entries (useful for shape comparison)

Definition at line 304 of file HistoStats.cpp.

    00305 {
    00306   if ( 0 == histo ) { return s_bad ; }                                // REUTRN
    00307   const long overflow = histo -> binEntries ( AIDA::IAxis::OVERFLOW_BIN )  ;
    00308   if ( 0 == overflow ) { return 0 ; }                                 // REUTRN
    00309   const long all      = histo->allEntries() ;
    00310   if ( 0 == all      ) { return 0 ; }                  // "CONVENTION?"  RETURN
    00311   if ( 0 >  all      ) { return s_bad ; }     // Lets be a bit paranoic, RETURN
    00312   //
    00313   double _tmp = (double) overflow ;
    00314   _tmp /= all ;
    00315   //
    00316   return _tmp ;
    00317 }

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

the fraction of underflow entries (useful for shape comparison)

Definition at line 322 of file HistoStats.cpp.

    00323 {
    00324   if ( 0 == histo ) { return s_bad ; }                                // REUTRN
    00325   const long underflow = histo -> binEntries ( AIDA::IAxis::UNDERFLOW_BIN )  ;
    00326   if ( 0 == underflow ) { return 0 ; }                                // REUTRN
    00327   const long all      = histo->allEntries() ;
    00328   if ( 0 == all      ) { return 0 ; }                  // "CONVENTION?"  RETURN
    00329   if ( 0 >  all      ) { return s_bad ; }     // Lets be a bit paranoic, RETURN
    00330   //
    00331   double _tmp = (double) underflow ;
    00332   _tmp /= all ;
    00333   //
    00334   return _tmp ;
    00335 }

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

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

Definition at line 368 of file HistoStats.cpp.

    00369 {
    00370   if ( 0 == histo ) { return s_bad ; } // RETURN
    00371   //
    00372   const double overflow = histo -> binEntries ( AIDA::IAxis::OVERFLOW_BIN );
    00373   const double all      = histo -> allEntries () ;
    00374   //
    00375   if ( 0 > overflow || 0 >= all || overflow > all ) { return s_bad ; }
    00376   //
    00377   const double n  = std::max ( overflow , 1.0 ) ;
    00378   const double N  = all ;
    00379   const double n1 = std::max ( N - n , 1.0 ) ;
    00380   //
    00381   return std::sqrt ( n * n1 / N ) / N ; // use the binomial formula
    00382 }

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

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

Definition at line 387 of file HistoStats.cpp.

    00388 {
    00389   if ( 0 == histo ) { return s_bad ; } // RETURN
    00390   //
    00391   const double underflow = histo -> binEntries ( AIDA::IAxis::UNDERFLOW_BIN );
    00392   const double all       = histo -> allEntries () ;
    00393   //
    00394   if ( 0 > underflow || 0 >= all || underflow > all ) { return s_bad ; }
    00395   //
    00396   const double n  = std::max ( underflow , 1.0 ) ;
    00397   const double N  = all ;
    00398   const double n1 = std::max ( N - n , 1.0 ) ;
    00399   //
    00400   return std::sqrt ( n * n1 / N ) / N ; // use the binomial formula
    00401 }

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

the fraction of overflow intergal (useful for shape comparison)

Definition at line 340 of file HistoStats.cpp.

    00341 {
    00342   if ( 0 == histo ) { return s_bad ; }                                // REUTRN
    00343   const double overflow = histo -> binHeight ( AIDA::IAxis::OVERFLOW_BIN )  ;
    00344   if ( 0 == overflow ) { return 0 ; }                                 // REUTRN
    00345   const double all      = histo -> sumAllBinHeights() ;
    00346   if ( 0 == all      ) { return 0 ; }                  // "CONVENTION?"  RETURN
    00347   //
    00348   return overflow / all ;
    00349 }

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

the fraction of underflow integral (useful for shape comparison)

Definition at line 354 of file HistoStats.cpp.

    00355 {
    00356   if ( 0 == histo ) { return s_bad ; }                                // REUTRN
    00357   const double underflow = histo -> binHeight ( AIDA::IAxis::UNDERFLOW_BIN )  ;
    00358   if ( 0 == underflow ) { return 0 ; }                                // REUTRN
    00359   const double all      = histo -> sumAllBinHeights() ;
    00360   if ( 0 == all      ) { return 0 ; }                  // "CONVENTION?"  RETURN
    00361   //
    00362   return underflow / all ;
    00363 }

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

the error on fraction of overflow intergal

Definition at line 406 of file HistoStats.cpp.

    00407 {
    00408   if ( 0 == histo ) { return s_bad ; }                                // RETURN
    00409   //
    00410   const double all       = histo -> sumAllBinHeights () ;
    00411   if ( 0 == all       ) { return s_bad ; }                            // RETURN
    00412   const double overflow  = histo -> binHeight ( AIDA::IAxis::OVERFLOW_BIN )  ;
    00413   const double oErr      = histo -> binError  ( AIDA::IAxis::OVERFLOW_BIN )  ;
    00414   if ( 0 > oErr       ) { return s_bad ; }                            // RETURN
    00415   const double aErr      = sumAllBinHeightErr ( histo ) ;
    00416   if ( 0 > aErr       ) { return s_bad ; }                            // RETURN
    00417   //
    00418   double error2  = oErr * oErr ;
    00419   error2        += aErr * aErr * overflow * overflow / all / all ;
    00420   error2        /=  all *  all ;
    00421
    00422   return std::sqrt ( error2 ) ;
    00423 }

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

the error on fraction of underflow integral

Definition at line 428 of file HistoStats.cpp.

    00429 {
    00430   if ( 0 == histo ) { return s_bad ; }                                // RETURN
    00431   //
    00432   const double all       = histo -> sumAllBinHeights () ;
    00433   if ( 0 == all       ) { return s_bad ; }                            // RETURN
    00434   const double underflow  = histo -> binHeight ( AIDA::IAxis::UNDERFLOW_BIN )  ;
    00435   const double oErr       = histo -> binError  ( AIDA::IAxis::UNDERFLOW_BIN )  ;
    00436   if ( 0 > oErr       ) { return s_bad ; }                            // RETURN
    00437   const double aErr      = sumAllBinHeightErr ( histo ) ;
    00438   if ( 0 > aErr       ) { return s_bad ; }                            // RETURN
    00439   //
    00440   double error2  = oErr * oErr ;
    00441   error2        += aErr * aErr * underflow * underflow / all / all ;
    00442   error2        /=  all *  all ;
    00443   //
    00444   return std::sqrt ( error2 ) ;
    00445 }

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 456 of file HistoStats.cpp.

    00458 {
    00459   if ( 0 == histo ) { return s_long_bad ; }                            // RETURN
    00460   if ( 0 > imax   ) { return 0          ; }                            // RETURN
    00461   long result = histo -> binEntries( AIDA::IAxis::UNDERFLOW_BIN )  ;
    00462
    00463   // get the exis
    00464   const AIDA::IAxis& axis = histo -> axis () ;
    00465   // number of bins
    00466   const int nBins = axis.bins() ;
    00467   // loop over all bins
    00468   for ( int i = 0 ; i < nBins ; ++i )
    00469   { if ( i < imax ) { result += histo->binEntries ( i ) ; } }
    00470   //
    00471   if ( nBins  < imax )
    00472   { result += histo -> binEntries( AIDA::IAxis::OVERFLOW_BIN ) ; }
    00473   //
    00474   return result ;
    00475 }

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 486 of file HistoStats.cpp.

    00489 {
    00490   if ( 0 == histo   ) { return s_long_bad ; }                         // RETURN
    00491   if ( imin == imax ) { return 0          ; }                         // RETURN
    00492   if ( imax < imin  ) { return nEntries  ( histo , imax ,imin ) ; }   // RETURN
    00493   //
    00494   long result = 0 ;
    00495   if ( 0 > imin  )
    00496   { result += histo -> binEntries( AIDA::IAxis::UNDERFLOW_BIN )  ; }
    00497   // get the exis
    00498   const AIDA::IAxis& axis = histo -> axis () ;
    00499   // number of bins
    00500   const int nBins = axis.bins() ;
    00501   if ( nBins  < imin ) { return 0 ; }                                 // RETURN
    00502   // loop over all bins
    00503   for ( int i = 0 ; i < nBins ; ++i )
    00504   { if ( imin <= i && i < imax ) { result += histo->binEntries ( i ) ; } }
    00505   //
    00506   if ( nBins  < imax )
    00507   { result += histo -> binEntries( AIDA::IAxis::OVERFLOW_BIN ) ; }
    00508   //
    00509   return result ;                                                      // RETURN
    00510 }

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 521 of file HistoStats.cpp.

    00523 {
    00524   if ( 0 == histo   ) { return s_bad ; }                              // RETURN
    00525   //
    00526   const double N = histo->allEntries () ;
    00527   if ( 0 >= N       ) { return s_bad ; }                              // RETURN
    00528   const long   n = nEntries ( histo , imax ) ;
    00529   if ( 0 >  n       ) { return s_bad ; }                              // RETURN
    00530   if ( n >  N       ) { return s_bad ; }                              // RETURN
    00531   //
    00532   return n / N ;                                                      // REUTRN
    00533 }

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 544 of file HistoStats.cpp.

    00547 {
    00548   if ( 0 == histo   ) { return s_bad ; }                              // RETURN
    00549   const double N = histo->allEntries () ;
    00550   if ( 0 >= N       ) { return s_bad ; }                              // RETURN
    00551   const long   n = nEntries ( histo , imin , imax ) ;
    00552   if ( 0 >  n       ) { return s_bad ; }                              // RETURN
    00553   if ( n >  N       ) { return s_bad ; }                              // RETURN
    00554   //
    00555   return n / N ;                                                      // REUTRN
    00556 }

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 567 of file HistoStats.cpp.

    00569 {
    00570   if ( 0 == histo   ) { return s_bad ; }                              // RETURN
    00571   //
    00572   const double N = histo->allEntries () ;
    00573   if ( 0 >= N       ) { return s_bad ; }                              // RETURN
    00574   const long   n = nEntries ( histo , imax ) ;
    00575   if ( 0 >  n       ) { return s_bad ; }                              // RETURN
    00576   if ( n >  N       ) { return s_bad ; }                              // RETURN
    00577   //
    00578   const double _n1 = std::max ( (double)       n   , 1.0 ) ;
    00579   const double _n2 = std::max (          ( N - n ) , 1.0 ) ;
    00580   //
    00581   return std::sqrt ( _n1 * _n2 / N ) / N ;                             // RETURN
    00582 }

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 593 of file HistoStats.cpp.

    00596 {
    00597   if ( 0 == histo   ) { return s_bad ; }                              // RETURN
    00598   //
    00599   const double N = histo->allEntries () ;
    00600   if ( 0 >= N       ) { return s_bad ; }                              // RETURN
    00601   const long   n = nEntries ( histo , imin , imax ) ;
    00602   if ( 0 >  n       ) { return s_bad ; }                              // RETURN
    00603   if ( n >  N       ) { return s_bad ; }                              // RETURN
    00604   //
    00605   const double _n1 = std::max ( (double)       n   , 1.0 ) ;
    00606   const double _n2 = std::max (          ( N - n ) , 1.0 ) ;
    00607   //
    00608   return std::sqrt ( _n1 * _n2 / N ) / N ;                             // RETURN
    00609 }

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r6/GaudiUtils/GaudiUtils/HistoStats.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r6/GaudiUtils/src/Lib/HistoStats.cpp