Hello community, here is the log from the commit of package YODA for openSUSE:Factory checked in at 2014-10-29 21:10:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/YODA (Old) and /work/SRC/openSUSE:Factory/.YODA.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "YODA" Changes: -------- --- /work/SRC/openSUSE:Factory/YODA/YODA.changes 2014-09-19 15:45:09.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.YODA.new/YODA.changes 2014-10-29 21:10:22.000000000 +0100 @@ -1,0 +2,14 @@ +Sun Oct 26 04:31:24 UTC 2014 - [email protected] + +- Update to version 1.3.0: + + Use numEntries() rather than effNumEntries() when checking + consistency of inputs to efficiency() calculations -- the + effNumEntries of a set can be smaller than that of a strict + subset, surprisingly! + + Small improvements to yodahist and yodaplot behaviours/UIs. + + Adding setX/Y/Z(val, err) methods to Point3D. + + Add an efficiency method for 2D histos. + + Hide fill and fillBin methods from Python mappings of bin + types. + +------------------------------------------------------------------- Old: ---- YODA-1.2.1.tar.bz2 New: ---- YODA-1.3.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ YODA.spec ++++++ --- /var/tmp/diff_new_pack.QsKoRu/_old 2014-10-29 21:10:23.000000000 +0100 +++ /var/tmp/diff_new_pack.QsKoRu/_new 2014-10-29 21:10:23.000000000 +0100 @@ -19,7 +19,7 @@ %define so_name lib%{name} Name: YODA -Version: 1.2.1 +Version: 1.3.0 Release: 0 Summary: A small set of data analysis classes for MC event generator validation analyses License: GPL-2.0 ++++++ YODA-1.2.1.tar.bz2 -> YODA-1.3.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/ChangeLog new/YODA-1.3.0/ChangeLog --- old/YODA-1.2.1/ChangeLog 2014-09-01 23:30:05.000000000 +0200 +++ new/YODA-1.3.0/ChangeLog 2014-09-30 20:11:42.000000000 +0200 @@ -1,3 +1,22 @@ +2014-09-30 Andy Buckley <[email protected]> + + * 1.3.0 release! + + * Use numEntries() rather than effNumEntries() when checking + consistency of inputs to efficiency() calculations -- the + effNumEntries of a set can be smaller than that of a strict + subset, surprisingly! + +2014-09-17 Andy Buckley <[email protected]> + + * Small improvements to yodahist and yodaplot behaviours/UIs. + + * Adding setX/Y/Z(val, err) methods to Point3D. + + * Add an efficiency method for 2D histos. + + * Hide fill and fillBin methods from Python mappings of bin types. + 2014-09-01 Andy Buckley <[email protected]> * YODA 1.2.1 release! diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/Makefile.in new/YODA-1.3.0/Makefile.in --- old/YODA-1.2.1/Makefile.in 2014-09-01 23:30:32.000000000 +0200 +++ new/YODA-1.3.0/Makefile.in 2014-09-18 01:19:22.000000000 +0200 @@ -825,8 +825,8 @@ maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -@WITH_DOXYGEN_FALSE@mostlyclean-local: @WITH_DOXYGEN_FALSE@uninstall-local: +@WITH_DOXYGEN_FALSE@mostlyclean-local: clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/bin/yoda-config new/YODA-1.3.0/bin/yoda-config --- old/YODA-1.2.1/bin/yoda-config 2014-09-01 23:30:54.000000000 +0200 +++ new/YODA-1.3.0/bin/yoda-config 2014-09-18 01:19:34.000000000 +0200 @@ -55,6 +55,6 @@ ## Version tmp=$( echo "$*" | egrep -- '--\<version\>') -test -n "$tmp" && echo 1.2.1 && exit 0 +test -n "$tmp" && echo 1.3.0 && exit 0 echo $OUT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/bin/yodahist new/YODA-1.3.0/bin/yodahist --- old/YODA-1.2.1/bin/yodahist 2014-05-30 14:40:54.000000000 +0200 +++ new/YODA-1.3.0/bin/yodahist 2014-09-16 10:12:30.000000000 +0200 @@ -5,9 +5,15 @@ Make and fill a YODA histogram from plain text file/stream input. +e.g. +cat foo.dat | %prog h1 10 0. 100. out foo.yoda +cat foo2.dat | %prog prof2 10 0. 100. 5 -10 10 show + + TODO: + * Automatically treat '-' as a minus sign in cmds list (with argparse?) * Also allow explicit lists of bin edges as parseable strings on command line? - * Minimal unique cmd shortcut finding + * Default printout/write and auto-true vals for show, log*, etc. * How to determine bin range in advance?... must need two passes?? * Add plotting later: plot params nx lx ux palette linecolor linestyle legend ticks on this or yodaplot interface? * Multiple datasets / histos? How??? @@ -109,7 +115,10 @@ cmds = {} while tmpargs: cmd = tmpargs[0].lower() - cmds[cmd] = tmpargs[1] + try: + cmds[cmd] = tmpargs[1] + except: + sys.stderr.write("Value missing for command '%s'\n" % cmd) del tmpargs[:2] # TODO: For now all commands take single-value arguments... maybe this will always be the case? # TODO: We avoid enforcing specific allowed commands for now. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/bin/yodaplot new/YODA-1.3.0/bin/yodaplot --- old/YODA-1.2.1/bin/yodaplot 2014-07-16 18:56:51.000000000 +0200 +++ new/YODA-1.3.0/bin/yodaplot 2014-09-16 10:51:42.000000000 +0200 @@ -45,6 +45,8 @@ \usepackage{mathpazo} +\usepackage{amsmath,amssymb} + \usepackage{tikz} \usepackage{pgfplots} % TODO: use siunitx for number typesetting? @@ -117,7 +119,7 @@ if aostyles["LineStyle"] == "none": body += "only marks, " else: - body += "const plot mark mid, %s" % aostyles["LineStyle"] + body += "const plot mark mid, %s, " % aostyles["LineStyle"] if aostyles["Marker"] != "none": body += "mark=%s, mark options={scale=%g}, " % (aostyles["Marker"], aostyles["MarkerScale"]) if aostyles["ErrorBars"]: @@ -139,7 +141,7 @@ body += " };\n" if aostyles["Legend"]: - body += " \\addlegendentry{%s}%%\n" % basename + body += " \\addlegendentry{%s}%%\n" % aostyles.get("Title", basename) body += " \\end{%s}%%\n" % axistype body += "\\end{tikzpicture}%\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/configure new/YODA-1.3.0/configure --- old/YODA-1.2.1/configure 2014-09-01 23:30:32.000000000 +0200 +++ new/YODA-1.3.0/configure 2014-09-18 01:19:22.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for YODA 1.2.1. +# Generated by GNU Autoconf 2.69 for YODA 1.3.0. # # Report bugs to <[email protected]>. # @@ -650,8 +650,8 @@ # Identity of this package. PACKAGE_NAME='YODA' PACKAGE_TARNAME='YODA' -PACKAGE_VERSION='1.2.1' -PACKAGE_STRING='YODA 1.2.1' +PACKAGE_VERSION='1.3.0' +PACKAGE_STRING='YODA 1.3.0' PACKAGE_BUGREPORT='[email protected]' PACKAGE_URL='' @@ -1425,7 +1425,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures YODA 1.2.1 to adapt to many kinds of systems. +\`configure' configures YODA 1.3.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1495,7 +1495,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of YODA 1.2.1:";; + short | recursive ) echo "Configuration of YODA 1.3.0:";; esac cat <<\_ACEOF @@ -1612,7 +1612,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -YODA configure 1.2.1 +YODA configure 1.3.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2144,7 +2144,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by YODA $as_me 1.2.1, which was +It was created by YODA $as_me 1.3.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3017,7 +3017,7 @@ # Define the identity of the package. PACKAGE='YODA' - VERSION='1.2.1' + VERSION='1.3.0' cat >>confdefs.h <<_ACEOF @@ -17716,7 +17716,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by YODA $as_me 1.2.1, which was +This file was extended by YODA $as_me 1.3.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17782,7 +17782,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -YODA config.status 1.2.1 +YODA config.status 1.3.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/configure.ac new/YODA-1.3.0/configure.ac --- old/YODA-1.2.1/configure.ac 2014-09-01 23:30:26.000000000 +0200 +++ new/YODA-1.3.0/configure.ac 2014-09-18 01:18:47.000000000 +0200 @@ -1,7 +1,7 @@ ## Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([YODA],[1.2.1],[[email protected]],[YODA]) +AC_INIT([YODA],[1.3.0],[[email protected]],[YODA]) ## Check and block installation into the src/build dir if test "$prefix" = "$PWD"; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/include/YODA/Config/YodaConfig.h new/YODA-1.3.0/include/YODA/Config/YodaConfig.h --- old/YODA-1.2.1/include/YODA/Config/YodaConfig.h 2014-09-01 23:30:55.000000000 +0200 +++ new/YODA-1.3.0/include/YODA/Config/YodaConfig.h 2014-09-18 01:19:34.000000000 +0200 @@ -10,13 +10,13 @@ #define YODA_NAME "YODA" /* Define to the full name and version of this package. */ -#define YODA_STRING "YODA 1.2.1" +#define YODA_STRING "YODA 1.3.0" /* Define to the one symbol short name of this package. */ #define YODA_TARNAME "YODA" /* Define to the version of this package. */ -#define YODA_VERSION "1.2.1" +#define YODA_VERSION "1.3.0" #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/include/YODA/Histo1D.h new/YODA-1.3.0/include/YODA/Histo1D.h --- old/YODA-1.2.1/include/YODA/Histo1D.h 2014-08-29 18:14:50.000000000 +0200 +++ new/YODA-1.3.0/include/YODA/Histo1D.h 2014-09-17 15:46:31.000000000 +0200 @@ -422,7 +422,7 @@ /// @note The two histos must have _exactly_ the same binning. /// /// @note An efficiency is not the same thing as a standard division of two - /// histograms: the errors must be treated as correlated. + /// histograms: the errors are treated as correlated via binomial statistics. Scatter2D efficiency(const Histo1D& accepted, const Histo1D& total); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/include/YODA/Histo2D.h new/YODA-1.3.0/include/YODA/Histo2D.h --- old/YODA-1.2.1/include/YODA/Histo2D.h 2014-08-29 18:16:15.000000000 +0200 +++ new/YODA-1.3.0/include/YODA/Histo2D.h 2014-09-17 15:46:05.000000000 +0200 @@ -480,10 +480,8 @@ /// @note The two histos must have _exactly_ the same binning. /// /// @note An efficiency is not the same thing as a standard division of two - /// histograms: the errors must be treated as correlated. - /// - /// @todo Implement! - // Scatter3D efficiency(const Histo2D& accepted, const Histo2D& total); + /// histograms: the errors are treated as correlated via binomial statistics. + Scatter3D efficiency(const Histo2D& accepted, const Histo2D& total); /// @brief Calculate the asymmetry (a-b)/(a+b) of two histograms diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/include/YODA/Point3D.h new/YODA-1.3.0/include/YODA/Point3D.h --- old/YODA-1.2.1/include/YODA/Point3D.h 2014-07-18 00:14:09.000000000 +0200 +++ new/YODA-1.3.0/include/YODA/Point3D.h 2014-09-17 16:32:27.000000000 +0200 @@ -310,6 +310,68 @@ //@} + /// @name Combined x/y value and error setters + //@{ + + /// Set x value and symmetric error + void setX(double x, double ex) { + setX(x); + setXErr(ex); + } + + /// Set x value and asymmetric error + void setX(double x, double exminus, double explus) { + setX(x); + setXErr(exminus, explus); + } + + /// Set x value and asymmetric error + void setX(double x, std::pair<double,double> ex) { + setX(x); + setXErr(ex); + } + + + /// Set y value and symmetric error + void setY(double y, double ey) { + setY(y); + setYErr(ey); + } + + /// Set y value and asymmetric error + void setY(double y, double eyminus, double eyplus) { + setY(y); + setYErr(eyminus, eyplus); + } + + /// Set y value and asymmetric error + void setY(double y, std::pair<double,double> ey) { + setY(y); + setYErr(ey); + } + + + /// Set z value and symmetric error + void setZ(double z, double ez) { + setZ(z); + setZErr(ez); + } + + /// Set z value and asymmetric error + void setZ(double z, double ezminus, double ezplus) { + setZ(z); + setZErr(ezminus, ezplus); + } + + /// Set z value and asymmetric error + void setZ(double z, std::pair<double,double> ez) { + setZ(z); + setZErr(ez); + } + + //@} + + // @name Manipulations //@{ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/include/YODA/Utils/BinSearcher.h new/YODA-1.3.0/include/YODA/Utils/BinSearcher.h --- old/YODA-1.2.1/include/YODA/Utils/BinSearcher.h 2014-08-29 00:59:30.000000000 +0200 +++ new/YODA-1.3.0/include/YODA/Utils/BinSearcher.h 2014-09-17 16:50:23.000000000 +0200 @@ -179,8 +179,8 @@ // Calculate mean index estimate deviations from the correct answers (for bin edges) double logsum = 0, linsum = 0; for (size_t i = 0; i < edges.size(); i++) { - logsum += fabs(logEst(edges[i]) - i); - linsum += fabs(linEst(edges[i]) - i); + logsum += logEst(edges[i]) - i; + linsum += linEst(edges[i]) - i; } const double log_avg = logsum / edges.size(); const double lin_avg = linsum / edges.size(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/pyext/Makefile.in new/YODA-1.3.0/pyext/Makefile.in --- old/YODA-1.2.1/pyext/Makefile.in 2014-09-01 23:30:33.000000000 +0200 +++ new/YODA-1.3.0/pyext/Makefile.in 2014-09-18 01:19:22.000000000 +0200 @@ -561,9 +561,9 @@ @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." @ENABLE_PYEXT_FALSE@uninstall-local: +@ENABLE_PYEXT_FALSE@clean-local: @ENABLE_PYEXT_FALSE@distclean-local: @ENABLE_PYEXT_FALSE@install-exec-local: -@ENABLE_PYEXT_FALSE@clean-local: clean: clean-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/pyext/yoda/core.cpp new/YODA-1.3.0/pyext/yoda/core.cpp --- old/YODA-1.2.1/pyext/yoda/core.cpp 2014-08-15 22:47:23.000000000 +0200 +++ new/YODA-1.3.0/pyext/yoda/core.cpp 2014-09-17 16:44:29.000000000 +0200 @@ -1,4 +1,4 @@ -/* Generated by Cython 0.20.1post0 (Debian 0.20.1+git90-g0e6e38e-1ubuntu2) on Fri Aug 15 21:47:21 2014 */ +/* Generated by Cython 0.20.1post0 (Debian 0.20.1+git90-g0e6e38e-1ubuntu2) on Wed Sep 17 15:44:26 2014 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/src/Counter.cc new/YODA-1.3.0/src/Counter.cc --- old/YODA-1.2.1/src/Counter.cc 2014-08-15 22:54:12.000000000 +0200 +++ new/YODA-1.3.0/src/Counter.cc 2014-09-30 19:44:42.000000000 +0200 @@ -39,20 +39,28 @@ Scatter1D tmp = divide(accepted, total); assert(tmp.numPoints() == 1); - // Check that the numerator is consistent with being a subset of the denominator - if (accepted.effNumEntries() > total.effNumEntries() || accepted.sumW() > total.sumW()) + /// BEGIN DIMENSIONALITY-INDEPENDENT BIT TO SHARE WITH H1 + + // Check that the numerator is consistent with being a subset of the denominator (NOT effNumEntries here!) + if (accepted.numEntries() > total.numEntries() || accepted.sumW() > total.sumW()) throw UserError("Attempt to calculate an efficiency when the numerator is not a subset of the denominator"); - // If no entries on the denominator, set eff = 0 and move to the next bin + // If no entries on the denominator, set eff = err = 0 and move to the next bin /// @todo Provide optional alt behaviours to fill with NaN or remove the invalid point, or... - /// @todo Or throw a LowStatsError exception if h.effNumEntries() == 0? - if (total.effNumEntries() == 0) tmp.point(0).setX(0.0, 0.0); + /// @todo Or throw a LowStatsError exception if h.effNumEntries() (or sumW()?) == 0? + double eff = 0, err = 0; + if (total.sumW() != 0) { + // Calculate the values and errors + // const double eff = b_acc.effNumEntries() / b_tot.effNumEntries(); + // const double ey = sqrt( b_acc.effNumEntries() * (1 - b_acc.effNumEntries()/b_tot.effNumEntries()) ) / b_tot.effNumEntries(); + eff = accepted.sumW() / total.sumW(); //< Actually this is already calculated by the division... + err = sqrt(abs( ((1-2*eff)*accepted.sumW2() + sqr(eff)*total.sumW2()) / sqr(total.sumW()) )); + // assert(point.y() == eff); //< @todo Correct? So we don't need to reset the eff on the next line? + } - // Calculate the values and errors - const double eff = accepted.sumW() / total.sumW(); //< Actually this is already calculated by the division... - const double err = sqrt(abs( ( (1-2*eff)*sqr(accepted.err()) + sqr(eff)*sqr(total.err()) ) / sqr(total.val()) )); - tmp.point(0).setX(eff, err); + /// END DIMENSIONALITY-INDEPENDENT BIT TO SHARE WITH H1 + tmp.point(0).setX(eff, err); return tmp; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/src/Histo1D.cc new/YODA-1.3.0/src/Histo1D.cc --- old/YODA-1.2.1/src/Histo1D.cc 2014-08-15 23:00:13.000000000 +0200 +++ new/YODA-1.3.0/src/Histo1D.cc 2014-09-30 19:44:40.000000000 +0200 @@ -147,25 +147,28 @@ const HistoBin1D& b_tot = total.bin(i); Point2D& point = tmp.point(i); - // Check that the numerator is consistent with being a subset of the denominator - if (b_acc.effNumEntries() > b_tot.effNumEntries() || b_acc.sumW() > b_tot.sumW()) + /// BEGIN DIMENSIONALITY-INDEPENDENT BIT TO SHARE WITH H2 + + // Check that the numerator is consistent with being a subset of the denominator (NOT effNumEntries here!) + if (b_acc.numEntries() > b_tot.numEntries() || b_acc.sumW() > b_tot.sumW()) throw UserError("Attempt to calculate an efficiency when the numerator is not a subset of the denominator"); - // If no entries on the denominator, set eff = 0 and move to the next bin + // If no entries on the denominator, set eff = err = 0 and move to the next bin /// @todo Provide optional alt behaviours to fill with NaN or remove the invalid point, or... - /// @todo Or throw a LowStatsError exception if h.effNumEntries() == 0? - if (b_tot.effNumEntries() == 0) { - point.setY(0.0, 0.0); - continue; + /// @todo Or throw a LowStatsError exception if h.effNumEntries() (or sumW()?) == 0? + double eff = 0, err = 0; + if (b_tot.sumW() != 0) { + // Calculate the values and errors + // const double eff = b_acc.effNumEntries() / b_tot.effNumEntries(); + // const double ey = sqrt( b_acc.effNumEntries() * (1 - b_acc.effNumEntries()/b_tot.effNumEntries()) ) / b_tot.effNumEntries(); + eff = b_acc.sumW() / b_tot.sumW(); //< Actually this is already calculated by the division... + err = sqrt(abs( ((1-2*eff)*b_acc.sumW2() + sqr(eff)*b_tot.sumW2()) / sqr(b_tot.sumW()) )); + // assert(point.y() == eff); //< @todo Correct? So we don't need to reset the eff on the next line? } - // Calculate the values and errors - // const double eff = b_acc.effNumEntries() / b_tot.effNumEntries(); - // const double ey = sqrt( b_acc.effNumEntries() * (1 - b_acc.effNumEntries()/b_tot.effNumEntries()) ) / b_tot.effNumEntries(); - const double eff = b_acc.sumW() / b_tot.sumW(); //< Actually this is already calculated by the division... - const double ey = sqrt(abs( ((1-2*eff)*sqr(b_acc.areaErr()) + sqr(eff)*sqr(b_tot.areaErr())) / sqr(b_tot.sumW()) )); - // assert(point.y() == eff); //< @todo Correct? So we don't need to reset the eff on the next line? - point.setY(eff, ey); + /// END DIMENSIONALITY-INDEPENDENT BIT TO SHARE WITH H2 + + point.setY(eff, err); } return tmp; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/src/Histo2D.cc new/YODA-1.3.0/src/Histo2D.cc --- old/YODA-1.2.1/src/Histo2D.cc 2014-08-15 23:02:14.000000000 +0200 +++ new/YODA-1.3.0/src/Histo2D.cc 2014-09-30 19:44:33.000000000 +0200 @@ -290,11 +290,47 @@ Scatter3D divide(const Histo2D& numer, const Histo2D& denom) { + /// @todo Implement without conversion to scatters; scatter division is a flawed idea return divide(mkScatter(numer), mkScatter(denom)); } - /// @todo Add efficiency(Histo2D, Histo2D) + Scatter3D efficiency(const Histo2D& accepted, const Histo2D& total) { + Scatter3D tmp = divide(accepted, total); + for (size_t i = 0; i < accepted.numBins(); ++i) { + const HistoBin2D& b_acc = accepted.bin(i); + const HistoBin2D& b_tot = total.bin(i); + Point3D& point = tmp.point(i); + + /// BEGIN DIMENSIONALITY-INDEPENDENT BIT TO SHARE WITH H1 + + // Check that the numerator is consistent with being a subset of the denominator (NOT effNumEntries here!) + if (b_acc.numEntries() > b_tot.numEntries() || b_acc.sumW() > b_tot.sumW()) + throw UserError("Attempt to calculate an efficiency when the numerator is not a subset of the denominator"); + + // If no entries on the denominator, set eff = err = 0 and move to the next bin + /// @todo Provide optional alt behaviours to fill with NaN or remove the invalid point, or... + /// @todo Or throw a LowStatsError exception if h.effNumEntries() (or sumW()?) == 0? + double eff = 0, err = 0; + if (b_tot.sumW() != 0) { + // Calculate the values and errors + // const double eff = b_acc.effNumEntries() / b_tot.effNumEntries(); + // const double ey = sqrt( b_acc.effNumEntries() * (1 - b_acc.effNumEntries()/b_tot.effNumEntries()) ) / b_tot.effNumEntries(); + eff = b_acc.sumW() / b_tot.sumW(); //< Actually this is already calculated by the division... + err = sqrt(abs( ((1-2*eff)*b_acc.sumW2() + sqr(eff)*b_tot.sumW2()) / sqr(b_tot.sumW()) )); + // assert(point.y() == eff); //< @todo Correct? So we don't need to reset the eff on the next line? + } + + /// END DIMENSIONALITY-INDEPENDENT BIT TO SHARE WITH H1 + + point.setZ(eff, err); + } + return tmp; + + } + + + /// @todo Add asymm for 2D histos? } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/src/Profile1D.cc new/YODA-1.3.0/src/Profile1D.cc --- old/YODA-1.2.1/src/Profile1D.cc 2014-08-15 23:00:22.000000000 +0200 +++ new/YODA-1.3.0/src/Profile1D.cc 2014-09-17 16:08:32.000000000 +0200 @@ -102,4 +102,7 @@ } + /// @todo Add asymm for profile histos? + + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/src/Profile2D.cc new/YODA-1.3.0/src/Profile2D.cc --- old/YODA-1.2.1/src/Profile2D.cc 2014-08-15 23:02:19.000000000 +0200 +++ new/YODA-1.3.0/src/Profile2D.cc 2014-09-17 16:08:44.000000000 +0200 @@ -170,4 +170,8 @@ return divide(mkScatter(numer), mkScatter(denom)); } + + /// @todo Add asymm for profile histos? + + } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/tests/TestBinSearcher.cc new/YODA-1.3.0/tests/TestBinSearcher.cc --- old/YODA-1.2.1/tests/TestBinSearcher.cc 2014-07-23 17:20:11.000000000 +0200 +++ new/YODA-1.3.0/tests/TestBinSearcher.cc 2014-09-03 18:14:50.000000000 +0200 @@ -36,5 +36,17 @@ TESTBS(bs2, 101, 11); TESTBS(bs2, 102, 11); + const vector<double> linedges2 = linspace(10, -1, 101); + cout << "Lin edges starting below 0: "; BOOST_FOREACH(double x, logedges) cout << x << " "; cout << endl; + YODA::Utils::BinSearcher bs3(linedges2); + TESTBS(bs3, -1-1e-5, 0); + TESTBS(bs3, -1, 1); + TESTBS(bs3, 0, 1); + TESTBS(bs3, 1, 1); + TESTBS(bs3, 2, 1); + TESTBS(bs3, 100, 10); + TESTBS(bs3, 101, 11); + TESTBS(bs3, 102, 11); + return rtn; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/YODA-1.2.1/yoda.pc new/YODA-1.3.0/yoda.pc --- old/YODA-1.2.1/yoda.pc 2014-09-01 23:30:54.000000000 +0200 +++ new/YODA-1.3.0/yoda.pc 2014-09-18 01:19:34.000000000 +0200 @@ -7,7 +7,7 @@ Name: yoda Description: YODA data analysis library URL: https://yoda.hepforge.org -Version: 1.2.1 +Version: 1.3.0 Libs: -L${exec_prefix}/lib -lYODA Cflags: -I${prefix}/include #-I -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
