105 Error (
"TSpectrumFit",
"Invalid number of peaks, must be > than 0");
215 c = (-1.) *
dap *
c * t * t * (
da1 + t * (2. *
da2 + t * 3. *
da3)) -
281 c =
p + 1. / (2. *
b);
353 c =
p + 1. / (2. *
b);
418 c =
p + 1. / (2. *
b);
473 c =
p + 1. / (2. *
b);
486 r = -
r * t / (2. *
b *
b);
547 c =
p + 1. / (2. *
b);
662 r = (-1) * 0.25 / (
b *
b);
664 r =
a *
sigma * t * exp(
r) * (1 - 2 *
r);
685 if (
pw > 10)
c *=
a2;
686 if (
pw > 12)
c *=
a2;
826 Double_t a,
b,
c,
d = 0, alpha,
chi_opt,
yw,
ywm,
f,
chi2,
chi_min,
chi =
829 for (i = 0,
j = 0; i <
fNPeaks; i++) {
848 if (
fFixT ==
false) {
853 if (
fFixB ==
false) {
858 if (
fFixS ==
false) {
880 Error (
"FitAwmi",
"All parameters are fixed");
885 Error (
"FitAwmi",
"Number of fitted parameters is larger than # of fitted points");
974 if (((
a +
d) <= 0 &&
a >= 0) || ((
a +
d) >= 0 &&
a <= 0))
1012 if (((
a +
d) <= 0 &&
a >= 0) || ((
a +
d) >= 0 &&
a <= 0))
1035 if (
fFixT ==
false) {
1057 if (
fFixB ==
false) {
1079 if (
fFixS ==
false) {
1186 for (pi = 0.1;
flag == 0 && pi <= 100; pi += 0.1) {
1190 for (i = 0,
j = 0; i <
fNPeaks; i++) {
1213 if (
fFixT ==
false) {
1217 if (
fFixB ==
false) {
1227 if (
fFixS ==
false) {
1287 for (i = 0,
j = 0; i <
fNPeaks; i++) {
1310 if (
fFixT ==
false) {
1314 if (
fFixB ==
false) {
1324 if (
fFixS ==
false) {
1348 for (i = 0,
j = 0; i <
fNPeaks; i++) {
1371 if (
fFixT ==
false) {
1375 if (
fFixB ==
false) {
1385 if (
fFixS ==
false) {
1435 alpha = alpha / 10.0;
1507 if (
fFixT ==
false) {
1519 if (
fFixB ==
false) {
1531 if (
fFixS ==
false) {
1576 for (i = 0,
j = 0; i <
fNPeaks; i++) {
1630 if (
fFixT ==
false) {
1641 if (
fFixB ==
false) {
1652 if (
fFixS ==
false) {
1731 for (i = 0; i <
size; i++) {
1745 for (i = 0; i <
size; i++) {
1751 for (i = 0; i <
size; i++) {
1752 for (
j = 0,
b = 0;
j <
size;
j++) {
1762 for (i = 0; i <
size; i++)
1866 for (i = 0,
j = 0; i <
fNPeaks; i++) {
1885 if (
fFixT ==
false) {
1890 if (
fFixB ==
false) {
1895 if (
fFixS ==
false) {
1916 Error (
"FitAwmi",
"All parameters are fixed");
1921 Error (
"FitAwmi",
"Number of fitted parameters is larger than # of fitted points");
1926 for (i = 0; i <
rozmer; i++)
1931 for (k = 0; k < (
rozmer + 4); k++) {
1970 if (
fFixT ==
false) {
1976 if (
fFixB ==
false) {
1983 if (
fFixS ==
false) {
2036 for (k = 0; k <
rozmer; k++) {
2055 for (i = 0; i <
rozmer; i++) {
2059 for (i = 0; i <
rozmer; i++) {
2081 for (pi = 0.1;
flag == 0 && pi <= 100; pi += 0.1) {
2085 for (i = 0,
j = 0; i <
fNPeaks; i++) {
2108 if (
fFixT ==
false) {
2112 if (
fFixB ==
false) {
2122 if (
fFixS ==
false) {
2182 for (i = 0,
j = 0; i <
fNPeaks; i++) {
2205 if (
fFixT ==
false) {
2209 if (
fFixB ==
false) {
2219 if (
fFixS ==
false) {
2243 for (i = 0,
j = 0; i <
fNPeaks; i++) {
2266 if (
fFixT ==
false) {
2270 if (
fFixB ==
false) {
2280 if (
fFixS ==
false) {
2330 alpha = alpha / 10.0;
2399 if (
fFixT ==
false) {
2410 if (
fFixB ==
false) {
2421 if (
fFixS ==
false) {
2462 for (i = 0,
j = 0; i <
fNPeaks; i++) {
2516 if (
fFixT ==
false) {
2527 if (
fFixB ==
false) {
2538 if (
fFixS ==
false) {
2592 for (i = 0; i <
rozmer; i++)
2612 Error(
"SetFitParameters",
"Wrong range");
2616 Error(
"SetFitParameters",
"Invalid number of iterations, must be positive");
2620 Error (
"SetFitParameters",
"Invalid step coefficient alpha, must be > than 0 and <=1");
2626 Error(
"SetFitParameters",
"Wrong type of statistic");
2631 Error(
"SetFitParameters",
"Wrong optimization algorithm");
2637 Error(
"SetFitParameters",
"Wrong power");
2642 Error(
"SetFitParameters",
"Wrong order of Taylor development");
2661 Error (
"SetPeakParameters",
"Invalid sigma, must be > than 0");
2666 Error (
"SetPeakParameters",
"Invalid peak position, must be in the range fXmin, fXmax");
2670 Error (
"SetPeakParameters",
"Invalid peak amplitude, must be > than 0");
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
double Double_t
Double 8 bytes.
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
The TNamed class is the base class for all named ROOT classes.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Bool_t fFixSigma
logical value of sigma parameter, which allows to fix the parameter (not to fit).
Double_t Ders(Int_t num_of_fitted_peaks, Double_t i, const Double_t *parameter, Double_t sigma)
This function calculates derivative of peaks shape function (see manual) according to relative amplit...
Double_t Area(Double_t a, Double_t sigma, Double_t t, Double_t b)
This function calculates area of a peak Function parameters:
Double_t * fAmpErr
[fNPeaks] array of amplitude errors
void SetPeakParameters(Double_t sigma, Bool_t fixSigma, const Double_t *positionInit, const Bool_t *fixPosition, const Double_t *ampInit, const Bool_t *fixAmp)
This function sets the following fitting parameters of peaks:
Double_t fAlpha
convergence coefficient, input parameter, it should be positive number and <=1, for details see refer...
Double_t Deri0(Double_t i, Double_t amp, Double_t i0, Double_t sigma, Double_t t, Double_t s, Double_t b)
This function calculates derivative of peak shape function (see manual) according to peak position.
Double_t Ourpowl(Double_t a, Int_t pw)
Power function.
Int_t fAlphaOptim
optimization of convergence algorithm, possible values kFitAlphaHalving, kFitAlphaOptimal
Double_t fA1Init
initial value of background a1 parameter(backgroud is estimated as a0+a1*x+a2*x*x)
void FitStiefel(Double_t *source)
This function fits the source spectrum.
Double_t Derdersigma(Int_t num_of_fitted_peaks, Double_t i, const Double_t *parameter, Double_t sigma)
This function calculates second derivative of peaks shape function (see manual) according to sigma of...
Double_t * fPositionCalc
[fNPeaks] array of calculated values of fitted positions, output parameters
Double_t fSInit
initial value of s parameter (relative amplitude of step), for details see html manual and references
Double_t fA1Calc
calculated value of background a1 parameter
Double_t fSigmaErr
error value of sigma parameter
Bool_t * fFixAmp
[fNPeaks] array of logical values which allow to fix appropriate amplitudes (not fit)....
Double_t * fAmpCalc
[fNPeaks] array of calculated values of fitted amplitudes, output parameters
Bool_t fFixB
logical value of b parameter, which allows to fix the parameter (not to fit).
Double_t Dersigma(Int_t num_of_fitted_peaks, Double_t i, const Double_t *parameter, Double_t sigma, Double_t t, Double_t s, Double_t b)
This function calculates derivative of peaks shape function (see manual) according to sigma of peaks.
Double_t fBErr
error value of b parameter
void FitAwmi(Double_t *source)
This function fits the source spectrum.
Int_t fNumberIterations
number of iterations in fitting procedure, input parameter, it should be > 0
Double_t * fAmpInit
[fNPeaks] array of initial values of peaks amplitudes, input parameters
Double_t fA1Err
error value of background a1 parameter
Double_t fA2Err
error value of background a2 parameter
Bool_t * fFixPosition
[fNPeaks] array of logical values which allow to fix appropriate positions (not fit)....
Double_t fA0Calc
calculated value of background a0 parameter
Int_t fNPeaks
number of peaks present in fit, input parameter, it should be > 0
Double_t fBCalc
calculated value of b parameter
Bool_t fFixA2
logical value of a2 parameter, which allows to fix the parameter (not to fit).
Double_t Erfc(Double_t x)
TSpectrumFit(void)
Default constructor.
~TSpectrumFit() override
Destructor.
Double_t fA2Init
initial value of background a2 parameter(backgroud is estimated as a0+a1*x+a2*x*x)
Double_t Derpt(Double_t a, Double_t sigma, Double_t b)
This function calculates derivative of the area of peak according to t parameter.
Bool_t fFixA1
logical value of a1 parameter, which allows to fix the parameter (not to fit).
Double_t fA2Calc
calculated value of background a2 parameter
Double_t Derpb(Double_t a, Double_t sigma, Double_t t, Double_t b)
This function calculates derivative of the area of peak according to b parameter.
Double_t * fPositionErr
[fNPeaks] array of position errors
Double_t fTInit
initial value of t parameter (relative amplitude of tail), for details see html manual and references
Bool_t fFixT
logical value of t parameter, which allows to fix the parameter (not to fit).
void GetSigma(Double_t &sigma, Double_t &sigmaErr)
This function gets the sigma parameter and its error.
Int_t fFitTaylor
order of Taylor expansion, possible values kFitTaylorOrderFirst, kFitTaylorOrderSecond....
Double_t Dera1(Double_t i)
Derivative of background according to a1.
Double_t fSigmaCalc
calculated value of sigma parameter
Double_t Derpsigma(Double_t a, Double_t t, Double_t b)
This function calculates derivative of the area of peak according to sigma of peaks.
Double_t fSErr
error value of s parameter
Bool_t fFixA0
logical value of a0 parameter, which allows to fix the parameter (not to fit).
Int_t fPower
possible values kFitPower2,4,6,8,10,12, for details see references. It applies only for Awmi fitting ...
Double_t fChi
here the fitting functions return resulting chi square
Double_t * fArea
[fNPeaks] array of calculated areas of peaks
Double_t Dera2(Double_t i)
Derivative of background according to a2.
Double_t fBInit
initial value of b parameter (slope), for details see html manual and references
Double_t * fPositionInit
[fNPeaks] array of initial values of peaks positions, input parameters
void GetTailParameters(Double_t &t, Double_t &tErr, Double_t &b, Double_t &bErr, Double_t &s, Double_t &sErr)
This function gets the tail parameters and their errors.
Bool_t fFixS
logical value of s parameter, which allows to fix the parameter (not to fit).
Double_t fA0Init
initial value of background a0 parameter(backgroud is estimated as a0+a1*x+a2*x*x)
Int_t fXmin
first fitted channel
void SetFitParameters(Int_t xmin, Int_t xmax, Int_t numberIterations, Double_t alpha, Int_t statisticType, Int_t alphaOptim, Int_t power, Int_t fitTaylor)
This function sets the following fitting parameters:
Double_t fSCalc
calculated value of s parameter
void SetTailParameters(Double_t tInit, Bool_t fixT, Double_t bInit, Bool_t fixB, Double_t sInit, Bool_t fixS)
This function sets the following fitting parameters of tails of peaks.
Int_t fXmax
last fitted channel
Int_t fStatisticType
type of statistics, possible values kFitOptimChiCounts (chi square statistics with counts as weightin...
Double_t fTErr
error value of t parameter
Double_t Dert(Int_t num_of_fitted_peaks, Double_t i, const Double_t *parameter, Double_t sigma, Double_t b)
This function calculates derivative of peaks shape function (see manual) according to relative amplit...
Double_t Derb(Int_t num_of_fitted_peaks, Double_t i, const Double_t *parameter, Double_t sigma, Double_t t, Double_t b)
This function calculates derivative of peaks shape function (see manual) according to slope b.
Double_t Derpa(Double_t sigma, Double_t t, Double_t b)
This function calculates derivative of the area of peak according to its amplitude.
Double_t fSigmaInit
initial value of sigma parameter
Double_t Deramp(Double_t i, Double_t i0, Double_t sigma, Double_t t, Double_t s, Double_t b)
This function calculates derivative of peak shape function (see manual) according to amplitude of pea...
Double_t Derderi0(Double_t i, Double_t amp, Double_t i0, Double_t sigma)
This function calculates second derivative of peak shape function (see manual) according to peak posi...
Double_t fA0Err
error value of background a0 parameter
Double_t fTCalc
calculated value of t parameter
Double_t Shape(Int_t num_of_fitted_peaks, Double_t i, const Double_t *parameter, Double_t sigma, Double_t t, Double_t s, Double_t b, Double_t a0, Double_t a1, Double_t a2)
This function calculates peaks shape function (see manual) Function parameters:
Double_t * fAreaErr
[fNPeaks] array of errors of peak areas
void StiefelInversion(Double_t **a, Int_t rozmer)
This function calculates solution of the system of linear equations.
Double_t Derfc(Double_t x)
This function calculates derivative of error function of x.
void SetBackgroundParameters(Double_t a0Init, Bool_t fixA0, Double_t a1Init, Bool_t fixA1, Double_t a2Init, Bool_t fixA2)
This function sets the following fitting parameters of background:
void GetBackgroundParameters(Double_t &a0, Double_t &a0Err, Double_t &a1, Double_t &a1Err, Double_t &a2, Double_t &a2Err)
This function gets the background parameters and their errors.
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.