DAS  3.0
Das Analysis System
unfold.cc File Reference
#include <boost/test/included/unit_test.hpp>
#include "Core/Unfolding/bin/unfold.cc"
#include <darwin.h>
#include <filesystem>
#include <vector>
+ Include dependency graph for unfold.cc:

Macros

#define DOXYGEN_SHOULD_SKIP_THIS
 
#define BOOST_TEST_MODULE   testUnfold
 

Functions

 BOOST_AUTO_TEST_CASE (prepare_data)
 
 BOOST_AUTO_TEST_CASE (closure_tests)
 

Macro Definition Documentation

◆ BOOST_TEST_MODULE

#define BOOST_TEST_MODULE   testUnfold

◆ DOXYGEN_SHOULD_SKIP_THIS

#define DOXYGEN_SHOULD_SKIP_THIS

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

BOOST_AUTO_TEST_CASE ( closure_tests  )
Todo:
expect perfect agreement
Todo:
expect agreement within stat unc
Todo:
play with config
113  {
114  pt::ptree config;
115  DAS::Unfolding::unfold("MC.root", "MC.root", "CT1.root", config, DT::verbose);
117  DAS::Unfolding::unfold("Data.root", "MC.root", "CT2.root", config, DT::verbose);
119 
121  }

◆ BOOST_AUTO_TEST_CASE() [2/2]

