ra4_draw  4bd0201e3d922d42bd545d4b045ed44db33454a4
gamma_params.hpp
Go to the documentation of this file.
1 #ifndef H_GAMMA_PARAM
2 #define H_GAMMA_PARAM
3 
4 #include <ostream>
5 
6 class GammaParams{
7 public:
8  GammaParams();
9  GammaParams(double n_effective, double weight);
10  GammaParams(const GammaParams &) = default;
11  GammaParams & operator=(const GammaParams &) = default;
12  GammaParams(GammaParams &&) = default;
13  GammaParams & operator=(GammaParams &&) = default;
14  ~GammaParams() = default;
15 
16  void SetNEffectiveAndWeight(double n_effective, double weight);
17  void SetYieldAndUncertainty(double yield, double uncertainty);
18 
19  double Yield() const;
20  void Yield(double yield);
21 
22  double Uncertainty() const;
23  void Uncertainty(double uncertainty);
24 
25  double NEffective() const;
26  void NEffective(double n_effective);
27 
28  double Weight() const;
29  void Weight(double weight);
30 
31  double CorrectedUncertainty() const;
32 
33  GammaParams & operator+=(const GammaParams &gp);
34  GammaParams & operator*=(double scale);
35 
36 private:
37  double n_effective_;//Effective number of unweighted events
38  double weight_;//Effective weight of sample
39 };
40 
42 GammaParams operator*(double scale, GammaParams gp);
43 GammaParams operator*(GammaParams gp, double scale);
44 std::ostream & operator<<(std::ostream &stream, const GammaParams &gp);
45 
46 #endif
double Weight() const
Get the effective weight for the sample.
double weight_
double CorrectedUncertainty() const
Get the "sqrt(N+1)"-like uncertainty on the yield/rate.
Represents a yield and uncertainty obtained by counting weighted events.
Definition: gamma_params.hpp:6
GammaParams & operator+=(const GammaParams &gp)
Adds another GammaParams to *this.
void SetYieldAndUncertainty(double yield, double uncertainty)
Sets GammaParams by yield and uncertainty.
GammaParams & operator*=(double scale)
Scale/multiply *this by a constant.
GammaParams()
Standard constructor initializing to unweighted count = 0, weight = 0.
double Yield() const
Get the yield/rate.
double n_effective_
std::ostream & operator<<(std::ostream &stream, const GammaParams &gp)
Print GammaParams to output stream.
~GammaParams()=default
GammaParams & operator=(const GammaParams &)=default
double Uncertainty() const
Get the "sqrt(N)"-like uncertainty on the yield/rate.
double NEffective() const
Get the effective number of unweighted events.
GammaParams operator*(double scale, GammaParams gp)
Scale/multiply a GammaParams by a constant on the left.
GammaParams operator+(GammaParams gp1, GammaParams gp2)
Add two GammaParams.
void SetNEffectiveAndWeight(double n_effective, double weight)
Sets GammaParams by unweighted event count and weight.