File indexing completed on 2026-08-06 09:24:27
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef MYSTATISTICS_Distribution_hpp_included
0009 #define MYSTATISTICS_Distribution_hpp_included
0010
0011 #include "Histogram.h"
0012
0013 #include <iostream>
0014
0015 namespace Statistics {
0016
0017
0018
0019
0020
0021 class Distribution {
0022
0023 public:
0024
0025
0026
0027
0028 struct DistributionBin {
0029
0030
0031
0032
0033 DistributionBin();
0034
0035
0036
0037
0038
0039 DistributionBin(const Bin& bin,
0040 double nPoints);
0041
0042
0043
0044
0045 DistributionBin& operator+=(const DistributionBin& other);
0046
0047
0048
0049
0050 DistributionBin& operator-=(const DistributionBin& other);
0051
0052
0053
0054
0055 DistributionBin& operator*=(const DistributionBin& other);
0056
0057
0058
0059
0060 DistributionBin& operator/=(const DistributionBin& other);
0061
0062
0063
0064
0065 void fromXML(const XML::Element&);
0066
0067
0068
0069
0070 XML::Element toXML() const;
0071
0072
0073
0074
0075 std::pair<double,double> boundaries;
0076
0077
0078
0079
0080 double value;
0081
0082
0083
0084
0085 double errorSquared;
0086
0087 };
0088
0089 public:
0090
0091
0092
0093
0094 Distribution();
0095
0096
0097
0098
0099 explicit Distribution(const Histogram& histo,
0100 double nPoints);
0101
0102
0103
0104
0105 virtual ~Distribution();
0106
0107 public:
0108
0109
0110
0111
0112 const std::string& name() const { return theName; }
0113
0114
0115
0116
0117 const std::vector<DistributionBin>& bins() const { return theBins; }
0118
0119 public:
0120
0121
0122
0123
0124 bool isCompatible(const Distribution& other) const;
0125
0126
0127
0128
0129 Distribution& operator+=(const Distribution& other);
0130
0131
0132
0133
0134 Distribution& operator-=(const Distribution& other);
0135
0136
0137
0138
0139 Distribution& operator*=(const Distribution& other);
0140
0141
0142
0143
0144 Distribution& operator/=(const Distribution& other);
0145
0146 public:
0147
0148
0149
0150
0151 void fromXML(const XML::Element&);
0152
0153
0154
0155
0156 XML::Element toXML() const;
0157
0158 public:
0159
0160
0161
0162
0163
0164 void toMakePlots(const std::string& analysis,
0165 const std::string& options = "") const;
0166
0167
0168
0169
0170
0171 void toMakePlots(const std::string& analysis,
0172 const Distribution& lower,
0173 const Distribution& upper,
0174 const std::string& options = "") const;
0175
0176
0177
0178
0179
0180 void appendToMakePlots(std::ostream& os,
0181 const std::string& analysis,
0182 const std::string& options = "") const;
0183
0184
0185
0186
0187
0188 void appendToMakePlots(std::ostream& os,
0189 const std::string& analysis,
0190 const Distribution& lower,
0191 const Distribution& upper,
0192 const std::string& options = "") const;
0193
0194 private:
0195
0196
0197
0198
0199 std::string theName;
0200
0201
0202
0203
0204 std::vector<DistributionBin> theBins;
0205
0206 };
0207
0208 }
0209
0210 #endif