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"
27
28#include "tbb/parallel_for.h"
29#include <algorithm>
30#include <limits>
31#include <numeric>
32
33using namespace boost::posix_time;
34using Mantid::Types::Core::DateAndTime;
35
36namespace Mantid::DataObjects {
37namespace {
38// static logger
39Kernel::Logger g_log("EventWorkspace");
40} // namespace
41
42DECLARE_WORKSPACE(EventWorkspace)
43
44using Kernel::Exception::NotImplementedError;
45using std::size_t;
46using namespace Mantid::Kernel;
47
49
51 : IEventWorkspace(other), mru(std::make_unique<EventWorkspaceMRU>()) {
52 for (const auto &el : other.data) {
53 // Create a new event list, copying over the events
54 auto newel = std::make_unique<EventList>(*el);
55 // Make sure to update the MRU to point to THIS event workspace.
56 newel->setMRU(this->mru.get());
57 this->data.emplace_back(std::move(newel));
58 }
59}
60
62
68 // Since there is a mutex lock around sorting, EventWorkspaces are always
69 // safe.
70 return true;
71}
72
81void EventWorkspace::init(const std::size_t &NVectors, const std::size_t &XLength, const std::size_t &YLength) {
82 static_cast<void>(XLength);
83 static_cast<void>(YLength);
84
85 // Check validity of arguments
86 if (NVectors == 0) {
87 throw std::out_of_range("Zero pixels specified to EventWorkspace::init");
88 }
89
90 // Set each X vector to have one bin of 0 & extremely close to zero
91 // Move the rhs very,very slightly just incase something doesn't like them
92 // being the same
93 HistogramData::BinEdges edges{0.0, std::numeric_limits<double>::min()};
94
95 // Initialize the data
96 data.resize(NVectors);
97 // Make sure SOMETHING exists for all initialized spots.
98 EventList el;
99 el.setHistogram(edges);
100 for (size_t i = 0; i < NVectors; i++) {
101 data[i] = std::make_unique<EventList>(el);
102 data[i]->setMRU(mru.get());
103 data[i]->setSpectrumNo(specnum_t(i));
104 }
105
106 // Create axes.
107 m_axes.resize(2);
108 m_axes[0] = std::make_unique<API::RefAxis>(this);
109 m_axes[1] = std::make_unique<API::SpectraAxis>(this);
110}
111
112void EventWorkspace::init(const HistogramData::Histogram &histogram) {
113 if (histogram.xMode() != HistogramData::Histogram::XMode::BinEdges)
114 throw std::runtime_error("EventWorkspace can only be initialized with XMode::BinEdges");
115
116 if (histogram.sharedY() || histogram.sharedE())
117 throw std::runtime_error("EventWorkspace cannot be initialized non-NULL Y or E data");
118
120 EventList el;
122 for (size_t i = 0; i < data.size(); i++) {
123 data[i] = std::make_unique<EventList>(el);
124 data[i]->setMRU(mru.get());
125 data[i]->setSpectrumNo(specnum_t(i));
126 }
127
128 m_axes.resize(2);
129 m_axes[0] = std::make_unique<API::RefAxis>(this);
130 m_axes[1] = std::make_unique<API::SpectraAxis>(this);
131}
132
136 if (data.empty()) {
137 throw std::runtime_error("There are no pixels in the event workspace, "
138 "therefore cannot determine if it is ragged.");
139 } else {
140 const auto numberOfBins = data[0]->histogram_size();
141 return std::any_of(data.cbegin(), data.cend(),
142 [&numberOfBins](const auto &eventList) { return numberOfBins != eventList->histogram_size(); });
143 }
144}
145
148size_t EventWorkspace::size() const {
149 return std::accumulate(
150 data.begin(), data.end(), static_cast<size_t>(0),
151 [](size_t value, const std::unique_ptr<EventList> &histo) { return value + histo->histogram_size(); });
152}
153
157 if (data.empty()) {
158 throw std::range_error("EventWorkspace::blocksize, no pixels in workspace, "
159 "therefore cannot determine blocksize (# of bins).");
160 } else {
161 size_t numBins = data[0]->histogram_size();
162 const auto iterPos = std::find_if_not(data.cbegin(), data.cend(),
163 [numBins](const auto &iter) { return numBins == iter->histogram_size(); });
164 if (iterPos != data.cend())
165 throw std::length_error("blocksize undefined because size of histograms is not equal");
166 return numBins;
167 }
168}
169
174std::size_t EventWorkspace::getNumberBins(const std::size_t &index) const {
175 if (index < data.size())
176 return data[index]->histogram_size();
177
178 throw std::invalid_argument("Could not find number of bins in a histogram at index " + std::to_string(index) +
179 ": index is too large.");
180}
181
186 if (data.empty()) {
187 return 0;
188 } else {
189 auto maxNumberOfBins = data[0]->histogram_size();
190 for (const auto &iter : data) {
191 const auto numberOfBins = iter->histogram_size();
192 if (numberOfBins > maxNumberOfBins)
193 maxNumberOfBins = numberOfBins;
194 }
195 return maxNumberOfBins;
196 }
197}
198
203size_t EventWorkspace::getNumberHistograms() const { return this->data.size(); }
204
207 auto &spec = const_cast<EventList &>(static_cast<const EventWorkspace &>(*this).getSpectrum(index));
208 spec.setMatrixWorkspace(this, index);
209 return spec;
210}
211
213const EventList &EventWorkspace::getSpectrum(const size_t index) const {
214 if (index >= data.size())
215 throw std::range_error("EventWorkspace::getSpectrum, workspace index out of range");
216 return *data[index];
217}
218
231
232double EventWorkspace::getTofMin() const { return this->getEventXMin(); }
233
234double EventWorkspace::getTofMax() const { return this->getEventXMax(); }
235
241 // set to crazy values to start
242 Mantid::Types::Core::DateAndTime tMin = DateAndTime::maximum();
243 size_t numWorkspace = this->data.size();
244 DateAndTime temp;
245 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
246 const EventList &evList = this->getSpectrum(workspaceIndex);
247 temp = evList.getPulseTimeMin();
248 if (temp < tMin)
249 tMin = temp;
250 }
251 return tMin;
252}
253
259 // set to crazy values to start
260 Mantid::Types::Core::DateAndTime tMax = DateAndTime::minimum();
261 size_t numWorkspace = this->data.size();
262 DateAndTime temp;
263 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
264 const EventList &evList = this->getSpectrum(workspaceIndex);
265 temp = evList.getPulseTimeMax();
266 if (temp > tMax)
267 tMax = temp;
268 }
269 return tMax;
270}
276void EventWorkspace::getPulseTimeMinMax(Mantid::Types::Core::DateAndTime &Tmin,
277 Mantid::Types::Core::DateAndTime &Tmax) const {
278
279 Tmax = DateAndTime::minimum();
280 Tmin = DateAndTime::maximum();
281
282 auto numWorkspace = static_cast<int64_t>(this->data.size());
283#pragma omp parallel
284 {
285 DateAndTime tTmax = DateAndTime::minimum();
286 DateAndTime tTmin = DateAndTime::maximum();
287#pragma omp for nowait
288 for (int64_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
289 const EventList &evList = this->getSpectrum(workspaceIndex);
290 DateAndTime tempMin, tempMax;
291 evList.getPulseTimeMinMax(tempMin, tempMax);
292 tTmin = std::min(tTmin, tempMin);
293 tTmax = std::max(tTmax, tempMax);
294 }
295#pragma omp critical
296 {
297 Tmin = std::min(Tmin, tTmin);
298 Tmax = std::max(Tmax, tTmax);
299 }
300 }
301}
302
308DateAndTime EventWorkspace::getTimeAtSampleMin(double tofOffset) const {
309 const auto &specInfo = spectrumInfo();
310 const auto L1 = specInfo.l1();
311
312 // set to crazy values to start
313 Mantid::Types::Core::DateAndTime tMin = DateAndTime::maximum();
314 size_t numWorkspace = this->data.size();
315 DateAndTime temp;
316
317 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
318 const auto L2 = specInfo.l2(workspaceIndex);
319 const double tofFactor = L1 / (L1 + L2);
320
321 const EventList &evList = this->getSpectrum(workspaceIndex);
322 temp = evList.getTimeAtSampleMin(tofFactor, tofOffset);
323 if (temp < tMin)
324 tMin = temp;
325 }
326 return tMin;
327}
328
334DateAndTime EventWorkspace::getTimeAtSampleMax(double tofOffset) const {
335 const auto &specInfo = spectrumInfo();
336 const auto L1 = specInfo.l1();
337
338 // set to crazy values to start
339 Mantid::Types::Core::DateAndTime tMax = DateAndTime::minimum();
340 size_t numWorkspace = this->data.size();
341 DateAndTime temp;
342 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
343 const auto L2 = specInfo.l2(workspaceIndex);
344 const double tofFactor = L1 / (L1 + L2);
345
346 const EventList &evList = this->getSpectrum(workspaceIndex);
347 temp = evList.getTimeAtSampleMax(tofFactor, tofOffset);
348 if (temp > tMax)
349 tMax = temp;
350 }
351 return tMax;
352}
353
365 // set to crazy values to start
366 double xmin = std::numeric_limits<double>::max();
367 if (this->getNumberEvents() == 0)
368 return xmin;
369 size_t numWorkspace = this->data.size();
370 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
371 const EventList &evList = this->getSpectrum(workspaceIndex);
372 const double temp = evList.getTofMin();
373 if (temp < xmin)
374 xmin = temp;
375 }
376 return xmin;
377}
378
390 // set to crazy values to start
391 double xmax = std::numeric_limits<double>::lowest();
392 if (this->getNumberEvents() == 0)
393 return xmax;
394 size_t numWorkspace = this->data.size();
395 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
396 const EventList &evList = this->getSpectrum(workspaceIndex);
397 const double temp = evList.getTofMax();
398 if (temp > xmax)
399 xmax = temp;
400 }
401 return xmax;
402}
403
410void EventWorkspace::getEventXMinMax(double &xmin, double &xmax) const {
411 // set to crazy values to start
412 xmin = std::numeric_limits<double>::max();
413 xmax = -1.0 * xmin;
414 if (this->getNumberEvents() == 0)
415 return;
416
417 auto numWorkspace = static_cast<int64_t>(this->data.size());
418#pragma omp parallel
419 {
420 double tXmin = xmin;
421 double tXmax = xmax;
422#pragma omp for nowait
423 for (int64_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
424 const EventList &evList = this->getSpectrum(workspaceIndex);
425 tXmin = std::min(evList.getTofMin(), tXmin);
426 tXmax = std::max(evList.getTofMax(), tXmax);
427 }
428#pragma omp critical
429 {
430 xmin = std::min(xmin, tXmin);
431 xmax = std::max(xmax, tXmax);
432 }
433 }
434}
435
439 return std::accumulate(data.cbegin(), data.cend(), size_t{0},
440 [](const auto total, const auto &list) { return total + list->getNumberEvents(); });
441}
442
449 for (const auto &list : this->data) {
450 Mantid::API::EventType thisType = list->getEventType();
451 if (static_cast<int>(out) < static_cast<int>(thisType)) {
452 out = thisType;
453 // This is the most-specialized it can get.
455 return out;
456 }
457 }
458 return out;
459}
460
466 for (auto &eventList : this->data)
467 eventList->switchTo(type);
468}
469
473bool EventWorkspace::isHistogramData() const { return true; }
474
479size_t EventWorkspace::MRUSize() const { return mru->MRUSize(); }
480
482void EventWorkspace::clearMRU() const { mru->clear(); }
483
486 // TODO: Add the MRU buffer
487
488 // Add the memory from all the event lists
489 size_t total = std::accumulate(data.begin(), data.end(), size_t{0},
490 [](size_t total, auto &list) { return total + list->getMemorySize(); });
491
492 total += run().getMemorySize();
493
494 total += this->getMemorySizeForXAxes();
495
496 // Return in bytes
497 return total;
498}
499
500// The two mutable accessors below can only be expressed in terms of EventList's own legacy
501// interface: handing out a mutable MantidVec would allow the length to be changed, so
502// FixedLengthVector::mutableRawData() is protected and Histogram is its only friend.
503GNU_DIAG_OFF("deprecated-declarations")
504MSVC_DIAG_OFF(4996)
505
510MantidVec &EventWorkspace::dataX(const std::size_t index) { return getSpectrum(index).dataX(); }
511
517
518MSVC_DIAG_ON(4996)
519GNU_DIAG_ON("deprecated-declarations")
520
524MantidVec &EventWorkspace::dataY(const std::size_t /*index*/) {
525 throw NotImplementedError("EventWorkspace::dataY cannot return a non-const "
526 "array: you can't modify the histogrammed data in "
527 "an EventWorkspace!");
528}
529
533MantidVec &EventWorkspace::dataE(const std::size_t /*index*/) {
534 throw NotImplementedError("EventWorkspace::dataE cannot return a non-const "
535 "array: you can't modify the histogrammed data in "
536 "an EventWorkspace!");
537}
538
542const MantidVec &EventWorkspace::dataX(const std::size_t index) const { return getSpectrum(index).x().rawData(); }
543
547const MantidVec &EventWorkspace::dataDx(const std::size_t index) const { return getSpectrum(index).dx().rawData(); }
548
552const MantidVec &EventWorkspace::dataY(const std::size_t index) const { return getSpectrum(index).y().rawData(); }
553
557const MantidVec &EventWorkspace::dataE(const std::size_t index) const { return getSpectrum(index).e().rawData(); }
558
565
576void EventWorkspace::generateHistogram(const std::size_t index, std::span<double const> X, MantidVec &Y, MantidVec &E,
577 bool skipError) const {
578 if (index >= data.size())
579 throw std::range_error("EventWorkspace::generateHistogram, histogram number out of range");
580 this->data[index]->generateHistogram(X, Y, E, skipError);
581}
582
593void EventWorkspace::generateHistogramPulseTime(const std::size_t index, std::span<double const> X, MantidVec &Y,
594 MantidVec &E, bool skipError) const {
595 if (index >= data.size())
596 throw std::range_error("EventWorkspace::generateHistogramPulseTime, "
597 "histogram number out of range");
598 this->data[index]->generateHistogramPulseTime(X, Y, E, skipError);
599}
600
604void EventWorkspace::setAllX(const HistogramData::BinEdges &x) {
605 // This is an EventWorkspace, so changing X size is ok as long as we clear
606 // the MRU below, i.e., we avoid the size check of Histogram::setBinEdges and
607 // just reset the whole Histogram.
609 for (auto &eventList : this->data)
610 eventList->setHistogram(x);
611
612 // Clear MRU lists now, free up memory
613 this->clearMRU();
614}
615
621 double tofmin, tofmax;
622 getEventXMinMax(tofmin, tofmax);
623
624 // Sanitize TOF min/max to ensure it always passes HistogramX validation.
625 // They would be invalid when number of events are 0 or 1, for example.
626 if (tofmin > tofmax) {
627 tofmin = 0;
628 tofmax = std::numeric_limits<double>::min();
629 } else if (tofmin == tofmax) {
630 tofmax += std::numeric_limits<double>::min();
631 }
632 setAllX({tofmin, tofmax});
633}
634
637public:
641
642 // Execute the sort as specified.
643 void operator()(const tbb::blocked_range<size_t> &range) const {
644 for (size_t wi = range.begin(); wi < range.end(); ++wi) {
645 // because EventList::sort calls tbb::parallel_sort checking that the EventList is non-empty reduces the number of
646 // threads created that return immediately
647 const auto &spectrum = m_WS->getSpectrum(wi); // follow the method signature
648 if (spectrum.empty())
649 spectrum.setSortOrder(m_sortType); // empty lists are easy to sort
650 else
651 spectrum.sort(m_sortType);
652 }
653 // Report progress
654 if (prog)
655 prog->report("Sorting");
656 }
657
658private:
665};
666
667/*
668 * Review each event list to get the sort type
669 * If any 2 have different order type, then be unsorted
670 */
672 EventSortType order = data[0]->getSortType();
673 const auto it =
674 std::find_if(data.cbegin(), data.cend(), [&order](const auto &list) { return list->getSortType() != order; });
675 if (it != data.cend())
676 return UNSORTED;
677 return order;
678}
679
680/*** Sort all event lists. Uses a parallelized algorithm
681 * @param sortType :: How to sort the event lists.
682 * @param prog :: a progress report object. If the pointer is not NULL, each
683 * event list will call prog.report() once.
684 */
686 if (this->getSortType() == sortType) {
687 if (prog != nullptr) {
688 prog->reportIncrement(this->data.size());
689 }
690 return;
691 }
692
693 // Create the thread pool using tbb
694 EventSortingTask task(this, sortType, prog);
695 constexpr size_t GRAINSIZE_DEFAULT{100}; // somewhat arbitrary
696 const size_t grainsize = std::min<size_t>(GRAINSIZE_DEFAULT, (this->getNumberHistograms() / GRAINSIZE_DEFAULT) + 1);
697 tbb::parallel_for(tbb::blocked_range<size_t>(0, data.size(), grainsize), task);
698}
699
712void EventWorkspace::getIntegratedSpectra(std::vector<double> &out, const double minX, const double maxX,
713 const bool entireRange) const {
714 // Start with empty vector
715 out.resize(this->getNumberHistograms(), 0.0);
716
717 // We can run in parallel since there is no cross-reading of event lists
719 for (int wksp_index = 0; wksp_index < int(this->getNumberHistograms()); wksp_index++) {
720 // Get Handle to data
721 EventList const *el = this->data[wksp_index].get();
722
723 // Let the eventList do the integration
724 out[wksp_index] = el->integrate(minX, maxX, entireRange);
725 }
726}
727
728} // namespace Mantid::DataObjects
729
730namespace Mantid::Kernel {
731template <>
733IPropertyManager::getValue<Mantid::DataObjects::EventWorkspace_sptr>(const std::string &name) const {
734 auto *prop = dynamic_cast<PropertyWithValue<Mantid::DataObjects::EventWorkspace_sptr> *>(getPointerToProperty(name));
735 if (prop) {
736 return *prop;
737 } else {
738 std::string message =
739 "Attempt to assign property " + name + " to incorrect type. Expected shared_ptr<EventWorkspace>.";
740 throw std::runtime_error(message);
741 }
742}
743
744template <>
746IPropertyManager::getValue<Mantid::DataObjects::EventWorkspace_const_sptr>(const std::string &name) const {
747 auto const *prop =
748 dynamic_cast<PropertyWithValue<Mantid::DataObjects::EventWorkspace_sptr> *>(getPointerToProperty(name));
749 if (prop) {
750 return prop->operator()();
751 } else {
752 std::string message =
753 "Attempt to assign property " + name + " to incorrect type. Expected const shared_ptr<EventWorkspace>.";
754 throw std::runtime_error(message);
755 }
756}
757} // 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:33
#define MSVC_DIAG_ON(x)
#define MSVC_DIAG_OFF(x)
#define GNU_DIAG_ON(x)
#define GNU_DIAG_OFF(x)
This is a collection of macros for turning compiler warnings off in a controlled manner.
#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:110
void setMatrixWorkspace(MatrixWorkspace *matrixWorkspace, const size_t index)
Sets the MatrixWorkspace pointer (pointer to the owning workspace).
const HistogramData::HistogramX & x() const
Definition ISpectrum.h:185
const HistogramData::HistogramDx & dx() const
Definition ISpectrum.h:188
Kernel::cow_ptr< HistogramData::HistogramX > sharedX() const
Definition ISpectrum.h:199
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:58
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 HistogramData::HistogramY & y() const override
void getPulseTimeMinMax(Mantid::Types::Core::DateAndTime &tMin, Mantid::Types::Core::DateAndTime &tM) const
Mantid::Types::Core::DateAndTime getPulseTimeMax() const override
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 HistogramData::HistogramE & e() const override
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.
void generateHistogram(const std::size_t index, std::span< double const > X, MantidVec &Y, MantidVec &E, bool skipError=false) const override
Generate a new histogram from specified event list at the given index.
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 generateHistogramPulseTime(const std::size_t index, std::span< double const > X, MantidVec &Y, MantidVec &E, bool skipError=false) const
Generate a new histogram from specified event list at the given index.
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.
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:19
std::shared_ptr< const EventWorkspace > EventWorkspace_const_sptr
shared pointer to a const Workspace2D
EventSortType
How the event list is sorted.
Definition EventList.h:33
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)