Warning, file /include/root/RooHist.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROO_HIST
0017 #define ROO_HIST
0018
0019 #include "TGraphAsymmErrors.h"
0020 #include "RooPlotable.h"
0021 #include "RooAbsData.h"
0022
0023 class RooAbsRealLValue;
0024 class RooCurve;
0025 class RooFitResult;
0026
0027 class TH1;
0028
0029 class RooHist : public TGraphAsymmErrors, public RooPlotable {
0030 public:
0031 RooHist() {}
0032 RooHist(double nominalBinWidth, double nSigma= 1, double xErrorFrac=1.0, double scaleFactor=1.0);
0033 RooHist(const TH1 &data, double nominalBinWidth= 0, double nSigma= 1, RooAbsData::ErrorType=RooAbsData::Poisson,
0034 double xErrorFrac=1.0, bool correctForBinWidth=true, double scaleFactor=1.);
0035 RooHist(const TH1 &data1, const TH1 &data2, double nominalBinWidth= 0, double nSigma= 1, RooAbsData::ErrorType=RooAbsData::Poisson,
0036 double xErrorFrac=1.0, bool efficiency=false, double scaleFactor=1.0);
0037 RooHist(const RooHist& hist1, const RooHist& hist2, double wgt1=1.0, double wgt2=1.0,
0038 RooAbsData::ErrorType etype=RooAbsData::Poisson, double xErrorFrac=1.0) ;
0039 RooHist(const RooAbsReal &f, RooAbsRealLValue &x, double xErrorFrac=1.0, double scaleFactor=1.0, const RooArgSet *normVars = nullptr, const RooFitResult* fr = nullptr);
0040
0041
0042 void addBin(Axis_t binCenter, double n, double binWidth= 0, double xErrorFrac=1.0, double scaleFactor=1.0);
0043
0044 void addBinWithError(Axis_t binCenter, double n, double elow, double ehigh, double binWidth= 0,
0045 double xErrorFrac=1.0, bool correctForBinWidth=true, double scaleFactor=1.0);
0046
0047 void addBinWithXYError(Axis_t binCenter, double n, double exlow, double exhigh, double eylow, double eyhigh,
0048 double scaleFactor=1.0);
0049
0050 void addAsymmetryBin(Axis_t binCenter, Int_t n1, Int_t n2, double binWidth= 0, double xErrorFrac=1.0, double scaleFactor=1.0);
0051
0052 void addAsymmetryBinWithError(Axis_t binCenter, double n1, double n2, double en1, double en2, double binWidth= 0, double xErrorFrac=1.0, double scaleFactor=1.0);
0053
0054
0055 void addEfficiencyBin(Axis_t binCenter, Int_t n1, Int_t n2, double binWidth= 0, double xErrorFrac=1.0, double scaleFactor=1.0);
0056
0057 void addEfficiencyBinWithError(Axis_t binCenter, double n1, double n2, double en1, double en2, double binWidth= 0, double xErrorFrac=1.0, double scaleFactor=1.0);
0058
0059 void printName(std::ostream& os) const override ;
0060 void printTitle(std::ostream& os) const override ;
0061 void printClassName(std::ostream& os) const override ;
0062 void printMultiline(std::ostream& os, Int_t content, bool verbose=false, TString indent= "") const override;
0063
0064 inline void Print(Option_t *options= nullptr) const override {
0065
0066 printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
0067 }
0068
0069 double getFitRangeNEvt() const override;
0070 double getFitRangeNEvt(double xlo, double xhi) const override ;
0071
0072 double getFitRangeBinW() const override { return _nominalBinWidth ; }
0073 inline double getNominalBinWidth() const { return _nominalBinWidth; }
0074 inline void setRawEntries(double n) { _rawEntries = n ; }
0075
0076 bool hasIdenticalBinning(const RooHist& other) const ;
0077
0078 RooHist* makeResidHist(const RooCurve& curve,bool normalize=false, bool useAverage=false) const;
0079 RooHist* makePullHist(const RooCurve& curve, bool useAverage=false) const
0080 {return makeResidHist(curve,true,useAverage); }
0081
0082 bool isIdentical(const RooHist& other, double tol=1e-6, bool verbose=true) const ;
0083
0084
0085 protected:
0086 void initialize();
0087 Int_t roundBin(double y);
0088
0089 friend class RooPlot;
0090
0091 void fillResidHist(RooHist & residHist, const RooCurve& curve,bool normalize=false, bool useAverage=false) const;
0092 std::unique_ptr<RooHist> createEmptyResidHist(const RooCurve& curve, bool normalize=false) const;
0093
0094 private:
0095
0096 void addPoint(Axis_t binCenter, double y, double yscale, double exlow, double exhigh, double eylow, double eyhigh);
0097
0098 double _nominalBinWidth = 1.0;
0099 double _nSigma = 1.0;
0100 double _entries = 0.0;
0101 double _rawEntries = 0.0;
0102
0103 std::vector<double> _originalWeights;
0104
0105 ClassDefOverride(RooHist,2)
0106 };
0107
0108 #endif