Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooMinimizerFcn.h
Go to the documentation of this file.
1/// \cond ROOFIT_INTERNAL
2
3/*****************************************************************************
4 * Project: RooFit *
5 * Package: RooFitCore *
6 * @(#)root/roofitcore:$Id$
7 * Authors: *
8 * AL, Alfio Lazzaro, INFN Milan, alfio.lazzaro@mi.infn.it *
9 * PB, Patrick Bos, Netherlands eScience Center, p.bos@esciencecenter.nl *
10 * *
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
17#ifndef ROO_MINIMIZER_FCN
18#define ROO_MINIMIZER_FCN
19
20#include "Math/IFunction.h"
21
22#include "RooAbsReal.h"
23#include "RooArgList.h"
24
25#include <fstream>
26#include <mutex>
27#include <vector>
28
29#include "RooAbsMinimizerFcn.h"
30
31// forward declaration
32class RooMinimizer;
33
34class RooMinimizerFcn : public RooAbsMinimizerFcn {
35
36public:
37 RooMinimizerFcn(RooAbsReal *funct, RooMinimizer *context);
38
39 void initMinimizer(ROOT::Math::Minimizer &, RooMinimizer *context) override;
40
41 std::string getFunctionName() const override;
42 std::string getFunctionTitle() const override;
43
44 void setOffsetting(bool flag) override;
45
46 double operator()(const double *x) const;
47 void evaluateGradient(const double *x, double *out) const;
48 bool evaluateHessian(std::span<const double> x, double *out) const;
49
51
52 bool secondDerivativeAlwaysVanishes(unsigned int i, unsigned int j) const;
53
54private:
55 void buildSecondDerivMask() const;
56
57 RooAbsReal *_funct = nullptr;
58 std::unique_ptr<ROOT::Math::IBaseFunctionMultiDim> _multiGenFcn;
59 mutable std::vector<double> _gradientOutput;
60 mutable std::vector<double> _hessianOutput;
61 mutable std::vector<bool> _secondDerivMask; ///< Lazily built, see buildSecondDerivMask().
62 mutable std::once_flag _secondDerivMaskOnce;
63};
64
65#endif
66
67/// \endcond
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2,...
Definition Minimizer.h:124
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:63
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Wrapper class around ROOT::Math::Minimizer that provides a seamless interface between the minimizer f...
Double_t x[n]
Definition legend1.C:17