#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 () |
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.
FFTtools::SineFitter::SineFitter | ( | ) |
Initialize the SineFitter. There are no options.
Definition at line 153 of file SineSubtract.cxx.
|
virtual |
Destructor
Definition at line 171 of file SineSubtract.cxx.
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.
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. |
Definition at line 722 of file SineSubtract.cxx.
|
inline |
Get pointer to array of best-fit amplitudes. Only makes sense to call after doFit
Definition at line 211 of file SineSubtract.h.
|
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.
|
inline |
Access the i-th record of doEval in the minimization
i | is the record to access, default is -1 (will try to find most recent for i < 0) |
Definition at line 245 of file SineSubtract.h.
|
inline |
Get the best fit frequency. Only makes sense to call after doFit
Definition at line 205 of file SineSubtract.h.
|
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.
|
inline |
Get pointer to array of best-fit phases. Only makes sense to call after doFit
Definition at line 208 of file SineSubtract.h.
|
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.
|
inline |
Get the power (sum(v^2)/n after the fit. This is what is minimized
Definition at line 223 of file SineSubtract.h.
|
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
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. |
Definition at line 177 of file SineSubtract.cxx.
|
inline |
Set the limit parameters
Definition at line 232 of file SineSubtract.h.
|
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.