Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooNLLVarNew.h
Go to the documentation of this file.
1/// \cond ROOFIT_INTERNAL
2
3/*
4 * Project: RooFit
5 * Authors:
6 * Jonas Rembser, CERN 2021
7 * Emmanouil Michalainas, CERN 2021
8 *
9 * Copyright (c) 2021, CERN
10 *
11 * Redistribution and use in source and binary forms,
12 * with or without modification, are permitted according to the terms
13 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
14 */
15
16#ifndef RooFit_RooNLLVarNew_h
17#define RooFit_RooNLLVarNew_h
18
19#include <RooAbsPdf.h>
20#include <RooAbsReal.h>
21#include <RooGlobalFunc.h>
22#include <RooTemplateProxy.h>
23
24#include <Math/Util.h>
25
26class RooNLLVarNew : public RooAbsReal {
27
28public:
29 // The names for the weight variables that the RooNLLVarNew expects
30 static constexpr const char *weightVarName = "_weight";
31 static constexpr const char *weightVarNameSumW2 = "_weight_sumW2";
32
33 RooNLLVarNew(const char *name, const char *title, RooAbsPdf &pdf, RooArgSet const &observables, bool isExtended,
34 RooFit::OffsetMode offsetMode);
35 RooNLLVarNew(const RooNLLVarNew &other, const char *name = nullptr);
36 TObject *clone(const char *newname) const override { return new RooNLLVarNew(*this, newname); }
37
38 /// Return default level for MINUIT error analysis.
39 double defaultErrorLevel() const override { return 0.5; }
40
41 void doEval(RooFit::EvalContext &) const override;
42 bool canComputeBatchWithCuda() const override { return !_binnedL; }
43 bool isReducerNode() const override { return true; }
44
45 void setPrefix(std::string const &prefix);
46
47 void applyWeightSquared(bool flag) override;
48
49 void enableOffsetting(bool) override;
50
51 void enableBinOffsetting(bool on = true) { _doBinOffset = on; }
52
53 void setSimCount(int simCount) { _simCount = simCount; }
54
55 void translate(RooFit::Detail::CodeSquashContext &ctx) const override;
56
57private:
58 double evaluate() const override { return _value; }
59 void resetWeightVarNames();
60 void finalizeResult(RooFit::EvalContext &, ROOT::Math::KahanSum<double> result, double weightSum) const;
61 void fillBinWidthsFromPdfBoundaries(RooAbsReal const &pdf, RooArgSet const &observables);
62 void doEvalBinnedL(RooFit::EvalContext &, std::span<const double> preds, std::span<const double> weights) const;
63
66 RooTemplateProxy<RooAbsReal> _weightSquaredVar;
67 std::unique_ptr<RooTemplateProxy<RooAbsReal>> _expectedEvents;
68 std::unique_ptr<RooTemplateProxy<RooAbsPdf>> _offsetPdf;
69 mutable double _sumWeight = 0.0; //!
70 mutable double _sumWeight2 = 0.0; //!
71 bool _weightSquared = false;
72 bool _binnedL = false;
73 bool _doOffset = false;
74 bool _doBinOffset = false;
75 int _simCount = 1;
76 std::string _prefix;
77 std::vector<double> _binw;
78 mutable ROOT::Math::KahanSum<double> _offset{0.}; ///<! Offset as KahanSum to avoid loss of precision
79
80}; // end class RooNLLVar
81
82#endif
83
84/// \endcond
bool _doOffset
Apply interval value offset to control numeric precision?
void enableOffsetting(bool flag) override
ROOT::Math::KahanSum< double > _offset
! Offset as KahanSum to avoid loss of precision
void setSimCount(Int_t simCount)
Int_t _simCount
Total number of component p.d.f.s in RooSimultaneous (if any)
double evaluate() const override
TObject * clone(const char *newname) const override
Definition RooChi2Var.h:9
double defaultErrorLevel() const override
Definition RooChi2Var.h:17
void applyWeightSquared(bool flag) override
bool _doBinOffset
Definition RooNLLVar.h:44
std::vector< double > _binw
!
Definition RooNLLVar.h:49
std::unique_ptr< RooAbsPdf > _offsetPdf
! An optional per-bin likelihood offset
Definition RooNLLVar.h:51
void enableBinOffsetting(bool on=true)
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
char name[80]
Definition TGX11.cxx:110
The Kahan summation is a compensated summation algorithm, which significantly reduces numerical error...
Definition Util.h:122
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
A class to maintain the context for squashing of RooFit models into code.
Mother of all ROOT objects.
Definition TObject.h:41
OffsetMode
For setting the offset mode with the Offset() command argument to RooAbsPdf::fitTo()