energyCalibration Class Reference

#include <energyCalibration.h>

List of all members.

Public Member Functions

 energyCalibration ()
 ~energyCalibration ()
int setPlotFlag (int p=-1)
int setScanSign (int s=0)
int setChargeSharing (int p=-1)
void setFitRange (Double_t mi, Double_t ma)
void getFitRange (Double_t &mi, Double_t &ma)
void setStartParameters (Double_t *par)
void getStartParameters (Double_t *par)
TF1 * fitSCurve (TH1 *h1, Double_t *mypar, Double_t *emypar)
TF1 * fitSpectrum (TH1 *h1, Double_t *mypar, Double_t *emypar)
TGraphErrors * linearCalibration (int nscan, Double_t *en, Double_t *een, Double_t *fl, Double_t *efl, Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff)
TGraphErrors * calibrateScurves (int nscan, Double_t *en, Double_t *een, TH1F **h1, Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff)
TGraphErrors * calibrateSpectra (int nscan, Double_t *en, Double_t *een, TH1F **h1, Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff)

Private Member Functions

TGraphErrors * calibrate (int nscan, Double_t *en, Double_t *een, TH1F **h1, Double_t &gain, Double_t &off, Double_t &egain, Double_t &eoff, int integral=1)
void initFitFunction (TF1 *fun, TH1 *h1)
TF1 * fitFunction (TF1 *fun, TH1 *h1, Double_t *mypar, Double_t *emypar)

Private Attributes

int plot_flag
int cs_flag
Double_t fit_min
Double_t fit_max
Double_t bg_offset
Double_t bg_slope
Double_t flex
Double_t noise
Double_t ampl
Double_t cs_slope
energyCalibrationFunctionsfuncs
TF1 * fscurve
TF1 * fspectrum


Detailed Description

class alowing the energy calibration of photon counting and anlogue detectors


Constructor & Destructor Documentation

energyCalibration::energyCalibration (  ) 

default constructor - creates the function with which the s-curves will be fitted

energyCalibration::~energyCalibration (  ) 

default destructor - deletes the function with which the s-curves will be fitted


Member Function Documentation

TGraphErrors* energyCalibration::calibrate ( int  nscan,
Double_t *  en,
Double_t *  een,
TH1F **  h1,
Double_t &  gain,
Double_t &  off,
Double_t &  egain,
Double_t &  eoff,
int  integral = 1 
) [private]

calculates gain and offset for the set of energies

Parameters:
nscan number of energy scans
en array of energies (nscan long)
een array of errors on energies (nscan long) - can be NULL!
h1 array of TH1
gain reference to gain resulting from the fit
offset reference to offset resulting from the fit
integral 1 is an s-curve set (default), 0 spectra
Returns:
graph energy vs peak/inflection point

TGraphErrors* energyCalibration::calibrateScurves ( int  nscan,
Double_t *  en,
Double_t *  een,
TH1F **  h1,
Double_t &  gain,
Double_t &  off,
Double_t &  egain,
Double_t &  eoff 
) [inline]

calculates gain and offset for the set of energy scans

Parameters:
nscan number of energy scans
en array of energies (nscan long)
een array of errors on energies (nscan long) - can be NULL!
h1 array of TH1
gain reference to gain resulting from the fit
off reference to offset resulting from the fit
egain reference to error on the gain resulting from the fit
eoff reference to the error on the offset resulting from the fit
Returns:
graph energy vs inflection point

TGraphErrors* energyCalibration::calibrateSpectra ( int  nscan,
Double_t *  en,
Double_t *  een,
TH1F **  h1,
Double_t &  gain,
Double_t &  off,
Double_t &  egain,
Double_t &  eoff 
) [inline]

calculates gain and offset for the set of energy spectra

Parameters:
nscan number of energy scans
en array of energies (nscan long)
een array of errors on energies (nscan long) - can be NULL!
h1 array of TH1
gain reference to gain resulting from the fit
off reference to offset resulting from the fit
egain reference to error on the gain resulting from the fit
eoff reference to the error on the offset resulting from the fit
Returns:
graph energy vs peak

TF1* energyCalibration::fitFunction ( TF1 *  fun,
TH1 *  h1,
Double_t *  mypar,
Double_t *  emypar 
) [private]

Perfors the fit according to the flags specified and returns the fitted function

Parameters:
fun function to fit
h1 histogram to fit
mypar pointer to fit parameters array
emypar pointer to fit parameter errors
Returns:
the fitted function - can be used e.g. to get the Chi2 or similar

TF1* energyCalibration::fitSCurve ( TH1 *  h1,
Double_t *  mypar,
Double_t *  emypar 
)

fits histogram with the s-curve function

Parameters:
h1 1d-histogram to be fitted
mypar pointer to fit parameters array
emypar pointer to fit parameter errors
Returns:
the fitted function - can be used e.g. to get the Chi2 or similar

