25const
std::
string MinusMD::name()
const {
return "MinusMD"; }
41 throw std::runtime_error(
"Cannot subtract a MDHistoWorkspace and a "
42 "MDEventWorkspace (only MDEventWorkspace - "
43 "MDEventWorkspace is allowed).");
45 throw std::runtime_error(
"Cannot subtract a MDEventWorkspace and a "
46 "scalar (only MDEventWorkspace - "
47 "MDEventWorkspace is allowed).");
61 throw std::runtime_error(
"Incompatible workspace types passed to MinusMD.");
81 std::vector<MDE> eventsCopy;
82 eventsCopy.reserve(events.size());
83 for (
auto it = events.begin(); it != events.end(); it++) {
86 eventsCopy.emplace_back(eventCopy);
92 prog.
report(
"Substracting Events");
95 this->
progress(0.41,
"Splitting Boxes");
99 auto prog2 =
new Progress(
this, 0.4, 0.9, 100);
103 prog2->resetNumSteps(ts->
size(), 0.4, 0.6);
106 this->
progress(0.95,
"Refreshing cache");
132 out->subtract(*operand);
139 out->subtract(scalar->y(0)[0], scalar->e(0)[0]);
#define DECLARE_ALGORITHM(classname)
static std::unique_ptr< QThreadPool > tp
#define CALL_MDEVENT_FUNCTION(funcname, workspace)
Macro that makes it possible to call a templated method for a MDEventWorkspace using a IMDEventWorksp...
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
size_t getTotalNumMDBoxes() const
Return the total number of MD Boxes, irrespective of depth.
void setFileNeedsUpdating(bool value)
Sets the marker set to true when a file-backed workspace needs its back-end file updated (by calling ...
Helper class for reporting progress from algorithms.
Templated super-class of a multi-dimensional event "box".
virtual size_t addEvents(const std::vector< MDE > &events)
Mantid::API::BoxController * getBoxController() const override
MDBoxIterator: iterate through MDBoxBase hierarchy down to a given maximum depth.
bool next() override
Advance to the next cell.
MDBoxBase< MDE, nd > * getBox() const
Return a pointer to the current box pointed to by the iterator.
Templated class for a multi-dimensional event "box".
const std::vector< MDE > & getConstEvents() const
Get vector of constant events to use.
uint64_t getNPoints() const override
std::shared_ptr< MDEventWorkspace< MDE, nd > > sptr
Typedef for a shared pointer of this kind of event workspace.
MDBoxBase< MDE, nd > * getBox()
void splitAllIfNeeded(Kernel::ThreadScheduler *ts) override
Split all boxes that exceed the split threshold.
void refreshCache() override
Refresh the cache (integrated signal of each box)
Templated class holding data about a neutron detection event in N-dimensions (for example,...
float getSignal() const
Returns the signal (weight) of this event.
void setSignal(const float newSignal)
Set the signal of the event.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
A Thread Pool implementation that keeps a certain number of threads running (normally,...
A First-In-First-Out Thread Scheduler.
The ThreadScheduler object defines how tasks are allocated to threads and in what order.
virtual size_t size()=0
Returns the size of the queue.
Mantid::API::IMDEventWorkspace_sptr m_rhs_event
Mantid::API::IMDEventWorkspace_sptr m_lhs_event
For checkInputs.
Mantid::DataObjects::WorkspaceSingleValue_sptr m_rhs_scalar
Mantid::API::IMDEventWorkspace_sptr m_operand_event
Operand MDEventWorkspace.
Mantid::DataObjects::WorkspaceSingleValue_sptr m_lhs_scalar
Mantid::DataObjects::MDHistoWorkspace_sptr m_rhs_histo
Mantid::DataObjects::MDHistoWorkspace_sptr m_lhs_histo
Mantid::API::IMDEventWorkspace_sptr m_out_event
Output MDEventWorkspace.
MinusMD : minus operation for MDWorkspaces.
void execHistoScalar(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::WorkspaceSingleValue_const_sptr scalar) override
Run the algorithm with a MDHisotWorkspace as output, scalar and operand.
bool commutative() const override
Is the operation commutative?
void checkInputs() override
Check the inputs and throw if the algorithm cannot be run.
int version() const override
Algorithm's version for identification.
void execHistoHisto(Mantid::DataObjects::MDHistoWorkspace_sptr out, Mantid::DataObjects::MDHistoWorkspace_const_sptr operand) override
Run the algorithm with a MDHisotWorkspace as output and operand.
void doMinus(typename Mantid::DataObjects::MDEventWorkspace< MDE, nd >::sptr ws)
Perform the subtraction.
void execEvent() override
Run the algorithm with an MDEventWorkspace as output.
std::shared_ptr< const WorkspaceSingleValue > WorkspaceSingleValue_const_sptr
std::shared_ptr< MDHistoWorkspace > MDHistoWorkspace_sptr
A shared pointer to a MDHistoWorkspace.
std::shared_ptr< const MDHistoWorkspace > MDHistoWorkspace_const_sptr
A shared pointer to a const MDHistoWorkspace.