1 #include <goofit/PDFs/basic/CorrGaussianPdf.h>
5 __device__ fptype device_CorrGaussian(fptype *evt, fptype *p, unsigned int *indices) {
6 fptype x = evt[indices[2 + indices[0]]];
7 fptype y = evt[indices[3 + indices[0]]];
8 fptype mean1 = p[indices[1]];
9 fptype sigma1 = p[indices[2]];
10 fptype mean2 = p[indices[3]];
11 fptype sigma2 = p[indices[4]];
12 fptype corr = p[indices[5]];
14 fptype x_dist = (x - mean1) / sigma1;
15 sigma2 *= (1 + corr * x_dist * x_dist);
16 fptype y_dist = (y - mean2) * (sigma2 == 0 ? 0 : (1.0 / sigma2));
17 fptype ret = exp(-0.5 * (x_dist * x_dist + y_dist * y_dist));
19 // if ((gpuDebug & 1) && (THREADIDX == 60)) printf("CorrGauss: %f %f %f %f %f %f %f %f %f %.12f\n", x, y, mean1,
20 // sigma1, mean2, sigma2, corr, x_dist, y_dist, ret);
21 // if ((gpuDebug & 1) && (THREADIDX == 60)) printf("[%i, %i] [%i, %i] CorrGauss: %f %f %f\n", BLOCKIDX, THREADIDX,
22 // gridDim.x, BLOCKDIM, x, y, ret);
23 // printf("CorrGauss: %i %i %i %f %f %f %f\n", indices[2 + indices[0]], indices[3 + indices[0]], indices[0], x, y,
29 __device__ device_function_ptr ptr_to_CorrGaussian = device_CorrGaussian;
31 __host__ CorrGaussianPdf::CorrGaussianPdf(std::string n,
40 // registerObservable(_x);
41 // registerObservable(_y);
43 std::vector<unsigned int> pindices;
44 pindices.push_back(registerParameter(mean1));
45 pindices.push_back(registerParameter(sigma1));
46 pindices.push_back(registerParameter(mean2));
47 pindices.push_back(registerParameter(sigma2));
48 pindices.push_back(registerParameter(correlation));
50 GET_FUNCTION_ADDR(ptr_to_CorrGaussian);