21 double novosib(
double x,
double peak,
double width,
double tail) {
22 double qa = 0, qb = 0, qc = 0, qx = 0, qy = 0;
24 if(fabs(tail) < 1.e-7)
25 qc = 0.5 * pow(((x - peak) / width), 2);
27 qa = tail * sqrt(log(4.));
29 qx = (x - peak) / width * qb;
34 qc = 0.5 * (pow((log(qy) / tail), 2) + tail * tail);
54 pdfHist.SetStats(
false);
64 pdfHist.Fill(xvar.
getValue(), pdfVals[0][i]);
65 totalPdf += pdfVals[0][i];
69 double val = pdfHist.GetBinContent(i + 1);
72 pdfHist.SetBinContent(i + 1, val);
76 dataHist.SetMarkerStyle(8);
77 dataHist.SetMarkerSize(0.5);
79 pdfHist.SetLineColor(kBlue);
80 pdfHist.SetLineWidth(3);
81 pdfHist.Draw(
"lsame");
85 int main(
int argc,
char **argv) {
88 size_t numevents = 100000;
89 app.add_option(
"-n,--num", numevents,
"Number of events",
true);
93 GooFit::setROOTStyle();
108 landHist.SetStats(
false);
109 bifgHist.SetStats(
false);
110 novoHist.SetStats(
false);
117 double curr =
novosib(x, 0.3, 0.5, 1.0);
125 double leftSigma = 13;
126 double rightSigma = 29;
127 double leftIntegral = 0.5 / (leftSigma * sqrt(2 * M_PI));
128 double rightIntegral = 0.5 / (rightSigma * sqrt(2 * M_PI));
129 double totalIntegral = leftIntegral + rightIntegral;
130 double bifpoint = -10;
136 xvar.
setValue(donram.Landau(20, 1));
146 if(donram.Uniform() < (leftIntegral / totalIntegral)) {
148 val = donram.Gaus(bifpoint, rightSigma);
154 val = donram.Gaus(bifpoint, leftSigma);
167 double y = donram.Uniform(0, maxNovo);
182 fitAndPlot(landau, &landdata, landHist, xvar,
"simple_fit_cpp_landau.png");
184 Variable nmean(
"nmean", 0.4, -10.0, 10.0);
185 Variable nsigm(
"nsigm", 0.6, 0.0, 1.0);
186 Variable ntail(
"ntail", 1.1, 0.1, 0.0, 3.0);
188 fitAndPlot(novo, &novodata, novoHist, xvar,
"simple_fit_cpp_novo.png");
190 Variable gmean(
"gmean", 3.0, 1, -15, 15);
191 Variable lsigm(
"lsigm", 10, 1, 10, 20);
192 Variable rsigm(
"rsigm", 20, 1, 10, 40);
194 fitAndPlot(bifur, &bifgdata, bifgHist, xvar,
"simple_fit_cpp_bifur.png");
size_t getNumEvents() const
void setNumBins(size_t num)
Set the number of bins.
__host__ std::vector< std::vector< fptype > > getCompProbsAtDataPoints()
Produce a list of probabilies at points.
double novosib(double x, double peak, double width, double tail)
int main(int argc, char **argv)
void setValue(fptype val)
Set the value.
Special class for observables. Used in DataSets.
size_t getNumBins() const
Get the number of bins.
void fitAndPlot(GooPdf *total, UnbinnedDataSet *data, TH1F &dataHist, Observable xvar, const char *fname)
__host__ void setData(DataSet *data)
fptype getLowerLimit() const
Get the lower limit.
fptype getValue() const
Get the value.
fptype getUpperLimit() const
Get the upper limit.
ROOT::Minuit2::FunctionMinimum fit()
This runs the fit.
#define GOOFIT_PARSE(app,...)
void loadEvent(size_t idx)
Set all the variables to the current event values.
__host__ UnbinnedDataSet makeGrid()
Set an equidistant grid based on the stored variable binning.