00001 #include<iostream>
00002 #include"AtlfastAlgs/ISmearer.h"
00003 #include"AtlfastAlgs/CellSmearer.h"
00004 #include"AtlfastAlgs/ElectronSmearer.h"
00005 #include"AtlfastAlgs/PhotonSmearer.h"
00006 #include"AtlfastAlgs/MuonSmearer.h"
00007 #include"AtlfastAlgs/JetSmearer.h"
00008
00009
00010
00011 #include "CLHEP/Vector/LorentzVector.h"
00012
00013
00014
00015 #include <boost/test/included/unit_test_framework.hpp>
00016 #include <boost/test/unit_test.hpp>
00017
00018 using namespace boost::unit_test_framework;
00019
00020 using Atlfast::ISmearer;
00021 using Atlfast::CellSmearer;
00022 using Atlfast::ElectronSmearer;
00023 using Atlfast::PhotonSmearer;
00024 using Atlfast::MuonSmearer;
00025 using Atlfast::JetSmearer;
00026
00027
00028
00029
00030
00031
00032
00033
00034 void CellSmearerTest1(){
00035 ISmearer* is = new CellSmearer(1234, 3.2);
00036 HepLorentzVector v(10., 10., 10., sqrt(300));
00037 HepLorentzVector sv = is->smear(v);
00038
00039 BOOST_CHECK(v.isParallel(sv) );
00040 BOOST_CHECK(v.t() != sv.t() );
00041 }
00042
00043 void ElectronSmearerTest1(){
00044 ISmearer* is = new ElectronSmearer(1234, 0);
00045 HepLorentzVector v(10., 10., 10., sqrt(300));
00046 HepLorentzVector sv = is->smear(v);
00047
00048 BOOST_CHECK(v.isParallel(sv) );
00049 BOOST_CHECK(v.t() != sv.t() );
00050 }
00051
00052
00053 void MuonSmearerTest1(){
00054 ISmearer* is = new MuonSmearer(1234, 0, 1);
00055 HepLorentzVector v(10., 10., 10., sqrt(300));
00056 HepLorentzVector sv = is->smear(v);
00057
00058 BOOST_CHECK(v.isParallel(sv) );
00059 BOOST_CHECK(v.t() != sv.t() );
00060 }
00061
00062
00063 void PhotonSmearerTest1(){
00064 ISmearer* is = new PhotonSmearer(1234, 0);
00065 HepLorentzVector v(10., 10., 10., sqrt(300));
00066 HepLorentzVector sv = is->smear(v);
00067
00068 BOOST_CHECK(v.isParallel(sv) );
00069 BOOST_CHECK(v.t() != sv.t() );
00070 }
00071
00072 void JetSmearerTest1(){
00073
00074
00075 ISmearer* is = new JetSmearer(1234, 0, 0.4, 0.4, 3.2);
00076
00077 HepLorentzVector v(10., 10., 10., sqrt(300));
00078 HepLorentzVector sv = is->smear(v);
00079
00080 BOOST_CHECK(v.isParallel(sv) );
00081 BOOST_CHECK(v.t() != sv.t() );
00082
00083 }
00084
00085 test_suite* init_unit_test_suite(int argc, char* argv[]){
00086 test_suite* test = BOOST_TEST_SUITE("Smearerer Tests");
00087 test->add(BOOST_TEST_CASE(&CellSmearerTest1) );
00088 test->add(BOOST_TEST_CASE(&ElectronSmearerTest1) );
00089
00090 test->add(BOOST_TEST_CASE(&MuonSmearerTest1) );
00091 test->add(BOOST_TEST_CASE(&JetSmearerTest1) );
00092
00093 return test;
00094 }
00095