5 #define APReweight3D_cxx
17 m_denominator_hist(0),
31 m_denominator_hist = (TH3D*) denominator_in->Clone(
"");
33 m_axis_x = (TAxis*) m_denominator_hist->GetXaxis()->Clone(
"");
34 m_axis_y = (TAxis*) m_denominator_hist->GetYaxis()->Clone(
"");
35 m_axis_z = (TAxis*) m_denominator_hist->GetZaxis()->Clone(
"");
43 m_weights.push_back(vector< vector<APWeightEntry*> >());
44 for (
unsigned int j = 0; j <
m_n_bins_y; ++j) {
45 m_weights[
i].push_back(vector<APWeightEntry*>());
48 vector<int> temp_vec(3,0);
49 vector<int> temp_vec_axes(3,0);
57 temp_entry->
SetID(m_ID);
66 std::cout <<
"WARNING in APReweight3D::~APReweight3D(TH3* denominator_in, TH3* numerator_in, bool isTrig) : Using histograms " <<
m_numerator_hist->GetName() <<
" and " << m_denominator_hist->GetName() <<
" the efficiency is larger than 1 for bin " <<
i <<
"! This is inconsistent and can lead to unwanted behaviour (weights > 1, variance < 0 )! Please check your input histograms. In order to avoid negative variances, the efficiency in this bin will be set to 0." << std::endl;
76 if (err_high_in == 0) err_high_in = err_low_in;
78 m_denominator_hist =
new TH3D(
"",
"", 1, 0., 1., 1, 0., 1., 1, 0., 1.);
79 m_numerator_hist =
new TH3D(
"",
"", 1, 0., 1., 1, 0., 1., 1, 0., 1.);
80 m_axis_x = (TAxis*) efficiency_in->GetXaxis()->Clone(
"");
81 m_axis_y = (TAxis*) efficiency_in->GetYaxis()->Clone(
"");
82 m_axis_z = (TAxis*) efficiency_in->GetZaxis()->Clone(
"");
89 m_weights.push_back(vector< vector<APWeightEntry*> >());
90 for (
unsigned int j = 0; j <
m_n_bins_y; ++j) {
91 m_weights[
i].push_back(vector<APWeightEntry*>());
94 temp_entry->
ReadEfficiency(efficiency_in->GetBinContent(
i + 1, j + 1,
k + 1), err_low_in->GetBinContent(
i + 1, j + 1,
k + 1), err_high_in->GetBinContent(
i + 1, j + 1,
k + 1));
95 vector<int> temp_vec(3,0);
96 vector<int> temp_vec_axes(3,0);
104 temp_entry->
SetID(m_ID);
112 delete m_denominator_hist;
119 for (
unsigned int j = 0; j <
m_n_bins_y; ++j) {
129 if (bin_x == 0 || bin_y == 0 || bin_z == 0)
return m_empty_weight;
130 return m_weights[bin_x - 1][bin_y - 1][bin_z - 1];
138 return m_denominator_hist;
155 if (
value >=
m_axis_x->GetBinLowEdge(
i) && value < m_axis_x->GetBinUpEdge(
i)) {
159 if (!
m_isQuiet) cout <<
"WARNING in APReweight3D::GetBinX: Value out of range! Returning 0." << endl;
165 if (
value >=
m_axis_y->GetBinLowEdge(
i) && value < m_axis_y->GetBinUpEdge(
i)) {
169 if (!
m_isQuiet) cout <<
"WARNING in APReweight3D::GetBinY: Value out of range! Returning 0." << endl;
175 if (
value >=
m_axis_z->GetBinLowEdge(
i) && value < m_axis_z->GetBinUpEdge(
i)) {
179 if (!
m_isQuiet) cout <<
"WARNING in APReweight3D::GetBinZ: Value out of range! Returning 0." << endl;
185 for (
unsigned int j = 0; j <
m_n_bins_y; ++j) {