Skip to content

Commit

Permalink
Cleaned the code. Refs #9095.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed May 19, 2014
1 parent adb0d93 commit dec8e76
Show file tree
Hide file tree
Showing 2 changed files with 162 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,16 @@ class DLLExport GetDetOffsetsMultiPeaks: public API::Algorithm

void processProperties();

/// Create workspaces for fitting information
void createInformationWorkspaces();

/// Main function to calculate all detectors' offsets
void calculateDetectorsOffsets();

void importFitWindowTableWorkspace(DataObjects::TableWorkspace_sptr windowtablews);

/// Call Gaussian as a Child Algorithm to fit the peak in a spectrum
int fitSpectra(const int64_t wi, API::MatrixWorkspace_sptr inputW, const std::vector<double> &m_peakPositions,
int fitSpectra(const int64_t wi, API::MatrixWorkspace_sptr m_inputWS, const std::vector<double> &m_peakPositions,
const std::vector<double> &m_fitWindows, size_t &nparams, double &minD, double &maxD,
std::vector<double>&peakPosToFit, std::vector<double> &peakPosFitted, std::vector<double> &chisq,
std::vector<double> &peakHeights, int &i_highestpeak, double& resolution, double& dev_resolution);
Expand All @@ -103,6 +109,7 @@ class DLLExport GetDetOffsetsMultiPeaks: public API::Algorithm
void addInfoToReportWS(int wi, FitPeakOffsetResult offsetresult, const std::vector<double> &tofitpeakpositions,
const std::vector<double> &fittedpeakpositions);

/// Generate a list of peaks to calculate detectors' offset
void generatePeaksList(const API::ITableWorkspace_sptr &peakslist,
int wi,
const std::vector<double> &peakPositionRef,
Expand All @@ -112,12 +119,6 @@ class DLLExport GetDetOffsetsMultiPeaks: public API::Algorithm
const std::vector<double> &fitWindowsToUse, const double minD, const double maxD,
double& deltaDovD, double& dev_deltaDovD);

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

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

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

/// Calculate a spectrum's offset by optimizing offset
Expand All @@ -133,11 +134,15 @@ class DLLExport GetDetOffsetsMultiPeaks: public API::Algorithm
/// Remove rows without offset calculated from offset table workspace
void removeEmptyRowsFromPeakOffsetTable();

API::MatrixWorkspace_sptr inputW;
/// Input workspace
API::MatrixWorkspace_sptr m_inputWS;
/// Input EventWorkspace (from m_inputWS)
DataObjects::EventWorkspace_const_sptr eventW;
bool isEvent;

/// Background type
std::string m_backType;
/// Peak profile type
std::string m_peakType;
double m_maxChiSq;
double m_minPeakHeight;
Expand All @@ -147,6 +152,11 @@ class DLLExport GetDetOffsetsMultiPeaks: public API::Algorithm
std::vector<double> m_peakPositions;
std::vector<double> m_fitWindows;

/// Input resolution
API::MatrixWorkspace_const_sptr m_inputResolutionWS;
/// Flag of use input resolution WS
bool m_hasInputResolution;

DataObjects::OffsetsWorkspace_sptr outputW;
/// Output workspace for debugging purpose
DataObjects::OffsetsWorkspace_sptr outputNP;
Expand All @@ -158,11 +168,13 @@ class DLLExport GetDetOffsetsMultiPeaks: public API::Algorithm
/// Workspace for calculated detector resolution
API::MatrixWorkspace_sptr m_resolutionWS;

/// Flag to use fit window from TableWorkspace per spectrum
/// Flag to use fit window from TableWorkspace per spectrum
bool m_useFitWindowTable;
/// Vector of fit windows (also in vector)
std::vector<std::vector<double> > m_vecFitWindow;



};

} // namespace Algorithm
Expand Down

0 comments on commit dec8e76

Please sign in to comment.