Logo ROOT  
Reference Guide
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
25class RooRealSumPdf ;
26namespace RooBatchCompute {
27struct RunContext;
28}
29
31public:
32
33 // Constructors, assignment etc
34 RooNLLVar();
35 RooNLLVar(const char *name, const char* title, RooAbsPdf& pdf, RooAbsData& data,
36 const RooCmdArg& arg1=RooCmdArg::none(), const RooCmdArg& arg2=RooCmdArg::none(),const RooCmdArg& arg3=RooCmdArg::none(),
37 const RooCmdArg& arg4=RooCmdArg::none(), const RooCmdArg& arg5=RooCmdArg::none(),const RooCmdArg& arg6=RooCmdArg::none(),
38 const RooCmdArg& arg7=RooCmdArg::none(), const RooCmdArg& arg8=RooCmdArg::none(),const RooCmdArg& arg9=RooCmdArg::none()) ;
39
40 RooNLLVar(const char *name, const char *title, RooAbsPdf& pdf, RooAbsData& data,
41 bool extended,
43
44 RooNLLVar(const char *name, const char *title, RooAbsPdf& pdf, RooAbsData& data,
45 const RooArgSet& projDeps, bool extended = false,
47
48 RooNLLVar(const RooNLLVar& other, const char* name=0);
49 TObject* clone(const char* newname) const override { return new RooNLLVar(*this,newname); }
50
51 RooAbsTestStatistic* create(const char *name, const char *title, RooAbsReal& pdf, RooAbsData& adata,
52 const RooArgSet& projDeps, RooAbsTestStatistic::Configuration const& cfg) override;
53
54 ~RooNLLVar() override;
55
56 void applyWeightSquared(bool flag) override;
57
58 double defaultErrorLevel() const override { return 0.5 ; }
59
60 void batchMode(bool on = true) {
62 }
63
64 using ComputeResult = std::pair<ROOT::Math::KahanSum<double>, double>;
65
66 static RooNLLVar::ComputeResult computeBatchedFunc(const RooAbsPdf *pdfClone, RooAbsData *dataClone,
67 std::unique_ptr<RooBatchCompute::RunContext> &evalData,
68 RooArgSet *normSet, bool weightSq, std::size_t stepSize,
69 std::size_t firstEvent, std::size_t lastEvent);
70 static RooNLLVar::ComputeResult computeScalarFunc(const RooAbsPdf *pdfClone, RooAbsData *dataClone, RooArgSet *normSet,
71 bool weightSq, std::size_t stepSize, std::size_t firstEvent,
72 std::size_t lastEvent);
73
74protected:
75
76 bool processEmptyDataSets() const override { return _extended ; }
77 double evaluatePartition(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize) const override;
78
79 static RooArgSet _emptySet ; // Supports named argument constructor
80
81private:
82 ComputeResult computeBatched(std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent) const;
83 ComputeResult computeScalar(std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent) const;
84
85 bool _extended{false};
86 bool _batchEvaluations{false};
87 bool _weightSq{false}; ///< Apply weights squared?
88 mutable bool _first{true}; ///<!
90
91 mutable std::vector<double> _binw ; ///<!
92 mutable RooRealSumPdf* _binnedPdf{nullptr}; ///<!
93 mutable std::unique_ptr<RooBatchCompute::RunContext> _evalData; ///<! Struct to store function evaluation workspaces.
94
95 ClassDefOverride(RooNLLVar,3) // Function representing (extended) -log(L) of p.d.f and dataset
96};
97
98#endif
99
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
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
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:62
RooAbsOptTestStatistic is the abstract base class for test statistics objects that evaluate a functio...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:64
RooAbsTestStatistic is the abstract base class for all test statistics.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:57
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:26
static const RooCmdArg & none()
Return reference to null argument.
Definition: RooCmdArg.cxx:51
Class RooNLLVar implements a -log(likelihood) calculation from a dataset and a PDF.
Definition: RooNLLVar.h:30
ComputeResult computeScalar(std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent) const
Definition: RooNLLVar.cxx:466
bool processEmptyDataSets() const override
Definition: RooNLLVar.h:76
RooRealSumPdf * _binnedPdf
!
Definition: RooNLLVar.h:92
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)
Definition: RooNLLVar.cxx:472
ROOT::Math::KahanSum< double > _offsetSaveW2
!
Definition: RooNLLVar.h:89
static RooNLLVar::ComputeResult computeBatchedFunc(const RooAbsPdf *pdfClone, RooAbsData *dataClone, std::unique_ptr< RooBatchCompute::RunContext > &evalData, RooArgSet *normSet, bool weightSq, std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent)
Definition: RooNLLVar.cxx:364
bool _batchEvaluations
Definition: RooNLLVar.h:86
static RooArgSet _emptySet
Definition: RooNLLVar.h:79
void batchMode(bool on=true)
Definition: RooNLLVar.h:60
void applyWeightSquared(bool flag) override
Disables or enables the usage of squared weights.
Definition: RooNLLVar.cxx:199
std::vector< double > _binw
!
Definition: RooNLLVar.h:91
std::pair< ROOT::Math::KahanSum< double >, double > ComputeResult
Definition: RooNLLVar.h:64
bool _extended
Definition: RooNLLVar.h:85
TObject * clone(const char *newname) const override
Definition: RooNLLVar.h:49
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.
Definition: RooNLLVar.cxx:185
double defaultErrorLevel() const override
Definition: RooNLLVar.h:58
~RooNLLVar() override
Definition: RooNLLVar.cxx:73
bool _first
!
Definition: RooNLLVar.h:88
std::unique_ptr< RooBatchCompute::RunContext > _evalData
! Struct to store function evaluation workspaces.
Definition: RooNLLVar.h:93
ComputeResult computeBatched(std::size_t stepSize, std::size_t firstEvent, std::size_t lastEvent) const
Compute probabilites of all data events.
Definition: RooNLLVar.cxx:357
bool _weightSq
Apply weights squared?
Definition: RooNLLVar.h:87
double evaluatePartition(std::size_t firstEvent, std::size_t lastEvent, std::size_t stepSize) const override
Calculate and return likelihood on subset of data.
Definition: RooNLLVar.cxx:227
The class RooRealSumPdf implements a PDF constructed from a sum of functions:
Definition: RooRealSumPdf.h:24
Mother of all ROOT objects.
Definition: TObject.h:37
Namespace for dispatching RooFit computations to various backends.