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"
16#include "MantidDataObjects/DllConfig.h"
28
29#include "tbb/parallel_for.h"
30#include <algorithm>
31#include <limits>
32#include <numeric>
33
34using namespace boost::posix_time;
35using Mantid::Types::Core::DateAndTime;
36
37namespace Mantid::DataObjects {
38namespace {
39// static logger
40Kernel::Logger g_log("EventWorkspace");
41} // namespace
42
43DECLARE_WORKSPACE(EventWorkspace)
44
45using Kernel::Exception::NotImplementedError;
46using std::size_t;
47using namespace Mantid::Kernel;
48
50
52 : IEventWorkspace(other), mru(std::make_unique<EventWorkspaceMRU>()) {
53 for (const auto &el : other.data) {
54 // Create a new event list, copying over the events
55 auto newel = std::make_unique<EventList>(*el);
56 // Make sure to update the MRU to point to THIS event workspace.
57 newel->setMRU(this->mru.get());
58 this->data.emplace_back(std::move(newel));
59 }
60}
61
63
69 // Since there is a mutex lock around sorting, EventWorkspaces are always
70 // safe.
71 return true;
72}
73
82void EventWorkspace::init(const std::size_t &NVectors, const std::size_t &XLength, const std::size_t &YLength) {
83 static_cast<void>(XLength);
84 static_cast<void>(YLength);
85
86 // Check validity of arguments
87 if (NVectors == 0) {
88 throw std::out_of_range("Zero pixels specified to EventWorkspace::init");
89 }
90
91 // Set each X vector to have one bin of 0 & extremely close to zero
92 // Move the rhs very,very slightly just incase something doesn't like them
93 // being the same
94 HistogramData::BinEdges edges{0.0, std::numeric_limits<double>::min()};
95
96 // Initialize the data
97 data.resize(NVectors);
98 // Make sure SOMETHING exists for all initialized spots.
99 EventList el;
100 el.setHistogram(edges);
101 for (size_t i = 0; i < NVectors; i++) {
102 data[i] = std::make_unique<EventList>(el);
103 data[i]->setMRU(mru.get());
104 data[i]->setSpectrumNo(specnum_t(i));
105 }
106
107 // Create axes.
108 m_axes.resize(2);
109 m_axes[0] = std::make_unique<API::RefAxis>(this);
110 m_axes[1] = std::make_unique<API::SpectraAxis>(this);
111}
112
113void EventWorkspace::init(const HistogramData::Histogram &histogram) {
114 if (histogram.xMode() != HistogramData::Histogram::XMode::BinEdges)
115 throw std::runtime_error("EventWorkspace can only be initialized with XMode::BinEdges");
116
117 if (histogram.sharedY() || histogram.sharedE())
118 throw std::runtime_error("EventWorkspace cannot be initialized non-NULL Y or E data");
119
121 EventList el;
123 for (size_t i = 0; i < data.size(); i++) {
124 data[i] = std::make_unique<EventList>(el);
125 data[i]->setMRU(mru.get());
126 data[i]->setSpectrumNo(specnum_t(i));
127 }
128
129 m_axes.resize(2);
130 m_axes[0] = std::make_unique<API::RefAxis>(this);
131 m_axes[1] = std::make_unique<API::SpectraAxis>(this);
132}
133
137 if (data.empty()) {
138 throw std::runtime_error("There are no pixels in the event workspace, "
139 "therefore cannot determine if it is ragged.");
140 } else {
141 const auto numberOfBins = data[0]->histogram_size();
142 return std::any_of(data.cbegin(), data.cend(),
143 [&numberOfBins](const auto &eventList) { return numberOfBins != eventList->histogram_size(); });
144 }
145}
146
149size_t EventWorkspace::size() const {
150 return std::accumulate(
151 data.begin(), data.end(), static_cast<size_t>(0),
152 [](size_t value, const std::unique_ptr<EventList> &histo) { return value + histo->histogram_size(); });
153}
154
158 if (data.empty()) {
159 throw std::range_error("EventWorkspace::blocksize, no pixels in workspace, "
160 "therefore cannot determine blocksize (# of bins).");
161 } else {
162 size_t numBins = data[0]->histogram_size();
163 const auto iterPos = std::find_if_not(data.cbegin(), data.cend(),
164 [numBins](const auto &iter) { return numBins == iter->histogram_size(); });
165 if (iterPos != data.cend())
166 throw std::length_error("blocksize undefined because size of histograms is not equal");
167 return numBins;
168 }
169}
170
175std::size_t EventWorkspace::getNumberBins(const std::size_t &index) const {
176 if (index < data.size())
177 return data[index]->histogram_size();
178
179 throw std::invalid_argument("Could not find number of bins in a histogram at index " + std::to_string(index) +
180 ": index is too large.");
181}
182
187 if (data.empty()) {
188 return 0;
189 } else {
190 auto maxNumberOfBins = data[0]->histogram_size();
191 for (const auto &iter : data) {
192 const auto numberOfBins = iter->histogram_size();
193 if (numberOfBins > maxNumberOfBins)
194 maxNumberOfBins = numberOfBins;
195 }
196 return maxNumberOfBins;
197 }
198}
199
204size_t EventWorkspace::getNumberHistograms() const { return this->data.size(); }
205
208 auto &spec = const_cast<EventList &>(static_cast<const EventWorkspace &>(*this).getSpectrum(index));
209 spec.setMatrixWorkspace(this, index);
210 return spec;
211}
212
214const EventList &EventWorkspace::getSpectrum(const size_t index) const {
215 if (index >= data.size())
216 throw std::range_error("EventWorkspace::getSpectrum, workspace index out of range");
217 return *data[index];
218}
219
232
233double EventWorkspace::getTofMin() const { return this->getEventXMin(); }
234
235double EventWorkspace::getTofMax() const { return this->getEventXMax(); }
236
242 // set to crazy values to start
243 Mantid::Types::Core::DateAndTime tMin = DateAndTime::maximum();
244 size_t numWorkspace = this->data.size();
245 DateAndTime temp;
246 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
247 const EventList &evList = this->getSpectrum(workspaceIndex);
248 temp = evList.getPulseTimeMin();
249 if (temp < tMin)
250 tMin = temp;
251 }
252 return tMin;
253}
254
260 // set to crazy values to start
261 Mantid::Types::Core::DateAndTime tMax = DateAndTime::minimum();
262 size_t numWorkspace = this->data.size();
263 DateAndTime temp;
264 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
265 const EventList &evList = this->getSpectrum(workspaceIndex);
266 temp = evList.getPulseTimeMax();
267 if (temp > tMax)
268 tMax = temp;
269 }
270 return tMax;
271}
277void EventWorkspace::getPulseTimeMinMax(Mantid::Types::Core::DateAndTime &Tmin,
278 Mantid::Types::Core::DateAndTime &Tmax) const {
279
280 Tmax = DateAndTime::minimum();
281 Tmin = DateAndTime::maximum();
282
283 auto numWorkspace = static_cast<int64_t>(this->data.size());
284#pragma omp parallel
285 {
286 DateAndTime tTmax = DateAndTime::minimum();
287 DateAndTime tTmin = DateAndTime::maximum();
288#pragma omp for nowait
289 for (int64_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
290 const EventList &evList = this->getSpectrum(workspaceIndex);
291 DateAndTime tempMin, tempMax;
292 evList.getPulseTimeMinMax(tempMin, tempMax);
293 tTmin = std::min(tTmin, tempMin);
294 tTmax = std::max(tTmax, tempMax);
295 }
296#pragma omp critical
297 {
298 Tmin = std::min(Tmin, tTmin);
299 Tmax = std::max(Tmax, tTmax);
300 }
301 }
302}
303
309DateAndTime EventWorkspace::getTimeAtSampleMin(double tofOffset) const {
310 const auto &specInfo = spectrumInfo();
311 const auto L1 = specInfo.l1();
312
313 // set to crazy values to start
314 Mantid::Types::Core::DateAndTime tMin = DateAndTime::maximum();
315 size_t numWorkspace = this->data.size();
316 DateAndTime temp;
317
318 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
319 const auto L2 = specInfo.l2(workspaceIndex);
320 const double tofFactor = L1 / (L1 + L2);
321
322 const EventList &evList = this->getSpectrum(workspaceIndex);
323 temp = evList.getTimeAtSampleMin(tofFactor, tofOffset);
324 if (temp < tMin)
325 tMin = temp;
326 }
327 return tMin;
328}
329
335DateAndTime EventWorkspace::getTimeAtSampleMax(double tofOffset) const {
336 const auto &specInfo = spectrumInfo();
337 const auto L1 = specInfo.l1();
338
339 // set to crazy values to start
340 Mantid::Types::Core::DateAndTime tMax = DateAndTime::minimum();
341 size_t numWorkspace = this->data.size();
342 DateAndTime temp;
343 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
344 const auto L2 = specInfo.l2(workspaceIndex);
345 const double tofFactor = L1 / (L1 + L2);
346
347 const EventList &evList = this->getSpectrum(workspaceIndex);
348 temp = evList.getTimeAtSampleMax(tofFactor, tofOffset);
349 if (temp > tMax)
350 tMax = temp;
351 }
352 return tMax;
353}
354
366 // set to crazy values to start
367 double xmin = std::numeric_limits<double>::max();
368 if (this->getNumberEvents() == 0)
369 return xmin;
370 size_t numWorkspace = this->data.size();
371 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
372 const EventList &evList = this->getSpectrum(workspaceIndex);
373 const double temp = evList.getTofMin();
374 if (temp < xmin)
375 xmin = temp;
376 }
377 return xmin;
378}
379
391 // set to crazy values to start
392 double xmax = std::numeric_limits<double>::lowest();
393 if (this->getNumberEvents() == 0)
394 return xmax;
395 size_t numWorkspace = this->data.size();
396 for (size_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
397 const EventList &evList = this->getSpectrum(workspaceIndex);
398 const double temp = evList.getTofMax();
399 if (temp > xmax)
400 xmax = temp;
401 }
402 return xmax;
403}
404
411void EventWorkspace::getEventXMinMax(double &xmin, double &xmax) const {
412 // set to crazy values to start
413 xmin = std::numeric_limits<double>::max();
414 xmax = -1.0 * xmin;
415 if (this->getNumberEvents() == 0)
416 return;
417
418 auto numWorkspace = static_cast<int64_t>(this->data.size());
419#pragma omp parallel
420 {
421 double tXmin = xmin;
422 double tXmax = xmax;
423#pragma omp for nowait
424 for (int64_t workspaceIndex = 0; workspaceIndex < numWorkspace; workspaceIndex++) {
425 const EventList &evList = this->getSpectrum(workspaceIndex);
426 tXmin = std::min(evList.getTofMin(), tXmin);
427 tXmax = std::max(evList.getTofMax(), tXmax);
428 }
429#pragma omp critical
430 {
431 xmin = std::min(xmin, tXmin);
432 xmax = std::max(xmax, tXmax);
433 }
434 }
435}
436
440 return std::accumulate(data.cbegin(), data.cend(), size_t{0},
441 [](const auto total, const auto &list) { return total + list->getNumberEvents(); });
442}
443
450 for (const auto &list : this->data) {
451 Mantid::API::EventType thisType = list->getEventType();
452 if (static_cast<int>(out) < static_cast<int>(thisType)) {
453 out = thisType;
454 // This is the most-specialized it can get.
456 return out;
457 }
458 }
459 return out;
460}
461
467 for (auto &eventList : this->data)
468 eventList->switchTo(type);
469}
470
474bool EventWorkspace::isHistogramData() const { return true; }
475
480size_t EventWorkspace::MRUSize() const { return mru->MRUSize(); }
481
483void EventWorkspace::clearMRU() const { mru->clear(); }
484
487 // TODO: Add the MRU buffer
488
489 // Add the memory from all the event lists
490 size_t total = std::accumulate(data.begin(), data.end(), size_t{0},
491 [](size_t total, auto &list) { return total + list->getMemorySize(); });
492
493 total += run().getMemorySize();
494
495 total += this->getMemorySizeForXAxes();
496
497 // Return in bytes
498 return total;
499}
500
501// The two mutable accessors below can only be expressed in terms of EventList's own legacy
502// interface: handing out a mutable MantidVec would allow the length to be changed, so
503// FixedLengthVector::mutableRawData() is protected and Histogram is its only friend.
504GNU_DIAG_OFF("deprecated-declarations")
505MSVC_DIAG_OFF(4996)
506
511[[deprecated("The dataX() method is deprecated in Mantid 7.0. Use mutableX() instead.")]]
512MantidVec &EventWorkspace::dataX(const std::size_t index) {
513 return getSpectrum(index).dataX();
514}
515
520[[deprecated("The dataDx() method is deprecated in Mantid 7.0. Use mutableDx() instead.")]]
522 return getSpectrum(index).dataDx();
523}
524
525MSVC_DIAG_ON(4996)
526GNU_DIAG_ON("deprecated-declarations")
527
531[[deprecated("The dataY() method is deprecated in Mantid 7.0. Use mutableY() instead.")]]
532MantidVec &EventWorkspace::dataY(const std::size_t /*index*/) {
533 throw NotImplementedError("EventWorkspace::dataY cannot return a non-const "
534 "array: you can't modify the histogrammed data in "
535 "an EventWorkspace!");
536}
537
541[[deprecated("The dataE() method is deprecated in Mantid 7.0. Use mutableE() instead.")]]
542MantidVec &EventWorkspace::dataE(const std::size_t /*index*/) {
543 throw NotImplementedError("EventWorkspace::dataE cannot return a non-const "
544 "array: you can't modify the histogrammed data in "
545 "an EventWorkspace!");
546}
547
551[[deprecated("The dataX() method is deprecated in Mantid 7.0. Use x() instead.")]]
552const MantidVec &EventWorkspace::dataX(const std::size_t index) const {
553 return getSpectrum(index).x().rawData();
554}
555
559[[deprecated("The dataDx() method is deprecated in Mantid 7.0. Use dx() instead.")]]
560const MantidVec &EventWorkspace::dataDx(const std::size_t index) const {
561 return getSpectrum(index).dx().rawData();
562}
563
567[[deprecated("The dataY() method is deprecated in Mantid 7.0. Use y() instead.")]]
568const MantidVec &EventWorkspace::dataY(const std::size_t index) const {
569 return getSpectrum(index).y().rawData();
570}
571
575[[deprecated("The dataE() method is deprecated in Mantid 7.0. Use e() instead.")]]
576const MantidVec &EventWorkspace::dataE(const std::size_t index) const {
577 return getSpectrum(index).e().rawData();
578}
579
583[[deprecated("The refX() method is deprecated in Mantid 7.0. Use sharedX() instead.")]]
587
598void EventWorkspace::generateHistogram(const std::size_t index, std::span<double const> X, MantidVec &Y, MantidVec &E,
599 bool skipError) const {
600 if (index >= data.size())
601 throw std::range_error("EventWorkspace::generateHistogram, histogram number out of range");
602 this->data[index]->generateHistogram(X, Y, E, skipError);
603}
604
615void EventWorkspace::generateHistogramPulseTime(const std::size_t index, std::span<double const> X, MantidVec &Y,
616 MantidVec &E, bool skipError) const {
617 if (index >= data.size())
618 throw std::range_error("EventWorkspace::generateHistogramPulseTime, "
619 "histogram number out of range");
620 this->data[index]->generateHistogramPulseTime(X, Y, E, skipError);
621}
622
626void EventWorkspace::setAllX(const HistogramData::BinEdges &x) {
627 // This is an EventWorkspace, so changing X size is ok as long as we clear
628 // the MRU below, i.e., we avoid the size check of Histogram::setBinEdges and
629 // just reset the whole Histogram.
631 for (auto &eventList : this->data)
632 eventList->setHistogram(x);
633
634 // Clear MRU lists now, free up memory
635 this->clearMRU();
636}
637
643 double tofmin, tofmax;
644 getEventXMinMax(tofmin, tofmax);
645
646 // Sanitize TOF min/max to ensure it always passes HistogramX validation.
647 // They would be invalid when number of events are 0 or 1, for example.
648 if (tofmin > tofmax) {
649 tofmin = 0;
650 tofmax = std::numeric_limits<double>::min();
651 } else if (tofmin == tofmax) {
652 tofmax += std::numeric_limits<double>::min();
653 }
654 setAllX({tofmin, tofmax});
655}
656
659public:
663
664 // Execute the sort as specified.
665 void operator()(const tbb::blocked_range<size_t> &range) const {
666 for (size_t wi = range.begin(); wi < range.end(); ++wi) {
667 // because EventList::sort calls tbb::parallel_sort checking that the EventList is non-empty reduces the number of
668 // threads created that return immediately
669 const auto &spectrum = m_WS->getSpectrum(wi); // follow the method signature
670 if (spectrum.empty())
671 spectrum.setSortOrder(m_sortType); // empty lists are easy to sort
672 else
673 spectrum.sort(m_sortType);
674 }
675 // Report progress
676 if (prog)
677 prog->report("Sorting");
678 }
679
680private:
687};
688
689/*
690 * Review each event list to get the sort type
691 * If any 2 have different order type, then be unsorted
692 */
694 EventSortType order = data[0]->getSortType();
695 const auto it =
696 std::find_if(data.cbegin(), data.cend(), [&order](const auto &list) { return list->getSortType() != order; });
697 if (it != data.cend())
698 return UNSORTED;
699 return order;
700}
701
702/*** Sort all event lists. Uses a parallelized algorithm
703 * @param sortType :: How to sort the event lists.
704 * @param prog :: a progress report object. If the pointer is not NULL, each
705 * event list will call prog.report() once.
706 */
708 if (this->getSortType() == sortType) {
709 if (prog != nullptr) {
710 prog->reportIncrement(this->data.size());
711 }
712 return;
713 }
714
715 // Create the thread pool using tbb
716 EventSortingTask task(this, sortType, prog);
717 constexpr size_t GRAINSIZE_DEFAULT{100}; // somewhat arbitrary
718 const size_t grainsize = std::min<size_t>(GRAINSIZE_DEFAULT, (this->getNumberHistograms() / GRAINSIZE_DEFAULT) + 1);
719 tbb::parallel_for(tbb::blocked_range<size_t>(0, data.size(), grainsize), task);
720}
721
734void EventWorkspace::getIntegratedSpectra(std::vector<double> &out, const double minX, const double maxX,
735 const bool entireRange) const {
736 // Start with empty vector
737 out.resize(this->getNumberHistograms(), 0.0);
738
739 // We can run in parallel since there is no cross-reading of event lists
741 for (int wksp_index = 0; wksp_index < int(this->getNumberHistograms()); wksp_index++) {
742 // Get Handle to data
743 EventList const *el = this->data[wksp_index].get();
744
745 // Let the eventList do the integration
746 out[wksp_index] = el->integrate(minX, maxX, entireRange);
747 }
748}
749
750} // namespace Mantid::DataObjects
751
752namespace Mantid::Kernel {
753template <>
755IPropertyManager::getValue<Mantid::DataObjects::EventWorkspace_sptr>(const std::string &name) const {
756 auto *prop = dynamic_cast<PropertyWithValue<Mantid::DataObjects::EventWorkspace_sptr> *>(getPointerToProperty(name));
757 if (prop) {
758 return *prop;
759 } else {
760 std::string message =
761 "Attempt to assign property " + name + " to incorrect type. Expected shared_ptr<EventWorkspace>.";
762 throw std::runtime_error(message);
763 }
764}
765
766template <>
768IPropertyManager::getValue<Mantid::DataObjects::EventWorkspace_const_sptr>(const std::string &name) const {
769 auto const *prop =
770 dynamic_cast<PropertyWithValue<Mantid::DataObjects::EventWorkspace_sptr> *>(getPointerToProperty(name));
771 if (prop) {
772 return prop->operator()();
773 } else {
774 std::string message =
775 "Attempt to assign property " + name + " to incorrect type. Expected const shared_ptr<EventWorkspace>.";
776 throw std::runtime_error(message);
777 }
778}
779} // 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 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: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 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:32
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class
Helper class which provides the Collimation Length for SANS instruments.
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)