herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
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
15namespace Statistics {
16
22
23 public:
24
29
34
39 DistributionBin(const Bin& bin,
40 double nPoints);
41
46
51
56
61
65 void fromXML(const XML::Element&);
66
71
75 std::pair<double,double> boundaries;
76
80 double value;
81
86
87 };
88
89 public:
90
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
130
135
140
145
146 public:
147
151 void fromXML(const XML::Element&);
152
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
A bin in a (one dimensional) histogram.
Definition: Bin.h:23
A (one dimensional) distribution.
Definition: Distribution.h:21
std::vector< DistributionBin > theBins
The bins in the distribution.
Definition: Distribution.h:204
bool isCompatible(const Distribution &other) const
Return true, if this distribution is compatible with another one.
virtual ~Distribution()
Destructor.
Distribution & operator*=(const Distribution &other)
Multiply two distributions.
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.
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.
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.
Distribution & operator/=(const Distribution &other)
Divide two distributions.
std::string theName
The name of the distribution.
Definition: Distribution.h:199
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.
const std::vector< DistributionBin > & bins() const
Return the bins in the distribution.
Definition: Distribution.h:117
Distribution(const Histogram &histo, double nPoints)
Construct from a histogram.
Distribution & operator-=(const Distribution &other)
Subtract two distributions.
XML::Element toXML() const
Return an XML element for the data of this distribution.
Distribution & operator+=(const Distribution &other)
Add two distributions.
const std::string & name() const
Return the name of the distribution.
Definition: Distribution.h:112
Distribution()
Default constructor.
void fromXML(const XML::Element &)
Fill distribution data from an XML element.
A (one dimensional) histogram.
Element represents a (tree of) XML elements.
Definition: Element.h:56
double errorSquared
The bin error squared.
Definition: Distribution.h:85
DistributionBin & operator/=(const DistributionBin &other)
Divide two distributionBins.
XML::Element toXML() const
Return an XML element for the data of this distribution.
DistributionBin & operator+=(const DistributionBin &other)
Add two distributionBins.
DistributionBin & operator-=(const DistributionBin &other)
Subtract two distributionBins.
DistributionBin & operator*=(const DistributionBin &other)
Multiply two distributionBins.
void fromXML(const XML::Element &)
Fill distribution data from an XML element.
std::pair< double, double > boundaries
The bin boundaries.
Definition: Distribution.h:75
DistributionBin(const Bin &bin, double nPoints)
Construct from a histogram bin, given a number of attempted points.