1 #include <goofit/PDFs/basic/BifurGaussPdf.h>
5 __device__ fptype device_BifurGauss(fptype *evt, fptype *p, unsigned int *indices) {
6 fptype x = evt[indices[2 + indices[0]]]; // why does indices recall itself?
7 fptype mean = p[indices[1]];
8 fptype sigmaLeft = p[indices[2]];
9 fptype sigmaRight = p[indices[3]];
11 // how to calculate the value of a bifurcated gaussian?
12 fptype sigma = sigmaLeft;
17 fptype ret = exp(-0.5 * (x - mean) * (x - mean) / (sigma * sigma));
21 __device__ device_function_ptr ptr_to_BifurGauss = device_BifurGauss;
23 __host__ BifurGaussPdf::BifurGaussPdf(std::string n, Observable _x, Variable mean, Variable sigmaL, Variable sigmaR)
25 std::vector<unsigned int> pindices;
26 pindices.push_back(registerParameter(mean));
27 pindices.push_back(registerParameter(sigmaL));
28 pindices.push_back(registerParameter(sigmaR));
29 GET_FUNCTION_ADDR(ptr_to_BifurGauss);
33 // q: how shall the normalization of a bifurcated gaussian be calculated?
34 // a: a "sum" of two half-gaussians?
35 __host__ fptype BifurGaussPdf::integrate(fptype lo, fptype hi) const {
37 = host_indices + parameters; // look at the global indexes vector starting at the parameters of this function
39 fptype sL = host_params[indices[2]];
40 fptype sR = host_params[indices[3]];
42 fptype normL = 1. / (sqrt(2 * M_PI) * sL);
43 fptype normR = 1. / (sqrt(2 * M_PI) * sR);
45 return .5 * normL + .5 * normR;