File indexing completed on 2025-12-16 10:29:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROOSTATS_SamplingDistribution
0017 #define ROOSTATS_SamplingDistribution
0018
0019 #include "TNamed.h"
0020
0021 #include "Rtypes.h"
0022 #include "RooDataSet.h"
0023
0024 #include <vector>
0025
0026 namespace RooStats {
0027
0028 class SamplingDistribution : public TNamed {
0029
0030 public:
0031
0032
0033 SamplingDistribution(const char *name,const char *title, std::vector<double>& samplingDist, const char * varName = nullptr);
0034 SamplingDistribution(const char *name,const char *title,
0035 std::vector<double>& samplingDist, std::vector<double>& sampleWeights, const char * varName = nullptr);
0036
0037
0038 SamplingDistribution(const char *name,const char *title, const char * varName = nullptr);
0039
0040 SamplingDistribution(const char *name,const char *title, RooDataSet& dataSet, const char * columnName = nullptr, const char * varName = nullptr);
0041
0042
0043 SamplingDistribution();
0044
0045
0046 ~SamplingDistribution() override;
0047
0048
0049 double InverseCDF(double pvalue);
0050
0051
0052 double InverseCDFInterpolate(double pvalue);
0053
0054
0055
0056 double InverseCDF(double pvalue, double sigmaVariaton, double& inverseVariation);
0057
0058
0059 void Add(const SamplingDistribution* other);
0060
0061
0062 Int_t GetSize() const{return fSamplingDist.size();}
0063
0064
0065 const std::vector<double> & GetSamplingDistribution() const {return fSamplingDist;}
0066
0067 const std::vector<double> & GetSampleWeights() const {return fSampleWeights;}
0068
0069 const TString GetVarName() const {return fVarName;}
0070
0071
0072 double Integral(double low, double high, bool normalize = true, bool lowClosed = true, bool highClosed = false) const;
0073
0074
0075 double IntegralAndError(double & error, double low, double high, bool normalize = true,
0076 bool lowClosed = true, bool highClosed = false) const;
0077
0078
0079 double CDF(double x) const;
0080
0081 private:
0082
0083 mutable std::vector<double> fSamplingDist;
0084 mutable std::vector<double> fSampleWeights;
0085
0086 TString fVarName;
0087
0088 mutable std::vector<double> fSumW;
0089 mutable std::vector<double> fSumW2;
0090
0091 protected:
0092
0093
0094 void SortValues() const;
0095
0096 ClassDefOverride(SamplingDistribution,2)
0097 };
0098 }
0099
0100 #endif