| 1 | //---------------------------------------------------------------------- |
|---|
| 2 | // Includes |
|---|
| 3 | //---------------------------------------------------------------------- |
|---|
| 4 | #include "Muon_MuonFInteraction.h" |
|---|
| 5 | #include <cmath> |
|---|
| 6 | |
|---|
| 7 | namespace Mantid |
|---|
| 8 | { |
|---|
| 9 | namespace CurveFitting |
|---|
| 10 | { |
|---|
| 11 | |
|---|
| 12 | using namespace Kernel; |
|---|
| 13 | using namespace API; |
|---|
| 14 | |
|---|
| 15 | DECLARE_FUNCTION(Muon_MuonFInteraction) |
|---|
| 16 | |
|---|
| 17 | void Muon_MuonFInteraction::init() |
|---|
| 18 | { |
|---|
| 19 | declareParameter("lambda", 0.2); |
|---|
| 20 | declareParameter("omiga", 0.5); |
|---|
| 21 | declareParameter("Beta", 1); |
|---|
| 22 | declareParameter("A", 1); |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | void Muon_MuonFInteraction::functionLocal(double* out, const double* xValues, const int& nData)const |
|---|
| 27 | { |
|---|
| 28 | const double& lambda = getParameter("lambda"); |
|---|
| 29 | const double& omiga = getParameter("omiga"); |
|---|
| 30 | const double& beta = getParameter("Beta"); |
|---|
| 31 | const double& A = getParameter("A"); |
|---|
| 32 | |
|---|
| 33 | for (int i = 0; i < nData; i++) { |
|---|
| 34 | double A1=exp(-pow(lambda*xValues[i],beta))*A/6; |
|---|
| 35 | double A2=cos(1.732050808*omiga*xValues[i]); |
|---|
| 36 | double A3=(1.0-1.0/1.732050808)*cos(((3.0-1.732050808)/2.0)*omiga*xValues[i]); |
|---|
| 37 | double A4=(1.0+1.0/1.732050808)*cos(((3.0+1.732050808)/2.0)*omiga*xValues[i]); |
|---|
| 38 | |
|---|
| 39 | out[i] = A1*(3+A2+A3+A4); |
|---|
| 40 | } |
|---|
| 41 | } |
|---|
| 42 | void Muon_MuonFInteraction::functionDerivLocal(API::Jacobian* out, const double* xValues, const int& nData) |
|---|
| 43 | { |
|---|
| 44 | calNumericalDeriv(out, xValues, nData); |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | } // namespace CurveFitting |
|---|
| 51 | } // namespace Mantid |
|---|