1 #include <goofit/PDFs/basic/ArgusPdf.h>
2 #include <goofit/Variable.h>
6 __device__ fptype device_Argus_Upper(fptype *evt, fptype *p, unsigned int *indices) {
7 fptype x = evt[indices[2 + indices[0]]];
8 fptype m0 = p[indices[1]];
15 fptype slope = p[indices[2]];
16 fptype power = p[indices[3]];
18 // printf("device_Argus_Upper %f %f %f %f %f\n", x, m0, slope, t, x * pow(t, power) * exp(slope * t));
20 return x * pow(t, power) * exp(slope * t);
23 __device__ fptype device_Argus_Lower(fptype *evt, fptype *p, unsigned int *indices) {
24 fptype x = evt[indices[2 + indices[0]]];
25 fptype m0 = p[indices[1]];
27 // printf("Argus: %i %i %f %f\n", indices[0], indices[2 + indices[0]], x, m0);
28 // printf("Argus: %i %i\n", indices[0], indices[2 + indices[0]]);
39 fptype slope = p[indices[2]];
40 fptype power = p[indices[3]];
41 fptype ret = x * pow(t, power) * exp(slope * t);
42 // if ((0 == THREADIDX) && (0 == BLOCKIDX) && (callnumber < 1)) cuPrintf("device_Argus_Lower %i %i %f %f %f %f
43 // %f\n", indices[1], indices[2], x, m0, slope, t, ret);
44 // if (isnan(ret)) printf("NaN Argus: %f %f %f %f %f %f %f\n", x, m0, t, slope, power, pow(t, power), exp(slope*t));
45 // if ((0 == THREADIDX) && (0 == BLOCKIDX) && (gpuDebug & 1))
46 // printf("(%i, %i) device_Argus_Lower %f %f %f %f %f\n", BLOCKIDX, THREADIDX, x, m0, slope, t, x * pow(t, power) *
52 __device__ device_function_ptr ptr_to_Argus_Upper = device_Argus_Upper;
53 __device__ device_function_ptr ptr_to_Argus_Lower = device_Argus_Lower;
55 __host__ ArgusPdf::ArgusPdf(std::string n, Observable _x, Variable m0, Variable slope, bool upper)
56 : ArgusPdf(n, _x, m0, slope, upper, Variable(n + "powervar", 0.5)) {}
58 __host__ ArgusPdf::ArgusPdf(std::string n, Observable _x, Variable m0, Variable slope, bool upper, Variable power)
60 registerParameter(m0);
61 registerParameter(slope);
62 registerParameter(power);
64 std::vector<unsigned int> pindices;
65 pindices.push_back(m0.getIndex());
66 pindices.push_back(slope.getIndex());
67 pindices.push_back(power.getIndex());
70 GET_FUNCTION_ADDR(ptr_to_Argus_Upper);
72 GET_FUNCTION_ADDR(ptr_to_Argus_Lower);
78 fptype argus_lower_helper(fptype x, fptype m0, fptype slope, fptype power) {
87 fptype ret = x * pow(t, power) * exp(slope * t);
92 __host__ double ArgusPdf::integrate(fptype lo, fptype hi) const {
94 unsigned int *indices = host_indices + parameters;
95 fptype m0 = host_params[indices[1]];
96 fptype slope = host_params[indices[2]];
97 fptype power = host_params[indices[3]];
99 for(int j = 0; j < integrationBins; ++j) {
102 x /= integrationBins;
105 norm += argus_lower_helper(x, m0, slope, power);
108 norm *= ((hi - lo) / integrationBins);
111 } // namespace GooFit