|
[Rivet-svn] r3436 - in trunk: . testblackhole at projects.hepforge.org blackhole at projects.hepforge.orgWed Oct 12 16:17:15 BST 2011
Author: buckley Date: Wed Oct 12 16:17:15 2011 New Revision: 3436 Log: Adding a separate math function test program Added: trunk/test/testMath.cc Modified: trunk/ChangeLog trunk/test/Makefile.am trunk/test/testMatVec.cc Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Tue Oct 11 15:13:21 2011 (r3435) +++ trunk/ChangeLog Wed Oct 12 16:17:15 2011 (r3436) @@ -1,9 +1,22 @@ +2011-10-12 Andy Buckley <andy at insectnation.org> + + * Adding a separate test program for non-matrix/vector math + functions, and adding a new set of int/float literal arg tests for + the inRange functions in it. + + * Adding a jet multiplicity plot for jets with pT > 30 GeV to + MC_TTBAR. + 2011-10-11 James Monk <jmonk at cern.ch> - * root2flat was missing the first bin (plus spurious last bin) - * my version of bash does not understand the pipe syntax |& in rivet-buildplugin + + * root2flat was missing the first bin (plus spurious last bin) + + * My version of bash does not understand the pipe syntax |& in rivet-buildplugin 2011-09-30 James Monk <jmonk at cern.ch> - * fix bug in ATLAS_2010_S8817804 that misidentified the akt4 jets as akt6 + + * Fix bug in ATLAS_2010_S8817804 that misidentified the akt4 jets + as akt6 2011-09-29 Andy Buckley <andy at insectnation.org> Modified: trunk/test/Makefile.am ============================================================================== --- trunk/test/Makefile.am Tue Oct 11 15:13:21 2011 (r3435) +++ trunk/test/Makefile.am Wed Oct 12 16:17:15 2011 (r3436) @@ -1,8 +1,11 @@ -check_PROGRAMS = testMatVec testBoost testCmp testApi +check_PROGRAMS = testMath testMatVec testBoost testCmp testApi testBoost_SOURCES = testBoost.cc testBoost_CPPFLAGS = -I$(top_srcdir)/include $(AM_CPPFLAGS) +testMath_SOURCES = testMath.cc +testMath_CPPFLAGS = -I$(top_srcdir)/include $(AM_CPPFLAGS) + testMatVec_SOURCES = testMatVec.cc testMatVec_LDADD = -lm $(GSL_LDFLAGS) testMatVec_CPPFLAGS = -I$(top_srcdir)/include $(AM_CPPFLAGS) @@ -22,7 +25,7 @@ PYTHON_BUILD_DIR=$(top_builddir)/pyext/build \ PATH=$(top_builddir)/bin:$(PATH) -TESTS = testMatVec testBoost testCmp testApi testCmdLine.sh +TESTS = testMath testMatVec testBoost testCmp testApi testCmdLine.sh EXTRA_DIST = testApi.hepmc testCmdLine.sh Modified: trunk/test/testMatVec.cc ============================================================================== --- trunk/test/testMatVec.cc Tue Oct 11 15:13:21 2011 (r3435) +++ trunk/test/testMatVec.cc Wed Oct 12 16:17:15 2011 (r3436) @@ -7,9 +7,9 @@ #include "Rivet/Math/Matrices.hh" using namespace std; +using namespace Rivet; int main() { - using namespace Rivet; FourVector a(1,0,0,0); cout << a << ": interval = " << a.invariant() << endl; @@ -140,27 +140,5 @@ cout << (ltY * ltX).boost() << endl; cout << (ltX * ltX.inverse()).boost() << endl; - //////////// - - // Angle tests - assert(fuzzyEquals(angle(FourMomentum(1,0,0,1), FourMomentum(1,0,0,1))/M_PI, 0.0)); - assert(fuzzyEquals(angle(FourMomentum(1,0,0,1), FourMomentum(1,0,1,0))/M_PI, 0.5)); - assert(fuzzyEquals(angle(FourMomentum(1,0,0,1), FourMomentum(1,0,0,-1))/M_PI, 1.0)); - // Test with vectors of different magnitude - assert(fuzzyEquals(angle(FourMomentum(3,0,0,3), FourMomentum(1,0,0,1))/M_PI, 0.0)); - assert(fuzzyEquals(angle(FourMomentum(5,0,0,5), FourMomentum(1,0,1,0))/M_PI, 0.5)); - assert(fuzzyEquals(angle(FourMomentum(7,0,0,7), FourMomentum(1,0,0,-1))/M_PI, 1.0)); - - //////////// - - linspace(0, 10, 50); - logspace(0.000001, 1.0, 50); - - assert(isZero(1e-15)); - assert(fuzzyEquals(1e-15, 0.0)); - assert(fuzzyEquals(2.0, 2.0)); - assert(!fuzzyEquals(1, 2.0)); - assert(fuzzyGtrEquals(1.0, 1.0 - 1e-15)); - return EXIT_SUCCESS; } Added: trunk/test/testMath.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/test/testMath.cc Wed Oct 12 16:17:15 2011 (r3436) @@ -0,0 +1,43 @@ +#include <iostream> +#include <limits> +#include <cassert> + +#include "Rivet/Math/MathUtils.hh" +#include "Rivet/Math/Vectors.hh" + +using namespace std; +using namespace Rivet; + +int main() { + + // Angle tests + assert(fuzzyEquals(angle(FourMomentum(1,0,0,1), FourMomentum(1,0,0,1))/M_PI, 0.0)); + assert(fuzzyEquals(angle(FourMomentum(1,0,0,1), FourMomentum(1,0,1,0))/M_PI, 0.5)); + assert(fuzzyEquals(angle(FourMomentum(1,0,0,1), FourMomentum(1,0,0,-1))/M_PI, 1.0)); + // Test with vectors of different magnitude + assert(fuzzyEquals(angle(FourMomentum(3,0,0,3), FourMomentum(1,0,0,1))/M_PI, 0.0)); + assert(fuzzyEquals(angle(FourMomentum(5,0,0,5), FourMomentum(1,0,1,0))/M_PI, 0.5)); + assert(fuzzyEquals(angle(FourMomentum(7,0,0,7), FourMomentum(1,0,0,-1))/M_PI, 1.0)); + + //////////// + + linspace(0, 10, 50); + logspace(0.000001, 1.0, 50); + + inRange(1, 0, 2); + inRange(1, 0.0, 2); + inRange(1, 0, 2.0); + inRange(1, 0.0, 2.0); + inRange(1.0, 0, 2); + inRange(1.0, 0.0, 2); + inRange(1.0, 0, 2.0); + inRange(1.0, 0.0, 2.0); + + assert(isZero(1e-15)); + assert(fuzzyEquals(1e-15, 0.0)); + assert(fuzzyEquals(2.0, 2.0)); + assert(!fuzzyEquals(1, 2.0)); + assert(fuzzyGtrEquals(1.0, 1.0 - 1e-15)); + + return EXIT_SUCCESS; +}
More information about the Rivet-svn mailing list |