Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
LikelihoodGradientWrapper.cxx
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * PB, Patrick Bos, Netherlands eScience Center, p.bos@esciencecenter.nl
5 *
6 * Copyright (c) 2021, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
14#include "RooMinimizer.h"
15
16// including derived classes for factory method
17#ifdef ROOFIT_MULTIPROCESS
19#endif // ROOFIT_MULTIPROCESS
20
21namespace RooFit {
22namespace TestStatistics {
23
24/** \class LikelihoodGradientWrapper
25 * \brief Virtual base class for implementation of likelihood gradient calculation strategies
26 *
27 * This class provides the interface necessary for RooMinimizer (through MinuitFcnGrad) to get the likelihood gradient
28 * values it needs for fitting the pdf to the data. The strategy by which these values are obtained is up to the
29 * implementer of this class. Its intended purpose was mainly to allow for parallel calculation strategies.
30 *
31 * \note The class is not intended for use by end-users. We recommend to either use RooMinimizer with a RooAbsL derived
32 * likelihood object, or to use a higher level entry point like RooAbsPdf::fitTo() or RooAbsPdf::createNLL().
33 */
34
35/*
36 * \param[in] likelihood Shared pointer to the likelihood that must be evaluated
37 * \param[in] calculation_is_clean Shared pointer to the object that keeps track of what has been evaluated for the
38 * current parameter set provided by Minuit. This information can be used by different calculators, so must be shared
39 * between them. \param[in] minimizer Raw pointer to the minimizer that owns the MinuitFcnGrad object that owns this
40 * wrapper object.
41 */
42LikelihoodGradientWrapper::LikelihoodGradientWrapper(std::shared_ptr<RooAbsL> likelihood,
43 std::shared_ptr<WrapperCalculationCleanFlags> calculation_is_clean,
44 std::size_t /*N_dim*/, RooMinimizer *minimizer,
46 : likelihood_(std::move(likelihood)),
47 minimizer_(minimizer),
48 calculation_is_clean_(std::move(calculation_is_clean)),
49 shared_offset_(std::move(offset))
50{
51}
52
54
56 const std::vector<ROOT::Fit::ParameterSettings> &parameter_settings)
57{
59}
60
61void LikelihoodGradientWrapper::updateMinuitInternalParameterValues(const std::vector<double> & /*minuit_internal_x*/)
62{
63}
64void LikelihoodGradientWrapper::updateMinuitExternalParameterValues(const std::vector<double> & /*minuit_external_x*/)
65{
66}
67
68/// Factory method.
69std::unique_ptr<LikelihoodGradientWrapper>
70LikelihoodGradientWrapper::create(LikelihoodGradientMode likelihoodGradientMode, std::shared_ptr<RooAbsL> likelihood,
71 std::shared_ptr<WrapperCalculationCleanFlags> calculationIsClean, std::size_t nDim,
73{
74 switch (likelihoodGradientMode) {
76#ifdef ROOFIT_MULTIPROCESS
77 return std::make_unique<LikelihoodGradientJob>(std::move(likelihood), std::move(calculationIsClean), nDim,
78 minimizer, std::move(offset));
79#else
80 (void)likelihood;
81 (void)calculationIsClean;
82 (void)nDim;
83 (void)minimizer;
84 (void)offset;
85 throw std::runtime_error("MinuitFcnGrad ctor with LikelihoodGradientMode::multiprocess is not available in this "
86 "build without RooFit::Multiprocess!");
87#endif
88 break;
89 }
90 default: {
91 throw std::logic_error("In MinuitFcnGrad constructor: likelihoodGradientMode has an unsupported value!");
92 }
93 }
94}
95
96} // namespace TestStatistics
97} // namespace RooFit
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
virtual void synchronizeWithMinimizer(const ROOT::Math::MinimizerOptions &options)
Synchronize minimizer settings with calculators in child classes.
virtual void updateMinuitInternalParameterValues(const std::vector< double > &minuit_internal_x)
Minuit passes in parameter values that may not conform to RooFit internal standards (like applying ra...
LikelihoodGradientWrapper(std::shared_ptr< RooAbsL > likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculation_is_clean, std::size_t N_dim, RooMinimizer *minimizer, SharedOffset offset)
virtual void synchronizeParameterSettings(const std::vector< ROOT::Fit::ParameterSettings > &parameter_settings)
static std::unique_ptr< LikelihoodGradientWrapper > create(LikelihoodGradientMode likelihoodGradientMode, std::shared_ptr< RooAbsL > likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculationIsClean, std::size_t nDim, RooMinimizer *minimizer, SharedOffset offset)
Factory method.
virtual void updateMinuitExternalParameterValues(const std::vector< double > &minuit_external_x)
Wrapper class around ROOT::Math::Minimizer that provides a seamless interface between the minimizer f...
ROOT::Math::IMultiGenFunction * getMultiGenFcn() const
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26