GooFit  v2.1.3
ScaledGaussianPdf.cu
Go to the documentation of this file.
1 #include <goofit/PDFs/basic/ScaledGaussianPdf.h>
2 #include <goofit/Variable.h>
3 
4 //#include <limits>
5 
6 namespace GooFit {
7 
8 __device__ fptype device_ScaledGaussian(fptype *evt, fptype *p, unsigned int *indices) {
9  fptype x = evt[0];
10  fptype mean = p[indices[1]] + p[indices[3]];
11  fptype sigma = p[indices[2]] * (1 + p[indices[4]]);
12  fptype ret = exp(-0.5 * (x - mean) * (x - mean) / (sigma * sigma));
13 
14  return ret;
15 }
16 
17 __device__ device_function_ptr ptr_to_ScaledGaussian = device_ScaledGaussian;
18 
19 __host__ ScaledGaussianPdf::ScaledGaussianPdf(
20  std::string n, Observable _x, Variable mean, Variable sigma, Variable delta, Variable epsilon)
21  : GooPdf(n, _x) {
22  registerParameter(mean);
23  registerParameter(sigma);
24  registerParameter(delta);
25  registerParameter(epsilon);
26 
27  std::vector<unsigned int> pindices;
28  pindices.push_back(mean.getIndex());
29  pindices.push_back(sigma.getIndex());
30  pindices.push_back(delta.getIndex());
31  pindices.push_back(epsilon.getIndex());
32  GET_FUNCTION_ADDR(ptr_to_ScaledGaussian);
33  initialize(pindices);
34 }
35 
36 } // namespace GooFit