|
DAS
3.0
Das Analysis System
|
#include "Core/Objects/interface/Di.h"
#include <boost/test/included/unit_test.hpp>
#include <iostream>
#include <map>
#include <TTree.h>
#include <TFile.h>
◆ BOOST_TEST_MODULE
#define BOOST_TEST_MODULE Di |
◆ BOOST_AUTO_TEST_CASE() [1/2]
BOOST_AUTO_TEST_CASE |
( |
dijet |
| ) |
|
47 vector<GenJet> *
genjets =
new vector<GenJet>;
49 bool valid =
static_cast<bool>(*gendijet);
56 valid =
static_cast<bool>(*gendijet);
60 auto f = make_unique<TFile>(
"di.root",
"RECREATE");
62 cout <<
"Creating tree" << endl;
64 auto t = make_unique<TTree>(
"tree",
"tree");
77 cout <<
"Reading tree" << endl;
79 auto t = unique_ptr<TTree>(
f->Get<TTree>(
"tree"));
81 cout <<
"Checking genJets" << endl;
82 t->Scan(
"genJets.CorrPt()");
83 cout <<
"Checking genDijet" << endl;
84 t->Scan(
"genDijet.first.CorrPt():genDijet.second.CorrPt():genDijet.HT()");
85 cout <<
"Setting branch addresses" << endl;
86 t->SetBranchAddress(
"genJets", &
genjets);
87 t->SetBranchAddress(
"genDijet", &
gendijet);
◆ BOOST_AUTO_TEST_CASE() [2/2]
BOOST_AUTO_TEST_CASE |
( |
variations |
| ) |
|
121 map<int, double> bits_results {{1,1.5}, {2,1.5}, {3,1.0}};
122 for (
auto bit_result: bits_results) {
123 int bit = bit_result.first;
124 double result = bit_result.second;
126 cout <<
"1st-jet weight: " <<
genjets.at(0).Weight(v) <<
'\n'
127 <<
"2nd-jet weight: " <<
genjets.at(1).Weight(v) <<
'\n'
132 for (
int i = 1; i <= 2; ++i) {
134 cout <<
"1st-jet corrected pt: " <<
genjets.at(0).CorrPt(v) <<
'\n'
135 <<
"2nd-jet corrected pt: " <<
genjets.at(1).CorrPt(v) <<
'\n'
137 <<
"dijet corrected HT: " <<
gendijet.
HT(v) << endl;
◆ BOOST_TEST()
BOOST_TEST |
( |
gendijet. |
Rapidity() = =1.3573785791881385 | ) |
|
◆ GetDummyGenJets()
vector<GenJet> GetDummyGenJets |
( |
| ) |
|
23 genjet1.
p4 = {1,1,1,1};
24 genjet2.
p4 = {2,2,2,2};
27 genjet1.
scales.push_back(1.5);
28 genjet1.
scales.push_back(0.5);
29 genjet2.
scales.push_back(1.5);
30 genjet2.
scales.push_back(0.5);
33 genjet1.
weights.push_back({1.5,1});
34 genjet1.
weights.push_back({0.5,1});
35 genjet2.
weights.push_back({1.5,2});
36 genjet2.
weights.push_back({0.5,2});
◆ gendijet
GenDijet gendijet = genjets.at(0) + genjets.at(1) |
double Weight(const Uncertainties::Variation &v=Uncertainties::nominal) const override
Definition: Di.h:73
GenDijet gendijet
Definition: Di.cc:98
FourVector p4
raw four-momentum directly after reconstruction
Definition: PhysicsObject.h:47
vector< GenJet > GetDummyGenJets()
Definition: Di.cc:18
Di< GenJet, GenJet > GenDijet
Definition: Di.h:77
BOOST_TEST(gendijet.Rapidity()==1.3573785791881385)
f
Definition: Ntupliser_cfg.py:252
std::vector< float > scales
energy scale corrections and variations
Definition: PhysicsObject.h:48
float HT(const Uncertainties::Variation &v=Uncertainties::nominal) const
Definition: Di.h:70
float CorrPt(const Uncertainties::Variation &v=Uncertainties::nominal) const override
Definition: Di.h:48
static const char *const ScaleVar
Name of jet gen scales in variations.
Definition: Jet.h:10
genjets
Definition: Ntupliser_cfg.py:268
class GenJet
Definition: Jet.h:9
const Variation nominal
Definition: Variation.h:109
Definition: Variation.h:16
static const char *const *const WeightVar
Name of jet gen weights in variations.
Definition: Jet.h:11
Weights weights
object weights
Definition: PhysicsObject.h:49
Definition: Variation.h:22