4 #pragma warning( disable : 1572 ) 17 #include "AIDA/IAxis.h" 18 #include "AIDA/IHistogram1D.h" 56 return mean( histo ) - value;
59 const auto _r =
rms( histo );
60 const auto _d = value -
mean( histo );
63 const auto n =
nEff( histo );
69 const auto& axis = histo->axis();
71 const auto nBins = axis.bins();
72 double result{0}, weight{0};
74 for (
int i = 0; i < nBins; ++i ) {
75 const auto lE = axis.binLowerEdge( i );
76 const auto uE = axis.binUpperEdge( i );
78 const auto yBin = histo->binHeight( i );
79 const double xBin = 0.5 * ( lE + uE );
82 result += yBin *
std::pow( xBin - value, order );
102 const auto n =
nEff( histo );
106 const auto a2o =
moment( histo, 2 * order );
107 const auto ao =
moment( histo, order );
151 const auto n =
nEff( histo );
161 ( mu2o - ( 2.0 * order * muom * muop ) -
std::pow( muo, 2 ) + ( order * order * mu2 * muom * muom ) ) /
n;
174 return (
std::fabs( s3 ) > 0 ? mu3 / s3 : 0.0 );
184 const auto n =
nEff( histo );
188 const auto result = 6.0 * (
n - 2 ) / ( (
n + 1 ) * (
n + 3 ) );
201 return (
std::fabs( s4 ) > 0 ? mu4 / s4 - 3.0 : 0.0 );
211 const auto n =
nEff( histo );
215 auto result = 24.0 *
n;
216 result *= (
n - 2 ) * (
n - 3 );
217 result /= (
n + 1 ) * (
n + 1 );
218 result /= (
n + 3 ) * (
n + 5 );
226 return ( histo ? histo->equivalentBinEntries() : s_bad );
240 const auto n =
nEff( histo );
255 const auto n =
nEff( histo );
259 auto result = 2.0 +
kurtosis( histo );
260 result += 2.0 / (
n - 1 );
275 const auto& axis = histo->axis();
277 const auto nBins = axis.bins();
279 for (
int i = 0; i < nBins; ++i ) {
281 error2 +=
std::pow( histo->binError( i ), 2 );
299 const auto err1 = histo->binError( AIDA::IAxis::UNDERFLOW_BIN );
300 const auto err2 = histo->binError( AIDA::IAxis::OVERFLOW_BIN );
312 const auto overflow = histo->binEntries( AIDA::IAxis::OVERFLOW_BIN );
313 if ( 0 == overflow ) {
316 const auto all = histo->allEntries();
324 return (
double)overflow / (double)all;
334 const auto underflow = histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN );
335 if ( 0 == underflow ) {
338 const auto all = histo->allEntries();
346 return (
double)underflow / (double)all;
356 const auto overflow = histo->binHeight( AIDA::IAxis::OVERFLOW_BIN );
357 if ( 0 == overflow ) {
360 const auto all = histo->sumAllBinHeights();
365 return (
double)overflow / (double)all;
375 const auto underflow = histo->binHeight( AIDA::IAxis::UNDERFLOW_BIN );
376 if ( 0 == underflow ) {
379 const auto all = histo->sumAllBinHeights();
384 return (
double)underflow / (double)all;
395 const auto overflow = histo->binEntries( AIDA::IAxis::OVERFLOW_BIN );
396 const auto all = histo->allEntries();
398 if ( 0 > overflow || 0 >= all || overflow > all ) {
402 const double n =
std::max( (
double)overflow, 1.0 );
403 const double N = all;
404 const double n1 =
std::max( N - n, 1.0 );
417 const auto underflow = histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN );
418 const auto all = histo->allEntries();
420 if ( 0 > underflow || 0 >= all || underflow > all ) {
424 const double n =
std::max( (
double)underflow, 1.0 );
425 const double N = all;
426 const double n1 =
std::max( N - n, 1.0 );
439 const auto all = histo->sumAllBinHeights();
443 const auto overflow = histo->binHeight( AIDA::IAxis::OVERFLOW_BIN );
444 const auto oErr = histo->binError( AIDA::IAxis::OVERFLOW_BIN );
453 double error2 =
std::pow( (
double)oErr, 2 );
455 error2 /=
std::pow( (
double)all, 2 );
468 const auto all = histo->sumAllBinHeights();
472 const auto underflow = histo->binHeight( AIDA::IAxis::UNDERFLOW_BIN );
473 const auto oErr = histo->binError( AIDA::IAxis::UNDERFLOW_BIN );
482 double error2 =
std::pow( (
double)oErr, 2 );
484 error2 /=
std::pow( (
double)all, 2 );
505 long result = histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN );
508 const auto& axis = histo->axis();
510 const auto nBins = axis.bins();
512 for (
int i = 0; i < nBins; ++i ) {
514 result += histo->binEntries( i );
518 if ( nBins < imax ) {
519 result += histo->binEntries( AIDA::IAxis::OVERFLOW_BIN );
540 if ( imin == imax ) {
544 return nEntries( histo, imax, imin );
549 result += histo->binEntries( AIDA::IAxis::UNDERFLOW_BIN );
552 const auto& axis = histo->axis();
554 const auto nBins = axis.bins();
555 if ( nBins < imin ) {
559 for (
int i = 0; i < nBins; ++i ) {
560 if ( imin <= i && i < imax ) {
561 result += histo->binEntries( i );
565 if ( nBins < imax ) {
566 result += histo->binEntries( AIDA::IAxis::OVERFLOW_BIN );
586 const auto N = histo->allEntries();
598 return (
double)
n / (double)
N;
616 const auto N = histo->allEntries();
620 const auto n =
nEntries( histo, imin, imax );
628 return (
double)
n / (double)
N;
645 const auto N = histo->allEntries();
657 const double _n1 =
std::max( (
double)
n, 1.0 );
658 const double _n2 =
std::max( (
double)(
N - n ), 1.0 );
679 const auto N = histo->allEntries();
683 const auto n =
nEntries( histo, imin, imax );
691 const double _n1 =
std::max( (
double)
n, 1.0 );
692 const double _n2 =
std::max( (
double)(
N - n ), 1.0 );
static double underflowIntegralFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of underflow integral
static double overflowIntegralFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of overflow intergal
static double momentErr(const AIDA::IHistogram1D *histo, const unsigned int order)
evaluate the uncertanty for 'bin-by-bin'-moment
static double underflowEntriesFrac(const AIDA::IHistogram1D *histo)
the fraction of underflow entries (useful for shape comparison)
static long nEntries(const AIDA::IHistogram1D *histo, const int imax)
get number of entries in histogram up to the certain bin (not-included)
static double rmsErr(const AIDA::IHistogram1D *histo)
get an error in the rms value
static double underflowIntegralFrac(const AIDA::IHistogram1D *histo)
the fraction of underflow integral (useful for shape comparison)
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 meanErr(const AIDA::IHistogram1D *histo)
get an error in the mean value
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 overflowIntegralFrac(const AIDA::IHistogram1D *histo)
the fraction of overflow intergal (useful for shape comparison)
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 c...
static double rms(const AIDA::IHistogram1D *histo)
get the rms value for the histogram (just for completeness)
static double overflowEntriesFrac(const AIDA::IHistogram1D *histo)
the fraction of overflow entries (useful for shape comparison)
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-include...
static double sumBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum bin height ("in-range integral")
static double overflowEntriesFracErr(const AIDA::IHistogram1D *histo)
error on fraction of overflow entries (useful for shape comparison)
static double sumAllBinHeightErr(const AIDA::IHistogram1D *histo)
get an error in the sum of all bin height ("integral")
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 skewnessErr(const AIDA::IHistogram1D *histo)
get the error in skewness for the histogram
static double underflowEntriesFracErr(const AIDA::IHistogram1D *histo)
the error on fraction of underflow entries (useful for shape comparison)
static double kurtosis(const AIDA::IHistogram1D *histo)
get the kurtosis for the histogram
static double nEff(const AIDA::IHistogram1D *histo)
get the effective entries (just for completeness)
static double skewness(const AIDA::IHistogram1D *histo)
get the skewness for the histogram