Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Mantid::Algorithms::BackgroundHelper Class Reference

Performs removal of constant (and possibly non-constant after simple modification) background calculated in TOF units from a matrix workspace, expressed in units, different from TOF. More...

#include <RemoveBackground.h>

Public Member Functions

 BackgroundHelper ()
 Constructor. More...
 
 BackgroundHelper (const BackgroundHelper &)=delete
 
void initialize (const API::MatrixWorkspace_const_sptr &bkgWS, const API::MatrixWorkspace_sptr &sourceWS, Kernel::DeltaEMode::Type emode, Kernel::Logger *pLog=nullptr, int nThreads=1, bool inPlace=true, bool nullifyNegative=false)
 Initialization method: More...
 
BackgroundHelperoperator= (const BackgroundHelper &)=delete
 
void removeBackground (int nHist, HistogramData::HistogramX &x_data, HistogramData::HistogramY &y_data, HistogramData::HistogramE &e_data, int threadNum=0) const
 Method removes background from vectors which represent a histogram data for a single spectra. More...
 

Private Attributes

API::MatrixWorkspace_const_sptr m_bgWs
 
double m_dtBg
 
Kernel::DeltaEMode::Type m_Emode
 
double m_ErrSq
 
bool m_inPlace
 
double m_NBg
 
bool m_nullifyNegative
 
Kernel::Loggerm_pgLog
 
bool m_previouslyRemovedBkgMode
 
bool m_singleValueBackground
 
const API::SpectrumInfom_spectrumInfo
 
API::MatrixWorkspace_const_sptr m_wkWS
 
std::vector< std::unique_ptr< Kernel::Unit > > m_WSUnit
 

Detailed Description

Performs removal of constant (and possibly non-constant after simple modification) background calculated in TOF units from a matrix workspace, expressed in units, different from TOF.

Date
26/10/2014 Class actually performing background removal from a workspace spectra

Definition at line 40 of file RemoveBackground.h.

Constructor & Destructor Documentation

◆ BackgroundHelper() [1/2]

Mantid::Algorithms::BackgroundHelper::BackgroundHelper ( )

Constructor.

Definition at line 147 of file RemoveBackground.cpp.

◆ BackgroundHelper() [2/2]

Mantid::Algorithms::BackgroundHelper::BackgroundHelper ( const BackgroundHelper )
delete

Member Function Documentation

◆ initialize()

void Mantid::Algorithms::BackgroundHelper::initialize ( const API::MatrixWorkspace_const_sptr bkgWS,
const API::MatrixWorkspace_sptr sourceWS,
Kernel::DeltaEMode::Type  emode,
Kernel::Logger pLog = nullptr,
int  nThreads = 1,
bool  inPlace = true,
bool  nullifyNegative = false 
)

Initialization method:

Parameters
bkgWS– shared pointer to the workspace which contains background
sourceWS– shared pointer to the workspace to remove background from
emode– energy conversion mode used during internal units conversion (0 – elastic, 1-direct, 2 indirect, as defined in Units conversion
pLog– pointer to the logger class which would report errors
nThreads– number of threads to be used for background removal
inPlace– if the background removal occurs from the existing workspace
nullifyNegative– if true, negative signals are nullified and error is modified appropriately or target workspace has to be cloned.

Definition at line 164 of file RemoveBackground.cpp.

References m_bgWs, m_dtBg, m_Emode, m_ErrSq, m_inPlace, m_NBg, m_nullifyNegative, m_pgLog, m_previouslyRemovedBkgMode, m_singleValueBackground, m_spectrumInfo, m_wkWS, and m_WSUnit.

Referenced by Mantid::Algorithms::RemoveBackground::exec().

◆ operator=()

BackgroundHelper & Mantid::Algorithms::BackgroundHelper::operator= ( const BackgroundHelper )
delete

◆ removeBackground()

void Mantid::Algorithms::BackgroundHelper::removeBackground ( int  nHist,
HistogramData::HistogramX &  x_data,
HistogramData::HistogramY &  y_data,
HistogramData::HistogramE &  e_data,
int  threadNum = 0 
) const

Method removes background from vectors which represent a histogram data for a single spectra.

Parameters
nHist– number (workspaceID) of the spectra in the workspace, where background going to be removed
x_data– the spectra x-values (presumably not in TOF units)
y_data– the spectra signal
e_data– the spectra errors
threadNum– the number of thread doing conversion (by default 0, single thread, in multithreading – result of omp_get_thread_num() )

The error estimate must go up in this nonideal situation and the value of background is a good estimate for it. However, don't reduce the error if it was already more than that

Definition at line 226 of file RemoveBackground.cpp.

References Mantid::Kernel::Logger::debug(), Mantid::API::SpectrumInfo::getDetectorValues(), Mantid::Kernel::Unit::initialize(), Mantid::API::SpectrumInfo::l1(), m_bgWs, m_dtBg, m_Emode, m_ErrSq, m_inPlace, m_NBg, m_nullifyNegative, m_pgLog, m_previouslyRemovedBkgMode, m_singleValueBackground, m_spectrumInfo, m_wkWS, m_WSUnit, Mantid::Kernel::Unit::singleToTOF(), and Mantid::Geometry::X.

Referenced by Mantid::Algorithms::RemoveBackground::exec().

Member Data Documentation

◆ m_bgWs

API::MatrixWorkspace_const_sptr Mantid::Algorithms::BackgroundHelper::m_bgWs
private

Definition at line 60 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().

◆ m_dtBg

double Mantid::Algorithms::BackgroundHelper::m_dtBg
private

Definition at line 77 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().

◆ m_Emode

Kernel::DeltaEMode::Type Mantid::Algorithms::BackgroundHelper::m_Emode
private

Definition at line 82 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().

◆ m_ErrSq

double Mantid::Algorithms::BackgroundHelper::m_ErrSq
private

Definition at line 80 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().

◆ m_inPlace

bool Mantid::Algorithms::BackgroundHelper::m_inPlace
private

Definition at line 69 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().

◆ m_NBg

double Mantid::Algorithms::BackgroundHelper::m_NBg
private

Definition at line 75 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().

◆ m_nullifyNegative

bool Mantid::Algorithms::BackgroundHelper::m_nullifyNegative
private

Definition at line 84 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().

◆ m_pgLog

Kernel::Logger* Mantid::Algorithms::BackgroundHelper::m_pgLog
private

Definition at line 67 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().

◆ m_previouslyRemovedBkgMode

bool Mantid::Algorithms::BackgroundHelper::m_previouslyRemovedBkgMode
private

Definition at line 86 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().

◆ m_singleValueBackground

bool Mantid::Algorithms::BackgroundHelper::m_singleValueBackground
private

Definition at line 72 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().

◆ m_spectrumInfo

const API::SpectrumInfo* Mantid::Algorithms::BackgroundHelper::m_spectrumInfo
private

Definition at line 64 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().

◆ m_wkWS

API::MatrixWorkspace_const_sptr Mantid::Algorithms::BackgroundHelper::m_wkWS
private

Definition at line 62 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().

◆ m_WSUnit

std::vector<std::unique_ptr<Kernel::Unit> > Mantid::Algorithms::BackgroundHelper::m_WSUnit
private

Definition at line 57 of file RemoveBackground.h.

Referenced by initialize(), and removeBackground().


The documentation for this class was generated from the following files: