40 throw std::runtime_error(
"Cannot subtract a MDHistoWorkspace and a "
41 "MDEventWorkspace (only MDEventWorkspace - "
42 "MDEventWorkspace is allowed).");
44 throw std::runtime_error(
"Cannot subtract a MDEventWorkspace and a "
45 "scalar (only MDEventWorkspace - "
46 "MDEventWorkspace is allowed).");
60 throw std::runtime_error(
"Incompatible workspace types passed to MinusMD.");
80 std::vector<MDE> eventsCopy;
81 eventsCopy.reserve(events.size());
82 for (
auto it = events.begin(); it != events.end(); it++) {
85 eventsCopy.emplace_back(eventCopy);
91 prog.
report(
"Substracting Events");
94 this->
progress(0.41,
"Splitting Boxes");
98 auto prog2 =
new Progress(
this, 0.4, 0.9, 100);
102 prog2->resetNumSteps(ts->
size(), 0.4, 0.6);
105 this->
progress(0.95,
"Refreshing cache");
131 out->subtract(*operand);
138 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)
Add several events, starting and stopping at particular point in a vector.
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.
std::shared_ptr< MDEventWorkspace< MDE, nd > > sptr
Typedef for a shared pointer of this kind of event workspace.
void refreshCache() override
Refresh the cache of # of points, signal, and error.
uint64_t getNPoints() const override
Returns the total number of points (events) in this workspace.
MDBoxBase< MDE, nd > * getBox()
void splitAllIfNeeded(Kernel::ThreadScheduler *ts) override
Goes through all the sub-boxes and splits them if they contain enough events to be worth it.
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.