Skip to content

Commit

Permalink
Progress on Le Bail Fit. Refs #5306.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Jul 19, 2012
1 parent 0bed987 commit f4590a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace CurveFitting
virtual const std::string category() const { return "Peak";}

/// Set up the range of peak calculation for higher efficiency
void setCalculationRange(double tof_low, double tof_upper);
// void setCalculationRange(double tof_low, double tof_upper);
/// Calculate peak
void geneatePeak(double* out, const double* xValues, const size_t nData);
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ namespace CurveFitting
*/
ThermoNeutronBackToBackExpPV::ThermoNeutronBackToBackExpPV() : mFWHM(0.0)
{
mLowTOF = 0.0;
mUpperTOF = 1.0E20;

}

ThermoNeutronBackToBackExpPV::~ThermoNeutronBackToBackExpPV()
Expand Down Expand Up @@ -71,15 +70,9 @@ namespace CurveFitting
return height;
};

/*
* Calculate FWHM
* It will be calculated each time when it is called because
* there is no record whether any peak parameter is changed since last caculation
* of FWHM.
*/
double ThermoNeutronBackToBackExpPV::fwhm() const
{
if (mFWHM < 1.0E-8)
if (fabs(mFWHM) < 1.0E-8)
{
double sigma2 = this->getParameter("Sigma2");
double gamma = this->getParameter("Gamma");
Expand Down Expand Up @@ -120,24 +113,17 @@ namespace CurveFitting
double H, eta;
calHandEta(sigma2, gamma, H, eta);

g_log.debug() << "DB1140: TOF_h = " << tof_h << " h = " << height << ", I = " << this->getParameter("I") << " alpha = "
<< alpha << " beta = " << beta << " H = " << H << " eta = " << eta << " Peak Range = " << mLowTOF << ", "
<< mUpperTOF << std::endl;
// g_log.debug() << "DB1140: TOF_h = " << tof_h << " h = " << height << ", I = " << this->getParameter("I") << " alpha = "
// << alpha << " beta = " << beta << " H = " << H << " eta = " << eta << std::endl;

// 2. Do calculation
g_log.debug() << "DB1143: nData = " << nData << " From " << xValues[0] << " To " << xValues[nData-1] << std::endl;
std::cout << "DB1143: nData = " << nData << " From " << xValues[0] << " To " << xValues[nData-1] << std::endl;
for (size_t id = 0; id < nData; ++id)
{
if (xValues[id] >= mLowTOF && xValues[id] <= mUpperTOF)
{
double dT = xValues[id]-tof_h;
double omega = calOmega(dT, eta, N, alpha, beta, H, sigma2, invert_sqrt2sigma);
out[id] = height*omega;
}
else
{
out[id] = 0.0;
}
double dT = xValues[id]-tof_h;
double omega = calOmega(dT, eta, N, alpha, beta, H, sigma2, invert_sqrt2sigma);
out[id] = height*omega;
// std::cout << "DB1143 " << xValues[id] << " " << out[id] << " " << omega << std::endl;
}

return;
Expand Down Expand Up @@ -225,21 +211,5 @@ namespace CurveFitting
return;
}

/*
* Set the range for a peak to be calculated
*/
void ThermoNeutronBackToBackExpPV::setCalculationRange(double tof_low, double tof_upper)
{
mLowTOF = tof_low;
mUpperTOF = tof_upper;

return;
}

void ThermoNeutronBackToBackExpPV::resetFWHM()
{
mFWHM = 0.0;
}

} // namespace Mantid
} // namespace CurveFitting

0 comments on commit f4590a8

Please sign in to comment.