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
20#include "RooCmdArg.h"
21#include "RooAbsPdf.h"
22#include <vector>
23#include <utility>
24
26public:
27
28 // Constructors, assignment etc
29 RooNLLVar(const char *name, const char* title, RooAbsPdf& pdf, RooAbsData& data,
30 const RooCmdArg& arg1={}, const RooCmdArg& arg2={},const RooCmdArg& arg3={},
31 const RooCmdArg& arg4={}, const RooCmdArg& arg5={},const RooCmdArg& arg6={},
32 const RooCmdArg& arg7={}, const RooCmdArg& arg8={},const RooCmdArg& arg9={}) ;
33
34 RooNLLVar(const char *name, const char *title, RooAbsPdf& pdf, RooAbsData& data,
35 bool extended,
37
38 RooNLLVar(const char *name, const char *title, RooAbsPdf& pdf, RooAbsData& data,
39 const RooArgSet& projDeps, bool extended = false,
41
42 RooNLLVar(const RooNLLVar& other, const char* name=nullptr);
43 TObject* clone(const char* newname) const override { return new RooNLLVar(*this,newname); }
44
45 RooAbsTestStatistic* create(const char *name, const char *title, RooAbsReal& pdf, RooAbsData& adata,
46 const RooArgSet& projDeps, RooAbsTestStatistic::Configuration const& cfg) override;
47
48 ~RooNLLVar() override;
49
50 void applyWeightSquared(bool flag) override;
51
52 double defaultErrorLevel() const override { return 0.5 ; }
53
54 void enableBinOffsetting(bool on = true);
55
56 using ComputeResult = std::pair<ROOT::Math::KahanSum<double>, double>;
57
58 static RooNLLVar::ComputeResult computeScalarFunc(const RooAbsPdf *pdfClone, RooAbsData *dataClone, RooArgSet *normSet,
59 bool weightSq, std::size_t stepSize, std::size_t firstEvent,
60 std::size_t lastEvent, RooAbsPdf const* offsetPdf = nullptr);
61
62 bool setDataSlave(RooAbsData& data, bool cloneData=true, bool ownNewDataAnyway=false) override;
63
64protected:
65
66 bool processEmptyDataSets() const override { return _extended ; }
67 double evaluatePartition(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize) const override;
68
69 static RooArgSet _emptySet ; // Supports named argument constructor
70
71private:
72 ComputeResult computeScalar(std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent) const;
73
74 bool _extended{false};
75 bool _doBinOffset{false};
76 bool _weightSq{false}; ///< Apply weights squared?
77 mutable bool _first{true}; ///<!
79
80 mutable std::vector<double> _binw ; ///<!
81 mutable RooAbsPdf* _binnedPdf{nullptr}; ///<!
82 std::unique_ptr<RooAbsPdf> _offsetPdf; ///<! An optional per-bin likelihood offset
83
84 ClassDefOverride(RooNLLVar,0) // Function representing (extended) -log(L) of p.d.f and dataset
85};
86
87#endif
88
#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
RooAbsOptTestStatistic is the abstract base class for test statistics objects that evaluate a functio...
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
Named container for two doubles, two integers two object points and three string pointers that can be...
Definition RooCmdArg.h:26
Class RooNLLVar implements a -log(likelihood) calculation from a dataset and a PDF.
Definition RooNLLVar.h:25
ComputeResult computeScalar(std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent) const
bool processEmptyDataSets() const override
Definition RooNLLVar.h:66
std::unique_ptr< RooAbsPdf > _offsetPdf
! An optional per-bin likelihood offset
Definition RooNLLVar.h:82
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:75
ROOT::Math::KahanSum< double > _offsetSaveW2
!
Definition RooNLLVar.h:78
static RooArgSet _emptySet
Definition RooNLLVar.h:69
RooAbsPdf * _binnedPdf
!
Definition RooNLLVar.h:81
void applyWeightSquared(bool flag) override
Disables or enables the usage of squared weights.
std::vector< double > _binw
!
Definition RooNLLVar.h:80
std::pair< ROOT::Math::KahanSum< double >, double > ComputeResult
Definition RooNLLVar.h:56
bool _extended
Definition RooNLLVar.h:74
TObject * clone(const char *newname) const override
Definition RooNLLVar.h:43
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:52
~RooNLLVar() override
Definition RooNLLVar.cxx:69
bool _first
!
Definition RooNLLVar.h:77
bool _weightSq
Apply weights squared?
Definition RooNLLVar.h:76
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