GooFit  v2.1.3
Params.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <goofit/Variable.h>
4 
5 #include <Minuit2/FCNBase.h>
6 #include <Minuit2/MnUserParameterState.h>
7 #include <Minuit2/MnUserParameters.h>
8 
9 #include <vector>
10 
11 namespace Minuit2 = ROOT::Minuit2;
12 
13 namespace GooFit {
14 
15 class PdfBase;
16 class FCN;
17 
18 class Params : public Minuit2::MnUserParameters {
19  friend FCN;
20 
21  protected:
22  std::vector<Variable> vars_;
24  size_t num_;
25 
26  bool do_record_{false};
27  std::vector<std::vector<double>> recorded_;
28 
29  public:
30  using MnUserParameters::MnUserParameters;
31 
32  Params(PdfBase &pdf);
33 
35  void SetGooFitParams(const Minuit2::MnUserParameterState &input);
36 
38  size_t size() const { return vars_.size(); };
39 
41  std::vector<double> make_minuit_vector() const;
42 
44  void from_minuit_vector(const std::vector<double> &values, bool force_changed = false);
45 
47  void set_record(bool do_record = true) { do_record_ = do_record; }
48 
50  std::vector<std::vector<double>> get_recorded() const { return recorded_; }
51 };
52 } // namespace GooFit
std::vector< Variable > vars_
Definition: Params.h:22
std::vector< std::vector< double > > get_recorded() const
Get recorded values array.
Definition: Params.h:50
std::vector< double > make_minuit_vector() const
Make a parameter array with the current variable values.
Definition: Params.cpp:39
size_t size() const
Get the number of params in the fit.
Definition: Params.h:38
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
size_t num_
Definition: Params.h:24
void set_record(bool do_record=true)
Set recording of Minuit parameter changes.
Definition: Params.h:47
void SetGooFitParams(const Minuit2::MnUserParameterState &input)
Read the values back into GooFit.
Definition: Params.cpp:29
std::vector< std::vector< double > > recorded_
Definition: Params.h:27
Params(PdfBase &pdf)
Definition: Params.cpp:8
bool do_record_
Definition: Params.h:26