herwig
is hosted by
Hepforge
,
IPPP Durham
Herwig
7.3.0
Utilities
Statistics
Distribution.h
1
// -*- C++ -*-
2
//
3
// Distribution.hpp is a part of myStatistics
4
// Copyright (C) 2012-2019 Simon Platzer, The Herwig Collaboration
5
//
6
// myStatistics is licenced under version 3 of the GPL, see COPYING for details.
7
//
8
#ifndef MYSTATISTICS_Distribution_hpp_included
9
#define MYSTATISTICS_Distribution_hpp_included
10
11
#include "Histogram.h"
12
13
#include <iostream>
14
15
namespace
Statistics {
16
21
class
Distribution
{
22
23
public
:
24
28
struct
DistributionBin
{
29
33
DistributionBin
();
34
39
DistributionBin
(
const
Bin
& bin,
40
double
nPoints);
41
45
DistributionBin
&
operator+=
(
const
DistributionBin
& other);
46
50
DistributionBin
&
operator-=
(
const
DistributionBin
& other);
51
55
DistributionBin
&
operator*=
(
const
DistributionBin
& other);
56
60
DistributionBin
&
operator/=
(
const
DistributionBin
& other);
61
65
void
fromXML
(
const
XML::Element
&);
66
70
XML::Element
toXML
()
const
;
71
75
std::pair<double,double>
boundaries
;
76
80
double
value
;
81
85
double
errorSquared
;
86
87
};
88
89
public
:
90
94
Distribution
();
95
99
explicit
Distribution
(
const
Histogram
& histo,
100
double
nPoints);
101
105
virtual
~Distribution
();
106
107
public
:
108
112
const
std::string&
name
()
const
{
return
theName
; }
113
117
const
std::vector<DistributionBin>&
bins
()
const
{
return
theBins
; }
118
119
public
:
120
124
bool
isCompatible
(
const
Distribution
& other)
const
;
125
129
Distribution
&
operator+=
(
const
Distribution
& other);
130
134
Distribution
&
operator-=
(
const
Distribution
& other);
135
139
Distribution
&
operator*=
(
const
Distribution
& other);
140
144
Distribution
&
operator/=
(
const
Distribution
& other);
145
146
public
:
147
151
void
fromXML
(
const
XML::Element
&);
152
156
XML::Element
toXML
()
const
;
157
158
public
:
159
164
void
toMakePlots
(
const
std::string& analysis,
165
const
std::string& options =
""
)
const
;
166
171
void
toMakePlots
(
const
std::string& analysis,
172
const
Distribution
& lower,
173
const
Distribution
& upper,
174
const
std::string& options =
""
)
const
;
175
180
void
appendToMakePlots
(std::ostream& os,
181
const
std::string& analysis,
182
const
std::string& options =
""
)
const
;
183
188
void
appendToMakePlots
(std::ostream& os,
189
const
std::string& analysis,
190
const
Distribution
& lower,
191
const
Distribution
& upper,
192
const
std::string& options =
""
)
const
;
193
194
private
:
195
199
std::string
theName
;
200
204
std::vector<DistributionBin>
theBins
;
205
206
};
207
208
}
209
210
#endif
// MYSTATISTICS_Distribution_hpp_included
Statistics::Bin
A bin in a (one dimensional) histogram.
Definition:
Bin.h:23
Statistics::Distribution
A (one dimensional) distribution.
Definition:
Distribution.h:21
Statistics::Distribution::theBins
std::vector< DistributionBin > theBins
The bins in the distribution.
Definition:
Distribution.h:204
Statistics::Distribution::isCompatible
bool isCompatible(const Distribution &other) const
Return true, if this distribution is compatible with another one.
Statistics::Distribution::~Distribution
virtual ~Distribution()
Destructor.
Statistics::Distribution::operator*=
Distribution & operator*=(const Distribution &other)
Multiply two distributions.
Statistics::Distribution::appendToMakePlots
void appendToMakePlots(std::ostream &os, const std::string &analysis, const std::string &options="") const
Write out data ready for make-plots, given an analysis name and plot options.
Statistics::Distribution::toMakePlots
void toMakePlots(const std::string &analysis, const Distribution &lower, const Distribution &upper, const std::string &options="") const
Write out data ready for make-plots, given an analysis name and plot options.
Statistics::Distribution::toMakePlots
void toMakePlots(const std::string &analysis, const std::string &options="") const
Write out data ready for make-plots, given an analysis name and plot options.
Statistics::Distribution::operator/=
Distribution & operator/=(const Distribution &other)
Divide two distributions.
Statistics::Distribution::theName
std::string theName
The name of the distribution.
Definition:
Distribution.h:199
Statistics::Distribution::appendToMakePlots
void appendToMakePlots(std::ostream &os, const std::string &analysis, const Distribution &lower, const Distribution &upper, const std::string &options="") const
Write out data ready for make-plots, given an analysis name and plot options.
Statistics::Distribution::bins
const std::vector< DistributionBin > & bins() const
Return the bins in the distribution.
Definition:
Distribution.h:117
Statistics::Distribution::Distribution
Distribution(const Histogram &histo, double nPoints)
Construct from a histogram.
Statistics::Distribution::operator-=
Distribution & operator-=(const Distribution &other)
Subtract two distributions.
Statistics::Distribution::toXML
XML::Element toXML() const
Return an XML element for the data of this distribution.
Statistics::Distribution::operator+=
Distribution & operator+=(const Distribution &other)
Add two distributions.
Statistics::Distribution::name
const std::string & name() const
Return the name of the distribution.
Definition:
Distribution.h:112
Statistics::Distribution::Distribution
Distribution()
Default constructor.
Statistics::Distribution::fromXML
void fromXML(const XML::Element &)
Fill distribution data from an XML element.
Statistics::Histogram
A (one dimensional) histogram.
Definition:
Statistics/Histogram.h:25
XML::Element
Element represents a (tree of) XML elements.
Definition:
Element.h:56
Statistics::Distribution::DistributionBin
A bin in a distribution.
Definition:
Distribution.h:28
Statistics::Distribution::DistributionBin::errorSquared
double errorSquared
The bin error squared.
Definition:
Distribution.h:85
Statistics::Distribution::DistributionBin::operator/=
DistributionBin & operator/=(const DistributionBin &other)
Divide two distributionBins.
Statistics::Distribution::DistributionBin::toXML
XML::Element toXML() const
Return an XML element for the data of this distribution.
Statistics::Distribution::DistributionBin::operator+=
DistributionBin & operator+=(const DistributionBin &other)
Add two distributionBins.
Statistics::Distribution::DistributionBin::operator-=
DistributionBin & operator-=(const DistributionBin &other)
Subtract two distributionBins.
Statistics::Distribution::DistributionBin::DistributionBin
DistributionBin()
Default constructor.
Statistics::Distribution::DistributionBin::operator*=
DistributionBin & operator*=(const DistributionBin &other)
Multiply two distributionBins.
Statistics::Distribution::DistributionBin::fromXML
void fromXML(const XML::Element &)
Fill distribution data from an XML element.
Statistics::Distribution::DistributionBin::value
double value
The bin value.
Definition:
Distribution.h:80
Statistics::Distribution::DistributionBin::boundaries
std::pair< double, double > boundaries
The bin boundaries.
Definition:
Distribution.h:75
Statistics::Distribution::DistributionBin::DistributionBin
DistributionBin(const Bin &bin, double nPoints)
Construct from a histogram bin, given a number of attempted points.
Generated on Thu Jun 20 2024 17:50:53 for Herwig by
1.9.6