Skip to content

Commit

Permalink
Refactored GetDetOffsetsMultiPeaks for future development. Refs #8773.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Feb 5, 2014
1 parent 5f4aa84 commit 43b66ae
Show file tree
Hide file tree
Showing 2 changed files with 344 additions and 45 deletions.
Expand Up @@ -4,6 +4,7 @@
#include "MantidAPI/Algorithm.h"
#include "MantidKernel/System.h"
#include "MantidDataObjects/OffsetsWorkspace.h"
#include "MantidDataObjects/EventWorkspace.h"
#include "MantidDataObjects/TableWorkspace.h"
#include "MantidAPI/MatrixWorkspace.h"
#include <gsl/gsl_blas.h>
Expand All @@ -15,6 +16,24 @@ namespace Mantid
{
namespace Algorithms
{

struct FitPeakOffsetResult
{
double mask;
double offset;
double chi2;
/// ???
double fitSum;
/// summation of chi-square
double chisqSum;
///
double peakPosFittedSize;
int numpeakstofit;
int numpeaksfitted;
int numpeaksindrange;
std::string fitoffsetstatus;
};

/**
Find the offsets for each detector
Expand Down Expand Up @@ -65,10 +84,30 @@ class DLLExport GetDetOffsetsMultiPeaks: public API::Algorithm
// Overridden Algorithm methods
void init();
void exec();

/// Generate output information table workspace
Mantid::DataObjects::TableWorkspace_sptr createOutputInfoTable();

/// Generate output peak information table workspace
Mantid::DataObjects::TableWorkspace_sptr createOutputPeakOffsetTable();

FitPeakOffsetResult calculatePeakOffset(const int wi, std::vector<double>& fittedpeakpositions, std::vector<double>& tofitpeakpositions);

void makeFitSummary(const DataObjects::TableWorkspace_sptr& infows);

API::MatrixWorkspace_sptr inputW;
DataObjects::EventWorkspace_const_sptr eventW;
bool isEvent;

std::string m_backType;
std::string m_peakType;
double m_maxChiSq;
double m_minPeakHeight;

double maxOffset;

std::vector<double> peakPositions;
std::vector<double> fitWindows;
};

} // namespace Algorithm
Expand Down

0 comments on commit 43b66ae

Please sign in to comment.