TF1* energyCalibration::fitSpectrum ( TH1 *  h1,
Double_t *  mypar,
Double_t *  emypar 
)

fits histogram with the spectrum

Parameters:
h1 1d-histogram to be fitted
mypar pointer to fit parameters array
emypar pointer to fit parameter errors
Returns:
the fitted function - can be used e.g. to get the Chi2 or similar

void energyCalibration::getFitRange ( Double_t &  mi,
Double_t &  ma 
) [inline]

gets the s-curve fit range

Parameters:
mi reference for minimum of the fit range (-1 is histogram x-min)
ma reference for maximum of the fit range (-1 is histogram x-max)

void energyCalibration::getStartParameters ( Double_t *  par  ) 

get start parameters for the s-curve function

Parameters:
par parameters, -1 means auto-calculated par[0] is the pedestal par[1] is the slope of the pedestal par[2] is the inflection point par[3] is the RMS par[4] is the amplitude par[5] is the angual coefficient of the charge sharing slope (scales with par[3]) -- always positive

void energyCalibration::initFitFunction ( TF1 *  fun,
TH1 *  h1 
) [private]

Initializes the start parameters and the range of the fit depending on the histogram characteristics and/or on the start parameters specified by the user

Parameters:
fun pointer to function to be initialized
h1 histogram from which to extract the range and start parameters, if not already specified by the user

TGraphErrors* energyCalibration::linearCalibration ( int  nscan,
Double_t *  en,
Double_t *  een,
Double_t *  fl,
Double_t *  efl,
Double_t &  gain,
Double_t &  off,
Double_t &  egain,
Double_t &  eoff 
)

calculates gain and offset for the set of inflection points

Parameters:
nscan number of energy scans
en array of energies (nscan long)
een array of errors on energies (nscan long) - can be NULL!
fl array of inflection points (nscan long)
efl array of errors on the inflection points (nscan long)
gain reference to gain resulting from the fit
off reference to offset resulting from the fit
egain reference to error on the gain resulting from the fit
eoff reference to the error on the offset resulting from the fit
Returns:
graph energy vs inflection point

int energyCalibration::setChargeSharing ( int  p = -1  ) 

sets plot flag

Parameters:
p plot flag (-1 gets, 0 unsets, >0 plot)
Returns:
current plot flag

void energyCalibration::setFitRange ( Double_t  mi,
Double_t  ma 
) [inline]

sets the s-curve fit range

Parameters:
mi minimum of the fit range (-1 is histogram x-min)
ma maximum of the fit range (-1 is histogram x-max)

int energyCalibration::setPlotFlag ( int  p = -1  )  [inline]

sets plot flag

Parameters:
p plot flag (-1 gets, 0 unsets, >0 plot)
Returns:
current plot flag

int energyCalibration::setScanSign ( int  s = 0  )  [inline]

sets scan sign

Parameters:
s can be 1 (energy and x-axis have the same direction) or -1 (energy and x-axis have opposite directions) otherwise gets
Returns:
current scan sign can be 1 (energy and x-axis have the same direction) or -1 (energy and x-axis have opposite directions)

void energyCalibration::setStartParameters ( Double_t *  par  ) 

set start parameters for the s-curve function

Parameters:
par parameters, -1 sets to auto-calculation par[0] is the pedestal par[1] is the slope of the pedestal par[2] is the inflection point par[3] is the RMS par[4] is the amplitude par[5] is the angual coefficient of the charge sharing slope (scales with par[3]) -- always positive


Member Data Documentation

Double_t energyCalibration::ampl [private]

start value for the number of photons

Double_t energyCalibration::bg_offset [private]

start value for the background pedestal

Double_t energyCalibration::bg_slope [private]

start value for the background slope

int energyCalibration::cs_flag [private]

0 functions without charge sharing contribution, >0 with charge sharing contribution

Double_t energyCalibration::cs_slope [private]

start value for the charge sharing slope

Double_t energyCalibration::fit_max [private]

maximum of the s-curve fitting range, -1 is histogram x-max

Double_t energyCalibration::fit_min [private]

minimum of the s-curve fitting range, -1 is histogram x-min

Double_t energyCalibration::flex [private]

start value for the inflection point

TF1* energyCalibration::fscurve [private]

function with which the s-curve will be fitted

TF1* energyCalibration::fspectrum [private]

function with which the spectrum will be fitted

energyCalibrationFunctions* energyCalibration::funcs [private]

Double_t energyCalibration::noise [private]

start value for the noise

int energyCalibration::plot_flag [private]

0 does not plot, >0 plots (flags?)


The documentation for this class was generated from the following file:
Generated on Tue Mar 27 16:32:29 2012 by  doxygen 1.4.7