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
22
23namespace ROOT {
24namespace Experimental {
25
26class RooNLLVarNew : public RooAbsReal {
27
28public:
29 // The names for the weight variables that the RooNLLVarNew expects
30 static constexpr const char *weightVarName = "_weight";
31 static constexpr const char *weightVarNameSumW2 = "_weight_sumW2";
32
34 RooNLLVarNew(const char *name, const char *title, RooAbsPdf &pdf, RooArgSet const &observables, bool isExtended,
35 std::string const &rangeName);
36 RooNLLVarNew(const RooNLLVarNew &other, const char *name = 0);
37 TObject *clone(const char *newname) const override { return new RooNLLVarNew(*this, newname); }
38
39 void getParametersHook(const RooArgSet *nset, RooArgSet *list, bool stripDisconnected) const override;
40
41 /// Return default level for MINUIT error analysis.
42 double defaultErrorLevel() const override { return 0.5; }
43
44 inline RooAbsPdf *getPdf() const { return &*_pdf; }
45 void computeBatch(cudaStream_t *, double *output, size_t nOut, RooFit::Detail::DataMap const&) const override;
46 inline bool isReducerNode() const override { return true; }
47
48 RooArgSet prefixObservableAndWeightNames(std::string const &prefix);
49
50 void applyWeightSquared(bool flag) override;
51
52protected:
53 void setObservables(RooArgSet const &observables)
54 {
56 _observables.add(observables);
57 }
58
61 mutable double _sumWeight = 0.0; //!
62 mutable double _sumWeight2 = 0.0; //!
63 mutable double _sumCorrectionTerm = 0.0; //!
65 bool _weightSquared = false;
66 std::string _prefix;
67 std::unique_ptr<RooTemplateProxy<RooAbsReal>> _rangeNormTerm;
68
69 double evaluate() const override;
70
71}; // end class RooNLLVar
72
73} // end namespace Experimental
74} // end namespace ROOT
75
76#endif
char name[80]
Definition: TGX11.cxx:110
std::unique_ptr< RooTemplateProxy< RooAbsReal > > _rangeNormTerm
Definition: RooNLLVarNew.h:67
TObject * clone(const char *newname) const override
Definition: RooNLLVarNew.h:37
void setObservables(RooArgSet const &observables)
Definition: RooNLLVarNew.h:53
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
RooTemplateProxy< RooAbsPdf > _pdf
Definition: RooNLLVarNew.h:59
double defaultErrorLevel() const override
Return default level for MINUIT error analysis.
Definition: RooNLLVarNew.h:42
RooAbsPdf * getPdf() const
Definition: RooNLLVarNew.h:44
static constexpr const char * weightVarName
Definition: RooNLLVarNew.h:30
bool isReducerNode() const override
Definition: RooNLLVarNew.h:46
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:31
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
void clear()
Clear contents. If the collection is owning, it will also delete the contents.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:64
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:57
Mother of all ROOT objects.
Definition: TObject.h:37
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
std::map< DataKey, RooSpan< const double > > DataMap
Definition: DataMap.h:59
static void output()