DDASToys for NSCLDAQ  6.2-000
Functions
CudaFitEngineAnalytic.cu File Reference

Provide CUDA fit engines for single- and double-pulse fits. More...

#include <stdexcept>
#include <math.h>
#include "jacobian_analytic.h"
Include dependency graph for CudaFitEngineAnalytic.cu:

Functions

__global__ void residual1 (void *tx, void *ty, void *res, unsigned len, float C, float A, float k1, float k2, float x1)
 Compute the residual for a point in the trace with a single pulse fit. More...
 
__global__ void jacobian1 (void *tx, void *ty, void *jac, unsigned len, float A, float k1, float k2, float x1)
 Compute the Jacobian at a single point of the trace for a single pulse fit. More...
 
__global__ void residual2 (void *xtc, void *ytc, void *res, unsigned npts, float C, float A1, float k11, float k12, float x1, float A2, float k21, float k22, float x2)
 Computes the double-pulse residual pointwise parallel. More...
 
__global__ void jacobian2 (void *xtc, void *jac, unsigned npts, double A1, double k1, double k2, double x1, double A2, double k3, double k4, double x2, double C)
 Compute the double-pulse Jacobian on a point of the pulse. The Jacobian matrix is an npts x 9 matrix. More...
 

Detailed Description

Provide CUDA fit engines for single- and double-pulse fits.

Note
This requires that the CUDA compiler be used.
Experimentally the Jacobian for double pulses needs to be double precision so we've got functions named XXXX which are float and identical functions named XXXXd which are double.

Function Documentation

◆ jacobian1()

__global__ void jacobian1 ( void *  tx,
void *  ty,
void *  jac,
unsigned  len,
float  A,
float  k1,
float  k2,
float  x1 
)

Compute the Jacobian at a single point of the trace for a single pulse fit.

Parameters
txPointer to the trace x coords.
tyPointer to the trace y coords.
jacPointer to the Jacobian matrix (len*5 elements)
lenTrace length.
AScale factor.
k1Risetime steepeness.
k2Decay time.
x1Position.

◆ jacobian2()

__global__ void jacobian2 ( void *  xtc,
void *  jac,
unsigned  npts,
double  A1,
double  k1,
double  k2,
double  x1,
double  A2,
double  k3,
double  k4,
double  x2,
double  C 
)

Compute the double-pulse Jacobian on a point of the pulse. The Jacobian matrix is an npts x 9 matrix.

Parameters
xtcx-coordinates of the trace.
jacJacobian matrix.
nptsNumber of points in the fit.
A1,k1,k2,x1Fit parameters for first pulse.
A2,k3,k4,x2Fit parameters for the second pulse.
CConstant term of the fit.

◆ residual1()

__global__ void residual1 ( void *  tx,
void *  ty,
void *  res,
unsigned  len,
float  C,
float  A,
float  k1,
float  k2,
float  x1 
)

Compute the residual for a point in the trace with a single pulse fit.

Parameters
txPointer to trace x values.
tyPointer to trace y values.
resPointer to residual values.
lenNumber of trace elements.
CConstant baseline.
AScale factor.
k1Rise steepeness.
k2Decay time.
x1Position.

◆ residual2()

__global__ void residual2 ( void *  xtc,
void *  ytc,
void *  res,
unsigned  npts,
float  C,
float  A1,
float  k11,
float  k12,
float  x1,
float  A2,
float  k21,
float  k22,
float  x2 
)

Computes the double-pulse residual pointwise parallel.

Parameters
xtcx-coordinates of trace.
ytcy-coordinates of trace.
resResiduals to compute.
nptsNumber of trace points.
CConstant offset fit parameter.
A1Scale factor for pulse1.
k11k1 for pulse 1.
k12k2 for pulse 1.
x1Position of pulse 1
A2Scale factof for pulse 2.
k21k1 for pulse 2.
k22k2 for pulse 2.
x2Position of pulse 2.