17#include "MantidHistogramData/Histogram.h"
18#include "MantidHistogramData/HistogramMath.h"
24using namespace Kernel;
26using namespace Geometry;
27using namespace DataObjects;
28using namespace HistogramData;
38 std::make_shared<InstrumentValidator>()),
39 "The workspace to correct for monitor efficiency");
41 "The name of the workspace in which to store the result.");
56 std::string mon_counts_log;
64 mon_counts_log =
"monitor_counts";
76 const auto numberOfSpectra =
static_cast<int>(this->
m_inputWS->getNumberHistograms());
78 auto numberOfSpectra_i =
static_cast<int64_t
>(numberOfSpectra);
81 double factor = 1 / eff0;
83 for (int64_t i = 0; i < numberOfSpectra_i; ++i) {
87 prog.
report(
"Detector Efficiency correction...");
104 p.DefineVar(
"e", &
energy);
106 double eff = p.Eval();
107 g_log.
debug() <<
"Formula: " << formula <<
" with: " <<
energy <<
"evaluated to: " << eff <<
'\n';
110 }
catch (mu::Parser::exception_type &e) {
112 "Error calculating formula from string. Muparser error message is: " + e.GetMsg());
123 const auto &componentInfo =
m_inputWS->componentInfo();
125 const auto firstComponent = componentInfo.children(componentInfo.root()).front();
126 if (componentInfo.hasParameter(firstComponent, parameterName)) {
127 std::string ret = componentInfo.getParameterAsString(firstComponent, parameterName);
128 g_log.
debug() <<
"Parsed parameter " << parameterName <<
": " << ret <<
"\n";
132 "> in the instrument definition!");
#define DECLARE_ALGORITHM(classname)
#define PARALLEL_START_INTERRUPT_REGION
Begins a block to skip processing is the algorithm has been interupted Note the end of the block if n...
#define PARALLEL_END_INTERRUPT_REGION
Ends a block to skip processing is the algorithm has been interupted Note the start of the block if n...
#define PARALLEL_FOR_IF(condition)
Empty definitions - to enable set your complier to enable openMP.
#define PARALLEL_CHECK_INTERRUPT_REGION
Adds a check after a Parallel region to see if it was interupted.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
Helper class for reporting progress from algorithms.
A property class for workspaces.
API::MatrixWorkspace_const_sptr m_inputWS
The user selected (input) workspace.
double calculateFormulaValue(const std::string &, double)
Calculate the value of a formula.
double m_Ei
stores the incident energy of the neutrons
std::string getValFromInstrumentDef(const std::string &)
Returns the value associated to a parameter name in the IDF.
API::MatrixWorkspace_sptr m_outputWS
The output workspace, maybe the same as the input one.
void exec() override
Execution code.
double m_monitorCounts
stores the total count of neutrons from the monitor
Exception for errors associated with the instrument definition.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void debug(const std::string &msg)
Logs at debug level.
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
std::enable_if< std::is_pointer< Arg >::value, bool >::type threadSafe(Arg workspace)
Thread-safety check Checks the workspace to ensure it is suitable for multithreaded access.
@ Input
An input workspace.
@ Output
An output workspace.