// @(#)root/spectrum:$Id$
// Author: Miroslav Morhac   25/09/2006

/////////////////////////////////////////////////////////////////////////////
//   THIS CLASS CONTAINS ADVANCED TWO-DIMENSIONAL SPECTRA                  //
//   FITTING FUNCTIONS                                                     //
//                                                                         //
//   These functions were written by:                                      //
//   Miroslav Morhac                                                       //
//   Institute of Physics                                                  //
//   Slovak Academy of Sciences                                            //
//   Dubravska cesta 9, 842 28 BRATISLAVA                                  //
//   SLOVAKIA                                                              //
//                                                                         //
//   email:fyzimiro@savba.sk,    fax:+421 7 54772479                       //
//                                                                         //
//  The original code in C has been repackaged as a C++ class by R.Brun    //
//                                                                         //
//  The algorithms in this class have been published in the following      //
//  references:                                                            //
//   [1] M. Morhac et al.: Efficient fitting algorithms applied to         //
//   analysis of coincidence gamma-ray spectra. Computer Physics           //
//   Communications, Vol 172/1 (2005) pp. 19-41.                           //
//                                                                         //
//   [2]  M. Morhac et al.: Study of fitting algorithms applied to         //
//   simultaneous analysis of large number of peaks in gamma-ray spectra.  //
//   Applied Spectroscopy, Vol. 57, No. 7, pp. 753-760, 2003.              //
//                                                                         //
//                                                                         //
//____________________________________________________________________________

#include "TSpectrum2Fit.h"
#include "TMath.h"

ClassImp(TSpectrum2Fit)

//______________________________________________________________________________
TSpectrum2Fit::TSpectrum2Fit() :TNamed("Spectrum2Fit", "Miroslav Morhac peak fitter")
{
   //default constructor
   fNPeaks = 0;
   fNumberIterations = 1;
   fXmin = 0;
   fXmax = 100;
   fYmin = 0;
   fYmax = 100;
   fStatisticType = kFitOptimChiCounts;
   fAlphaOptim    = kFitAlphaHalving;
   fPower         = kFitPower2;
   fFitTaylor     = kFitTaylorOrderFirst;
   fAlpha = 1;
   fChi   = 0;
   fPositionInitX   = 0;
   fPositionCalcX   = 0;
   fPositionErrX    = 0;
   fPositionInitY   = 0;
   fPositionCalcY   = 0;
   fPositionErrY    = 0;
   fPositionInitX1  = 0;
   fPositionCalcX1  = 0;
   fPositionErrX1   = 0;
   fPositionInitY1  = 0;
   fPositionCalcY1  = 0;
   fPositionErrY1   = 0;
   fAmpInit    = 0;
   fAmpCalc    = 0;
   fAmpErr     = 0;
   fAmpInitX1  = 0;
   fAmpCalcX1  = 0;
   fAmpErrX1   = 0;
   fAmpInitY1  = 0;
   fAmpCalcY1  = 0;
   fAmpErrY1   = 0;
   fVolume     = 0;
   fVolumeErr  = 0;
   fSigmaInitX = 2;
   fSigmaCalcX = 0;
   fSigmaErrX  = 0;
   fSigmaInitY = 2;
   fSigmaCalcY = 0;
   fSigmaErrY  = 0;
   fRoInit  = 0;
   fRoCalc  = 0;
   fRoErr   = 0;
   fTxyInit = 0;
   fTxyCalc = 0;
   fTxyErr  = 0;
   fTxInit  = 0;
   fTxCalc  = 0;
   fTxErr   = 0;
   fTyInit  = 0;
   fTyCalc  = 0;
   fTyErr   = 0;
   fBxInit  = 1;
   fBxCalc  = 0;
   fBxErr   = 0;
   fByInit  = 1;
   fByCalc  = 0;
   fByErr   = 0;
   fSxyInit = 0;
   fSxyCalc = 0;
   fSxyErr  = 0;
   fSxInit  = 0;
   fSxCalc  = 0;
   fSxErr   = 0;
   fSyInit  = 0;
   fSyCalc  = 0;
   fSyErr   = 0;
   fA0Init  = 0;
   fA0Calc  = 0;
   fA0Err   = 0;
   fAxInit  = 0;
   fAxCalc  = 0;
   fAxErr   = 0;
   fAyInit  = 0;
   fAyCalc  = 0;
   fAyErr   = 0;
   fFixPositionX    = 0;
   fFixPositionY    = 0;
   fFixPositionX1   = 0;
   fFixPositionY1   = 0;
   fFixAmp     = 0;
   fFixAmpX1   = 0;
   fFixAmpY1   = 0;
   fFixSigmaX  = false;
   fFixSigmaY  = false;
   fFixRo  = true;
   fFixTxy = true;
   fFixTx  = true;
   fFixTy  = true;
   fFixBx  = true;
   fFixBy  = true;
   fFixSxy = true;
   fFixSx  = true;
   fFixSy  = true;
   fFixA0  = true;
   fFixAx  = true;
   fFixAy  = true;

}
//______________________________________________________________________________
TSpectrum2Fit::TSpectrum2Fit(Int_t numberPeaks) :TNamed("Spectrum2Fit", "Miroslav Morhac peak fitter")
{
   //numberPeaks: number of fitted peaks (must be greater than zero)
   //the constructor allocates arrays for all fitted parameters (peak positions, amplitudes etc) and sets the member
   //variables to their default values. One can change these variables by member functions (setters) of TSpectrumFit class.
//Begin_Html <!--
/* -->
<div class=Section1>

<p class=MsoNormal style='text-align:justify'>Shape function of the fitted
peaks contains the two-dimensional symmetrical Gaussian two one-dimensional
symmetrical Gaussian ridges as well as nonsymmetrical terms and background.</p>

<p class=MsoNormal style='text-align:justify'><sub><span style='font-size:10.0pt'><img
width=600 height=401 src="gif/spectrum2fit_constructor_image001.gif"></span></sub></p>

</div>

<!-- */
// --> End_Html
   if (numberPeaks <= 0){
      Error ("TSpectrum2Fit","Invalid number of peaks, must be > than 0");
      return;
   }
   fNPeaks = numberPeaks;
   fNumberIterations = 1;
   fXmin = 0;
   fXmax = 100;
   fYmin = 0;
   fYmax = 100;
   fStatisticType = kFitOptimChiCounts;
   fAlphaOptim = kFitAlphaHalving;
   fPower = kFitPower2;
   fFitTaylor = kFitTaylorOrderFirst;
   fAlpha = 1;
   fChi   = 0;
   fPositionInitX   = new Double_t[numberPeaks];
   fPositionCalcX   = new Double_t[numberPeaks];
   fPositionErrX    = new Double_t[numberPeaks];
   fPositionInitY   = new Double_t[numberPeaks];
   fPositionCalcY   = new Double_t[numberPeaks];
   fPositionErrY    = new Double_t[numberPeaks];
   fPositionInitX1  = new Double_t[numberPeaks];
   fPositionCalcX1  = new Double_t[numberPeaks];
   fPositionErrX1   = new Double_t[numberPeaks];
   fPositionInitY1  = new Double_t[numberPeaks];
   fPositionCalcY1  = new Double_t[numberPeaks];
   fPositionErrY1   = new Double_t[numberPeaks];
   fAmpInit    = new Double_t[numberPeaks];
   fAmpCalc    = new Double_t[numberPeaks];
   fAmpErr     = new Double_t[numberPeaks];
   fAmpInitX1  = new Double_t[numberPeaks];
   fAmpCalcX1  = new Double_t[numberPeaks];
   fAmpErrX1   = new Double_t[numberPeaks];
   fAmpInitY1  = new Double_t[numberPeaks];
   fAmpCalcY1  = new Double_t[numberPeaks];
   fAmpErrY1   = new Double_t[numberPeaks];
   fVolume     = new Double_t[numberPeaks];
   fVolumeErr  = new Double_t[numberPeaks];
   fSigmaInitX = 2;
   fSigmaCalcX = 0;
   fSigmaErrX  = 0;
   fSigmaInitY = 2;
   fSigmaCalcY = 0;
   fSigmaErrY  = 0;
   fRoInit  = 0;
   fRoCalc  = 0;
   fRoErr   = 0;
   fTxyInit = 0;
   fTxyCalc = 0;
   fTxyErr  = 0;
   fTxInit  = 0;
   fTxCalc  = 0;
   fTxErr   = 0;
   fTyInit  = 0;
   fTyCalc  = 0;
   fTyErr   = 0;
   fBxInit  = 1;
   fBxCalc  = 0;
   fBxErr   = 0;
   fByInit  = 1;
   fByCalc  = 0;
   fByErr   = 0;
   fSxyInit = 0;
   fSxyCalc = 0;
   fSxyErr  = 0;
   fSxInit  = 0;
   fSxCalc  = 0;
   fSxErr   = 0;
   fSyInit  = 0;
   fSyCalc  = 0;
   fSyErr   = 0;
   fA0Init  = 0;
   fA0Calc  = 0;
   fA0Err   = 0;
   fAxInit  = 0;
   fAxCalc  = 0;
   fAxErr   = 0;
   fAyInit  = 0;
   fAyCalc  = 0;
   fAyErr   = 0;
   fFixPositionX    = new Bool_t[numberPeaks];
   fFixPositionY    = new Bool_t[numberPeaks];
   fFixPositionX1   = new Bool_t[numberPeaks];
   fFixPositionY1   = new Bool_t[numberPeaks];
   fFixAmp     = new Bool_t[numberPeaks];
   fFixAmpX1   = new Bool_t[numberPeaks];
   fFixAmpY1   = new Bool_t[numberPeaks];
   fFixSigmaX  = false;
   fFixSigmaY  = false;
   fFixRo  = true;
   fFixTxy = true;
   fFixTx  = true;
   fFixTy  = true;
   fFixBx  = true;
   fFixBy  = true;
   fFixSxy = true;
   fFixSx  = true;
   fFixSy  = true;
   fFixA0  = true;
   fFixAx  = true;
   fFixAy  = true;
}

//______________________________________________________________________________
TSpectrum2Fit::~TSpectrum2Fit()
{
   // destructor
   delete [] fPositionInitX;
   delete [] fPositionCalcX;
   delete [] fPositionErrX;
   delete [] fFixPositionX;
   delete [] fPositionInitY;
   delete [] fPositionCalcY;
   delete [] fPositionErrY;
   delete [] fFixPositionY;
   delete [] fPositionInitX1;
   delete [] fPositionCalcX1;
   delete [] fPositionErrX1;
   delete [] fFixPositionX1;
   delete [] fPositionInitY1;
   delete [] fPositionCalcY1;
   delete [] fPositionErrY1;
   delete [] fFixPositionY1;
   delete [] fAmpInit;
   delete [] fAmpCalc;
   delete [] fAmpErr;
   delete [] fFixAmp;
   delete [] fAmpInitX1;
   delete [] fAmpCalcX1;
   delete [] fAmpErrX1;
   delete [] fFixAmpX1;
   delete [] fAmpInitY1;
   delete [] fAmpCalcY1;
   delete [] fAmpErrY1;
   delete [] fFixAmpY1;
   delete [] fVolume;
   delete [] fVolumeErr;
}


/////////////////BEGINNING OF AUXILIARY FUNCTIONS USED BY FITTING FUNCTIONS//////////////////////////
//______________________________________________________________________________
Double_t TSpectrum2Fit::Erfc(Double_t x)
{
//////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                      //
//                                                                          //
//   This function calculates error function of x.                           //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////
   Double_t da1 = 0.1740121, da2 = -0.0479399, da3 = 0.3739278, dap =
       0.47047;
   Double_t a, t, c, w;
   a = TMath::Abs(x);
   w = 1. + dap * a;
   t = 1. / w;
   w = a * a;
   if (w < 700)
      c = exp(-w);

   else {
      c = 0;
   }
   c = c * t * (da1 + t * (da2 + t * da3));
   if (x < 0)
      c = 1. - c;
   return (c);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derfc(Double_t x)
{
//////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                      //
//                                                                          //
//   This function calculates derivative of error function of x.             //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////
   Double_t a, t, c, w;
   Double_t da1 = 0.1740121, da2 = -0.0479399, da3 = 0.3739278, dap =
       0.47047;
   a = TMath::Abs(x);
   w = 1. + dap * a;
   t = 1. / w;
   w = a * a;
   if (w < 700)
      c = exp(-w);

   else {
      c = 0;
   }
   c = (-1.) * dap * c * t * t * (da1 + t * (2. * da2 + t * 3. * da3)) -
       2. * a * Erfc(a);
   return (c);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Ourpowl(Double_t a, Int_t pw)
{
   //power function
   Double_t c;
   Double_t a2 = a*a;
   c = 1;
   if (pw >  0) c *= a2;
   if (pw >  2) c *= a2;
   if (pw >  4) c *= a2;
   if (pw >  6) c *= a2;
   if (pw >  8) c *= a2;
   if (pw > 10) c *= a2;
   if (pw > 12) c *= a2;
   return (c);
}
void TSpectrum2Fit::StiefelInversion(Double_t **a, Int_t size)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates solution of the system of linear equations.        //
//   The matrix a should have a dimension size*(size+4)                         //
//   The calling function should fill in the matrix, the column size should     //
//   contain vector y (right side of the system of equations). The result is    //
//   placed into size+1 column of the matrix.                                   //
//   according to sigma of peaks.                                               //
//      Function parameters:                                                    //
//              -a-matrix with dimension size*(size+4)                          //                                            //
//              -size-number of rows of the matrix                              //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Int_t i, j, k = 0;
   Double_t sk = 0, b, lambdak, normk, normk_old = 0;

   do {
      normk = 0;

         //calculation of rk and norm
      for (i = 0; i < size; i++) {
         a[i][size + 2] = -a[i][size]; //rk=-C
         for (j = 0; j < size; j++) {
            a[i][size + 2] += a[i][j] * a[j][size + 1]; //A*xk-C
         }
         normk += a[i][size + 2] * a[i][size + 2]; //calculation normk
      }

      //calculation of sk
      if (k != 0) {
         sk = normk / normk_old;
      }

      //calculation of uk
      for (i = 0; i < size; i++) {
         a[i][size + 3] = -a[i][size + 2] + sk * a[i][size + 3]; //uk=-rk+sk*uk-1
      }

      //calculation of lambdak
      lambdak = 0;
      for (i = 0; i < size; i++) {
         for (j = 0, b = 0; j < size; j++) {
            b += a[i][j] * a[j][size + 3]; //A*uk
         }
         lambdak += b * a[i][size + 3];
      }
      if (TMath::Abs(lambdak) > 1e-50) //computer zero
         lambdak = normk / lambdak;

      else
         lambdak = 0;
      for (i = 0; i < size; i++)
         a[i][size + 1] += lambdak * a[i][size + 3]; //xk+1=xk+lambdak*uk
      normk_old = normk;
      k += 1;
   } while (k < size && TMath::Abs(normk) > 1e-50); //computer zero
   return;
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Shape2(Int_t numOfFittedPeaks, Double_t x, Double_t y,
                            const Double_t *parameter, Double_t sigmax,
                            Double_t sigmay, Double_t ro, Double_t a0, Double_t ax,
                            Double_t ay, Double_t txy, Double_t sxy, Double_t tx,
                            Double_t ty, Double_t sx, Double_t sy, Double_t bx,
                            Double_t by)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates 2D peaks shape function (see manual)               //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x-channel in x-dimension                                       //
//              -y-channel in y-dimension                                       //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -ro-correlation coefficient                                     //
//              -a0,ax,ay-bac kground coefficients                              //
//              -txy,tx,ty, sxy,sy,sx-relative amplitudes                       //
//              -bx, by-slopes                                                  //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Int_t j;
   Double_t r, p, r1, e, ex, ey, vx, s2, px, py, rx, ry, erx, ery;
   vx = 0;
   s2 = TMath::Sqrt(2.0);
   for (j = 0; j < numOfFittedPeaks; j++) {
      p = (x - parameter[7 * j + 1]) / sigmax;
      r = (y - parameter[7 * j + 2]) / sigmay;
      if (TMath::Abs(p) < 3 && TMath::Abs(r) < 3) {
         e = (p * p - 2 * ro * p * r + r * r) / (2 * (1 - ro * ro));
         if (e < 700)
            r1 = exp(-e);

         else {
            r1 = 0;
         }
         if (txy != 0) {
            px = 0, py = 0;
            erx = Erfc(p / s2 + 1 / (2 * bx)), ery =
                Erfc(r / s2 + 1 / (2 * by));
            ex = p / (s2 * bx), ey = r / (s2 * by);
            if (TMath::Abs(ex) < 9 && TMath::Abs(ey) < 9) {
               px = exp(ex) * erx, py = exp(ey) * ery;
            }
            r1 += 0.5 * txy * px * py;
         }
         if (sxy != 0) {
            rx = Erfc(p / s2), ry = Erfc(r / s2);
            r1 += 0.5 * sxy * rx * ry;
         }
         vx = vx + parameter[7 * j] * r1;
      }
      p = (x - parameter[7 * j + 5]) / sigmax;
      if (TMath::Abs(p) < 3) {
         e = p * p / 2;
         if (e < 700)
            r1 = exp(-e);

         else {
            r1 = 0;
         }
         if (tx != 0) {
            px = 0;
            erx = Erfc(p / s2 + 1 / (2 * bx));
            ex = p / (s2 * bx);
            if (TMath::Abs(ex) < 9) {
               px = exp(ex) * erx;
            }
            r1 += 0.5 * tx * px;
         }
         if (sx != 0) {
            rx = Erfc(p / s2);
            r1 += 0.5 * sx * rx;
         }
         vx = vx + parameter[7 * j + 3] * r1;
      }
      r = (y - parameter[7 * j + 6]) / sigmay;
      if (TMath::Abs(r) < 3) {
         e = r * r / 2;
         if (e < 700)
            r1 = exp(-e);

         else {
            r1 = 0;
         }
         if (ty != 0) {
            py = 0;
            ery = Erfc(r / s2 + 1 / (2 * by));
            ey = r / (s2 * by);
            if (TMath::Abs(ey) < 9) {
               py = exp(ey) * ery;
            }
            r1 += 0.5 * ty * py;
         }
         if (sy != 0) {
            ry = Erfc(r / s2);
            r1 += 0.5 * sy * ry;
         }
         vx = vx + parameter[7 * j + 4] * r1;
      }
   }
   vx = vx + a0 + ax * x + ay * y;
   return (vx);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Deramp2(Double_t x, Double_t y, Double_t x0, Double_t y0,
                            Double_t sigmax, Double_t sigmay, Double_t ro,
                            Double_t txy, Double_t sxy, Double_t bx, Double_t by)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of 2D peaks shape function (see manual) //
//   according to amplitude of 2D peak                                          //
//      Function parameters:                                                    //
//              -x-channel in x-dimension                                       //
//              -y-channel in y-dimension                                       //
//              -x0-position of peak in x-dimension                             //
//              -y0-position of peak in y-dimension                             //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -ro-correlation coefficient                                     //
//              -txy, sxy-relative amplitudes                                   //
//              -bx, by-slopes                                                  //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 = 0, e, ex, ey, px, py, rx, ry, erx, ery, s2;
   p = (x - x0) / sigmax;
   r = (y - y0) / sigmay;
   if (TMath::Abs(p) < 3 && TMath::Abs(r) < 3) {
      s2 = TMath::Sqrt(2.0);
      e = (p * p - 2 * ro * p * r + r * r) / (2 * (1 - ro * ro));
      if (e < 700)
         r1 = exp(-e);

      else {
         r1 = 0;
      }
      if (txy != 0) {
         px = 0, py = 0;
         erx = Erfc(p / s2 + 1 / (2 * bx)), ery =
             Erfc(r / s2 + 1 / (2 * by));
         ex = p / (s2 * bx), ey = r / (s2 * by);
         if (TMath::Abs(ex) < 9 && TMath::Abs(ey) < 9) {
            px = exp(ex) * erx, py = exp(ey) * ery;
         }
         r1 += 0.5 * txy * px * py;
      }
      if (sxy != 0) {
         rx = Erfc(p / s2), ry = Erfc(r / s2);
         r1 += 0.5 * sxy * rx * ry;
      }
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derampx(Double_t x, Double_t x0, Double_t sigmax, Double_t tx,
                             Double_t sx, Double_t bx)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of 2D peaks shape function (see manual) //
//   according to amplitude of the ridge                                        //
//      Function parameters:                                                    //
//              -x-channel in x-dimension                                       //
//              -x0-position of peak in x-dimension                             //
//              -y0-position of peak in y-dimension                             //
//              -sigmax-sigmax of peaks                                         //
//              -ro-correlation coefficient                                     //
//              -tx, sx-relative amplitudes                                     //
//              -bx-slope                                                       //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r1 = 0, px, erx, rx, ex, s2;
   p = (x - x0) / sigmax;
   if (TMath::Abs(p) < 3) {
      s2 = TMath::Sqrt(2.0);
      p = p * p / 2;
      if (p < 700)
         r1 = exp(-p);

      else {
         r1 = 0;
      }
      if (tx != 0) {
         px = 0;
         erx = Erfc(p / s2 + 1 / (2 * bx));
         ex = p / (s2 * bx);
         if (TMath::Abs(ex) < 9) {
            px = exp(ex) * erx;
         }
         r1 += 0.5 * tx * px;
      }
      if (sx != 0) {
         rx = Erfc(p / s2);
         r1 += 0.5 * sx * rx;
      }
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Deri02(Double_t x, Double_t y, Double_t a, Double_t x0,
                            Double_t y0, Double_t sigmax, Double_t sigmay,
                            Double_t ro, Double_t txy, Double_t sxy, Double_t bx,
                            Double_t by)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of 2D peaks shape function (see manual) //
//   according to x position of 2D peak                                         //
//      Function parameters:                                                    //
//              -x-channel in x-dimension                                       //
//              -y-channel in y-dimension                                       //
//              -a-amplitude                                                    //
//              -x0-position of peak in x-dimension                             //
//              -y0-position of peak in y-dimension                             //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -ro-correlation coefficient                                     //
//              -txy, sxy-relative amplitudes                                   //
//              -bx, by-slopes                                                  //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 = 0, e, ex, ey, px, py, rx, ry, erx, ery, s2;
   p = (x - x0) / sigmax;
   r = (y - y0) / sigmay;
   if (TMath::Abs(p) < 3 && TMath::Abs(r) < 3) {
      s2 = TMath::Sqrt(2.0);
      e = (p * p - 2 * ro * p * r + r * r) / (2 * (1 - ro * ro));
      if (e < 700)
         r1 = exp(-e);

      else {
         r1 = 0;
      }
      e = -(ro * r - p) / sigmax;
      e = e / (1 - ro * ro);
      r1 = r1 * e;
      if (txy != 0) {
         px = 0, py = 0;
         erx =
             (-Erfc(p / s2 + 1 / (2 * bx)) / (s2 * bx * sigmax) -
              Derfc(p / s2 + 1 / (2 * bx)) / (s2 * sigmax)), ery =
             Erfc(r / s2 + 1 / (2 * by));
         ex = p / (s2 * bx), ey = r / (s2 * by);
         if (TMath::Abs(ex) < 9 && TMath::Abs(ey) < 9) {
            px = exp(ex) * erx, py = exp(ey) * ery;
         }
         r1 += 0.5 * txy * px * py;
      }
      if (sxy != 0) {
         rx = -Derfc(p / s2) / (s2 * sigmax), ry = Erfc(r / s2);
         r1 += 0.5 * sxy * rx * ry;
      }
      r1 = a * r1;
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derderi02(Double_t x, Double_t y, Double_t a, Double_t x0,
                              Double_t y0, Double_t sigmax, Double_t sigmay,
                              Double_t ro)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates second derivative of 2D peaks shape function       //
//   (see manual) according to x position of 2D peak                            //
//      Function parameters:                                                    //
//              -x-channel in x-dimension                                       //
//              -y-channel in y-dimension                                       //
//              -a-amplitude                                                    //
//              -x0-position of peak in x-dimension                             //
//              -y0-position of peak in y-dimension                             //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -ro-correlation coefficient                                     //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 = 0, e;
   p = (x - x0) / sigmax;
   r = (y - y0) / sigmay;
   if (TMath::Abs(p) < 3 && TMath::Abs(r) < 3) {
      e = (p * p - 2 * ro * p * r + r * r) / (2 * (1 - ro * ro));
      if (e < 700)
         r1 = exp(-e);

      else {
         r1 = 0;
      }
      e = -(ro * r - p) / sigmax;
      e = e / (1 - ro * ro);
      r1 = r1 * (e * e - 1 / ((1 - ro * ro) * sigmax * sigmax));
      r1 = a * r1;
   }
   return (r1);
}
Double_t TSpectrum2Fit::Derj02(Double_t x, Double_t y, Double_t a, Double_t x0,
                            Double_t y0, Double_t sigmax, Double_t sigmay,
                            Double_t ro, Double_t txy, Double_t sxy, Double_t bx,
                            Double_t by)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of 2D peaks shape function (see manual) //
//   according to y position of 2D peak                                         //
//      Function parameters:                                                    //
//              -x-channel in x-dimension                                       //
//              -y-channel in y-dimension                                       //
//              -a-amplitude                                                    //
//              -x0-position of peak in x-dimension                             //
//              -y0-position of peak in y-dimension                             //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -ro-correlation coefficient                                     //
//              -txy, sxy-relative amplitudes                                   //
//              -bx, by-slopes                                                  //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 = 0, e, ex, ey, px, py, rx, ry, erx, ery, s2;
   p = (x - x0) / sigmax;
   r = (y - y0) / sigmay;
   if (TMath::Abs(p) < 3 && TMath::Abs(r) < 3) {
      s2 = TMath::Sqrt(2.0);
      e = (p * p - 2 * ro * p * r + r * r) / (2 * (1 - ro * ro));
      if (e < 700)
         r1 = exp(-e);

      else {
         r1 = 0;
      }
      e = -(ro * p - r) / sigmay;
      e = e / (1 - ro * ro);
      r1 = r1 * e;
      if (txy != 0) {
         px = 0, py = 0;
         ery =
             (-Erfc(r / s2 + 1 / (2 * by)) / (s2 * by * sigmay) -
              Derfc(r / s2 + 1 / (2 * by)) / (s2 * sigmay)), erx =
             Erfc(p / s2 + 1 / (2 * bx));
         ex = p / (s2 * bx), ey = r / (s2 * by);
         if (TMath::Abs(ex) < 9 && TMath::Abs(ey) < 9) {
            px = exp(ex) * erx, py = exp(ey) * ery;
         }
         r1 += 0.5 * txy * px * py;
      }
      if (sxy != 0) {
         ry = -Derfc(r / s2) / (s2 * sigmay), rx = Erfc(p / s2);
         r1 += 0.5 * sxy * rx * ry;
      }
      r1 = a * r1;
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derderj02(Double_t x, Double_t y, Double_t a, Double_t x0,
                               Double_t y0, Double_t sigmax, Double_t sigmay,
                               Double_t ro)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates second derivative of 2D peaks shape function       //
//   (see manual) according to y position of 2D peak                            //
//      Function parameters:                                                    //
//              -x-channel in x-dimension                                       //
//              -y-channel in y-dimension                                       //
//              -a-amplitude                                                    //
//              -x0-position of peak in x-dimension                             //
//              -y0-position of peak in y-dimension                             //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -ro-correlation coefficient                                     //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 = 0, e;
   p = (x - x0) / sigmax;
   r = (y - y0) / sigmay;
   if (TMath::Abs(p) < 3 && TMath::Abs(r) < 3) {
      e = (p * p - 2 * ro * p * r + r * r) / (2 * (1 - ro * ro));
      if (e < 700)
         r1 = exp(-e);

      else {
         r1 = 0;
      }
      e = -(ro * p - r) / sigmay;
      e = e / (1 - ro * ro);
      r1 = r1 * (e * e - 1 / ((1 - ro * ro) * sigmay * sigmay));
      r1 = a * r1;
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Deri01(Double_t x, Double_t ax, Double_t x0, Double_t sigmax,
                            Double_t tx, Double_t sx, Double_t bx)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of 2D peaks shape function (see manual) //
//   according to x position of 1D ridge                                        //
//      Function parameters:                                                    //
//              -x-channel in x-dimension                                       //
//              -ax-amplitude of ridge                                          //
//              -x0-position of peak in x-dimension                             //
//              -sigmax-sigmax of peaks                                         //
//              -ro-correlation coefficient                                     //
//              -tx, sx-relative amplitudes                                     //
//              -bx-slope                                                       //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, e, r1 = 0, px, rx, erx, ex, s2;
   p = (x - x0) / sigmax;
   if (TMath::Abs(p) < 3) {
      s2 = TMath::Sqrt(2.0);
      e = p * p / 2;
      if (e < 700)
         r1 = exp(-e);

      else {
         r1 = 0;
      }
      r1 = r1 * p / sigmax;
      if (tx != 0) {
         px = 0;
         erx =
             (-Erfc(p / s2 + 1 / (2 * bx)) / (s2 * bx * sigmax) -
              Derfc(p / s2 + 1 / (2 * bx)) / (s2 * sigmax));
         ex = p / (s2 * bx);
         if (TMath::Abs(ex) < 9)
            px = exp(ex) * erx;
         r1 += 0.5 * tx * px;
      }
      if (sx != 0) {
         rx = -Derfc(p / s2) / (s2 * sigmax);
         r1 += 0.5 * sx * rx;
      }
      r1 = ax * r1;
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derderi01(Double_t x, Double_t ax, Double_t x0,
                               Double_t sigmax)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates second derivative of 2D peaks shape function       //
//   (see manual) according to x position of 1D ridge                           //
//      Function parameters:                                                    //
//              -x-channel in x-dimension                                       //
//              -ax-amplitude of ridge                                          //
//              -x0-position of peak in x-dimension                             //
//              -sigmax-sigmax of peaks                                         //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, e, r1 = 0;
   p = (x - x0) / sigmax;
   if (TMath::Abs(p) < 3) {
      e = p * p / 2;
      if (e < 700)
         r1 = exp(-e);

      else {
         r1 = 0;
      }
      r1 = r1 * (p * p / (sigmax * sigmax) - 1 / (sigmax * sigmax));
      r1 = ax * r1;
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Dersigmax(Int_t numOfFittedPeaks, Double_t x, Double_t y,
                               const Double_t *parameter, Double_t sigmax,
                               Double_t sigmay, Double_t ro, Double_t txy,
                               Double_t sxy, Double_t tx, Double_t sx, Double_t bx,
                               Double_t by)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of peaks shape function (see manual)    //
//   according to sigmax of peaks.                                              //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x,y-position of channel                                        //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -ro-correlation coefficient                                     //
//              -txy, sxy, tx, sx-relative amplitudes                           //
//              -bx, by-slopes                                                  //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 =
       0, e, a, b, x0, y0, s2, px, py, rx, ry, erx, ery, ex, ey;
   Int_t j;
   s2 = TMath::Sqrt(2.0);
   for (j = 0; j < numOfFittedPeaks; j++) {
      a = parameter[7 * j];
      x0 = parameter[7 * j + 1];
      y0 = parameter[7 * j + 2];
      p = (x - x0) / sigmax;
      r = (y - y0) / sigmay;
      if (TMath::Abs(p) < 3 && TMath::Abs(r) < 3) {
         e = (p * p - 2 * ro * p * r + r * r) / (2 * (1 - ro * ro));
         if (e < 700)
            e = exp(-e);

         else {
            e = 0;
         }
         b = -(ro * p * r - p * p) / sigmax;
         e = e * b / (1 - ro * ro);
         if (txy != 0) {
            px = 0, py = 0;
            erx =
                -Erfc(p / s2 + 1 / (2 * bx)) * p / (s2 * bx * sigmax) -
                Derfc(p / s2 + 1 / (2 * bx)) * p / (s2 * sigmax), ery =
                Erfc(r / s2 + 1 / (2 * by));
            ex = p / (s2 * bx), ey = r / (s2 * by);
            if (TMath::Abs(ex) < 9 && TMath::Abs(ey) < 9) {
               px = exp(ex) * erx, py = exp(ey) * ery;
            }
            e += 0.5 * txy * px * py;
         }
         if (sxy != 0) {
            rx = -Derfc(p / s2) * p / (s2 * sigmax), ry = Erfc(r / s2);
            e += 0.5 * sxy * rx * ry;
         }
         r1 = r1 + a * e;
      }
      if (TMath::Abs(p) < 3) {
         x0 = parameter[7 * j + 5];
         p = (x - x0) / sigmax;
         b = p * p / 2;
         if (b < 700)
            e = exp(-b);

         else {
            e = 0;
         }
         e = 2 * b * e / sigmax;
         if (tx != 0) {
            px = 0;
            erx =
                (-Erfc(p / s2 + 1 / (2 * bx)) * p / (s2 * bx * sigmax) -
                 Derfc(p / s2 + 1 / (2 * bx)) * p / (s2 * sigmax));
            ex = p / (s2 * bx);
            if (TMath::Abs(ex) < 9)
               px = exp(ex) * erx;
            e += 0.5 * tx * px;
         }
         if (sx != 0) {
            rx = -Derfc(p / s2) * p / (s2 * sigmax);
            e += 0.5 * sx * rx;
         }
         r1 += parameter[7 * j + 3] * e;
      }
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derdersigmax(Int_t numOfFittedPeaks, Double_t x,
                                  Double_t y, const Double_t *parameter,
                                  Double_t sigmax, Double_t sigmay,
                                  Double_t ro)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates second derivative of peaks shape function          //
//   (see manual) according to sigmax of peaks.                                 //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x,y-position of channel                                        //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -ro-correlation coefficient                                     //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 = 0, e, a, b, x0, y0;
   Int_t j;
   for (j = 0; j < numOfFittedPeaks; j++) {
      a = parameter[7 * j];
      x0 = parameter[7 * j + 1];
      y0 = parameter[7 * j + 2];
      p = (x - x0) / sigmax;
      r = (y - y0) / sigmay;
      if (TMath::Abs(p) < 3 && TMath::Abs(r) < 3) {
         e = (p * p - 2 * ro * p * r + r * r) / (2 * (1 - ro * ro));
         if (e < 700)
            e = exp(-e);

         else {
            e = 0;
         }
         b = -(ro * p * r - p * p) / sigmax;
         e = e * (b * b / (1 - ro * ro) -
                   (3 * p * p - 2 * ro * p * r) / (sigmax * sigmax)) / (1 -
                                                                        ro
                                                                        *
                                                                        ro);
         r1 = r1 + a * e;
      }
      if (TMath::Abs(p) < 3) {
         x0 = parameter[7 * j + 5];
         p = (x - x0) / sigmax;
         b = p * p / 2;
         if (b < 700)
            e = exp(-b);

         else {
            e = 0;
         }
         e = e * (4 * b * b - 6 * b) / (sigmax * sigmax);
         r1 += parameter[7 * j + 3] * e;
      }
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Dersigmay(Int_t numOfFittedPeaks, Double_t x, Double_t y,
                               const Double_t *parameter, Double_t sigmax,
                               Double_t sigmay, Double_t ro, Double_t txy,
                               Double_t sxy, Double_t ty, Double_t sy, Double_t bx,
                               Double_t by)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of peaks shape function (see manual)    //
//   according to sigmax of peaks.                                              //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x,y-position of channel                                        //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -ro-correlation coefficient                                     //
//              -txy, sxy, ty, sy-relative amplitudes                           //
//              -bx, by-slopes                                                  //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 =
       0, e, a, b, x0, y0, s2, px, py, rx, ry, erx, ery, ex, ey;
   Int_t j;
   s2 = TMath::Sqrt(2.0);
   for (j = 0; j < numOfFittedPeaks; j++) {
      a = parameter[7 * j];
      x0 = parameter[7 * j + 1];
      y0 = parameter[7 * j + 2];
      p = (x - x0) / sigmax;
      r = (y - y0) / sigmay;
      if (TMath::Abs(p) < 3 && TMath::Abs(r) < 3) {
         e = (p * p - 2 * ro * p * r + r * r) / (2 * (1 - ro * ro));
         if (e < 700)
            e = exp(-e);

         else {
            e = 0;
         }
         b = -(ro * p * r - r * r) / sigmay;
         e = e * b / (1 - ro * ro);
         if (txy != 0) {
            px = 0, py = 0;
            ery =
                -Erfc(r / s2 + 1 / (2 * by)) * r / (s2 * by * sigmay) -
                Derfc(r / s2 + 1 / (2 * by)) * r / (s2 * sigmay), erx =
                Erfc(p / s2 + 1 / (2 * bx));
            ex = p / (s2 * bx), ey = r / (s2 * by);
            if (TMath::Abs(ex) < 9 && TMath::Abs(ey) < 9) {
               px = exp(ex) * erx, py = exp(ey) * ery;
            }
            e += 0.5 * txy * px * py;
         }
         if (sxy != 0) {
            ry = -Derfc(r / s2) * r / (s2 * sigmay), rx = Erfc(p / s2);
            e += 0.5 * sxy * rx * ry;
         }
         r1 = r1 + a * e;
      }
      if (TMath::Abs(r) < 3) {
         y0 = parameter[7 * j + 6];
         r = (y - y0) / sigmay;
         b = r * r / 2;
         if (b < 700)
            e = exp(-b);

         else {
            e = 0;
         }
         e = 2 * b * e / sigmay;
         if (ty != 0) {
            py = 0;
            ery =
                (-Erfc(r / s2 + 1 / (2 * by)) * r / (s2 * by * sigmay) -
                 Derfc(r / s2 + 1 / (2 * by)) * r / (s2 * sigmay));
            ey = r / (s2 * by);
            if (TMath::Abs(ey) < 9)
               py = exp(ey) * ery;
            e += 0.5 * ty * py;
         }
         if (sy != 0) {
            ry = -Derfc(r / s2) * r / (s2 * sigmay);
            e += 0.5 * sy * ry;
         }
         r1 += parameter[7 * j + 4] * e;
      }
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derdersigmay(Int_t numOfFittedPeaks, Double_t x,
                                  Double_t y, const Double_t *parameter,
                                  Double_t sigmax, Double_t sigmay,
                                  Double_t ro)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates second derivative of peaks shape function          //
//   (see manual) according to sigmay of peaks.                                 //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x,y-position of channel                                        //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -ro-correlation coefficient                                     //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 = 0, e, a, b, x0, y0;
   Int_t j;
   for (j = 0; j < numOfFittedPeaks; j++) {
      a = parameter[7 * j];
      x0 = parameter[7 * j + 1];
      y0 = parameter[7 * j + 2];
      p = (x - x0) / sigmax;
      r = (y - y0) / sigmay;
      if (TMath::Abs(p) < 3 && TMath::Abs(r) < 3) {
         e = (p * p - 2 * ro * p * r + r * r) / (2 * (1 - ro * ro));
         if (e < 700)
            e = exp(-e);

         else {
            e = 0;
         }
         b = -(ro * p * r - r * r) / sigmay;
         e = e * (b * b / (1 - ro * ro) -
                   (3 * r * r - 2 * ro * r * p) / (sigmay * sigmay)) / (1 -
                                                                        ro
                                                                        *
                                                                        ro);
         r1 = r1 + a * e;
      }
      if (TMath::Abs(r) < 3) {
         y0 = parameter[7 * j + 6];
         r = (y - y0) / sigmay;
         b = r * r / 2;
         if (b < 700)
            e = exp(-b);

         else {
            e = 0;
         }
         e = e * (4 * b * b - 6 * b) / (sigmay * sigmay);
         r1 += parameter[7 * j + 4] * e;
      }
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derro(Int_t numOfFittedPeaks, Double_t x, Double_t y,
                           const Double_t *parameter, Double_t sx, Double_t sy,
                           Double_t r)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of peaks shape function (see manual)    //
//   according to correlation coefficient ro.                                   //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x,y-position of channel                                        //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sx-sigmax of peaks                                             //
//              -sy-sigmay of peaks                                             //
//              -r-correlation coefficient ro                                   //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t px, qx, rx, vx, x0, y0, a, ex, tx;
   Int_t j;
   vx = 0;
   for (j = 0; j < numOfFittedPeaks; j++) {
      a = parameter[7 * j];
      x0 = parameter[7 * j + 1];
      y0 = parameter[7 * j + 2];
      px = (x - x0) / sx;
      qx = (y - y0) / sy;
      if (TMath::Abs(px) < 3 && TMath::Abs(qx) < 3) {
         rx = (px * px - 2 * r * px * qx + qx * qx);
         ex = rx / (2 * (1 - r * r));
         if ((ex) < 700)
            ex = exp(-ex);

         else {
            ex = 0;
         }
         tx = px * qx / (1 - r * r);
         tx = tx - r * rx / ((1 - r * r) * (1 - r * r));
         vx = vx + a * ex * tx;
      }
   }
   return (vx);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Dertxy(Int_t numOfFittedPeaks, Double_t x, Double_t y,
                            const Double_t *parameter, Double_t sigmax,
                            Double_t sigmay, Double_t bx, Double_t by)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of peaks shape function (see manual)    //
//   according to relative amplitude txy.                                       //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x,y-position of channel                                        //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -bx, by-slopes                                                  //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 = 0, ex, ey, px, py, erx, ery, s2, x0, y0, a;
   Int_t j;
   s2 = TMath::Sqrt(2.0);
   for (j = 0; j < numOfFittedPeaks; j++) {
      a = parameter[7 * j];
      x0 = parameter[7 * j + 1];
      y0 = parameter[7 * j + 2];
      p = (x - x0) / sigmax;
      r = (y - y0) / sigmay;
      px = 0, py = 0;
      erx = Erfc(p / s2 + 1 / (2 * bx)), ery =
          Erfc(r / s2 + 1 / (2 * by));
      ex = p / (s2 * bx), ey = r / (s2 * by);
      if (TMath::Abs(ex) < 9 && TMath::Abs(ey) < 9) {
         px = exp(ex) * erx, py = exp(ey) * ery;
      }
      r1 += 0.5 * a * px * py;
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Dersxy(Int_t numOfFittedPeaks, Double_t x, Double_t y,
                            const Double_t *parameter, Double_t sigmax,
                            Double_t sigmay)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of peaks shape function (see manual)    //
//   according to relative amplitude sxy.                                       //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x,y-position of channel                                        //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 = 0, rx, ry, x0, y0, a, s2;
   Int_t j;
   s2 = TMath::Sqrt(2.0);
   for (j = 0; j < numOfFittedPeaks; j++) {
      a = parameter[7 * j];
      x0 = parameter[7 * j + 1];
      y0 = parameter[7 * j + 2];
      p = (x - x0) / sigmax;
      r = (y - y0) / sigmay;
      rx = Erfc(p / s2), ry = Erfc(r / s2);
      r1 += 0.5 * a * rx * ry;
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Dertx(Int_t numOfFittedPeaks, Double_t x,
                           const Double_t *parameter, Double_t sigmax,
                           Double_t bx)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of peaks shape function (see manual)    //
//   according to relative amplitude tx.                                        //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x-position of channel                                          //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigma of 1D ridge                                       //
//              -bx-slope                                                       //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r1 = 0, ex, px, erx, s2, ax, x0;
   Int_t j;
   s2 = TMath::Sqrt(2.0);
   for (j = 0; j < numOfFittedPeaks; j++) {
      ax = parameter[7 * j + 3];
      x0 = parameter[7 * j + 5];
      p = (x - x0) / sigmax;
      px = 0;
      erx = Erfc(p / s2 + 1 / (2 * bx));
      ex = p / (s2 * bx);
      if (TMath::Abs(ex) < 9) {
         px = exp(ex) * erx;
      }
      r1 += 0.5 * ax * px;
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derty(Int_t numOfFittedPeaks, Double_t x,
                           const Double_t *parameter, Double_t sigmax,
                           Double_t bx)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of peaks shape function (see manual)    //
//   according to relative amplitude ty.                                        //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x-position of channel                                          //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigma of 1D ridge                                       //
//              -bx-slope                                                       //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r1 = 0, ex, px, erx, s2, ax, x0;
   Int_t j;
   s2 = TMath::Sqrt(2.0);
   for (j = 0; j < numOfFittedPeaks; j++) {
      ax = parameter[7 * j + 4];
      x0 = parameter[7 * j + 6];
      p = (x - x0) / sigmax;
      px = 0;
      erx = Erfc(p / s2 + 1 / (2 * bx));
      ex = p / (s2 * bx);
      if (TMath::Abs(ex) < 9) {
         px = exp(ex) * erx;
      }
      r1 += 0.5 * ax * px;
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Dersx(Int_t numOfFittedPeaks, Double_t x,
                           const Double_t *parameter, Double_t sigmax)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of peaks shape function (see manual)    //
//   according to relative amplitude sx.                                        //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x-position of channel                                          //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigma of 1D ridge                                       //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r1 = 0, rx, ax, x0, s2;
   Int_t j;
   s2 = TMath::Sqrt(2.0);
   for (j = 0; j < numOfFittedPeaks; j++) {
      ax = parameter[7 * j + 3];
      x0 = parameter[7 * j + 5];
      p = (x - x0) / sigmax;
      s2 = TMath::Sqrt(2.0);
      rx = Erfc(p / s2);
      r1 += 0.5 * ax * rx;
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Dersy(Int_t numOfFittedPeaks, Double_t x,
                           const Double_t *parameter, Double_t sigmax)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of peaks shape function (see manual)    //
//   according to relative amplitude sy.                                        //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x-position of channel                                          //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigma of 1D ridge                                       //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r1 = 0, rx, ax, x0, s2;
   Int_t j;
   s2 = TMath::Sqrt(2.0);
   for (j = 0; j < numOfFittedPeaks; j++) {
      ax = parameter[7 * j + 4];
      x0 = parameter[7 * j + 6];
      p = (x - x0) / sigmax;
      s2 = TMath::Sqrt(2.0);
      rx = Erfc(p / s2);
      r1 += 0.5 * ax * rx;
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derbx(Int_t numOfFittedPeaks, Double_t x, Double_t y,
                           const Double_t *parameter, Double_t sigmax,
                           Double_t sigmay, Double_t txy, Double_t tx, Double_t bx,
                           Double_t by)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of peaks shape function (see manual)    //
//   according to slope bx.                                                     //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x,y-position of channel                                        //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -txy, tx-relative amplitudes                                    //
//              -bx, by-slopes                                                  //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 = 0, a, x0, y0, s2, px, py, erx, ery, ex, ey;
   Int_t j;
   s2 = TMath::Sqrt(2.0);
   for (j = 0; j < numOfFittedPeaks; j++) {
      a = parameter[7 * j];
      x0 = parameter[7 * j + 1];
      y0 = parameter[7 * j + 2];
      p = (x - x0) / sigmax;
      r = (y - y0) / sigmay;
      if (txy != 0) {
         px = 0, py = 0;
         erx =
             -Erfc(p / s2 + 1 / (2 * bx)) * p / (s2 * bx * bx) -
             Derfc(p / s2 + 1 / (2 * bx)) / (s2 * bx * bx), ery =
             Erfc(r / s2 + 1 / (2 * by));
         ex = p / (s2 * bx), ey = r / (s2 * by);
         if (TMath::Abs(ex) < 9 && TMath::Abs(ey) < 9) {
            px = exp(ex) * erx, py = exp(ey) * ery;
         }
         r1 += 0.5 * a * txy * px * py;
      }
      a = parameter[7 * j + 3];
      x0 = parameter[7 * j + 5];
      p = (x - x0) / sigmax;
      if (tx != 0) {
         px = 0;
         erx =
             (-Erfc(p / s2 + 1 / (2 * bx)) * p / (s2 * bx * bx) -
              Derfc(p / s2 + 1 / (2 * bx)) / (s2 * bx * bx));
         ex = p / (s2 * bx);
         if (TMath::Abs(ex) < 9)
            px = exp(ex) * erx;
         r1 += 0.5 * a * tx * px;
      }
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derby(Int_t numOfFittedPeaks, Double_t x, Double_t y,
                           const Double_t *parameter, Double_t sigmax,
                           Double_t sigmay, Double_t txy, Double_t ty, Double_t bx,
                           Double_t by)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of peaks shape function (see manual)    //
//   according to slope by.                                                     //
//      Function parameters:                                                    //
//              -numOfFittedPeaks-number of fitted peaks                        //
//              -x,y-position of channel                                        //
//              -parameter-array of peaks parameters (amplitudes and positions) //
//              -sigmax-sigmax of peaks                                         //
//              -sigmay-sigmay of peaks                                         //
//              -txy, ty-relative amplitudes                                    //
//              -bx, by-slopes                                                  //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t p, r, r1 = 0, a, x0, y0, s2, px, py, erx, ery, ex, ey;
   Int_t j;
   s2 = TMath::Sqrt(2.0);
   for (j = 0; j < numOfFittedPeaks; j++) {
      a = parameter[7 * j];
      x0 = parameter[7 * j + 1];
      y0 = parameter[7 * j + 2];
      p = (x - x0) / sigmax;
      r = (y - y0) / sigmay;
      if (txy != 0) {
         px = 0, py = 0;
         ery =
             -Erfc(r / s2 + 1 / (2 * by)) * r / (s2 * by * by) -
             Derfc(r / s2 + 1 / (2 * by)) / (s2 * by * by), erx =
             Erfc(p / s2 + 1 / (2 * bx));
         ex = p / (s2 * bx), ey = r / (s2 * by);
         if (TMath::Abs(ex) < 9 && TMath::Abs(ey) < 9) {
            px = exp(ex) * erx, py = exp(ey) * ery;
         }
         r1 += 0.5 * a * txy * px * py;
      }
      a = parameter[7 * j + 4];
      y0 = parameter[7 * j + 6];
      r = (y - y0) / sigmay;
      if (ty != 0) {
         py = 0;
         ery =
             (-Erfc(r / s2 + 1 / (2 * by)) * r / (s2 * by * by) -
              Derfc(r / s2 + 1 / (2 * by)) / (s2 * by * by));
         ey = r / (s2 * by);
         if (TMath::Abs(ey) < 9)
            py = exp(ey) * ery;
         r1 += 0.5 * a * ty * py;
      }
   }
   return (r1);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Volume(Double_t a, Double_t sx, Double_t sy, Double_t ro)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates volume of a peak                                   //
//      Function parameters:                                                    //
//              -a-amplitude of the peak                                        //
//              -sx,sy-sigmas of peak                                           //
//              -ro-correlation coefficient                                     //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t pi = 3.1415926535, r;
   r = 1 - ro * ro;
   if (r > 0)
      r = TMath::Sqrt(r);

   else {
      return (0);
   }
   r = 2 * a * pi * sx * sy * r;
   return (r);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derpa2(Double_t sx, Double_t sy, Double_t ro)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of the volume of a peak                 //
//   according to amplitute                                                     //
//      Function parameters:                                                    //
//              -sx,sy-sigmas of peak                                           //
//              -ro-correlation coefficient                                     //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t pi = 3.1415926535, r;
   r = 1 - ro * ro;
   if (r > 0)
      r = TMath::Sqrt(r);

   else {
      return (0);
   }
   r = 2 * pi * sx * sy * r;
   return (r);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derpsigmax(Double_t a, Double_t sy, Double_t ro)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of the volume of a peak                 //
//   according to sigmax                                                        //
//      Function parameters:                                                    //
//              -a-amplitude of peak                                            //
//              -sy-sigma of peak                                               //
//              -ro-correlation coefficient                                     //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t pi = 3.1415926535, r;
   r = 1 - ro * ro;
   if (r > 0)
      r = TMath::Sqrt(r);

   else {
      return (0);
   }
   r = a * 2 * pi * sy * r;
   return (r);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derpsigmay(Double_t a, Double_t sx, Double_t ro)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of the volume of a peak                 //
//   according to sigmay                                                        //
//      Function parameters:                                                    //
//              -a-amplitude of peak                                            //
//              -sx-sigma of peak                                               //
//              -ro-correlation coefficient                                     //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t pi = 3.1415926535, r;
   r = 1 - ro * ro;
   if (r > 0)
      r = TMath::Sqrt(r);

   else {
      return (0);
   }
   r = a * 2 * pi * sx * r;
   return (r);
}

//______________________________________________________________________________
Double_t TSpectrum2Fit::Derpro(Double_t a, Double_t sx, Double_t sy, Double_t ro)
{
//////////////////////////////////////////////////////////////////////////////////
//   AUXILIARY FUNCTION                                                          //
//                                                                              //
//   This function calculates derivative of the volume of a peak                 //
//   according to ro                                                            //
//      Function parameters:                                                    //
//              -a-amplitude of peak                                            //
//              -sx,sy-sigmas of peak                                           //
//              -ro-correlation coefficient                                     //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////
   Double_t pi = 3.1415926535, r;
   r = 1 - ro * ro;
   if (r > 0)
      r = TMath::Sqrt(r);

   else {
      return (0);
   }
   r = -a * 2 * pi * sx * sy * ro / r;
   return (r);
}


/////////////////END OF AUXILIARY FUNCTIONS USED BY FITTING FUNCTION fit2//////////////////////////
/////////////////FITTING FUNCTION WITHOUT MATRIX INVERSION///////////////////////////////////////
//______________________________________________________________________________
void TSpectrum2Fit::FitAwmi(Double_t **source)
{
/////////////////////////////////////////////////////////////////////////////
// TWO-DIMENSIONAL FIT FUNCTION
//  ALGORITHM WITHOUT MATRIX INVERSION
//  This function fits the source spectrum. The calling program should
//  fill in input parameters of the TSpectrum2Fit class.
//  The fitted parameters are written into
//  TSpectrum2Fit class output parameters and fitted data are written into
//  source spectrum.
//
//        Function parameters:
//        source-pointer to the matrix of source spectrum
//
/////////////////////////////////////////////////////////////////////////////
//
//Begin_Html <!--
/* -->
<div class=Section2>

<p class=MsoNormal><b><span style='font-size:14.0pt'>Fitting</span></b></p>

<p class=MsoNormal style='text-align:justify'><i>&nbsp;</i></p>

<p class=MsoNormal style='text-align:justify'><i>Goal: to estimate
simultaneously peak shape parameters in spectra with large number of peaks</i></p>

<p class=MsoNormal>&nbsp;</p>

<p class=MsoNormal style='margin-left:36.0pt;text-align:justify;text-indent:
-18.0pt'>•<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>peaks can be fitted separately, each peak (or multiplets) in a region or
together all peaks in a spectrum. To fit separately each peak one needs to
determine the fitted region. However it can happen that the regions of
neighboring peaks are overlapping. Then the results of fitting are very poor.
On the other hand, when fitting together all peaks found in a  spectrum, one
needs to have a method that is  stable (converges) and fast enough to carry out
fitting in reasonable time </p>

<p class=MsoNormal style='margin-left:36.0pt;text-align:justify;text-indent:
-18.0pt'>•<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>we have implemented the nonsymmetrical semiempirical peak shape function</p>

<p class=MsoNormal style='margin-left:36.0pt;text-align:justify;text-indent:
-18.0pt'>•<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>it contains the two-dimensional symmetrical Gaussian two one-dimensional
symmetrical Gaussian ridges as well as nonsymmetrical terms and background.</p>

<p class=MsoNormal style='text-align:justify'><sub><img width=600 height=315
src="gif/spectrum2fit_awmi_image001.gif"></sub></p>

<p class=MsoNormal style='margin-left:37.05pt'>where Txy, Tx, Ty, Sxy, Sx, Sy
are relative amplitudes and Bx, By are slopes.</p>

<p class=MsoNormal>&nbsp;</p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'>•<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>algorithm without matrix inversion (AWMI) allows fitting tens, hundreds
of peaks simultaneously that represent sometimes thousands of parameters [2],
[5]. </p>

<p class=MsoNormal>&nbsp;</p>

<p class=MsoNormal>&nbsp;</p>

<p class=MsoNormal><i>Function:</i></p>

<p class=MsoNormal style='text-align:justify'>void <a
href="http://root.cern.ch/root/html/TSpectrum.html#TSpectrum:Fit1Awmi"><b>TSpectrumFit2::FitAwmi</b></a>(<a
href="http://root.cern.ch/root/html/ListOfTypes.html#float"><b>float</b></a> **fSource)</p>

<p class=MsoNormal style='text-align:justify'> </p>

<p class=MsoNormal style='text-align:justify'>This function fits the source
spectrum using AWMI algorithm. The calling program should fill in input
parameters of the TSpectrumFit2 class using a set of TSpectrumFit2 setters. The
fitted parameters are written into the class and fitted data are written into
source spectrum. </p>

<p class=MsoNormal>&nbsp;</p>

<p class=MsoNormal>&nbsp;</p>

<p class=MsoNormal><i><span style='color:red'>Parameter:</span></i></p>

<p class=MsoNormal style='text-align:justify'>        <b>fSource</b>-pointer to
the matrix of source spectrum                  </p>

<p class=MsoNormal>&nbsp;</p>

<p class=MsoNormal>&nbsp;</p>

<p class=MsoNormal><i><span style='font-size:10.0pt;color:red'>Member variables
of  TSpectrumFit2 class:</span></i></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t    
fNPeaks;                        //number of peaks present in fit, input
parameter, it should be &gt; 0</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t    
fNumberIterations;              //number of iterations in fitting procedure,
input parameter, it should be &gt; 0</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t    
fXmin;                          //first fitted channel in x direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t    
fXmax;                          //last fitted channel in x direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t    
fYmin;                          //first fitted channel in y direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t    
fYmax;                          //last fitted channel in y direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t    
fStatisticType;                 //type of statistics, possible values
kFitOptimChiCounts (chi square statistics with counts as weighting
coefficients), kFitOptimChiFuncValues (chi square statistics with function
values as weighting coefficients),kFitOptimMaxLikelihood</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t     fAlphaOptim;                   
//optimization of convergence algorithm, possible values kFitAlphaHalving,
kFitAlphaOptimal</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t    
fPower;                         //possible values kFitPower2,4,6,8,10,12, for
details see references. It applies only for Awmi fitting function.</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t    
fFitTaylor;                     //order of Taylor expansion, possible values
kFitTaylorOrderFirst, kFitTaylorOrderSecond. It applies only for Awmi fitting
function.</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fAlpha;                         //convergence coefficient, input parameter, it
should be positive number and &lt;=1, for details see references</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fChi;                           //here the fitting functions return resulting
chi square   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fPositionInitX;                 //[fNPeaks] array of initial values of x
positions of 2D peaks, input parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fPositionCalcX;                 //[fNPeaks] array of calculated values of x
positions of 2D peaks, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fPositionErrX;                  //[fNPeaks] array of error values of x
positions of 2D peaks, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fPositionInitY;                 //[fNPeaks] array of initial values of y
positions of 2D peaks, input parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fPositionCalcY;                 //[fNPeaks] array of calculated values of y
positions of 2D peaks, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fPositionErrY;                  //[fNPeaks] array of error values of y
positions of 2D peaks, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fPositionInitX1;                //[fNPeaks] array of initial x positions of 1D
ridges, input parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fPositionCalcX1;                //[fNPeaks] array of calculated x positions of
1D ridges, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fPositionErrX1;                 //[fNPeaks] array of x positions errors of 1D
ridges, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fPositionInitY1;                //[fNPeaks] array of initial y positions of 1D
ridges, input parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fPositionCalcY1;                //[fNPeaks] array of calculated y positions of
1D ridges, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fPositionErrY1;                 //[fNPeaks] array of y positions errors of 1D
ridges, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fAmpInit;                       //[fNPeaks] array of initial values of
amplitudes of 2D peaks, input parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fAmpCalc;                       //[fNPeaks] array of calculated values of
amplitudes of 2D peaks, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fAmpErr;                        //[fNPeaks] array of amplitudes errors of 2D
peaks, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fAmpInitX1;                     //[fNPeaks] array of initial values of
amplitudes of 1D ridges in x direction, input parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fAmpCalcX1;                     //[fNPeaks] array of calculated values of
amplitudes of 1D ridges in x direction, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fAmpErrX1;                      //[fNPeaks] array of amplitudes errors of 1D
ridges in x direction, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fAmpInitY1;                     //[fNPeaks] array of initial values of
amplitudes of 1D ridges in y direction, input parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fAmpCalcY1;                     //[fNPeaks] array of calculated values of
amplitudes of 1D ridges in y direction, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fAmpErrY1;                      //[fNPeaks] array of amplitudes errors of 1D
ridges in y direction, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fVolume;                        //[fNPeaks] array of calculated volumes of 2D
peaks, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t
*fVolumeErr;                     //[fNPeaks] array of volumes errors of 2D
peaks, output parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSigmaInitX;                    //initial value of sigma x parameter</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSigmaCalcX;                    //calculated value of sigma x parameter</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSigmaErrX;                     //error value of sigma x parameter</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSigmaInitY;                    //initial value of sigma y parameter</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSigmaCalcY;                    //calculated value of sigma y parameter</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSigmaErrY;                     //error value of sigma y parameter</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fRoInit;                        //initial value of correlation coefficient</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fRoCalc;                        //calculated value of correlation coefficient</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fRoErr;                         //error value of correlation coefficient</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fTxyInit;                       //initial value of t parameter for 2D peaks
(relative amplitude of tail), for details see html manual and references</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fTxyCalc;                       //calculated value of t parameter for 2D peaks</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fTxyErr;                        //error value of t parameter for 2D peaks</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSxyInit;                       //initial value of s parameter for 2D peaks
(relative amplitude of step), for details see html manual and references</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSxyCalc;                       //calculated value of s parameter for 2D peaks</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSxyErr;                        //error value of s parameter for 2D peaks</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fTxInit;                        //initial value of t parameter for 1D ridges in
x direction (relative amplitude of tail), for details see html manual and
references</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fTxCalc;                        //calculated value of t parameter for 1D ridges
in x direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fTxErr;                         //error value of t parameter for 1D ridges in x
direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fTyInit;                        //initial value of t parameter for 1D ridges in
y direction (relative amplitude of tail), for details see html manual and
references</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t  fTyCalc;                       
//calculated value of t parameter for 1D ridges in y direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fTyErr;                         //error value of t parameter for 1D ridges in y
direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSxInit;                        //initial value of s parameter for 1D ridges in
x direction (relative amplitude of step), for details see html manual and
references</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSxCalc;                        //calculated value of s parameter for 1D ridges
in x direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t  fSxErr;                         //error
value of s parameter for 1D ridges in x direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSyInit;                        //initial value of s parameter for 1D ridges in
y direction (relative amplitude of step), for details see html manual and
references</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSyCalc;                        //calculated value of s parameter for 1D ridges
in y direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fSyErr;                         //error value of s parameter for 1D ridges in y
direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fBxInit;                        //initial value of b parameter for 1D ridges in
x direction (slope), for details see html manual and references</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fBxCalc;                        //calculated value of b parameter for 1D ridges
in x direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fBxErr;                         //error value of b parameter for 1D ridges in x
direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fByInit;                        //initial value of b parameter for 1D ridges in
y direction (slope), for details see html manual and references</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fByCalc;                        //calculated value of b parameter for 1D ridges
in y direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fByErr;                         //error value of b parameter for 1D ridges in y
direction</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fA0Init;                        //initial value of background a0 parameter(backgroud
is estimated as a0+ax*x+ay*y)</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fA0Calc;                        //calculated value of background a0 parameter</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fA0Err;                         //error value of background a0 parameter</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t  fAxInit;        
               //initial value of background ax parameter(backgroud is
estimated as a0+ax*x+ay*y)</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fAxCalc;                        //calculated value of background ax parameter</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fAxErr;                         //error value of background ax parameter</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fAyInit;                        //initial value of background ay
parameter(backgroud is estimated as a0+ax*x+ay*y)</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t 
fAyCalc;                        //calculated value of background ay parameter</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t  fAyErr;                        
//error value of background ay parameter   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t  
*fFixPositionX;                  //[fNPeaks] array of logical values which
allow to fix appropriate x positions of 2D peaks (not fit). However they are
present in the estimated functional</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t  
*fFixPositionY;                  //[fNPeaks] array of logical values which
allow to fix appropriate y positions of 2D peaks (not fit). However they are
present in the estimated functional</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t  
*fFixPositionX1;                 //[fNPeaks] array of logical values which
allow to fix appropriate x positions of 1D ridges (not fit). However they are
present in the estimated functional</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t  
*fFixPositionY1;                 //[fNPeaks] array of logical values which
allow to fix appropriate y positions of 1D ridges (not fit). However they are
present in the estimated functional</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t  
*fFixAmp;                        //[fNPeaks] array of logical values which
allow to fix appropriate amplitudes of 2D peaks (not fit). However they are
present in the estimated functional</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t  
*fFixAmpX1;                      //[fNPeaks] array of logical values which
allow to fix appropriate amplitudes of 1D ridges in x direction (not fit).
However they are present in the estimated functional</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t  
*fFixAmpY1;                      //[fNPeaks] array of logical values which
allow to fix appropriate amplitudes of 1D ridges in y direction (not fit).
However they are present in the estimated functional</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t   
fFixSigmaX;                     //logical value of sigma x parameter, which
allows to fix the parameter (not to fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t   
fFixSigmaY;                     //logical value of sigma y parameter, which
allows to fix the parameter (not to fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t    fFixRo;                         //logical
value of correlation coefficient, which allows to fix the parameter (not to
fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t   
fFixTxy;                        //logical value of t parameter for 2D peaks,
which allows to fix the parameter (not to fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t   
fFixSxy;                        //logical value of s parameter for 2D peaks,
which allows to fix the parameter (not to fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t   
fFixTx;                         //logical value of t parameter for 1D ridges in
x direction, which allows to fix the parameter (not to fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t   
fFixTy;                         //logical value of t parameter for 1D ridges in
y direction, which allows to fix the parameter (not to fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t   
fFixSx;                         //logical value of s parameter for 1D ridges in
x direction, which allows to fix the parameter (not to fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t   
fFixSy;                         //logical value of s parameter for 1D ridges in
y direction, which allows to fix the parameter (not to fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t    fFixBx;                         //logical
value of b parameter for 1D ridges in x direction, which allows to fix the
parameter (not to fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t   
fFixBy;                         //logical value of b parameter for 1D ridges in
y direction, which allows to fix the parameter (not to fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t   
fFixA0;                         //logical value of a0 parameter, which allows
to fix the parameter (not to fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t   
fFixAx;                         //logical value of ax parameter, which allows
to fix the parameter (not to fit).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t   
fFixAy;                         //logical value of ay parameter, which allows
to fix the parameter (not to fit).</span></p>

<p class=MsoNormal> </p>

<p class=MsoNormal style='text-align:justify'><b><i>References:</i></b></p>

<p class=MsoNormal style='text-align:justify'>[1] Phillps G.W., Marlow K.W.,
NIM 137 (1976) 525.</p>

<p class=MsoNormal style='text-align:justify'>[2] I. A. Slavic: Nonlinear
least-squares fitting without matrix inversion applied to complex Gaussian
spectra analysis. NIM 134 (1976) 285-289.</p>

<p class=MsoNormal style='text-align:justify'>[3] T. Awaya: A new method for
curve fitting to the data with low statistics not using chi-square method. NIM
165 (1979) 317-323.</p>

<p class=MsoNormal style='text-align:justify'>[4] T. Hauschild, M. Jentschel:
Comparison of maximum likelihood estimation and chi-square statistics applied
to counting experiments. NIM A 457 (2001) 384-401.</p>

<p class=MsoNormal style='text-align:justify'> [5]  M. Morhá&#269;,  J.
Kliman,  M. Jandel,  &#317;. Krupa, V. Matoušek: Study of fitting algorithms
applied to simultaneous analysis of large number of peaks in -ray spectra. <span
lang=EN-GB>Applied Spectroscopy, Vol. 57, No. 7, pp. 753-760, 2003</span></p>

<p class=MsoNormal style='text-align:justify'> </p>

<p class=MsoNormal style='text-align:justify'><i>Example  – script FitAwmi2.c:</i></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:18.0pt'><img
border=0 width=602 height=455 src="gif/spectrum2fit_awmi_image002.jpg"></span></p>

<p class=MsoNormal style='text-align:justify'><b>Fig. 1 Original two-dimensional
spectrum with found peaks (using TSpectrum2 peak searching function). The
positions of peaks were used as initial estimates in fitting procedure.</b></p>

<p class=MsoNormal style='text-align:justify'><b><span style='font-size:16.0pt'><img
border=0 width=602 height=455 src="gif/spectrum2fit_awmi_image003.jpg"></span></b></p>

<p class=MsoBodyText2 style='text-align:justify'>Fig. 2 Fitted (generated from
fitted parameters) spectrum of the data from Fig. 1 using Algorithm Without
Matrix Inversion. Each peak was represented by 7 parameters, which together
with Sigmax, Sigmay and a0 resulted in 38 fitted parameters. The chi-square
after 1000 iterations was 0.642342.</p>

<p class=MsoNormal><b><span style='color:#339966'>&nbsp;</span></b></p>

<p class=MsoNormal><b><span style='color:#339966'>Script:</span></b></p>

<p class=MsoNormal>&nbsp;</p>

<p class=MsoNormal><span style='font-size:10.0pt'>// Example to illustrate fitting
function, algorithm without matrix inversion (AWMI) (class TSpectrumFit2).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>// To execute this example,
do</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>// root &gt; .x FitAwmi2.C</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>&nbsp;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>void FitAwmi2() {</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t i, j, nfound;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t nbinsx = 64;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t nbinsy = 64;   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t xmin  = 0;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t xmax  = nbinsx;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t ymin  = 0;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t ymax  = nbinsy;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t ** source = new
float *[nbinsx];   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t ** dest = new
float *[nbinsx];      </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   for (i=0;i&lt;nbinsx;i++)</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>                                                source[i]=new
float[nbinsy];</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   for (i=0;i&lt;nbinsx;i++)</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>                                                dest[i]=new
float[nbinsy];</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   TH2F *search = new
TH2F(&quot;search&quot;,&quot;High resolution peak
searching&quot;,nbinsx,xmin,xmax,nbinsy,ymin,ymax);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   TFile *f = new
TFile(&quot;TSpectrum2.root&quot;);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   search=(TH2F*)
f-&gt;Get(&quot;search4;1&quot;);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   TCanvas *Searching = new
TCanvas(&quot;Searching&quot;,&quot;Two-dimensional fitting using Algorithm
Without Matrix Inversion&quot;,10,10,1000,700);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   TSpectrum2 *s = new
TSpectrum2();</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   for (i = 0; i &lt; nbinsx;
i++){</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>     for (j = 0; j &lt;
nbinsy; j++){</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>                    source[i][j]
= search-&gt;GetBinContent(i + 1,j + 1); </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>                 }</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   } </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   //searching for candidate
peaks positions     </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   nfound =
s-&gt;SearchHighRes(source, dest, nbinsx, nbinsy, 2, 5, kTRUE, 3, kFALSE, 3);  
</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t *FixPosX = new
Bool_t[nfound];</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t *FixPosY = new
Bool_t[nfound];   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t *FixAmp = new
Bool_t[nfound];      </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t *PosX = new
Double_t[nfound];         </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t *PosY = new
Double_t[nfound];</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t *Amp = new
Double_t[nfound];      </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t *AmpXY = new
Double_t[nfound];         </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   PosX =
s-&gt;GetPositionX();</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   PosY =
s-&gt;GetPositionY();      </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   printf(&quot;Found %d
candidate peaks\n&quot;,nfound);   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   for(i = 0; i&lt; nfound ;
i++){</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>      FixPosX[i] = kFALSE;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>      FixPosY[i] =
kFALSE;      </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>      FixAmp[i] = kFALSE;    </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>      Amp[i] =
source[(Int_t)(PosX[i]+0.5)][(Int_t)(PosY[i]+0.5)];      //initial values of peaks
amplitudes, input parameters          </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>      AmpXY[i] = 0;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   }</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   //filling in the initial
estimates of the input parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   TSpectrumFit2 *pfit=new
TSpectrumFit2(nfound);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>  
pfit-&gt;SetFitParameters(xmin, xmax-1, ymin, ymax-1, 1000, 0.1, pfit-&gt;kFitOptimChiCounts,
pfit-&gt;kFitAlphaHalving, pfit-&gt;kFitPower2,
pfit-&gt;kFitTaylorOrderFirst);   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>  
pfit-&gt;SetPeakParameters(2, kFALSE, 2, kFALSE, 0, kTRUE, PosX, (Bool_t *)
FixPosX, PosY, (Bool_t *) FixPosY, PosX, (Bool_t *) FixPosX, PosY, (Bool_t *)
FixPosY, Amp, (Bool_t *) FixAmp, AmpXY, (Bool_t *) FixAmp, AmpXY, (Bool_t *)
FixAmp);      </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>  
pfit-&gt;SetBackgroundParameters(0, kFALSE, 0, kTRUE, 0, kTRUE);   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   pfit-&gt;FitAwmi(source);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>    for (i = 0; i &lt;
nbinsx; i++){</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>     for (j = 0; j &lt;
nbinsy; j++){</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>                  search-&gt;SetBinContent(i
+ 1, j + 1,source[i][j]);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>                 }</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   }   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>  
search-&gt;Draw(&quot;SURF&quot;);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>}</span></p>

<p class=MsoNormal style='text-align:justify'><i><span style='font-size:16.0pt'>&nbsp;</span></i></p>

<p class=MsoNormal style='text-align:justify'><i>Example 2 – script FitA2.c:</i></p>

<p class=MsoNormal><img border=0 width=602 height=455
src="gif/spectrum2fit_awmi_image004.jpg"></p>

<p class=MsoNormal style='text-align:justify'><b>Fig. 3 Original
two-dimensional gamma-gamma-ray spectrum with found peaks (using TSpectrum2
peak searching function). </b></p>

<p class=MsoNormal style='text-align:justify'><img border=0 width=602
height=455 src="gif/spectrum2fit_awmi_image005.jpg"></p>

<p class=MsoNormal style='text-align:justify'><b>Fig. 4 Fitted (generated from
fitted parameters) spectrum of the data from Fig. 3 using Algorithm Without
Matrix Inversion. 152 peaks were identified. </b><b>Each peak was represented
by 7 parameters, which together with Sigmax, Sigmay and a0 resulted in 1067
fitted parameters. The chi-square after 1000 iterations was 0.728675. One can
observe good correspondence with the original data.</b></p>

<p class=MsoNormal style='text-align:justify'><b><span style='font-size:16.0pt'>&nbsp;</span></b></p>

<p class=MsoNormal><b><span style='color:#339966'>Script:</span></b></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>//
Example to illustrate fitting function, algorithm without matrix inversion
(AWMI) (class TSpectrumFit2).</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>//
To execute this example, do</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>//
root &gt; .x FitA2.C</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>void
FitA2() {</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Int_t i, j, nfound;</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Int_t nbinsx = 256;</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Int_t nbinsy = 256;   </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Int_t xmin  = 0;</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Int_t xmax  = nbinsx;</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Int_t ymin  = 0;</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Int_t ymax  = nbinsy;</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Double_t ** source = new float *[nbinsx];   </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Double_t ** dest = new float *[nbinsx];      </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
for (i=0;i&lt;nbinsx;i++)</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>                                                source[i]=new
float[nbinsy];</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
for (i=0;i&lt;nbinsx;i++)</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>                                                dest[i]=new
float[nbinsy];   </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
TH2F *search = new TH2F(&quot;search&quot;,&quot;High resolution peak
searching&quot;,nbinsx,xmin,xmax,nbinsy,ymin,ymax);</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
TFile *f = new TFile(&quot;TSpectrum2.root&quot;);</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
search=(TH2F*) f-&gt;Get(&quot;fit1;1&quot;);</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
TCanvas *Searching = new TCanvas(&quot;Searching&quot;,&quot;Two-dimensional
fitting using Algorithm Without Matrix Inversion&quot;,10,10,1000,700);</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
TSpectrum2 *s = new TSpectrum2(1000,1);</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
for (i = 0; i &lt; nbinsx; i++){</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>    
for (j = 0; j &lt; nbinsy; j++){</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
                 source[i][j] = search-&gt;GetBinContent(i + 1,j + 1); </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
              }</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
}   </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
nfound = s-&gt;SearchHighRes(source, dest, nbinsx, nbinsy, 2, 2, kTRUE, 100,
kFALSE, 3);   </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
printf(&quot;Found %d candidate peaks\n&quot;,nfound);</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Bool_t *FixPosX = new Bool_t[nfound];</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Bool_t *FixPosY = new Bool_t[nfound];   </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Bool_t *FixAmp = new Bool_t[nfound];      </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Double_t *PosX = new Double_t[nfound];         </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Double_t *PosY = new Double_t[nfound];</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Double_t *Amp = new Double_t[nfound];      </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
Double_t *AmpXY = new Double_t[nfound];         </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
PosX = s-&gt;GetPositionX();</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
PosY = s-&gt;GetPositionY();      </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
for(i = 0; i&lt; nfound ; i++){</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>     
FixPosX[i] = kFALSE;</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>     
FixPosY[i] = kFALSE;      </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>     
FixAmp[i] = kFALSE;    </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>     
Amp[i] = source[(Int_t)(PosX[i]+0.5)][(Int_t)(PosY[i]+0.5)];      //initial values
of peaks amplitudes, input parameters          </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>     
AmpXY[i] = 0;</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
}</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
//filling in the initial estimates of the input parameters</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
TSpectrumFit2 *pfit=new TSpectrumFit2(nfound);</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
pfit-&gt;SetFitParameters(xmin, xmax-1, ymin, ymax-1, 1000, 0.1,
pfit-&gt;kFitOptimChiCounts, pfit-&gt;kFitAlphaHalving, pfit-&gt;kFitPower2,
pfit-&gt;kFitTaylorOrderFirst);   </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
pfit-&gt;SetPeakParameters(2, kFALSE, 2, kFALSE, 0, kTRUE, PosX, (Bool_t *)
FixPosX, PosY, (Bool_t *) FixPosY, PosX, (Bool_t *) FixPosX, PosY, (Bool_t *)
FixPosY, Amp, (Bool_t *) FixAmp, AmpXY, (Bool_t *) FixAmp, AmpXY, (Bool_t *)
FixAmp);      </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
pfit-&gt;SetBackgroundParameters(0, kFALSE, 0, kTRUE, 0, kTRUE);   </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
pfit-&gt;FitAwmi(source);</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
for (i = 0; i &lt; nbinsx; i++){</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>    
for (j = 0; j &lt; nbinsy; j++){</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>    
             search-&gt;SetBinContent(i + 1, j + 1,source[i][j]);</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
              }</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
}   </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>  
search-&gt;Draw(&quot;SURF&quot;);   </span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>}</span></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:10.0pt'>&nbsp;</span></p>

</div>

<!-- */
// --> End_Html

   Int_t i, i1, i2, j, k, shift =
       7 * fNPeaks + 14, peak_vel, size, iter, pw,
       regul_cycle, flag;
   Double_t a, b, c, d = 0, alpha, chi_opt, yw, ywm, f, chi2, chi_min, chi =
       0, pi, pmin = 0, chi_cel = 0, chi_er;
   Double_t *working_space = new Double_t[5 * (7 * fNPeaks + 14)];
   for (i = 0, j = 0; i < fNPeaks; i++) {
      working_space[7 * i] = fAmpInit[i]; //vector parameter
      if (fFixAmp[i] == false) {
         working_space[shift + j] = fAmpInit[i]; //vector xk
         j += 1;
      }
      working_space[7 * i + 1] = fPositionInitX[i]; //vector parameter
      if (fFixPositionX[i] == false) {
         working_space[shift + j] = fPositionInitX[i]; //vector xk
         j += 1;
      }
      working_space[7 * i + 2] = fPositionInitY[i]; //vector parameter
      if (fFixPositionY[i] == false) {
         working_space[shift + j] = fPositionInitY[i]; //vector xk
         j += 1;
      }
      working_space[7 * i + 3] = fAmpInitX1[i]; //vector parameter
      if (fFixAmpX1[i] == false) {
         working_space[shift + j] = fAmpInitX1[i]; //vector xk
         j += 1;
      }
      working_space[7 * i + 4] = fAmpInitY1[i]; //vector parameter
      if (fFixAmpY1[i] == false) {
         working_space[shift + j] = fAmpInitY1[i]; //vector xk
         j += 1;
      }
      working_space[7 * i + 5] = fPositionInitX1[i]; //vector parameter
      if (fFixPositionX1[i] == false) {
         working_space[shift + j] = fPositionInitX1[i]; //vector xk
         j += 1;
      }
      working_space[7 * i + 6] = fPositionInitY1[i]; //vector parameter
      if (fFixPositionY1[i] == false) {
         working_space[shift + j] = fPositionInitY1[i]; //vector xk
         j += 1;
      }
   }
   peak_vel = 7 * i;
   working_space[7 * i] = fSigmaInitX; //vector parameter
   if (fFixSigmaX == false) {
      working_space[shift + j] = fSigmaInitX; //vector xk
      j += 1;
   }
   working_space[7 * i + 1] = fSigmaInitY; //vector parameter
   if (fFixSigmaY == false) {
      working_space[shift + j] = fSigmaInitY; //vector xk
      j += 1;
   }
   working_space[7 * i + 2] = fRoInit; //vector parameter
   if (fFixRo == false) {
      working_space[shift + j] = fRoInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 3] = fA0Init; //vector parameter
   if (fFixA0 == false) {
      working_space[shift + j] = fA0Init; //vector xk
      j += 1;
   }
   working_space[7 * i + 4] = fAxInit; //vector parameter
   if (fFixAx == false) {
      working_space[shift + j] = fAxInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 5] = fAyInit; //vector parameter
   if (fFixAy == false) {
      working_space[shift + j] = fAyInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 6] = fTxyInit; //vector parameter
   if (fFixTxy == false) {
      working_space[shift + j] = fTxyInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 7] = fSxyInit; //vector parameter
   if (fFixSxy == false) {
      working_space[shift + j] = fSxyInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 8] = fTxInit; //vector parameter
   if (fFixTx == false) {
      working_space[shift + j] = fTxInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 9] = fTyInit; //vector parameter
   if (fFixTy == false) {
      working_space[shift + j] = fTyInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 10] = fSxyInit; //vector parameter
   if (fFixSx == false) {
      working_space[shift + j] = fSxInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 11] = fSyInit; //vector parameter
   if (fFixSy == false) {
      working_space[shift + j] = fSyInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 12] = fBxInit; //vector parameter
   if (fFixBx == false) {
      working_space[shift + j] = fBxInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 13] = fByInit; //vector parameter
   if (fFixBy == false) {
      working_space[shift + j] = fByInit; //vector xk
      j += 1;
   }
   size = j;
   for (iter = 0; iter < fNumberIterations; iter++) {
      for (j = 0; j < size; j++) {
         working_space[2 * shift + j] = 0, working_space[3 * shift + j] = 0; //der,temp
      }

          //filling vectors
      alpha = fAlpha;
      chi_opt = 0, pw = fPower - 2;
      for (i1 = fXmin; i1 <= fXmax; i1++) {
         for (i2 = fYmin; i2 <= fYmax; i2++) {
            yw = source[i1][i2];
            ywm = yw;
            f = Shape2(fNPeaks, i1, i2,
                        working_space, working_space[peak_vel],
                        working_space[peak_vel + 1],
                        working_space[peak_vel + 2],
                        working_space[peak_vel + 3],
                        working_space[peak_vel + 4],
                        working_space[peak_vel + 5],
                        working_space[peak_vel + 6],
                        working_space[peak_vel + 7],
                        working_space[peak_vel + 8],
                        working_space[peak_vel + 9],
                        working_space[peak_vel + 10],
                        working_space[peak_vel + 11],
                        working_space[peak_vel + 12],
                        working_space[peak_vel + 13]);
            if (fStatisticType == kFitOptimMaxLikelihood) {
               if (f > 0.00001)
                  chi_opt += yw * TMath::Log(f) - f;
            }

            else {
               if (ywm != 0)
                  chi_opt += (yw - f) * (yw - f) / ywm;
            }
            if (fStatisticType == kFitOptimChiFuncValues) {
               ywm = f;
               if (f < 0.00001)
                  ywm = 0.00001;
            }

            else if (fStatisticType == kFitOptimMaxLikelihood) {
               ywm = f;
               if (f < 0.00001)
                  ywm = 0.00001;
            }

            else {
               if (ywm == 0)
                  ywm = 1;
            }

                //calculation of gradient vector
                for (j = 0, k = 0; j < fNPeaks; j++) {
               if (fFixAmp[j] == false) {
                  a = Deramp2(i1, i2,
                               working_space[7 * j + 1],
                               working_space[7 * j + 2],
                               working_space[peak_vel],
                               working_space[peak_vel + 1],
                               working_space[peak_vel + 2],
                               working_space[peak_vel + 6],
                               working_space[peak_vel + 7],
                               working_space[peak_vel + 12],
                               working_space[peak_vel + 13]);
                  if (ywm != 0) {
                     c = Ourpowl(a, pw);
                     if (fStatisticType == kFitOptimChiFuncValues) {
                        b = a * (yw * yw - f * f) / (ywm * ywm);
                        working_space[2 * shift + k] += b * c; //der
                        b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                        working_space[3 * shift + k] += b * c; //temp
                     }

                     else {
                        b = a * (yw - f) / ywm;
                        working_space[2 * shift + k] += b * c; //der
                        b = a * a / ywm;
                        working_space[3 * shift + k] += b * c; //temp
                     }
                  }
                  k += 1;
               }
               if (fFixPositionX[j] == false) {
                  a = Deri02(i1, i2,
                              working_space[7 * j],
                              working_space[7 * j + 1],
                              working_space[7 * j + 2],
                              working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
                  if (fFitTaylor == kFitTaylorOrderSecond)
                     d = Derderi02(i1, i2,
                                    working_space[7 * j],
                                    working_space[7 * j + 1],
                                    working_space[7 * j + 2],
                                    working_space[peak_vel],
                                    working_space[peak_vel + 1],
                                    working_space[peak_vel + 2]);
                  if (ywm != 0) {
                     c = Ourpowl(a, pw);
                     if (TMath::Abs(a) > 0.00000001
                          && fFitTaylor == kFitTaylorOrderSecond) {
                        d = d * TMath::Abs(yw - f) / (2 * a * ywm);
                        if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0
                             && a <= 0))
                           d = 0;
                     }

                     else
                        d = 0;
                     a = a + d;
                     if (fStatisticType == kFitOptimChiFuncValues) {
                        b = a * (yw * yw - f * f) / (ywm * ywm);
                        working_space[2 * shift + k] += b * c; //der
                        b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                        working_space[3 * shift + k] += b * c; //temp
                     }

                     else {
                        b = a * (yw - f) / ywm;
                        working_space[2 * shift + k] += b * c; //der
                        b = a * a / ywm;
                        working_space[3 * shift + k] += b * c; //temp
                     }
                  }
                  k += 1;
               }
               if (fFixPositionY[j] == false) {
                  a = Derj02(i1, i2,
                              working_space[7 * j],
                              working_space[7 * j + 1],
                              working_space[7 * j + 2],
                              working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
                  if (fFitTaylor == kFitTaylorOrderSecond)
                     d = Derderj02(i1, i2,
                                    working_space[7 * j],
                                    working_space[7 * j + 1],
                                    working_space[7 * j + 2],
                                    working_space[peak_vel],
                                    working_space[peak_vel + 1],
                                    working_space[peak_vel + 2]);
                  if (ywm != 0) {
                     c = Ourpowl(a, pw);
                     if (TMath::Abs(a) > 0.00000001
                          && fFitTaylor == kFitTaylorOrderSecond) {
                        d = d * TMath::Abs(yw - f) / (2 * a * ywm);
                        if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0
                             && a <= 0))
                           d = 0;
                     }

                     else
                        d = 0;
                     a = a + d;
                     if (fStatisticType == kFitOptimChiFuncValues) {
                        b = a * (yw * yw - f * f) / (ywm * ywm);
                        working_space[2 * shift + k] += b * c; //der
                        b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                        working_space[3 * shift + k] += b * c; //temp
                     }

                     else {
                        b = a * (yw - f) / ywm;
                        working_space[2 * shift + k] += b * c; //der
                        b = a * a / ywm;
                        working_space[3 * shift + k] += b * c; //temp
                     }
                  }
                  k += 1;
               }
               if (fFixAmpX1[j] == false) {
                  a = Derampx(i1, working_space[7 * j + 5],
                               working_space[peak_vel],
                               working_space[peak_vel + 8],
                               working_space[peak_vel + 10],
                               working_space[peak_vel + 12]);
                  if (ywm != 0) {
                     c = Ourpowl(a, pw);
                     if (fStatisticType == kFitOptimChiFuncValues) {
                        b = a * (yw * yw - f * f) / (ywm * ywm);
                        working_space[2 * shift + k] += b * c; //der
                        b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                        working_space[3 * shift + k] += b * c; //temp
                     }

                     else {
                        b = a * (yw - f) / ywm;
                        working_space[2 * shift + k] += b * c; //der
                        b = a * a / ywm;
                        working_space[3 * shift + k] += b * c; //temp
                     }
                  }
                  k += 1;
               }
               if (fFixAmpY1[j] == false) {
                  a = Derampx(i2, working_space[7 * j + 6],
                               working_space[peak_vel + 1],
                               working_space[peak_vel + 9],
                               working_space[peak_vel + 11],
                               working_space[peak_vel + 13]);
                  if (ywm != 0) {
                     c = Ourpowl(a, pw);
                     if (fStatisticType == kFitOptimChiFuncValues) {
                        b = a * (yw * yw - f * f) / (ywm * ywm);
                        working_space[2 * shift + k] += b * c; //der
                        b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                        working_space[3 * shift + k] += b * c; //temp
                     }

                     else {
                        b = a * (yw - f) / ywm;
                        working_space[2 * shift + k] += b * c; //der
                        b = a * a / ywm;
                        working_space[3 * shift + k] += b * c; //temp
                     }
                  }
                  k += 1;
               }
               if (fFixPositionX1[j] == false) {
                  a = Deri01(i1, working_space[7 * j + 3],
                              working_space[7 * j + 5],
                              working_space[peak_vel],
                              working_space[peak_vel + 8],
                              working_space[peak_vel + 10],
                              working_space[peak_vel + 12]);
                  if (fFitTaylor == kFitTaylorOrderSecond)
                     d = Derderi01(i1, working_space[7 * j + 3],
                                    working_space[7 * j + 5],
                                    working_space[peak_vel]);
                  if (ywm != 0) {
                     c = Ourpowl(a, pw);
                     if (TMath::Abs(a) > 0.00000001
                          && fFitTaylor == kFitTaylorOrderSecond) {
                        d = d * TMath::Abs(yw - f) / (2 * a * ywm);
                        if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0
                             && a <= 0))
                           d = 0;
                     }

                     else
                        d = 0;
                     a = a + d;
                     if (fStatisticType == kFitOptimChiFuncValues) {
                        b = a * (yw * yw - f * f) / (ywm * ywm);
                        working_space[2 * shift + k] += b * c; //Der
                        b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                        working_space[3 * shift + k] += b * c; //temp
                     }

                     else {
                        b = a * (yw - f) / ywm;
                        working_space[2 * shift + k] += b * c; //Der
                        b = a * a / ywm;
                        working_space[3 * shift + k] += b * c; //temp
                     }
                  }
                  k += 1;
               }
               if (fFixPositionY1[j] == false) {
                  a = Deri01(i2, working_space[7 * j + 4],
                              working_space[7 * j + 6],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 9],
                              working_space[peak_vel + 11],
                              working_space[peak_vel + 13]);
                  if (fFitTaylor == kFitTaylorOrderSecond)
                     d = Derderi01(i2, working_space[7 * j + 4],
                                    working_space[7 * j + 6],
                                    working_space[peak_vel + 1]);
                  if (ywm != 0) {
                     c = Ourpowl(a, pw);
                     if (TMath::Abs(a) > 0.00000001
                          && fFitTaylor == kFitTaylorOrderSecond) {
                        d = d * TMath::Abs(yw - f) / (2 * a * ywm);
                        if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0
                             && a <= 0))
                           d = 0;
                     }

                     else
                        d = 0;
                     a = a + d;
                     if (fStatisticType == kFitOptimChiFuncValues) {
                        b = a * (yw * yw - f * f) / (ywm * ywm);
                        working_space[2 * shift + k] += b * c; //der
                        b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                        working_space[3 * shift + k] += b * c; //temp
                     }

                     else {
                        b = a * (yw - f) / ywm;
                        working_space[2 * shift + k] += b * c; //der
                        b = a * a / ywm;
                        working_space[3 * shift + k] += b * c; //temp
                     }
                  }
                  k += 1;
               }
            }
            if (fFixSigmaX == false) {
               a = Dersigmax(fNPeaks, i1, i2,
                              working_space, working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 8],
                              working_space[peak_vel + 10],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
               if (fFitTaylor == kFitTaylorOrderSecond)
                  d = Derdersigmax(fNPeaks, i1,
                                    i2, working_space,
                                    working_space[peak_vel],
                                    working_space[peak_vel + 1],
                                    working_space[peak_vel + 2]);
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (TMath::Abs(a) > 0.00000001
                       && fFitTaylor == kFitTaylorOrderSecond) {
                     d = d * TMath::Abs(yw - f) / (2 * a * ywm);
                     if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0 && a <= 0))
                        d = 0;
                  }

                  else
                     d = 0;
                  a = a + d;
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixSigmaY == false) {
               a = Dersigmay(fNPeaks, i1, i2,
                              working_space, working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 9],
                              working_space[peak_vel + 11],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
               if (fFitTaylor == kFitTaylorOrderSecond)
                  d = Derdersigmay(fNPeaks, i1,
                                    i2, working_space,
                                    working_space[peak_vel],
                                    working_space[peak_vel + 1],
                                    working_space[peak_vel + 2]);
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (TMath::Abs(a) > 0.00000001
                       && fFitTaylor == kFitTaylorOrderSecond) {
                     d = d * TMath::Abs(yw - f) / (2 * a * ywm);
                     if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0 && a <= 0))
                        d = 0;
                  }

                  else
                     d = 0;
                  a = a + d;
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixRo == false) {
               a = Derro(fNPeaks, i1, i2,
                          working_space, working_space[peak_vel],
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 2]);
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (TMath::Abs(a) > 0.00000001
                       && fFitTaylor == kFitTaylorOrderSecond) {
                     d = d * TMath::Abs(yw - f) / (2 * a * ywm);
                     if (((a + d) <= 0 && a >= 0) || ((a + d) >= 0 && a <= 0))
                        d = 0;
                  }

                  else
                     d = 0;
                  a = a + d;
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixA0 == false) {
               a = 1.;
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixAx == false) {
               a = i1;
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixAy == false) {
               a = i2;
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixTxy == false) {
               a = Dertxy(fNPeaks, i1, i2,
                           working_space, working_space[peak_vel],
                           working_space[peak_vel + 1],
                           working_space[peak_vel + 12],
                           working_space[peak_vel + 13]);
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixSxy == false) {
               a = Dersxy(fNPeaks, i1, i2,
                           working_space, working_space[peak_vel],
                           working_space[peak_vel + 1]);
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixTx == false) {
               a = Dertx(fNPeaks, i1, working_space,
                          working_space[peak_vel],
                          working_space[peak_vel + 12]);
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixTy == false) {
               a = Derty(fNPeaks, i2, working_space,
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 13]);
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixSx == false) {
               a = Dersx(fNPeaks, i1, working_space,
                          working_space[peak_vel]);
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixSy == false) {
               a = Dersy(fNPeaks, i2, working_space,
                          working_space[peak_vel + 1]);
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixBx == false) {
               a = Derbx(fNPeaks, i1, i2,
                          working_space, working_space[peak_vel],
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 6],
                          working_space[peak_vel + 8],
                          working_space[peak_vel + 12],
                          working_space[peak_vel + 13]);
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
            if (fFixBy == false) {
               a = Derby(fNPeaks, i1, i2,
                          working_space, working_space[peak_vel],
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 6],
                          working_space[peak_vel + 8],
                          working_space[peak_vel + 12],
                          working_space[peak_vel + 13]);
               if (ywm != 0) {
                  c = Ourpowl(a, pw);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     b = a * (yw * yw - f * f) / (ywm * ywm);
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a * (4 * yw - 2 * f) / (ywm * ywm);
                     working_space[3 * shift + k] += b * c; //temp
                  }

                  else {
                     b = a * (yw - f) / ywm;
                     working_space[2 * shift + k] += b * c; //der
                     b = a * a / ywm;
                     working_space[3 * shift + k] += b * c; //temp
                  }
               }
               k += 1;
            }
         }
      }
      for (j = 0; j < size; j++) {
         if (TMath::Abs(working_space[3 * shift + j]) > 0.000001)
            working_space[2 * shift + j] = working_space[2 * shift + j] / TMath::Abs(working_space[3 * shift + j]); //der[j]=der[j]/temp[j]
         else
            working_space[2 * shift + j] = 0; //der[j]
      }

      //calculate chi_opt
      chi2 = chi_opt;
      chi_opt = TMath::Sqrt(TMath::Abs(chi_opt));

      //calculate new parameters
      regul_cycle = 0;
      for (j = 0; j < size; j++) {
         working_space[4 * shift + j] = working_space[shift + j]; //temp_xk[j]=xk[j]
      }

      do {
         if (fAlphaOptim == kFitAlphaOptimal) {
            if (fStatisticType != kFitOptimMaxLikelihood)
               chi_min = 10000 * chi2;

            else
               chi_min = 0.1 * chi2;
            flag = 0;
            for (pi = 0.1; flag == 0 && pi <= 100; pi += 0.1) {
               for (j = 0; j < size; j++) {
                  working_space[shift + j] = working_space[4 * shift + j] + pi * alpha * working_space[2 * shift + j]; //xk[j]=temp_xk[j]+pi*alpha*der[j]
               }
               for (i = 0, j = 0; i < fNPeaks; i++) {
                  if (fFixAmp[i] == false) {
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = 0; //xk[j]
                     working_space[7 * i] = working_space[shift + j]; //parameter[7*i]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionX[i] == false) {
                     if (working_space[shift + j] < fXmin) //xk[j]
                        working_space[shift + j] = fXmin; //xk[j]
                     if (working_space[shift + j] > fXmax) //xk[j]
                        working_space[shift + j] = fXmax; //xk[j]
                     working_space[7 * i + 1] = working_space[shift + j]; //parameter[7*i+1]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionY[i] == false) {
                     if (working_space[shift + j] < fYmin) //xk[j]
                        working_space[shift + j] = fYmin; //xk[j]
                     if (working_space[shift + j] > fYmax) //xk[j]
                        working_space[shift + j] = fYmax; //xk[j]
                     working_space[7 * i + 2] = working_space[shift + j]; //parameter[7*i+2]=xk[j]
                     j += 1;
                  }
                  if (fFixAmpX1[i] == false) {
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = 0; //xk[j]
                     working_space[7 * i + 3] = working_space[shift + j]; //parameter[7*i+3]=xk[j]
                     j += 1;
                  }
                  if (fFixAmpY1[i] == false) {
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = 0; //xk[j]
                     working_space[7 * i + 4] = working_space[shift + j]; //parameter[7*i+4]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionX1[i] == false) {
                     if (working_space[shift + j] < fXmin) //xk[j]
                        working_space[shift + j] = fXmin; //xk[j]
                     if (working_space[shift + j] > fXmax) //xk[j]
                        working_space[shift + j] = fXmax; //xk[j]
                     working_space[7 * i + 5] = working_space[shift + j]; //parameter[7*i+5]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionY1[i] == false) {
                     if (working_space[shift + j] < fYmin) //xk[j]
                        working_space[shift + j] = fYmin; //xk[j]
                     if (working_space[shift + j] > fYmax) //xk[j]
                        working_space[shift + j] = fYmax; //xk[j]
                     working_space[7 * i + 6] = working_space[shift + j]; //parameter[7*i+6]=xk[j]
                     j += 1;
                  }
               }
               if (fFixSigmaX == false) {
                  if (working_space[shift + j] < 0.001) { //xk[j]
                     working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel] = working_space[shift + j]; //parameter[peak_vel]=xk[j]
                  j += 1;
               }
               if (fFixSigmaY == false) {
                  if (working_space[shift + j] < 0.001) { //xk[j]
                     working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel + 1] = working_space[shift + j]; //parameter[peak_vel+1]=xk[j]
                  j += 1;
               }
               if (fFixRo == false) {
                  if (working_space[shift + j] < -1) { //xk[j]
                     working_space[shift + j] = -1; //xk[j]
                  }
                  if (working_space[shift + j] > 1) { //xk[j]
                     working_space[shift + j] = 1; //xk[j]
                  }
                  working_space[peak_vel + 2] = working_space[shift + j]; //parameter[peak_vel+2]=xk[j]
                  j += 1;
               }
               if (fFixA0 == false) {
                  working_space[peak_vel + 3] = working_space[shift + j]; //parameter[peak_vel+3]=xk[j]
                  j += 1;
               }
               if (fFixAx == false) {
                  working_space[peak_vel + 4] = working_space[shift + j]; //parameter[peak_vel+4]=xk[j]
                  j += 1;
               }
               if (fFixAy == false) {
                  working_space[peak_vel + 5] = working_space[shift + j]; //parameter[peak_vel+5]=xk[j]
                  j += 1;
               }
               if (fFixTxy == false) {
                  working_space[peak_vel + 6] = working_space[shift + j]; //parameter[peak_vel+6]=xk[j]
                  j += 1;
               }
               if (fFixSxy == false) {
                  working_space[peak_vel + 7] = working_space[shift + j]; //parameter[peak_vel+7]=xk[j]
                  j += 1;
               }
               if (fFixTx == false) {
                  working_space[peak_vel + 8] = working_space[shift + j]; //parameter[peak_vel+8]=xk[j]
                  j += 1;
               }
               if (fFixTy == false) {
                  working_space[peak_vel + 9] = working_space[shift + j]; //parameter[peak_vel+9]=xk[j]
                  j += 1;
               }
               if (fFixSx == false) {
                  working_space[peak_vel + 10] = working_space[shift + j]; //parameter[peak_vel+10]=xk[j]
                  j += 1;
               }
               if (fFixSy == false) {
                  working_space[peak_vel + 11] = working_space[shift + j]; //parameter[peak_vel+11]=xk[j]
                  j += 1;
               }
               if (fFixBx == false) {
                  if (TMath::Abs(working_space[shift + j]) < 0.001) { //xk[j]
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = -0.001; //xk[j]
                     else
                        working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel + 12] = working_space[shift + j]; //parameter[peak_vel+12]=xk[j]
                  j += 1;
               }
               if (fFixBy == false) {
                  if (TMath::Abs(working_space[shift + j]) < 0.001) { //xk[j]
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = -0.001; //xk[j]
                     else
                        working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel + 13] = working_space[shift + j]; //parameter[peak_vel+13]=xk[j]
                  j += 1;
               }
               chi2 = 0;
               for (i1 = fXmin; i1 <= fXmax; i1++) {
                  for (i2 = fYmin; i2 <= fYmax; i2++) {
                     yw = source[i1][i2];
                     ywm = yw;
                     f = Shape2(fNPeaks, i1,
                                 i2, working_space,
                                 working_space[peak_vel],
                                 working_space[peak_vel + 1],
                                 working_space[peak_vel + 2],
                                 working_space[peak_vel + 3],
                                 working_space[peak_vel + 4],
                                 working_space[peak_vel + 5],
                                 working_space[peak_vel + 6],
                                 working_space[peak_vel + 7],
                                 working_space[peak_vel + 8],
                                 working_space[peak_vel + 9],
                                 working_space[peak_vel + 10],
                                 working_space[peak_vel + 11],
                                 working_space[peak_vel + 12],
                                 working_space[peak_vel + 13]);
                     if (fStatisticType == kFitOptimChiFuncValues) {
                        ywm = f;
                        if (f < 0.00001)
                           ywm = 0.00001;
                     }
                     if (fStatisticType == kFitOptimMaxLikelihood) {
                        if (f > 0.00001)
                           chi2 += yw * TMath::Log(f) - f;
                     }

                     else {
                        if (ywm != 0)
                           chi2 += (yw - f) * (yw - f) / ywm;
                     }
                  }
               }
               if ((chi2 < chi_min
                    && fStatisticType != kFitOptimMaxLikelihood)
                    || (chi2 > chi_min
                    && fStatisticType == kFitOptimMaxLikelihood)) {
                  pmin = pi, chi_min = chi2;
               }

               else
                  flag = 1;
               if (pi == 0.1)
                  chi_min = chi2;
               chi = chi_min;
            }
            if (pmin != 0.1) {
               for (j = 0; j < size; j++) {
                  working_space[shift + j] = working_space[4 * shift + j] + pmin * alpha * working_space[2 * shift + j]; //xk[j]=temp_xk[j]+pmin*alpha*der[j]
               }
               for (i = 0, j = 0; i < fNPeaks; i++) {
                  if (fFixAmp[i] == false) {
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = 0; //xk[j]
                     working_space[7 * i] = working_space[shift + j]; //parameter[7*i]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionX[i] == false) {
                     if (working_space[shift + j] < fXmin) //xk[j]
                        working_space[shift + j] = fXmin; //xk[j]
                     if (working_space[shift + j] > fXmax) //xk[j]
                        working_space[shift + j] = fXmax; //xk[j]
                     working_space[7 * i + 1] = working_space[shift + j]; //parameter[7*i+1]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionY[i] == false) {
                     if (working_space[shift + j] < fYmin) //xk[j]
                        working_space[shift + j] = fYmin; //xk[j]
                     if (working_space[shift + j] > fYmax) //xk[j]
                        working_space[shift + j] = fYmax; //xk[j]
                     working_space[7 * i + 2] = working_space[shift + j]; //parameter[7*i+2]=xk[j]
                     j += 1;
                  }
                  if (fFixAmpX1[i] == false) {
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = 0; //xk[j]
                     working_space[7 * i + 3] = working_space[shift + j]; //parameter[7*i+3]=xk[j]
                     j += 1;
                  }
                  if (fFixAmpY1[i] == false) {
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = 0; //xk[j]
                     working_space[7 * i + 4] = working_space[shift + j]; //parameter[7*i+4]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionX1[i] == false) {
                     if (working_space[shift + j] < fXmin) //xk[j]
                        working_space[shift + j] = fXmin; //xk[j]
                     if (working_space[shift + j] > fXmax) //xk[j]
                        working_space[shift + j] = fXmax; //xk[j]
                     working_space[7 * i + 5] = working_space[shift + j]; //parameter[7*i+5]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionY1[i] == false) {
                     if (working_space[shift + j] < fYmin) //xk[j]
                        working_space[shift + j] = fYmin; //xk[j]
                     if (working_space[shift + j] > fYmax) //xk[j]
                        working_space[shift + j] = fYmax; //xk[j]
                     working_space[7 * i + 6] = working_space[shift + j]; //parameter[7*i+6]=xk[j]
                     j += 1;
                  }
               }
               if (fFixSigmaX == false) {
                  if (working_space[shift + j] < 0.001) { //xk[j]
                     working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel] = working_space[shift + j]; //parameter[peak_vel]=xk[j]
                  j += 1;
               }
               if (fFixSigmaY == false) {
                  if (working_space[shift + j] < 0.001) { //xk[j]
                     working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel + 1] = working_space[shift + j]; //parameter[peak_vel+1]=xk[j]
                  j += 1;
               }
               if (fFixRo == false) {
                  if (working_space[shift + j] < -1) { //xk[j]
                     working_space[shift + j] = -1; //xk[j]
                  }
                  if (working_space[shift + j] > 1) { //xk[j]
                     working_space[shift + j] = 1; //xk[j]
                  }
                  working_space[peak_vel + 2] = working_space[shift + j]; //parameter[peak_vel+2]=xk[j]
                  j += 1;
               }
               if (fFixA0 == false) {
                  working_space[peak_vel + 3] = working_space[shift + j]; //parameter[peak_vel+3]=xk[j]
                  j += 1;
               }
               if (fFixAx == false) {
                  working_space[peak_vel + 4] = working_space[shift + j]; //parameter[peak_vel+4]=xk[j]
                  j += 1;
               }
               if (fFixAy == false) {
                  working_space[peak_vel + 5] = working_space[shift + j]; //parameter[peak_vel+5]=xk[j]
                  j += 1;
               }
               if (fFixTxy == false) {
                  working_space[peak_vel + 6] = working_space[shift + j]; //parameter[peak_vel+6]=xk[j]
                  j += 1;
               }
               if (fFixSxy == false) {
                  working_space[peak_vel + 7] = working_space[shift + j]; //parameter[peak_vel+7]=xk[j]
                  j += 1;
               }
               if (fFixTx == false) {
                  working_space[peak_vel + 8] = working_space[shift + j]; //parameter[peak_vel+8]=xk[j]
                  j += 1;
               }
               if (fFixTy == false) {
                  working_space[peak_vel + 9] = working_space[shift + j]; //parameter[peak_vel+9]=xk[j]
                  j += 1;
               }
               if (fFixSx == false) {
                  working_space[peak_vel + 10] = working_space[shift + j]; //parameter[peak_vel+10]=xk[j]
                  j += 1;
               }
               if (fFixSy == false) {
                  working_space[peak_vel + 11] = working_space[shift + j]; //parameter[peak_vel+11]=xk[j]
                  j += 1;
               }
               if (fFixBx == false) {
                  if (TMath::Abs(working_space[shift + j]) < 0.001) { //xk[j]
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = -0.001; //xk[j]
                     else
                        working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel + 12] = working_space[shift + j]; //parameter[peak_vel+12]=xk[j]
                  j += 1;
               }
               if (fFixBy == false) {
                  if (TMath::Abs(working_space[shift + j]) < 0.001) { //xk[j]
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = -0.001; //xk[j]
                     else
                        working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel + 13] = working_space[shift + j]; //parameter[peak_vel+13]=xk[j]
                  j += 1;
               }
               chi = chi_min;
            }
         }

         else {
            for (j = 0; j < size; j++) {
               working_space[shift + j] = working_space[4 * shift + j] + alpha * working_space[2 * shift + j]; //xk[j]=temp_xk[j]+pi*alpha*der[j]
            }
            for (i = 0, j = 0; i < fNPeaks; i++) {
               if (fFixAmp[i] == false) {
                  if (working_space[shift + j] < 0) //xk[j]
                     working_space[shift + j] = 0; //xk[j]
                  working_space[7 * i] = working_space[shift + j]; //parameter[7*i]=xk[j]
                  j += 1;
               }
               if (fFixPositionX[i] == false) {
                  if (working_space[shift + j] < fXmin) //xk[j]
                     working_space[shift + j] = fXmin; //xk[j]
                  if (working_space[shift + j] > fXmax) //xk[j]
                     working_space[shift + j] = fXmax; //xk[j]
                  working_space[7 * i + 1] = working_space[shift + j]; //parameter[7*i+1]=xk[j]
                  j += 1;
               }
               if (fFixPositionY[i] == false) {
                  if (working_space[shift + j] < fYmin) //xk[j]
                     working_space[shift + j] = fYmin; //xk[j]
                  if (working_space[shift + j] > fYmax) //xk[j]
                     working_space[shift + j] = fYmax; //xk[j]
                  working_space[7 * i + 2] = working_space[shift + j]; //parameter[7*i+2]=xk[j]
                  j += 1;
               }
               if (fFixAmpX1[i] == false) {
                  if (working_space[shift + j] < 0) //xk[j]
                     working_space[shift + j] = 0; //xk[j]
                  working_space[7 * i + 3] = working_space[shift + j]; //parameter[7*i+3]=xk[j]
                  j += 1;
               }
               if (fFixAmpY1[i] == false) {
                  if (working_space[shift + j] < 0) //xk[j]
                     working_space[shift + j] = 0; //xk[j]
                  working_space[7 * i + 4] = working_space[shift + j]; //parameter[7*i+4]=xk[j]
                  j += 1;
               }
               if (fFixPositionX1[i] == false) {
                  if (working_space[shift + j] < fXmin) //xk[j]
                     working_space[shift + j] = fXmin; //xk[j]
                  if (working_space[shift + j] > fXmax) //xk[j]
                     working_space[shift + j] = fXmax; //xk[j]
                  working_space[7 * i + 5] = working_space[shift + j]; //parameter[7*i+5]=xk[j]
                  j += 1;
               }
               if (fFixPositionY1[i] == false) {
                  if (working_space[shift + j] < fYmin) //xk[j]
                     working_space[shift + j] = fYmin; //xk[j]
                  if (working_space[shift + j] > fYmax) //xk[j]
                     working_space[shift + j] = fYmax; //xk[j]
                  working_space[7 * i + 6] = working_space[shift + j]; //parameter[7*i+6]=xk[j]
                  j += 1;
               }
            }
            if (fFixSigmaX == false) {
               if (working_space[shift + j] < 0.001) { //xk[j]
                  working_space[shift + j] = 0.001; //xk[j]
               }
               working_space[peak_vel] = working_space[shift + j]; //parameter[peak_vel]=xk[j]
               j += 1;
            }
            if (fFixSigmaY == false) {
               if (working_space[shift + j] < 0.001) { //xk[j]
                  working_space[shift + j] = 0.001; //xk[j]
               }
               working_space[peak_vel + 1] = working_space[shift + j]; //parameter[peak_vel+1]=xk[j]
               j += 1;
            }
            if (fFixRo == false) {
               if (working_space[shift + j] < -1) { //xk[j]
                  working_space[shift + j] = -1; //xk[j]
               }
               if (working_space[shift + j] > 1) { //xk[j]
                  working_space[shift + j] = 1; //xk[j]
               }
               working_space[peak_vel + 2] = working_space[shift + j]; //parameter[peak_vel+2]=xk[j]
               j += 1;
            }
            if (fFixA0 == false) {
               working_space[peak_vel + 3] = working_space[shift + j]; //parameter[peak_vel+3]=xk[j]
               j += 1;
            }
            if (fFixAx == false) {
               working_space[peak_vel + 4] = working_space[shift + j]; //parameter[peak_vel+4]=xk[j]
               j += 1;
            }
            if (fFixAy == false) {
               working_space[peak_vel + 5] = working_space[shift + j]; //parameter[peak_vel+5]=xk[j]
               j += 1;
            }
            if (fFixTxy == false) {
               working_space[peak_vel + 6] = working_space[shift + j]; //parameter[peak_vel+6]=xk[j]
               j += 1;
            }
            if (fFixSxy == false) {
               working_space[peak_vel + 7] = working_space[shift + j]; //parameter[peak_vel+7]=xk[j]
               j += 1;
            }
            if (fFixTx == false) {
               working_space[peak_vel + 8] = working_space[shift + j]; //parameter[peak_vel+8]=xk[j]
               j += 1;
            }
            if (fFixTy == false) {
               working_space[peak_vel + 9] = working_space[shift + j]; //parameter[peak_vel+9]=xk[j]
               j += 1;
            }
            if (fFixSx == false) {
               working_space[peak_vel + 10] = working_space[shift + j]; //parameter[peak_vel+10]=xk[j]
               j += 1;
            }
            if (fFixSy == false) {
               working_space[peak_vel + 11] = working_space[shift + j]; //parameter[peak_vel+11]=xk[j]
               j += 1;
            }
            if (fFixBx == false) {
               if (TMath::Abs(working_space[shift + j]) < 0.001) { //xk[j]
                  if (working_space[shift + j] < 0) //xk[j]
                     working_space[shift + j] = -0.001; //xk[j]
                  else
                     working_space[shift + j] = 0.001; //xk[j]
               }
               working_space[peak_vel + 12] = working_space[shift + j]; //parameter[peak_vel+12]=xk[j]
               j += 1;
            }
            if (fFixBy == false) {
               if (TMath::Abs(working_space[shift + j]) < 0.001) { //xk[j]
                  if (working_space[shift + j] < 0) //xk[j]
                     working_space[shift + j] = -0.001; //xk[j]
                  else
                     working_space[shift + j] = 0.001; //xk[j]
               }
               working_space[peak_vel + 13] = working_space[shift + j]; //parameter[peak_vel+13]=xk[j]
               j += 1;
            }
            chi = 0;
            for (i1 = fXmin; i1 <= fXmax; i1++) {
               for (i2 = fYmin; i2 <= fYmax; i2++) {
                  yw = source[i1][i2];
                  ywm = yw;
                  f = Shape2(fNPeaks, i1, i2,
                              working_space, working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 3],
                              working_space[peak_vel + 4],
                              working_space[peak_vel + 5],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 8],
                              working_space[peak_vel + 9],
                              working_space[peak_vel + 10],
                              working_space[peak_vel + 11],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     ywm = f;
                     if (f < 0.00001)
                        ywm = 0.00001;
                  }
                  if (fStatisticType == kFitOptimMaxLikelihood) {
                     if (f > 0.00001)
                        chi += yw * TMath::Log(f) - f;
                  }

                  else {
                     if (ywm != 0)
                        chi += (yw - f) * (yw - f) / ywm;
                  }
               }
            }
         }
         chi2 = chi;
         chi = TMath::Sqrt(TMath::Abs(chi));
         if (fAlphaOptim == kFitAlphaHalving && chi > 1E-6)
            alpha = alpha * chi_opt / (2 * chi);

         else if (fAlphaOptim == kFitAlphaOptimal)
            alpha = alpha / 10.0;
         iter += 1;
         regul_cycle += 1;
      } while (((chi > chi_opt
                 && fStatisticType != kFitOptimMaxLikelihood)
                 || (chi < chi_opt
                 && fStatisticType == kFitOptimMaxLikelihood))
                && regul_cycle < kFitNumRegulCycles);
      for (j = 0; j < size; j++) {
         working_space[4 * shift + j] = 0; //temp_xk[j]
         working_space[2 * shift + j] = 0; //der[j]
      }
      for (i1 = fXmin, chi_cel = 0; i1 <= fXmax; i1++) {
         for (i2 = fYmin; i2 <= fYmax; i2++) {
            yw = source[i1][i2];
            if (yw == 0)
               yw = 1;
            f = Shape2(fNPeaks, i1, i2,
                        working_space, working_space[peak_vel],
                        working_space[peak_vel + 1],
                        working_space[peak_vel + 2],
                        working_space[peak_vel + 3],
                        working_space[peak_vel + 4],
                        working_space[peak_vel + 5],
                        working_space[peak_vel + 6],
                        working_space[peak_vel + 7],
                        working_space[peak_vel + 8],
                        working_space[peak_vel + 9],
                        working_space[peak_vel + 10],
                        working_space[peak_vel + 11],
                        working_space[peak_vel + 12],
                        working_space[peak_vel + 13]);
            chi_opt = (yw - f) * (yw - f) / yw;
            chi_cel += (yw - f) * (yw - f) / yw;

                //calculate gradient vector
                for (j = 0, k = 0; j < fNPeaks; j++) {
               if (fFixAmp[j] == false) {
                  a = Deramp2(i1, i2,
                               working_space[7 * j + 1],
                               working_space[7 * j + 2],
                               working_space[peak_vel],
                               working_space[peak_vel + 1],
                               working_space[peak_vel + 2],
                               working_space[peak_vel + 6],
                               working_space[peak_vel + 7],
                               working_space[peak_vel + 12],
                               working_space[peak_vel + 13]);
                  if (yw != 0) {
                     c = Ourpowl(a, pw);
                     working_space[2 * shift + k] += chi_opt * c; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b * c; //temp_xk[k]
                  }
                  k += 1;
               }
               if (fFixPositionX[j] == false) {
                  a = Deri02(i1, i2,
                              working_space[7 * j],
                              working_space[7 * j + 1],
                              working_space[7 * j + 2],
                              working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
                  if (yw != 0) {
                     c = Ourpowl(a, pw);
                     working_space[2 * shift + k] += chi_opt * c; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b * c; //temp_xk[k]
                  }
                  k += 1;
               }
               if (fFixPositionY[j] == false) {
                  a = Derj02(i1, i2,
                              working_space[7 * j],
                              working_space[7 * j + 1],
                              working_space[7 * j + 2],
                              working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
                  if (yw != 0) {
                     c = Ourpowl(a, pw);
                     working_space[2 * shift + k] += chi_opt * c; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b * c; //temp_xk[k]
                  }
                  k += 1;
               }
               if (fFixAmpX1[j] == false) {
                  a = Derampx(i1, working_space[7 * j + 5],
                               working_space[peak_vel],
                               working_space[peak_vel + 8],
                               working_space[peak_vel + 10],
                               working_space[peak_vel + 12]);
                  if (yw != 0) {
                     c = Ourpowl(a, pw);
                     working_space[2 * shift + k] += chi_opt * c; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b * c; //temp_xk[k]
                  }
                  k += 1;
               }
               if (fFixAmpY1[j] == false) {
                  a = Derampx(i2, working_space[7 * j + 6],
                               working_space[peak_vel + 1],
                               working_space[peak_vel + 9],
                               working_space[peak_vel + 11],
                               working_space[peak_vel + 13]);
                  if (yw != 0) {
                     c = Ourpowl(a, pw);
                     working_space[2 * shift + k] += chi_opt * c; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b * c; //temp_xk[k]
                  }
                  k += 1;
               }
               if (fFixPositionX1[j] == false) {
                  a = Deri01(i1, working_space[7 * j + 3],
                              working_space[7 * j + 5],
                              working_space[peak_vel],
                              working_space[peak_vel + 8],
                              working_space[peak_vel + 10],
                              working_space[peak_vel + 12]);
                  if (yw != 0) {
                     c = Ourpowl(a, pw);
                     working_space[2 * shift + k] += chi_opt * c; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b * c; //temp_xk[k]
                  }
                  k += 1;
               }
               if (fFixPositionY1[j] == false) {
                  a = Deri01(i2, working_space[7 * j + 4],
                              working_space[7 * j + 6],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 9],
                              working_space[peak_vel + 11],
                              working_space[peak_vel + 13]);
                  if (yw != 0) {
                     c = Ourpowl(a, pw);
                     working_space[2 * shift + k] += chi_opt * c; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b * c; //temp_xk[k]
                  }
                  k += 1;
               }
            }
            if (fFixSigmaX == false) {
               a = Dersigmax(fNPeaks, i1, i2,
                              working_space, working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 8],
                              working_space[peak_vel + 10],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixSigmaY == false) {
               a = Dersigmay(fNPeaks, i1, i2,
                              working_space, working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 9],
                              working_space[peak_vel + 11],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixRo == false) {
               a = Derro(fNPeaks, i1, i2,
                          working_space, working_space[peak_vel],
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 2]);
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixA0 == false) {
               a = 1.;
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixAx == false) {
               a = i1;
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixAy == false) {
               a = i2;
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixTxy == false) {
               a = Dertxy(fNPeaks, i1, i2,
                           working_space, working_space[peak_vel],
                           working_space[peak_vel + 1],
                           working_space[peak_vel + 12],
                           working_space[peak_vel + 13]);
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixSxy == false) {
               a = Dersxy(fNPeaks, i1, i2,
                           working_space, working_space[peak_vel],
                           working_space[peak_vel + 1]);
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixTx == false) {
               a = Dertx(fNPeaks, i1, working_space,
                          working_space[peak_vel],
                          working_space[peak_vel + 12]);
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixTy == false) {
               a = Derty(fNPeaks, i2, working_space,
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 13]);
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixSx == false) {
               a = Dersx(fNPeaks, i1, working_space,
                          working_space[peak_vel]);
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixSy == false) {
               a = Dersy(fNPeaks, i2, working_space,
                          working_space[peak_vel + 1]);
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixBx == false) {
               a = Derbx(fNPeaks, i1, i2,
                          working_space, working_space[peak_vel],
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 6],
                          working_space[peak_vel + 8],
                          working_space[peak_vel + 12],
                          working_space[peak_vel + 13]);
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixBy == false) {
               a = Derby(fNPeaks, i1, i2,
                          working_space, working_space[peak_vel],
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 6],
                          working_space[peak_vel + 8],
                          working_space[peak_vel + 12],
                          working_space[peak_vel + 13]);
               if (yw != 0) {
                  c = Ourpowl(a, pw);
                  working_space[2 * shift + k] += chi_opt * c; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b * c; //temp_xk[k]
               }
               k += 1;
            }
         }
      }
   }
   b = (fXmax - fXmin + 1) * (fYmax - fYmin + 1) - size;
   chi_er = chi_cel / b;
   for (i = 0, j = 0; i < fNPeaks; i++) {
      fVolume[i] =
          Volume(working_space[7 * i], working_space[peak_vel],
                 working_space[peak_vel + 1], working_space[peak_vel + 2]);
      if (fVolume[i] > 0) {
         c = 0;
         if (fFixAmp[i] == false) {
            a = Derpa2(working_space[peak_vel],
                        working_space[peak_vel + 1],
                        working_space[peak_vel + 2]);
            b = working_space[4 * shift + j]; //temp_xk[j]
            if (b == 0)
               b = 1;

            else
               b = 1 / b;
            c = c + a * a * b;
         }
         if (fFixSigmaX == false) {
            a = Derpsigmax(working_space[shift + j],
                            working_space[peak_vel + 1],
                            working_space[peak_vel + 2]);
            b = working_space[4 * shift + peak_vel]; //temp_xk[j]
            if (b == 0)
               b = 1;

            else
               b = 1 / b;
            c = c + a * a * b;
         }
         if (fFixSigmaY == false) {
            a = Derpsigmay(working_space[shift + j],
                            working_space[peak_vel],
                            working_space[peak_vel + 2]);
            b = working_space[4 * shift + peak_vel + 1]; //temp_xk[j]
            if (b == 0)
               b = 1;

            else
               b = 1 / b;
            c = c + a * a * b;
         }
         if (fFixRo == false) {
            a = Derpro(working_space[shift + j], working_space[peak_vel],
                        working_space[peak_vel + 1],
                        working_space[peak_vel + 2]);
            b = working_space[4 * shift + peak_vel + 2]; //temp_xk[j]
            if (b == 0)
               b = 1;

            else
               b = 1 / b;
            c = c + a * a * b;
         }
         fVolumeErr[i] = TMath::Sqrt(TMath::Abs(chi_er * c));
      }

      else {
         fVolumeErr[i] = 0;
      }
      if (fFixAmp[i] == false) {
         fAmpCalc[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fAmpErr[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fAmpCalc[i] = fAmpInit[i];
         fAmpErr[i] = 0;
      }
      if (fFixPositionX[i] == false) {
         fPositionCalcX[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fPositionErrX[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fPositionCalcX[i] = fPositionInitX[i];
         fPositionErrX[i] = 0;
      }
      if (fFixPositionY[i] == false) {
         fPositionCalcY[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fPositionErrY[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fPositionCalcY[i] = fPositionInitY[i];
         fPositionErrY[i] = 0;
      }
      if (fFixAmpX1[i] == false) {
         fAmpCalcX1[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fAmpErrX1[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fAmpCalcX1[i] = fAmpInitX1[i];
         fAmpErrX1[i] = 0;
      }
      if (fFixAmpY1[i] == false) {
         fAmpCalcY1[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fAmpErrY1[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fAmpCalcY1[i] = fAmpInitY1[i];
         fAmpErrY1[i] = 0;
      }
      if (fFixPositionX1[i] == false) {
         fPositionCalcX1[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fPositionErrX1[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fPositionCalcX1[i] = fPositionInitX1[i];
         fPositionErrX1[i] = 0;
      }
      if (fFixPositionY1[i] == false) {
         fPositionCalcY1[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fPositionErrY1[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fPositionCalcY1[i] = fPositionInitY1[i];
         fPositionErrY1[i] = 0;
      }
   }
   if (fFixSigmaX == false) {
      fSigmaCalcX = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fSigmaErrX = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fSigmaCalcX = fSigmaInitX;
      fSigmaErrX = 0;
   }
   if (fFixSigmaY == false) {
      fSigmaCalcY = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fSigmaErrY = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fSigmaCalcY = fSigmaInitY;
      fSigmaErrY = 0;
   }
   if (fFixRo == false) {
      fRoCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fRoErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fRoCalc = fRoInit;
      fRoErr = 0;
   }
   if (fFixA0 == false) {
      fA0Calc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fA0Err = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fA0Calc = fA0Init;
      fA0Err = 0;
   }
   if (fFixAx == false) {
      fAxCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fAxErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fAxCalc = fAxInit;
      fAxErr = 0;
   }
   if (fFixAy == false) {
      fAyCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fAyErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fAyCalc = fAyInit;
      fAyErr = 0;
   }
   if (fFixTxy == false) {
      fTxyCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fTxyErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fTxyCalc = fTxyInit;
      fTxyErr = 0;
   }
   if (fFixSxy == false) {
      fSxyCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fSxyErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fSxyCalc = fSxyInit;
      fSxyErr = 0;
   }
   if (fFixTx == false) {
      fTxCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fTxErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fTxCalc = fTxInit;
      fTxErr = 0;
   }
   if (fFixTy == false) {
      fTyCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fTyErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fTyCalc = fTyInit;
      fTyErr = 0;
   }
   if (fFixSx == false) {
      fSxCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fSxErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fSxCalc = fSxInit;
      fSxErr = 0;
   }
   if (fFixSy == false) {
      fSyCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fSyErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fSyCalc = fSyInit;
      fSyErr = 0;
   }
   if (fFixBx == false) {
      fBxCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fBxErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fBxCalc = fBxInit;
      fBxErr = 0;
   }
   if (fFixBy == false) {
      fByCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fByErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fByCalc = fByInit;
      fByErr = 0;
   }
   b = (fXmax - fXmin + 1) * (fYmax - fYmin + 1) - size;
   fChi = chi_cel / b;
   for (i1 = fXmin; i1 <= fXmax; i1++) {
      for (i2 = fYmin; i2 <= fYmax; i2++) {
         f = Shape2(fNPeaks, i1, i2,
                     working_space, working_space[peak_vel],
                     working_space[peak_vel + 1],
                     working_space[peak_vel + 2],
                     working_space[peak_vel + 3],
                     working_space[peak_vel + 4],
                     working_space[peak_vel + 5],
                     working_space[peak_vel + 6],
                     working_space[peak_vel + 7],
                     working_space[peak_vel + 8],
                     working_space[peak_vel + 9],
                     working_space[peak_vel + 10],
                     working_space[peak_vel + 11],
                     working_space[peak_vel + 12],
                     working_space[peak_vel + 13]);
         source[i1][i2] = f;
      }
   }
   delete [] working_space;
   return;
}




// ____________________________________________________________________________________________________________________________
void TSpectrum2Fit::FitStiefel(Double_t **source)
{
/////////////////////////////////////////////////////////////////////////////
// TWO-DIMENSIONAL FIT FUNCTION USING STIEFEL-HESTENS
//  ALGORITHM.
//  This function fits the source spectrum. The calling program should
//  fill in input parameters of the TSpectrum2Fit class.
//  The fitted parameters are written into
//  TSpectrum2Fit class output parameters and fitted data are written into
//  source spectrum.
//
//        Function parameters:
//        source-pointer to the matrix of source spectrum
//
/////////////////////////////////////////////////////////////////////////////
//
//Begin_Html <!--
/* -->
<div class=Section1>

<p class=MsoNormal><b><span style='font-size:14.0pt'>Stiefel fitting algorithm</span></b></p>

<p class=MsoNormal style='text-align:justify'><i><span style='font-size:18.0pt'>&nbsp;</span></i></p>

<p class=MsoNormal><i>Function:</i></p>

<p class=MsoNormal style='text-align:justify'>void <a
href="http://root.cern.ch/root/html/TSpectrum.html#TSpectrum:Fit1Awmi"><b>TSpectrumFit2::FitStiefel</b></a>(<a
href="http://root.cern.ch/root/html/ListOfTypes.html#float"><b>float</b></a>
**fSource) </p>

<p class=MsoNormal style='text-align:justify'>This function fits the source
spectrum using Stiefel-Hestens method [1].  The calling program should fill in
input fitting parameters of the TSpectrumFit2 class using a set of
TSpectrumFit2 setters. The fitted parameters are written into the class and the
fitted data are written into source spectrum. It converges faster than Awmi
method.</p>

<p class=MsoNormal><i><span style='color:red'>&nbsp;</span></i></p>

<p class=MsoNormal><i><span style='color:red'>Parameter:</span></i></p>

<p class=MsoNormal style='text-align:justify'>        <b>fSource</b>-pointer to
the matrix of source spectrum                  </p>

<p class=MsoNormal style='text-align:justify'>        </p>

<p class=MsoNormal style='text-align:justify'><b><i>Reference:</i></b></p>

<p class=MsoNormal style='text-align:justify'>[1] B. Mihaila: Analysis of
complex gamma spectra, Rom. Jorn. Phys., Vol. 39, No. 2, (1994), 139-148.</p>

<p class=MsoNormal style='text-align:justify'>&nbsp;</p>

<p class=MsoNormal style='text-align:justify'><i>Example 1 – script FitS.c:</i></p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:18.0pt'><img
border=0 width=602 height=455 src="gif/spectrum2fit_stiefel_image001.jpg"></span></p>

<p class=MsoNormal style='text-align:justify'><b>Fig. 1 Original
two-dimensional spectrum with found peaks (using TSpectrum2 peak searching
function). The positions of peaks were used as initial estimates in fitting
procedure.</b></p>

<p class=MsoNormal style='text-align:justify'><b><span style='font-size:16.0pt'><img
border=0 width=602 height=455 src="gif/spectrum2fit_stiefel_image002.jpg"></span></b></p>

<p class=MsoBodyText2 style='text-align:justify'>Fig. 2 Fitted (generated from
fitted parameters) spectrum of the data from Fig. 1 using Stiefel-Hestens
method. Each peak was represented by 7 parameters, which together with Sigmax,
Sigmay and a0 resulted in 38 fitted parameters. The chi-square after 1000
iterations was 0.642157.</p>

<p class=MsoNormal style='text-align:justify'><span style='font-size:18.0pt'>&nbsp;</span></p>

<p class=MsoNormal><b><span style='color:#339966'>Script:</span></b></p>

<p class=MsoNormal><span style='font-size:10.0pt'>// Example to illustrate
fitting function, algorithm without matrix inversion (AWMI) (class
TSpectrumFit2).</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>// To execute this example,
do</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>// root &gt; .x FitStiefel2.C</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>&nbsp;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>void FitStiefel2() {</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t i, j, nfound;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t nbinsx = 64;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Int_t nbinsy = 64;   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   </span><span lang=FR
style='font-size:10.0pt'>Int_t xmin  = 0;</span></p>

<p class=MsoNormal><span lang=FR style='font-size:10.0pt'>   Int_t xmax  =
nbinsx;</span></p>

<p class=MsoNormal><span lang=FR style='font-size:10.0pt'>   Int_t ymin  = 0;</span></p>

<p class=MsoNormal><span lang=FR style='font-size:10.0pt'>   Int_t ymax  =
nbinsy;</span></p>

<p class=MsoNormal><span lang=FR style='font-size:10.0pt'>   </span><span
style='font-size:10.0pt'>Double_t ** source = new float *[nbinsx];   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t ** dest = new
float *[nbinsx];      </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   for (i=0;i&lt;nbinsx;i++)</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>                                                source[i]=new
float[nbinsy];</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   for (i=0;i&lt;nbinsx;i++)</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>                                                dest[i]=new
float[nbinsy];</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   TH2F *search = new
TH2F(&quot;search&quot;,&quot;High resolution peak
searching&quot;,nbinsx,xmin,xmax,nbinsy,ymin,ymax);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   TFile *f = new
TFile(&quot;TSpectrum2.root&quot;);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   search=(TH2F*)
f-&gt;Get(&quot;search4;1&quot;);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   TCanvas *Searching = new
TCanvas(&quot;Searching&quot;,&quot;Two-dimensional fitting using
Stiefel-Hestens method&quot;,10,10,1000,700);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   TSpectrum2 *s = new
TSpectrum2();</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   for (i = 0; i &lt; nbinsx;
i++){</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>     for (j = 0; j &lt;
nbinsy; j++){</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>                    source[i][j]
= search-&gt;GetBinContent(i + 1,j + 1); </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>                 }</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   }   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   nfound =
s-&gt;SearchHighRes(source, dest, nbinsx, nbinsy, 2, 5, kTRUE, 3, kFALSE, 3);  
</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   printf(&quot;Found %d
candidate peaks\n&quot;,nfound);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t *FixPosX = new
Bool_t[nfound];</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t *FixPosY = new
Bool_t[nfound];   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Bool_t *FixAmp = new
Bool_t[nfound];      </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t *PosX = new
Double_t[nfound];         </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t *PosY = new
Double_t[nfound];</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t *Amp = new
Double_t[nfound];      </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   Double_t *AmpXY = new
Double_t[nfound];         </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   PosX = s-&gt;GetPositionX();</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   PosY =
s-&gt;GetPositionY();      </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   for(i = 0; i&lt; nfound ;
i++){</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>      FixPosX[i] = kFALSE;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>      FixPosY[i] =
kFALSE;      </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>      FixAmp[i] = kFALSE;    </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>      Amp[i] =
source[(Int_t)(PosX[i]+0.5)][(Int_t)(PosY[i]+0.5)];      //initial values of peaks
amplitudes, input parameters          </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>      AmpXY[i] = 0;</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   }</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   //filling in the initial
estimates of the input parameters</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   TSpectrumFit2 *pfit=new
TSpectrumFit2(nfound);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>  
pfit-&gt;SetFitParameters(xmin, xmax-1, ymin, ymax-1, 1000, 0.1,
pfit-&gt;kFitOptimChiCounts, pfit-&gt;kFitAlphaHalving, pfit-&gt;kFitPower2,
pfit-&gt;kFitTaylorOrderFirst);   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>  
pfit-&gt;SetPeakParameters(2, kFALSE, 2, kFALSE, 0, kTRUE, PosX, (Bool_t *)
FixPosX, PosY, (Bool_t *) FixPosY, PosX, (Bool_t *) FixPosX, PosY, (Bool_t *)
FixPosY, Amp, (Bool_t *) FixAmp, AmpXY, (Bool_t *) FixAmp, AmpXY, (Bool_t *)
FixAmp);      </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>  
pfit-&gt;SetBackgroundParameters(0, kFALSE, 0, kTRUE, 0, kTRUE);   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>  
pfit-&gt;FitStiefel(source);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>    for (i = 0; i &lt;
nbinsx; i++){</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>     for (j = 0; j &lt;
nbinsy; j++){</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>                  search-&gt;SetBinContent(i
+ 1, j + 1,source[i][j]);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>                 }</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>   }   </span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>  
search-&gt;Draw(&quot;SURF&quot;);</span></p>

<p class=MsoNormal><span style='font-size:10.0pt'>}</span></p>

</div>

<!-- */
// --> End_Html

   Int_t i, i1, i2, j, k, shift =
       7 * fNPeaks + 14, peak_vel, size, iter, regul_cycle,
       flag;
   Double_t a, b, c, alpha, chi_opt, yw, ywm, f, chi2, chi_min, chi = 0
       , pi, pmin = 0, chi_cel = 0, chi_er;
   Double_t *working_space = new Double_t[5 * (7 * fNPeaks + 14)];
   for (i = 0, j = 0; i < fNPeaks; i++) {
      working_space[7 * i] = fAmpInit[i]; //vector parameter
      if (fFixAmp[i] == false) {
         working_space[shift + j] = fAmpInit[i]; //vector xk
         j += 1;
      }
      working_space[7 * i + 1] = fPositionInitX[i]; //vector parameter
      if (fFixPositionX[i] == false) {
         working_space[shift + j] = fPositionInitX[i]; //vector xk
         j += 1;
      }
      working_space[7 * i + 2] = fPositionInitY[i]; //vector parameter
      if (fFixPositionY[i] == false) {
         working_space[shift + j] = fPositionInitY[i]; //vector xk
         j += 1;
      }
      working_space[7 * i + 3] = fAmpInitX1[i]; //vector parameter
      if (fFixAmpX1[i] == false) {
         working_space[shift + j] = fAmpInitX1[i]; //vector xk
         j += 1;
      }
      working_space[7 * i + 4] = fAmpInitY1[i]; //vector parameter
      if (fFixAmpY1[i] == false) {
         working_space[shift + j] = fAmpInitY1[i]; //vector xk
         j += 1;
      }
      working_space[7 * i + 5] = fPositionInitX1[i]; //vector parameter
      if (fFixPositionX1[i] == false) {
         working_space[shift + j] = fPositionInitX1[i]; //vector xk
         j += 1;
      }
      working_space[7 * i + 6] = fPositionInitY1[i]; //vector parameter
      if (fFixPositionY1[i] == false) {
         working_space[shift + j] = fPositionInitY1[i]; //vector xk
         j += 1;
      }
   }
   peak_vel = 7 * i;
   working_space[7 * i] = fSigmaInitX; //vector parameter
   if (fFixSigmaX == false) {
      working_space[shift + j] = fSigmaInitX; //vector xk
      j += 1;
   }
   working_space[7 * i + 1] = fSigmaInitY; //vector parameter
   if (fFixSigmaY == false) {
      working_space[shift + j] = fSigmaInitY; //vector xk
      j += 1;
   }
   working_space[7 * i + 2] = fRoInit; //vector parameter
   if (fFixRo == false) {
      working_space[shift + j] = fRoInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 3] = fA0Init; //vector parameter
   if (fFixA0 == false) {
      working_space[shift + j] = fA0Init; //vector xk
      j += 1;
   }
   working_space[7 * i + 4] = fAxInit; //vector parameter
   if (fFixAx == false) {
      working_space[shift + j] = fAxInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 5] = fAyInit; //vector parameter
   if (fFixAy == false) {
      working_space[shift + j] = fAyInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 6] = fTxyInit; //vector parameter
   if (fFixTxy == false) {
      working_space[shift + j] = fTxyInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 7] = fSxyInit; //vector parameter
   if (fFixSxy == false) {
      working_space[shift + j] = fSxyInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 8] = fTxInit; //vector parameter
   if (fFixTx == false) {
      working_space[shift + j] = fTxInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 9] = fTyInit; //vector parameter
   if (fFixTy == false) {
      working_space[shift + j] = fTyInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 10] = fSxyInit; //vector parameter
   if (fFixSx == false) {
      working_space[shift + j] = fSxInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 11] = fSyInit; //vector parameter
   if (fFixSy == false) {
      working_space[shift + j] = fSyInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 12] = fBxInit; //vector parameter
   if (fFixBx == false) {
      working_space[shift + j] = fBxInit; //vector xk
      j += 1;
   }
   working_space[7 * i + 13] = fByInit; //vector parameter
   if (fFixBy == false) {
      working_space[shift + j] = fByInit; //vector xk
      j += 1;
   }
   size = j;
   Double_t **working_matrix = new Double_t *[size];
   for (i = 0; i < size; i++)
      working_matrix[i] = new Double_t[size + 4];
   for (iter = 0; iter < fNumberIterations; iter++) {
      for (j = 0; j < size; j++) {
         working_space[3 * shift + j] = 0; //temp
         for (k = 0; k <= size; k++) {
            working_matrix[j][k] = 0;
         }
      }

      //filling working matrix
      alpha = fAlpha;
      chi_opt = 0;
      for (i1 = fXmin; i1 <= fXmax; i1++) {
         for (i2 = fYmin; i2 <= fYmax; i2++) {
            //calculation of gradient vector
            for (j = 0, k = 0; j < fNPeaks; j++) {
               if (fFixAmp[j] == false) {
                  working_space[2 * shift + k] =
                      Deramp2(i1, i2,
                              working_space[7 * j + 1],
                              working_space[7 * j + 2],
                              working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
                  k += 1;
               }
               if (fFixPositionX[j] == false) {
                  working_space[2 * shift + k] =
                      Deri02(i1, i2,
                             working_space[7 * j],
                             working_space[7 * j + 1],
                             working_space[7 * j + 2],
                             working_space[peak_vel],
                             working_space[peak_vel + 1],
                             working_space[peak_vel + 2],
                             working_space[peak_vel + 6],
                             working_space[peak_vel + 7],
                             working_space[peak_vel + 12],
                             working_space[peak_vel + 13]);
                  k += 1;
               }
               if (fFixPositionY[j] == false) {
                  working_space[2 * shift + k] =
                      Derj02(i1, i2,
                             working_space[7 * j],
                             working_space[7 * j + 1],
                             working_space[7 * j + 2],
                             working_space[peak_vel],
                             working_space[peak_vel + 1],
                             working_space[peak_vel + 2],
                             working_space[peak_vel + 6],
                             working_space[peak_vel + 7],
                             working_space[peak_vel + 12],
                             working_space[peak_vel + 13]);
                  k += 1;
               }
               if (fFixAmpX1[j] == false) {
                  working_space[2 * shift + k] =
                      Derampx(i1, working_space[7 * j + 5],
                              working_space[peak_vel],
                              working_space[peak_vel + 8],
                              working_space[peak_vel + 10],
                              working_space[peak_vel + 12]);
                  k += 1;
               }
               if (fFixAmpY1[j] == false) {
                  working_space[2 * shift + k] =
                      Derampx(i2, working_space[7 * j + 6],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 9],
                              working_space[peak_vel + 11],
                              working_space[peak_vel + 13]);
                  k += 1;
               }
               if (fFixPositionX1[j] == false) {
                  working_space[2 * shift + k] =
                      Deri01(i1, working_space[7 * j + 3],
                             working_space[7 * j + 5],
                             working_space[peak_vel],
                             working_space[peak_vel + 8],
                             working_space[peak_vel + 10],
                             working_space[peak_vel + 12]);
                  k += 1;
               }
               if (fFixPositionY1[j] == false) {
                  working_space[2 * shift + k] =
                      Deri01(i2, working_space[7 * j + 4],
                             working_space[7 * j + 6],
                             working_space[peak_vel + 1],
                             working_space[peak_vel + 9],
                             working_space[peak_vel + 11],
                             working_space[peak_vel + 13]);
                  k += 1;
               }
            } if (fFixSigmaX == false) {
               working_space[2 * shift + k] =
                   Dersigmax(fNPeaks, i1, i2,
                             working_space, working_space[peak_vel],
                             working_space[peak_vel + 1],
                             working_space[peak_vel + 2],
                             working_space[peak_vel + 6],
                             working_space[peak_vel + 7],
                             working_space[peak_vel + 8],
                             working_space[peak_vel + 10],
                             working_space[peak_vel + 12],
                             working_space[peak_vel + 13]);
               k += 1;
            }
            if (fFixSigmaY == false) {
               working_space[2 * shift + k] =
                   Dersigmay(fNPeaks, i1, i2,
                             working_space, working_space[peak_vel],
                             working_space[peak_vel + 1],
                             working_space[peak_vel + 2],
                             working_space[peak_vel + 6],
                             working_space[peak_vel + 7],
                             working_space[peak_vel + 9],
                             working_space[peak_vel + 11],
                             working_space[peak_vel + 12],
                             working_space[peak_vel + 13]);
               k += 1;
            }
            if (fFixRo == false) {
               working_space[2 * shift + k] =
                   Derro(fNPeaks, i1, i2,
                         working_space, working_space[peak_vel],
                         working_space[peak_vel + 1],
                         working_space[peak_vel + 2]);
               k += 1;
            }
            if (fFixA0 == false) {
               working_space[2 * shift + k] = 1.;
               k += 1;
            }
            if (fFixAx == false) {
               working_space[2 * shift + k] = i1;
               k += 1;
            }
            if (fFixAy == false) {
               working_space[2 * shift + k] = i2;
               k += 1;
            }
            if (fFixTxy == false) {
               working_space[2 * shift + k] =
                   Dertxy(fNPeaks, i1, i2,
                          working_space, working_space[peak_vel],
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 12],
                          working_space[peak_vel + 13]);
               k += 1;
            }
            if (fFixSxy == false) {
               working_space[2 * shift + k] =
                   Dersxy(fNPeaks, i1, i2,
                          working_space, working_space[peak_vel],
                          working_space[peak_vel + 1]);
               k += 1;
            }
            if (fFixTx == false) {
               working_space[2 * shift + k] =
                   Dertx(fNPeaks, i1, working_space,
                         working_space[peak_vel],
                         working_space[peak_vel + 12]);
               k += 1;
            }
            if (fFixTy == false) {
               working_space[2 * shift + k] =
                   Derty(fNPeaks, i2, working_space,
                         working_space[peak_vel + 1],
                         working_space[peak_vel + 13]);
               k += 1;
            }
            if (fFixSx == false) {
               working_space[2 * shift + k] =
                   Dersx(fNPeaks, i1, working_space,
                         working_space[peak_vel]);
               k += 1;
            }
            if (fFixSy == false) {
               working_space[2 * shift + k] =
                   Dersy(fNPeaks, i2, working_space,
                         working_space[peak_vel + 1]);
               k += 1;
            }
            if (fFixBx == false) {
               working_space[2 * shift + k] =
                   Derbx(fNPeaks, i1, i2,
                         working_space, working_space[peak_vel],
                         working_space[peak_vel + 1],
                         working_space[peak_vel + 6],
                         working_space[peak_vel + 8],
                         working_space[peak_vel + 12],
                         working_space[peak_vel + 13]);
               k += 1;
            }
            if (fFixBy == false) {
               working_space[2 * shift + k] =
                   Derby(fNPeaks, i1, i2,
                         working_space, working_space[peak_vel],
                         working_space[peak_vel + 1],
                         working_space[peak_vel + 6],
                         working_space[peak_vel + 8],
                         working_space[peak_vel + 12],
                         working_space[peak_vel + 13]);
               k += 1;
            }
            yw = source[i1][i2];
            ywm = yw;
            f = Shape2(fNPeaks, i1, i2,
                        working_space, working_space[peak_vel],
                        working_space[peak_vel + 1],
                        working_space[peak_vel + 2],
                        working_space[peak_vel + 3],
                        working_space[peak_vel + 4],
                        working_space[peak_vel + 5],
                        working_space[peak_vel + 6],
                        working_space[peak_vel + 7],
                        working_space[peak_vel + 8],
                        working_space[peak_vel + 9],
                        working_space[peak_vel + 10],
                        working_space[peak_vel + 11],
                        working_space[peak_vel + 12],
                        working_space[peak_vel + 13]);
            if (fStatisticType == kFitOptimMaxLikelihood) {
               if (f > 0.00001)
                  chi_opt += yw * TMath::Log(f) - f;
            }

            else {
               if (ywm != 0)
                  chi_opt += (yw - f) * (yw - f) / ywm;
            }
            if (fStatisticType == kFitOptimChiFuncValues) {
               ywm = f;
               if (f < 0.00001)
                  ywm = 0.00001;
            }

            else if (fStatisticType == kFitOptimMaxLikelihood) {
               ywm = f;
               if (f < 0.00001)
                  ywm = 0.00001;
            }

            else {
               if (ywm == 0)
                  ywm = 1;
            }
            for (j = 0; j < size; j++) {
               for (k = 0; k < size; k++) {
                  b = working_space[2 * shift +
                                     j] * working_space[2 * shift +
                                                        k] / ywm;
                  if (fStatisticType == kFitOptimChiFuncValues)
                     b = b * (4 * yw - 2 * f) / ywm;
                  working_matrix[j][k] += b;
                  if (j == k)
                     working_space[3 * shift + j] += b;
               }
            }
            if (fStatisticType == kFitOptimChiFuncValues)
               b = (f * f - yw * yw) / (ywm * ywm);

            else
               b = (f - yw) / ywm;
            for (j = 0; j < size; j++) {
               working_matrix[j][size] -=
                   b * working_space[2 * shift + j];
            }
         }
      }
      for (i = 0; i < size; i++) {
         working_matrix[i][size + 1] = 0; //xk
      }
      StiefelInversion(working_matrix, size);
      for (i = 0; i < size; i++) {
         working_space[2 * shift + i] = working_matrix[i][size + 1]; //der
      }

      //calculate chi_opt
      chi2 = chi_opt;
      chi_opt = TMath::Sqrt(TMath::Abs(chi_opt));

      //calculate new parameters
      regul_cycle = 0;
      for (j = 0; j < size; j++) {
         working_space[4 * shift + j] = working_space[shift + j]; //temp_xk[j]=xk[j]
      }

      do {
         if (fAlphaOptim == kFitAlphaOptimal) {
            if (fStatisticType != kFitOptimMaxLikelihood)
               chi_min = 10000 * chi2;

            else
               chi_min = 0.1 * chi2;
            flag = 0;
            for (pi = 0.1; flag == 0 && pi <= 100; pi += 0.1) {
               for (j = 0; j < size; j++) {
                  working_space[shift + j] = working_space[4 * shift + j] + pi * alpha * working_space[2 * shift + j]; //xk[j]=temp_xk[j]+pi*alpha*der[j]
               }
               for (i = 0, j = 0; i < fNPeaks; i++) {
                  if (fFixAmp[i] == false) {
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = 0; //xk[j]
                     working_space[7 * i] = working_space[shift + j]; //parameter[7*i]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionX[i] == false) {
                     if (working_space[shift + j] < fXmin) //xk[j]
                        working_space[shift + j] = fXmin; //xk[j]
                     if (working_space[shift + j] > fXmax) //xk[j]
                        working_space[shift + j] = fXmax; //xk[j]
                     working_space[7 * i + 1] = working_space[shift + j]; //parameter[7*i+1]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionY[i] == false) {
                     if (working_space[shift + j] < fYmin) //xk[j]
                        working_space[shift + j] = fYmin; //xk[j]
                     if (working_space[shift + j] > fYmax) //xk[j]
                        working_space[shift + j] = fYmax; //xk[j]
                     working_space[7 * i + 2] = working_space[shift + j]; //parameter[7*i+2]=xk[j]
                     j += 1;
                  }
                  if (fFixAmpX1[i] == false) {
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = 0; //xk[j]
                     working_space[7 * i + 3] = working_space[shift + j]; //parameter[7*i+3]=xk[j]
                     j += 1;
                  }
                  if (fFixAmpY1[i] == false) {
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = 0; //xk[j]
                     working_space[7 * i + 4] = working_space[shift + j]; //parameter[7*i+4]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionX1[i] == false) {
                     if (working_space[shift + j] < fXmin) //xk[j]
                        working_space[shift + j] = fXmin; //xk[j]
                     if (working_space[shift + j] > fXmax) //xk[j]
                        working_space[shift + j] = fXmax; //xk[j]
                     working_space[7 * i + 5] = working_space[shift + j]; //parameter[7*i+5]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionY1[i] == false) {
                     if (working_space[shift + j] < fYmin) //xk[j]
                        working_space[shift + j] = fYmin; //xk[j]
                     if (working_space[shift + j] > fYmax) //xk[j]
                        working_space[shift + j] = fYmax; //xk[j]
                     working_space[7 * i + 6] = working_space[shift + j]; //parameter[7*i+6]=xk[j]
                     j += 1;
                  }
               }
               if (fFixSigmaX == false) {
                  if (working_space[shift + j] < 0.001) { //xk[j]
                     working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel] = working_space[shift + j]; //parameter[peak_vel]=xk[j]
                  j += 1;
               }
               if (fFixSigmaY == false) {
                  if (working_space[shift + j] < 0.001) { //xk[j]
                     working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel + 1] = working_space[shift + j]; //parameter[peak_vel+1]=xk[j]
                  j += 1;
               }
               if (fFixRo == false) {
                  if (working_space[shift + j] < -1) { //xk[j]
                     working_space[shift + j] = -1; //xk[j]
                  }
                  if (working_space[shift + j] > 1) { //xk[j]
                     working_space[shift + j] = 1; //xk[j]
                  }
                  working_space[peak_vel + 2] = working_space[shift + j]; //parameter[peak_vel+2]=xk[j]
                  j += 1;
               }
               if (fFixA0 == false) {
                  working_space[peak_vel + 3] = working_space[shift + j]; //parameter[peak_vel+3]=xk[j]
                  j += 1;
               }
               if (fFixAx == false) {
                  working_space[peak_vel + 4] = working_space[shift + j]; //parameter[peak_vel+4]=xk[j]
                  j += 1;
               }
               if (fFixAy == false) {
                  working_space[peak_vel + 5] = working_space[shift + j]; //parameter[peak_vel+5]=xk[j]
                  j += 1;
               }
               if (fFixTxy == false) {
                  working_space[peak_vel + 6] = working_space[shift + j]; //parameter[peak_vel+6]=xk[j]
                  j += 1;
               }
               if (fFixSxy == false) {
                  working_space[peak_vel + 7] = working_space[shift + j]; //parameter[peak_vel+7]=xk[j]
                  j += 1;
               }
               if (fFixTx == false) {
                  working_space[peak_vel + 8] = working_space[shift + j]; //parameter[peak_vel+8]=xk[j]
                  j += 1;
               }
               if (fFixTy == false) {
                  working_space[peak_vel + 9] = working_space[shift + j]; //parameter[peak_vel+9]=xk[j]
                  j += 1;
               }
               if (fFixSx == false) {
                  working_space[peak_vel + 10] = working_space[shift + j]; //parameter[peak_vel+10]=xk[j]
                  j += 1;
               }
               if (fFixSy == false) {
                  working_space[peak_vel + 11] = working_space[shift + j]; //parameter[peak_vel+11]=xk[j]
                  j += 1;
               }
               if (fFixBx == false) {
                  if (TMath::Abs(working_space[shift + j]) < 0.001) { //xk[j]
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = -0.001; //xk[j]
                     else
                        working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel + 12] = working_space[shift + j]; //parameter[peak_vel+12]=xk[j]
                  j += 1;
               }
               if (fFixBy == false) {
                  if (TMath::Abs(working_space[shift + j]) < 0.001) { //xk[j]
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = -0.001; //xk[j]
                     else
                        working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel + 13] = working_space[shift + j]; //parameter[peak_vel+13]=xk[j]
                  j += 1;
               }
               chi2 = 0;
               for (i1 = fXmin; i1 <= fXmax; i1++) {
                  for (i2 = fYmin; i2 <= fYmax; i2++) {
                     yw = source[i1][i2];
                     ywm = yw;
                     f = Shape2(fNPeaks, i1,
                                 i2, working_space,
                                 working_space[peak_vel],
                                 working_space[peak_vel + 1],
                                 working_space[peak_vel + 2],
                                 working_space[peak_vel + 3],
                                 working_space[peak_vel + 4],
                                 working_space[peak_vel + 5],
                                 working_space[peak_vel + 6],
                                 working_space[peak_vel + 7],
                                 working_space[peak_vel + 8],
                                 working_space[peak_vel + 9],
                                 working_space[peak_vel + 10],
                                 working_space[peak_vel + 11],
                                 working_space[peak_vel + 12],
                                 working_space[peak_vel + 13]);
                     if (fStatisticType == kFitOptimChiFuncValues) {
                        ywm = f;
                        if (f < 0.00001)
                           ywm = 0.00001;
                     }
                     if (fStatisticType == kFitOptimMaxLikelihood) {
                        if (f > 0.00001)
                           chi2 += yw * TMath::Log(f) - f;
                     }

                     else {
                        if (ywm != 0)
                           chi2 += (yw - f) * (yw - f) / ywm;
                     }
                  }
               }
               if ((chi2 < chi_min
                    && fStatisticType != kFitOptimMaxLikelihood)
                    || (chi2 > chi_min
                    && fStatisticType == kFitOptimMaxLikelihood)) {
                  pmin = pi, chi_min = chi2;
               }

               else
                  flag = 1;
               if (pi == 0.1)
                  chi_min = chi2;
               chi = chi_min;
            }
            if (pmin != 0.1) {
               for (j = 0; j < size; j++) {
                  working_space[shift + j] = working_space[4 * shift + j] + pmin * alpha * working_space[2 * shift + j]; //xk[j]=temp_xk[j]+pmin*alpha*der[j]
               }
               for (i = 0, j = 0; i < fNPeaks; i++) {
                  if (fFixAmp[i] == false) {
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = 0; //xk[j]
                     working_space[7 * i] = working_space[shift + j]; //parameter[7*i]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionX[i] == false) {
                     if (working_space[shift + j] < fXmin) //xk[j]
                        working_space[shift + j] = fXmin; //xk[j]
                     if (working_space[shift + j] > fXmax) //xk[j]
                        working_space[shift + j] = fXmax; //xk[j]
                     working_space[7 * i + 1] = working_space[shift + j]; //parameter[7*i+1]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionY[i] == false) {
                     if (working_space[shift + j] < fYmin) //xk[j]
                        working_space[shift + j] = fYmin; //xk[j]
                     if (working_space[shift + j] > fYmax) //xk[j]
                        working_space[shift + j] = fYmax; //xk[j]
                     working_space[7 * i + 2] = working_space[shift + j]; //parameter[7*i+2]=xk[j]
                     j += 1;
                  }
                  if (fFixAmpX1[i] == false) {
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = 0; //xk[j]
                     working_space[7 * i + 3] = working_space[shift + j]; //parameter[7*i+3]=xk[j]
                     j += 1;
                  }
                  if (fFixAmpY1[i] == false) {
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = 0; //xk[j]
                     working_space[7 * i + 4] = working_space[shift + j]; //parameter[7*i+4]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionX1[i] == false) {
                     if (working_space[shift + j] < fXmin) //xk[j]
                        working_space[shift + j] = fXmin; //xk[j]
                     if (working_space[shift + j] > fXmax) //xk[j]
                        working_space[shift + j] = fXmax; //xk[j]
                     working_space[7 * i + 5] = working_space[shift + j]; //parameter[7*i+5]=xk[j]
                     j += 1;
                  }
                  if (fFixPositionY1[i] == false) {
                     if (working_space[shift + j] < fYmin) //xk[j]
                        working_space[shift + j] = fYmin; //xk[j]
                     if (working_space[shift + j] > fYmax) //xk[j]
                        working_space[shift + j] = fYmax; //xk[j]
                     working_space[7 * i + 6] = working_space[shift + j]; //parameter[7*i+6]=xk[j]
                     j += 1;
                  }
               }
               if (fFixSigmaX == false) {
                  if (working_space[shift + j] < 0.001) { //xk[j]
                     working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel] = working_space[shift + j]; //parameter[peak_vel]=xk[j]
                  j += 1;
               }
               if (fFixSigmaY == false) {
                  if (working_space[shift + j] < 0.001) { //xk[j]
                     working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel + 1] = working_space[shift + j]; //parameter[peak_vel+1]=xk[j]
                  j += 1;
               }
               if (fFixRo == false) {
                  if (working_space[shift + j] < -1) { //xk[j]
                     working_space[shift + j] = -1; //xk[j]
                  }
                  if (working_space[shift + j] > 1) { //xk[j]
                     working_space[shift + j] = 1; //xk[j]
                  }
                  working_space[peak_vel + 2] = working_space[shift + j]; //parameter[peak_vel+2]=xk[j]
                  j += 1;
               }
               if (fFixA0 == false) {
                  working_space[peak_vel + 3] = working_space[shift + j]; //parameter[peak_vel+3]=xk[j]
                  j += 1;
               }
               if (fFixAx == false) {
                  working_space[peak_vel + 4] = working_space[shift + j]; //parameter[peak_vel+4]=xk[j]
                  j += 1;
               }
               if (fFixAy == false) {
                  working_space[peak_vel + 5] = working_space[shift + j]; //parameter[peak_vel+5]=xk[j]
                  j += 1;
               }
               if (fFixTxy == false) {
                  working_space[peak_vel + 6] = working_space[shift + j]; //parameter[peak_vel+6]=xk[j]
                  j += 1;
               }
               if (fFixSxy == false) {
                  working_space[peak_vel + 7] = working_space[shift + j]; //parameter[peak_vel+7]=xk[j]
                  j += 1;
               }
               if (fFixTx == false) {
                  working_space[peak_vel + 8] = working_space[shift + j]; //parameter[peak_vel+8]=xk[j]
                  j += 1;
               }
               if (fFixTy == false) {
                  working_space[peak_vel + 9] = working_space[shift + j]; //parameter[peak_vel+9]=xk[j]
                  j += 1;
               }
               if (fFixSx == false) {
                  working_space[peak_vel + 10] = working_space[shift + j]; //parameter[peak_vel+10]=xk[j]
                  j += 1;
               }
               if (fFixSy == false) {
                  working_space[peak_vel + 11] = working_space[shift + j]; //parameter[peak_vel+11]=xk[j]
                  j += 1;
               }
               if (fFixBx == false) {
                  if (TMath::Abs(working_space[shift + j]) < 0.001) { //xk[j]
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = -0.001; //xk[j]
                     else
                        working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel + 12] = working_space[shift + j]; //parameter[peak_vel+12]=xk[j]
                  j += 1;
               }
               if (fFixBy == false) {
                  if (TMath::Abs(working_space[shift + j]) < 0.001) { //xk[j]
                     if (working_space[shift + j] < 0) //xk[j]
                        working_space[shift + j] = -0.001; //xk[j]
                     else
                        working_space[shift + j] = 0.001; //xk[j]
                  }
                  working_space[peak_vel + 13] = working_space[shift + j]; //parameter[peak_vel+13]=xk[j]
                  j += 1;
               }
               chi = chi_min;
            }
         }

         else {
            for (j = 0; j < size; j++) {
               working_space[shift + j] = working_space[4 * shift + j] + alpha * working_space[2 * shift + j]; //xk[j]=temp_xk[j]+pi*alpha*der[j]
            }
            for (i = 0, j = 0; i < fNPeaks; i++) {
               if (fFixAmp[i] == false) {
                  if (working_space[shift + j] < 0) //xk[j]
                     working_space[shift + j] = 0; //xk[j]
                  working_space[7 * i] = working_space[shift + j]; //parameter[7*i]=xk[j]
                  j += 1;
               }
               if (fFixPositionX[i] == false) {
                  if (working_space[shift + j] < fXmin) //xk[j]
                     working_space[shift + j] = fXmin; //xk[j]
                  if (working_space[shift + j] > fXmax) //xk[j]
                     working_space[shift + j] = fXmax; //xk[j]
                  working_space[7 * i + 1] = working_space[shift + j]; //parameter[7*i+1]=xk[j]
                  j += 1;
               }
               if (fFixPositionY[i] == false) {
                  if (working_space[shift + j] < fYmin) //xk[j]
                     working_space[shift + j] = fYmin; //xk[j]
                  if (working_space[shift + j] > fYmax) //xk[j]
                     working_space[shift + j] = fYmax; //xk[j]
                  working_space[7 * i + 2] = working_space[shift + j]; //parameter[7*i+2]=xk[j]
                  j += 1;
               }
               if (fFixAmpX1[i] == false) {
                  if (working_space[shift + j] < 0) //xk[j]
                     working_space[shift + j] = 0; //xk[j]
                  working_space[7 * i + 3] = working_space[shift + j]; //parameter[7*i+3]=xk[j]
                  j += 1;
               }
               if (fFixAmpY1[i] == false) {
                  if (working_space[shift + j] < 0) //xk[j]
                     working_space[shift + j] = 0; //xk[j]
                  working_space[7 * i + 4] = working_space[shift + j]; //parameter[7*i+4]=xk[j]
                  j += 1;
               }
               if (fFixPositionX1[i] == false) {
                  if (working_space[shift + j] < fXmin) //xk[j]
                     working_space[shift + j] = fXmin; //xk[j]
                  if (working_space[shift + j] > fXmax) //xk[j]
                     working_space[shift + j] = fXmax; //xk[j]
                  working_space[7 * i + 5] = working_space[shift + j]; //parameter[7*i+5]=xk[j]
                  j += 1;
               }
               if (fFixPositionY1[i] == false) {
                  if (working_space[shift + j] < fYmin) //xk[j]
                     working_space[shift + j] = fYmin; //xk[j]
                  if (working_space[shift + j] > fYmax) //xk[j]
                     working_space[shift + j] = fYmax; //xk[j]
                  working_space[7 * i + 6] = working_space[shift + j]; //parameter[7*i+6]=xk[j]
                  j += 1;
               }
            }
            if (fFixSigmaX == false) {
               if (working_space[shift + j] < 0.001) { //xk[j]
                  working_space[shift + j] = 0.001; //xk[j]
               }
               working_space[peak_vel] = working_space[shift + j]; //parameter[peak_vel]=xk[j]
               j += 1;
            }
            if (fFixSigmaY == false) {
               if (working_space[shift + j] < 0.001) { //xk[j]
                  working_space[shift + j] = 0.001; //xk[j]
               }
               working_space[peak_vel + 1] = working_space[shift + j]; //parameter[peak_vel+1]=xk[j]
               j += 1;
            }
            if (fFixRo == false) {
               if (working_space[shift + j] < -1) { //xk[j]
                  working_space[shift + j] = -1; //xk[j]
               }
               if (working_space[shift + j] > 1) { //xk[j]
                  working_space[shift + j] = 1; //xk[j]
               }
               working_space[peak_vel + 2] = working_space[shift + j]; //parameter[peak_vel+2]=xk[j]
               j += 1;
            }
            if (fFixA0 == false) {
               working_space[peak_vel + 3] = working_space[shift + j]; //parameter[peak_vel+3]=xk[j]
               j += 1;
            }
            if (fFixAx == false) {
               working_space[peak_vel + 4] = working_space[shift + j]; //parameter[peak_vel+4]=xk[j]
               j += 1;
            }
            if (fFixAy == false) {
               working_space[peak_vel + 5] = working_space[shift + j]; //parameter[peak_vel+5]=xk[j]
               j += 1;
            }
            if (fFixTxy == false) {
               working_space[peak_vel + 6] = working_space[shift + j]; //parameter[peak_vel+6]=xk[j]
               j += 1;
            }
            if (fFixSxy == false) {
               working_space[peak_vel + 7] = working_space[shift + j]; //parameter[peak_vel+7]=xk[j]
               j += 1;
            }
            if (fFixTx == false) {
               working_space[peak_vel + 8] = working_space[shift + j]; //parameter[peak_vel+8]=xk[j]
               j += 1;
            }
            if (fFixTy == false) {
               working_space[peak_vel + 9] = working_space[shift + j]; //parameter[peak_vel+9]=xk[j]
               j += 1;
            }
            if (fFixSx == false) {
               working_space[peak_vel + 10] = working_space[shift + j]; //parameter[peak_vel+10]=xk[j]
               j += 1;
            }
            if (fFixSy == false) {
               working_space[peak_vel + 11] = working_space[shift + j]; //parameter[peak_vel+11]=xk[j]
               j += 1;
            }
            if (fFixBx == false) {
               if (TMath::Abs(working_space[shift + j]) < 0.001) { //xk[j]
                  if (working_space[shift + j] < 0) //xk[j]
                     working_space[shift + j] = -0.001; //xk[j]
                  else
                     working_space[shift + j] = 0.001; //xk[j]
               }
               working_space[peak_vel + 12] = working_space[shift + j]; //parameter[peak_vel+12]=xk[j]
               j += 1;
            }
            if (fFixBy == false) {
               if (TMath::Abs(working_space[shift + j]) < 0.001) { //xk[j]
                  if (working_space[shift + j] < 0) //xk[j]
                     working_space[shift + j] = -0.001; //xk[j]
                  else
                     working_space[shift + j] = 0.001; //xk[j]
               }
               working_space[peak_vel + 13] = working_space[shift + j]; //parameter[peak_vel+13]=xk[j]
               j += 1;
            }
            chi = 0;
            for (i1 = fXmin; i1 <= fXmax; i1++) {
               for (i2 = fYmin; i2 <= fYmax; i2++) {
                  yw = source[i1][i2];
                  ywm = yw;
                  f = Shape2(fNPeaks, i1, i2,
                              working_space, working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 3],
                              working_space[peak_vel + 4],
                              working_space[peak_vel + 5],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 8],
                              working_space[peak_vel + 9],
                              working_space[peak_vel + 10],
                              working_space[peak_vel + 11],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
                  if (fStatisticType == kFitOptimChiFuncValues) {
                     ywm = f;
                     if (f < 0.00001)
                        ywm = 0.00001;
                  }
                  if (fStatisticType == kFitOptimMaxLikelihood) {
                     if (f > 0.00001)
                        chi += yw * TMath::Log(f) - f;
                  }

                  else {
                     if (ywm != 0)
                        chi += (yw - f) * (yw - f) / ywm;
                  }
               }
            }
         }
         chi2 = chi;
         chi = TMath::Sqrt(TMath::Abs(chi));
         if (fAlphaOptim == kFitAlphaHalving && chi > 1E-6)
            alpha = alpha * chi_opt / (2 * chi);

         else if (fAlphaOptim == kFitAlphaOptimal)
            alpha = alpha / 10.0;
         iter += 1;
         regul_cycle += 1;
      } while (((chi > chi_opt
                 && fStatisticType != kFitOptimMaxLikelihood)
                 || (chi < chi_opt
                 && fStatisticType == kFitOptimMaxLikelihood))
                && regul_cycle < kFitNumRegulCycles);
      for (j = 0; j < size; j++) {
         working_space[4 * shift + j] = 0; //temp_xk[j]
         working_space[2 * shift + j] = 0; //der[j]
      }
      for (i1 = fXmin, chi_cel = 0; i1 <= fXmax; i1++) {
         for (i2 = fYmin; i2 <= fYmax; i2++) {
            yw = source[i1][i2];
            if (yw == 0)
               yw = 1;
            f = Shape2(fNPeaks, i1, i2,
                        working_space, working_space[peak_vel],
                        working_space[peak_vel + 1],
                        working_space[peak_vel + 2],
                        working_space[peak_vel + 3],
                        working_space[peak_vel + 4],
                        working_space[peak_vel + 5],
                        working_space[peak_vel + 6],
                        working_space[peak_vel + 7],
                        working_space[peak_vel + 8],
                        working_space[peak_vel + 9],
                        working_space[peak_vel + 10],
                        working_space[peak_vel + 11],
                        working_space[peak_vel + 12],
                        working_space[peak_vel + 13]);
            chi_opt = (yw - f) * (yw - f) / yw;
            chi_cel += (yw - f) * (yw - f) / yw;

                //calculate gradient vector
                for (j = 0, k = 0; j < fNPeaks; j++) {
               if (fFixAmp[j] == false) {
                  a = Deramp2(i1, i2,
                               working_space[7 * j + 1],
                               working_space[7 * j + 2],
                               working_space[peak_vel],
                               working_space[peak_vel + 1],
                               working_space[peak_vel + 2],
                               working_space[peak_vel + 6],
                               working_space[peak_vel + 7],
                               working_space[peak_vel + 12],
                               working_space[peak_vel + 13]);
                  if (yw != 0) {
                     working_space[2 * shift + k] += chi_opt; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b; //temp_xk[k]
                  }
                  k += 1;
               }
               if (fFixPositionX[j] == false) {
                  a = Deri02(i1, i2,
                              working_space[7 * j],
                              working_space[7 * j + 1],
                              working_space[7 * j + 2],
                              working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
                  if (yw != 0) {
                     working_space[2 * shift + k] += chi_opt; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b; //temp_xk[k]
                  }
                  k += 1;
               }
               if (fFixPositionY[j] == false) {
                  a = Derj02(i1, i2,
                              working_space[7 * j],
                              working_space[7 * j + 1],
                              working_space[7 * j + 2],
                              working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
                  if (yw != 0) {
                     working_space[2 * shift + k] += chi_opt; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b; //temp_xk[k]
                  }
                  k += 1;
               }
               if (fFixAmpX1[j] == false) {
                  a = Derampx(i1, working_space[7 * j + 5],
                               working_space[peak_vel],
                               working_space[peak_vel + 8],
                               working_space[peak_vel + 10],
                               working_space[peak_vel + 12]);
                  if (yw != 0) {
                     working_space[2 * shift + k] += chi_opt; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b; //temp_xk[k]
                  }
                  k += 1;
               }
               if (fFixAmpY1[j] == false) {
                  a = Derampx(i2, working_space[7 * j + 6],
                               working_space[peak_vel + 1],
                               working_space[peak_vel + 9],
                               working_space[peak_vel + 11],
                               working_space[peak_vel + 13]);
                  if (yw != 0) {
                     working_space[2 * shift + k] += chi_opt; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b; //temp_xk[k]
                  }
                  k += 1;
               }
               if (fFixPositionX1[j] == false) {
                  a = Deri01(i1, working_space[7 * j + 3],
                              working_space[7 * j + 5],
                              working_space[peak_vel],
                              working_space[peak_vel + 8],
                              working_space[peak_vel + 10],
                              working_space[peak_vel + 12]);
                  if (yw != 0) {
                     working_space[2 * shift + k] += chi_opt; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b; //temp_xk[k]
                  }
                  k += 1;
               }
               if (fFixPositionY1[j] == false) {
                  a = Deri01(i2, working_space[7 * j + 4],
                              working_space[7 * j + 6],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 9],
                              working_space[peak_vel + 11],
                              working_space[peak_vel + 13]);
                  if (yw != 0) {
                     working_space[2 * shift + k] += chi_opt; //der[k]
                     b = a * a / yw;
                     working_space[4 * shift + k] += b; //temp_xk[k]
                  }
                  k += 1;
               }
            }
            if (fFixSigmaX == false) {
               a = Dersigmax(fNPeaks, i1, i2,
                              working_space, working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 8],
                              working_space[peak_vel + 10],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixSigmaY == false) {
               a = Dersigmay(fNPeaks, i1, i2,
                              working_space, working_space[peak_vel],
                              working_space[peak_vel + 1],
                              working_space[peak_vel + 2],
                              working_space[peak_vel + 6],
                              working_space[peak_vel + 7],
                              working_space[peak_vel + 9],
                              working_space[peak_vel + 11],
                              working_space[peak_vel + 12],
                              working_space[peak_vel + 13]);
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixRo == false) {
               a = Derro(fNPeaks, i1, i2,
                          working_space, working_space[peak_vel],
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 2]);
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixA0 == false) {
               a = 1.;
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixAx == false) {
               a = i1;
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixAy == false) {
               a = i2;
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixTxy == false) {
               a = Dertxy(fNPeaks, i1, i2,
                           working_space, working_space[peak_vel],
                           working_space[peak_vel + 1],
                           working_space[peak_vel + 12],
                           working_space[peak_vel + 13]);
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixSxy == false) {
               a = Dersxy(fNPeaks, i1, i2,
                           working_space, working_space[peak_vel],
                           working_space[peak_vel + 1]);
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixTx == false) {
               a = Dertx(fNPeaks, i1, working_space,
                          working_space[peak_vel],
                          working_space[peak_vel + 12]);
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixTy == false) {
               a = Derty(fNPeaks, i2, working_space,
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 13]);
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixSx == false) {
               a = Dersx(fNPeaks, i1, working_space,
                          working_space[peak_vel]);
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixSy == false) {
               a = Dersy(fNPeaks, i2, working_space,
                          working_space[peak_vel + 1]);
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixBx == false) {
               a = Derbx(fNPeaks, i1, i2,
                          working_space, working_space[peak_vel],
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 6],
                          working_space[peak_vel + 8],
                          working_space[peak_vel + 12],
                          working_space[peak_vel + 13]);
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
            if (fFixBy == false) {
               a = Derby(fNPeaks, i1, i2,
                          working_space, working_space[peak_vel],
                          working_space[peak_vel + 1],
                          working_space[peak_vel + 6],
                          working_space[peak_vel + 8],
                          working_space[peak_vel + 12],
                          working_space[peak_vel + 13]);
               if (yw != 0) {
                  working_space[2 * shift + k] += chi_opt; //der[k]
                  b = a * a / yw;
                  working_space[4 * shift + k] += b; //temp_xk[k]
               }
               k += 1;
            }
         }
      }
   }
   b = (fXmax - fXmin + 1) * (fYmax - fYmin + 1) - size;
   chi_er = chi_cel / b;
   for (i = 0, j = 0; i < fNPeaks; i++) {
      fVolume[i] =
          Volume(working_space[7 * i], working_space[peak_vel],
                 working_space[peak_vel + 1], working_space[peak_vel + 2]);
      if (fVolume[i] > 0) {
         c = 0;
         if (fFixAmp[i] == false) {
            a = Derpa2(working_space[peak_vel],
                        working_space[peak_vel + 1],
                        working_space[peak_vel + 2]);
            b = working_space[4 * shift + j]; //temp_xk[j]
            if (b == 0)
               b = 1;

            else
               b = 1 / b;
            c = c + a * a * b;
         }
         if (fFixSigmaX == false) {
            a = Derpsigmax(working_space[shift + j],
                            working_space[peak_vel + 1],
                            working_space[peak_vel + 2]);
            b = working_space[4 * shift + peak_vel]; //temp_xk[j]
            if (b == 0)
               b = 1;

            else
               b = 1 / b;
            c = c + a * a * b;
         }
         if (fFixSigmaY == false) {
            a = Derpsigmay(working_space[shift + j],
                            working_space[peak_vel],
                            working_space[peak_vel + 2]);
            b = working_space[4 * shift + peak_vel + 1]; //temp_xk[j]
            if (b == 0)
               b = 1;

            else
               b = 1 / b;
            c = c + a * a * b;
         }
         if (fFixRo == false) {
            a = Derpro(working_space[shift + j], working_space[peak_vel],
                        working_space[peak_vel + 1],
                        working_space[peak_vel + 2]);
            b = working_space[4 * shift + peak_vel + 2]; //temp_xk[j]
            if (b == 0)
               b = 1;

            else
               b = 1 / b;
            c = c + a * a * b;
         }
         fVolumeErr[i] = TMath::Sqrt(TMath::Abs(chi_er * c));
      }

      else {
         fVolumeErr[i] = 0;
      }
      if (fFixAmp[i] == false) {
         fAmpCalc[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fAmpErr[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fAmpCalc[i] = fAmpInit[i];
         fAmpErr[i] = 0;
      }
      if (fFixPositionX[i] == false) {
         fPositionCalcX[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fPositionErrX[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fPositionCalcX[i] = fPositionInitX[i];
         fPositionErrX[i] = 0;
      }
      if (fFixPositionY[i] == false) {
         fPositionCalcY[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fPositionErrY[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fPositionCalcY[i] = fPositionInitY[i];
         fPositionErrY[i] = 0;
      }
      if (fFixAmpX1[i] == false) {
         fAmpCalcX1[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fAmpErrX1[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fAmpCalcX1[i] = fAmpInitX1[i];
         fAmpErrX1[i] = 0;
      }
      if (fFixAmpY1[i] == false) {
         fAmpCalcY1[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fAmpErrY1[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fAmpCalcY1[i] = fAmpInitY1[i];
         fAmpErrY1[i] = 0;
      }
      if (fFixPositionX1[i] == false) {
         fPositionCalcX1[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fPositionErrX1[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fPositionCalcX1[i] = fPositionInitX1[i];
         fPositionErrX1[i] = 0;
      }
      if (fFixPositionY1[i] == false) {
         fPositionCalcY1[i] = working_space[shift + j]; //xk[j]
         if (working_space[3 * shift + j] != 0)
            fPositionErrY1[i] = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
         j += 1;
      }

      else {
         fPositionCalcY1[i] = fPositionInitY1[i];
         fPositionErrY1[i] = 0;
      }
   }
   if (fFixSigmaX == false) {
      fSigmaCalcX = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fSigmaErrX = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fSigmaCalcX = fSigmaInitX;
      fSigmaErrX = 0;
   }
   if (fFixSigmaY == false) {
      fSigmaCalcY = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fSigmaErrY = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fSigmaCalcY = fSigmaInitY;
      fSigmaErrY = 0;
   }
   if (fFixRo == false) {
      fRoCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fRoErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fRoCalc = fRoInit;
      fRoErr = 0;
   }
   if (fFixA0 == false) {
      fA0Calc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fA0Err = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fA0Calc = fA0Init;
      fA0Err = 0;
   }
   if (fFixAx == false) {
      fAxCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fAxErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fAxCalc = fAxInit;
      fAxErr = 0;
   }
   if (fFixAy == false) {
      fAyCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fAyErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fAyCalc = fAyInit;
      fAyErr = 0;
   }
   if (fFixTxy == false) {
      fTxyCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fTxyErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fTxyCalc = fTxyInit;
      fTxyErr = 0;
   }
   if (fFixSxy == false) {
      fSxyCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fSxyErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fSxyCalc = fSxyInit;
      fSxyErr = 0;
   }
   if (fFixTx == false) {
      fTxCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fTxErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fTxCalc = fTxInit;
      fTxErr = 0;
   }
   if (fFixTy == false) {
      fTyCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fTyErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fTyCalc = fTyInit;
      fTyErr = 0;
   }
   if (fFixSx == false) {
      fSxCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fSxErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fSxCalc = fSxInit;
      fSxErr = 0;
   }
   if (fFixSy == false) {
      fSyCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fSyErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fSyCalc = fSyInit;
      fSyErr = 0;
   }
   if (fFixBx == false) {
      fBxCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fBxErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fBxCalc = fBxInit;
      fBxErr = 0;
   }
   if (fFixBy == false) {
      fByCalc = working_space[shift + j]; //xk[j]
      if (working_space[3 * shift + j] != 0) //temp[j]
         fByErr = TMath::Sqrt(TMath::Abs(working_space[2 * shift + j])) / TMath::Sqrt(TMath::Abs(working_space[3 * shift + j])); //der[j]/temp[j]
      j += 1;
   }

   else {
      fByCalc = fByInit;
      fByErr = 0;
   }
   b = (fXmax - fXmin + 1) * (fYmax - fYmin + 1) - size;
   fChi = chi_cel / b;
   for (i1 = fXmin; i1 <= fXmax; i1++) {
      for (i2 = fYmin; i2 <= fYmax; i2++) {
         f = Shape2(fNPeaks, i1, i2,
                     working_space, working_space[peak_vel],
                     working_space[peak_vel + 1],
                     working_space[peak_vel + 2],
                     working_space[peak_vel + 3],
                     working_space[peak_vel + 4],
                     working_space[peak_vel + 5],
                     working_space[peak_vel + 6],
                     working_space[peak_vel + 7],
                     working_space[peak_vel + 8],
                     working_space[peak_vel + 9],
                     working_space[peak_vel + 10],
                     working_space[peak_vel + 11],
                     working_space[peak_vel + 12],
                     working_space[peak_vel + 13]);
         source[i1][i2] = f;

      }
   }
   for (i = 0; i < size; i++) delete [] working_matrix[i];
   delete [] working_matrix;
   delete [] working_space;
   return;
}

void TSpectrum2Fit::SetFitParameters(Int_t xmin,Int_t xmax,Int_t ymin,Int_t ymax, Int_t numberIterations, Double_t alpha, Int_t statisticType, Int_t alphaOptim, Int_t power, Int_t fitTaylor)
{
//////////////////////////////////////////////////////////////////////////////
//   SETTER FUNCTION
//
//   This function sets the following fitting parameters:
//         -xmin, xmax, ymin, ymax - fitting region
//         -numberIterations - # of desired iterations in the fit
//         -alpha - convergence coefficient, it should be positive number and <=1, for details see references
//         -statisticType - type of statistics, possible values kFitOptimChiCounts (chi square statistics with counts as weighting coefficients), kFitOptimChiFuncValues (chi square statistics with function values as weighting coefficients),kFitOptimMaxLikelihood
//         -alphaOptim - optimization of convergence algorithm, possible values kFitAlphaHalving, kFitAlphaOptimal
//         -power - possible values kFitPower2,4,6,8,10,12, for details see references. It applies only for Awmi fitting function.
//         -fitTaylor - order of Taylor expansion, possible values kFitTaylorOrderFirst, kFitTaylorOrderSecond. It applies only for Awmi fitting function.
//////////////////////////////////////////////////////////////////////////////

   if(xmin<0 || xmax <= xmin || ymin<0 || ymax <= ymin){
      Error("SetFitParameters", "Wrong range");
      return;
   }
   if (numberIterations <= 0){
      Error("SetFitParameters","Invalid number of iterations, must be positive");
      return;
   }
   if (alpha <= 0 || alpha > 1){
      Error ("SetFitParameters","Invalid step coefficient alpha, must be > than 0 and <=1");
      return;
   }
   if (statisticType != kFitOptimChiCounts
        && statisticType != kFitOptimChiFuncValues
        && statisticType != kFitOptimMaxLikelihood){
      Error("SetFitParameters","Wrong type of statistic");
      return;
   }
   if (alphaOptim != kFitAlphaHalving
        && alphaOptim != kFitAlphaOptimal){
      Error("SetFitParameters","Wrong optimization algorithm");
      return;
   }
   if (power != kFitPower2 && power != kFitPower4
        && power != kFitPower6 && power != kFitPower8
        && power != kFitPower10 && power != kFitPower12){
      Error("SetFitParameters","Wrong power");
      return;
   }
   if (fitTaylor != kFitTaylorOrderFirst
        && fitTaylor != kFitTaylorOrderSecond){
      Error("SetFitParameters","Wrong order of Taylor development");
      return;
   }
   fXmin=xmin,fXmax=xmax,fYmin=ymin,fYmax=ymax,fNumberIterations=numberIterations,fAlpha=alpha,fStatisticType=statisticType,fAlphaOptim=alphaOptim,fPower=power,fFitTaylor=fitTaylor;
}

//______________________________________________________________________________
void TSpectrum2Fit::SetPeakParameters(Double_t sigmaX, Bool_t fixSigmaX, Double_t sigmaY, Bool_t fixSigmaY, Double_t ro, Bool_t fixRo, const Double_t *positionInitX, const Bool_t *fixPositionX, const Double_t *positionInitY, const Bool_t *fixPositionY, const Double_t *positionInitX1, const Bool_t *fixPositionX1, const Double_t *positionInitY1, const Bool_t *fixPositionY1, const Double_t *ampInit, const Bool_t *fixAmp, const Double_t *ampInitX1, const Bool_t *fixAmpX1, const Double_t *ampInitY1, const Bool_t *fixAmpY1)
{
//////////////////////////////////////////////////////////////////////////////
//   SETTER FUNCTION
//
//   This function sets the following fitting parameters of peaks:
//         -sigmaX - initial value of sigma x parameter
//         -fixSigmaX - logical value of sigma x parameter, which allows to fix the parameter (not to fit)
//         -sigmaY - initial value of sigma y parameter
//         -fixSigmaY - logical value of sigma y parameter, which allows to fix the parameter (not to fit)
//         -ro - initial value of ro parameter (correlation coefficient)
//         -fixRo - logical value of ro parameter, which allows to fix the parameter (not to fit)
//         -positionInitX - aray of initial values of peaks x positions
//         -fixPositionX - array of logical values which allow to fix appropriate x positions (not fit). However they are present in the estimated functional.
//         -positionInitY - aray of initial values of peaks y positions
//         -fixPositionY - array of logical values which allow to fix appropriate y positions (not fit). However they are present in the estimated functional.
//         -ampInit - aray of initial values of  2D peaks amplitudes
//         -fixAmp - aray of logical values which allow to fix appropriate amplitudes of 2D peaks (not fit). However they are present in the estimated functional
//         -ampInitX1 - aray of initial values of amplitudes of  1D ridges in x direction
//         -fixAmpX1 - aray of logical values which allow to fix appropriate amplitudes of 1D ridges in x direction (not fit). However they are present in the estimated functional
//         -ampInitY1 - aray of initial values of amplitudes of  1D ridges in y direction
//         -fixAmpY1 - aray of logical values which allow to fix appropriate amplitudes of 1D ridges in y direction (not fit). However they are present in the estimated functional
//////////////////////////////////////////////////////////////////////////////

   if (sigmaX <= 0 || sigmaY <= 0){
      Error ("SetPeakParameters","Invalid sigma, must be > than 0");
      return;
   }
   if (ro < -1 || ro > 1){
      Error ("SetPeakParameters","Invalid ro, must be from region <-1,1>");
      return;
   }
   Int_t i;
   for(i=0; i < fNPeaks; i++){
      if(positionInitX[i] < fXmin || positionInitX[i] > fXmax){
         Error ("SetPeakParameters","Invalid peak position, must be in the range fXmin, fXmax");
         return;
      }
      if(positionInitY[i] < fYmin || positionInitY[i] > fYmax){
         Error ("SetPeakParameters","Invalid peak position, must be in the range fYmin, fYmax");
         return;
      }
      if(positionInitX1[i] < fXmin || positionInitX1[i] > fXmax){
         Error ("SetPeakParameters","Invalid ridge position, must be in the range fXmin, fXmax");
         return;
      }
      if(positionInitY1[i] < fYmin || positionInitY1[i] > fYmax){
         Error ("SetPeakParameters","Invalid ridge position, must be in the range fYmin, fYmax");
         return;
      }
      if(ampInit[i] < 0){
         Error ("SetPeakParameters","Invalid peak amplitude, must be > than 0");
         return;
      }
      if(ampInitX1[i] < 0){
         Error ("SetPeakParameters","Invalid x ridge amplitude, must be > than 0");
         return;
      }
      if(ampInitY1[i] < 0){
         Error ("SetPeakParameters","Invalid y ridge amplitude, must be > than 0");
         return;
      }
   }
   fSigmaInitX = sigmaX, fFixSigmaX = fixSigmaX, fSigmaInitY = sigmaY, fFixSigmaY = fixSigmaY, fRoInit = ro, fFixRo = fixRo;
   for(i=0; i < fNPeaks; i++){
      fPositionInitX[i] = positionInitX[i];
      fFixPositionX[i] = fixPositionX[i];
      fPositionInitY[i] = positionInitY[i];
      fFixPositionY[i] = fixPositionY[i];
      fPositionInitX1[i] = positionInitX1[i];
      fFixPositionX1[i] = fixPositionX1[i];
      fPositionInitY1[i] = positionInitY1[i];
      fFixPositionY1[i] = fixPositionY1[i];
      fAmpInit[i] = ampInit[i];
      fFixAmp[i] = fixAmp[i];
      fAmpInitX1[i] = ampInitX1[i];
      fFixAmpX1[i] = fixAmpX1[i];
      fAmpInitY1[i] = ampInitY1[i];
      fFixAmpY1[i] = fixAmpY1[i];
   }
}

//______________________________________________________________________________
void TSpectrum2Fit::SetBackgroundParameters(Double_t a0Init, Bool_t fixA0, Double_t axInit, Bool_t fixAx, Double_t ayInit, Bool_t fixAy)
{
//////////////////////////////////////////////////////////////////////////////
//   SETTER FUNCTION
//
//   This function sets the following fitting parameters of background:
//         -a0Init - initial value of a0 parameter (backgroud is estimated as a0+ax*x+ay*y)
//         -fixA0 - logical value of a0 parameter, which allows to fix the parameter (not to fit)
//         -axInit - initial value of ax parameter
//         -fixAx - logical value of ax parameter, which allows to fix the parameter (not to fit)
//         -ayInit - initial value of ay parameter
//         -fixAy - logical value of ay parameter, which allows to fix the parameter (not to fit)
//////////////////////////////////////////////////////////////////////////////

   fA0Init = a0Init;
   fFixA0 = fixA0;
   fAxInit = axInit;
   fFixAx = fixAx;
   fAyInit = ayInit;
   fFixAy = fixAy;
}

//______________________________________________________________________________
void TSpectrum2Fit::SetTailParameters(Double_t tInitXY, Bool_t fixTxy, Double_t tInitX, Bool_t fixTx, Double_t tInitY, Bool_t fixTy, Double_t bInitX, Bool_t fixBx, Double_t bInitY, Bool_t fixBy, Double_t sInitXY, Bool_t fixSxy, Double_t sInitX, Bool_t fixSx, Double_t sInitY, Bool_t fixSy)
{
//////////////////////////////////////////////////////////////////////////////
//   SETTER FUNCTION
//
//   This function sets the following fitting parameters of tails of peaks
//         -tInitXY - initial value of txy parameter
//         -fixTxy - logical value of txy parameter, which allows to fix the parameter (not to fit)
//         -tInitX - initial value of tx parameter
//         -fixTx - logical value of tx parameter, which allows to fix the parameter (not to fit)
//         -tInitY - initial value of ty parameter
//         -fixTy - logical value of ty parameter, which allows to fix the parameter (not to fit)
//         -bInitX - initial value of bx parameter
//         -fixBx - logical value of bx parameter, which allows to fix the parameter (not to fit)
//         -bInitY - initial value of by parameter
//         -fixBy - logical value of by parameter, which allows to fix the parameter (not to fit)
//         -sInitXY - initial value of sxy parameter
//         -fixSxy - logical value of sxy parameter, which allows to fix the parameter (not to fit)
//         -sInitX - initial value of sx parameter
//         -fixSx - logical value of sx parameter, which allows to fix the parameter (not to fit)
//         -sInitY - initial value of sy parameter
//         -fixSy - logical value of sy parameter, which allows to fix the parameter (not to fit)
//////////////////////////////////////////////////////////////////////////////
   fTxyInit = tInitXY;
   fFixTxy = fixTxy;
   fTxInit = tInitX;
   fFixTx = fixTx;
   fTyInit = tInitY;
   fFixTy = fixTy;
   fBxInit = bInitX;
   fFixBx = fixBx;
   fByInit = bInitY;
   fFixBy = fixBy;
   fSxyInit = sInitXY;
   fFixSxy = fixSxy;
   fSxInit = sInitX;
   fFixSx = fixSx;
   fSyInit = sInitY;
   fFixSy = fixSy;
}

//______________________________________________________________________________
void TSpectrum2Fit::GetPositions(Double_t *positionsX, Double_t *positionsY, Double_t *positionsX1, Double_t *positionsY1)
{
//////////////////////////////////////////////////////////////////////////////
//   GETTER FUNCTION
//
//   This function gets the positions of fitted 2D peaks and 1D ridges
//         -positionX - gets vector of x positions of 2D peaks
//         -positionY - gets vector of y positions of 2D peaks
//         -positionX1 - gets vector of x positions of 1D ridges
//         -positionY1 - gets vector of y positions of 1D ridges
//////////////////////////////////////////////////////////////////////////////
   for( Int_t i=0; i < fNPeaks; i++){
      positionsX[i]  = fPositionCalcX[i];
      positionsY[i]  = fPositionCalcY[i];
      positionsX1[i] = fPositionCalcX1[i];
      positionsY1[i] = fPositionCalcY1[i];
   }
}

//______________________________________________________________________________
void TSpectrum2Fit::GetPositionErrors(Double_t *positionErrorsX, Double_t *positionErrorsY, Double_t *positionErrorsX1, Double_t *positionErrorsY1)
{
//////////////////////////////////////////////////////////////////////////////
//   GETTER FUNCTION
//
//   This function gets the errors of positions of fitted 2D peaks and 1D ridges
//         -positionErrorsX - gets vector of errors of x positions of 2D peaks
//         -positionErrorsY - gets vector of errors of y positions of 2D peaks
//         -positionErrorsX1 - gets vector of errors of x positions of 1D ridges
//         -positionErrorsY1 - gets vector of errors of y positions of 1D ridges
//////////////////////////////////////////////////////////////////////////////

   for( Int_t i=0; i < fNPeaks; i++){
      positionErrorsX[i] = fPositionErrX[i];
      positionErrorsY[i] = fPositionErrY[i];
      positionErrorsX1[i] = fPositionErrX1[i];
      positionErrorsY1[i] = fPositionErrY1[i];
   }
}

//______________________________________________________________________________
void TSpectrum2Fit::GetAmplitudes(Double_t *amplitudes, Double_t *amplitudesX1, Double_t *amplitudesY1)
{
//////////////////////////////////////////////////////////////////////////////
//   GETTER FUNCTION
//
//   This function gets the amplitudes of fitted 2D peaks and 1D ridges
//         -amplitudes - gets vector of amplitudes of 2D peaks
//         -amplitudesX1 - gets vector of amplitudes of 1D ridges in x direction
//         -amplitudesY1 - gets vector of amplitudes of 1D ridges in y direction
//////////////////////////////////////////////////////////////////////////////

   for( Int_t i=0; i < fNPeaks; i++){
      amplitudes[i] = fAmpCalc[i];
      amplitudesX1[i] = fAmpCalcX1[i];
      amplitudesY1[i] = fAmpCalcY1[i];
   }
}

//______________________________________________________________________________
void TSpectrum2Fit::GetAmplitudeErrors(Double_t *amplitudeErrors, Double_t *amplitudeErrorsX1, Double_t *amplitudeErrorsY1)
{
//////////////////////////////////////////////////////////////////////////////
//   GETTER FUNCTION
//
//   This function gets the amplitudes of fitted 2D peaks and 1D ridges
//         -amplitudeErrors - gets vector of amplitudes errors of 2D peaks
//         -amplitudeErrorsX1 - gets vector of amplitudes errors of 1D ridges in x direction
//         -amplitudesErrorY1 - gets vector of amplitudes errors of 1D ridges in y direction
//////////////////////////////////////////////////////////////////////////////

   for( Int_t i=0; i < fNPeaks; i++){
      amplitudeErrors[i] = fAmpErr[i];
      amplitudeErrorsX1[i] = fAmpErrX1[i];
      amplitudeErrorsY1[i] = fAmpErrY1[i];
   }
}

//______________________________________________________________________________
void TSpectrum2Fit::GetVolumes(Double_t *volumes)
{
//////////////////////////////////////////////////////////////////////////////
//   GETTER FUNCTION
//
//   This function gets the volumes of fitted 2D peaks
//         -volumes - gets vector of volumes of 2D peaks
//////////////////////////////////////////////////////////////////////////////
   for( Int_t i=0; i < fNPeaks; i++){
      volumes[i] = fVolume[i];
   }
}

//______________________________________________________________________________
void TSpectrum2Fit::GetVolumeErrors(Double_t *volumeErrors)
{
//////////////////////////////////////////////////////////////////////////////
//   GETTER FUNCTION
//
//   This function gets errors of the volumes of fitted 2D peaks
//         -volumeErrors - gets vector of volumes errors of 2D peaks
//////////////////////////////////////////////////////////////////////////////
   for( Int_t i=0; i < fNPeaks; i++){
      volumeErrors[i] = fVolumeErr[i];
   }
}

//______________________________________________________________________________
void TSpectrum2Fit::GetSigmaX(Double_t &sigmaX, Double_t &sigmaErrX)
{
//////////////////////////////////////////////////////////////////////////////
//   GETTER FUNCTION
//
//   This function gets the sigma x parameter and its error
//         -sigmaX - gets the fitted value of sigma x parameter
//         -sigmaErrX - gets error value of sigma x parameter
//////////////////////////////////////////////////////////////////////////////
   sigmaX=fSigmaCalcX;
   sigmaErrX=fSigmaErrX;
}

//______________________________________________________________________________
void TSpectrum2Fit::GetSigmaY(Double_t &sigmaY, Double_t &sigmaErrY)
{
//////////////////////////////////////////////////////////////////////////////
//   GETTER FUNCTION
//
//   This function gets the sigma y parameter and its error
//         -sigmaY - gets the fitted value of sigma y parameter
//         -sigmaErrY - gets error value of sigma y parameter
//////////////////////////////////////////////////////////////////////////////
   sigmaY=fSigmaCalcY;
   sigmaErrY=fSigmaErrY;
}

//______________________________________________________________________________
void TSpectrum2Fit::GetRo(Double_t &ro, Double_t &roErr)
{
//////////////////////////////////////////////////////////////////////////////
//   GETTER FUNCTION
//
//   This function gets the ro parameter and its error
//         -ro - gets the fitted value of ro parameter
//         -roErr - gets error value of ro parameter
//////////////////////////////////////////////////////////////////////////////
   ro=fRoCalc;
   roErr=fRoErr;
}

//______________________________________________________________________________
void TSpectrum2Fit::GetBackgroundParameters(Double_t &a0, Double_t &a0Err, Double_t &ax, Double_t &axErr, Double_t &ay, Double_t &ayErr)
{
//////////////////////////////////////////////////////////////////////////////
//   GETTER FUNCTION
//
//   This function gets the background parameters and their errors
//         -a0 - gets the fitted value of a0 parameter
//         -a0Err - gets error value of a0 parameter
//         -ax - gets the fitted value of ax parameter
//         -axErr - gets error value of ax parameter
//         -ay - gets the fitted value of ay parameter
//         -ayErr - gets error value of ay parameter
//////////////////////////////////////////////////////////////////////////////

   a0 = fA0Calc;
   a0Err = fA0Err;
   ax = fAxCalc;
   axErr = fAxErr;
   ay = fAyCalc;
   ayErr = fAyErr;
}

//______________________________________________________________________________
void TSpectrum2Fit::GetTailParameters(Double_t &txy, Double_t &txyErr, Double_t &tx, Double_t &txErr, Double_t &ty, Double_t &tyErr, Double_t &bx, Double_t &bxErr, Double_t &by, Double_t &byErr, Double_t &sxy, Double_t &sxyErr, Double_t &sx, Double_t &sxErr, Double_t &sy, Double_t &syErr)
{
//////////////////////////////////////////////////////////////////////////////
//   GETTER FUNCTION
//
//   This function gets the tail parameters and their errors
//         -txy - gets the fitted value of txy parameter
//         -txyErr - gets error value of txy parameter
//         -tx - gets the fitted value of tx parameter
//         -txErr - gets error value of tx parameter
//         -ty - gets the fitted value of ty parameter
//         -tyErr - gets error value of ty parameter
//         -bx - gets the fitted value of bx parameter
//         -bxErr - gets error value of bx parameter
//         -by - gets the fitted value of by parameter
//         -byErr - gets error value of by parameter
//         -sxy - gets the fitted value of sxy parameter
//         -sxyErr - gets error value of sxy parameter
//         -sx - gets the fitted value of sx parameter
//         -sxErr - gets error value of sx parameter
//         -sy - gets the fitted value of sy parameter
//         -syErr - gets error value of sy parameter
//////////////////////////////////////////////////////////////////////////////
   txy = fTxyCalc;
   txyErr = fTxyErr;
   tx = fTxCalc;
   txErr = fTxErr;
   ty = fTyCalc;
   tyErr = fTyErr;
   bx = fBxCalc;
   bxErr = fBxErr;
   by = fByCalc;
   byErr = fByErr;
   sxy = fSxyCalc;
   sxyErr = fSxyErr;
   sx = fSxCalc;
   sxErr = fSxErr;
   sy = fSyCalc;
   syErr = fSyErr;
}

 TSpectrum2Fit.cxx:1
 TSpectrum2Fit.cxx:2
 TSpectrum2Fit.cxx:3
 TSpectrum2Fit.cxx:4
 TSpectrum2Fit.cxx:5
 TSpectrum2Fit.cxx:6
 TSpectrum2Fit.cxx:7
 TSpectrum2Fit.cxx:8
 TSpectrum2Fit.cxx:9
 TSpectrum2Fit.cxx:10
 TSpectrum2Fit.cxx:11
 TSpectrum2Fit.cxx:12
 TSpectrum2Fit.cxx:13
 TSpectrum2Fit.cxx:14
 TSpectrum2Fit.cxx:15
 TSpectrum2Fit.cxx:16
 TSpectrum2Fit.cxx:17
 TSpectrum2Fit.cxx:18
 TSpectrum2Fit.cxx:19
 TSpectrum2Fit.cxx:20
 TSpectrum2Fit.cxx:21
 TSpectrum2Fit.cxx:22
 TSpectrum2Fit.cxx:23
 TSpectrum2Fit.cxx:24
 TSpectrum2Fit.cxx:25
 TSpectrum2Fit.cxx:26
 TSpectrum2Fit.cxx:27
 TSpectrum2Fit.cxx:28
 TSpectrum2Fit.cxx:29
 TSpectrum2Fit.cxx:30
 TSpectrum2Fit.cxx:31
 TSpectrum2Fit.cxx:32
 TSpectrum2Fit.cxx:33
 TSpectrum2Fit.cxx:34
 TSpectrum2Fit.cxx:35
 TSpectrum2Fit.cxx:36
 TSpectrum2Fit.cxx:37
 TSpectrum2Fit.cxx:38
 TSpectrum2Fit.cxx:39
 TSpectrum2Fit.cxx:40
 TSpectrum2Fit.cxx:41
 TSpectrum2Fit.cxx:42
 TSpectrum2Fit.cxx:43
 TSpectrum2Fit.cxx:44
 TSpectrum2Fit.cxx:45
 TSpectrum2Fit.cxx:46
 TSpectrum2Fit.cxx:47
 TSpectrum2Fit.cxx:48
 TSpectrum2Fit.cxx:49
 TSpectrum2Fit.cxx:50
 TSpectrum2Fit.cxx:51
 TSpectrum2Fit.cxx:52
 TSpectrum2Fit.cxx:53
 TSpectrum2Fit.cxx:54
 TSpectrum2Fit.cxx:55
 TSpectrum2Fit.cxx:56
 TSpectrum2Fit.cxx:57
 TSpectrum2Fit.cxx:58
 TSpectrum2Fit.cxx:59
 TSpectrum2Fit.cxx:60
 TSpectrum2Fit.cxx:61
 TSpectrum2Fit.cxx:62
 TSpectrum2Fit.cxx:63
 TSpectrum2Fit.cxx:64
 TSpectrum2Fit.cxx:65
 TSpectrum2Fit.cxx:66
 TSpectrum2Fit.cxx:67
 TSpectrum2Fit.cxx:68
 TSpectrum2Fit.cxx:69
 TSpectrum2Fit.cxx:70
 TSpectrum2Fit.cxx:71
 TSpectrum2Fit.cxx:72
 TSpectrum2Fit.cxx:73
 TSpectrum2Fit.cxx:74
 TSpectrum2Fit.cxx:75
 TSpectrum2Fit.cxx:76
 TSpectrum2Fit.cxx:77
 TSpectrum2Fit.cxx:78
 TSpectrum2Fit.cxx:79
 TSpectrum2Fit.cxx:80
 TSpectrum2Fit.cxx:81
 TSpectrum2Fit.cxx:82
 TSpectrum2Fit.cxx:83
 TSpectrum2Fit.cxx:84
 TSpectrum2Fit.cxx:85
 TSpectrum2Fit.cxx:86
 TSpectrum2Fit.cxx:87
 TSpectrum2Fit.cxx:88
 TSpectrum2Fit.cxx:89
 TSpectrum2Fit.cxx:90
 TSpectrum2Fit.cxx:91
 TSpectrum2Fit.cxx:92
 TSpectrum2Fit.cxx:93
 TSpectrum2Fit.cxx:94
 TSpectrum2Fit.cxx:95
 TSpectrum2Fit.cxx:96
 TSpectrum2Fit.cxx:97
 TSpectrum2Fit.cxx:98
 TSpectrum2Fit.cxx:99
 TSpectrum2Fit.cxx:100
 TSpectrum2Fit.cxx:101
 TSpectrum2Fit.cxx:102
 TSpectrum2Fit.cxx:103
 TSpectrum2Fit.cxx:104
 TSpectrum2Fit.cxx:105
 TSpectrum2Fit.cxx:106
 TSpectrum2Fit.cxx:107
 TSpectrum2Fit.cxx:108
 TSpectrum2Fit.cxx:109
 TSpectrum2Fit.cxx:110
 TSpectrum2Fit.cxx:111
 TSpectrum2Fit.cxx:112
 TSpectrum2Fit.cxx:113
 TSpectrum2Fit.cxx:114
 TSpectrum2Fit.cxx:115
 TSpectrum2Fit.cxx:116
 TSpectrum2Fit.cxx:117
 TSpectrum2Fit.cxx:118
 TSpectrum2Fit.cxx:119
 TSpectrum2Fit.cxx:120
 TSpectrum2Fit.cxx:121
 TSpectrum2Fit.cxx:122
 TSpectrum2Fit.cxx:123
 TSpectrum2Fit.cxx:124
 TSpectrum2Fit.cxx:125
 TSpectrum2Fit.cxx:126
 TSpectrum2Fit.cxx:127
 TSpectrum2Fit.cxx:128
 TSpectrum2Fit.cxx:129
 TSpectrum2Fit.cxx:130
 TSpectrum2Fit.cxx:131
 TSpectrum2Fit.cxx:132
 TSpectrum2Fit.cxx:133
 TSpectrum2Fit.cxx:134
 TSpectrum2Fit.cxx:135
 TSpectrum2Fit.cxx:136
 TSpectrum2Fit.cxx:137
 TSpectrum2Fit.cxx:138
 TSpectrum2Fit.cxx:139
 TSpectrum2Fit.cxx:140
 TSpectrum2Fit.cxx:141
 TSpectrum2Fit.cxx:142
 TSpectrum2Fit.cxx:143
 TSpectrum2Fit.cxx:144
 TSpectrum2Fit.cxx:145
 TSpectrum2Fit.cxx:146
 TSpectrum2Fit.cxx:147
 TSpectrum2Fit.cxx:148
 TSpectrum2Fit.cxx:149
 TSpectrum2Fit.cxx:150
 TSpectrum2Fit.cxx:151
 TSpectrum2Fit.cxx:152
 TSpectrum2Fit.cxx:153
 TSpectrum2Fit.cxx:154
 TSpectrum2Fit.cxx:155
 TSpectrum2Fit.cxx:156
 TSpectrum2Fit.cxx:157
 TSpectrum2Fit.cxx:158
 TSpectrum2Fit.cxx:159
 TSpectrum2Fit.cxx:160
 TSpectrum2Fit.cxx:161
 TSpectrum2Fit.cxx:162
 TSpectrum2Fit.cxx:163
 TSpectrum2Fit.cxx:164
 TSpectrum2Fit.cxx:165
 TSpectrum2Fit.cxx:166
 TSpectrum2Fit.cxx:167
 TSpectrum2Fit.cxx:168
 TSpectrum2Fit.cxx:169
 TSpectrum2Fit.cxx:170
 TSpectrum2Fit.cxx:171
 TSpectrum2Fit.cxx:172
 TSpectrum2Fit.cxx:173
 TSpectrum2Fit.cxx:174
 TSpectrum2Fit.cxx:175
 TSpectrum2Fit.cxx:176
 TSpectrum2Fit.cxx:177
 TSpectrum2Fit.cxx:178
 TSpectrum2Fit.cxx:179
 TSpectrum2Fit.cxx:180
 TSpectrum2Fit.cxx:181
 TSpectrum2Fit.cxx:182
 TSpectrum2Fit.cxx:183
 TSpectrum2Fit.cxx:184
 TSpectrum2Fit.cxx:185
 TSpectrum2Fit.cxx:186
 TSpectrum2Fit.cxx:187
 TSpectrum2Fit.cxx:188
 TSpectrum2Fit.cxx:189
 TSpectrum2Fit.cxx:190
 TSpectrum2Fit.cxx:191
 TSpectrum2Fit.cxx:192
 TSpectrum2Fit.cxx:193
 TSpectrum2Fit.cxx:194
 TSpectrum2Fit.cxx:195
 TSpectrum2Fit.cxx:196
 TSpectrum2Fit.cxx:197
 TSpectrum2Fit.cxx:198
 TSpectrum2Fit.cxx:199
 TSpectrum2Fit.cxx:200
 TSpectrum2Fit.cxx:201
 TSpectrum2Fit.cxx:202
 TSpectrum2Fit.cxx:203
 TSpectrum2Fit.cxx:204
 TSpectrum2Fit.cxx:205
 TSpectrum2Fit.cxx:206
 TSpectrum2Fit.cxx:207
 TSpectrum2Fit.cxx:208
 TSpectrum2Fit.cxx:209
 TSpectrum2Fit.cxx:210
 TSpectrum2Fit.cxx:211
 TSpectrum2Fit.cxx:212
 TSpectrum2Fit.cxx:213
 TSpectrum2Fit.cxx:214
 TSpectrum2Fit.cxx:215
 TSpectrum2Fit.cxx:216
 TSpectrum2Fit.cxx:217
 TSpectrum2Fit.cxx:218
 TSpectrum2Fit.cxx:219
 TSpectrum2Fit.cxx:220
 TSpectrum2Fit.cxx:221
 TSpectrum2Fit.cxx:222
 TSpectrum2Fit.cxx:223
 TSpectrum2Fit.cxx:224
 TSpectrum2Fit.cxx:225
 TSpectrum2Fit.cxx:226
 TSpectrum2Fit.cxx:227
 TSpectrum2Fit.cxx:228
 TSpectrum2Fit.cxx:229
 TSpectrum2Fit.cxx:230
 TSpectrum2Fit.cxx:231
 TSpectrum2Fit.cxx:232
 TSpectrum2Fit.cxx:233
 TSpectrum2Fit.cxx:234
 TSpectrum2Fit.cxx:235
 TSpectrum2Fit.cxx:236
 TSpectrum2Fit.cxx:237
 TSpectrum2Fit.cxx:238
 TSpectrum2Fit.cxx:239
 TSpectrum2Fit.cxx:240
 TSpectrum2Fit.cxx:241
 TSpectrum2Fit.cxx:242
 TSpectrum2Fit.cxx:243
 TSpectrum2Fit.cxx:244
 TSpectrum2Fit.cxx:245
 TSpectrum2Fit.cxx:246
 TSpectrum2Fit.cxx:247
 TSpectrum2Fit.cxx:248
 TSpectrum2Fit.cxx:249
 TSpectrum2Fit.cxx:250
 TSpectrum2Fit.cxx:251
 TSpectrum2Fit.cxx:252
 TSpectrum2Fit.cxx:253
 TSpectrum2Fit.cxx:254
 TSpectrum2Fit.cxx:255
 TSpectrum2Fit.cxx:256
 TSpectrum2Fit.cxx:257
 TSpectrum2Fit.cxx:258
 TSpectrum2Fit.cxx:259
 TSpectrum2Fit.cxx:260
 TSpectrum2Fit.cxx:261
 TSpectrum2Fit.cxx:262
 TSpectrum2Fit.cxx:263
 TSpectrum2Fit.cxx:264
 TSpectrum2Fit.cxx:265
 TSpectrum2Fit.cxx:266
 TSpectrum2Fit.cxx:267
 TSpectrum2Fit.cxx:268
 TSpectrum2Fit.cxx:269
 TSpectrum2Fit.cxx:270
 TSpectrum2Fit.cxx:271
 TSpectrum2Fit.cxx:272
 TSpectrum2Fit.cxx:273
 TSpectrum2Fit.cxx:274
 TSpectrum2Fit.cxx:275
 TSpectrum2Fit.cxx:276
 TSpectrum2Fit.cxx:277
 TSpectrum2Fit.cxx:278
 TSpectrum2Fit.cxx:279
 TSpectrum2Fit.cxx:280
 TSpectrum2Fit.cxx:281
 TSpectrum2Fit.cxx:282
 TSpectrum2Fit.cxx:283
 TSpectrum2Fit.cxx:284
 TSpectrum2Fit.cxx:285
 TSpectrum2Fit.cxx:286
 TSpectrum2Fit.cxx:287
 TSpectrum2Fit.cxx:288
 TSpectrum2Fit.cxx:289
 TSpectrum2Fit.cxx:290
 TSpectrum2Fit.cxx:291
 TSpectrum2Fit.cxx:292
 TSpectrum2Fit.cxx:293
 TSpectrum2Fit.cxx:294
 TSpectrum2Fit.cxx:295
 TSpectrum2Fit.cxx:296
 TSpectrum2Fit.cxx:297
 TSpectrum2Fit.cxx:298
 TSpectrum2Fit.cxx:299
 TSpectrum2Fit.cxx:300
 TSpectrum2Fit.cxx:301
 TSpectrum2Fit.cxx:302
 TSpectrum2Fit.cxx:303
 TSpectrum2Fit.cxx:304
 TSpectrum2Fit.cxx:305
 TSpectrum2Fit.cxx:306
 TSpectrum2Fit.cxx:307
 TSpectrum2Fit.cxx:308
 TSpectrum2Fit.cxx:309
 TSpectrum2Fit.cxx:310
 TSpectrum2Fit.cxx:311
 TSpectrum2Fit.cxx:312
 TSpectrum2Fit.cxx:313
 TSpectrum2Fit.cxx:314
 TSpectrum2Fit.cxx:315
 TSpectrum2Fit.cxx:316
 TSpectrum2Fit.cxx:317
 TSpectrum2Fit.cxx:318
 TSpectrum2Fit.cxx:319
 TSpectrum2Fit.cxx:320
 TSpectrum2Fit.cxx:321
 TSpectrum2Fit.cxx:322
 TSpectrum2Fit.cxx:323
 TSpectrum2Fit.cxx:324
 TSpectrum2Fit.cxx:325
 TSpectrum2Fit.cxx:326
 TSpectrum2Fit.cxx:327
 TSpectrum2Fit.cxx:328
 TSpectrum2Fit.cxx:329
 TSpectrum2Fit.cxx:330
 TSpectrum2Fit.cxx:331
 TSpectrum2Fit.cxx:332
 TSpectrum2Fit.cxx:333
 TSpectrum2Fit.cxx:334
 TSpectrum2Fit.cxx:335
 TSpectrum2Fit.cxx:336
 TSpectrum2Fit.cxx:337
 TSpectrum2Fit.cxx:338
 TSpectrum2Fit.cxx:339
 TSpectrum2Fit.cxx:340
 TSpectrum2Fit.cxx:341
 TSpectrum2Fit.cxx:342
 TSpectrum2Fit.cxx:343
 TSpectrum2Fit.cxx:344
 TSpectrum2Fit.cxx:345
 TSpectrum2Fit.cxx:346
 TSpectrum2Fit.cxx:347
 TSpectrum2Fit.cxx:348
 TSpectrum2Fit.cxx:349
 TSpectrum2Fit.cxx:350
 TSpectrum2Fit.cxx:351
 TSpectrum2Fit.cxx:352
 TSpectrum2Fit.cxx:353
 TSpectrum2Fit.cxx:354
 TSpectrum2Fit.cxx:355
 TSpectrum2Fit.cxx:356
 TSpectrum2Fit.cxx:357
 TSpectrum2Fit.cxx:358
 TSpectrum2Fit.cxx:359
 TSpectrum2Fit.cxx:360
 TSpectrum2Fit.cxx:361
 TSpectrum2Fit.cxx:362
 TSpectrum2Fit.cxx:363
 TSpectrum2Fit.cxx:364
 TSpectrum2Fit.cxx:365
 TSpectrum2Fit.cxx:366
 TSpectrum2Fit.cxx:367
 TSpectrum2Fit.cxx:368
 TSpectrum2Fit.cxx:369
 TSpectrum2Fit.cxx:370
 TSpectrum2Fit.cxx:371
 TSpectrum2Fit.cxx:372
 TSpectrum2Fit.cxx:373
 TSpectrum2Fit.cxx:374
 TSpectrum2Fit.cxx:375
 TSpectrum2Fit.cxx:376
 TSpectrum2Fit.cxx:377
 TSpectrum2Fit.cxx:378
 TSpectrum2Fit.cxx:379
 TSpectrum2Fit.cxx:380
 TSpectrum2Fit.cxx:381
 TSpectrum2Fit.cxx:382
 TSpectrum2Fit.cxx:383
 TSpectrum2Fit.cxx:384
 TSpectrum2Fit.cxx:385
 TSpectrum2Fit.cxx:386
 TSpectrum2Fit.cxx:387
 TSpectrum2Fit.cxx:388
 TSpectrum2Fit.cxx:389
 TSpectrum2Fit.cxx:390
 TSpectrum2Fit.cxx:391
 TSpectrum2Fit.cxx:392
 TSpectrum2Fit.cxx:393
 TSpectrum2Fit.cxx:394
 TSpectrum2Fit.cxx:395
 TSpectrum2Fit.cxx:396
 TSpectrum2Fit.cxx:397
 TSpectrum2Fit.cxx:398
 TSpectrum2Fit.cxx:399
 TSpectrum2Fit.cxx:400
 TSpectrum2Fit.cxx:401
 TSpectrum2Fit.cxx:402
 TSpectrum2Fit.cxx:403
 TSpectrum2Fit.cxx:404
 TSpectrum2Fit.cxx:405
 TSpectrum2Fit.cxx:406
 TSpectrum2Fit.cxx:407
 TSpectrum2Fit.cxx:408
 TSpectrum2Fit.cxx:409
 TSpectrum2Fit.cxx:410
 TSpectrum2Fit.cxx:411
 TSpectrum2Fit.cxx:412
 TSpectrum2Fit.cxx:413
 TSpectrum2Fit.cxx:414
 TSpectrum2Fit.cxx:415
 TSpectrum2Fit.cxx:416
 TSpectrum2Fit.cxx:417
 TSpectrum2Fit.cxx:418
 TSpectrum2Fit.cxx:419
 TSpectrum2Fit.cxx:420
 TSpectrum2Fit.cxx:421
 TSpectrum2Fit.cxx:422
 TSpectrum2Fit.cxx:423
 TSpectrum2Fit.cxx:424
 TSpectrum2Fit.cxx:425
 TSpectrum2Fit.cxx:426
 TSpectrum2Fit.cxx:427
 TSpectrum2Fit.cxx:428
 TSpectrum2Fit.cxx:429
 TSpectrum2Fit.cxx:430
 TSpectrum2Fit.cxx:431
 TSpectrum2Fit.cxx:432
 TSpectrum2Fit.cxx:433
 TSpectrum2Fit.cxx:434
 TSpectrum2Fit.cxx:435
 TSpectrum2Fit.cxx:436
 TSpectrum2Fit.cxx:437
 TSpectrum2Fit.cxx:438
 TSpectrum2Fit.cxx:439
 TSpectrum2Fit.cxx:440
 TSpectrum2Fit.cxx:441
 TSpectrum2Fit.cxx:442
 TSpectrum2Fit.cxx:443
 TSpectrum2Fit.cxx:444
 TSpectrum2Fit.cxx:445
 TSpectrum2Fit.cxx:446
 TSpectrum2Fit.cxx:447
 TSpectrum2Fit.cxx:448
 TSpectrum2Fit.cxx:449
 TSpectrum2Fit.cxx:450
 TSpectrum2Fit.cxx:451
 TSpectrum2Fit.cxx:452
 TSpectrum2Fit.cxx:453
 TSpectrum2Fit.cxx:454
 TSpectrum2Fit.cxx:455
 TSpectrum2Fit.cxx:456
 TSpectrum2Fit.cxx:457
 TSpectrum2Fit.cxx:458
 TSpectrum2Fit.cxx:459
 TSpectrum2Fit.cxx:460
 TSpectrum2Fit.cxx:461
 TSpectrum2Fit.cxx:462
 TSpectrum2Fit.cxx:463
 TSpectrum2Fit.cxx:464
 TSpectrum2Fit.cxx:465
 TSpectrum2Fit.cxx:466
 TSpectrum2Fit.cxx:467
 TSpectrum2Fit.cxx:468
 TSpectrum2Fit.cxx:469
 TSpectrum2Fit.cxx:470
 TSpectrum2Fit.cxx:471
 TSpectrum2Fit.cxx:472
 TSpectrum2Fit.cxx:473
 TSpectrum2Fit.cxx:474
 TSpectrum2Fit.cxx:475
 TSpectrum2Fit.cxx:476
 TSpectrum2Fit.cxx:477
 TSpectrum2Fit.cxx:478
 TSpectrum2Fit.cxx:479
 TSpectrum2Fit.cxx:480
 TSpectrum2Fit.cxx:481
 TSpectrum2Fit.cxx:482
 TSpectrum2Fit.cxx:483
 TSpectrum2Fit.cxx:484
 TSpectrum2Fit.cxx:485
 TSpectrum2Fit.cxx:486
 TSpectrum2Fit.cxx:487
 TSpectrum2Fit.cxx:488
 TSpectrum2Fit.cxx:489
 TSpectrum2Fit.cxx:490
 TSpectrum2Fit.cxx:491
 TSpectrum2Fit.cxx:492
 TSpectrum2Fit.cxx:493
 TSpectrum2Fit.cxx:494
 TSpectrum2Fit.cxx:495
 TSpectrum2Fit.cxx:496
 TSpectrum2Fit.cxx:497
 TSpectrum2Fit.cxx:498
 TSpectrum2Fit.cxx:499
 TSpectrum2Fit.cxx:500
 TSpectrum2Fit.cxx:501
 TSpectrum2Fit.cxx:502
 TSpectrum2Fit.cxx:503
 TSpectrum2Fit.cxx:504
 TSpectrum2Fit.cxx:505
 TSpectrum2Fit.cxx:506
 TSpectrum2Fit.cxx:507
 TSpectrum2Fit.cxx:508
 TSpectrum2Fit.cxx:509
 TSpectrum2Fit.cxx:510
 TSpectrum2Fit.cxx:511
 TSpectrum2Fit.cxx:512
 TSpectrum2Fit.cxx:513
 TSpectrum2Fit.cxx:514
 TSpectrum2Fit.cxx:515
 TSpectrum2Fit.cxx:516
 TSpectrum2Fit.cxx:517
 TSpectrum2Fit.cxx:518
 TSpectrum2Fit.cxx:519
 TSpectrum2Fit.cxx:520
 TSpectrum2Fit.cxx:521
 TSpectrum2Fit.cxx:522
 TSpectrum2Fit.cxx:523
 TSpectrum2Fit.cxx:524
 TSpectrum2Fit.cxx:525
 TSpectrum2Fit.cxx:526
 TSpectrum2Fit.cxx:527
 TSpectrum2Fit.cxx:528
 TSpectrum2Fit.cxx:529
 TSpectrum2Fit.cxx:530
 TSpectrum2Fit.cxx:531
 TSpectrum2Fit.cxx:532
 TSpectrum2Fit.cxx:533
 TSpectrum2Fit.cxx:534
 TSpectrum2Fit.cxx:535
 TSpectrum2Fit.cxx:536
 TSpectrum2Fit.cxx:537
 TSpectrum2Fit.cxx:538
 TSpectrum2Fit.cxx:539
 TSpectrum2Fit.cxx:540
 TSpectrum2Fit.cxx:541
 TSpectrum2Fit.cxx:542
 TSpectrum2Fit.cxx:543
 TSpectrum2Fit.cxx:544
 TSpectrum2Fit.cxx:545
 TSpectrum2Fit.cxx:546
 TSpectrum2Fit.cxx:547
 TSpectrum2Fit.cxx:548
 TSpectrum2Fit.cxx:549
 TSpectrum2Fit.cxx:550
 TSpectrum2Fit.cxx:551
 TSpectrum2Fit.cxx:552
 TSpectrum2Fit.cxx:553
 TSpectrum2Fit.cxx:554
 TSpectrum2Fit.cxx:555
 TSpectrum2Fit.cxx:556
 TSpectrum2Fit.cxx:557
 TSpectrum2Fit.cxx:558
 TSpectrum2Fit.cxx:559
 TSpectrum2Fit.cxx:560
 TSpectrum2Fit.cxx:561
 TSpectrum2Fit.cxx:562
 TSpectrum2Fit.cxx:563
 TSpectrum2Fit.cxx:564
 TSpectrum2Fit.cxx:565
 TSpectrum2Fit.cxx:566
 TSpectrum2Fit.cxx:567
 TSpectrum2Fit.cxx:568
 TSpectrum2Fit.cxx:569
 TSpectrum2Fit.cxx:570
 TSpectrum2Fit.cxx:571
 TSpectrum2Fit.cxx:572
 TSpectrum2Fit.cxx:573
 TSpectrum2Fit.cxx:574
 TSpectrum2Fit.cxx:575
 TSpectrum2Fit.cxx:576
 TSpectrum2Fit.cxx:577
 TSpectrum2Fit.cxx:578
 TSpectrum2Fit.cxx:579
 TSpectrum2Fit.cxx:580
 TSpectrum2Fit.cxx:581
 TSpectrum2Fit.cxx:582
 TSpectrum2Fit.cxx:583
 TSpectrum2Fit.cxx:584
 TSpectrum2Fit.cxx:585
 TSpectrum2Fit.cxx:586
 TSpectrum2Fit.cxx:587
 TSpectrum2Fit.cxx:588
 TSpectrum2Fit.cxx:589
 TSpectrum2Fit.cxx:590
 TSpectrum2Fit.cxx:591
 TSpectrum2Fit.cxx:592
 TSpectrum2Fit.cxx:593
 TSpectrum2Fit.cxx:594
 TSpectrum2Fit.cxx:595
 TSpectrum2Fit.cxx:596
 TSpectrum2Fit.cxx:597
 TSpectrum2Fit.cxx:598
 TSpectrum2Fit.cxx:599
 TSpectrum2Fit.cxx:600
 TSpectrum2Fit.cxx:601
 TSpectrum2Fit.cxx:602
 TSpectrum2Fit.cxx:603
 TSpectrum2Fit.cxx:604
 TSpectrum2Fit.cxx:605
 TSpectrum2Fit.cxx:606
 TSpectrum2Fit.cxx:607
 TSpectrum2Fit.cxx:608
 TSpectrum2Fit.cxx:609
 TSpectrum2Fit.cxx:610
 TSpectrum2Fit.cxx:611
 TSpectrum2Fit.cxx:612
 TSpectrum2Fit.cxx:613
 TSpectrum2Fit.cxx:614
 TSpectrum2Fit.cxx:615
 TSpectrum2Fit.cxx:616
 TSpectrum2Fit.cxx:617
 TSpectrum2Fit.cxx:618
 TSpectrum2Fit.cxx:619
 TSpectrum2Fit.cxx:620
 TSpectrum2Fit.cxx:621
 TSpectrum2Fit.cxx:622
 TSpectrum2Fit.cxx:623
 TSpectrum2Fit.cxx:624
 TSpectrum2Fit.cxx:625
 TSpectrum2Fit.cxx:626
 TSpectrum2Fit.cxx:627
 TSpectrum2Fit.cxx:628
 TSpectrum2Fit.cxx:629
 TSpectrum2Fit.cxx:630
 TSpectrum2Fit.cxx:631
 TSpectrum2Fit.cxx:632
 TSpectrum2Fit.cxx:633
 TSpectrum2Fit.cxx:634
 TSpectrum2Fit.cxx:635
 TSpectrum2Fit.cxx:636
 TSpectrum2Fit.cxx:637
 TSpectrum2Fit.cxx:638
 TSpectrum2Fit.cxx:639
 TSpectrum2Fit.cxx:640
 TSpectrum2Fit.cxx:641
 TSpectrum2Fit.cxx:642
 TSpectrum2Fit.cxx:643
 TSpectrum2Fit.cxx:644
 TSpectrum2Fit.cxx:645
 TSpectrum2Fit.cxx:646
 TSpectrum2Fit.cxx:647
 TSpectrum2Fit.cxx:648
 TSpectrum2Fit.cxx:649
 TSpectrum2Fit.cxx:650
 TSpectrum2Fit.cxx:651
 TSpectrum2Fit.cxx:652
 TSpectrum2Fit.cxx:653
 TSpectrum2Fit.cxx:654
 TSpectrum2Fit.cxx:655
 TSpectrum2Fit.cxx:656
 TSpectrum2Fit.cxx:657
 TSpectrum2Fit.cxx:658
 TSpectrum2Fit.cxx:659
 TSpectrum2Fit.cxx:660
 TSpectrum2Fit.cxx:661
 TSpectrum2Fit.cxx:662
 TSpectrum2Fit.cxx:663
 TSpectrum2Fit.cxx:664
 TSpectrum2Fit.cxx:665
 TSpectrum2Fit.cxx:666
 TSpectrum2Fit.cxx:667
 TSpectrum2Fit.cxx:668
 TSpectrum2Fit.cxx:669
 TSpectrum2Fit.cxx:670
 TSpectrum2Fit.cxx:671
 TSpectrum2Fit.cxx:672
 TSpectrum2Fit.cxx:673
 TSpectrum2Fit.cxx:674
 TSpectrum2Fit.cxx:675
 TSpectrum2Fit.cxx:676
 TSpectrum2Fit.cxx:677
 TSpectrum2Fit.cxx:678
 TSpectrum2Fit.cxx:679
 TSpectrum2Fit.cxx:680
 TSpectrum2Fit.cxx:681
 TSpectrum2Fit.cxx:682
 TSpectrum2Fit.cxx:683
 TSpectrum2Fit.cxx:684
 TSpectrum2Fit.cxx:685
 TSpectrum2Fit.cxx:686
 TSpectrum2Fit.cxx:687
 TSpectrum2Fit.cxx:688
 TSpectrum2Fit.cxx:689
 TSpectrum2Fit.cxx:690
 TSpectrum2Fit.cxx:691
 TSpectrum2Fit.cxx:692
 TSpectrum2Fit.cxx:693
 TSpectrum2Fit.cxx:694
 TSpectrum2Fit.cxx:695
 TSpectrum2Fit.cxx:696
 TSpectrum2Fit.cxx:697
 TSpectrum2Fit.cxx:698
 TSpectrum2Fit.cxx:699
 TSpectrum2Fit.cxx:700
 TSpectrum2Fit.cxx:701
 TSpectrum2Fit.cxx:702
 TSpectrum2Fit.cxx:703
 TSpectrum2Fit.cxx:704
 TSpectrum2Fit.cxx:705
 TSpectrum2Fit.cxx:706
 TSpectrum2Fit.cxx:707
 TSpectrum2Fit.cxx:708
 TSpectrum2Fit.cxx:709
 TSpectrum2Fit.cxx:710
 TSpectrum2Fit.cxx:711
 TSpectrum2Fit.cxx:712
 TSpectrum2Fit.cxx:713
 TSpectrum2Fit.cxx:714
 TSpectrum2Fit.cxx:715
 TSpectrum2Fit.cxx:716
 TSpectrum2Fit.cxx:717
 TSpectrum2Fit.cxx:718
 TSpectrum2Fit.cxx:719
 TSpectrum2Fit.cxx:720
 TSpectrum2Fit.cxx:721
 TSpectrum2Fit.cxx:722
 TSpectrum2Fit.cxx:723
 TSpectrum2Fit.cxx:724
 TSpectrum2Fit.cxx:725
 TSpectrum2Fit.cxx:726
 TSpectrum2Fit.cxx:727
 TSpectrum2Fit.cxx:728
 TSpectrum2Fit.cxx:729
 TSpectrum2Fit.cxx:730
 TSpectrum2Fit.cxx:731
 TSpectrum2Fit.cxx:732
 TSpectrum2Fit.cxx:733
 TSpectrum2Fit.cxx:734
 TSpectrum2Fit.cxx:735
 TSpectrum2Fit.cxx:736
 TSpectrum2Fit.cxx:737
 TSpectrum2Fit.cxx:738
 TSpectrum2Fit.cxx:739
 TSpectrum2Fit.cxx:740
 TSpectrum2Fit.cxx:741
 TSpectrum2Fit.cxx:742
 TSpectrum2Fit.cxx:743
 TSpectrum2Fit.cxx:744
 TSpectrum2Fit.cxx:745
 TSpectrum2Fit.cxx:746
 TSpectrum2Fit.cxx:747
 TSpectrum2Fit.cxx:748
 TSpectrum2Fit.cxx:749
 TSpectrum2Fit.cxx:750
 TSpectrum2Fit.cxx:751
 TSpectrum2Fit.cxx:752
 TSpectrum2Fit.cxx:753
 TSpectrum2Fit.cxx:754
 TSpectrum2Fit.cxx:755
 TSpectrum2Fit.cxx:756
 TSpectrum2Fit.cxx:757
 TSpectrum2Fit.cxx:758
 TSpectrum2Fit.cxx:759
 TSpectrum2Fit.cxx:760
 TSpectrum2Fit.cxx:761
 TSpectrum2Fit.cxx:762
 TSpectrum2Fit.cxx:763
 TSpectrum2Fit.cxx:764
 TSpectrum2Fit.cxx:765
 TSpectrum2Fit.cxx:766
 TSpectrum2Fit.cxx:767
 TSpectrum2Fit.cxx:768
 TSpectrum2Fit.cxx:769
 TSpectrum2Fit.cxx:770
 TSpectrum2Fit.cxx:771
 TSpectrum2Fit.cxx:772
 TSpectrum2Fit.cxx:773
 TSpectrum2Fit.cxx:774
 TSpectrum2Fit.cxx:775
 TSpectrum2Fit.cxx:776
 TSpectrum2Fit.cxx:777
 TSpectrum2Fit.cxx:778
 TSpectrum2Fit.cxx:779
 TSpectrum2Fit.cxx:780
 TSpectrum2Fit.cxx:781
 TSpectrum2Fit.cxx:782
 TSpectrum2Fit.cxx:783
 TSpectrum2Fit.cxx:784
 TSpectrum2Fit.cxx:785
 TSpectrum2Fit.cxx:786
 TSpectrum2Fit.cxx:787
 TSpectrum2Fit.cxx:788
 TSpectrum2Fit.cxx:789
 TSpectrum2Fit.cxx:790
 TSpectrum2Fit.cxx:791
 TSpectrum2Fit.cxx:792
 TSpectrum2Fit.cxx:793
 TSpectrum2Fit.cxx:794
 TSpectrum2Fit.cxx:795
 TSpectrum2Fit.cxx:796
 TSpectrum2Fit.cxx:797
 TSpectrum2Fit.cxx:798
 TSpectrum2Fit.cxx:799
 TSpectrum2Fit.cxx:800
 TSpectrum2Fit.cxx:801
 TSpectrum2Fit.cxx:802
 TSpectrum2Fit.cxx:803
 TSpectrum2Fit.cxx:804
 TSpectrum2Fit.cxx:805
 TSpectrum2Fit.cxx:806
 TSpectrum2Fit.cxx:807
 TSpectrum2Fit.cxx:808
 TSpectrum2Fit.cxx:809
 TSpectrum2Fit.cxx:810
 TSpectrum2Fit.cxx:811
 TSpectrum2Fit.cxx:812
 TSpectrum2Fit.cxx:813
 TSpectrum2Fit.cxx:814
 TSpectrum2Fit.cxx:815
 TSpectrum2Fit.cxx:816
 TSpectrum2Fit.cxx:817
 TSpectrum2Fit.cxx:818
 TSpectrum2Fit.cxx:819
 TSpectrum2Fit.cxx:820
 TSpectrum2Fit.cxx:821
 TSpectrum2Fit.cxx:822
 TSpectrum2Fit.cxx:823
 TSpectrum2Fit.cxx:824
 TSpectrum2Fit.cxx:825
 TSpectrum2Fit.cxx:826
 TSpectrum2Fit.cxx:827
 TSpectrum2Fit.cxx:828
 TSpectrum2Fit.cxx:829
 TSpectrum2Fit.cxx:830
 TSpectrum2Fit.cxx:831
 TSpectrum2Fit.cxx:832
 TSpectrum2Fit.cxx:833
 TSpectrum2Fit.cxx:834
 TSpectrum2Fit.cxx:835
 TSpectrum2Fit.cxx:836
 TSpectrum2Fit.cxx:837
 TSpectrum2Fit.cxx:838
 TSpectrum2Fit.cxx:839
 TSpectrum2Fit.cxx:840
 TSpectrum2Fit.cxx:841
 TSpectrum2Fit.cxx:842
 TSpectrum2Fit.cxx:843
 TSpectrum2Fit.cxx:844
 TSpectrum2Fit.cxx:845
 TSpectrum2Fit.cxx:846
 TSpectrum2Fit.cxx:847
 TSpectrum2Fit.cxx:848
 TSpectrum2Fit.cxx:849
 TSpectrum2Fit.cxx:850
 TSpectrum2Fit.cxx:851
 TSpectrum2Fit.cxx:852
 TSpectrum2Fit.cxx:853
 TSpectrum2Fit.cxx:854
 TSpectrum2Fit.cxx:855
 TSpectrum2Fit.cxx:856
 TSpectrum2Fit.cxx:857
 TSpectrum2Fit.cxx:858
 TSpectrum2Fit.cxx:859
 TSpectrum2Fit.cxx:860
 TSpectrum2Fit.cxx:861
 TSpectrum2Fit.cxx:862
 TSpectrum2Fit.cxx:863
 TSpectrum2Fit.cxx:864
 TSpectrum2Fit.cxx:865
 TSpectrum2Fit.cxx:866
 TSpectrum2Fit.cxx:867
 TSpectrum2Fit.cxx:868
 TSpectrum2Fit.cxx:869
 TSpectrum2Fit.cxx:870
 TSpectrum2Fit.cxx:871
 TSpectrum2Fit.cxx:872
 TSpectrum2Fit.cxx:873
 TSpectrum2Fit.cxx:874
 TSpectrum2Fit.cxx:875
 TSpectrum2Fit.cxx:876
 TSpectrum2Fit.cxx:877
 TSpectrum2Fit.cxx:878
 TSpectrum2Fit.cxx:879
 TSpectrum2Fit.cxx:880
 TSpectrum2Fit.cxx:881
 TSpectrum2Fit.cxx:882
 TSpectrum2Fit.cxx:883
 TSpectrum2Fit.cxx:884
 TSpectrum2Fit.cxx:885
 TSpectrum2Fit.cxx:886
 TSpectrum2Fit.cxx:887
 TSpectrum2Fit.cxx:888
 TSpectrum2Fit.cxx:889
 TSpectrum2Fit.cxx:890
 TSpectrum2Fit.cxx:891
 TSpectrum2Fit.cxx:892
 TSpectrum2Fit.cxx:893
 TSpectrum2Fit.cxx:894
 TSpectrum2Fit.cxx:895
 TSpectrum2Fit.cxx:896
 TSpectrum2Fit.cxx:897
 TSpectrum2Fit.cxx:898
 TSpectrum2Fit.cxx:899
 TSpectrum2Fit.cxx:900
 TSpectrum2Fit.cxx:901
 TSpectrum2Fit.cxx:902
 TSpectrum2Fit.cxx:903
 TSpectrum2Fit.cxx:904
 TSpectrum2Fit.cxx:905
 TSpectrum2Fit.cxx:906
 TSpectrum2Fit.cxx:907
 TSpectrum2Fit.cxx:908
 TSpectrum2Fit.cxx:909
 TSpectrum2Fit.cxx:910
 TSpectrum2Fit.cxx:911
 TSpectrum2Fit.cxx:912
 TSpectrum2Fit.cxx:913
 TSpectrum2Fit.cxx:914
 TSpectrum2Fit.cxx:915
 TSpectrum2Fit.cxx:916
 TSpectrum2Fit.cxx:917
 TSpectrum2Fit.cxx:918
 TSpectrum2Fit.cxx:919
 TSpectrum2Fit.cxx:920
 TSpectrum2Fit.cxx:921
 TSpectrum2Fit.cxx:922
 TSpectrum2Fit.cxx:923
 TSpectrum2Fit.cxx:924
 TSpectrum2Fit.cxx:925
 TSpectrum2Fit.cxx:926
 TSpectrum2Fit.cxx:927
 TSpectrum2Fit.cxx:928
 TSpectrum2Fit.cxx:929
 TSpectrum2Fit.cxx:930
 TSpectrum2Fit.cxx:931
 TSpectrum2Fit.cxx:932
 TSpectrum2Fit.cxx:933
 TSpectrum2Fit.cxx:934
 TSpectrum2Fit.cxx:935
 TSpectrum2Fit.cxx:936
 TSpectrum2Fit.cxx:937
 TSpectrum2Fit.cxx:938
 TSpectrum2Fit.cxx:939
 TSpectrum2Fit.cxx:940
 TSpectrum2Fit.cxx:941
 TSpectrum2Fit.cxx:942
 TSpectrum2Fit.cxx:943
 TSpectrum2Fit.cxx:944
 TSpectrum2Fit.cxx:945
 TSpectrum2Fit.cxx:946
 TSpectrum2Fit.cxx:947
 TSpectrum2Fit.cxx:948
 TSpectrum2Fit.cxx:949
 TSpectrum2Fit.cxx:950
 TSpectrum2Fit.cxx:951
 TSpectrum2Fit.cxx:952
 TSpectrum2Fit.cxx:953
 TSpectrum2Fit.cxx:954
 TSpectrum2Fit.cxx:955
 TSpectrum2Fit.cxx:956
 TSpectrum2Fit.cxx:957
 TSpectrum2Fit.cxx:958
 TSpectrum2Fit.cxx:959
 TSpectrum2Fit.cxx:960
 TSpectrum2Fit.cxx:961
 TSpectrum2Fit.cxx:962
 TSpectrum2Fit.cxx:963
 TSpectrum2Fit.cxx:964
 TSpectrum2Fit.cxx:965
 TSpectrum2Fit.cxx:966
 TSpectrum2Fit.cxx:967
 TSpectrum2Fit.cxx:968
 TSpectrum2Fit.cxx:969
 TSpectrum2Fit.cxx:970
 TSpectrum2Fit.cxx:971
 TSpectrum2Fit.cxx:972
 TSpectrum2Fit.cxx:973
 TSpectrum2Fit.cxx:974
 TSpectrum2Fit.cxx:975
 TSpectrum2Fit.cxx:976
 TSpectrum2Fit.cxx:977
 TSpectrum2Fit.cxx:978
 TSpectrum2Fit.cxx:979
 TSpectrum2Fit.cxx:980
 TSpectrum2Fit.cxx:981
 TSpectrum2Fit.cxx:982
 TSpectrum2Fit.cxx:983
 TSpectrum2Fit.cxx:984
 TSpectrum2Fit.cxx:985
 TSpectrum2Fit.cxx:986
 TSpectrum2Fit.cxx:987
 TSpectrum2Fit.cxx:988
 TSpectrum2Fit.cxx:989
 TSpectrum2Fit.cxx:990
 TSpectrum2Fit.cxx:991
 TSpectrum2Fit.cxx:992
 TSpectrum2Fit.cxx:993
 TSpectrum2Fit.cxx:994
 TSpectrum2Fit.cxx:995
 TSpectrum2Fit.cxx:996
 TSpectrum2Fit.cxx:997
 TSpectrum2Fit.cxx:998
 TSpectrum2Fit.cxx:999
 TSpectrum2Fit.cxx:1000
 TSpectrum2Fit.cxx:1001
 TSpectrum2Fit.cxx:1002
 TSpectrum2Fit.cxx:1003
 TSpectrum2Fit.cxx:1004
 TSpectrum2Fit.cxx:1005
 TSpectrum2Fit.cxx:1006
 TSpectrum2Fit.cxx:1007
 TSpectrum2Fit.cxx:1008
 TSpectrum2Fit.cxx:1009
 TSpectrum2Fit.cxx:1010
 TSpectrum2Fit.cxx:1011
 TSpectrum2Fit.cxx:1012
 TSpectrum2Fit.cxx:1013
 TSpectrum2Fit.cxx:1014
 TSpectrum2Fit.cxx:1015
 TSpectrum2Fit.cxx:1016
 TSpectrum2Fit.cxx:1017
 TSpectrum2Fit.cxx:1018
 TSpectrum2Fit.cxx:1019
 TSpectrum2Fit.cxx:1020
 TSpectrum2Fit.cxx:1021
 TSpectrum2Fit.cxx:1022
 TSpectrum2Fit.cxx:1023
 TSpectrum2Fit.cxx:1024
 TSpectrum2Fit.cxx:1025
 TSpectrum2Fit.cxx:1026
 TSpectrum2Fit.cxx:1027
 TSpectrum2Fit.cxx:1028
 TSpectrum2Fit.cxx:1029
 TSpectrum2Fit.cxx:1030
 TSpectrum2Fit.cxx:1031
 TSpectrum2Fit.cxx:1032
 TSpectrum2Fit.cxx:1033
 TSpectrum2Fit.cxx:1034
 TSpectrum2Fit.cxx:1035
 TSpectrum2Fit.cxx:1036
 TSpectrum2Fit.cxx:1037
 TSpectrum2Fit.cxx:1038
 TSpectrum2Fit.cxx:1039
 TSpectrum2Fit.cxx:1040
 TSpectrum2Fit.cxx:1041
 TSpectrum2Fit.cxx:1042
 TSpectrum2Fit.cxx:1043
 TSpectrum2Fit.cxx:1044
 TSpectrum2Fit.cxx:1045
 TSpectrum2Fit.cxx:1046
 TSpectrum2Fit.cxx:1047
 TSpectrum2Fit.cxx:1048
 TSpectrum2Fit.cxx:1049
 TSpectrum2Fit.cxx:1050
 TSpectrum2Fit.cxx:1051
 TSpectrum2Fit.cxx:1052
 TSpectrum2Fit.cxx:1053
 TSpectrum2Fit.cxx:1054
 TSpectrum2Fit.cxx:1055
 TSpectrum2Fit.cxx:1056
 TSpectrum2Fit.cxx:1057
 TSpectrum2Fit.cxx:1058
 TSpectrum2Fit.cxx:1059
 TSpectrum2Fit.cxx:1060
 TSpectrum2Fit.cxx:1061
 TSpectrum2Fit.cxx:1062
 TSpectrum2Fit.cxx:1063
 TSpectrum2Fit.cxx:1064
 TSpectrum2Fit.cxx:1065
 TSpectrum2Fit.cxx:1066
 TSpectrum2Fit.cxx:1067
 TSpectrum2Fit.cxx:1068
 TSpectrum2Fit.cxx:1069
 TSpectrum2Fit.cxx:1070
 TSpectrum2Fit.cxx:1071
 TSpectrum2Fit.cxx:1072
 TSpectrum2Fit.cxx:1073
 TSpectrum2Fit.cxx:1074
 TSpectrum2Fit.cxx:1075
 TSpectrum2Fit.cxx:1076
 TSpectrum2Fit.cxx:1077
 TSpectrum2Fit.cxx:1078
 TSpectrum2Fit.cxx:1079
 TSpectrum2Fit.cxx:1080
 TSpectrum2Fit.cxx:1081
 TSpectrum2Fit.cxx:1082
 TSpectrum2Fit.cxx:1083
 TSpectrum2Fit.cxx:1084
 TSpectrum2Fit.cxx:1085
 TSpectrum2Fit.cxx:1086
 TSpectrum2Fit.cxx:1087
 TSpectrum2Fit.cxx:1088
 TSpectrum2Fit.cxx:1089
 TSpectrum2Fit.cxx:1090
 TSpectrum2Fit.cxx:1091
 TSpectrum2Fit.cxx:1092
 TSpectrum2Fit.cxx:1093
 TSpectrum2Fit.cxx:1094
 TSpectrum2Fit.cxx:1095
 TSpectrum2Fit.cxx:1096
 TSpectrum2Fit.cxx:1097
 TSpectrum2Fit.cxx:1098
 TSpectrum2Fit.cxx:1099
 TSpectrum2Fit.cxx:1100
 TSpectrum2Fit.cxx:1101
 TSpectrum2Fit.cxx:1102
 TSpectrum2Fit.cxx:1103
 TSpectrum2Fit.cxx:1104
 TSpectrum2Fit.cxx:1105
 TSpectrum2Fit.cxx:1106
 TSpectrum2Fit.cxx:1107
 TSpectrum2Fit.cxx:1108
 TSpectrum2Fit.cxx:1109
 TSpectrum2Fit.cxx:1110
 TSpectrum2Fit.cxx:1111
 TSpectrum2Fit.cxx:1112
 TSpectrum2Fit.cxx:1113
 TSpectrum2Fit.cxx:1114
 TSpectrum2Fit.cxx:1115
 TSpectrum2Fit.cxx:1116
 TSpectrum2Fit.cxx:1117
 TSpectrum2Fit.cxx:1118
 TSpectrum2Fit.cxx:1119
 TSpectrum2Fit.cxx:1120
 TSpectrum2Fit.cxx:1121
 TSpectrum2Fit.cxx:1122
 TSpectrum2Fit.cxx:1123
 TSpectrum2Fit.cxx:1124
 TSpectrum2Fit.cxx:1125
 TSpectrum2Fit.cxx:1126
 TSpectrum2Fit.cxx:1127
 TSpectrum2Fit.cxx:1128
 TSpectrum2Fit.cxx:1129
 TSpectrum2Fit.cxx:1130
 TSpectrum2Fit.cxx:1131
 TSpectrum2Fit.cxx:1132
 TSpectrum2Fit.cxx:1133
 TSpectrum2Fit.cxx:1134
 TSpectrum2Fit.cxx:1135
 TSpectrum2Fit.cxx:1136
 TSpectrum2Fit.cxx:1137
 TSpectrum2Fit.cxx:1138
 TSpectrum2Fit.cxx:1139
 TSpectrum2Fit.cxx:1140
 TSpectrum2Fit.cxx:1141
 TSpectrum2Fit.cxx:1142
 TSpectrum2Fit.cxx:1143
 TSpectrum2Fit.cxx:1144
 TSpectrum2Fit.cxx:1145
 TSpectrum2Fit.cxx:1146
 TSpectrum2Fit.cxx:1147
 TSpectrum2Fit.cxx:1148
 TSpectrum2Fit.cxx:1149
 TSpectrum2Fit.cxx:1150
 TSpectrum2Fit.cxx:1151
 TSpectrum2Fit.cxx:1152
 TSpectrum2Fit.cxx:1153
 TSpectrum2Fit.cxx:1154
 TSpectrum2Fit.cxx:1155
 TSpectrum2Fit.cxx:1156
 TSpectrum2Fit.cxx:1157
 TSpectrum2Fit.cxx:1158
 TSpectrum2Fit.cxx:1159
 TSpectrum2Fit.cxx:1160
 TSpectrum2Fit.cxx:1161
 TSpectrum2Fit.cxx:1162
 TSpectrum2Fit.cxx:1163
 TSpectrum2Fit.cxx:1164
 TSpectrum2Fit.cxx:1165
 TSpectrum2Fit.cxx:1166
 TSpectrum2Fit.cxx:1167
 TSpectrum2Fit.cxx:1168
 TSpectrum2Fit.cxx:1169
 TSpectrum2Fit.cxx:1170
 TSpectrum2Fit.cxx:1171
 TSpectrum2Fit.cxx:1172
 TSpectrum2Fit.cxx:1173
 TSpectrum2Fit.cxx:1174
 TSpectrum2Fit.cxx:1175
 TSpectrum2Fit.cxx:1176
 TSpectrum2Fit.cxx:1177
 TSpectrum2Fit.cxx:1178
 TSpectrum2Fit.cxx:1179
 TSpectrum2Fit.cxx:1180
 TSpectrum2Fit.cxx:1181
 TSpectrum2Fit.cxx:1182
 TSpectrum2Fit.cxx:1183
 TSpectrum2Fit.cxx:1184
 TSpectrum2Fit.cxx:1185
 TSpectrum2Fit.cxx:1186
 TSpectrum2Fit.cxx:1187
 TSpectrum2Fit.cxx:1188
 TSpectrum2Fit.cxx:1189
 TSpectrum2Fit.cxx:1190
 TSpectrum2Fit.cxx:1191
 TSpectrum2Fit.cxx:1192
 TSpectrum2Fit.cxx:1193
 TSpectrum2Fit.cxx:1194
 TSpectrum2Fit.cxx:1195
 TSpectrum2Fit.cxx:1196
 TSpectrum2Fit.cxx:1197
 TSpectrum2Fit.cxx:1198
 TSpectrum2Fit.cxx:1199
 TSpectrum2Fit.cxx:1200
 TSpectrum2Fit.cxx:1201
 TSpectrum2Fit.cxx:1202
 TSpectrum2Fit.cxx:1203
 TSpectrum2Fit.cxx:1204
 TSpectrum2Fit.cxx:1205
 TSpectrum2Fit.cxx:1206
 TSpectrum2Fit.cxx:1207
 TSpectrum2Fit.cxx:1208
 TSpectrum2Fit.cxx:1209
 TSpectrum2Fit.cxx:1210
 TSpectrum2Fit.cxx:1211
 TSpectrum2Fit.cxx:1212
 TSpectrum2Fit.cxx:1213
 TSpectrum2Fit.cxx:1214
 TSpectrum2Fit.cxx:1215
 TSpectrum2Fit.cxx:1216
 TSpectrum2Fit.cxx:1217
 TSpectrum2Fit.cxx:1218
 TSpectrum2Fit.cxx:1219
 TSpectrum2Fit.cxx:1220
 TSpectrum2Fit.cxx:1221
 TSpectrum2Fit.cxx:1222
 TSpectrum2Fit.cxx:1223
 TSpectrum2Fit.cxx:1224
 TSpectrum2Fit.cxx:1225
 TSpectrum2Fit.cxx:1226
 TSpectrum2Fit.cxx:1227
 TSpectrum2Fit.cxx:1228
 TSpectrum2Fit.cxx:1229
 TSpectrum2Fit.cxx:1230
 TSpectrum2Fit.cxx:1231
 TSpectrum2Fit.cxx:1232
 TSpectrum2Fit.cxx:1233
 TSpectrum2Fit.cxx:1234
 TSpectrum2Fit.cxx:1235
 TSpectrum2Fit.cxx:1236
 TSpectrum2Fit.cxx:1237
 TSpectrum2Fit.cxx:1238
 TSpectrum2Fit.cxx:1239
 TSpectrum2Fit.cxx:1240
 TSpectrum2Fit.cxx:1241
 TSpectrum2Fit.cxx:1242
 TSpectrum2Fit.cxx:1243
 TSpectrum2Fit.cxx:1244
 TSpectrum2Fit.cxx:1245
 TSpectrum2Fit.cxx:1246
 TSpectrum2Fit.cxx:1247
 TSpectrum2Fit.cxx:1248
 TSpectrum2Fit.cxx:1249
 TSpectrum2Fit.cxx:1250
 TSpectrum2Fit.cxx:1251
 TSpectrum2Fit.cxx:1252
 TSpectrum2Fit.cxx:1253
 TSpectrum2Fit.cxx:1254
 TSpectrum2Fit.cxx:1255
 TSpectrum2Fit.cxx:1256
 TSpectrum2Fit.cxx:1257
 TSpectrum2Fit.cxx:1258
 TSpectrum2Fit.cxx:1259
 TSpectrum2Fit.cxx:1260
 TSpectrum2Fit.cxx:1261
 TSpectrum2Fit.cxx:1262
 TSpectrum2Fit.cxx:1263
 TSpectrum2Fit.cxx:1264
 TSpectrum2Fit.cxx:1265
 TSpectrum2Fit.cxx:1266
 TSpectrum2Fit.cxx:1267
 TSpectrum2Fit.cxx:1268
 TSpectrum2Fit.cxx:1269
 TSpectrum2Fit.cxx:1270
 TSpectrum2Fit.cxx:1271
 TSpectrum2Fit.cxx:1272
 TSpectrum2Fit.cxx:1273
 TSpectrum2Fit.cxx:1274
 TSpectrum2Fit.cxx:1275
 TSpectrum2Fit.cxx:1276
 TSpectrum2Fit.cxx:1277
 TSpectrum2Fit.cxx:1278
 TSpectrum2Fit.cxx:1279
 TSpectrum2Fit.cxx:1280
 TSpectrum2Fit.cxx:1281
 TSpectrum2Fit.cxx:1282
 TSpectrum2Fit.cxx:1283
 TSpectrum2Fit.cxx:1284
 TSpectrum2Fit.cxx:1285
 TSpectrum2Fit.cxx:1286
 TSpectrum2Fit.cxx:1287
 TSpectrum2Fit.cxx:1288
 TSpectrum2Fit.cxx:1289
 TSpectrum2Fit.cxx:1290
 TSpectrum2Fit.cxx:1291
 TSpectrum2Fit.cxx:1292
 TSpectrum2Fit.cxx:1293
 TSpectrum2Fit.cxx:1294
 TSpectrum2Fit.cxx:1295
 TSpectrum2Fit.cxx:1296
 TSpectrum2Fit.cxx:1297
 TSpectrum2Fit.cxx:1298
 TSpectrum2Fit.cxx:1299
 TSpectrum2Fit.cxx:1300
 TSpectrum2Fit.cxx:1301
 TSpectrum2Fit.cxx:1302
 TSpectrum2Fit.cxx:1303
 TSpectrum2Fit.cxx:1304
 TSpectrum2Fit.cxx:1305
 TSpectrum2Fit.cxx:1306
 TSpectrum2Fit.cxx:1307
 TSpectrum2Fit.cxx:1308
 TSpectrum2Fit.cxx:1309
 TSpectrum2Fit.cxx:1310
 TSpectrum2Fit.cxx:1311
 TSpectrum2Fit.cxx:1312
 TSpectrum2Fit.cxx:1313
 TSpectrum2Fit.cxx:1314
 TSpectrum2Fit.cxx:1315
 TSpectrum2Fit.cxx:1316
 TSpectrum2Fit.cxx:1317
 TSpectrum2Fit.cxx:1318
 TSpectrum2Fit.cxx:1319
 TSpectrum2Fit.cxx:1320
 TSpectrum2Fit.cxx:1321
 TSpectrum2Fit.cxx:1322
 TSpectrum2Fit.cxx:1323
 TSpectrum2Fit.cxx:1324
 TSpectrum2Fit.cxx:1325
 TSpectrum2Fit.cxx:1326
 TSpectrum2Fit.cxx:1327
 TSpectrum2Fit.cxx:1328
 TSpectrum2Fit.cxx:1329
 TSpectrum2Fit.cxx:1330
 TSpectrum2Fit.cxx:1331
 TSpectrum2Fit.cxx:1332
 TSpectrum2Fit.cxx:1333
 TSpectrum2Fit.cxx:1334
 TSpectrum2Fit.cxx:1335
 TSpectrum2Fit.cxx:1336
 TSpectrum2Fit.cxx:1337
 TSpectrum2Fit.cxx:1338
 TSpectrum2Fit.cxx:1339
 TSpectrum2Fit.cxx:1340
 TSpectrum2Fit.cxx:1341
 TSpectrum2Fit.cxx:1342
 TSpectrum2Fit.cxx:1343
 TSpectrum2Fit.cxx:1344
 TSpectrum2Fit.cxx:1345
 TSpectrum2Fit.cxx:1346
 TSpectrum2Fit.cxx:1347
 TSpectrum2Fit.cxx:1348
 TSpectrum2Fit.cxx:1349
 TSpectrum2Fit.cxx:1350
 TSpectrum2Fit.cxx:1351
 TSpectrum2Fit.cxx:1352
 TSpectrum2Fit.cxx:1353
 TSpectrum2Fit.cxx:1354
 TSpectrum2Fit.cxx:1355
 TSpectrum2Fit.cxx:1356
 TSpectrum2Fit.cxx:1357
 TSpectrum2Fit.cxx:1358
 TSpectrum2Fit.cxx:1359
 TSpectrum2Fit.cxx:1360
 TSpectrum2Fit.cxx:1361
 TSpectrum2Fit.cxx:1362
 TSpectrum2Fit.cxx:1363
 TSpectrum2Fit.cxx:1364
 TSpectrum2Fit.cxx:1365
 TSpectrum2Fit.cxx:1366
 TSpectrum2Fit.cxx:1367
 TSpectrum2Fit.cxx:1368
 TSpectrum2Fit.cxx:1369
 TSpectrum2Fit.cxx:1370
 TSpectrum2Fit.cxx:1371
 TSpectrum2Fit.cxx:1372
 TSpectrum2Fit.cxx:1373
 TSpectrum2Fit.cxx:1374
 TSpectrum2Fit.cxx:1375
 TSpectrum2Fit.cxx:1376
 TSpectrum2Fit.cxx:1377
 TSpectrum2Fit.cxx:1378
 TSpectrum2Fit.cxx:1379
 TSpectrum2Fit.cxx:1380
 TSpectrum2Fit.cxx:1381
 TSpectrum2Fit.cxx:1382
 TSpectrum2Fit.cxx:1383
 TSpectrum2Fit.cxx:1384
 TSpectrum2Fit.cxx:1385
 TSpectrum2Fit.cxx:1386
 TSpectrum2Fit.cxx:1387
 TSpectrum2Fit.cxx:1388
 TSpectrum2Fit.cxx:1389
 TSpectrum2Fit.cxx:1390
 TSpectrum2Fit.cxx:1391
 TSpectrum2Fit.cxx:1392
 TSpectrum2Fit.cxx:1393
 TSpectrum2Fit.cxx:1394
 TSpectrum2Fit.cxx:1395
 TSpectrum2Fit.cxx:1396
 TSpectrum2Fit.cxx:1397
 TSpectrum2Fit.cxx:1398
 TSpectrum2Fit.cxx:1399
 TSpectrum2Fit.cxx:1400
 TSpectrum2Fit.cxx:1401
 TSpectrum2Fit.cxx:1402
 TSpectrum2Fit.cxx:1403
 TSpectrum2Fit.cxx:1404
 TSpectrum2Fit.cxx:1405
 TSpectrum2Fit.cxx:1406
 TSpectrum2Fit.cxx:1407
 TSpectrum2Fit.cxx:1408
 TSpectrum2Fit.cxx:1409
 TSpectrum2Fit.cxx:1410
 TSpectrum2Fit.cxx:1411
 TSpectrum2Fit.cxx:1412
 TSpectrum2Fit.cxx:1413
 TSpectrum2Fit.cxx:1414
 TSpectrum2Fit.cxx:1415
 TSpectrum2Fit.cxx:1416
 TSpectrum2Fit.cxx:1417
 TSpectrum2Fit.cxx:1418
 TSpectrum2Fit.cxx:1419
 TSpectrum2Fit.cxx:1420
 TSpectrum2Fit.cxx:1421
 TSpectrum2Fit.cxx:1422
 TSpectrum2Fit.cxx:1423
 TSpectrum2Fit.cxx:1424
 TSpectrum2Fit.cxx:1425
 TSpectrum2Fit.cxx:1426
 TSpectrum2Fit.cxx:1427
 TSpectrum2Fit.cxx:1428
 TSpectrum2Fit.cxx:1429
 TSpectrum2Fit.cxx:1430
 TSpectrum2Fit.cxx:1431
 TSpectrum2Fit.cxx:1432
 TSpectrum2Fit.cxx:1433
 TSpectrum2Fit.cxx:1434
 TSpectrum2Fit.cxx:1435
 TSpectrum2Fit.cxx:1436
 TSpectrum2Fit.cxx:1437
 TSpectrum2Fit.cxx:1438
 TSpectrum2Fit.cxx:1439
 TSpectrum2Fit.cxx:1440
 TSpectrum2Fit.cxx:1441
 TSpectrum2Fit.cxx:1442
 TSpectrum2Fit.cxx:1443
 TSpectrum2Fit.cxx:1444
 TSpectrum2Fit.cxx:1445
 TSpectrum2Fit.cxx:1446
 TSpectrum2Fit.cxx:1447
 TSpectrum2Fit.cxx:1448
 TSpectrum2Fit.cxx:1449
 TSpectrum2Fit.cxx:1450
 TSpectrum2Fit.cxx:1451
 TSpectrum2Fit.cxx:1452
 TSpectrum2Fit.cxx:1453
 TSpectrum2Fit.cxx:1454
 TSpectrum2Fit.cxx:1455
 TSpectrum2Fit.cxx:1456
 TSpectrum2Fit.cxx:1457
 TSpectrum2Fit.cxx:1458
 TSpectrum2Fit.cxx:1459
 TSpectrum2Fit.cxx:1460
 TSpectrum2Fit.cxx:1461
 TSpectrum2Fit.cxx:1462
 TSpectrum2Fit.cxx:1463
 TSpectrum2Fit.cxx:1464
 TSpectrum2Fit.cxx:1465
 TSpectrum2Fit.cxx:1466
 TSpectrum2Fit.cxx:1467
 TSpectrum2Fit.cxx:1468
 TSpectrum2Fit.cxx:1469
 TSpectrum2Fit.cxx:1470
 TSpectrum2Fit.cxx:1471
 TSpectrum2Fit.cxx:1472
 TSpectrum2Fit.cxx:1473
 TSpectrum2Fit.cxx:1474
 TSpectrum2Fit.cxx:1475
 TSpectrum2Fit.cxx:1476
 TSpectrum2Fit.cxx:1477
 TSpectrum2Fit.cxx:1478
 TSpectrum2Fit.cxx:1479
 TSpectrum2Fit.cxx:1480
 TSpectrum2Fit.cxx:1481
 TSpectrum2Fit.cxx:1482
 TSpectrum2Fit.cxx:1483
 TSpectrum2Fit.cxx:1484
 TSpectrum2Fit.cxx:1485
 TSpectrum2Fit.cxx:1486
 TSpectrum2Fit.cxx:1487
 TSpectrum2Fit.cxx:1488
 TSpectrum2Fit.cxx:1489
 TSpectrum2Fit.cxx:1490
 TSpectrum2Fit.cxx:1491
 TSpectrum2Fit.cxx:1492
 TSpectrum2Fit.cxx:1493
 TSpectrum2Fit.cxx:1494
 TSpectrum2Fit.cxx:1495
 TSpectrum2Fit.cxx:1496
 TSpectrum2Fit.cxx:1497
 TSpectrum2Fit.cxx:1498
 TSpectrum2Fit.cxx:1499
 TSpectrum2Fit.cxx:1500
 TSpectrum2Fit.cxx:1501
 TSpectrum2Fit.cxx:1502
 TSpectrum2Fit.cxx:1503
 TSpectrum2Fit.cxx:1504
 TSpectrum2Fit.cxx:1505
 TSpectrum2Fit.cxx:1506
 TSpectrum2Fit.cxx:1507
 TSpectrum2Fit.cxx:1508
 TSpectrum2Fit.cxx:1509
 TSpectrum2Fit.cxx:1510
 TSpectrum2Fit.cxx:1511
 TSpectrum2Fit.cxx:1512
 TSpectrum2Fit.cxx:1513
 TSpectrum2Fit.cxx:1514
 TSpectrum2Fit.cxx:1515
 TSpectrum2Fit.cxx:1516
 TSpectrum2Fit.cxx:1517
 TSpectrum2Fit.cxx:1518
 TSpectrum2Fit.cxx:1519
 TSpectrum2Fit.cxx:1520
 TSpectrum2Fit.cxx:1521
 TSpectrum2Fit.cxx:1522
 TSpectrum2Fit.cxx:1523
 TSpectrum2Fit.cxx:1524
 TSpectrum2Fit.cxx:1525
 TSpectrum2Fit.cxx:1526
 TSpectrum2Fit.cxx:1527
 TSpectrum2Fit.cxx:1528
 TSpectrum2Fit.cxx:1529
 TSpectrum2Fit.cxx:1530
 TSpectrum2Fit.cxx:1531
 TSpectrum2Fit.cxx:1532
 TSpectrum2Fit.cxx:1533
 TSpectrum2Fit.cxx:1534
 TSpectrum2Fit.cxx:1535
 TSpectrum2Fit.cxx:1536
 TSpectrum2Fit.cxx:1537
 TSpectrum2Fit.cxx:1538
 TSpectrum2Fit.cxx:1539
 TSpectrum2Fit.cxx:1540
 TSpectrum2Fit.cxx:1541
 TSpectrum2Fit.cxx:1542
 TSpectrum2Fit.cxx:1543
 TSpectrum2Fit.cxx:1544
 TSpectrum2Fit.cxx:1545
 TSpectrum2Fit.cxx:1546
 TSpectrum2Fit.cxx:1547
 TSpectrum2Fit.cxx:1548
 TSpectrum2Fit.cxx:1549
 TSpectrum2Fit.cxx:1550
 TSpectrum2Fit.cxx:1551
 TSpectrum2Fit.cxx:1552
 TSpectrum2Fit.cxx:1553
 TSpectrum2Fit.cxx:1554
 TSpectrum2Fit.cxx:1555
 TSpectrum2Fit.cxx:1556
 TSpectrum2Fit.cxx:1557
 TSpectrum2Fit.cxx:1558
 TSpectrum2Fit.cxx:1559
 TSpectrum2Fit.cxx:1560
 TSpectrum2Fit.cxx:1561
 TSpectrum2Fit.cxx:1562
 TSpectrum2Fit.cxx:1563
 TSpectrum2Fit.cxx:1564
 TSpectrum2Fit.cxx:1565
 TSpectrum2Fit.cxx:1566
 TSpectrum2Fit.cxx:1567
 TSpectrum2Fit.cxx:1568
 TSpectrum2Fit.cxx:1569
 TSpectrum2Fit.cxx:1570
 TSpectrum2Fit.cxx:1571
 TSpectrum2Fit.cxx:1572
 TSpectrum2Fit.cxx:1573
 TSpectrum2Fit.cxx:1574
 TSpectrum2Fit.cxx:1575
 TSpectrum2Fit.cxx:1576
 TSpectrum2Fit.cxx:1577
 TSpectrum2Fit.cxx:1578
 TSpectrum2Fit.cxx:1579
 TSpectrum2Fit.cxx:1580
 TSpectrum2Fit.cxx:1581
 TSpectrum2Fit.cxx:1582
 TSpectrum2Fit.cxx:1583
 TSpectrum2Fit.cxx:1584
 TSpectrum2Fit.cxx:1585
 TSpectrum2Fit.cxx:1586
 TSpectrum2Fit.cxx:1587
 TSpectrum2Fit.cxx:1588
 TSpectrum2Fit.cxx:1589
 TSpectrum2Fit.cxx:1590
 TSpectrum2Fit.cxx:1591
 TSpectrum2Fit.cxx:1592
 TSpectrum2Fit.cxx:1593
 TSpectrum2Fit.cxx:1594
 TSpectrum2Fit.cxx:1595
 TSpectrum2Fit.cxx:1596
 TSpectrum2Fit.cxx:1597
 TSpectrum2Fit.cxx:1598
 TSpectrum2Fit.cxx:1599
 TSpectrum2Fit.cxx:1600
 TSpectrum2Fit.cxx:1601
 TSpectrum2Fit.cxx:1602
 TSpectrum2Fit.cxx:1603
 TSpectrum2Fit.cxx:1604
 TSpectrum2Fit.cxx:1605
 TSpectrum2Fit.cxx:1606
 TSpectrum2Fit.cxx:1607
 TSpectrum2Fit.cxx:1608
 TSpectrum2Fit.cxx:1609
 TSpectrum2Fit.cxx:1610
 TSpectrum2Fit.cxx:1611
 TSpectrum2Fit.cxx:1612
 TSpectrum2Fit.cxx:1613
 TSpectrum2Fit.cxx:1614
 TSpectrum2Fit.cxx:1615
 TSpectrum2Fit.cxx:1616
 TSpectrum2Fit.cxx:1617
 TSpectrum2Fit.cxx:1618
 TSpectrum2Fit.cxx:1619
 TSpectrum2Fit.cxx:1620
 TSpectrum2Fit.cxx:1621
 TSpectrum2Fit.cxx:1622
 TSpectrum2Fit.cxx:1623
 TSpectrum2Fit.cxx:1624
 TSpectrum2Fit.cxx:1625
 TSpectrum2Fit.cxx:1626
 TSpectrum2Fit.cxx:1627
 TSpectrum2Fit.cxx:1628
 TSpectrum2Fit.cxx:1629
 TSpectrum2Fit.cxx:1630
 TSpectrum2Fit.cxx:1631
 TSpectrum2Fit.cxx:1632
 TSpectrum2Fit.cxx:1633
 TSpectrum2Fit.cxx:1634
 TSpectrum2Fit.cxx:1635
 TSpectrum2Fit.cxx:1636
 TSpectrum2Fit.cxx:1637
 TSpectrum2Fit.cxx:1638
 TSpectrum2Fit.cxx:1639
 TSpectrum2Fit.cxx:1640
 TSpectrum2Fit.cxx:1641
 TSpectrum2Fit.cxx:1642
 TSpectrum2Fit.cxx:1643
 TSpectrum2Fit.cxx:1644
 TSpectrum2Fit.cxx:1645
 TSpectrum2Fit.cxx:1646
 TSpectrum2Fit.cxx:1647
 TSpectrum2Fit.cxx:1648
 TSpectrum2Fit.cxx:1649
 TSpectrum2Fit.cxx:1650
 TSpectrum2Fit.cxx:1651
 TSpectrum2Fit.cxx:1652
 TSpectrum2Fit.cxx:1653
 TSpectrum2Fit.cxx:1654
 TSpectrum2Fit.cxx:1655
 TSpectrum2Fit.cxx:1656
 TSpectrum2Fit.cxx:1657
 TSpectrum2Fit.cxx:1658
 TSpectrum2Fit.cxx:1659
 TSpectrum2Fit.cxx:1660
 TSpectrum2Fit.cxx:1661
 TSpectrum2Fit.cxx:1662
 TSpectrum2Fit.cxx:1663
 TSpectrum2Fit.cxx:1664
 TSpectrum2Fit.cxx:1665
 TSpectrum2Fit.cxx:1666
 TSpectrum2Fit.cxx:1667
 TSpectrum2Fit.cxx:1668
 TSpectrum2Fit.cxx:1669
 TSpectrum2Fit.cxx:1670
 TSpectrum2Fit.cxx:1671
 TSpectrum2Fit.cxx:1672
 TSpectrum2Fit.cxx:1673
 TSpectrum2Fit.cxx:1674
 TSpectrum2Fit.cxx:1675
 TSpectrum2Fit.cxx:1676
 TSpectrum2Fit.cxx:1677
 TSpectrum2Fit.cxx:1678
 TSpectrum2Fit.cxx:1679
 TSpectrum2Fit.cxx:1680
 TSpectrum2Fit.cxx:1681
 TSpectrum2Fit.cxx:1682
 TSpectrum2Fit.cxx:1683
 TSpectrum2Fit.cxx:1684
 TSpectrum2Fit.cxx:1685
 TSpectrum2Fit.cxx:1686
 TSpectrum2Fit.cxx:1687
 TSpectrum2Fit.cxx:1688
 TSpectrum2Fit.cxx:1689
 TSpectrum2Fit.cxx:1690
 TSpectrum2Fit.cxx:1691
 TSpectrum2Fit.cxx:1692
 TSpectrum2Fit.cxx:1693
 TSpectrum2Fit.cxx:1694
 TSpectrum2Fit.cxx:1695
 TSpectrum2Fit.cxx:1696
 TSpectrum2Fit.cxx:1697
 TSpectrum2Fit.cxx:1698
 TSpectrum2Fit.cxx:1699
 TSpectrum2Fit.cxx:1700
 TSpectrum2Fit.cxx:1701
 TSpectrum2Fit.cxx:1702
 TSpectrum2Fit.cxx:1703
 TSpectrum2Fit.cxx:1704
 TSpectrum2Fit.cxx:1705
 TSpectrum2Fit.cxx:1706
 TSpectrum2Fit.cxx:1707
 TSpectrum2Fit.cxx:1708
 TSpectrum2Fit.cxx:1709
 TSpectrum2Fit.cxx:1710
 TSpectrum2Fit.cxx:1711
 TSpectrum2Fit.cxx:1712
 TSpectrum2Fit.cxx:1713
 TSpectrum2Fit.cxx:1714
 TSpectrum2Fit.cxx:1715
 TSpectrum2Fit.cxx:1716
 TSpectrum2Fit.cxx:1717
 TSpectrum2Fit.cxx:1718
 TSpectrum2Fit.cxx:1719
 TSpectrum2Fit.cxx:1720
 TSpectrum2Fit.cxx:1721
 TSpectrum2Fit.cxx:1722
 TSpectrum2Fit.cxx:1723
 TSpectrum2Fit.cxx:1724
 TSpectrum2Fit.cxx:1725
 TSpectrum2Fit.cxx:1726
 TSpectrum2Fit.cxx:1727
 TSpectrum2Fit.cxx:1728
 TSpectrum2Fit.cxx:1729
 TSpectrum2Fit.cxx:1730
 TSpectrum2Fit.cxx:1731
 TSpectrum2Fit.cxx:1732
 TSpectrum2Fit.cxx:1733
 TSpectrum2Fit.cxx:1734
 TSpectrum2Fit.cxx:1735
 TSpectrum2Fit.cxx:1736
 TSpectrum2Fit.cxx:1737
 TSpectrum2Fit.cxx:1738
 TSpectrum2Fit.cxx:1739
 TSpectrum2Fit.cxx:1740
 TSpectrum2Fit.cxx:1741
 TSpectrum2Fit.cxx:1742
 TSpectrum2Fit.cxx:1743
 TSpectrum2Fit.cxx:1744
 TSpectrum2Fit.cxx:1745
 TSpectrum2Fit.cxx:1746
 TSpectrum2Fit.cxx:1747
 TSpectrum2Fit.cxx:1748
 TSpectrum2Fit.cxx:1749
 TSpectrum2Fit.cxx:1750
 TSpectrum2Fit.cxx:1751
 TSpectrum2Fit.cxx:1752
 TSpectrum2Fit.cxx:1753
 TSpectrum2Fit.cxx:1754
 TSpectrum2Fit.cxx:1755
 TSpectrum2Fit.cxx:1756
 TSpectrum2Fit.cxx:1757
 TSpectrum2Fit.cxx:1758
 TSpectrum2Fit.cxx:1759
 TSpectrum2Fit.cxx:1760
 TSpectrum2Fit.cxx:1761
 TSpectrum2Fit.cxx:1762
 TSpectrum2Fit.cxx:1763
 TSpectrum2Fit.cxx:1764
 TSpectrum2Fit.cxx:1765
 TSpectrum2Fit.cxx:1766
 TSpectrum2Fit.cxx:1767
 TSpectrum2Fit.cxx:1768
 TSpectrum2Fit.cxx:1769
 TSpectrum2Fit.cxx:1770
 TSpectrum2Fit.cxx:1771
 TSpectrum2Fit.cxx:1772
 TSpectrum2Fit.cxx:1773
 TSpectrum2Fit.cxx:1774
 TSpectrum2Fit.cxx:1775
 TSpectrum2Fit.cxx:1776
 TSpectrum2Fit.cxx:1777
 TSpectrum2Fit.cxx:1778
 TSpectrum2Fit.cxx:1779
 TSpectrum2Fit.cxx:1780
 TSpectrum2Fit.cxx:1781
 TSpectrum2Fit.cxx:1782
 TSpectrum2Fit.cxx:1783
 TSpectrum2Fit.cxx:1784
 TSpectrum2Fit.cxx:1785
 TSpectrum2Fit.cxx:1786
 TSpectrum2Fit.cxx:1787
 TSpectrum2Fit.cxx:1788
 TSpectrum2Fit.cxx:1789
 TSpectrum2Fit.cxx:1790
 TSpectrum2Fit.cxx:1791
 TSpectrum2Fit.cxx:1792
 TSpectrum2Fit.cxx:1793
 TSpectrum2Fit.cxx:1794
 TSpectrum2Fit.cxx:1795
 TSpectrum2Fit.cxx:1796
 TSpectrum2Fit.cxx:1797
 TSpectrum2Fit.cxx:1798
 TSpectrum2Fit.cxx:1799
 TSpectrum2Fit.cxx:1800
 TSpectrum2Fit.cxx:1801
 TSpectrum2Fit.cxx:1802
 TSpectrum2Fit.cxx:1803
 TSpectrum2Fit.cxx:1804
 TSpectrum2Fit.cxx:1805
 TSpectrum2Fit.cxx:1806
 TSpectrum2Fit.cxx:1807
 TSpectrum2Fit.cxx:1808
 TSpectrum2Fit.cxx:1809
 TSpectrum2Fit.cxx:1810
 TSpectrum2Fit.cxx:1811
 TSpectrum2Fit.cxx:1812
 TSpectrum2Fit.cxx:1813
 TSpectrum2Fit.cxx:1814
 TSpectrum2Fit.cxx:1815
 TSpectrum2Fit.cxx:1816
 TSpectrum2Fit.cxx:1817
 TSpectrum2Fit.cxx:1818
 TSpectrum2Fit.cxx:1819
 TSpectrum2Fit.cxx:1820
 TSpectrum2Fit.cxx:1821
 TSpectrum2Fit.cxx:1822
 TSpectrum2Fit.cxx:1823
 TSpectrum2Fit.cxx:1824
 TSpectrum2Fit.cxx:1825
 TSpectrum2Fit.cxx:1826
 TSpectrum2Fit.cxx:1827
 TSpectrum2Fit.cxx:1828
 TSpectrum2Fit.cxx:1829
 TSpectrum2Fit.cxx:1830
 TSpectrum2Fit.cxx:1831
 TSpectrum2Fit.cxx:1832
 TSpectrum2Fit.cxx:1833
 TSpectrum2Fit.cxx:1834
 TSpectrum2Fit.cxx:1835
 TSpectrum2Fit.cxx:1836
 TSpectrum2Fit.cxx:1837
 TSpectrum2Fit.cxx:1838
 TSpectrum2Fit.cxx:1839
 TSpectrum2Fit.cxx:1840
 TSpectrum2Fit.cxx:1841
 TSpectrum2Fit.cxx:1842
 TSpectrum2Fit.cxx:1843
 TSpectrum2Fit.cxx:1844
 TSpectrum2Fit.cxx:1845
 TSpectrum2Fit.cxx:1846
 TSpectrum2Fit.cxx:1847
 TSpectrum2Fit.cxx:1848
 TSpectrum2Fit.cxx:1849
 TSpectrum2Fit.cxx:1850
 TSpectrum2Fit.cxx:1851
 TSpectrum2Fit.cxx:1852
 TSpectrum2Fit.cxx:1853
 TSpectrum2Fit.cxx:1854
 TSpectrum2Fit.cxx:1855
 TSpectrum2Fit.cxx:1856
 TSpectrum2Fit.cxx:1857
 TSpectrum2Fit.cxx:1858
 TSpectrum2Fit.cxx:1859
 TSpectrum2Fit.cxx:1860
 TSpectrum2Fit.cxx:1861
 TSpectrum2Fit.cxx:1862
 TSpectrum2Fit.cxx:1863
 TSpectrum2Fit.cxx:1864
 TSpectrum2Fit.cxx:1865
 TSpectrum2Fit.cxx:1866
 TSpectrum2Fit.cxx:1867
 TSpectrum2Fit.cxx:1868
 TSpectrum2Fit.cxx:1869
 TSpectrum2Fit.cxx:1870
 TSpectrum2Fit.cxx:1871
 TSpectrum2Fit.cxx:1872
 TSpectrum2Fit.cxx:1873
 TSpectrum2Fit.cxx:1874
 TSpectrum2Fit.cxx:1875
 TSpectrum2Fit.cxx:1876
 TSpectrum2Fit.cxx:1877
 TSpectrum2Fit.cxx:1878
 TSpectrum2Fit.cxx:1879
 TSpectrum2Fit.cxx:1880
 TSpectrum2Fit.cxx:1881
 TSpectrum2Fit.cxx:1882
 TSpectrum2Fit.cxx:1883
 TSpectrum2Fit.cxx:1884
 TSpectrum2Fit.cxx:1885
 TSpectrum2Fit.cxx:1886
 TSpectrum2Fit.cxx:1887
 TSpectrum2Fit.cxx:1888
 TSpectrum2Fit.cxx:1889
 TSpectrum2Fit.cxx:1890
 TSpectrum2Fit.cxx:1891
 TSpectrum2Fit.cxx:1892
 TSpectrum2Fit.cxx:1893
 TSpectrum2Fit.cxx:1894
 TSpectrum2Fit.cxx:1895
 TSpectrum2Fit.cxx:1896
 TSpectrum2Fit.cxx:1897
 TSpectrum2Fit.cxx:1898
 TSpectrum2Fit.cxx:1899
 TSpectrum2Fit.cxx:1900
 TSpectrum2Fit.cxx:1901
 TSpectrum2Fit.cxx:1902
 TSpectrum2Fit.cxx:1903
 TSpectrum2Fit.cxx:1904
 TSpectrum2Fit.cxx:1905
 TSpectrum2Fit.cxx:1906
 TSpectrum2Fit.cxx:1907
 TSpectrum2Fit.cxx:1908
 TSpectrum2Fit.cxx:1909
 TSpectrum2Fit.cxx:1910
 TSpectrum2Fit.cxx:1911
 TSpectrum2Fit.cxx:1912
 TSpectrum2Fit.cxx:1913
 TSpectrum2Fit.cxx:1914
 TSpectrum2Fit.cxx:1915
 TSpectrum2Fit.cxx:1916
 TSpectrum2Fit.cxx:1917
 TSpectrum2Fit.cxx:1918
 TSpectrum2Fit.cxx:1919
 TSpectrum2Fit.cxx:1920
 TSpectrum2Fit.cxx:1921
 TSpectrum2Fit.cxx:1922
 TSpectrum2Fit.cxx:1923
 TSpectrum2Fit.cxx:1924
 TSpectrum2Fit.cxx:1925
 TSpectrum2Fit.cxx:1926
 TSpectrum2Fit.cxx:1927
 TSpectrum2Fit.cxx:1928
 TSpectrum2Fit.cxx:1929
 TSpectrum2Fit.cxx:1930
 TSpectrum2Fit.cxx:1931
 TSpectrum2Fit.cxx:1932
 TSpectrum2Fit.cxx:1933
 TSpectrum2Fit.cxx:1934
 TSpectrum2Fit.cxx:1935
 TSpectrum2Fit.cxx:1936
 TSpectrum2Fit.cxx:1937
 TSpectrum2Fit.cxx:1938
 TSpectrum2Fit.cxx:1939
 TSpectrum2Fit.cxx:1940
 TSpectrum2Fit.cxx:1941
 TSpectrum2Fit.cxx:1942
 TSpectrum2Fit.cxx:1943
 TSpectrum2Fit.cxx:1944
 TSpectrum2Fit.cxx:1945
 TSpectrum2Fit.cxx:1946
 TSpectrum2Fit.cxx:1947
 TSpectrum2Fit.cxx:1948
 TSpectrum2Fit.cxx:1949
 TSpectrum2Fit.cxx:1950
 TSpectrum2Fit.cxx:1951
 TSpectrum2Fit.cxx:1952
 TSpectrum2Fit.cxx:1953
 TSpectrum2Fit.cxx:1954
 TSpectrum2Fit.cxx:1955
 TSpectrum2Fit.cxx:1956
 TSpectrum2Fit.cxx:1957
 TSpectrum2Fit.cxx:1958
 TSpectrum2Fit.cxx:1959
 TSpectrum2Fit.cxx:1960
 TSpectrum2Fit.cxx:1961
 TSpectrum2Fit.cxx:1962
 TSpectrum2Fit.cxx:1963
 TSpectrum2Fit.cxx:1964
 TSpectrum2Fit.cxx:1965
 TSpectrum2Fit.cxx:1966
 TSpectrum2Fit.cxx:1967
 TSpectrum2Fit.cxx:1968
 TSpectrum2Fit.cxx:1969
 TSpectrum2Fit.cxx:1970
 TSpectrum2Fit.cxx:1971
 TSpectrum2Fit.cxx:1972
 TSpectrum2Fit.cxx:1973
 TSpectrum2Fit.cxx:1974
 TSpectrum2Fit.cxx:1975
 TSpectrum2Fit.cxx:1976
 TSpectrum2Fit.cxx:1977
 TSpectrum2Fit.cxx:1978
 TSpectrum2Fit.cxx:1979
 TSpectrum2Fit.cxx:1980
 TSpectrum2Fit.cxx:1981
 TSpectrum2Fit.cxx:1982
 TSpectrum2Fit.cxx:1983
 TSpectrum2Fit.cxx:1984
 TSpectrum2Fit.cxx:1985
 TSpectrum2Fit.cxx:1986
 TSpectrum2Fit.cxx:1987
 TSpectrum2Fit.cxx:1988
 TSpectrum2Fit.cxx:1989
 TSpectrum2Fit.cxx:1990
 TSpectrum2Fit.cxx:1991
 TSpectrum2Fit.cxx:1992
 TSpectrum2Fit.cxx:1993
 TSpectrum2Fit.cxx:1994
 TSpectrum2Fit.cxx:1995
 TSpectrum2Fit.cxx:1996
 TSpectrum2Fit.cxx:1997
 TSpectrum2Fit.cxx:1998
 TSpectrum2Fit.cxx:1999
 TSpectrum2Fit.cxx:2000
 TSpectrum2Fit.cxx:2001
 TSpectrum2Fit.cxx:2002
 TSpectrum2Fit.cxx:2003
 TSpectrum2Fit.cxx:2004
 TSpectrum2Fit.cxx:2005
 TSpectrum2Fit.cxx:2006
 TSpectrum2Fit.cxx:2007
 TSpectrum2Fit.cxx:2008
 TSpectrum2Fit.cxx:2009
 TSpectrum2Fit.cxx:2010
 TSpectrum2Fit.cxx:2011
 TSpectrum2Fit.cxx:2012
 TSpectrum2Fit.cxx:2013
 TSpectrum2Fit.cxx:2014
 TSpectrum2Fit.cxx:2015
 TSpectrum2Fit.cxx:2016
 TSpectrum2Fit.cxx:2017
 TSpectrum2Fit.cxx:2018
 TSpectrum2Fit.cxx:2019
 TSpectrum2Fit.cxx:2020
 TSpectrum2Fit.cxx:2021
 TSpectrum2Fit.cxx:2022
 TSpectrum2Fit.cxx:2023
 TSpectrum2Fit.cxx:2024
 TSpectrum2Fit.cxx:2025
 TSpectrum2Fit.cxx:2026
 TSpectrum2Fit.cxx:2027
 TSpectrum2Fit.cxx:2028
 TSpectrum2Fit.cxx:2029
 TSpectrum2Fit.cxx:2030
 TSpectrum2Fit.cxx:2031
 TSpectrum2Fit.cxx:2032
 TSpectrum2Fit.cxx:2033
 TSpectrum2Fit.cxx:2034
 TSpectrum2Fit.cxx:2035
 TSpectrum2Fit.cxx:2036
 TSpectrum2Fit.cxx:2037
 TSpectrum2Fit.cxx:2038
 TSpectrum2Fit.cxx:2039
 TSpectrum2Fit.cxx:2040
 TSpectrum2Fit.cxx:2041
 TSpectrum2Fit.cxx:2042
 TSpectrum2Fit.cxx:2043
 TSpectrum2Fit.cxx:2044
 TSpectrum2Fit.cxx:2045
 TSpectrum2Fit.cxx:2046
 TSpectrum2Fit.cxx:2047
 TSpectrum2Fit.cxx:2048
 TSpectrum2Fit.cxx:2049
 TSpectrum2Fit.cxx:2050
 TSpectrum2Fit.cxx:2051
 TSpectrum2Fit.cxx:2052
 TSpectrum2Fit.cxx:2053
 TSpectrum2Fit.cxx:2054
 TSpectrum2Fit.cxx:2055
 TSpectrum2Fit.cxx:2056
 TSpectrum2Fit.cxx:2057
 TSpectrum2Fit.cxx:2058
 TSpectrum2Fit.cxx:2059
 TSpectrum2Fit.cxx:2060
 TSpectrum2Fit.cxx:2061
 TSpectrum2Fit.cxx:2062
 TSpectrum2Fit.cxx:2063
 TSpectrum2Fit.cxx:2064
 TSpectrum2Fit.cxx:2065
 TSpectrum2Fit.cxx:2066
 TSpectrum2Fit.cxx:2067
 TSpectrum2Fit.cxx:2068
 TSpectrum2Fit.cxx:2069
 TSpectrum2Fit.cxx:2070
 TSpectrum2Fit.cxx:2071
 TSpectrum2Fit.cxx:2072
 TSpectrum2Fit.cxx:2073
 TSpectrum2Fit.cxx:2074
 TSpectrum2Fit.cxx:2075
 TSpectrum2Fit.cxx:2076
 TSpectrum2Fit.cxx:2077
 TSpectrum2Fit.cxx:2078
 TSpectrum2Fit.cxx:2079
 TSpectrum2Fit.cxx:2080
 TSpectrum2Fit.cxx:2081
 TSpectrum2Fit.cxx:2082
 TSpectrum2Fit.cxx:2083
 TSpectrum2Fit.cxx:2084
 TSpectrum2Fit.cxx:2085
 TSpectrum2Fit.cxx:2086
 TSpectrum2Fit.cxx:2087
 TSpectrum2Fit.cxx:2088
 TSpectrum2Fit.cxx:2089
 TSpectrum2Fit.cxx:2090
 TSpectrum2Fit.cxx:2091
 TSpectrum2Fit.cxx:2092
 TSpectrum2Fit.cxx:2093
 TSpectrum2Fit.cxx:2094
 TSpectrum2Fit.cxx:2095
 TSpectrum2Fit.cxx:2096
 TSpectrum2Fit.cxx:2097
 TSpectrum2Fit.cxx:2098
 TSpectrum2Fit.cxx:2099
 TSpectrum2Fit.cxx:2100
 TSpectrum2Fit.cxx:2101
 TSpectrum2Fit.cxx:2102
 TSpectrum2Fit.cxx:2103
 TSpectrum2Fit.cxx:2104
 TSpectrum2Fit.cxx:2105
 TSpectrum2Fit.cxx:2106
 TSpectrum2Fit.cxx:2107
 TSpectrum2Fit.cxx:2108
 TSpectrum2Fit.cxx:2109
 TSpectrum2Fit.cxx:2110
 TSpectrum2Fit.cxx:2111
 TSpectrum2Fit.cxx:2112
 TSpectrum2Fit.cxx:2113
 TSpectrum2Fit.cxx:2114
 TSpectrum2Fit.cxx:2115
 TSpectrum2Fit.cxx:2116
 TSpectrum2Fit.cxx:2117
 TSpectrum2Fit.cxx:2118
 TSpectrum2Fit.cxx:2119
 TSpectrum2Fit.cxx:2120
 TSpectrum2Fit.cxx:2121
 TSpectrum2Fit.cxx:2122
 TSpectrum2Fit.cxx:2123
 TSpectrum2Fit.cxx:2124
 TSpectrum2Fit.cxx:2125
 TSpectrum2Fit.cxx:2126
 TSpectrum2Fit.cxx:2127
 TSpectrum2Fit.cxx:2128
 TSpectrum2Fit.cxx:2129
 TSpectrum2Fit.cxx:2130
 TSpectrum2Fit.cxx:2131
 TSpectrum2Fit.cxx:2132
 TSpectrum2Fit.cxx:2133
 TSpectrum2Fit.cxx:2134
 TSpectrum2Fit.cxx:2135
 TSpectrum2Fit.cxx:2136
 TSpectrum2Fit.cxx:2137
 TSpectrum2Fit.cxx:2138
 TSpectrum2Fit.cxx:2139
 TSpectrum2Fit.cxx:2140
 TSpectrum2Fit.cxx:2141
 TSpectrum2Fit.cxx:2142
 TSpectrum2Fit.cxx:2143
 TSpectrum2Fit.cxx:2144
 TSpectrum2Fit.cxx:2145
 TSpectrum2Fit.cxx:2146
 TSpectrum2Fit.cxx:2147
 TSpectrum2Fit.cxx:2148
 TSpectrum2Fit.cxx:2149
 TSpectrum2Fit.cxx:2150
 TSpectrum2Fit.cxx:2151
 TSpectrum2Fit.cxx:2152
 TSpectrum2Fit.cxx:2153
 TSpectrum2Fit.cxx:2154
 TSpectrum2Fit.cxx:2155
 TSpectrum2Fit.cxx:2156
 TSpectrum2Fit.cxx:2157
 TSpectrum2Fit.cxx:2158
 TSpectrum2Fit.cxx:2159
 TSpectrum2Fit.cxx:2160
 TSpectrum2Fit.cxx:2161
 TSpectrum2Fit.cxx:2162
 TSpectrum2Fit.cxx:2163
 TSpectrum2Fit.cxx:2164
 TSpectrum2Fit.cxx:2165
 TSpectrum2Fit.cxx:2166
 TSpectrum2Fit.cxx:2167
 TSpectrum2Fit.cxx:2168
 TSpectrum2Fit.cxx:2169
 TSpectrum2Fit.cxx:2170
 TSpectrum2Fit.cxx:2171
 TSpectrum2Fit.cxx:2172
 TSpectrum2Fit.cxx:2173
 TSpectrum2Fit.cxx:2174
 TSpectrum2Fit.cxx:2175
 TSpectrum2Fit.cxx:2176
 TSpectrum2Fit.cxx:2177
 TSpectrum2Fit.cxx:2178
 TSpectrum2Fit.cxx:2179
 TSpectrum2Fit.cxx:2180
 TSpectrum2Fit.cxx:2181
 TSpectrum2Fit.cxx:2182
 TSpectrum2Fit.cxx:2183
 TSpectrum2Fit.cxx:2184
 TSpectrum2Fit.cxx:2185
 TSpectrum2Fit.cxx:2186
 TSpectrum2Fit.cxx:2187
 TSpectrum2Fit.cxx:2188
 TSpectrum2Fit.cxx:2189
 TSpectrum2Fit.cxx:2190
 TSpectrum2Fit.cxx:2191
 TSpectrum2Fit.cxx:2192
 TSpectrum2Fit.cxx:2193
 TSpectrum2Fit.cxx:2194
 TSpectrum2Fit.cxx:2195
 TSpectrum2Fit.cxx:2196
 TSpectrum2Fit.cxx:2197
 TSpectrum2Fit.cxx:2198
 TSpectrum2Fit.cxx:2199
 TSpectrum2Fit.cxx:2200
 TSpectrum2Fit.cxx:2201
 TSpectrum2Fit.cxx:2202
 TSpectrum2Fit.cxx:2203
 TSpectrum2Fit.cxx:2204
 TSpectrum2Fit.cxx:2205
 TSpectrum2Fit.cxx:2206
 TSpectrum2Fit.cxx:2207
 TSpectrum2Fit.cxx:2208
 TSpectrum2Fit.cxx:2209
 TSpectrum2Fit.cxx:2210
 TSpectrum2Fit.cxx:2211
 TSpectrum2Fit.cxx:2212
 TSpectrum2Fit.cxx:2213
 TSpectrum2Fit.cxx:2214
 TSpectrum2Fit.cxx:2215
 TSpectrum2Fit.cxx:2216
 TSpectrum2Fit.cxx:2217
 TSpectrum2Fit.cxx:2218
 TSpectrum2Fit.cxx:2219
 TSpectrum2Fit.cxx:2220
 TSpectrum2Fit.cxx:2221
 TSpectrum2Fit.cxx:2222
 TSpectrum2Fit.cxx:2223
 TSpectrum2Fit.cxx:2224
 TSpectrum2Fit.cxx:2225
 TSpectrum2Fit.cxx:2226
 TSpectrum2Fit.cxx:2227
 TSpectrum2Fit.cxx:2228
 TSpectrum2Fit.cxx:2229
 TSpectrum2Fit.cxx:2230
 TSpectrum2Fit.cxx:2231
 TSpectrum2Fit.cxx:2232
 TSpectrum2Fit.cxx:2233
 TSpectrum2Fit.cxx:2234
 TSpectrum2Fit.cxx:2235
 TSpectrum2Fit.cxx:2236
 TSpectrum2Fit.cxx:2237
 TSpectrum2Fit.cxx:2238
 TSpectrum2Fit.cxx:2239
 TSpectrum2Fit.cxx:2240
 TSpectrum2Fit.cxx:2241
 TSpectrum2Fit.cxx:2242
 TSpectrum2Fit.cxx:2243
 TSpectrum2Fit.cxx:2244
 TSpectrum2Fit.cxx:2245
 TSpectrum2Fit.cxx:2246
 TSpectrum2Fit.cxx:2247
 TSpectrum2Fit.cxx:2248
 TSpectrum2Fit.cxx:2249
 TSpectrum2Fit.cxx:2250
 TSpectrum2Fit.cxx:2251
 TSpectrum2Fit.cxx:2252
 TSpectrum2Fit.cxx:2253
 TSpectrum2Fit.cxx:2254
 TSpectrum2Fit.cxx:2255
 TSpectrum2Fit.cxx:2256
 TSpectrum2Fit.cxx:2257
 TSpectrum2Fit.cxx:2258
 TSpectrum2Fit.cxx:2259
 TSpectrum2Fit.cxx:2260
 TSpectrum2Fit.cxx:2261
 TSpectrum2Fit.cxx:2262
 TSpectrum2Fit.cxx:2263
 TSpectrum2Fit.cxx:2264
 TSpectrum2Fit.cxx:2265
 TSpectrum2Fit.cxx:2266
 TSpectrum2Fit.cxx:2267
 TSpectrum2Fit.cxx:2268
 TSpectrum2Fit.cxx:2269
 TSpectrum2Fit.cxx:2270
 TSpectrum2Fit.cxx:2271
 TSpectrum2Fit.cxx:2272
 TSpectrum2Fit.cxx:2273
 TSpectrum2Fit.cxx:2274
 TSpectrum2Fit.cxx:2275
 TSpectrum2Fit.cxx:2276
 TSpectrum2Fit.cxx:2277
 TSpectrum2Fit.cxx:2278
 TSpectrum2Fit.cxx:2279
 TSpectrum2Fit.cxx:2280
 TSpectrum2Fit.cxx:2281
 TSpectrum2Fit.cxx:2282
 TSpectrum2Fit.cxx:2283
 TSpectrum2Fit.cxx:2284
 TSpectrum2Fit.cxx:2285
 TSpectrum2Fit.cxx:2286
 TSpectrum2Fit.cxx:2287
 TSpectrum2Fit.cxx:2288
 TSpectrum2Fit.cxx:2289
 TSpectrum2Fit.cxx:2290
 TSpectrum2Fit.cxx:2291
 TSpectrum2Fit.cxx:2292
 TSpectrum2Fit.cxx:2293
 TSpectrum2Fit.cxx:2294
 TSpectrum2Fit.cxx:2295
 TSpectrum2Fit.cxx:2296
 TSpectrum2Fit.cxx:2297
 TSpectrum2Fit.cxx:2298
 TSpectrum2Fit.cxx:2299
 TSpectrum2Fit.cxx:2300
 TSpectrum2Fit.cxx:2301
 TSpectrum2Fit.cxx:2302
 TSpectrum2Fit.cxx:2303
 TSpectrum2Fit.cxx:2304
 TSpectrum2Fit.cxx:2305
 TSpectrum2Fit.cxx:2306
 TSpectrum2Fit.cxx:2307
 TSpectrum2Fit.cxx:2308
 TSpectrum2Fit.cxx:2309
 TSpectrum2Fit.cxx:2310
 TSpectrum2Fit.cxx:2311
 TSpectrum2Fit.cxx:2312
 TSpectrum2Fit.cxx:2313
 TSpectrum2Fit.cxx:2314
 TSpectrum2Fit.cxx:2315
 TSpectrum2Fit.cxx:2316
 TSpectrum2Fit.cxx:2317
 TSpectrum2Fit.cxx:2318
 TSpectrum2Fit.cxx:2319
 TSpectrum2Fit.cxx:2320
 TSpectrum2Fit.cxx:2321
 TSpectrum2Fit.cxx:2322
 TSpectrum2Fit.cxx:2323
 TSpectrum2Fit.cxx:2324
 TSpectrum2Fit.cxx:2325
 TSpectrum2Fit.cxx:2326
 TSpectrum2Fit.cxx:2327
 TSpectrum2Fit.cxx:2328
 TSpectrum2Fit.cxx:2329
 TSpectrum2Fit.cxx:2330
 TSpectrum2Fit.cxx:2331
 TSpectrum2Fit.cxx:2332
 TSpectrum2Fit.cxx:2333
 TSpectrum2Fit.cxx:2334
 TSpectrum2Fit.cxx:2335
 TSpectrum2Fit.cxx:2336
 TSpectrum2Fit.cxx:2337
 TSpectrum2Fit.cxx:2338
 TSpectrum2Fit.cxx:2339
 TSpectrum2Fit.cxx:2340
 TSpectrum2Fit.cxx:2341
 TSpectrum2Fit.cxx:2342
 TSpectrum2Fit.cxx:2343
 TSpectrum2Fit.cxx:2344
 TSpectrum2Fit.cxx:2345
 TSpectrum2Fit.cxx:2346
 TSpectrum2Fit.cxx:2347
 TSpectrum2Fit.cxx:2348
 TSpectrum2Fit.cxx:2349
 TSpectrum2Fit.cxx:2350
 TSpectrum2Fit.cxx:2351
 TSpectrum2Fit.cxx:2352
 TSpectrum2Fit.cxx:2353
 TSpectrum2Fit.cxx:2354
 TSpectrum2Fit.cxx:2355
 TSpectrum2Fit.cxx:2356
 TSpectrum2Fit.cxx:2357
 TSpectrum2Fit.cxx:2358
 TSpectrum2Fit.cxx:2359
 TSpectrum2Fit.cxx:2360
 TSpectrum2Fit.cxx:2361
 TSpectrum2Fit.cxx:2362
 TSpectrum2Fit.cxx:2363
 TSpectrum2Fit.cxx:2364
 TSpectrum2Fit.cxx:2365
 TSpectrum2Fit.cxx:2366
 TSpectrum2Fit.cxx:2367
 TSpectrum2Fit.cxx:2368
 TSpectrum2Fit.cxx:2369
 TSpectrum2Fit.cxx:2370
 TSpectrum2Fit.cxx:2371
 TSpectrum2Fit.cxx:2372
 TSpectrum2Fit.cxx:2373
 TSpectrum2Fit.cxx:2374
 TSpectrum2Fit.cxx:2375
 TSpectrum2Fit.cxx:2376
 TSpectrum2Fit.cxx:2377
 TSpectrum2Fit.cxx:2378
 TSpectrum2Fit.cxx:2379
 TSpectrum2Fit.cxx:2380
 TSpectrum2Fit.cxx:2381
 TSpectrum2Fit.cxx:2382
 TSpectrum2Fit.cxx:2383
 TSpectrum2Fit.cxx:2384
 TSpectrum2Fit.cxx:2385
 TSpectrum2Fit.cxx:2386
 TSpectrum2Fit.cxx:2387
 TSpectrum2Fit.cxx:2388
 TSpectrum2Fit.cxx:2389
 TSpectrum2Fit.cxx:2390
 TSpectrum2Fit.cxx:2391
 TSpectrum2Fit.cxx:2392
 TSpectrum2Fit.cxx:2393
 TSpectrum2Fit.cxx:2394
 TSpectrum2Fit.cxx:2395
 TSpectrum2Fit.cxx:2396
 TSpectrum2Fit.cxx:2397
 TSpectrum2Fit.cxx:2398
 TSpectrum2Fit.cxx:2399
 TSpectrum2Fit.cxx:2400
 TSpectrum2Fit.cxx:2401
 TSpectrum2Fit.cxx:2402
 TSpectrum2Fit.cxx:2403
 TSpectrum2Fit.cxx:2404
 TSpectrum2Fit.cxx:2405
 TSpectrum2Fit.cxx:2406
 TSpectrum2Fit.cxx:2407
 TSpectrum2Fit.cxx:2408
 TSpectrum2Fit.cxx:2409
 TSpectrum2Fit.cxx:2410
 TSpectrum2Fit.cxx:2411
 TSpectrum2Fit.cxx:2412
 TSpectrum2Fit.cxx:2413
 TSpectrum2Fit.cxx:2414
 TSpectrum2Fit.cxx:2415
 TSpectrum2Fit.cxx:2416
 TSpectrum2Fit.cxx:2417
 TSpectrum2Fit.cxx:2418
 TSpectrum2Fit.cxx:2419
 TSpectrum2Fit.cxx:2420
 TSpectrum2Fit.cxx:2421
 TSpectrum2Fit.cxx:2422
 TSpectrum2Fit.cxx:2423
 TSpectrum2Fit.cxx:2424
 TSpectrum2Fit.cxx:2425
 TSpectrum2Fit.cxx:2426
 TSpectrum2Fit.cxx:2427
 TSpectrum2Fit.cxx:2428
 TSpectrum2Fit.cxx:2429
 TSpectrum2Fit.cxx:2430
 TSpectrum2Fit.cxx:2431
 TSpectrum2Fit.cxx:2432
 TSpectrum2Fit.cxx:2433
 TSpectrum2Fit.cxx:2434
 TSpectrum2Fit.cxx:2435
 TSpectrum2Fit.cxx:2436
 TSpectrum2Fit.cxx:2437
 TSpectrum2Fit.cxx:2438
 TSpectrum2Fit.cxx:2439
 TSpectrum2Fit.cxx:2440
 TSpectrum2Fit.cxx:2441
 TSpectrum2Fit.cxx:2442
 TSpectrum2Fit.cxx:2443
 TSpectrum2Fit.cxx:2444
 TSpectrum2Fit.cxx:2445
 TSpectrum2Fit.cxx:2446
 TSpectrum2Fit.cxx:2447
 TSpectrum2Fit.cxx:2448
 TSpectrum2Fit.cxx:2449
 TSpectrum2Fit.cxx:2450
 TSpectrum2Fit.cxx:2451
 TSpectrum2Fit.cxx:2452
 TSpectrum2Fit.cxx:2453
 TSpectrum2Fit.cxx:2454
 TSpectrum2Fit.cxx:2455
 TSpectrum2Fit.cxx:2456
 TSpectrum2Fit.cxx:2457
 TSpectrum2Fit.cxx:2458
 TSpectrum2Fit.cxx:2459
 TSpectrum2Fit.cxx:2460
 TSpectrum2Fit.cxx:2461
 TSpectrum2Fit.cxx:2462
 TSpectrum2Fit.cxx:2463
 TSpectrum2Fit.cxx:2464
 TSpectrum2Fit.cxx:2465
 TSpectrum2Fit.cxx:2466
 TSpectrum2Fit.cxx:2467
 TSpectrum2Fit.cxx:2468
 TSpectrum2Fit.cxx:2469
 TSpectrum2Fit.cxx:2470
 TSpectrum2Fit.cxx:2471
 TSpectrum2Fit.cxx:2472
 TSpectrum2Fit.cxx:2473
 TSpectrum2Fit.cxx:2474
 TSpectrum2Fit.cxx:2475
 TSpectrum2Fit.cxx:2476
 TSpectrum2Fit.cxx:2477
 TSpectrum2Fit.cxx:2478
 TSpectrum2Fit.cxx:2479
 TSpectrum2Fit.cxx:2480
 TSpectrum2Fit.cxx:2481
 TSpectrum2Fit.cxx:2482
 TSpectrum2Fit.cxx:2483
 TSpectrum2Fit.cxx:2484
 TSpectrum2Fit.cxx:2485
 TSpectrum2Fit.cxx:2486
 TSpectrum2Fit.cxx:2487
 TSpectrum2Fit.cxx:2488
 TSpectrum2Fit.cxx:2489
 TSpectrum2Fit.cxx:2490
 TSpectrum2Fit.cxx:2491
 TSpectrum2Fit.cxx:2492
 TSpectrum2Fit.cxx:2493
 TSpectrum2Fit.cxx:2494
 TSpectrum2Fit.cxx:2495
 TSpectrum2Fit.cxx:2496
 TSpectrum2Fit.cxx:2497
 TSpectrum2Fit.cxx:2498
 TSpectrum2Fit.cxx:2499
 TSpectrum2Fit.cxx:2500
 TSpectrum2Fit.cxx:2501
 TSpectrum2Fit.cxx:2502
 TSpectrum2Fit.cxx:2503
 TSpectrum2Fit.cxx:2504
 TSpectrum2Fit.cxx:2505
 TSpectrum2Fit.cxx:2506
 TSpectrum2Fit.cxx:2507
 TSpectrum2Fit.cxx:2508
 TSpectrum2Fit.cxx:2509
 TSpectrum2Fit.cxx:2510
 TSpectrum2Fit.cxx:2511
 TSpectrum2Fit.cxx:2512
 TSpectrum2Fit.cxx:2513
 TSpectrum2Fit.cxx:2514
 TSpectrum2Fit.cxx:2515
 TSpectrum2Fit.cxx:2516
 TSpectrum2Fit.cxx:2517
 TSpectrum2Fit.cxx:2518
 TSpectrum2Fit.cxx:2519
 TSpectrum2Fit.cxx:2520
 TSpectrum2Fit.cxx:2521
 TSpectrum2Fit.cxx:2522
 TSpectrum2Fit.cxx:2523
 TSpectrum2Fit.cxx:2524
 TSpectrum2Fit.cxx:2525
 TSpectrum2Fit.cxx:2526
 TSpectrum2Fit.cxx:2527
 TSpectrum2Fit.cxx:2528
 TSpectrum2Fit.cxx:2529
 TSpectrum2Fit.cxx:2530
 TSpectrum2Fit.cxx:2531
 TSpectrum2Fit.cxx:2532
 TSpectrum2Fit.cxx:2533
 TSpectrum2Fit.cxx:2534
 TSpectrum2Fit.cxx:2535
 TSpectrum2Fit.cxx:2536
 TSpectrum2Fit.cxx:2537
 TSpectrum2Fit.cxx:2538
 TSpectrum2Fit.cxx:2539
 TSpectrum2Fit.cxx:2540
 TSpectrum2Fit.cxx:2541
 TSpectrum2Fit.cxx:2542
 TSpectrum2Fit.cxx:2543
 TSpectrum2Fit.cxx:2544
 TSpectrum2Fit.cxx:2545
 TSpectrum2Fit.cxx:2546
 TSpectrum2Fit.cxx:2547
 TSpectrum2Fit.cxx:2548
 TSpectrum2Fit.cxx:2549
 TSpectrum2Fit.cxx:2550
 TSpectrum2Fit.cxx:2551
 TSpectrum2Fit.cxx:2552
 TSpectrum2Fit.cxx:2553
 TSpectrum2Fit.cxx:2554
 TSpectrum2Fit.cxx:2555
 TSpectrum2Fit.cxx:2556
 TSpectrum2Fit.cxx:2557
 TSpectrum2Fit.cxx:2558
 TSpectrum2Fit.cxx:2559
 TSpectrum2Fit.cxx:2560
 TSpectrum2Fit.cxx:2561
 TSpectrum2Fit.cxx:2562
 TSpectrum2Fit.cxx:2563
 TSpectrum2Fit.cxx:2564
 TSpectrum2Fit.cxx:2565
 TSpectrum2Fit.cxx:2566
 TSpectrum2Fit.cxx:2567
 TSpectrum2Fit.cxx:2568
 TSpectrum2Fit.cxx:2569
 TSpectrum2Fit.cxx:2570
 TSpectrum2Fit.cxx:2571
 TSpectrum2Fit.cxx:2572
 TSpectrum2Fit.cxx:2573
 TSpectrum2Fit.cxx:2574
 TSpectrum2Fit.cxx:2575
 TSpectrum2Fit.cxx:2576
 TSpectrum2Fit.cxx:2577
 TSpectrum2Fit.cxx:2578
 TSpectrum2Fit.cxx:2579
 TSpectrum2Fit.cxx:2580
 TSpectrum2Fit.cxx:2581
 TSpectrum2Fit.cxx:2582
 TSpectrum2Fit.cxx:2583
 TSpectrum2Fit.cxx:2584
 TSpectrum2Fit.cxx:2585
 TSpectrum2Fit.cxx:2586
 TSpectrum2Fit.cxx:2587
 TSpectrum2Fit.cxx:2588
 TSpectrum2Fit.cxx:2589
 TSpectrum2Fit.cxx:2590
 TSpectrum2Fit.cxx:2591
 TSpectrum2Fit.cxx:2592
 TSpectrum2Fit.cxx:2593
 TSpectrum2Fit.cxx:2594
 TSpectrum2Fit.cxx:2595
 TSpectrum2Fit.cxx:2596
 TSpectrum2Fit.cxx:2597
 TSpectrum2Fit.cxx:2598
 TSpectrum2Fit.cxx:2599
 TSpectrum2Fit.cxx:2600
 TSpectrum2Fit.cxx:2601
 TSpectrum2Fit.cxx:2602
 TSpectrum2Fit.cxx:2603
 TSpectrum2Fit.cxx:2604
 TSpectrum2Fit.cxx:2605
 TSpectrum2Fit.cxx:2606
 TSpectrum2Fit.cxx:2607
 TSpectrum2Fit.cxx:2608
 TSpectrum2Fit.cxx:2609
 TSpectrum2Fit.cxx:2610
 TSpectrum2Fit.cxx:2611
 TSpectrum2Fit.cxx:2612
 TSpectrum2Fit.cxx:2613
 TSpectrum2Fit.cxx:2614
 TSpectrum2Fit.cxx:2615
 TSpectrum2Fit.cxx:2616
 TSpectrum2Fit.cxx:2617
 TSpectrum2Fit.cxx:2618
 TSpectrum2Fit.cxx:2619
 TSpectrum2Fit.cxx:2620
 TSpectrum2Fit.cxx:2621
 TSpectrum2Fit.cxx:2622
 TSpectrum2Fit.cxx:2623
 TSpectrum2Fit.cxx:2624
 TSpectrum2Fit.cxx:2625
 TSpectrum2Fit.cxx:2626
 TSpectrum2Fit.cxx:2627
 TSpectrum2Fit.cxx:2628
 TSpectrum2Fit.cxx:2629
 TSpectrum2Fit.cxx:2630
 TSpectrum2Fit.cxx:2631
 TSpectrum2Fit.cxx:2632
 TSpectrum2Fit.cxx:2633
 TSpectrum2Fit.cxx:2634
 TSpectrum2Fit.cxx:2635
 TSpectrum2Fit.cxx:2636
 TSpectrum2Fit.cxx:2637
 TSpectrum2Fit.cxx:2638
 TSpectrum2Fit.cxx:2639
 TSpectrum2Fit.cxx:2640
 TSpectrum2Fit.cxx:2641
 TSpectrum2Fit.cxx:2642
 TSpectrum2Fit.cxx:2643
 TSpectrum2Fit.cxx:2644
 TSpectrum2Fit.cxx:2645
 TSpectrum2Fit.cxx:2646
 TSpectrum2Fit.cxx:2647
 TSpectrum2Fit.cxx:2648
 TSpectrum2Fit.cxx:2649
 TSpectrum2Fit.cxx:2650
 TSpectrum2Fit.cxx:2651
 TSpectrum2Fit.cxx:2652
 TSpectrum2Fit.cxx:2653
 TSpectrum2Fit.cxx:2654
 TSpectrum2Fit.cxx:2655
 TSpectrum2Fit.cxx:2656
 TSpectrum2Fit.cxx:2657
 TSpectrum2Fit.cxx:2658
 TSpectrum2Fit.cxx:2659
 TSpectrum2Fit.cxx:2660
 TSpectrum2Fit.cxx:2661
 TSpectrum2Fit.cxx:2662
 TSpectrum2Fit.cxx:2663
 TSpectrum2Fit.cxx:2664
 TSpectrum2Fit.cxx:2665
 TSpectrum2Fit.cxx:2666
 TSpectrum2Fit.cxx:2667
 TSpectrum2Fit.cxx:2668
 TSpectrum2Fit.cxx:2669
 TSpectrum2Fit.cxx:2670
 TSpectrum2Fit.cxx:2671
 TSpectrum2Fit.cxx:2672
 TSpectrum2Fit.cxx:2673
 TSpectrum2Fit.cxx:2674
 TSpectrum2Fit.cxx:2675
 TSpectrum2Fit.cxx:2676
 TSpectrum2Fit.cxx:2677
 TSpectrum2Fit.cxx:2678
 TSpectrum2Fit.cxx:2679
 TSpectrum2Fit.cxx:2680
 TSpectrum2Fit.cxx:2681
 TSpectrum2Fit.cxx:2682
 TSpectrum2Fit.cxx:2683
 TSpectrum2Fit.cxx:2684
 TSpectrum2Fit.cxx:2685
 TSpectrum2Fit.cxx:2686
 TSpectrum2Fit.cxx:2687
 TSpectrum2Fit.cxx:2688
 TSpectrum2Fit.cxx:2689
 TSpectrum2Fit.cxx:2690
 TSpectrum2Fit.cxx:2691
 TSpectrum2Fit.cxx:2692
 TSpectrum2Fit.cxx:2693
 TSpectrum2Fit.cxx:2694
 TSpectrum2Fit.cxx:2695
 TSpectrum2Fit.cxx:2696
 TSpectrum2Fit.cxx:2697
 TSpectrum2Fit.cxx:2698
 TSpectrum2Fit.cxx:2699
 TSpectrum2Fit.cxx:2700
 TSpectrum2Fit.cxx:2701
 TSpectrum2Fit.cxx:2702
 TSpectrum2Fit.cxx:2703
 TSpectrum2Fit.cxx:2704
 TSpectrum2Fit.cxx:2705
 TSpectrum2Fit.cxx:2706
 TSpectrum2Fit.cxx:2707
 TSpectrum2Fit.cxx:2708
 TSpectrum2Fit.cxx:2709
 TSpectrum2Fit.cxx:2710
 TSpectrum2Fit.cxx:2711
 TSpectrum2Fit.cxx:2712
 TSpectrum2Fit.cxx:2713
 TSpectrum2Fit.cxx:2714
 TSpectrum2Fit.cxx:2715
 TSpectrum2Fit.cxx:2716
 TSpectrum2Fit.cxx:2717
 TSpectrum2Fit.cxx:2718
 TSpectrum2Fit.cxx:2719
 TSpectrum2Fit.cxx:2720
 TSpectrum2Fit.cxx:2721
 TSpectrum2Fit.cxx:2722
 TSpectrum2Fit.cxx:2723
 TSpectrum2Fit.cxx:2724
 TSpectrum2Fit.cxx:2725
 TSpectrum2Fit.cxx:2726
 TSpectrum2Fit.cxx:2727
 TSpectrum2Fit.cxx:2728
 TSpectrum2Fit.cxx:2729
 TSpectrum2Fit.cxx:2730
 TSpectrum2Fit.cxx:2731
 TSpectrum2Fit.cxx:2732
 TSpectrum2Fit.cxx:2733
 TSpectrum2Fit.cxx:2734
 TSpectrum2Fit.cxx:2735
 TSpectrum2Fit.cxx:2736
 TSpectrum2Fit.cxx:2737
 TSpectrum2Fit.cxx:2738
 TSpectrum2Fit.cxx:2739
 TSpectrum2Fit.cxx:2740
 TSpectrum2Fit.cxx:2741
 TSpectrum2Fit.cxx:2742
 TSpectrum2Fit.cxx:2743
 TSpectrum2Fit.cxx:2744
 TSpectrum2Fit.cxx:2745
 TSpectrum2Fit.cxx:2746
 TSpectrum2Fit.cxx:2747
 TSpectrum2Fit.cxx:2748
 TSpectrum2Fit.cxx:2749
 TSpectrum2Fit.cxx:2750
 TSpectrum2Fit.cxx:2751
 TSpectrum2Fit.cxx:2752
 TSpectrum2Fit.cxx:2753
 TSpectrum2Fit.cxx:2754
 TSpectrum2Fit.cxx:2755
 TSpectrum2Fit.cxx:2756
 TSpectrum2Fit.cxx:2757
 TSpectrum2Fit.cxx:2758
 TSpectrum2Fit.cxx:2759
 TSpectrum2Fit.cxx:2760
 TSpectrum2Fit.cxx:2761
 TSpectrum2Fit.cxx:2762
 TSpectrum2Fit.cxx:2763
 TSpectrum2Fit.cxx:2764
 TSpectrum2Fit.cxx:2765
 TSpectrum2Fit.cxx:2766
 TSpectrum2Fit.cxx:2767
 TSpectrum2Fit.cxx:2768
 TSpectrum2Fit.cxx:2769
 TSpectrum2Fit.cxx:2770
 TSpectrum2Fit.cxx:2771
 TSpectrum2Fit.cxx:2772
 TSpectrum2Fit.cxx:2773
 TSpectrum2Fit.cxx:2774
 TSpectrum2Fit.cxx:2775
 TSpectrum2Fit.cxx:2776
 TSpectrum2Fit.cxx:2777
 TSpectrum2Fit.cxx:2778
 TSpectrum2Fit.cxx:2779
 TSpectrum2Fit.cxx:2780
 TSpectrum2Fit.cxx:2781
 TSpectrum2Fit.cxx:2782
 TSpectrum2Fit.cxx:2783
 TSpectrum2Fit.cxx:2784
 TSpectrum2Fit.cxx:2785
 TSpectrum2Fit.cxx:2786
 TSpectrum2Fit.cxx:2787
 TSpectrum2Fit.cxx:2788
 TSpectrum2Fit.cxx:2789
 TSpectrum2Fit.cxx:2790
 TSpectrum2Fit.cxx:2791
 TSpectrum2Fit.cxx:2792
 TSpectrum2Fit.cxx:2793
 TSpectrum2Fit.cxx:2794
 TSpectrum2Fit.cxx:2795
 TSpectrum2Fit.cxx:2796
 TSpectrum2Fit.cxx:2797
 TSpectrum2Fit.cxx:2798
 TSpectrum2Fit.cxx:2799
 TSpectrum2Fit.cxx:2800
 TSpectrum2Fit.cxx:2801
 TSpectrum2Fit.cxx:2802
 TSpectrum2Fit.cxx:2803
 TSpectrum2Fit.cxx:2804
 TSpectrum2Fit.cxx:2805
 TSpectrum2Fit.cxx:2806
 TSpectrum2Fit.cxx:2807
 TSpectrum2Fit.cxx:2808
 TSpectrum2Fit.cxx:2809
 TSpectrum2Fit.cxx:2810
 TSpectrum2Fit.cxx:2811
 TSpectrum2Fit.cxx:2812
 TSpectrum2Fit.cxx:2813
 TSpectrum2Fit.cxx:2814
 TSpectrum2Fit.cxx:2815
 TSpectrum2Fit.cxx:2816
 TSpectrum2Fit.cxx:2817
 TSpectrum2Fit.cxx:2818
 TSpectrum2Fit.cxx:2819
 TSpectrum2Fit.cxx:2820
 TSpectrum2Fit.cxx:2821
 TSpectrum2Fit.cxx:2822
 TSpectrum2Fit.cxx:2823
 TSpectrum2Fit.cxx:2824
 TSpectrum2Fit.cxx:2825
 TSpectrum2Fit.cxx:2826
 TSpectrum2Fit.cxx:2827
 TSpectrum2Fit.cxx:2828
 TSpectrum2Fit.cxx:2829
 TSpectrum2Fit.cxx:2830
 TSpectrum2Fit.cxx:2831
 TSpectrum2Fit.cxx:2832
 TSpectrum2Fit.cxx:2833
 TSpectrum2Fit.cxx:2834
 TSpectrum2Fit.cxx:2835
 TSpectrum2Fit.cxx:2836
 TSpectrum2Fit.cxx:2837
 TSpectrum2Fit.cxx:2838
 TSpectrum2Fit.cxx:2839
 TSpectrum2Fit.cxx:2840
 TSpectrum2Fit.cxx:2841
 TSpectrum2Fit.cxx:2842
 TSpectrum2Fit.cxx:2843
 TSpectrum2Fit.cxx:2844
 TSpectrum2Fit.cxx:2845
 TSpectrum2Fit.cxx:2846
 TSpectrum2Fit.cxx:2847
 TSpectrum2Fit.cxx:2848
 TSpectrum2Fit.cxx:2849
 TSpectrum2Fit.cxx:2850
 TSpectrum2Fit.cxx:2851
 TSpectrum2Fit.cxx:2852
 TSpectrum2Fit.cxx:2853
 TSpectrum2Fit.cxx:2854
 TSpectrum2Fit.cxx:2855
 TSpectrum2Fit.cxx:2856
 TSpectrum2Fit.cxx:2857
 TSpectrum2Fit.cxx:2858
 TSpectrum2Fit.cxx:2859
 TSpectrum2Fit.cxx:2860
 TSpectrum2Fit.cxx:2861
 TSpectrum2Fit.cxx:2862
 TSpectrum2Fit.cxx:2863
 TSpectrum2Fit.cxx:2864
 TSpectrum2Fit.cxx:2865
 TSpectrum2Fit.cxx:2866
 TSpectrum2Fit.cxx:2867
 TSpectrum2Fit.cxx:2868
 TSpectrum2Fit.cxx:2869
 TSpectrum2Fit.cxx:2870
 TSpectrum2Fit.cxx:2871
 TSpectrum2Fit.cxx:2872
 TSpectrum2Fit.cxx:2873
 TSpectrum2Fit.cxx:2874
 TSpectrum2Fit.cxx:2875
 TSpectrum2Fit.cxx:2876
 TSpectrum2Fit.cxx:2877
 TSpectrum2Fit.cxx:2878
 TSpectrum2Fit.cxx:2879
 TSpectrum2Fit.cxx:2880
 TSpectrum2Fit.cxx:2881
 TSpectrum2Fit.cxx:2882
 TSpectrum2Fit.cxx:2883
 TSpectrum2Fit.cxx:2884
 TSpectrum2Fit.cxx:2885
 TSpectrum2Fit.cxx:2886
 TSpectrum2Fit.cxx:2887
 TSpectrum2Fit.cxx:2888
 TSpectrum2Fit.cxx:2889
 TSpectrum2Fit.cxx:2890
 TSpectrum2Fit.cxx:2891
 TSpectrum2Fit.cxx:2892
 TSpectrum2Fit.cxx:2893
 TSpectrum2Fit.cxx:2894
 TSpectrum2Fit.cxx:2895
 TSpectrum2Fit.cxx:2896
 TSpectrum2Fit.cxx:2897
 TSpectrum2Fit.cxx:2898
 TSpectrum2Fit.cxx:2899
 TSpectrum2Fit.cxx:2900
 TSpectrum2Fit.cxx:2901
 TSpectrum2Fit.cxx:2902
 TSpectrum2Fit.cxx:2903
 TSpectrum2Fit.cxx:2904
 TSpectrum2Fit.cxx:2905
 TSpectrum2Fit.cxx:2906
 TSpectrum2Fit.cxx:2907
 TSpectrum2Fit.cxx:2908
 TSpectrum2Fit.cxx:2909
 TSpectrum2Fit.cxx:2910
 TSpectrum2Fit.cxx:2911
 TSpectrum2Fit.cxx:2912
 TSpectrum2Fit.cxx:2913
 TSpectrum2Fit.cxx:2914
 TSpectrum2Fit.cxx:2915
 TSpectrum2Fit.cxx:2916
 TSpectrum2Fit.cxx:2917
 TSpectrum2Fit.cxx:2918
 TSpectrum2Fit.cxx:2919
 TSpectrum2Fit.cxx:2920
 TSpectrum2Fit.cxx:2921
 TSpectrum2Fit.cxx:2922
 TSpectrum2Fit.cxx:2923
 TSpectrum2Fit.cxx:2924
 TSpectrum2Fit.cxx:2925
 TSpectrum2Fit.cxx:2926
 TSpectrum2Fit.cxx:2927
 TSpectrum2Fit.cxx:2928
 TSpectrum2Fit.cxx:2929
 TSpectrum2Fit.cxx:2930
 TSpectrum2Fit.cxx:2931
 TSpectrum2Fit.cxx:2932
 TSpectrum2Fit.cxx:2933
 TSpectrum2Fit.cxx:2934
 TSpectrum2Fit.cxx:2935
 TSpectrum2Fit.cxx:2936
 TSpectrum2Fit.cxx:2937
 TSpectrum2Fit.cxx:2938
 TSpectrum2Fit.cxx:2939
 TSpectrum2Fit.cxx:2940
 TSpectrum2Fit.cxx:2941
 TSpectrum2Fit.cxx:2942
 TSpectrum2Fit.cxx:2943
 TSpectrum2Fit.cxx:2944
 TSpectrum2Fit.cxx:2945
 TSpectrum2Fit.cxx:2946
 TSpectrum2Fit.cxx:2947
 TSpectrum2Fit.cxx:2948
 TSpectrum2Fit.cxx:2949
 TSpectrum2Fit.cxx:2950
 TSpectrum2Fit.cxx:2951
 TSpectrum2Fit.cxx:2952
 TSpectrum2Fit.cxx:2953
 TSpectrum2Fit.cxx:2954
 TSpectrum2Fit.cxx:2955
 TSpectrum2Fit.cxx:2956
 TSpectrum2Fit.cxx:2957
 TSpectrum2Fit.cxx:2958
 TSpectrum2Fit.cxx:2959
 TSpectrum2Fit.cxx:2960
 TSpectrum2Fit.cxx:2961
 TSpectrum2Fit.cxx:2962
 TSpectrum2Fit.cxx:2963
 TSpectrum2Fit.cxx:2964
 TSpectrum2Fit.cxx:2965
 TSpectrum2Fit.cxx:2966
 TSpectrum2Fit.cxx:2967
 TSpectrum2Fit.cxx:2968
 TSpectrum2Fit.cxx:2969
 TSpectrum2Fit.cxx:2970
 TSpectrum2Fit.cxx:2971
 TSpectrum2Fit.cxx:2972
 TSpectrum2Fit.cxx:2973
 TSpectrum2Fit.cxx:2974
 TSpectrum2Fit.cxx:2975
 TSpectrum2Fit.cxx:2976
 TSpectrum2Fit.cxx:2977
 TSpectrum2Fit.cxx:2978
 TSpectrum2Fit.cxx:2979
 TSpectrum2Fit.cxx:2980
 TSpectrum2Fit.cxx:2981
 TSpectrum2Fit.cxx:2982
 TSpectrum2Fit.cxx:2983
 TSpectrum2Fit.cxx:2984
 TSpectrum2Fit.cxx:2985
 TSpectrum2Fit.cxx:2986
 TSpectrum2Fit.cxx:2987
 TSpectrum2Fit.cxx:2988
 TSpectrum2Fit.cxx:2989
 TSpectrum2Fit.cxx:2990
 TSpectrum2Fit.cxx:2991
 TSpectrum2Fit.cxx:2992
 TSpectrum2Fit.cxx:2993
 TSpectrum2Fit.cxx:2994
 TSpectrum2Fit.cxx:2995
 TSpectrum2Fit.cxx:2996
 TSpectrum2Fit.cxx:2997
 TSpectrum2Fit.cxx:2998
 TSpectrum2Fit.cxx:2999
 TSpectrum2Fit.cxx:3000
 TSpectrum2Fit.cxx:3001
 TSpectrum2Fit.cxx:3002
 TSpectrum2Fit.cxx:3003
 TSpectrum2Fit.cxx:3004
 TSpectrum2Fit.cxx:3005
 TSpectrum2Fit.cxx:3006
 TSpectrum2Fit.cxx:3007
 TSpectrum2Fit.cxx:3008
 TSpectrum2Fit.cxx:3009
 TSpectrum2Fit.cxx:3010
 TSpectrum2Fit.cxx:3011
 TSpectrum2Fit.cxx:3012
 TSpectrum2Fit.cxx:3013
 TSpectrum2Fit.cxx:3014
 TSpectrum2Fit.cxx:3015
 TSpectrum2Fit.cxx:3016
 TSpectrum2Fit.cxx:3017
 TSpectrum2Fit.cxx:3018
 TSpectrum2Fit.cxx:3019
 TSpectrum2Fit.cxx:3020
 TSpectrum2Fit.cxx:3021
 TSpectrum2Fit.cxx:3022
 TSpectrum2Fit.cxx:3023
 TSpectrum2Fit.cxx:3024
 TSpectrum2Fit.cxx:3025
 TSpectrum2Fit.cxx:3026
 TSpectrum2Fit.cxx:3027
 TSpectrum2Fit.cxx:3028
 TSpectrum2Fit.cxx:3029
 TSpectrum2Fit.cxx:3030
 TSpectrum2Fit.cxx:3031
 TSpectrum2Fit.cxx:3032
 TSpectrum2Fit.cxx:3033
 TSpectrum2Fit.cxx:3034
 TSpectrum2Fit.cxx:3035
 TSpectrum2Fit.cxx:3036
 TSpectrum2Fit.cxx:3037
 TSpectrum2Fit.cxx:3038
 TSpectrum2Fit.cxx:3039
 TSpectrum2Fit.cxx:3040
 TSpectrum2Fit.cxx:3041
 TSpectrum2Fit.cxx:3042
 TSpectrum2Fit.cxx:3043
 TSpectrum2Fit.cxx:3044
 TSpectrum2Fit.cxx:3045
 TSpectrum2Fit.cxx:3046
 TSpectrum2Fit.cxx:3047
 TSpectrum2Fit.cxx:3048
 TSpectrum2Fit.cxx:3049
 TSpectrum2Fit.cxx:3050
 TSpectrum2Fit.cxx:3051
 TSpectrum2Fit.cxx:3052
 TSpectrum2Fit.cxx:3053
 TSpectrum2Fit.cxx:3054
 TSpectrum2Fit.cxx:3055
 TSpectrum2Fit.cxx:3056
 TSpectrum2Fit.cxx:3057
 TSpectrum2Fit.cxx:3058
 TSpectrum2Fit.cxx:3059
 TSpectrum2Fit.cxx:3060
 TSpectrum2Fit.cxx:3061
 TSpectrum2Fit.cxx:3062
 TSpectrum2Fit.cxx:3063
 TSpectrum2Fit.cxx:3064
 TSpectrum2Fit.cxx:3065
 TSpectrum2Fit.cxx:3066
 TSpectrum2Fit.cxx:3067
 TSpectrum2Fit.cxx:3068
 TSpectrum2Fit.cxx:3069
 TSpectrum2Fit.cxx:3070
 TSpectrum2Fit.cxx:3071
 TSpectrum2Fit.cxx:3072
 TSpectrum2Fit.cxx:3073
 TSpectrum2Fit.cxx:3074
 TSpectrum2Fit.cxx:3075
 TSpectrum2Fit.cxx:3076
 TSpectrum2Fit.cxx:3077
 TSpectrum2Fit.cxx:3078
 TSpectrum2Fit.cxx:3079
 TSpectrum2Fit.cxx:3080
 TSpectrum2Fit.cxx:3081
 TSpectrum2Fit.cxx:3082
 TSpectrum2Fit.cxx:3083
 TSpectrum2Fit.cxx:3084
 TSpectrum2Fit.cxx:3085
 TSpectrum2Fit.cxx:3086
 TSpectrum2Fit.cxx:3087
 TSpectrum2Fit.cxx:3088
 TSpectrum2Fit.cxx:3089
 TSpectrum2Fit.cxx:3090
 TSpectrum2Fit.cxx:3091
 TSpectrum2Fit.cxx:3092
 TSpectrum2Fit.cxx:3093
 TSpectrum2Fit.cxx:3094
 TSpectrum2Fit.cxx:3095
 TSpectrum2Fit.cxx:3096
 TSpectrum2Fit.cxx:3097
 TSpectrum2Fit.cxx:3098
 TSpectrum2Fit.cxx:3099
 TSpectrum2Fit.cxx:3100
 TSpectrum2Fit.cxx:3101
 TSpectrum2Fit.cxx:3102
 TSpectrum2Fit.cxx:3103
 TSpectrum2Fit.cxx:3104
 TSpectrum2Fit.cxx:3105
 TSpectrum2Fit.cxx:3106
 TSpectrum2Fit.cxx:3107
 TSpectrum2Fit.cxx:3108
 TSpectrum2Fit.cxx:3109
 TSpectrum2Fit.cxx:3110
 TSpectrum2Fit.cxx:3111
 TSpectrum2Fit.cxx:3112
 TSpectrum2Fit.cxx:3113
 TSpectrum2Fit.cxx:3114
 TSpectrum2Fit.cxx:3115
 TSpectrum2Fit.cxx:3116
 TSpectrum2Fit.cxx:3117
 TSpectrum2Fit.cxx:3118
 TSpectrum2Fit.cxx:3119
 TSpectrum2Fit.cxx:3120
 TSpectrum2Fit.cxx:3121
 TSpectrum2Fit.cxx:3122
 TSpectrum2Fit.cxx:3123
 TSpectrum2Fit.cxx:3124
 TSpectrum2Fit.cxx:3125
 TSpectrum2Fit.cxx:3126
 TSpectrum2Fit.cxx:3127
 TSpectrum2Fit.cxx:3128
 TSpectrum2Fit.cxx:3129
 TSpectrum2Fit.cxx:3130
 TSpectrum2Fit.cxx:3131
 TSpectrum2Fit.cxx:3132
 TSpectrum2Fit.cxx:3133
 TSpectrum2Fit.cxx:3134
 TSpectrum2Fit.cxx:3135
 TSpectrum2Fit.cxx:3136
 TSpectrum2Fit.cxx:3137
 TSpectrum2Fit.cxx:3138
 TSpectrum2Fit.cxx:3139
 TSpectrum2Fit.cxx:3140
 TSpectrum2Fit.cxx:3141
 TSpectrum2Fit.cxx:3142
 TSpectrum2Fit.cxx:3143
 TSpectrum2Fit.cxx:3144
 TSpectrum2Fit.cxx:3145
 TSpectrum2Fit.cxx:3146
 TSpectrum2Fit.cxx:3147
 TSpectrum2Fit.cxx:3148
 TSpectrum2Fit.cxx:3149
 TSpectrum2Fit.cxx:3150
 TSpectrum2Fit.cxx:3151
 TSpectrum2Fit.cxx:3152
 TSpectrum2Fit.cxx:3153
 TSpectrum2Fit.cxx:3154
 TSpectrum2Fit.cxx:3155
 TSpectrum2Fit.cxx:3156
 TSpectrum2Fit.cxx:3157
 TSpectrum2Fit.cxx:3158
 TSpectrum2Fit.cxx:3159
 TSpectrum2Fit.cxx:3160
 TSpectrum2Fit.cxx:3161
 TSpectrum2Fit.cxx:3162
 TSpectrum2Fit.cxx:3163
 TSpectrum2Fit.cxx:3164
 TSpectrum2Fit.cxx:3165
 TSpectrum2Fit.cxx:3166
 TSpectrum2Fit.cxx:3167
 TSpectrum2Fit.cxx:3168
 TSpectrum2Fit.cxx:3169
 TSpectrum2Fit.cxx:3170
 TSpectrum2Fit.cxx:3171
 TSpectrum2Fit.cxx:3172
 TSpectrum2Fit.cxx:3173
 TSpectrum2Fit.cxx:3174
 TSpectrum2Fit.cxx:3175
 TSpectrum2Fit.cxx:3176
 TSpectrum2Fit.cxx:3177
 TSpectrum2Fit.cxx:3178
 TSpectrum2Fit.cxx:3179
 TSpectrum2Fit.cxx:3180
 TSpectrum2Fit.cxx:3181
 TSpectrum2Fit.cxx:3182
 TSpectrum2Fit.cxx:3183
 TSpectrum2Fit.cxx:3184
 TSpectrum2Fit.cxx:3185
 TSpectrum2Fit.cxx:3186
 TSpectrum2Fit.cxx:3187
 TSpectrum2Fit.cxx:3188
 TSpectrum2Fit.cxx:3189
 TSpectrum2Fit.cxx:3190
 TSpectrum2Fit.cxx:3191
 TSpectrum2Fit.cxx:3192
 TSpectrum2Fit.cxx:3193
 TSpectrum2Fit.cxx:3194
 TSpectrum2Fit.cxx:3195
 TSpectrum2Fit.cxx:3196
 TSpectrum2Fit.cxx:3197
 TSpectrum2Fit.cxx:3198
 TSpectrum2Fit.cxx:3199
 TSpectrum2Fit.cxx:3200
 TSpectrum2Fit.cxx:3201
 TSpectrum2Fit.cxx:3202
 TSpectrum2Fit.cxx:3203
 TSpectrum2Fit.cxx:3204
 TSpectrum2Fit.cxx:3205
 TSpectrum2Fit.cxx:3206
 TSpectrum2Fit.cxx:3207
 TSpectrum2Fit.cxx:3208
 TSpectrum2Fit.cxx:3209
 TSpectrum2Fit.cxx:3210
 TSpectrum2Fit.cxx:3211
 TSpectrum2Fit.cxx:3212
 TSpectrum2Fit.cxx:3213
 TSpectrum2Fit.cxx:3214
 TSpectrum2Fit.cxx:3215
 TSpectrum2Fit.cxx:3216
 TSpectrum2Fit.cxx:3217
 TSpectrum2Fit.cxx:3218
 TSpectrum2Fit.cxx:3219
 TSpectrum2Fit.cxx:3220
 TSpectrum2Fit.cxx:3221
 TSpectrum2Fit.cxx:3222
 TSpectrum2Fit.cxx:3223
 TSpectrum2Fit.cxx:3224
 TSpectrum2Fit.cxx:3225
 TSpectrum2Fit.cxx:3226
 TSpectrum2Fit.cxx:3227
 TSpectrum2Fit.cxx:3228
 TSpectrum2Fit.cxx:3229
 TSpectrum2Fit.cxx:3230
 TSpectrum2Fit.cxx:3231
 TSpectrum2Fit.cxx:3232
 TSpectrum2Fit.cxx:3233
 TSpectrum2Fit.cxx:3234
 TSpectrum2Fit.cxx:3235
 TSpectrum2Fit.cxx:3236
 TSpectrum2Fit.cxx:3237
 TSpectrum2Fit.cxx:3238
 TSpectrum2Fit.cxx:3239
 TSpectrum2Fit.cxx:3240
 TSpectrum2Fit.cxx:3241
 TSpectrum2Fit.cxx:3242
 TSpectrum2Fit.cxx:3243
 TSpectrum2Fit.cxx:3244
 TSpectrum2Fit.cxx:3245
 TSpectrum2Fit.cxx:3246
 TSpectrum2Fit.cxx:3247
 TSpectrum2Fit.cxx:3248
 TSpectrum2Fit.cxx:3249
 TSpectrum2Fit.cxx:3250
 TSpectrum2Fit.cxx:3251
 TSpectrum2Fit.cxx:3252
 TSpectrum2Fit.cxx:3253
 TSpectrum2Fit.cxx:3254
 TSpectrum2Fit.cxx:3255
 TSpectrum2Fit.cxx:3256
 TSpectrum2Fit.cxx:3257
 TSpectrum2Fit.cxx:3258
 TSpectrum2Fit.cxx:3259
 TSpectrum2Fit.cxx:3260
 TSpectrum2Fit.cxx:3261
 TSpectrum2Fit.cxx:3262
 TSpectrum2Fit.cxx:3263
 TSpectrum2Fit.cxx:3264
 TSpectrum2Fit.cxx:3265
 TSpectrum2Fit.cxx:3266
 TSpectrum2Fit.cxx:3267
 TSpectrum2Fit.cxx:3268
 TSpectrum2Fit.cxx:3269
 TSpectrum2Fit.cxx:3270
 TSpectrum2Fit.cxx:3271
 TSpectrum2Fit.cxx:3272
 TSpectrum2Fit.cxx:3273
 TSpectrum2Fit.cxx:3274
 TSpectrum2Fit.cxx:3275
 TSpectrum2Fit.cxx:3276
 TSpectrum2Fit.cxx:3277
 TSpectrum2Fit.cxx:3278
 TSpectrum2Fit.cxx:3279
 TSpectrum2Fit.cxx:3280
 TSpectrum2Fit.cxx:3281
 TSpectrum2Fit.cxx:3282
 TSpectrum2Fit.cxx:3283
 TSpectrum2Fit.cxx:3284
 TSpectrum2Fit.cxx:3285
 TSpectrum2Fit.cxx:3286
 TSpectrum2Fit.cxx:3287
 TSpectrum2Fit.cxx:3288
 TSpectrum2Fit.cxx:3289
 TSpectrum2Fit.cxx:3290
 TSpectrum2Fit.cxx:3291
 TSpectrum2Fit.cxx:3292
 TSpectrum2Fit.cxx:3293
 TSpectrum2Fit.cxx:3294
 TSpectrum2Fit.cxx:3295
 TSpectrum2Fit.cxx:3296
 TSpectrum2Fit.cxx:3297
 TSpectrum2Fit.cxx:3298
 TSpectrum2Fit.cxx:3299
 TSpectrum2Fit.cxx:3300
 TSpectrum2Fit.cxx:3301
 TSpectrum2Fit.cxx:3302
 TSpectrum2Fit.cxx:3303
 TSpectrum2Fit.cxx:3304
 TSpectrum2Fit.cxx:3305
 TSpectrum2Fit.cxx:3306
 TSpectrum2Fit.cxx:3307
 TSpectrum2Fit.cxx:3308
 TSpectrum2Fit.cxx:3309
 TSpectrum2Fit.cxx:3310
 TSpectrum2Fit.cxx:3311
 TSpectrum2Fit.cxx:3312
 TSpectrum2Fit.cxx:3313
 TSpectrum2Fit.cxx:3314
 TSpectrum2Fit.cxx:3315
 TSpectrum2Fit.cxx:3316
 TSpectrum2Fit.cxx:3317
 TSpectrum2Fit.cxx:3318
 TSpectrum2Fit.cxx:3319
 TSpectrum2Fit.cxx:3320
 TSpectrum2Fit.cxx:3321
 TSpectrum2Fit.cxx:3322
 TSpectrum2Fit.cxx:3323
 TSpectrum2Fit.cxx:3324
 TSpectrum2Fit.cxx:3325
 TSpectrum2Fit.cxx:3326
 TSpectrum2Fit.cxx:3327
 TSpectrum2Fit.cxx:3328
 TSpectrum2Fit.cxx:3329
 TSpectrum2Fit.cxx:3330
 TSpectrum2Fit.cxx:3331
 TSpectrum2Fit.cxx:3332
 TSpectrum2Fit.cxx:3333
 TSpectrum2Fit.cxx:3334
 TSpectrum2Fit.cxx:3335
 TSpectrum2Fit.cxx:3336
 TSpectrum2Fit.cxx:3337
 TSpectrum2Fit.cxx:3338
 TSpectrum2Fit.cxx:3339
 TSpectrum2Fit.cxx:3340
 TSpectrum2Fit.cxx:3341
 TSpectrum2Fit.cxx:3342
 TSpectrum2Fit.cxx:3343
 TSpectrum2Fit.cxx:3344
 TSpectrum2Fit.cxx:3345
 TSpectrum2Fit.cxx:3346
 TSpectrum2Fit.cxx:3347
 TSpectrum2Fit.cxx:3348
 TSpectrum2Fit.cxx:3349
 TSpectrum2Fit.cxx:3350
 TSpectrum2Fit.cxx:3351
 TSpectrum2Fit.cxx:3352
 TSpectrum2Fit.cxx:3353
 TSpectrum2Fit.cxx:3354
 TSpectrum2Fit.cxx:3355
 TSpectrum2Fit.cxx:3356
 TSpectrum2Fit.cxx:3357
 TSpectrum2Fit.cxx:3358
 TSpectrum2Fit.cxx:3359
 TSpectrum2Fit.cxx:3360
 TSpectrum2Fit.cxx:3361
 TSpectrum2Fit.cxx:3362
 TSpectrum2Fit.cxx:3363
 TSpectrum2Fit.cxx:3364
 TSpectrum2Fit.cxx:3365
 TSpectrum2Fit.cxx:3366
 TSpectrum2Fit.cxx:3367
 TSpectrum2Fit.cxx:3368
 TSpectrum2Fit.cxx:3369
 TSpectrum2Fit.cxx:3370
 TSpectrum2Fit.cxx:3371
 TSpectrum2Fit.cxx:3372
 TSpectrum2Fit.cxx:3373
 TSpectrum2Fit.cxx:3374
 TSpectrum2Fit.cxx:3375
 TSpectrum2Fit.cxx:3376
 TSpectrum2Fit.cxx:3377
 TSpectrum2Fit.cxx:3378
 TSpectrum2Fit.cxx:3379
 TSpectrum2Fit.cxx:3380
 TSpectrum2Fit.cxx:3381
 TSpectrum2Fit.cxx:3382
 TSpectrum2Fit.cxx:3383
 TSpectrum2Fit.cxx:3384
 TSpectrum2Fit.cxx:3385
 TSpectrum2Fit.cxx:3386
 TSpectrum2Fit.cxx:3387
 TSpectrum2Fit.cxx:3388
 TSpectrum2Fit.cxx:3389
 TSpectrum2Fit.cxx:3390
 TSpectrum2Fit.cxx:3391
 TSpectrum2Fit.cxx:3392
 TSpectrum2Fit.cxx:3393
 TSpectrum2Fit.cxx:3394
 TSpectrum2Fit.cxx:3395
 TSpectrum2Fit.cxx:3396
 TSpectrum2Fit.cxx:3397
 TSpectrum2Fit.cxx:3398
 TSpectrum2Fit.cxx:3399
 TSpectrum2Fit.cxx:3400
 TSpectrum2Fit.cxx:3401
 TSpectrum2Fit.cxx:3402
 TSpectrum2Fit.cxx:3403
 TSpectrum2Fit.cxx:3404
 TSpectrum2Fit.cxx:3405
 TSpectrum2Fit.cxx:3406
 TSpectrum2Fit.cxx:3407
 TSpectrum2Fit.cxx:3408
 TSpectrum2Fit.cxx:3409
 TSpectrum2Fit.cxx:3410
 TSpectrum2Fit.cxx:3411
 TSpectrum2Fit.cxx:3412
 TSpectrum2Fit.cxx:3413
 TSpectrum2Fit.cxx:3414
 TSpectrum2Fit.cxx:3415
 TSpectrum2Fit.cxx:3416
 TSpectrum2Fit.cxx:3417
 TSpectrum2Fit.cxx:3418
 TSpectrum2Fit.cxx:3419
 TSpectrum2Fit.cxx:3420
 TSpectrum2Fit.cxx:3421
 TSpectrum2Fit.cxx:3422
 TSpectrum2Fit.cxx:3423
 TSpectrum2Fit.cxx:3424
 TSpectrum2Fit.cxx:3425
 TSpectrum2Fit.cxx:3426
 TSpectrum2Fit.cxx:3427
 TSpectrum2Fit.cxx:3428
 TSpectrum2Fit.cxx:3429
 TSpectrum2Fit.cxx:3430
 TSpectrum2Fit.cxx:3431
 TSpectrum2Fit.cxx:3432
 TSpectrum2Fit.cxx:3433
 TSpectrum2Fit.cxx:3434
 TSpectrum2Fit.cxx:3435
 TSpectrum2Fit.cxx:3436
 TSpectrum2Fit.cxx:3437
 TSpectrum2Fit.cxx:3438
 TSpectrum2Fit.cxx:3439
 TSpectrum2Fit.cxx:3440
 TSpectrum2Fit.cxx: