GooFit  v2.1.3
StepPdf.cu
Go to the documentation of this file.
1 #include <goofit/PDFs/basic/StepPdf.h>
2 
3 namespace GooFit {
4 
5 __device__ fptype device_Step(fptype *evt, fptype *p, unsigned int *indices) {
6  fptype x = evt[indices[2 + indices[0]]];
7  fptype x0 = p[indices[1]];
8  return (x > x0 ? 1 : 0);
9 }
10 
11 __device__ device_function_ptr ptr_to_Step = device_Step;
12 device_function_ptr hptr_to_Step = device_Step;
13 
14 __host__ StepPdf::StepPdf(std::string n, Observable _x, Variable x0)
15  : GooPdf(n, _x) {
16  std::vector<unsigned int> pindices;
17  pindices.push_back(registerParameter(x0));
18  GET_FUNCTION_ADDR(ptr_to_Step);
19  initialize(pindices);
20 }
21 
22 __host__ fptype StepPdf::integrate(fptype lo, fptype hi) const {
23  unsigned int *indices = host_indices + parameters;
24  fptype x0 = host_params[indices[1]];
25  return (hi - x0);
26 }
27 
28 } // namespace GooFit