16#ifndef RooFit_RooNLLVarNew_h
17#define RooFit_RooNLLVarNew_h
30class RooNLLVarNew :
public RooAbsReal {
34 static constexpr const char *weightVarName =
"_weight";
35 static constexpr const char *weightVarNameSumW2 =
"_weight_sumW2";
36 static constexpr const char *binVolumeVarName =
"_bin_volume";
37 static constexpr const char *weightErrorLoVarName =
"_weight_err_lo";
38 static constexpr const char *weightErrorHiVarName =
"_weight_err_hi";
40 enum class Statistic {
49 Statistic statistic = Statistic::NLL;
50 bool extended =
false;
55 RooNLLVarNew(
const char *
name,
const char *title, RooAbsReal &func, RooArgSet
const &observables, Config
const &cfg);
56 RooNLLVarNew(
const RooNLLVarNew &other,
const char *
name =
nullptr);
57 TObject *clone(
const char *newname)
const override {
return new RooNLLVarNew(*
this, newname); }
60 double defaultErrorLevel()
const override {
return _statistic == Statistic::Chi2 ? 1.0 : 0.5; }
62 void doEval(RooFit::EvalContext &)
const override;
63 bool canComputeBatchWithCuda()
const override {
return _statistic == Statistic::NLL && !_binnedL; }
64 bool isReducerNode()
const override {
return true; }
66 void setPrefix(std::string
const &prefix);
68 void applyWeightSquared(
bool flag)
override;
70 void enableOffsetting(
bool)
override;
72 void enableBinOffsetting(
bool on =
true) { _doBinOffset =
on; }
74 void setSimCount(
int simCount) { _simCount = simCount; }
82 RooAbsReal
const &func()
const {
return *_func; }
83 RooAbsReal
const &weightVar()
const {
return *_weightVar; }
84 RooAbsReal
const &weightSquaredVar()
const {
return *_weightSquaredVar; }
85 bool binnedL()
const {
return _binnedL; }
86 int simCount()
const {
return _simCount; }
87 Statistic statistic()
const {
return _statistic; }
88 FuncMode funcMode()
const {
return _funcMode; }
90 RooAbsReal
const *expectedEvents()
const {
return _expectedEvents ? &**_expectedEvents :
nullptr; }
91 RooAbsReal
const *binVolumes()
const {
return _binVolumes ? &**_binVolumes :
nullptr; }
92 RooAbsReal
const *weightErrLo()
const {
return _weightErrLo ? &**_weightErrLo :
nullptr; }
93 RooAbsReal
const *weightErrHi()
const {
return _weightErrHi ? &**_weightErrHi :
nullptr; }
96 double evaluate()
const override {
return _value; }
97 void resetWeightVarNames();
98 void finalizeResult(RooFit::EvalContext &, ROOT::Math::KahanSum<double>
result,
double weightSum)
const;
99 void fillBinWidthsFromPdfBoundaries(RooAbsReal
const &pdf, RooArgSet
const &observables);
100 void doEvalBinnedL(RooFit::EvalContext &, std::span<const double> preds, std::span<const double> weights)
const;
101 void doEvalChi2(RooFit::EvalContext &, std::span<const double> preds, std::span<const double> weights,
102 std::span<const double> weightsSumW2)
const;
104 RooTemplateProxy<RooAbsReal> _func;
105 RooTemplateProxy<RooAbsReal> _weightVar;
106 RooTemplateProxy<RooAbsReal> _weightSquaredVar;
107 std::unique_ptr<RooTemplateProxy<RooAbsReal>> _expectedEvents;
108 std::unique_ptr<RooTemplateProxy<RooAbsPdf>> _offsetPdf;
109 std::unique_ptr<RooTemplateProxy<RooAbsReal>> _binVolumes;
110 std::unique_ptr<RooTemplateProxy<RooAbsReal>> _weightErrLo;
111 std::unique_ptr<RooTemplateProxy<RooAbsReal>> _weightErrHi;
112 bool _weightSquared =
false;
113 bool _binnedL =
false;
114 bool _doOffset =
false;
115 bool _doBinOffset =
false;
116 Statistic _statistic = Statistic::NLL;
117 FuncMode _funcMode = FuncMode::Pdf;
121 std::vector<double> _binw;
122 mutable ROOT::Math::KahanSum<double> _offset{0.};
double evaluate() const override
#define ClassDefOverride(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
OffsetMode
For setting the offset mode with the Offset() command argument to RooAbsPdf::fitTo()