Analysis-Utilities 26.9.9
C++/ROOT utilities for nuclear measurement data analysis
Loading...
Searching...
No Matches
RooStepShelf.cu
Go to the documentation of this file.
2
3#include <cuda_runtime.h>
4
5namespace {
6
7__device__ inline double SigmoidNegDev(double z) {
8 if (z < 0.0) {
9 return 1.0 / (1.0 + exp(z));
10 }
11 return exp(-z) / (1.0 + exp(-z));
12}
13
14__global__ void RooStepShelfKernel(double *output, const double *x_vals,
15 double mu, double inv_sigma, size_t n) {
16 size_t i = blockIdx.x * blockDim.x + threadIdx.x;
17 if (i < n) {
18 double z = (x_vals[i] - mu) * inv_sigma;
19 double s = SigmoidNegDev(z);
20 double v = s * s;
21 output[i] = v > 1e-300 ? v : 1e-300;
22 }
23}
24
25} // namespace
26
27void RooStepShelf_launchKernel(double *output, const double *x_vals, double mu,
28 double inv_sigma, size_t n) {
29 const int threads = 256;
30 const int blocks = (n + threads - 1) / threads;
31 RooStepShelfKernel<<<blocks, threads>>>(output, x_vals, mu, inv_sigma, n);
32}
Host-callable launch wrappers for the photopeak PDF CUDA kernels.
void RooStepShelf_launchKernel(double *output, const double *x_vals, double mu, double inv_sigma, size_t n)
Launch the resolution-smeared step-shelf kernel.