GooFit  v2.1.3
Functions
product.cpp File Reference
#include <goofit/Application.h>
#include <goofit/FitManager.h>
#include <goofit/PDFs/basic/ExpPdf.h>
#include <goofit/PDFs/combine/ProdPdf.h>
#include <goofit/UnbinnedDataSet.h>
#include <goofit/Variable.h>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 11 of file product.cpp.

References GooFit::UnbinnedDataSet::addEvent(), data, GooFit::FitManagerMinuit2::fit(), GOOFIT_PARSE, and GooFit::PdfBase::setData().

11  {
12  GooFit::Application app("Product example", argc, argv);
13 
14  GOOFIT_PARSE(app);
15 
16  Observable xvar{"xvar", 0, log(1 + RAND_MAX / 2)};
17  Observable yvar{"yvar", 0, log(1 + RAND_MAX / 2)};
18  vector<Observable> varList = {xvar, yvar};
19  UnbinnedDataSet data{varList};
20 
21  for(int i = 0; i < 100000; ++i) {
22  xvar.setValue(xvar.getUpperLimit() - log(1 + rand() / 2));
23  yvar.setValue(yvar.getUpperLimit() - log(1 + rand() / 2));
24  data.addEvent();
25  }
26 
27  Variable alpha_x{"alpha_x", -2.4, 0.1, -10, 10};
28  Variable alpha_y{"alpha_y", -1.1, 0.1, -10, 10};
29 
30  ExpPdf exp_x{"exp_x", xvar, alpha_x};
31  ExpPdf exp_y{"exp_y", yvar, alpha_y};
32  ProdPdf product{"product", {&exp_x, &exp_y}};
33 
34  product.setData(&data);
35  FitManager fitter(&product);
36  fitter.fit();
37 
38  return fitter;
39 }
Special class for observables. Used in DataSets.
Definition: Variable.h:109
UnbinnedDataSet * data
__host__ void setData(DataSet *data)
#define GOOFIT_PARSE(app,...)
Definition: Application.h:11