5 const std::vector<double> & incident_bins,
6 const std::vector<fhicl::ParameterSet> & selections) {
8 "Data;Reconstructed KE (MeV)",
9 incident_bins.size() - 1,
11 for (
auto it = selections.begin(); it != selections.end(); ++it) {
15 std::vector<std::vector<double>> selected_bins =
16 it->get<std::vector<std::vector<double>>>(
"RecoBins");
18 std::vector<std::string> titles =
19 it->get<std::vector<std::string>>(
"AxisTitles");
20 TString
title =
"Data";
21 for (
auto &
t : titles) {
25 if (selected_bins.size() == 1) {
27 sel_name.c_str(), title,
28 selected_bins[0].size() - 1, &selected_bins[0][0]);
30 else if (selected_bins.size() == 2) {
32 sel_name.c_str(), title,
33 selected_bins[0].size() - 1, &selected_bins[0][0],
34 selected_bins[1].size() - 1, &selected_bins[1][0]);
36 else if (selected_bins.size() == 3) {
38 sel_name.c_str(), title,
39 selected_bins[0].size() - 1, &selected_bins[0][0],
40 selected_bins[1].size() - 1, &selected_bins[1][0],
41 selected_bins[2].size() - 1, &selected_bins[2][0]);
52 inc_name +=
"Rebinned";
67 TH1 * sel_hist = (TH1 *)it->second;
72 if (sel_hist->GetNbinsY() > 1) ++nAxes;
73 if (sel_hist->GetNbinsZ() > 1) ++nAxes;
76 TString
title = sel_hist->GetTitle();
78 title += sel_hist->GetXaxis()->GetTitle();
81 sel_hist->GetNbinsX(), 0, sel_hist->GetNbinsX());
84 else if (nAxes == 2) {
87 title += sel_hist->GetXaxis()->GetTitle();
89 title += sel_hist->GetYaxis()->GetTitle();
92 name.c_str(), title.c_str(),
93 sel_hist->GetNbinsX(), 0, sel_hist->GetNbinsX(),
94 sel_hist->GetNbinsY(), 0, sel_hist->GetNbinsY());
97 else if (nAxes == 3) {
100 title += sel_hist->GetXaxis()->GetTitle();
102 title += sel_hist->GetYaxis()->GetTitle();
104 title += sel_hist->GetZaxis()->GetTitle();
107 name.c_str(), title.c_str(),
108 sel_hist->GetNbinsX(), 0, sel_hist->GetNbinsX(),
109 sel_hist->GetNbinsY(), 0, sel_hist->GetNbinsY(),
110 sel_hist->GetNbinsZ(), 0, sel_hist->GetNbinsZ());
121 for (
int i = 1; i <= it->second->GetNbinsX(); ++i) {
123 i, it->second->GetBinContent(i));
129 for (
int i = 1; i <= sel_hist->GetNbinsX(); ++i) {
130 double low_x = sel_hist->GetXaxis()->GetBinLowEdge(i);
131 double up_x = sel_hist->GetXaxis()->GetBinUpEdge(i);
135 rebinned->GetXaxis()->SetBinLabel(i, bin_label.c_str());
137 rebinned->SetBinContent(i, sel_hist->GetBinContent(i));
142 for (
int i = 1; i <= sel_hist->GetNbinsX(); ++i) {
143 double low_x = sel_hist->GetXaxis()->GetBinLowEdge(i);
144 double up_x = sel_hist->GetXaxis()->GetBinUpEdge(i);
148 rebinned->GetXaxis()->SetBinLabel(
149 i, bin_label.c_str());
150 for (
int j = 1; j <= sel_hist->GetNbinsY(); ++j) {
151 double low_y = sel_hist->GetYaxis()->GetBinLowEdge(j);
152 double up_y = sel_hist->GetYaxis()->GetBinUpEdge(j);
156 rebinned->GetYaxis()->SetBinLabel(j, bin_label.c_str());
157 rebinned->SetBinContent(i, j, sel_hist->GetBinContent(i, j));
163 for (
int i = 1; i <= sel_hist->GetNbinsX(); ++i) {
164 double low_x = sel_hist->GetXaxis()->GetBinLowEdge(i);
165 double up_x = sel_hist->GetXaxis()->GetBinUpEdge(i);
169 rebinned->GetXaxis()->SetBinLabel(i, bin_label.c_str());
170 for (
int j = 1; j <= sel_hist->GetNbinsY(); ++j) {
171 double low_y = sel_hist->GetYaxis()->GetBinLowEdge(j);
172 double up_y = sel_hist->GetYaxis()->GetBinUpEdge(j);
176 rebinned->GetYaxis()->SetBinLabel(j, bin_label.c_str());
178 for (
int k = 1;
k <= sel_hist->GetNbinsY(); ++
k) {
179 double low_z = sel_hist->GetYaxis()->GetBinLowEdge(
k);
180 double up_z = sel_hist->GetYaxis()->GetBinUpEdge(
k);
184 rebinned->GetZaxis()->SetBinLabel(
k, bin_label.c_str());
186 rebinned->SetBinContent(i, j,
k, sel_hist->GetBinContent(i, j,
k));
201 for (
int i = 0; i <
fTotal; ++i) {
202 double r =
fRNG.Uniform();
203 std::pair<int, int>
bin;
251 const std::map<
int,
std::vector<std::vector<ThinSliceSample>>> & samples,
259 for (
auto it = samples.begin(); it != samples.end(); ++it) {
260 for (
size_t i = 0; i < it->second.size(); ++i) {
261 for (
size_t j = 0; j < it->second[i].size(); ++j) {
262 const auto &
hists = it->second[i][j].GetSelectionHists();
263 for (
auto it2 =
hists.begin(); it2 !=
hists.end(); ++it2) {
265 flux += it2->second->Integral();
void Rebin3D(TH1 *sel_hist, TH1 *rebinned)
std::vector< std::pair< std::pair< int, int >, double > > fCumulatives
void Rebin2D(TH1 *sel_hist, TH1 *rebinned)
std::map< int, TH1 * > fSelectionHistsRebinned
void FillHistsFromSamples(const std::map< int, std::vector< std::vector< ThinSliceSample >>> &samples, double &flux)
void GenerateStatFluctuation()
void Rebin1D(TH1 *sel_hist, TH1 *rebinned)
std::map< int, std::string > fSelectionNames
QTextStream & bin(QTextStream &s)
TH1D fIncidentHistRebinned
std::string PreciseToString(const double val, const int n=2)
std::map< int, TH1 * > fSelectionHists
second_as<> second
Type of time stored in seconds, in double precision.