#include <SineSubtract.h>
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).
◆ SineFitter()
FFTtools::SineFitter::SineFitter |
( |
| ) |
|
◆ ~SineFitter()
FFTtools::SineFitter::~SineFitter |
( |
| ) |
|
|
virtual |
◆ doFit()
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
-
ntrace | the number of traces we will minimize |
nsamples | the number of samples per trace. |
x | x-values of the traces to use. x[0] should be first trace, etc. |
y | y-values of the traces to use. x[0] should be first trace, etc. |
w | weights 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. |
env | Envelopes for each of the traces. This is multipled against the sinusoid and and can be used to favor parts of the waveform over another. |
◆ getAmp()
const double* FFTtools::SineFitter::getAmp |
( |
| ) |
const |
|
inline |
Get pointer to array of best-fit amplitudes. Only makes sense to call after doFit
◆ getAmpErr()
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
◆ getEvalRecordGraph()
TGraph* FFTtools::SineFitter::getEvalRecordGraph |
( |
int |
i = -1 | ) |
|
|
inline |
Access the i-th record of doEval in the minimization
- Parameters
-
i | is 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
◆ getFreq()
double FFTtools::SineFitter::getFreq |
( |
| ) |
const |
|
inline |
Get the best fit frequency. Only makes sense to call after doFit
◆ getFreqErr()
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
◆ getPhase()
const double* FFTtools::SineFitter::getPhase |
( |
| ) |
const |
|
inline |
Get pointer to array of best-fit phases. Only makes sense to call after doFit
◆ getPhaseErr()
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
◆ getPower()
double FFTtools::SineFitter::getPower |
( |
| ) |
const |
|
inline |
Get the power (sum(v^2)/n after the fit. This is what is minimized
◆ getStatus()
int FFTtools::SineFitter::getStatus |
( |
| ) |
const |
|
inline |
Return minimzation status
◆ setGuess()
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
-
f | The guessed frequency |
ntrace | The number of traces we will next minimize |
ph | A pointer to a an array of guess phases, one for each trace. In practice, the phase is difficult to guess. |
amp | the guess amplitude. |
◆ setLimitOptions()
◆ setVerbose()
void FFTtools::SineFitter::setVerbose |
( |
bool |
v | ) |
|
|
inline |
Toggle verbose mode, in case looking at screen-fulls of Minuit output is something that excites you
The documentation for this class was generated from the following files: