Skip to content

Commit

Permalink
refs #10384 Separated BackgroundHelper from Rebin and moved it to
Browse files Browse the repository at this point in the history
RemoveBackground.
  • Loading branch information
abuts committed Oct 30, 2014
1 parent f209d78 commit 0cf37b6
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 635 deletions.

This file was deleted.

2 changes: 0 additions & 2 deletions Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/Rebin.h
Expand Up @@ -5,8 +5,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include "MantidAlgorithms/BackgroundHelper.h"

namespace Mantid
{
namespace Algorithms
Expand Down
Expand Up @@ -5,8 +5,6 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include "MantidAlgorithms/BackgroundHelper.h"

namespace Mantid
{
namespace Algorithms
Expand Down Expand Up @@ -37,7 +35,52 @@ namespace Mantid
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/

/**Class actually performing background removal from a workspace spectra */
class DLLExport BackgroundHelper
{
public:
BackgroundHelper();
~BackgroundHelper();
void initialize(const API::MatrixWorkspace_const_sptr &bkgWS,const API::MatrixWorkspace_sptr &sourceWS,
int emode,int nTreads=1,bool inPlace=true);
void removeBackground(int hist,const MantidVec &XValues,MantidVec &y_data,MantidVec &e_data,
int tread_num=0,Kernel::Logger *pLog=NULL)const;

private:
//vector of pointers to the units conversion class for the working workspace;
std::vector<Kernel::Unit *> m_WSUnit;

// shared pointer to the workspace containing background
API::MatrixWorkspace_const_sptr m_bgWs;
// shared pointer to the workspace where background should be removed
API::MatrixWorkspace_const_sptr m_wkWS;

// perform background removal in-place
bool m_inPlace;

// if the background workspace is single value workspace
bool m_singleValueBackground;
// average number of counts at background for first spectra of a background workspace
double m_NBg;
// time interval for measuring the background
double m_dtBg;
// Squared error of the background for first spectra of a background workspace
//double m_ErrSq;
// energy conversion mode
int m_Emode;
// source-sample distance
double m_L1;
// incident for direct or analysis for indirect energy for units conversion
double m_Efix;
// shared pointer to the sample
Geometry::IComponent_const_sptr m_Sample;

// get Ei attached to direct or indirect instrument workspace
double getEi(const API::MatrixWorkspace_const_sptr &inputWS)const;
// the procedure user to delete existing unit converter pointers
void deleteUnitsConverters();
};

class DLLExport RemoveBackground : public API::Algorithm
{
public:
Expand All @@ -62,54 +105,9 @@ namespace Mantid
void init();
virtual void exec();


private:
// method to check if removing background is requested and possible
API::MatrixWorkspace_const_sptr checkRemoveBackgroundParameters(const API::MatrixWorkspace_sptr &inputWS,int &eMode, bool PreserveEvents);
// class responsible for background removal
BackgroundHelper m_BackgroundHelper;
protected: // for testing
/**Class actually performing background removal from a workspace spectra */
class BackgroundHelper
{
public:
BackgroundHelper();
~BackgroundHelper();
void initialize(const API::MatrixWorkspace_const_sptr &bkgWS,const API::MatrixWorkspace_sptr &sourceWS,int emode,int nTreads=1);

void removeBackground(int hist,const MantidVec &XValues,MantidVec &y_data,MantidVec &e_data,int tread_num=0)const;

private:
//vector of pointers to the units conversion class for the working workspace;
std::vector<Kernel::Unit *> m_WSUnit;

// shared pointer to the workspace containing background
API::MatrixWorkspace_const_sptr m_bgWs;
// shared pointer to the workspace where background should be removed
API::MatrixWorkspace_const_sptr m_wkWS;

// if the background workspace is single value workspace
bool m_singleValueBackground;
// average number of counts at background for first spectra of a background workspace
double m_NBg;
// time interval for measuring the background
double m_dtBg;
// Squared error of the background for first spectra of a background workspace
//double m_ErrSq;
// energy conversion mode
int m_Emode;
// source-sample distance
double m_L1;
// incident for direct or analysis for indirect energy for units conversion
double m_Efix;
// shared pointer to the sample
Geometry::IComponent_const_sptr m_Sample;

// get Ei attached to direct or indirect instrument workspace
double getEi(const API::MatrixWorkspace_const_sptr &inputWS)const;
// the procedure user to delete existing unit converter pointers
void deleteUnitsConverters();
};


};
Expand Down

0 comments on commit 0cf37b6

Please sign in to comment.