Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooNLLVar.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooNLLVar.h,v 1.10 2007/07/21 21:32:52 wouter Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_NLL_VAR
17#define ROO_NLL_VAR
18
19// We can't print deprecation warnings when including headers in cling, because
20// this will be done automatically anyway.
21#ifdef __CLING__
22#ifndef ROOFIT_BUILDS_ITSELF
23// These warnings should only be suppressed when building ROOT itself!
24#warning "Including RooNLLVar.h is deprecated, and this header will be removed in ROOT v6.34: please use RooAbsPdf::createNLL() to create likelihood objects"
25#else
26// If we are builting RooFit itself, this will serve as a reminder to actually
27// remove this deprecate public header. Here is now this needs to be done:
28// 1. Move this header file from inc/ to src/
29// 2. Remove the LinkDef entry, ClassDefOverride, and ClassImpl macros for
30// this class
31// 3. If there are are tests using this class in the test/ directory, change
32// the include to use a relative path the moved header file in the src/
33// directory, e.g. #include <RemovedInterface.h> becomes #include
34// "../src/RemovedInterface.h"
35// 4. Remove this ifndef-else-endif block from the header
36// 5. Remove the deprecation warning at the end of the class declaration
37#include <RVersion.h>
38#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 34, 00)
39#error "Please remove this deprecated public interface."
40#endif
41#endif
42#endif
45#include "RooCmdArg.h"
46#include "RooAbsPdf.h"
47#include <vector>
48#include <utility>
51public:
52
53 // Constructors, assignment etc
54 RooNLLVar(const char *name, const char *title, RooAbsPdf& pdf, RooAbsData& data,
55 bool extended,
57
58 RooNLLVar(const char *name, const char *title, RooAbsPdf& pdf, RooAbsData& data,
59 const RooArgSet& projDeps, bool extended = false,
61
62 RooNLLVar(const RooNLLVar& other, const char* name=nullptr);
63 TObject* clone(const char* newname) const override { return new RooNLLVar(*this,newname); }
64
65 RooAbsTestStatistic* create(const char *name, const char *title, RooAbsReal& pdf, RooAbsData& adata,
66 const RooArgSet& projDeps, RooAbsTestStatistic::Configuration const& cfg) override;
67
68 ~RooNLLVar() override;
69
70 void applyWeightSquared(bool flag) override;
71
72 double defaultErrorLevel() const override { return 0.5 ; }
73
74 void enableBinOffsetting(bool on = true);
75
76 using ComputeResult = std::pair<ROOT::Math::KahanSum<double>, double>;
77
78 static RooNLLVar::ComputeResult computeScalarFunc(const RooAbsPdf *pdfClone, RooAbsData *dataClone, RooArgSet *normSet,
79 bool weightSq, std::size_t stepSize, std::size_t firstEvent,
80 std::size_t lastEvent, RooAbsPdf const* offsetPdf = nullptr);
81
82 bool setDataSlave(RooAbsData& data, bool cloneData=true, bool ownNewDataAnyway=false) override;
83
84protected:
85
86 bool processEmptyDataSets() const override { return _extended ; }
87 double evaluatePartition(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize) const override;
88
89 static RooArgSet _emptySet ; // Supports named argument constructor
90
91private:
92 ComputeResult computeScalar(std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent) const;
93
94 bool _extended{false};
95 bool _doBinOffset{false};
96 bool _weightSq{false}; ///< Apply weights squared?
97 mutable bool _first{true}; ///<!
99
100 mutable std::vector<double> _binw ; ///<!
101 mutable RooAbsPdf* _binnedPdf{nullptr}; ///<!
102 std::unique_ptr<RooAbsPdf> _offsetPdf; ///<! An optional per-bin likelihood offset
103
104 ClassDefOverride(RooNLLVar,0) // Function representing (extended) -log(L) of p.d.f and dataset
105
106#ifndef ROOFIT_BUILDS_ITSELF
107} R__DEPRECATED(6,34, "Please use RooAbsPdf::createNLL() to create likelihood objects");
108#else
109};
110#endif
111
112#endif
113
#define R__DEPRECATED(MAJOR, MINOR, REASON)
Definition RConfig.hxx:521
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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:55
Implements a -log(likelihood) calculation from a dataset and a PDF.
Definition RooNLLVar.h:50
ComputeResult computeScalar(std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent) const
bool processEmptyDataSets() const override
Definition RooNLLVar.h:86
std::unique_ptr< RooAbsPdf > _offsetPdf
! An optional per-bin likelihood offset
Definition RooNLLVar.h:102
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:95
ROOT::Math::KahanSum< double > _offsetSaveW2
!
Definition RooNLLVar.h:98
static RooArgSet _emptySet
Definition RooNLLVar.h:89
RooAbsPdf * _binnedPdf
!
Definition RooNLLVar.h:101
void applyWeightSquared(bool flag) override
Disables or enables the usage of squared weights.
std::vector< double > _binw
!
Definition RooNLLVar.h:100
std::pair< ROOT::Math::KahanSum< double >, double > ComputeResult
Definition RooNLLVar.h:76
bool _extended
Definition RooNLLVar.h:94
TObject * clone(const char *newname) const override
Definition RooNLLVar.h:63
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:72
~RooNLLVar() override
Definition RooNLLVar.cxx:53
bool _first
!
Definition RooNLLVar.h:97
bool _weightSq
Apply weights squared?
Definition RooNLLVar.h:96
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