Gaudi Framework, version v22r0

Home   Generated: 9 Feb 2011

Gaudi::Utils::HistoStats Class Reference

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

#include <GaudiUtils/HistoStats.h>

List of all members.

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)

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.


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.

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

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

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

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

get the kurtosis for the histogram

Definition at line 192 of file HistoStats.cpp.

00193 {
00194   if ( 0 == histo ) { return s_bad ; }                    // RETURN 
00195   const double mu4 = centralMoment ( histo , 4 ) ;
00196   const double s4  = std::pow ( rms ( histo ) , 4 ) ;
00197   return ( std::fabs(s4)>0 ? mu4/s4 - 3.0 : 0.0 );
00198 }

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.

00204 {
00205   if ( 0 == histo ) { return s_bad ; }                    // RETURN 
00206   const double n = nEff ( histo ) ;
00207   if ( 3 > n      ) { return 0.0 ; }                      // RETURN   
00208   double result = 24 * n ;
00209   result *= ( n - 2 ) * ( n - 3 ) ;
00210   result /= ( n + 1 ) * ( n + 1 ) ;
00211   result /= ( n + 3 ) * ( n + 5 ) ;
00212   return std::sqrt ( result ) ;  
00213 }

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.

00228 {
00229   if ( 0 == histo ) { return s_bad ; }
00230   return histo -> mean() ;    
00231 }

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.

00237 {
00238   if ( 0 == histo ) { return s_bad ; }
00239   const double n = nEff ( histo ) ;
00240   return 0 >= n ? 0.0 : rms ( histo ) / std::sqrt ( n ) ;
00241 }

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

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

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.

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

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.

00219 {
00220   if ( 0 == histo ) { return s_bad ; }
00221   return histo -> equivalentBinEntries () ;
00222 }

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

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

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

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

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

00552 {
00553   if ( 0 == histo   ) { return s_bad ; }                              // RETURN
00554   const double N = histo->allEntries () ;
00555   if ( 0 >= N       ) { return s_bad ; }                              // RETURN 
00556   const long   n = nEntries ( histo , imin , imax ) ;
00557   if ( 0 >  n       ) { return s_bad ; }                              // RETURN 
00558   if ( n >  N       ) { return s_bad ; }                              // RETURN 
00559   //
00560   return n / N ;                                                      // REUTRN 
00561 }

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

00528 {
00529   if ( 0 == histo   ) { return s_bad ; }                              // RETURN
00530   //
00531   const double N = histo->allEntries () ;
00532   if ( 0 >= N       ) { return s_bad ; }                              // RETURN 
00533   const long   n = nEntries ( histo , imax ) ;
00534   if ( 0 >  n       ) { return s_bad ; }                              // RETURN 
00535   if ( n >  N       ) { return s_bad ; }                              // RETURN 
00536   //
00537   return n / N ;                                                      // REUTRN 
00538 }

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

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

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

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

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.

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

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.

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

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.

00346 {
00347   if ( 0 == histo ) { return s_bad ; }                                // REUTRN  
00348   const double overflow = histo -> binHeight ( AIDA::IAxis::OVERFLOW_BIN )  ;
00349   if ( 0 == overflow ) { return 0 ; }                                 // REUTRN
00350   const double all      = histo -> sumAllBinHeights() ;
00351   if ( 0 == all      ) { return 0 ; }                  // "CONVENTION?"  RETURN 
00352   //
00353   return overflow / all ;
00354 }

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.

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

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.

00247 {
00248   if ( 0 == histo ) { return s_bad ; }
00249   return histo -> rms () ;    
00250 }

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.

00256 {
00257   if ( 0 == histo ) { return s_bad ; }  
00258   const double n = nEff ( histo ) ;    
00259   if ( 1 >=  n ) { return 0.0 ; }
00260   double result = 2 + kurtosis ( histo ) ;
00261   result += 2.0 /( n - 1 ) ;
00262   result /= 4.0 * n ;
00263   result = std::max ( result , 0.0 ) ;
00264   return histo -> rms() * std::sqrt ( result ) ;
00265 }

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

get the skewness for the histogram

Definition at line 167 of file HistoStats.cpp.

00168 {
00169   if ( 0 == histo ) { return s_bad ; }                      // RETURN
00170   const double mu3 = centralMoment ( histo , 3 ) ;
00171   const double s3  = std::pow ( rms ( histo ) , 3 ) ;
00172   return ( std::fabs(s3)>0 ? mu3/s3 : 0.0 );
00173 }

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.

00179 {
00180   if ( 0 == histo ) { return s_bad ; }                     // RETURN 
00181   const double n = nEff ( histo ) ;
00182   if ( 2 > n      ) { return 0.0   ; }                     // RETURN
00183   double result = 6 ;
00184   result *= ( n - 2 )  ;
00185   result /= ( n + 1 ) * ( n + 3 ) ;    
00186   return std::sqrt ( result ) ;  
00187 }

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.

00294 {
00295   if ( 0 == histo ) { return s_bad ; }  
00296   //
00297   const double error = sumBinHeightErr( histo ) ;
00298   if ( 0 > error ) { return s_bad ; }
00300   const double err1 = histo->binError ( AIDA::IAxis::UNDERFLOW_BIN ) ;
00301   const double err2 = histo->binError ( AIDA::IAxis::OVERFLOW_BIN  ) ;
00302   //
00303   return std::sqrt ( error * error + err1 * err1 + err2 * err2 ) ;
00304 }

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.

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

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.

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

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.

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

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.

00360 {
00361   if ( 0 == histo ) { return s_bad ; }                                // REUTRN  
00362   const double underflow = histo -> binHeight ( AIDA::IAxis::UNDERFLOW_BIN )  ;
00363   if ( 0 == underflow ) { return 0 ; }                                // REUTRN 
00364   const double all      = histo -> sumAllBinHeights() ;
00365   if ( 0 == all      ) { return 0 ; }                  // "CONVENTION?"  RETURN 
00366   //
00367   return underflow / all ; 
00368 }

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.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Wed Feb 9 16:33:22 2011 for Gaudi Framework, version v22r0 by Doxygen version 1.6.2 written by Dimitri van Heesch, © 1997-2004