CSpectrumFit

Name

CSpectrumFit -- Fit of spectrum channels.

Synopsis


#include <CSpectrumFit.h>

class CSpectrumFit : public CNamedItem
{
public:
  CSpectrumFit(std::string spectrumName, int myId,
	       int low, int high, 
	       CFit&    fit);

  CFit::PointIterator begin();
  CFit::PointIterator end();
  size_t              size();
  CFit::FitState      GetState(); 
  double              operator()(double x);
  CFit::FitParameterList getParameters();
  std::string         fitType();
  std::string         makeTclFitScript();
  std::string         fitName();
  CSpectrumFit*       clone();	// Clone self.
  void                update();
  int                 low() const;
  int                 high() const;
  
};

        

DESCRIPTION

Joins together a spectrum and a fit performed over some region of interest. The fit is performed when an object is constructed and when requested via its update method. This fit should always be in the CFit::Performed state.

METHODS

Note that several of these methods delegate to the underlying fit object.

CSpectrumFit((std::string spectrumName, int myId, int low, int high, CFit& fit);

spectrumName is the name of a spectrum in the SpecTcl spectrum dictionary. An exception is thrown if the name is not valid. The name is also used to provide a name for the Spectrum Fit object (see, however CFitDictionary).

myId is the id used to construct the base class named item.

low and high specify a region of interest (ROI), in channels, in the spectrum. If either limit is outside of the spectrum channel limits an exception is thrown. If there are not sufficient channels in the ROI, an exception will be thrown.

fit is a fit object in the CFit::Accepting state. On construction, among other things, the spectrum channels in the ROI are entered as points into this fit and the and the fit is performed. The fit must stay in scope for the duration of the lifetime of this object. The fit's destruction is, however the responsibility of client code.

CFit::PointIterator begin(); , CFit::PointIterator end(); , size_t size();

These methods delegate to the underlying fit object's methods of the same name. They support iteration through the fit points. The X coordinate of each point is a channel number. The Y coordinate is the counts in that channel as of the last time a fit was performed.

Fits are performed at construction time and when the update method is invoked.

CFit::FitState GetState();

Returns the underlying fit's state. This should always be CFit::Performed. If it is not, some external actor must be playing with the encapsulated fit. Something that should not be done.

This method delegates to the underlying fit.

double operator()(double x);

Delegates to the underlying fit's operator() which evaluates the fitted function at x.

CFit::FitParameterListx CFit::FitParameterList();

Delegates to CFit::FitParameterList. Returns the fit parameters from the current fit.

std::string fitType();

in the underlying fit. Delegates to CFit::Type

std::string makeTclFitScript();

Delegates to the underlying fit's makeTclFitScript method to get a proc that can be used by scripts to operate on the fit.

std::string fitName();

Name of the underlying fit.

CSpectrumFit* clone();

Returns a dynamically allocated clone of this object. Note that the fit is cloned as well. Objects with cloned fits will destroy the fit when they themselves are destroyed.

void update();

Fetches the new points from the fit's ROI and performs the fit using them.

const int low(); , const int high();

Return the limits of the ROI over hich the fit is computed.