Warning, file /include/root/RooBinSamplingPdf.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
0017 #ifndef ROO_BIN_SAMPLING__PDF
0018 #define ROO_BIN_SAMPLING__PDF
0019
0020 #include "RooAbsReal.h"
0021 #include "RooTemplateProxy.h"
0022 #include "RooAbsPdf.h"
0023
0024 #include "Math/Integrator.h"
0025
0026 #include <memory>
0027
0028 class RooBinSamplingPdf : public RooAbsPdf {
0029 public:
0030
0031 RooBinSamplingPdf() { };
0032 RooBinSamplingPdf(const char *name, const char *title, RooAbsRealLValue& observable, RooAbsPdf& inputPdf,
0033 double epsilon = 1.E-4);
0034
0035 RooBinSamplingPdf(const RooBinSamplingPdf& other, const char* name = nullptr);
0036
0037 TObject* clone(const char* newname) const override {
0038 return new RooBinSamplingPdf(*this, newname);
0039 }
0040
0041
0042 bool forceAnalyticalInt(const RooAbsArg& dep) const override {
0043 return _pdf->forceAnalyticalInt(dep);
0044 }
0045
0046 Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet,
0047 const char* rangeName=nullptr) const override {
0048 return _pdf->getAnalyticalIntegralWN(allVars, analVars, normSet, rangeName);
0049 }
0050
0051 Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& numVars,
0052 const char* rangeName=nullptr) const override {
0053 return _pdf->getAnalyticalIntegral(allVars, numVars, rangeName);
0054 }
0055
0056 double analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName) const override {
0057 return _pdf->analyticalIntegralWN(code, normSet, rangeName);
0058 }
0059
0060 double analyticalIntegral(Int_t code, const char* rangeName=nullptr) const override {
0061 return _pdf->analyticalIntegral(code, rangeName);
0062 }
0063
0064
0065 bool selfNormalized() const override { return true; }
0066
0067
0068 RooFit::OwningPtr<RooAbsReal> createIntegral(const RooArgSet& iset,
0069 const RooArgSet* nset=nullptr,
0070 const RooNumIntConfig* cfg=nullptr,
0071 const char* rangeName=nullptr) const override {
0072 return _pdf->createIntegral(iset, nset, cfg, rangeName);
0073 }
0074
0075 ExtendMode extendMode() const override { return _pdf->extendMode(); }
0076 double expectedEvents(const RooArgSet* nset) const override { return _pdf->expectedEvents(nset); }
0077
0078
0079 Int_t getGenerator(const RooArgSet& directVars, RooArgSet& generateVars, bool staticInitOK = true) const override {
0080 return _pdf->getGenerator(directVars, generateVars, staticInitOK);
0081 }
0082
0083 void initGenerator(Int_t code) override { _pdf->initGenerator(code); }
0084
0085 void generateEvent(Int_t code) override { _pdf->generateEvent(code); }
0086
0087 bool isDirectGenSafe(const RooAbsArg& arg) const override { return _pdf->isDirectGenSafe(arg); }
0088
0089
0090
0091 Int_t getMaxVal(const RooArgSet& vars) const override { return _pdf->getMaxVal(vars); }
0092 double maxVal(Int_t code) const override { return _pdf->maxVal(code); }
0093 Int_t minTrialSamples(const RooArgSet& arGenObs) const override { return _pdf->minTrialSamples(arGenObs); }
0094
0095
0096
0097 bool isBinnedDistribution(const RooArgSet& ) const override { return true; }
0098 std::list<double>* binBoundaries(RooAbsRealLValue& obs, double xlo, double xhi) const override;
0099 std::list<double>* plotSamplingHint(RooAbsRealLValue& obs, double xlo, double xhi) const override;
0100
0101 std::unique_ptr<ROOT::Math::IntegratorOneDim>& integrator() const;
0102
0103 static std::unique_ptr<RooAbsPdf> create(RooAbsPdf& pdf, RooAbsData const &data, double precision);
0104
0105 double epsilon() const { return _relEpsilon; }
0106 const RooAbsPdf& pdf() const { return _pdf.arg(); }
0107 const RooAbsReal& observable() const { return _observable.arg(); }
0108
0109 void doEval(RooFit::EvalContext &) const override;
0110
0111 protected:
0112 double evaluate() const override;
0113 std::span<const double> binBoundaries() const;
0114
0115 private:
0116 template<typename Func>
0117 friend class ROOT::Math::WrappedFunction;
0118
0119 double operator()(double x) const;
0120 double integrate(const RooArgSet* normSet, double low, double high) const;
0121
0122
0123 RooTemplateProxy<RooAbsPdf> _pdf;
0124 RooTemplateProxy<RooAbsRealLValue> _observable;
0125 double _relEpsilon{1.E-4};
0126
0127 mutable std::unique_ptr<ROOT::Math::IntegratorOneDim> _integrator{nullptr};
0128 mutable std::vector<double> _binBoundaries;
0129
0130 ClassDefOverride(RooBinSamplingPdf,1)
0131 };
0132
0133 #endif