#include <boost/test/included/unit_test.hpp>
#include <iostream>
#include <map>
#include <TFile.h>
#include <TTree.h>
#include <Di.h>
#include <Jet.h>
|
auto | gendijet = genjets.at(0) + genjets.at(1) |
|
◆ 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);
61 valid =
static_cast<bool>(*gendijet);
64 auto f = make_unique<TFile>(
"di.root",
"RECREATE");
66 cout <<
"Creating tree" << endl;
68 auto t = make_unique<TTree>(
"tree",
"tree");
81 cout <<
"Reading tree" << endl;
83 auto t = unique_ptr<TTree>(
f->Get<TTree>(
"tree"));
85 cout <<
"Checking genJets" << endl;
86 t->Scan(
"genJets.CorrPt()");
87 cout <<
"Checking genDijet" << endl;
88 t->Scan(
"genDijet.first.CorrPt():genDijet.second.CorrPt():genDijet.HT()");
89 cout <<
"Setting branch addresses" << endl;
90 t->SetBranchAddress(
"genJets", &
genjets);
91 t->SetBranchAddress(
"genDijet", &
gendijet);
◆ BOOST_AUTO_TEST_CASE() [2/2]
BOOST_AUTO_TEST_CASE |
( |
variations |
| ) |
|
128 map<int, double> bits_results {{1,1.5}, {2,1.5}, {3,1.0}};
129 for (
auto bit_result: bits_results) {
130 int bit = bit_result.first;
131 double result = bit_result.second;
133 cout <<
"1st-jet weight: " <<
genjets.at(0).Weight(v) <<
'\n'
134 <<
"2nd-jet weight: " <<
genjets.at(1).Weight(v) <<
'\n'
135 <<
"dijet weight: " <<
gendijet.Weight(v) << endl;
139 for (
int i = 1; i <= 2; ++i) {
141 cout <<
"1st-jet corrected pt: " <<
genjets.at(0).CorrPt(v) <<
'\n'
142 <<
"2nd-jet corrected pt: " <<
genjets.at(1).CorrPt(v) <<
'\n'
143 <<
"dijet corrected pt: " <<
gendijet.CorrPt(v) <<
'\n'
144 <<
"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
auto gendijet = genjets.at(0) + genjets.at(1) |