Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
5 #define APWeightEntry_cxx
21 : m_val_denominator(0),
26 m_stat_uncert_high(0),
42 : m_stat_uncert_low(0),
46 double val_denominator_f = (
double) val_denominator;
48 double val_numerator_f = (
double) val_numerator;
69 m_pdf =
new double[1000];
73 m_variance = (val_numerator_f / (val_denominator_f * val_denominator_f)) + ((val_numerator_f * val_numerator_f) / (val_denominator_f * val_denominator_f * val_denominator_f));
79 double step = (sig_high - sig_low) * 1
e-3;
80 const double inv_scale = 1. /
scale;
84 double temp_value = sig_low;
85 double arr_position = sig_low;
87 for (
int i = 0;
i < 1000; ++
i) {
88 temp_value =
exp(
m_val_numerator *
log(arr_position * inv_scale)+(-val_numerator_f - val_denominator_f - 2.) *
log((arr_position * inv_scale) + 1.) - shift);
89 if (temp_value != temp_value) temp_value = 0.;
95 m_bins[1000] = arr_position;
106 m_pdf =
new double[1000];
107 m_bins =
new double[1001];
109 const double inv_val_denominator_f = 1. / val_denominator_f;
115 if (val_numerator_f == 0) {
117 sig_high =
std::min(1., (8. * inv_val_denominator_f));
119 if (val_numerator_f == val_denominator_f) {
120 sig_low =
std::max(0., (1. - 8. * inv_val_denominator_f));
124 double step = fabs(sig_high - sig_low) * 1
e-3;
126 if (val_numerator_f == 0 || val_numerator_f == val_denominator_f) {
132 double temp_value = sig_low;
133 double arr_position = sig_low;
135 if (val_numerator_f == 0) {
136 for (
int i = 0;
i < 1000; ++
i) {
137 temp_value =
exp(val_denominator_f *
log(1. - arr_position) - shift);
141 arr_position +=
step;
144 if (val_numerator_f == val_denominator_f) {
145 for (
int i = 0;
i < 1000; ++
i) {
146 temp_value =
exp(val_numerator_f *
log(arr_position) - shift);
150 arr_position +=
step;
153 for (
int i = 0;
i < 1000; ++
i) {
154 temp_value =
exp(val_numerator_f *
log(arr_position) + (val_denominator_f - val_numerator_f) *
log(1. - arr_position) - shift);
158 arr_position +=
step;
162 m_bins[1000] = arr_position;
181 const std::vector<int>& n_dim_origin) {
237 double rn = random->Rndm();
238 int ibin = TMath::BinarySearch(1000,
m_cumul,
rn);
280 for (
int i = 0;
i < 1000; ++
i) {
290 for (
int i = 0;
i < 1000; ++
i) {
293 const double inv_normalize = 1. /
m_cumul[1000];
294 for (
int i = 1;
i < 1000; ++
i) {
std::vector< int > m_coords
Holds the coordinates of the current entry in the original histogram.
unsigned int GetID() const
Returns the internal ID (used by APReweight/APReweight2D/APReweight3D/APReweightND).
void SetCoordinates(const std::vector< int > &coords, const std::vector< int > &n_dim_origin)
bool m_is_trig
Flag, set to true if weight entry is trigger based.
unsigned int GetValDenominator() const
Get value of original denominator.
Thread-local TRandom generator.
double GetStatUncertLow() const
Get lower bound of asymmetric statistical uncertainty.
double GetSysUncert2() const
Get absolute systematic uncertainty squared value of efficiency/weight.
double m_variance
Holds Variance of efficiency/weight (classical binomial/poisson model).
unsigned int m_val_denominator
Holds the value of original denominator.
void _ComputeCum()
Calculates the cumulative function of the pdf if necessary.
double GetRandom()
Get random number from PDF.
unsigned int GetValNumerator() const
Get value of original numerator.
TH1F * GetPDF()
Returns the calculated PDF.
const std::vector< int > & GetCoords() const
Returns the coordinates of the current entry in the original histogram.
double m_stat_uncert_high
Holds upper bound of asymmetric statistical uncertainty.
virtual ~APWeightEntry()
Default destructor.
double m_sys_uncert
Holds absolute systematic uncertainty value of efficiency/weight.
void efficiency(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
void ReadEfficiency(double efficiency, double err_low, double err_high)
Read efficiencies and upper/lower uncertainty (if numerator/denominator not applicable (e....
double GetVariance() const
Get Variance of efficiency/weight (classical binomial/poisson model).
bool m_is_nan
Flag, set to true if denominator is zero.
const std::vector< int > & GetOriginalDimensions() const
Returns the dimensions and amounts of bins for each dimension of the original histogram.
double m_stat_uncert_low
Holds lower bound of asymmetric statistical uncertainty.
void SetID(unsigned int id)
Set the internal ID (used by APReweight/APReweight2D/APReweight3D/APReweightND).
void SetSystUncert(double rel_uncert)
Set the relative (!) systematic uncertainty for the efficiency/weight.
double m_expectancy_val
Holds the Expectancy value of efficiency/weight.
bool IsNaN() const
Returns true if instance is NaN.
TH1F * m_hist
Holds the TH1F instance from the arrays if computed.
unsigned int m_val_numerator
Holds the value of original numerator.
std::vector< int > m_n_dim_origin
Holds the amount of dimensions and bins per axis in the original histogram.
APWeightEntry()
Default constructor.
bool IsTrig() const
Returns true if instance is trigger based.
void _CreateHist()
Creates a TH1F instance from the arrays if necessary.
double m_sys_uncert2
Holds absolute systematic uncertainty squared value of efficiency/weight.
double GetExpectancy() const
Get Expectancy value of efficiency/weight.
double m_integral
Holds the integral of the probability distribution.
double GetStatUncertHigh() const
Get upper bound of asymmetric statistical uncertainty.
double * m_cumul
Histograms to hold the probability distribution and the cumulative distribution.
Thread-local TRandom generator.
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
double GetSysUncert() const
Get absolute systematic uncertainty value of efficiency/weight.
#define ATLAS_THREAD_SAFE
Define macros for attributes used to control the static checker.
unsigned int m_ID
Holds internal ID (used by APReweight/APReweight2D/APReweight3D/APReweightND).