#include <boost/test/included/unit_test.hpp>
#include <iostream>
#include <map>
#include <TFile.h>
#include <TTree.h>
#include <Di.h>
#include <Jet.h>
◆ BOOST_TEST_MODULE
#define BOOST_TEST_MODULE Di |
◆ BOOST_AUTO_TEST_CASE() [1/2]
BOOST_AUTO_TEST_CASE |
( |
dijet |
| ) |
|
53 vector<GenJet> *
genjets =
new vector<GenJet>;
55 bool valid =
static_cast<bool>(*gendijet);
63 valid =
static_cast<bool>(*gendijet);
66 auto f = make_unique<TFile>(
"di.root",
"RECREATE");
68 cout <<
"Creating tree" << endl;
70 auto t = make_unique<TTree>(
"tree",
"tree");
83 cout <<
"Reading tree" << endl;
85 auto t = unique_ptr<TTree>(
f->Get<TTree>(
"tree"));
87 cout <<
"Checking genJets" << endl;
88 t->Scan(
"genJets.CorrPt()");
89 cout <<
"Checking genDijet" << endl;
90 t->Scan(
"genDijet.first.CorrPt():genDijet.second.CorrPt():genDijet.HT()");
91 cout <<
"Setting branch addresses" << endl;
92 t->SetBranchAddress(
"genJets", &
genjets);
93 t->SetBranchAddress(
"genDijet", &
gendijet);
◆ BOOST_AUTO_TEST_CASE() [2/2]
BOOST_AUTO_TEST_CASE |
( |
variations |
| ) |
|
132 map<int, double> bits_results {{1,1.5}, {2,1.5}, {3,1.0}};
133 for (
auto bit_result: bits_results) {
134 int bit = bit_result.first;
135 double result = bit_result.second;
137 cout <<
"1st-jet weight: " <<
genjets.at(0).Weight(v) <<
'\n'
138 <<
"2nd-jet weight: " <<
genjets.at(1).Weight(v) <<
'\n'
139 <<
"dijet weight: " <<
gendijet.Weight(v) << endl;
143 for (
int i = 1; i <= 2; ++i) {
145 cout <<
"1st-jet corrected pt: " <<
genjets.at(0).CorrPt(v) <<
'\n'
146 <<
"2nd-jet corrected pt: " <<
genjets.at(1).CorrPt(v) <<
'\n'
147 <<
"dijet corrected pt: " <<
gendijet.CorrPt(v) <<
'\n'
148 <<
"dijet corrected HT: " <<
gendijet.HT(v) << endl;
◆ BOOST_TEST()
BOOST_TEST |
( |
gendijet. |
Rapidity() = =1.3573785791881385 | ) |
|
◆ GetDummyGenJets()
vector<GenJet> GetDummyGenJets |
( |
| ) |
|
29 genjet1.
p4 = {1,1,1,1};
30 genjet2.
p4 = {2,2,2,2};
33 genjet1.
scales.push_back(1.5);
34 genjet1.
scales.push_back(0.5);
35 genjet2.
scales.push_back(1.5);
36 genjet2.
scales.push_back(0.5);
39 genjet1.
weights.push_back({1.5,1});
40 genjet1.
weights.push_back({0.5,1});
41 genjet2.
weights.push_back({1.5,2});
42 genjet2.
weights.push_back({0.5,2});
◆ gendijet