#include <SaturationFcn.h>
Public Member Functions | |
virtual double | operator() (const std::vector< double > &x) const |
SaturationFcn () | |
void | set_data (int N, float *charge_ptr, float *adc_ptr) |
virtual double | Up () const |
~SaturationFcn () | |
Public Attributes | |
double | x0start |
double | x1start |
double | x2start |
double | x3start |
Private Attributes | |
double | datx [20] |
double | daty [20] |
Definition at line 7 of file SaturationFcn.h.
SaturationFcn::SaturationFcn | ( | ) | [inline] |
Definition at line 11 of file SaturationFcn.h.
{}
SaturationFcn::~SaturationFcn | ( | ) | [inline] |
Definition at line 13 of file SaturationFcn.h.
{}
virtual double SaturationFcn::operator() | ( | const std::vector< double > & | x | ) | const [inline, virtual] |
Definition at line 37 of file SaturationFcn.h.
References datx, daty, i, MultiGaussianStateTransform::N, funct::pow(), and tmp.
{ double chisq = 0.0; int N=20; for(int i=0;i<N;i++){ double val=1.0+pow(x[1]*datx[i],x[2]); double val2=1.0/x[2]; val=x[0]*x[1]*datx[i]/pow(val,val2); double tmp=(daty[i]-x[3]-val); //printf(" dat: %d %f %f %f %f \n",i,datx[i],daty[i]-x[3],val,tmp); chisq=chisq+tmp*tmp; } //printf("x0-3 %f %f %f %f chisq %f \n",x[0],x[1],x[2],x[3],chisq); return chisq; }
void SaturationFcn::set_data | ( | int | N, |
float * | charge_ptr, | ||
float * | adc_ptr | ||
) | [inline] |
Definition at line 16 of file SaturationFcn.h.
References datx, daty, i, MultiGaussianStateTransform::N, x, x0start, x1start, x2start, x3start, and detailsBasic3DVector::y.
Referenced by SaturationFit::SaturationFit().
{ float x[20],y[20]; for(int i=0;i<N;i++){ x[i]=charge_ptr[i]; y[i]=adc_ptr[i]; datx[i]=x[i]; daty[i]=y[i]; //printf("%d datx daty %f %f \n",i,datx[i],daty[i]); } x3start=(y[4]*x[1]-y[1]*x[4])/(x[1]-x[4]); x0start=daty[13]-x3start; x1start=(y[4]-y[1])/(x[4]-x[1])/x0start; x2start=20.; //printf(" x0-2start %f %f %f %f\n",x0start,x1start,x2start,x3start); }
virtual double SaturationFcn::Up | ( | ) | const [inline, virtual] |
Definition at line 35 of file SaturationFcn.h.
{return 1.;}
double SaturationFcn::datx[20] [private] |
Definition at line 58 of file SaturationFcn.h.
Referenced by operator()(), and set_data().
double SaturationFcn::daty[20] [private] |
Definition at line 58 of file SaturationFcn.h.
Referenced by operator()(), and set_data().
double SaturationFcn::x0start |
Definition at line 52 of file SaturationFcn.h.
Referenced by SaturationFit::SaturationFit(), and set_data().
double SaturationFcn::x1start |
Definition at line 53 of file SaturationFcn.h.
Referenced by SaturationFit::SaturationFit(), and set_data().
double SaturationFcn::x2start |
Definition at line 54 of file SaturationFcn.h.
Referenced by SaturationFit::SaturationFit(), and set_data().
double SaturationFcn::x3start |
Definition at line 55 of file SaturationFcn.h.
Referenced by SaturationFit::SaturationFit(), and set_data().