Page MenuHomeHEPForge

No OneTemporary

diff --git a/Utilities/tests/utilitiesTestsGlobalFixture.h b/Utilities/tests/utilitiesTestsGlobalFixture.h
--- a/Utilities/tests/utilitiesTestsGlobalFixture.h
+++ b/Utilities/tests/utilitiesTestsGlobalFixture.h
@@ -1,28 +1,29 @@
// -*- C++ -*-
//
// utilitiesTestGlobalFixture.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration, 2015 Marco A. Harrendorf
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#include <boost/test/unit_test.hpp>
#include "ThePEG/Repository/StandardRandom.h"
#include "ThePEG/Repository/UseRandom.h"
+#include "ThePEG/Config/Unitsystem.h"
#include <iostream>
struct FixGlobal1 {
FixGlobal1() {
BOOST_TEST_MESSAGE( "setup global fixture for utilitiesTest" );
// Initialize randomNumberGenerator
ThePEG::StandardRandom* randomNumberStandardGenerator = new ThePEG::StandardRandom();
new ThePEG::UseRandom(randomNumberStandardGenerator);
}
~FixGlobal1() { BOOST_TEST_MESSAGE( "teardown global fixture for utilitiesTest" ); }
};
BOOST_GLOBAL_FIXTURE(FixGlobal1)
\ No newline at end of file
diff --git a/Utilities/tests/utilitiesTestsKinematics.h b/Utilities/tests/utilitiesTestsKinematics.h
--- a/Utilities/tests/utilitiesTestsKinematics.h
+++ b/Utilities/tests/utilitiesTestsKinematics.h
@@ -1,47 +1,121 @@
// -*- C++ -*-
//
// utilitiesTestKinematics.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration, 2015 Marco A. Harrendorf
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_Utilities_Test_Kinematics_H
#define HERWIG_Utilities_Test_Kinematics_H
#include <boost/test/unit_test.hpp>
#include "Herwig++/Utilities/Kinematics.h"
+#include "ThePEG/Config/Unitsystem.h"
+
+
struct FixKinematics1 {
FixKinematics1()
{BOOST_TEST_MESSAGE( "setup fixture for utilitiesKinematicsTestTest" ); }
~FixKinematics1() { BOOST_TEST_MESSAGE( "teardown fixture for utilitiesKinematicsTest" ); }
};
/*
* Start of boost unit tests for Kinematics.h
- *
+ *
+ * @todo Implement unit test for threeBodyDecay
*/
BOOST_AUTO_TEST_SUITE(utilitiesKinematicsTest)
/*
* Boost unit tests
*
*/
BOOST_AUTO_TEST_CASE(generateAnglestest)
{
double flatMinusPiToPlusPi, flatNullToTwoPi;
for(int i = 0; i < 100; ++i) {
Herwig::Kinematics::generateAngles(flatMinusPiToPlusPi, flatNullToTwoPi);
BOOST_CHECK( -M_PI <= flatMinusPiToPlusPi );
BOOST_CHECK( flatMinusPiToPlusPi <= M_PI);
BOOST_CHECK( 0. <= flatNullToTwoPi);
BOOST_CHECK(flatNullToTwoPi <= 2*M_PI);
}
}
+
+BOOST_AUTO_TEST_CASE(unitDirection)
+{
+ BOOST_CHECK_EQUAL( Herwig::Kinematics::unitDirection(1.1, -1), ThePEG::Units::Axis());
+ BOOST_CHECK_EQUAL( Herwig::Kinematics::unitDirection(-1.1, -1), ThePEG::Units::Axis());
+ BOOST_CHECK_EQUAL( Herwig::Kinematics::unitDirection(1.1, 0), ThePEG::Units::Axis());
+ BOOST_CHECK_EQUAL( Herwig::Kinematics::unitDirection(-1.1, -1), ThePEG::Units::Axis());
+
+ BOOST_CHECK_EQUAL( Herwig::Kinematics::unitDirection(1, 0), ThePEG::Units::Axis(0, 0, 1));
+ BOOST_CHECK_EQUAL( Herwig::Kinematics::unitDirection(1, M_PI/2.), ThePEG::Units::Axis(0, 0, 1));
+
+ BOOST_CHECK(Herwig::Kinematics::unitDirection(0, M_PI/2).almostEqual(ThePEG::Units::Axis(0, 1, 0), 0.001));
+ BOOST_CHECK_EQUAL( Herwig::Kinematics::unitDirection(0, 0), ThePEG::Units::Axis(1, 0, 0));
+}
+
+BOOST_AUTO_TEST_CASE(pstarTwoBodyDecay)
+{
+ BOOST_CHECK_EQUAL(Herwig::Kinematics::pstarTwoBodyDecay(ThePEG::Units::Energy(-100), ThePEG::Units::Energy(60), ThePEG::Units::Energy(60)), ThePEG::Units::Energy(0));
+ BOOST_CHECK_EQUAL(Herwig::Kinematics::pstarTwoBodyDecay(ThePEG::Units::Energy(100), ThePEG::Units::Energy(-40), ThePEG::Units::Energy(40)), ThePEG::Units::Energy(0));
+ BOOST_CHECK_EQUAL(Herwig::Kinematics::pstarTwoBodyDecay(ThePEG::Units::Energy(100), ThePEG::Units::Energy(-40), ThePEG::Units::Energy(-40)), ThePEG::Units::Energy(0));
+
+ BOOST_CHECK_EQUAL(Herwig::Kinematics::pstarTwoBodyDecay(ThePEG::Units::Energy(100), ThePEG::Units::Energy(60), ThePEG::Units::Energy(60)), ThePEG::Units::Energy(0));
+ BOOST_CHECK_EQUAL(Herwig::Kinematics::pstarTwoBodyDecay(ThePEG::Units::Energy(100), ThePEG::Units::Energy(50), ThePEG::Units::Energy(50)), ThePEG::Units::Energy(0));
+
+ BOOST_CHECK_EQUAL(Herwig::Kinematics::pstarTwoBodyDecay(ThePEG::Units::Energy(10), ThePEG::Units::Energy(6), ThePEG::Units::Energy(3)), ThePEG::Units::Energy(std::sqrt(19*91)/20.));
+ BOOST_CHECK_EQUAL(Herwig::Kinematics::pstarTwoBodyDecay(ThePEG::Units::Energy(10), ThePEG::Units::Energy(3), ThePEG::Units::Energy(6)), ThePEG::Units::Energy(std::sqrt(19*91)/20.));
+}
+
+BOOST_AUTO_TEST_CASE(twoBodyDecay1)
+{
+ ThePEG::Units::Lorentz5Momentum decayProductOne(1);
+ ThePEG::Units::Lorentz5Momentum decayProductTwo(1);
+ BOOST_CHECK(Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(100), ThePEG::Units::Energy(40), ThePEG::Units::Energy(40), ThePEG::Units::Axis(), decayProductOne, decayProductTwo));
+ BOOST_CHECK(Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(100), ThePEG::Units::Energy(50), ThePEG::Units::Energy(50), ThePEG::Units::Axis(), decayProductOne, decayProductTwo));
+
+ BOOST_CHECK(!(Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(100), ThePEG::Units::Energy(60), ThePEG::Units::Energy(60), ThePEG::Units::Axis(), decayProductOne, decayProductTwo)));
+ BOOST_CHECK(!(Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(-100), ThePEG::Units::Energy(40), ThePEG::Units::Energy(40), ThePEG::Units::Axis(), decayProductOne, decayProductTwo)));
+ BOOST_CHECK(!(Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(100), ThePEG::Units::Energy(-40), ThePEG::Units::Energy(40), ThePEG::Units::Axis(), decayProductOne, decayProductTwo)));
+ BOOST_CHECK(!(Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(100), ThePEG::Units::Energy(40), ThePEG::Units::Energy(-40), ThePEG::Units::Axis(), decayProductOne, decayProductTwo)));
+
+ Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(100), ThePEG::Units::Energy(50), ThePEG::Units::Energy(50), ThePEG::Units::Axis(1,0,0), decayProductOne, decayProductTwo);
+ BOOST_CHECK_EQUAL(decayProductOne, ThePEG::Units::Lorentz5Momentum(50));
+ BOOST_CHECK_EQUAL(decayProductTwo, ThePEG::Units::Lorentz5Momentum(50));
+
+ Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(10), ThePEG::Units::Energy(6), ThePEG::Units::Energy(3), ThePEG::Units::Axis(1,0,0), decayProductOne, decayProductTwo);
+ BOOST_CHECK_EQUAL(decayProductOne, ThePEG::Units::Lorentz5Momentum(6, ThePEG::Units::Momentum3(std::sqrt(19*91)/20., 0, 0)));
+ BOOST_CHECK_EQUAL(decayProductTwo, ThePEG::Units::Lorentz5Momentum(3, ThePEG::Units::Momentum3(-(std::sqrt(19*91)/20.), 0, 0)));
+}
+
+BOOST_AUTO_TEST_CASE(twoBodyDecay2)
+{
+ ThePEG::Units::Lorentz5Momentum decayProductOne(1);
+ ThePEG::Units::Lorentz5Momentum decayProductTwo(1);
+ BOOST_CHECK(Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(100), ThePEG::Units::Energy(40), ThePEG::Units::Energy(40), 1, M_PI/2., decayProductOne, decayProductTwo));
+ BOOST_CHECK(Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(100), ThePEG::Units::Energy(50), ThePEG::Units::Energy(50), 1, M_PI/2., decayProductOne, decayProductTwo));
+
+ BOOST_CHECK(!(Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(100), ThePEG::Units::Energy(60), ThePEG::Units::Energy(60), 1, M_PI/2., decayProductOne, decayProductTwo)));
+ BOOST_CHECK(!(Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(-100), ThePEG::Units::Energy(40), ThePEG::Units::Energy(40), 1, M_PI/2., decayProductOne, decayProductTwo)));
+ BOOST_CHECK(!(Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(100), ThePEG::Units::Energy(-40), ThePEG::Units::Energy(40), 1, M_PI/2., decayProductOne, decayProductTwo)));
+ BOOST_CHECK(!(Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(100), ThePEG::Units::Energy(40), ThePEG::Units::Energy(-40), 1, M_PI/2., decayProductOne, decayProductTwo)));
+
+ Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(100), ThePEG::Units::Energy(50), ThePEG::Units::Energy(50), 1, M_PI/2., decayProductOne, decayProductTwo);
+ BOOST_CHECK_EQUAL(decayProductOne, ThePEG::Units::Lorentz5Momentum(50));
+ BOOST_CHECK_EQUAL(decayProductTwo, ThePEG::Units::Lorentz5Momentum(50));
+
+ Herwig::Kinematics::twoBodyDecay(ThePEG::Units::Lorentz5Momentum(10), ThePEG::Units::Energy(6), ThePEG::Units::Energy(3), 1, M_PI/2., decayProductOne, decayProductTwo);
+ BOOST_CHECK_EQUAL(decayProductOne, ThePEG::Units::Lorentz5Momentum(6, ThePEG::Units::Momentum3(0, 0, std::sqrt(19*91)/20.)));
+ BOOST_CHECK_EQUAL(decayProductTwo, ThePEG::Units::Lorentz5Momentum(3, ThePEG::Units::Momentum3(0, 0, -(std::sqrt(19*91)/20.))));
+}
+
BOOST_AUTO_TEST_SUITE_END()
#endif /* HERWIG_Utilities_Test_Kinematics_H */
\ No newline at end of file
diff --git a/Utilities/tests/utilitiesTestsStatistic.h b/Utilities/tests/utilitiesTestsStatistic.h
--- a/Utilities/tests/utilitiesTestsStatistic.h
+++ b/Utilities/tests/utilitiesTestsStatistic.h
@@ -1,89 +1,89 @@
// -*- C++ -*-
//
-// utilitiesTestStatistic.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
+// utilitiesTestStatistic.h is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2011 The Herwig Collaboration, 2015 Marco A. Harrendorf
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef HERWIG_Utilities_Test_Statistic_H
#define HERWIG_Utilities_Test_Statistic_H
#include <boost/test/unit_test.hpp>
#include "Herwig++/Utilities/Statistic.h"
/*
* Fixture which defines the common variables for testing Statistic class
*/
struct FixStatistic1 {
FixStatistic1() : statisticDefault(), statisticTest()
{BOOST_TEST_MESSAGE( "setup fixture for utilitiesStatisticTest" ); }
~FixStatistic1() { BOOST_TEST_MESSAGE( "teardown fixture for utilitiesStatisticTest" ); }
Herwig::Statistic statisticDefault;
Herwig::Statistic statisticTest;
};
/*
* Start of boost unit tests for Statistic.h
*
*/
BOOST_FIXTURE_TEST_SUITE(utilitiesStatisticTest, FixStatistic1 )
/*
* Boost unit tests
*
*/
BOOST_AUTO_TEST_CASE(defaultConstructor)
{
BOOST_CHECK_EQUAL(statisticDefault.numberOfPoints(), static_cast<unsigned int>(0));
BOOST_CHECK_EQUAL(statisticDefault.total(), 0.);
BOOST_CHECK_EQUAL(statisticDefault.mean(), 0.);
BOOST_CHECK_EQUAL(statisticDefault.minimum(), -1e100);
BOOST_CHECK_EQUAL(statisticDefault.maximum(), 1e100);
BOOST_CHECK_EQUAL(statisticDefault.var(), 0);
BOOST_CHECK_EQUAL(statisticDefault.mean_var(), 0);
}
BOOST_AUTO_TEST_CASE(operations)
{
statisticTest += 2;
BOOST_CHECK_EQUAL(statisticTest.minimum(), 2);
BOOST_CHECK_EQUAL(statisticTest.maximum(), 2);
statisticTest += -2;
BOOST_CHECK_EQUAL(statisticTest.numberOfPoints(), static_cast<unsigned int>(2));
BOOST_CHECK_EQUAL(statisticTest.total(), 0.);
BOOST_CHECK_EQUAL(statisticTest.mean(), 0.);
BOOST_CHECK_EQUAL(statisticTest.minimum(), -2);
BOOST_CHECK_EQUAL(statisticTest.maximum(), 2);
BOOST_CHECK_EQUAL(statisticTest.var(), 8);
BOOST_CHECK_EQUAL(statisticTest.stdDev(), sqrt(8));
BOOST_CHECK_EQUAL(statisticTest.mean_var(), 4);
BOOST_CHECK_EQUAL(statisticTest.mean_stdDev(), 2);
statisticTest += 2;
BOOST_CHECK_EQUAL(statisticTest.numberOfPoints(), static_cast<unsigned int>(3));
BOOST_CHECK_EQUAL(statisticTest.total(), 2.);
BOOST_CHECK_EQUAL(statisticTest.mean(), 2./3.);
BOOST_CHECK_EQUAL(statisticTest.minimum(), -2);
BOOST_CHECK_EQUAL(statisticTest.maximum(), 2);
BOOST_CHECK_EQUAL(statisticTest.var(), 16./3.);
BOOST_CHECK_EQUAL(statisticTest.stdDev(), sqrt(16./3.));
BOOST_CHECK_EQUAL(statisticTest.mean_var(), 16./9.);
BOOST_CHECK_EQUAL(statisticTest.mean_stdDev(), sqrt(16./9.));
statisticTest += 4.5;
BOOST_CHECK_EQUAL(statisticTest.minimum(), -2);
BOOST_CHECK_EQUAL(statisticTest.maximum(), 4.5);
statisticTest += -3.5;
BOOST_CHECK_EQUAL(statisticTest.minimum(), -3.5);
BOOST_CHECK_EQUAL(statisticTest.maximum(), 4.5);
}
BOOST_AUTO_TEST_SUITE_END()
#endif /* HERWIG_Utilities_Test_Statistic_H */
\ No newline at end of file

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 2:48 PM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3802236
Default Alt Text
(12 KB)

Event Timeline