#include <Event.h>
#include <Jet.h>
#include <MetaInfo.h>
#include <Variation.h>
#include <TList.h>
#include <TObjString.h>
#include <boost/test/included/unit_test.hpp>
#include <boost/exception/all.hpp>
◆ BOOST_TEST_MODULE
◆ BOOST_AUTO_TEST_CASE() [1/5]
BOOST_AUTO_TEST_CASE |
( |
bSF_like |
| ) |
|
98 auto bSFstatbins = metainfo.AddVars(RecJet::WeightVar, {
"bSFstat"},
symmetric |
bits, 8);
100 for (
const auto& bSFstatbin: bSFstatbins)
101 cout << bSFstatbin <<
'\n';
104 BOOST_TEST( metainfo.GetVars(RecJet::WeightVar).size() == bSFstatbins.size() );
◆ BOOST_AUTO_TEST_CASE() [2/5]
BOOST_AUTO_TEST_CASE |
( |
JES_like |
| ) |
|
49 auto JEC = metainfo.AddVars(RecJet::ScaleVar, {
"FlavourQCD",
"PtBalance"});
51 for (
const auto& jes: JEC)
55 BOOST_TEST( metainfo.GetVars(RecJet::ScaleVar,
"JER").size() == 0 );
56 JEC.merge(metainfo.AddVars(RecJet::ScaleVar, {
"JER"}));
59 BOOST_TEST( metainfo.GetVars(RecJet::ScaleVar,
"JER").size() == 2 );
60 BOOST_TEST( metainfo.GetVars(RecJet::ScaleVar ).size() == JEC.size() );
61 BOOST_TEST( metainfo.GetVars( ).size() == JEC.size()+1 );
62 for (
const auto& v: metainfo.GetVars())
66 BOOST_TEST_MESSAGE(
"Testing an erroneous regex" );
67 BOOST_REQUIRE_THROW( metainfo.GetVars(RecJet::ScaleVar,
"\\w{"), wrapexcept<regex_error> );
69 BOOST_TEST_MESSAGE(
"Testing a wrong number of members" );
70 BOOST_REQUIRE_THROW( metainfo.AddVars(RecJet::ScaleVar, {
"JER"},
symmetric, 0), wrapexcept<invalid_argument> );
◆ BOOST_AUTO_TEST_CASE() [3/5]
BOOST_AUTO_TEST_CASE |
( |
model_like |
| ) |
|
31 auto models = metainfo.AddVars(GenEvent::WeightVar, {
"Pythia",
"Herwig"},
single);
33 for (
const auto& model: models)
34 cout << model <<
'\n';
37 BOOST_REQUIRE_NO_THROW( metainfo.GetVars(GenEvent::WeightVar) );
38 BOOST_TEST( metainfo.GetVars(GenEvent::WeightVar).size() == models.size() );
39 BOOST_REQUIRE_THROW( metainfo.GetVars(RecEvent::WeightVar), wrapexcept<invalid_argument> );
41 BOOST_REQUIRE_THROW( metainfo.AddVars(GenEvent::WeightVar, {
"MadGraph"},
single, 2), wrapexcept<invalid_argument> );
43 metainfo.Set<
int>(
"variations",
"GenEvtWgts",
"Vincia", 0);
44 BOOST_REQUIRE_THROW( metainfo.GetVars(GenEvent::WeightVar,
"Vincia"), wrapexcept<invalid_argument> );
◆ BOOST_AUTO_TEST_CASE() [4/5]
BOOST_AUTO_TEST_CASE |
( |
prefiring_like |
| ) |
|
87 auto prefbins = metainfo.AddVars(RecEvent::WeightVar, {
"Prefiring"},
symmetric |
replicas, 20);
89 for (
const auto& prefbin: prefbins)
90 cout << prefbin <<
'\n';
93 BOOST_TEST( metainfo.GetVars(RecEvent::WeightVar).size() == prefbins.size() );
◆ BOOST_AUTO_TEST_CASE() [5/5]
BOOST_AUTO_TEST_CASE |
( |
replica_like |
| ) |
|
76 auto replicae = metainfo.AddVars(GenEvent::WeightVar, {
"Replica"},
replicas, 10);
78 for (
const auto& replica: replicae)
79 cout << replica <<
'\n';
82 BOOST_TEST( metainfo.GetVars(GenEvent::WeightVar).size() == replicae.size() );