1 #include <goofit/PDFs/utility/VariableBinTransform1DPdf.h>
7 __device__ fptype device_VarBinTransform1D(fptype *evt, fptype *p, unsigned int *indices) {
8 // Index structure: nP lim1 lim2 ...
10 // int previousSize = 1;
11 // printf("[%i, %i] Bin Transform: %i %i %f %f\n", THREADIDX, BLOCKIDX, numObservables, previousSize, evt[0],
13 fptype obsValue = evt[indices[2 + indices[0]]];
16 int numLimits = indices[1];
17 for(int i = 0; i < numLimits; ++i) {
18 fptype lowerLimit = functorConstants[indices[i + 2]];
19 if(obsValue < lowerLimit)
27 __device__ device_function_ptr ptr_to_VarBinTransform1D = device_VarBinTransform1D;
29 // Notice that bin sizes and limits can be different, for this purpose, than what's implied by the Variable members.
30 __host__ VariableBinTransform1DPdf::VariableBinTransform1DPdf(std::string n, Observable _x, vector<fptype> binlimits)
32 unsigned int numLimits = binlimits.size(); // Excluding the min & max values for _x
33 cIndex = registerConstants(numLimits);
34 std::vector<fptype> host_constants;
35 std::vector<unsigned int> pindices{numLimits};
36 for(size_t i = 0; i < numLimits; ++i) {
37 pindices.push_back(cIndex + i);
38 host_constants.push_back(binlimits[i]); // cIndex will be accounted for by offset in memcpy
41 MEMCPY_TO_SYMBOL(functorConstants,
42 host_constants.data(),
43 numLimits * sizeof(fptype),
44 cIndex * sizeof(fptype),
45 cudaMemcpyHostToDevice);
47 GET_FUNCTION_ADDR(ptr_to_VarBinTransform1D);