Classes | Public Member Functions | List of all members
FFTtools::SineFitter Class Reference

#include <SineSubtract.h>

Public Member Functions

 SineFitter ()
 
virtual ~SineFitter ()
 
void setGuess (double f, int ntrace, const double *ph, double amp)
 
void doFit (int ntrace, const int *nsamples, const double **x, const double **y, const double *w=0, const double **env=0)
 
double getFreq () const
 
const double * getPhase () const
 
const double * getAmp () const
 
double getFreqErr () const
 
const double * getPhaseErr () const
 
const double * getAmpErr () const
 
double getPower () const
 
void setVerbose (bool v)
 
int getStatus () const
 
void setLimitOptions (const SineFitterLimits *lims)
 
ROOT::Minuit2::Minuit2Minimizer * minimizer ()
 
TGraph * getEvalRecordGraph (int i=-1)
 
size_t nEvalRecords ()
 
void SetDoEvalRecord (bool doEvalRecord)
 
Bool_t GetDoEvalRecord () const
 
void deleteEvalRecords ()
 

Detailed Description

The SineFitter class handles the actual minimization of a set of points to a sinusoid. It contains the Minuit2 object, the result, and a FitFn. It may be used to fit for a single trace or multiple traces simultaneously (each with different amplitude and phase).

Definition at line 175 of file SineSubtract.h.

Constructor & Destructor Documentation

FFTtools::SineFitter::SineFitter ( )

Initialize the SineFitter. There are no options.

Definition at line 153 of file SineSubtract.cxx.

FFTtools::SineFitter::~SineFitter ( )
virtual

Destructor

Definition at line 171 of file SineSubtract.cxx.

Member Function Documentation

void FFTtools::SineFitter::doFit ( int  ntrace,
const int *  nsamples,
const double **  x,
const double **  y,
const double *  w = 0,
const double **  env = 0 
)

Perform the minimation to 1 or more traces. setGuess must be called before.

Parameters
ntracethe number of traces we will minimize
nsamplesthe number of samples per trace.
xx-values of the traces to use. x[0] should be first trace, etc.
yy-values of the traces to use. x[0] should be first trace, etc.
wweights for each of the traces. This is useful only when fitting multiple traces and you want one to be more important than another. If 0, all are treated the same.
envEnvelopes for each of the traces. This is multipled against the sinusoid and and can be used to favor parts of the waveform over another.

Definition at line 722 of file SineSubtract.cxx.

const double* FFTtools::SineFitter::getAmp ( ) const
inline

Get pointer to array of best-fit amplitudes. Only makes sense to call after doFit

Definition at line 211 of file SineSubtract.h.

const double* FFTtools::SineFitter::getAmpErr ( ) const
inline

Get the parameter error on best-fit amplitudes. Since we don't take into account errors on x and y in the fit, this probably needs to be scaled to be meaninful

Definition at line 220 of file SineSubtract.h.

TGraph* FFTtools::SineFitter::getEvalRecordGraph ( int  i = -1)
inline

Access the i-th record of doEval in the minimization

Parameters
iis the record to access, default is -1 (will try to find most recent for i < 0)
Returns
pointer to record graph if it exists, otherwise NULL. DO NOT DELETE

Definition at line 245 of file SineSubtract.h.

double FFTtools::SineFitter::getFreq ( ) const
inline

Get the best fit frequency. Only makes sense to call after doFit

Definition at line 205 of file SineSubtract.h.

double FFTtools::SineFitter::getFreqErr ( ) const
inline

Get the parameter error on best-fit frequency. Since we don't take into account errors on x and y in the fit, this probably needs to be scaled to be meaninful

Definition at line 214 of file SineSubtract.h.

const double* FFTtools::SineFitter::getPhase ( ) const
inline

Get pointer to array of best-fit phases. Only makes sense to call after doFit

Definition at line 208 of file SineSubtract.h.

const double* FFTtools::SineFitter::getPhaseErr ( ) const
inline

Get the parameter error on best-fit phases. Since we don't take into account errors on x and y in the fit, this probably needs to be scaled to be meaninful

Definition at line 217 of file SineSubtract.h.

double FFTtools::SineFitter::getPower ( ) const
inline

Get the power (sum(v^2)/n after the fit. This is what is minimized

Definition at line 223 of file SineSubtract.h.

int FFTtools::SineFitter::getStatus ( ) const
inline

Return minimzation status

Definition at line 229 of file SineSubtract.h.

void FFTtools::SineFitter::setGuess ( double  f,
int  ntrace,
const double *  ph,
double  amp 
)

Set the guess for the fitter. This must be done before doing the fit

Parameters
fThe guessed frequency
ntraceThe number of traces we will next minimize
phA pointer to a an array of guess phases, one for each trace. In practice, the phase is difficult to guess.
ampthe guess amplitude.

Definition at line 177 of file SineSubtract.cxx.

void FFTtools::SineFitter::setLimitOptions ( const SineFitterLimits lims)
inline

Set the limit parameters

Definition at line 232 of file SineSubtract.h.

void FFTtools::SineFitter::setVerbose ( bool  v)
inline

Toggle verbose mode, in case looking at screen-fulls of Minuit output is something that excites you

Definition at line 226 of file SineSubtract.h.


The documentation for this class was generated from the following files: