GooFit  v2.1.3
Public Member Functions | Protected Attributes | List of all members
GooFit::FCN Class Reference

#include <FCN.h>

Inheritance diagram for GooFit::FCN:

Public Member Functions

 FCN (Params &params)
 Create an FCN given parameters (PDF reference is inside params) More...
 
double operator() (const std::vector< double > &pars) const override
 Run the fit (used by Minuit2 class) More...
 
double operator() () const
 produce the FCN value for the current values of the parameters More...
 
double Up () const override
 This value is 0.5 for ll, 1 for chi2. More...
 
ParamsGetParams ()
 Get a pointer to the parameters. More...
 

Protected Attributes

Paramsparams_
 

Detailed Description

Definition at line 11 of file FCN.h.

Constructor & Destructor Documentation

◆ FCN()

GooFit::FCN::FCN ( Params params)

Create an FCN given parameters (PDF reference is inside params)

Definition at line 9 of file FCN.cpp.

References GooFit::host_callnumber, params_, GooFit::Variable::setChanged(), and GooFit::Params::vars_.

10  : params_(&params) {
11  host_callnumber = 0;
12 
13  // Verify that all varaibles need to be recached
14  for(Variable &var : params_->vars_)
15  var.setChanged(true);
16 }
std::vector< Variable > vars_
Definition: Params.h:22
Params * params_
Definition: FCN.h:13
int host_callnumber
Definition: PdfBase.cpp:33

Member Function Documentation

◆ GetParams()

Params * GooFit::FCN::GetParams ( )

Get a pointer to the parameters.

Definition at line 44 of file FCN.cpp.

References params_.

Referenced by Up().

44 { return params_; }
Params * params_
Definition: FCN.h:13

◆ operator()() [1/2]

double GooFit::FCN::operator() ( const std::vector< double > &  pars) const
override

Run the fit (used by Minuit2 class)

Definition at line 18 of file FCN.cpp.

References GooFit::PdfBase::calculateNLL(), GooFit::Params::from_minuit_vector(), GOOFIT_TRACE, GooFit::host_callnumber, params_, and GooFit::Params::pdf_.

18  {
19  // Translate from Minuit indexing to GooFit indexing
21 
22  GOOFIT_TRACE("Calculating NLL");
23  double nll = params_->pdf_->calculateNLL();
24 
26 
27  return nll;
28 }
virtual __host__ double calculateNLL() const =0
Params * params_
Definition: FCN.h:13
#define GOOFIT_TRACE(...)
Definition: Log.h:126
void from_minuit_vector(const std::vector< double > &values, bool force_changed=false)
Set from a minuit vector. Optional force_changed to force complete recalculation. ...
Definition: Params.cpp:47
PdfBase * pdf_
Definition: Params.h:23
int host_callnumber
Definition: PdfBase.cpp:33

◆ operator()() [2/2]

double GooFit::FCN::operator() ( ) const

produce the FCN value for the current values of the parameters

Definition at line 30 of file FCN.cpp.

References GooFit::PdfBase::calculateNLL(), GooFit::Params::from_minuit_vector(), GOOFIT_TRACE, GooFit::host_callnumber, GooFit::Params::make_minuit_vector(), params_, and GooFit::Params::pdf_.

30  {
31  // Make a vector of current values, then force the recalculation step
32  std::vector<double> pars = params_->make_minuit_vector();
33  params_->from_minuit_vector(pars, true);
34 
35  GOOFIT_TRACE("Calculating NLL");
36  double nll = params_->pdf_->calculateNLL();
37 
39 
40  return nll;
41 }
virtual __host__ double calculateNLL() const =0
Params * params_
Definition: FCN.h:13
#define GOOFIT_TRACE(...)
Definition: Log.h:126
std::vector< double > make_minuit_vector() const
Make a parameter array with the current variable values.
Definition: Params.cpp:39
void from_minuit_vector(const std::vector< double > &values, bool force_changed=false)
Set from a minuit vector. Optional force_changed to force complete recalculation. ...
Definition: Params.cpp:47
PdfBase * pdf_
Definition: Params.h:23
int host_callnumber
Definition: PdfBase.cpp:33

◆ Up()

double GooFit::FCN::Up ( ) const
inlineoverride

This value is 0.5 for ll, 1 for chi2.

Definition at line 26 of file FCN.h.

References GetParams().

26 { return 0.5; }

Member Data Documentation

◆ params_

Params* GooFit::FCN::params_
protected

Definition at line 13 of file FCN.h.

Referenced by FCN(), GetParams(), and operator()().


The documentation for this class was generated from the following files: