16#include "MantidHistogramData/Histogram.h"
17#include "MantidHistogramData/HistogramMath.h"
23using namespace Kernel;
25using namespace Geometry;
26using namespace DataObjects;
27using namespace HistogramData;
37 std::make_shared<InstrumentValidator>()),
38 "The workspace to correct for monitor efficiency");
40 "The name of the workspace in which to store the result.");
55 std::string mon_counts_log;
63 mon_counts_log =
"monitor_counts";
75 const auto numberOfSpectra =
static_cast<int>(this->
m_inputWS->getNumberHistograms());
77 auto numberOfSpectra_i =
static_cast<int64_t
>(numberOfSpectra);
80 double factor = 1 / eff0;
82 for (int64_t i = 0; i < numberOfSpectra_i; ++i) {
86 prog.
report(
"Detector Efficiency correction...");
103 p.DefineVar(
"e", &
energy);
105 double eff = p.Eval();
106 g_log.
debug() <<
"Formula: " << formula <<
" with: " <<
energy <<
"evaluated to: " << eff <<
'\n';
109 }
catch (mu::Parser::exception_type &e) {
111 "Error calculating formula from string. Muparser error message is: " + e.GetMsg());
126 std::string ret = par->asString();
127 g_log.
debug() <<
"Parsed parameter " << parameterName <<
": " << ret <<
"\n";
131 "> 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::shared_ptr< Parameter > Parameter_sptr
Typedef for the shared pointer.
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.
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.
Generate a tableworkspace to store the calibration results.
@ Input
An input workspace.
@ Output
An output workspace.