Mantid
Loading...
Searching...
No Matches
EventWorkspace.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
10#include "MantidAPI/Progress.h"
11#include "MantidAPI/RefAxis.h"
12#include "MantidAPI/Run.h"
26
27#include "tbb/parallel_for.h"
28#include <algorithm>
29#include <limits>
30#include <numeric>
31
32using namespace boost::posix_time;
33using Mantid::Types::Core::DateAndTime;
34
35namespace Mantid::DataObjects {
36namespace {
37// static logger
38Kernel::Logger g_log("EventWorkspace");
39} // namespace
40
41DECLARE_WORKSPACE(EventWorkspace)
42
43using Kernel::Exception::NotImplementedError;
44using std::size_t;
45using namespace Mantid::Kernel;
46
48
50 : IEventWorkspace(other), mru(std::make_unique<EventWorkspaceMRU>()) {
51 for (const auto &el : other.data) {
52 // Create a new event list, copying over the events
53 auto newel = std::make_unique<EventList>(*el);
54 // Make sure to update the MRU to point to THIS event workspace.
55 newel->setMRU(this->mru.get());
56 this->data.emplace_back(std::move(newel));
57 }
58}
59
61
67 // Since there is a mutex lock around sorting, EventWorkspaces are always
68 // safe.
69 return true;
70}
71
80void EventWorkspace::init(const std::size_t &NVectors, const std::size_t &XLength, const std::size_t &YLength) {
81 static_cast<void>(XLength);
82 static_cast<void>(YLength);
83
84 // Check validity of arguments
85 if (NVectors == 0) {
86 throw std::out_of_range("Zero pixels specified to EventWorkspace::init");
87 }
88
89 // Set each X vector to have one bin of 0 & extremely close to zero
90 // Move the rhs very,very slightly just incase something doesn't like them
91 // being the same
92 HistogramData::BinEdges edges{0.0, std::numeric_limits<double>::min()};
93
94 // Initialize the data
95 data.resize(NVectors);
96 // Make sure SOMETHING exists for all initialized spots.
97 EventList el;
98 el.setHistogram(edges);
99 for (size_t i = 0; i < NVectors; i++) {
100 data[i] = std::make_unique<EventList>(el);
101 data[i]->setMRU(mru.get());
102 data[i]->setSpectrumNo(specnum_t(i));
103 }
104
105 // Create axes.
106 m_axes.resize(2);
107 m_axes[0] = std::make_unique<API::RefAxis>(this);
108 m_axes[1] = std::make_unique<API::SpectraAxis>(this);
109}
110
111void EventWorkspace::init(const HistogramData::Histogram &histogram) {
112 if (histogram.xMode() != HistogramData::Histogram::XMode::BinEdges)
113 throw std::runtime_error("EventWorkspace can only be initialized with XMode::BinEdges");
114
115 if (histogram.sharedY() || histogram.sharedE())
116 throw std::runtime_error("EventWorkspace cannot be initialized non-NULL Y or E data");
117
119 EventList el;
121 for (size_t i = 0; i < data.size(); i++) {
122 data[i] = std::make_unique<EventList>(el);
123 data[i]->setMRU(mru.get());
124 data[i]->setSpectrumNo(specnum_t(i));
125 }
126
127 m_axes.resize(2);
128 m_axes[0] = std::make_unique<API::RefAxis>(this);
129 m_axes[1] = std::make_unique<API::SpectraAxis>(this);
130}
131
135 if (data.empty()) {
136 throw std::runtime_error("There are no pixels in the event workspace, "
137 "therefore cannot determine if it is ragged.");
138 } else {
139 const auto numberOfBins = data[0]->histogram_size();
140 return std::any_of(data.cbegin(), data.cend(),
141 [&numberOfBins](const auto &eventList) { return numberOfBins != eventList->histogram_size(); });
142 }
143}
144
147size_t EventWorkspace::size() const {
148 return std::accumulate(
149 data.begin(), data.end(), static_cast<size_t>(0),
150 [](size_t value, const std::unique_ptr<EventList> &histo) { return value + histo->histogram_size(); });
151}
152
156 if (data.empty()) {
157 throw std::range_error("EventWorkspace::blocksize, no pixels in workspace, "
158 "therefore cannot determine blocksize (# of bins).");
159 } else {
160 size_t numBins = data[0]->histogram_size();
161 const auto iterPos = std::find_if_not(data.cbegin(), data.cend(),
162 [numBins](const auto &iter) { return numBins == iter->histogram_size(); });
163 if (iterPos != data.cend())
164 throw std::length_error("blocksize undefined because size of histograms is not equal");
165 return numBins;
166 }
167}
168
173std::size_t EventWorkspace::getNumberBins(const std::size_t &index) const {
174 if (index < data.size())
175 return data[index]->histogram_size();
176
177 throw std::invalid_argument("Could not find number of bins in a histogram at index " + std::to_string(index) +
178 ": index is too large.");
179}
180
185 if (data.empty()) {
186 return 0;
187 } else {
188 auto maxNumberOfBins = data[0]->histogram_size();
189 for (const auto &iter : data) {
190 const auto numberOfBins = iter->histogram_size();
191 if (numberOfBins > maxNumberOfBins)
192 maxNumberOfBins = numberOfBins;
193 }
194 return maxNumberOfBins;
195 }
196}
197
202size_t EventWorkspace::getNumberHistograms() const { return this->data.size(); }
203
206 auto &spec = const_cast<EventList &>(static_cast<const EventWorkspace &>(*this).getSpectrum(index));
207 spec.setMatrixWorkspace(this, index);
208 return spec;
209}
210
212const EventList &EventWorkspace::getSpectrum(const size_t index) const {
213 if (index >= data.size())
214 throw std::range_error("EventWorkspace::getSpectrum, workspace index out of range");
215 return *data[index];
216}
217
230
231double EventWorkspace::getTofMin() const { return this->getEventXMin(); }
232
233double EventWorkspace::getTofMax() const { return this->getEventXMax(); }
234
240 // set to crazy values to start
241 Mantid::Types::Core::DateAndTime tMin = DateAndTime::maximum();
242 size_t numWorkspace = this->data.size();
243 DateAndTime temp;
244 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
245 const EventList &evList = this->getSpectrum(workspaceIndex);
246 temp = evList.getPulseTimeMin();
247 if (temp < tMin)
248 tMin = temp;
249 }
250 return tMin;
251}
252
258 // set to crazy values to start
259 Mantid::Types::Core::DateAndTime tMax = DateAndTime::minimum();
260 size_t numWorkspace = this->data.size();
261 DateAndTime temp;
262 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
263 const EventList &evList = this->getSpectrum(workspaceIndex);
264 temp = evList.getPulseTimeMax();
265 if (temp > tMax)
266 tMax = temp;
267 }
268 return tMax;
269}
275void EventWorkspace::getPulseTimeMinMax(Mantid::Types::Core::DateAndTime &Tmin,
276 Mantid::Types::Core::DateAndTime &Tmax) const {
277
278 Tmax = DateAndTime::minimum();
279 Tmin = DateAndTime::maximum();
280
281 auto numWorkspace = static_cast<int64_t>(this->data.size());
282#pragma omp parallel
283 {
284 DateAndTime tTmax = DateAndTime::minimum();
285 DateAndTime tTmin = DateAndTime::maximum();
286#pragma omp for nowait
287 for (int64_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
288 const EventList &evList = this->getSpectrum(workspaceIndex);
289 DateAndTime tempMin, tempMax;
290 evList.getPulseTimeMinMax(tempMin, tempMax);
291 tTmin = std::min(tTmin, tempMin);
292 tTmax = std::max(tTmax, tempMax);
293 }
294#pragma omp critical
295 {
296 Tmin = std::min(Tmin, tTmin);
297 Tmax = std::max(Tmax, tTmax);
298 }
299 }
300}
301
307DateAndTime EventWorkspace::getTimeAtSampleMin(double tofOffset) const {
308 const auto &specInfo = spectrumInfo();
309 const auto L1 = specInfo.l1();
310
311 // set to crazy values to start
312 Mantid::Types::Core::DateAndTime tMin = DateAndTime::maximum();
313 size_t numWorkspace = this->data.size();
314 DateAndTime temp;
315
316 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
317 const auto L2 = specInfo.l2(workspaceIndex);
318 const double tofFactor = L1 / (L1 + L2);
319
320 const EventList &evList = this->getSpectrum(workspaceIndex);
321 temp = evList.getTimeAtSampleMin(tofFactor, tofOffset);
322 if (temp < tMin)
323 tMin = temp;
324 }
325 return tMin;
326}
327
333DateAndTime EventWorkspace::getTimeAtSampleMax(double tofOffset) const {
334 const auto &specInfo = spectrumInfo();
335 const auto L1 = specInfo.l1();
336
337 // set to crazy values to start
338 Mantid::Types::Core::DateAndTime tMax = DateAndTime::minimum();
339 size_t numWorkspace = this->data.size();
340 DateAndTime temp;
341 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
342 const auto L2 = specInfo.l2(workspaceIndex);
343 const double tofFactor = L1 / (L1 + L2);
344
345 const EventList &evList = this->getSpectrum(workspaceIndex);
346 temp = evList.getTimeAtSampleMax(tofFactor, tofOffset);
347 if (temp > tMax)
348 tMax = temp;
349 }
350 return tMax;
351}
352
364 // set to crazy values to start
365 double xmin = std::numeric_limits<double>::max();
366 if (this->getNumberEvents() == 0)
367 return xmin;
368 size_t numWorkspace = this->data.size();
369 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
370 const EventList &evList = this->getSpectrum(workspaceIndex);
371 const double temp = evList.getTofMin();
372 if (temp < xmin)
373 xmin = temp;
374 }
375 return xmin;
376}
377
389 // set to crazy values to start
390 double xmax = std::numeric_limits<double>::lowest();
391 if (this->getNumberEvents() == 0)
392 return xmax;
393 size_t numWorkspace = this->data.size();
394 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
395 const EventList &evList = this->getSpectrum(workspaceIndex);
396 const double temp = evList.getTofMax();
397 if (temp > xmax)
398 xmax = temp;
399 }
400 return xmax;
401}
402
409void EventWorkspace::getEventXMinMax(double &xmin, double &xmax) const {
410 // set to crazy values to start
411 xmin = std::numeric_limits<double>::max();
412 xmax = -1.0 * xmin;
413 if (this->getNumberEvents() == 0)
414 return;
415
416 auto numWorkspace = static_cast<int64_t>(this->data.size());
417#pragma omp parallel
418 {
419 double tXmin = xmin;
420 double tXmax = xmax;
421#pragma omp for nowait
422 for (int64_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
423 const EventList &evList = this->getSpectrum(workspaceIndex);
424 tXmin = std::min(evList.getTofMin(), tXmin);
425 tXmax = std::max(evList.getTofMax(), tXmax);
426 }
427#pragma omp critical
428 {
429 xmin = std::min(xmin, tXmin);
430 xmax = std::max(xmax, tXmax);
431 }
432 }
433}
434
438 return std::accumulate(data.cbegin(), data.cend(), size_t{0},
439 [](const auto total, const auto &list) { return total + list->getNumberEvents(); });
440}
441
448 for (const auto &list : this->data) {
449 Mantid::API::EventType thisType = list->getEventType();
450 if (static_cast<int>(out) < static_cast<int>(thisType)) {
451 out = thisType;
452 // This is the most-specialized it can get.
454 return out;
455 }
456 }
457 return out;
458}
459
465 for (auto &eventList : this->data)
466 eventList->switchTo(type);
467}
468
472bool EventWorkspace::isHistogramData() const { return true; }
473
478size_t EventWorkspace::MRUSize() const { return mru->MRUSize(); }
479
481void EventWorkspace::clearMRU() const { mru->clear(); }
482
485 // TODO: Add the MRU buffer
486
487 // Add the memory from all the event lists
488 size_t total = std::accumulate(data.begin(), data.end(), size_t{0},
489 [](size_t total, auto &list) { return total + list->getMemorySize(); });
490
491 total += run().getMemorySize();
492
493 total += this->getMemorySizeForXAxes();
494
495 // Return in bytes
496 return total;
497}
498
503MantidVec &EventWorkspace::dataX(const std::size_t index) { return getSpectrum(index).dataX(); }
504
510
514MantidVec &EventWorkspace::dataY(const std::size_t /*index*/) {
515 throw NotImplementedError("EventWorkspace::dataY cannot return a non-const "
516 "array: you can't modify the histogrammed data in "
517 "an EventWorkspace!");
518}
519
523MantidVec &EventWorkspace::dataE(const std::size_t /*index*/) {
524 throw NotImplementedError("EventWorkspace::dataE cannot return a non-const "
525 "array: you can't modify the histogrammed data in "
526 "an EventWorkspace!");
527}
528
532const MantidVec &EventWorkspace::dataX(const std::size_t index) const { return getSpectrum(index).readX(); }
533
537const MantidVec &EventWorkspace::dataDx(const std::size_t index) const { return getSpectrum(index).readDx(); }
538
542const MantidVec &EventWorkspace::dataY(const std::size_t index) const { return getSpectrum(index).readY(); }
543
547const MantidVec &EventWorkspace::dataE(const std::size_t index) const { return getSpectrum(index).readE(); }
548
555
567 bool skipError) const {
568 if (index >= data.size())
569 throw std::range_error("EventWorkspace::generateHistogram, histogram number out of range");
570 this->data[index]->generateHistogram(X, Y, E, skipError);
571}
572
584 bool skipError) const {
585 if (index >= data.size())
586 throw std::range_error("EventWorkspace::generateHistogramPulseTime, "
587 "histogram number out of range");
588 this->data[index]->generateHistogramPulseTime(X, Y, E, skipError);
589}
590
594void EventWorkspace::setAllX(const HistogramData::BinEdges &x) {
595 // This is an EventWorkspace, so changing X size is ok as long as we clear
596 // the MRU below, i.e., we avoid the size check of Histogram::setBinEdges and
597 // just reset the whole Histogram.
599 for (auto &eventList : this->data)
600 eventList->setHistogram(x);
601
602 // Clear MRU lists now, free up memory
603 this->clearMRU();
604}
605
611 double tofmin, tofmax;
612 getEventXMinMax(tofmin, tofmax);
613
614 // Sanitize TOF min/max to ensure it always passes HistogramX validation.
615 // They would be invalid when number of events are 0 or 1, for example.
616 if (tofmin > tofmax) {
617 tofmin = 0;
618 tofmax = std::numeric_limits<double>::min();
619 } else if (tofmin == tofmax) {
620 tofmax += std::numeric_limits<double>::min();
621 }
622 setAllX({tofmin, tofmax});
623}
624
627public:
631
632 // Execute the sort as specified.
633 void operator()(const tbb::blocked_range<size_t> &range) const {
634 for (size_t wi = range.begin(); wi < range.end(); ++wi) {
635 // because EventList::sort calls tbb::parallel_sort checking that the EventList is non-empty reduces the number of
636 // threads created that return immediately
637 const auto &spectrum = m_WS->getSpectrum(wi); // follow the method signature
638 if (spectrum.empty())
639 spectrum.setSortOrder(m_sortType); // empty lists are easy to sort
640 else
641 spectrum.sort(m_sortType);
642 }
643 // Report progress
644 if (prog)
645 prog->report("Sorting");
646 }
647
648private:
655};
656
657/*
658 * Review each event list to get the sort type
659 * If any 2 have different order type, then be unsorted
660 */
662 size_t dataSize = this->data.size();
663 EventSortType order = data[0]->getSortType();
664 for (size_t i = 1; i < dataSize; i++) {
665 if (order != data[i]->getSortType())
666 return UNSORTED;
667 }
668 return order;
669}
670
671/*** Sort all event lists. Uses a parallelized algorithm
672 * @param sortType :: How to sort the event lists.
673 * @param prog :: a progress report object. If the pointer is not NULL, each
674 * event list will call prog.report() once.
675 */
677 if (this->getSortType() == sortType) {
678 if (prog != nullptr) {
679 prog->reportIncrement(this->data.size());
680 }
681 return;
682 }
683
684 // Create the thread pool using tbb
685 EventSortingTask task(this, sortType, prog);
686 constexpr size_t GRAINSIZE_DEFAULT{100}; // somewhat arbitrary
687 const size_t grainsize = std::min<size_t>(GRAINSIZE_DEFAULT, (this->getNumberHistograms() / GRAINSIZE_DEFAULT) + 1);
688 tbb::parallel_for(tbb::blocked_range<size_t>(0, data.size(), grainsize), task);
689}
690
703void EventWorkspace::getIntegratedSpectra(std::vector<double> &out, const double minX, const double maxX,
704 const bool entireRange) const {
705 // Start with empty vector
706 out.resize(this->getNumberHistograms(), 0.0);
707
708 // We can run in parallel since there is no cross-reading of event lists
710 for (int wksp_index = 0; wksp_index < int(this->getNumberHistograms()); wksp_index++) {
711 // Get Handle to data
712 EventList const *el = this->data[wksp_index].get();
713
714 // Let the eventList do the integration
715 out[wksp_index] = el->integrate(minX, maxX, entireRange);
716 }
717}
718
719} // namespace Mantid::DataObjects
720
721namespace Mantid::Kernel {
722template <>
724IPropertyManager::getValue<Mantid::DataObjects::EventWorkspace_sptr>(const std::string &name) const {
725 auto *prop = dynamic_cast<PropertyWithValue<Mantid::DataObjects::EventWorkspace_sptr> *>(getPointerToProperty(name));
726 if (prop) {
727 return *prop;
728 } else {
729 std::string message =
730 "Attempt to assign property " + name + " to incorrect type. Expected shared_ptr<EventWorkspace>.";
731 throw std::runtime_error(message);
732 }
733}
734
735template <>
737IPropertyManager::getValue<Mantid::DataObjects::EventWorkspace_const_sptr>(const std::string &name) const {
738 auto const *prop =
739 dynamic_cast<PropertyWithValue<Mantid::DataObjects::EventWorkspace_sptr> *>(getPointerToProperty(name));
740 if (prop) {
741 return prop->operator()();
742 } else {
743 std::string message =
744 "Attempt to assign property " + name + " to incorrect type. Expected const shared_ptr<EventWorkspace>.";
745 throw std::runtime_error(message);
746 }
747}
748} // namespace Mantid::Kernel
std::string name
Definition Run.cpp:60
double value
The value of the point.
Definition FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
#define PARALLEL_FOR_NO_WSP_CHECK()
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Definition System.h:37
#define DECLARE_WORKSPACE(classname)
const SpectrumInfo & spectrumInfo() const
Return a reference to the SpectrumInfo object.
size_t numberOfDetectorGroups() const
Returns the number of detector groups.
const Run & run() const
Run details object access.
This class provides an interface to an EventWorkspace.
void setHistogram(T &&...data)
Sets the Histogram associated with this spectrum.
Definition ISpectrum.h:96
void setMatrixWorkspace(MatrixWorkspace *matrixWorkspace, const size_t index)
Sets the MatrixWorkspace pointer (pointer to the owning workspace).
virtual const MantidVec & readE() const
Deprecated, use e() instead. Returns the y error data const.
Definition ISpectrum.cpp:45
virtual const MantidVec & readY() const
Deprecated, use y() instead. Returns the y data const.
Definition ISpectrum.cpp:42
std::vector< std::unique_ptr< Axis > > m_axes
A vector of pointers to the axes for this workspace.
virtual size_t getMemorySizeForXAxes() const
Returns the memory used (in bytes) by the X axes, handling ragged bins.
void invalidateCommonBinsFlag()
Invalidates the commons bins flag.
HistogramData::Histogram histogram(const size_t index) const
Returns the Histogram at the given workspace index.
Helper class for reporting progress from algorithms.
Definition Progress.h:25
size_t getMemorySize() const override
Return an approximate memory size for the object in bytes.
Definition Run.cpp:517
A class for holding :
Definition EventList.h:57
Mantid::Types::Core::DateAndTime getTimeAtSampleMax(const double &tofFactor, const double &tofOffset) const override
Get the maximum time at sample.
double getTofMax() const override
void setSortOrder(const EventSortType order) const
Manually set the event list sort order value.
double getTofMin() const override
const MantidVec & readDx() const override
Deprecated, use dx() instead.
void getPulseTimeMinMax(Mantid::Types::Core::DateAndTime &tMin, Mantid::Types::Core::DateAndTime &tM) const
Mantid::Types::Core::DateAndTime getPulseTimeMax() const override
Kernel::cow_ptr< HistogramData::HistogramX > ptrX() const override
Deprecated, use sharedX() instead. Returns a pointer to the x data.
MantidVec & dataX() override
Deprecated, use mutableX() instead.
MantidVec & dataDx() override
Deprecated, use mutableDx() instead.
Mantid::Types::Core::DateAndTime getTimeAtSampleMin(const double &tofFactor, const double &tofOffset) const override
Get the minimum time at sample.
const MantidVec & readX() const override
Deprecated, use x() instead. Returns the x data const.
void integrate(const double minX, const double maxX, const bool entireRange, double &sum, double &error) const
Integrate the events between a range of X values, or all events.
Mantid::Types::Core::DateAndTime getPulseTimeMin() const override
Task for sorting an event list.
void operator()(const tbb::blocked_range< size_t > &range) const
const EventWorkspace * m_WS
EventWorkspace on which to sort.
EventSortingTask(const EventWorkspace *WS, EventSortType sortType, Mantid::API::Progress *prog)
ctor
Mantid::API::Progress * prog
Optional Progress dialog.
This is a container for the MRU (most-recently-used) list of generated histograms.
This class is intended to fulfill the design specified in <https://github.com/mantidproject/documents...
void init(const std::size_t &, const std::size_t &, const std::size_t &) override
Initialize the pixels.
std::vector< std::unique_ptr< EventList > > data
A vector that holds the event list for each spectrum; the key is the workspace index,...
void setAllX(const HistogramData::BinEdges &x) override
Set all histogram X vectors.
double getEventXMax() const
Get them maximum x-value for the events themselves, ignoring the histogram representation.
EventList * getSpectrumUnsafe(const size_t index)
Returns a pointer to the EventList for a given spectrum in a timely manner.
MantidVec & dataY(const std::size_t) override
Deprecated, use mutableY() instead.
std::size_t getNumberBins(const std::size_t &index) const override
Returns the number of bins for a given histogram index.
Kernel::cow_ptr< HistogramData::HistogramX > refX(const std::size_t) const override
Deprecated, use sharedX() instead.
bool isHistogramData() const override
Returns true always - an EventWorkspace always represents histogramm-able data.
Mantid::Types::Core::DateAndTime getPulseTimeMin() const override
Get the minimum pulse time for events accross the entire workspace.
std::size_t getMaxNumberBins() const override
Returns the maximum number of bins in a workspace (works on ragged data).
EventList & getSpectrum(const size_t index) override
Return the underlying ISpectrum ptr at the given workspace index.
std::size_t MRUSize() const
Return how many entries in the Y MRU list are used.
void getEventXMinMax(double &xmin, double &xmax) const
Get them minimum and maximum x-values for the events themselves, ignoring the histogram representatio...
std::size_t getNumberHistograms() const override
Get the number of histograms, usually the same as the number of pixels or detectors.
void getPulseTimeMinMax(Mantid::Types::Core::DateAndTime &xmin, Mantid::Types::Core::DateAndTime &xmax) const
Get the maximum and mimumum pulse time for events accross the entire workspace.
Mantid::Types::Core::DateAndTime getTimeAtSampleMin(double tofOffset=0) const override
Get the minimum time at sample for events across the entire workspace.
double getEventXMin() const
Get them minimum x-value for the events themselves, ignoring the histogram representation.
void switchEventType(const Mantid::API::EventType type)
Switch all event lists to the given event type.
Mantid::Types::Core::DateAndTime getPulseTimeMax() const override
Get the maximum pulse time for events accross the entire workspace.
MantidVec & dataDx(const std::size_t) override
Deprecated, use mutableDx() instead.
void getIntegratedSpectra(std::vector< double > &out, const double minX, const double maxX, const bool entireRange) const override
Integrate all the spectra in the matrix workspace within the range given.
bool threadSafe() const override
Returns true if the EventWorkspace is safe for multithreaded operations.
std::size_t size() const override
The total size of the workspace.
void sortAll(EventSortType sortType, Mantid::API::Progress *prog) const
EventList & getSpectrumWithoutInvalidation(const size_t index) override
Return const reference to EventList at the given workspace index.
void clearMRU() const override
Clears the MRU lists.
Mantid::API::EventType getEventType() const override
Get the EventType of the most-specialized EventList in the workspace.
bool isRaggedWorkspace() const override
Returns true if the workspace is ragged (has differently sized spectra).
MantidVec & dataX(const std::size_t) override
Deprecated, use mutableX() instead.
Mantid::Types::Core::DateAndTime getTimeAtSampleMax(double tofOffset=0) const override
Get the maximum time at sample for events across the entire workspace.
std::size_t getNumberEvents() const override
The total number of events across all of the spectra.
std::size_t blocksize() const override
Get the blocksize, aka the number of bins in the histogram.
size_t getMemorySize() const override
Returns the amount of memory used in bytes.
void generateHistogram(const std::size_t index, const MantidVec &X, MantidVec &Y, MantidVec &E, bool skipError=false) const override
Generate a new histogram from specified event list at the given index.
void generateHistogramPulseTime(const std::size_t index, const MantidVec &X, MantidVec &Y, MantidVec &E, bool skipError=false) const
Generate a new histogram from specified event list at the given index.
MantidVec & dataE(const std::size_t) override
Deprecated, use mutableE() instead.
std::unique_ptr< EventWorkspaceMRU > mru
Container for the MRU lists of the event lists contained.
void resetAllXToSingleBin() override
Set all Histogram X vectors to a single bin with boundaries that fit the TOF of all events across all...
Marks code as not implemented yet.
Definition Exception.h:138
void reportIncrement(int inc, const std::string &msg="")
Sends the progress notification and increment the loop counter by more than one.
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
The concrete, templated class for properties.
Implements a copy on write data template.
Definition cow_ptr.h:41
Kernel::Logger g_log("ExperimentInfo")
static logger object
EventType
What kind of event list is being stored.
Definition IEventList.h:18
std::shared_ptr< const EventWorkspace > EventWorkspace_const_sptr
shared pointer to a const Workspace2D
EventSortType
How the event list is sorted.
Definition EventList.h:32
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
Definition cow_ptr.h:172
int32_t specnum_t
Typedef for a spectrum Number.
Definition IDTypes.h:14
STL namespace.
std::string to_string(const wide_integer< Bits, Signed > &n)