ATLAS Offline Software
Loading...
Searching...
No Matches
APWeightEntry.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6
17
18#ifndef APWeightEntry_h
19#define APWeightEntry_h
20
21#include "Rtypes.h"
22
23class TH1F;
24
26
27public:
29 APWeightEntry(unsigned int val_denominator, unsigned int val_numerator, double scale, bool isTrig = false);
30 virtual ~APWeightEntry();
31
32 void ReadEfficiency(double efficiency, double err_low, double err_high);
33 void SetCoordinates(const std::vector<int>& coords, const std::vector<int>& n_dim_origin);
34
35 unsigned int GetValDenominator() const;
36 unsigned int GetValNumerator() const;
37 double GetExpectancy() const;
38 double GetVariance() const;
39 double GetStatUncertLow() const;
40 double GetStatUncertHigh() const;
41 double GetSysUncert() const;
42 double GetSysUncert2() const;
43 double GetRandom();
44 TH1F* GetPDF();
45 unsigned int GetID() const;
46
47 const std::vector< int > & GetCoords() const;
48 const std::vector< int > & GetOriginalDimensions() const;
49
50 bool IsNaN() const;
51 bool IsTrig() const;
52
53 void SetSystUncert(double rel_uncert);
54 void SetID(unsigned int id);
55
56private:
59
60 void _CreateHist();
61 void _ComputeCum();
62
63 unsigned int m_val_denominator;
64 unsigned int m_val_numerator;
66 double m_variance;
69 double m_sys_uncert;
71
72 bool m_is_trig;
73 bool m_is_nan;
74 unsigned int m_ID;
75 double m_integral;
76 double *m_pdf, *m_bins, *m_cumul;
77 TH1F *m_hist;
78 std::vector<int> m_coords;
79 std::vector< int > m_n_dim_origin;
80};
81
82#endif
double GetStatUncertHigh() const
Get upper bound of asymmetric statistical uncertainty.
APWeightEntry & operator=(const APWeightEntry &)
void SetID(unsigned int id)
Set the internal ID (used by APReweight/APReweight2D/APReweight3D/APReweightND).
const std::vector< int > & GetOriginalDimensions() const
Returns the dimensions and amounts of bins for each dimension of the original histogram.
double GetStatUncertLow() const
Get lower bound of asymmetric statistical uncertainty.
double GetSysUncert2() const
Get absolute systematic uncertainty squared value of efficiency/weight.
virtual ~APWeightEntry()
Default destructor.
bool m_is_nan
Flag, set to true if denominator is zero.
double * m_cumul
Histograms to hold the probability distribution and the cumulative distribution.
void ReadEfficiency(double efficiency, double err_low, double err_high)
Read efficiencies and upper/lower uncertainty (if numerator/denominator not applicable (e....
double GetSysUncert() const
Get absolute systematic uncertainty value of efficiency/weight.
APWeightEntry(const APWeightEntry &)
const std::vector< int > & GetCoords() const
Returns the coordinates of the current entry in the original histogram.
unsigned int GetID() const
Returns the internal ID (used by APReweight/APReweight2D/APReweight3D/APReweightND).
APWeightEntry()
Default constructor.
double GetRandom()
Get random number from PDF.
double m_stat_uncert_high
Holds upper bound of asymmetric statistical uncertainty.
std::vector< int > m_coords
Holds the coordinates of the current entry in the original histogram.
double GetVariance() const
Get Variance of efficiency/weight (classical binomial/poisson model).
void _CreateHist()
Creates a TH1F instance from the arrays if necessary.
unsigned int GetValNumerator() const
Get value of original numerator.
double m_integral
Holds the integral of the probability distribution.
void _ComputeCum()
Calculates the cumulative function of the pdf if necessary.
double m_sys_uncert2
Holds absolute systematic uncertainty squared value of efficiency/weight.
TH1F * GetPDF()
Returns the calculated PDF.
unsigned int m_val_numerator
Holds the value of original numerator.
bool m_is_trig
Flag, set to true if weight entry is trigger based.
double GetExpectancy() const
Get Expectancy value of efficiency/weight.
double m_sys_uncert
Holds absolute systematic uncertainty value of efficiency/weight.
double m_stat_uncert_low
Holds lower bound of asymmetric statistical uncertainty.
unsigned int GetValDenominator() const
Get value of original denominator.
unsigned int m_val_denominator
Holds the value of original denominator.
bool IsNaN() const
Returns true if instance is NaN.
void SetSystUncert(double rel_uncert)
Set the relative (!) systematic uncertainty for the efficiency/weight.
TH1F * m_hist
Holds the TH1F instance from the arrays if computed.
double m_variance
Holds Variance of efficiency/weight (classical binomial/poisson model).
void SetCoordinates(const std::vector< int > &coords, const std::vector< int > &n_dim_origin)
std::vector< int > m_n_dim_origin
Holds the amount of dimensions and bins per axis in the original histogram.
double m_expectancy_val
Holds the Expectancy value of efficiency/weight.
double * m_bins
unsigned int m_ID
Holds internal ID (used by APReweight/APReweight2D/APReweight3D/APReweightND).
bool IsTrig() const
Returns true if instance is trigger based.
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="")
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)