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