|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #define APReweight2D_cxx
17 m_denominator_hist(0),
29 m_denominator_hist = (TH2D*) denominator_in->Clone(
"");
31 m_axis_x = (TAxis*) m_denominator_hist->GetXaxis()->Clone(
"");
32 m_axis_y = (TAxis*) m_denominator_hist->GetYaxis()->Clone(
"");
39 m_weights.push_back(vector<APWeightEntry*>());
40 for (
unsigned int j = 0; j <
m_n_bins_y; ++j) {
42 vector<int> temp_vec(2,0);
43 vector<int> temp_vec_axes(2,0);
49 temp_entry->
SetID(m_ID);
57 std::cout <<
"WARNING in APReweight2D::~APReweight2D(TH2* denominator_in, TH2* 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;
67 if (err_high_in == 0) err_high_in = err_low_in;
69 m_denominator_hist =
new TH2D(
"",
"", 1, 0., 1., 1, 0., 1.);
71 m_axis_x = (TAxis*) efficiency_in->GetXaxis()->Clone(
"");
72 m_axis_y = (TAxis*) efficiency_in->GetYaxis()->Clone(
"");
78 m_weights.push_back(vector<APWeightEntry*>());
79 for (
unsigned int j = 0; j <
m_n_bins_y; ++j) {
81 temp_entry->
ReadEfficiency(efficiency_in->GetBinContent(
i + 1, j + 1), err_low_in->GetBinContent(
i + 1, j + 1), err_high_in->GetBinContent(
i + 1, j + 1));
82 vector<int> temp_vec(2,0);
83 vector<int> temp_vec_axes(2,0);
89 temp_entry->
SetID(m_ID);
96 delete m_denominator_hist;
119 return m_denominator_hist;
136 if (
value >=
m_axis_x->GetBinLowEdge(
i) && value < m_axis_x->GetBinUpEdge(
i)) {
140 if (!
m_isQuiet) cout <<
"WARNING in APReweight2D::GetBinX: Value out of range! Returning 0." << endl;
146 if (
value >=
m_axis_y->GetBinLowEdge(
i) && value < m_axis_y->GetBinUpEdge(
i)) {
150 if (!
m_isQuiet) cout <<
"WARNING in APReweight2D::GetBinY: Value out of range! Returning 0." << endl;
156 for (
unsigned int j = 0; j <
m_n_bins_y; ++j) {
APWeightEntry * GetBinWeight(unsigned int bin_x, unsigned int bin_y) const
Get Weight entry for a given pair of bin numbers.
APReweight2D()
Default constructor.
const TH2D * GetNumeratorHist() const
Get original numerator histogram.
void ReadEfficiency(TH2 *efficiency_in, TH2 *err_low_in, TH2 *err_high_in=0)
Read efficiencies and upper/lower uncertainty (if numerator/denominator not applicable (e....
void SetCoordinates(const std::vector< int > &coords, const std::vector< int > &n_dim_origin)
const TH2D * GetDenominatorHist() const
Get original denominator histogram.
APWeightEntry * m_empty_weight
Dummy weight (equals 0.) to return if value out of range is provided.
void SetQuietMode(bool isQuiet=true)
Sets the flag to turn off messages.
unsigned int GetBinX(double value_x) const
Get bin number in X that corresponds to a given value.
double m_scale
Holds the scale factor that was calculated from sample sizes upon instantiation.
bool m_isQuiet
Flag to turn off messages.
TAxis * m_axis_y
Holds the Y axis of the APReweight2D instance (from input histograms).
void ReadEfficiency(double efficiency, double err_low, double err_high)
Read efficiencies and upper/lower uncertainty (if numerator/denominator not applicable (e....
bool m_isTrig
Flag to determine if the class holds trigger efficiencies or "simple" MC weights.
TAxis * m_axis_x
Holds the X axis of the APReweight2D instance (from input histograms).
void SetID(unsigned int id)
Set the internal ID (used by APReweight/APReweight2D/APReweight3D/APReweightND).
unsigned int m_n_bins_x
Holds the amount of bins in X.
void SetSystUncert(double rel_uncert)
Set the relative (!) systematic uncertainty for the efficiency/weight.
void SetSystUncert(double rel_uncert)
Set the global relative (!) systematic uncertainty of all efficiencies/weights.
APWeightEntry * GetWeight(double value_x, double value_y) const
Get Weight entry for a given pair of values.
unsigned int NBins() const
Get amount of bins.
unsigned int GetBinY(double value_y) const
Get bin number in Y that corresponds to a given value.
unsigned int m_n_bins_y
Holds the amount of bins in Y.
std::vector< std::vector< APWeightEntry * > > m_weights
Holds all weight entries.
virtual ~APReweight2D()
Default destructor.
double GetSampleScale() const
Get scale factor that was calculated from sample sizes upon instantiation.
ClassDef(APReweight2D, 1) private TH2D * m_numerator_hist
< Holds the original denominator histogram.