Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooNLLVar.h
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 *
4 * Copyright (c) 2024, CERN
5 *
6 * Redistribution and use in source and binary forms,
7 * with or without modification, are permitted according to the terms
8 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
9 */
10
11#ifndef ROO_NLL_VAR
12#define ROO_NLL_VAR
13
15#include "RooCmdArg.h"
16#include "RooAbsPdf.h"
17#include <vector>
18#include <utility>
19
21public:
22
23 // Constructors, assignment etc
24 RooNLLVar(const char *name, const char *title, RooAbsPdf& pdf, RooAbsData& data,
25 bool extended,
27
28 RooNLLVar(const char *name, const char *title, RooAbsPdf& pdf, RooAbsData& data,
29 const RooArgSet& projDeps, bool extended = false,
31
32 RooNLLVar(const RooNLLVar& other, const char* name=nullptr);
33 TObject* clone(const char* newname) const override { return new RooNLLVar(*this,newname); }
34
35 RooAbsTestStatistic* create(const char *name, const char *title, RooAbsReal& pdf, RooAbsData& adata,
36 const RooArgSet& projDeps, RooAbsTestStatistic::Configuration const& cfg) override;
37
38 ~RooNLLVar() override;
39
40 void applyWeightSquared(bool flag) override;
41
42 double defaultErrorLevel() const override { return 0.5 ; }
43
44 void enableBinOffsetting(bool on = true);
45
46 using ComputeResult = std::pair<ROOT::Math::KahanSum<double>, double>;
47
48 static RooNLLVar::ComputeResult computeScalarFunc(const RooAbsPdf *pdfClone, RooAbsData *dataClone, RooArgSet *normSet,
49 bool weightSq, std::size_t stepSize, std::size_t firstEvent,
50 std::size_t lastEvent, RooAbsPdf const* offsetPdf = nullptr);
51
52 bool setDataSlave(RooAbsData& data, bool cloneData=true, bool ownNewDataAnyway=false) override;
53
54protected:
55
56 bool processEmptyDataSets() const override { return _extended ; }
57 double evaluatePartition(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize) const override;
58
59 static RooArgSet _emptySet ; // Supports named argument constructor
60
61private:
62 ComputeResult computeScalar(std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent) const;
63
64 bool _extended{false};
65 bool _doBinOffset{false};
66 bool _weightSq{false}; ///< Apply weights squared?
67 mutable bool _first{true}; ///<!
69
70 mutable std::vector<double> _binw ; ///<!
71 mutable RooAbsPdf* _binnedPdf{nullptr}; ///<!
72 std::unique_ptr<RooAbsPdf> _offsetPdf; ///<! An optional per-bin likelihood offset
73};
74
75#endif
76
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 base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract base class for test statistics objects that evaluate a function or PDF at each point of a gi...
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
Abstract base class for all test statistics.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Implements a -log(likelihood) calculation from a dataset and a PDF.
Definition RooNLLVar.h:20
ComputeResult computeScalar(std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent) const
bool processEmptyDataSets() const override
Definition RooNLLVar.h:56
std::unique_ptr< RooAbsPdf > _offsetPdf
! An optional per-bin likelihood offset
Definition RooNLLVar.h:72
static RooNLLVar::ComputeResult computeScalarFunc(const RooAbsPdf *pdfClone, RooAbsData *dataClone, RooArgSet *normSet, bool weightSq, std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent, RooAbsPdf const *offsetPdf=nullptr)
bool _doBinOffset
Definition RooNLLVar.h:65
ROOT::Math::KahanSum< double > _offsetSaveW2
!
Definition RooNLLVar.h:68
static RooArgSet _emptySet
Definition RooNLLVar.h:59
RooAbsPdf * _binnedPdf
!
Definition RooNLLVar.h:71
void applyWeightSquared(bool flag) override
Disables or enables the usage of squared weights.
std::vector< double > _binw
!
Definition RooNLLVar.h:70
std::pair< ROOT::Math::KahanSum< double >, double > ComputeResult
Definition RooNLLVar.h:46
bool _extended
Definition RooNLLVar.h:64
TObject * clone(const char *newname) const override
Definition RooNLLVar.h:33
bool setDataSlave(RooAbsData &data, bool cloneData=true, bool ownNewDataAnyway=false) override
Change dataset that is used to given one.
RooAbsTestStatistic * create(const char *name, const char *title, RooAbsReal &pdf, RooAbsData &adata, const RooArgSet &projDeps, RooAbsTestStatistic::Configuration const &cfg) override
Create a test statistic using several properties of the current instance.
void enableBinOffsetting(bool on=true)
double defaultErrorLevel() const override
Definition RooNLLVar.h:42
~RooNLLVar() override
Definition RooNLLVar.cxx:51
bool _first
!
Definition RooNLLVar.h:67
bool _weightSq
Apply weights squared?
Definition RooNLLVar.h:66
double evaluatePartition(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize) const override
Calculate and return likelihood on subset of data.
Mother of all ROOT objects.
Definition TObject.h:41