Warning, file /include/root/RooHistPdf.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_PDF
0017 #define ROO_HIST_PDF
0018
0019 #include "RooAbsPdf.h"
0020 #include "RooRealProxy.h"
0021 #include "RooSetProxy.h"
0022 #include "RooAICRegistry.h"
0023 #include "RooDataHist.h"
0024
0025 #include <list>
0026
0027 class RooRealVar;
0028 class RooAbsReal;
0029
0030 class RooHistPdf : public RooAbsPdf {
0031 public:
0032 RooHistPdf() {}
0033 RooHistPdf(const char *name, const char *title, const RooArgSet& vars, const RooDataHist& dhist, Int_t intOrder=0);
0034 RooHistPdf(const char *name, const char *title, const RooArgList& pdfObs, const RooArgList& histObs, const RooDataHist& dhist, Int_t intOrder=0);
0035 RooHistPdf(const char *name, const char *title, const RooArgSet& vars,
0036 std::unique_ptr<RooDataHist> dhist, int intOrder=0);
0037 RooHistPdf(const char *name, const char *title, const RooArgList& pdfObs, const RooArgList& histObs,
0038 std::unique_ptr<RooDataHist> dhist, int intOrder=0);
0039 RooHistPdf(const RooHistPdf& other, const char* name=nullptr);
0040 TObject* clone(const char* newname) const override { return new RooHistPdf(*this,newname); }
0041
0042 RooDataHist& dataHist() {
0043
0044 return *_dataHist ;
0045 }
0046 const RooDataHist& dataHist() const {
0047
0048 return *_dataHist ;
0049 }
0050
0051
0052
0053 RooDataHist* cloneAndOwnDataHist(const char* newname="");
0054
0055 void setInterpolationOrder(Int_t order) {
0056
0057 _intOrder = order ;
0058 }
0059 Int_t getInterpolationOrder() const {
0060
0061 return _intOrder ;
0062 }
0063
0064 Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=nullptr) const override ;
0065 double analyticalIntegral(Int_t code, const char* rangeName=nullptr) const override ;
0066
0067 bool forceAnalyticalInt(const RooAbsArg& dep) const override;
0068
0069 void setCdfBoundaries(bool flag) {
0070
0071 _cdfBoundaries = flag ;
0072 }
0073 bool getCdfBoundaries() const {
0074
0075 return _cdfBoundaries ;
0076 }
0077
0078 void setUnitNorm(bool flag) {
0079
0080 _unitNorm = flag ;
0081 }
0082 bool haveUnitNorm() const {
0083
0084 return _unitNorm ;
0085 }
0086
0087 bool selfNormalized() const override { return _unitNorm ; }
0088
0089 Int_t getMaxVal(const RooArgSet& vars) const override ;
0090 double maxVal(Int_t code) const override ;
0091
0092 std::list<double>* plotSamplingHint(RooAbsRealLValue& obs, double xlo, double xhi) const override ;
0093 std::list<double>* binBoundaries(RooAbsRealLValue& , double , double ) const override ;
0094 bool isBinnedDistribution(const RooArgSet&) const override { return _intOrder==0 ; }
0095
0096 void doEval(RooFit::EvalContext &) const override;
0097
0098 void translate(RooFit::Detail::CodeSquashContext &ctx) const override;
0099 std::string
0100 buildCallToAnalyticIntegral(int code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override;
0101
0102 protected:
0103 bool areIdentical(const RooDataHist& dh1, const RooDataHist& dh2) ;
0104
0105 bool importWorkspaceHook(RooWorkspace& ws) override ;
0106
0107 double evaluate() const override;
0108 double totalVolume() const ;
0109 friend class RooAbsCachedPdf ;
0110 double totVolume() const ;
0111
0112 RooArgSet _histObsList;
0113 RooSetProxy _pdfObsList;
0114 RooDataHist* _dataHist = nullptr;
0115 std::unique_ptr<RooDataHist> _ownedDataHist;
0116 mutable RooAICRegistry _codeReg ;
0117 Int_t _intOrder = 0;
0118 bool _cdfBoundaries = false;
0119 mutable double _totVolume = 0.0;
0120 bool _unitNorm = false;
0121
0122 private:
0123
0124 friend class RooHistFunc;
0125
0126 static bool forceAnalyticalInt(RooArgSet const& pdfObsList, RooAbsArg const& dep);
0127
0128 static Int_t getAnalyticalIntegral(RooArgSet& allVars,
0129 RooArgSet& analVars,
0130 const char* rangeName,
0131 RooArgSet const& histObsList,
0132 RooArgSet const& pdfObsList,
0133 Int_t intOrder) ;
0134
0135 static double analyticalIntegral(Int_t code,
0136 const char* rangeName,
0137 RooArgSet const& histObsList,
0138 RooArgSet const& pdfObsList,
0139 RooDataHist& dataHist,
0140 bool histFuncMode) ;
0141
0142 static std::list<double>* plotSamplingHint(RooDataHist const& dataHist,
0143 RooArgSet const& pdfObsList,
0144 RooArgSet const& histObsList,
0145 int intOrder,
0146 RooAbsRealLValue& obs,
0147 double xlo,
0148 double xhi);
0149
0150 static void rooHistTranslateImpl(RooAbsArg const *klass, RooFit::Detail::CodeSquashContext &ctx, int intOrder,
0151 RooDataHist const *dataHist, const RooArgSet &obs, bool correctForBinSize, bool cdfBoundaries);
0152
0153 static std::string rooHistIntegralTranslateImpl(int code, RooAbsArg const *klass, RooDataHist const *dataHist,
0154 const RooArgSet &obs, bool histFuncMode);
0155
0156 private:
0157 inline void initializeOwnedDataHist(std::unique_ptr<RooDataHist> &&dataHist)
0158 {
0159 _ownedDataHist = std::move(dataHist);
0160 }
0161
0162 ClassDefOverride(RooHistPdf,4)
0163 };
0164
0165 #endif