Logo ROOT  
Reference Guide
RooNLLVarNew.h
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * Jonas Rembser, CERN 2021
5 * Emmanouil Michalainas, CERN 2021
6 *
7 * Copyright (c) 2021, CERN
8 *
9 * Redistribution and use in source and binary forms,
10 * with or without modification, are permitted according to the terms
11 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
12 */
13
14#ifndef RooFit_RooNLLVarNew_h
15#define RooFit_RooNLLVarNew_h
16
17#include "RooAbsPdf.h"
18#include "RooAbsReal.h"
19#include "RooTemplateProxy.h"
20
21#include <Math/Util.h>
22
24
25namespace ROOT {
26namespace Experimental {
27
28class RooNLLVarNew : public RooAbsReal {
29
30public:
31 // The names for the weight variables that the RooNLLVarNew expects
32 static constexpr const char *weightVarName = "_weight";
33 static constexpr const char *weightVarNameSumW2 = "_weight_sumW2";
34
36 RooNLLVarNew(const char *name, const char *title, RooAbsPdf &pdf, RooArgSet const &observables, bool isExtended,
37 bool doOffset);
38 RooNLLVarNew(const RooNLLVarNew &other, const char *name = nullptr);
39 TObject *clone(const char *newname) const override { return new RooNLLVarNew(*this, newname); }
40
41 void getParametersHook(const RooArgSet *nset, RooArgSet *list, bool stripDisconnected) const override;
42
43 /// Return default level for MINUIT error analysis.
44 double defaultErrorLevel() const override { return 0.5; }
45
46 inline RooAbsPdf *getPdf() const { return &*_pdf; }
47 void computeBatch(cudaStream_t *, double *output, size_t nOut, RooFit::Detail::DataMap const &) const override;
48 inline bool isReducerNode() const override { return true; }
49
50 RooArgSet prefixObservableAndWeightNames(std::string const &prefix);
51
52 void applyWeightSquared(bool flag) override;
53
54 std::unique_ptr<RooArgSet> fillNormSetForServer(RooArgSet const &normSet, RooAbsArg const &server) const override;
55
56private:
57 double evaluate() const override;
59
62 mutable double _sumWeight = 0.0; //!
63 mutable double _sumWeight2 = 0.0; //!
65 bool _weightSquared = false;
66 bool _binnedL = false;
67 bool _doOffset = false;
68 std::string _prefix;
71 mutable std::vector<double> _binw; ///<!
72 mutable std::vector<double> _logProbasBuffer; ///<!
73 mutable ROOT::Math::KahanSum<double> _offset = 0.0; ///<! Offset as KahanSum to avoid loss of precision
74
75}; // end class RooNLLVar
76
77} // end namespace Experimental
78} // end namespace ROOT
79
80#endif
char name[80]
Definition: TGX11.cxx:110
RooTemplateProxy< RooAbsReal > _weightVar
Definition: RooNLLVarNew.h:69
TObject * clone(const char *newname) const override
Definition: RooNLLVarNew.h:39
void computeBatch(cudaStream_t *, double *output, size_t nOut, RooFit::Detail::DataMap const &) const override
Compute multiple negative logs of propabilities.
void applyWeightSquared(bool flag) override
Toggles the weight square correction.
void getParametersHook(const RooArgSet *nset, RooArgSet *list, bool stripDisconnected) const override
ROOT::Math::KahanSum< double > _offset
! Offset as KahanSum to avoid loss of precision
Definition: RooNLLVarNew.h:73
RooTemplateProxy< RooAbsPdf > _pdf
Definition: RooNLLVarNew.h:60
std::vector< double > _logProbasBuffer
!
Definition: RooNLLVarNew.h:72
double defaultErrorLevel() const override
Return default level for MINUIT error analysis.
Definition: RooNLLVarNew.h:44
RooTemplateProxy< RooAbsReal > _weightSquaredVar
Definition: RooNLLVarNew.h:70
std::vector< double > _binw
!
Definition: RooNLLVarNew.h:71
RooAbsPdf * getPdf() const
Definition: RooNLLVarNew.h:46
static constexpr const char * weightVarName
Definition: RooNLLVarNew.h:32
std::unique_ptr< RooArgSet > fillNormSetForServer(RooArgSet const &normSet, RooAbsArg const &server) const override
Fills a RooArgSet to be used as the normalization set for a server, given a normalization set for thi...
bool isReducerNode() const override
Definition: RooNLLVarNew.h:48
RooArgSet prefixObservableAndWeightNames(std::string const &prefix)
Replaces all observables and the weight variable of this NLL with clones that only differ by a prefix...
static constexpr const char * weightVarNameSumW2
Definition: RooNLLVarNew.h:33
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:71
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:62
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:56
Mother of all ROOT objects.
Definition: TObject.h:41
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
static void output()