98 auto preBng =
new TUnfoldBinning(
"pre");
100 auto firstPreBng =
new TUnfoldBinning(
"first_dist");
101 firstPreBng->AddAxis(
"first_axis", 4, 0.5, 4.5,
false,
false);
102 preBng->AddBinning(firstPreBng);
104 auto secondPreBng =
new TUnfoldBinning(
"second_dist");
105 secondPreBng->AddAxis(
"second_axis", 4, 4.5, 8.5,
false,
false);
106 preBng->AddBinning(secondPreBng);
108 auto hIn = unique_ptr<TH1D>((TH1D*)preBng->CreateHistogram(
"hIn",
false,
nullptr,
"input"));
109 auto covIn = unique_ptr<TH2D>(preBng->CreateErrorMatrixHistogram(
"covIn",
false,
nullptr,
"input"));
111 hIn->SetBinContent(1, 1); hIn->SetBinContent(5, 3);
112 hIn->SetBinContent(2, 2); hIn->SetBinContent(6, 4);
113 hIn->SetBinContent(3, 5); hIn->SetBinContent(7, 7);
114 hIn->SetBinContent(4, 0); hIn->SetBinContent(8, 10);
116 for (
int i = 1; i <= 8; ++i)
117 covIn->SetBinContent(i,i,hIn->GetBinContent(i));
122 using namespace Unfolding;
125 auto postBng =
new TUnfoldBinning(
"post");
126 vector<unique_ptr<Transformer>> transformers;
127 transformers.emplace_back(make_unique<Transformer>(firstPreBng));
128 transformers.emplace_back(make_unique<TestTransformer>(secondPreBng));
129 postBng->AddBinning(transformers[0]->postBinning);
130 postBng->AddBinning(transformers[1]->postBinning);
132 function<VectorXd(
const VectorXd &)> transformation =
133 [&transformers](
const VectorXd& x) {
135 for (
const auto& t: transformers)
140 for (
auto& t: transformers)
141 t->RemoveBadInputBins(hIn.get(), covIn.get());
145 Teddy toy(hIn, covIn, transformation);
146 for (
int i = 0; i < 1e6; ++i)
148 auto [x,cov] = toy.buy();
150 cout <<
"x:\n" << x <<
"\n\n"
151 <<
"cov:\n" << cov << endl;
154 xTruth << 1, 2, 5, 0, 0, 0, 4, 10, 0;
155 for (
int i = 0; i < 9; ++i) {
156 cout << i <<
' ' << xTruth(i) <<
' ' << x(i) << endl;