BOOST_AUTO_TEST_CASE ( prepare_data  )
18  {
20  const vector<float> recBins{330,362,395,430,468,507,548,592,638},
21  genBins{330 ,395 ,468 ,548 ,638};
22 
23  {
24  auto f = make_unique<TFile>("Data.root", "RECREATE");
25  auto d = f->mkdir("nominal");
26  d->cd();
27 
28  const vector<float> gen {6651.39, 2621.78, 1051.84, 446.982},
29  rec {4443, 2679.64, 1695.39, 1099.81, 678.544, 437.573, 286.335, 184.408};
30  const vector<vector<float>> cov {
31  { 108.138, 3.00372, 1.29928, 0.524956, 0.200247, 0.0904205, 0.0443272, 0.0218946},
32  { 3.00372, 41.5128, 1.21452, 0.542849, 0.199151, 0.090259, 0.0347899, 0.0175689},
33  { 1.29928, 1.21452, 17.1436, 0.531326, 0.223862, 0.0838979, 0.0339368, 0.0162317},
34  { 0.524956, 0.542849, 0.531326, 7.17864, 0.224999, 0.0920277, 0.0364688, 0.0144472},
35  { 0.200247, 0.199151, 0.223862, 0.224999, 2.82483, 0.0927202, 0.0404473, 0.0157154},
36  {0.0904205, 0.090259, 0.0838979, 0.0920277, 0.0927202, 1.21123, 0.0406513, 0.0169662},
37  {0.0443272, 0.0347899, 0.0339368, 0.0364688, 0.0404473, 0.0406513, 0.505679, 0.0176721},
38  {0.0218946, 0.0175689, 0.0162317, 0.0144472, 0.0157154, 0.0169662, 0.0176721, 0.218359 }};
39 
40  TH1 * h_gen = new TH1F("gen" , "", genBins.size()-1, genBins.data()),
41  * h_rec = new TH1F("rec" , "", recBins.size()-1, recBins.data()),
42  * h_cov = new TH2F("cov" , "", recBins.size()-1, recBins.data(),
43  recBins.size()-1, recBins.data());
44 
45  for (size_t j = 1; j < recBins.size(); ++j)
46  h_rec->SetBinContent(j, rec[j-1]);
47  for (size_t i = 1; i < recBins.size(); ++i)
48  for (size_t j = 1; j < recBins.size(); ++j)
49  h_cov->SetBinContent(i,j, cov[i-1][j-1]);
50 
51  for (TH1 * h: { h_gen, h_rec, h_cov}) {
52  h->SetDirectory(d);
53  h->Write();
54  }
55  }
56 
57  {
58  auto f = make_unique<TFile>("MC.root", "RECREATE");
59  auto d = f->mkdir("nominal");
60  d->cd();
61 
62  const vector<float> gen { 6607.1, 2609.2, 1044.67, 441.662 },
63  miss { 1548.09, 47.2368, 10.4246, 63.2799 },
64  rec { 4418.15, 2671.14, 1684.89, 1092.87, 674.859, 432.432, 284.292, 182.416 },
65  fake { 2012.1, 311.821, 30.4037, 6.08727, 2.85702, 2.72962, 8.60857, 32.8295 };
66  const vector<vector<float>> cov {
67  { 8.64223, 0.188038, 0.0785687, 0.0314394, 0.012043, 0.00512699, 0.00214151, 0.00104955 },
68  { 0.188038, 3.2715, 0.0673984, 0.0294979, 0.0109737, 0.00414604, 0.00199121, 0.000775939 },
69  { 0.0785687, 0.0673984, 1.3916, 0.0285614, 0.0118633, 0.00421753, 0.00157878, 0.000638562 },
70  { 0.0314394, 0.0294979, 0.0285614, 0.603268, 0.0113055, 0.00414158, 0.00136819, 0.000564623 },
71  { 0.012043, 0.0109737, 0.0118633, 0.0113055, 0.228633, 0.00329566, 0.00120471, 0.000447009 },
72  { 0.00512699, 0.00414604, 0.00421753, 0.00414158, 0.00329566, 0.0771141, 0.00107167, 0.000453384 },
73  { 0.00214151, 0.00199121, 0.00157878, 0.00136819, 0.00120471, 0.00107167, 0.0270088, 0.000437179 },
74  { 0.00104955, 0.000775939, 0.000638562, 0.000564623, 0.000447009, 0.000453384, 0.000437179, 0.00989617 } },
75  RM {
76  { 2291.16, 1899.53, 733.807, 123.198, 9.89329, 1.05721, 0.277702, 0.0833232},
77  { 111.343, 450.662, 877.149, 776.032, 292.045, 49.7355, 4.4996, 0.501105},
78  { 3.04508, 8.35056, 42.1392, 183.755, 351.442, 303.365, 121.612, 20.5417},
79  { 0.49977, 0.777264, 1.38553, 3.79658, 18.6224, 75.5446, 149.295, 128.461} };
80 
81  TH1 * h_gen = new TH1F("gen" , "", genBins.size()-1, genBins.data()),
82  * h_miss = new TH1F("missAll", "", genBins.size()-1, genBins.data()),
83  * h_rec = new TH1F("rec" , "", recBins.size()-1, recBins.data()),
84  * h_fake = new TH1F("fakeAll", "", recBins.size()-1, recBins.data()),
85  * h_cov = new TH2F("cov" , "", recBins.size()-1, recBins.data(),
86  recBins.size()-1, recBins.data()),
87  * h_RM = new TH2F("RM" , "", genBins.size()-1, genBins.data(),
88  recBins.size()-1, recBins.data());
89 
90  for (size_t i = 1; i < genBins.size(); ++i) {
91  h_gen->SetBinContent(i, gen[i-1]);
92  h_miss->SetBinContent(i, miss[i-1]);
93  }
94  for (size_t j = 1; j < recBins.size(); ++j) {
95  h_rec->SetBinContent(j, rec[j-1]);
96  h_fake->SetBinContent(j, fake[j-1]);
97  }
98  for (size_t i = 1; i < genBins.size(); ++i)
99  for (size_t j = 1; j < recBins.size(); ++j)
100  h_RM->SetBinContent(i,j, RM[i-1][j-1]);
101  for (size_t i = 1; i < recBins.size(); ++i)
102  for (size_t j = 1; j < recBins.size(); ++j)
103  h_cov->SetBinContent(i,j, cov[i-1][j-1]);
104 
105  for (auto& h: { h_gen, h_miss, h_rec, h_fake, h_cov, h_RM}) {
106  h->SetDirectory(d);
107  h->Write();
108  }
109  }
110  }
DAS::Unfolding::unfold
void unfold(const fs::path &inputData, const fs::path &inputMC, const fs::path &output, const pt::ptree &config, const int steering, const DT::Slice slice={1, 0})
Definition: unfold.cc:437
Step::verbose
static bool verbose
Definition: Step.h:40
Ntupliser_cfg.f
f
Definition: Ntupliser_cfg.py:256
Darwin::Tools::StandardInit
void StandardInit()
Definition: FileUtils.cc:29
Ntupliser_cfg.config
config
Definition: Ntupliser_cfg.py:264
DAS::Unfolding::InclusiveJet1D::genBins
static const std::vector< double > genBins
Definition: getUnfHistPt.cc:34
DAS::Unfolding::InclusiveJet1D::recBins
static const std::vector< double > recBins
Definition: getUnfHistPt.cc:33