NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
Functions
lmfit.cpp File Reference

: Contains the functions needed to drive GSL's Levenberg Marquart fitter. More...

#include "functions.h"
#include "lmfit.h"
#include <gsl/gsl_rng.h>
#include <gsl/gsl_blas.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_fit.h>
#include <gsl/gsl_multimin.h>
#include <gsl/gsl_multifit_nlin.h>
#include <algorithm>
#include <stdexcept>

Functions

double DDAS_FALLBACK_K1 (0.1)
 
double DDAS_FALLBACK_K2 (0.1)
 
int SINGLE_MAXITERATIONS (50)
 
int DOUBLE_MAXITERATIONS (50)
 
double estimateK1 (int xmax, double C0, const std::vector< uint16_t > &trace)
 

Detailed Description

: Contains the functions needed to drive GSL's Levenberg Marquart fitter.

Function Documentation

double estimateK1 ( int  xmax,
double  C0,
const std::vector< uint16_t > &  trace 
)

estimateK1 Estimate a value for the steepness parameter of the rising side of the pulse. We approximate xmax as 0.9 of maximum and use that ln(9)/(xmax - x0.5) gives k where x0.5 is the position of 1/2 height.

If we can't find x0.5 then we fall back on a guess of 0.1

Note
- should allow this fallback value to be an input parameter.
Parameters
xmax- where the maximum point is.
C0- Estimate for the constant offset.
trace- The trace data.
Returns
double - the estimate.
Note
for now assume that the .5 position is within the AOI
for now we're not correcting for flattops.