23class SplittingInterval;
27namespace DataObjects {
28class EventWorkspaceMRU;
64 EventList(
const std::vector<Types::Event::TofEvent> &events);
66 EventList(
const std::vector<WeightedEvent> &events);
68 EventList(
const std::vector<WeightedEventNoTime> &events);
72 void copyDataFrom(
const ISpectrum &source)
override;
74 void createFromHistogram(
const ISpectrum *inSpec,
bool GenerateZeros,
bool GenerateMultipleEvents,
95 bool equals(
const EventList &
rhs,
const double tolTof,
const double tolWeight,
const int64_t tolPulse)
const;
105 this->events.emplace_back(event);
115 this->weightedEvents.emplace_back(event);
125 this->weightedEventsNoTime.emplace_back(event);
135 std::vector<Types::Event::TofEvent> &getEvents();
136 const std::vector<Types::Event::TofEvent> &getEvents()
const;
138 std::vector<WeightedEvent> &getWeightedEvents();
139 const std::vector<WeightedEvent> &getWeightedEvents()
const;
141 std::vector<WeightedEventNoTime> &getWeightedEventsNoTime();
142 const std::vector<WeightedEventNoTime> &getWeightedEventsNoTime()
const;
144 void clear(
const bool removeDetIDs =
true)
override;
149 void clearData()
override;
151 void reserve(
size_t num)
override;
157 void sortTof()
const;
159 void sortPulseTime()
const;
160 void sortPulseTimeTOF()
const;
161 void sortTimeAtSample(
const double &tofFactor,
const double &tofShift,
bool forceResort =
false)
const;
163 bool isSortedByTof()
const override;
175 const MantidVec &dataDx()
const override;
176 const MantidVec &readDx()
const override;
180 MantidVec &
dataY()
override {
throw std::runtime_error(
"EventList: non-const access to Y data is not possible."); }
183 MantidVec &
dataE()
override {
throw std::runtime_error(
"EventList: non-const access to E data is not possible."); }
196 std::size_t getNumberEvents()
const override;
199 size_t getMemorySize()
const override;
201 virtual size_t histogram_size()
const;
204 void compressFatEvents(
const double tolerance,
const Types::Core::DateAndTime &timeStart,
const double seconds,
209 bool skipError =
false)
const override;
212 const double &tofOffset,
bool skipError =
false)
const override;
214 void integrate(
const double minX,
const double maxX,
const bool entireRange,
double &sum,
double &
error)
const;
216 double integrate(
const double minX,
const double maxX,
const bool entireRange)
const override;
218 void convertTof(std::function<
double(
double)> func,
const int sorting = 0)
override;
220 void convertTof(
const double factor,
const double offset = 0.)
override;
222 void scaleTof(
const double factor)
override;
224 void addTof(
const double offset)
override;
226 void addPulsetime(
const double seconds)
override;
228 void addPulsetimes(
const std::vector<double> &seconds)
override;
230 void maskTof(
const double tofMin,
const double tofMax)
override;
231 void maskCondition(
const std::vector<bool> &mask)
override;
233 void getTofs(std::vector<double> &tofs)
const override;
234 double getTofMin()
const override;
235 double getTofMax()
const override;
236 Mantid::Types::Core::DateAndTime getPulseTimeMax()
const override;
237 Mantid::Types::Core::DateAndTime getPulseTimeMin()
const override;
238 void getPulseTimeMinMax(Mantid::Types::Core::DateAndTime &tMin, Mantid::Types::Core::DateAndTime &tM)
const;
239 Mantid::Types::Core::DateAndTime getTimeAtSampleMax(
const double &tofFactor,
const double &tofOffset)
const override;
240 Mantid::Types::Core::DateAndTime getTimeAtSampleMin(
const double &tofFactor,
const double &tofOffset)
const override;
242 std::vector<double> getTofs()
const override;
245 std::vector<double> getWeights()
const override;
247 void getWeights(std::vector<double> &weights)
const override;
250 std::vector<double> getWeightErrors()
const override;
252 void getWeightErrors(std::vector<double> &weightErrors)
const override;
254 std::vector<Mantid::Types::Core::DateAndTime> getPulseTimes()
const override;
256 void setTofs(
const MantidVec &tofs)
override;
260 void filterByPulseTime(Types::Core::DateAndTime start, Types::Core::DateAndTime stop,
EventList &output)
const;
262 void filterByTimeAtSample(Types::Core::DateAndTime start, Types::Core::DateAndTime stop,
double tofFactor,
263 double tofOffset,
EventList &output)
const;
270 double toffactor,
double tofshift)
const;
273 std::string splitByFullTimeMatrixSplitter(
const std::vector<int64_t> &vec_splitters_time,
274 const std::vector<int> &vecgroups,
275 std::map<int, EventList *> vec_outputEventList,
bool docorrection,
276 double toffactor,
double tofshift)
const;
282 void splitByPulseTimeWithMatrix(
const std::vector<int64_t> &vec_times,
const std::vector<int> &vec_target,
283 std::map<int, EventList *> outputs)
const;
285 void multiply(
const double value,
const double error = 0.0)
override;
290 void divide(
const double value,
const double error = 0.0)
override;
296 void convertUnitsQuickly(
const double &factor,
const double &power);
300 HistogramData::Histogram histogram()
const override;
301 HistogramData::Counts counts()
const override;
302 HistogramData::CountVariances countVariances()
const override;
303 HistogramData::CountStandardDeviations countStandardDeviations()
const override;
304 HistogramData::Frequencies frequencies()
const override;
305 HistogramData::FrequencyVariances frequencyVariances()
const override;
306 HistogramData::FrequencyStandardDeviations frequencyStandardDeviations()
const override;
307 const HistogramData::HistogramY &
y()
const override;
308 const HistogramData::HistogramE &e()
const override;
312 void generateCountsHistogramPulseTime(
const double &xMin,
const double &xMax,
MantidVec &Y,
313 const double TofMin = std::numeric_limits<double>::lowest(),
314 const double TofMax = std::numeric_limits<double>::max())
const;
317 void checkAndSanitizeHistogram(HistogramData::Histogram &histogram)
override;
318 void checkWorksWithPoints()
const override;
319 void checkIsYAndEWritable()
const override;
322 using ISpectrum::copyDataInto;
323 void copyDataInto(
EventList &sink)
const override;
324 void copyDataInto(
Histogram1D &sink)
const override;
326 const HistogramData::Histogram &
histogramRef()
const override {
return m_histogram; }
327 HistogramData::Histogram &mutableHistogramRef()
override;
333 mutable std::vector<Types::Event::TofEvent>
events;
354 static typename std::vector<T>::const_iterator findFirstPulseEvent(
const std::vector<T> &events,
355 const double seek_pulsetime);
358 typename std::vector<T>::const_iterator findFirstTimeAtSampleEvent(
const std::vector<T> &events,
359 const double seek_time,
const double &tofFactor,
360 const double &tofOffset)
const;
366 void generateCountsHistogramTimeAtSample(
const MantidVec &X,
MantidVec &Y,
const double &tofFactor,
367 const double &tofOffset)
const;
371 void switchToWeightedEvents();
372 void switchToWeightedEventsNoTime();
374 void sortPulseTimeTOFDelta(
const Types::Core::DateAndTime &start,
const double seconds)
const;
377 template <
class T1,
class T2>
static void minusHelper(std::vector<T1> &events,
const std::vector<T2> &more_events);
379 static void compressEventsHelper(
const std::vector<T> &events, std::vector<WeightedEventNoTime> &out,
382 void compressEventsParallelHelper(
const std::vector<T> &events, std::vector<WeightedEventNoTime> &out,
386 const double tolerance,
const Mantid::Types::Core::DateAndTime &timeStart,
387 const double seconds);
392 static void integrateHelper(std::vector<T> &events,
const double minX,
const double maxX,
const bool entireRange,
393 double &sum,
double &
error);
395 static double integrateHelper(std::vector<T> &events,
const double minX,
const double maxX,
const bool entireRange);
396 template <
class T>
void convertTofHelper(std::vector<T> &events,
const std::function<
double(
double)> &func);
398 template <
class T>
void convertTofHelper(std::vector<T> &events,
const double factor,
const double offset);
399 template <
class T>
void addPulsetimeHelper(std::vector<T> &events,
const double seconds);
400 template <
class T>
void addPulsetimesHelper(std::vector<T> &events,
const std::vector<double> &seconds);
401 template <
class T>
static std::size_t maskTofHelper(std::vector<T> &events,
const double tofMin,
const double tofMax);
402 template <
class T>
static std::size_t maskConditionHelper(std::vector<T> &events,
const std::vector<bool> &mask);
404 template <
class T>
static void getTofsHelper(
const std::vector<T> &events, std::vector<double> &tofs);
405 template <
class T>
static void getWeightsHelper(
const std::vector<T> &events, std::vector<double> &weights);
406 template <
class T>
static void getWeightErrorsHelper(
const std::vector<T> &events, std::vector<double> &weightErrors);
408 static void getPulseTimesHelper(
const std::vector<T> &events, std::vector<Mantid::Types::Core::DateAndTime> ×);
409 template <
class T>
static void setTofsHelper(std::vector<T> &events,
const std::vector<double> &tofs);
412 Types::Core::DateAndTime stop, std::vector<T> &output);
415 Types::Core::DateAndTime stop,
double tofFactor,
double tofOffset,
416 std::vector<T> &output);
420 typename std::vector<T> &events)
const;
423 typename std::vector<T> &events,
bool docorrection,
double toffactor,
424 double tofshift)
const;
428 typename std::vector<T> &events)
const;
432 void splitByPulseTimeWithMatrixHelper(
const std::vector<int64_t> &vec_split_times,
433 const std::vector<int> &vec_split_target, std::map<int, EventList *> outputs,
434 typename std::vector<T> &events)
const;
437 std::string splitByFullTimeVectorSplitterHelper(
const std::vector<int64_t> &vectimes,
438 const std::vector<int> &vecgroups, std::map<int, EventList *> outputs,
439 typename std::vector<T> &vecEvents,
bool docorrection,
440 double toffactor,
double tofshift)
const;
444 splitByFullTimeSparseVectorSplitterHelper(
const std::vector<int64_t> &vectimes,
const std::vector<int> &vecgroups,
445 std::map<int, EventList *> outputs,
typename std::vector<T> &vecEvents,
446 bool docorrection,
double toffactor,
double tofshift)
const;
448 template <
class T>
static void multiplyHelper(std::vector<T> &events,
const double value,
const double error = 0.0);
450 static void multiplyHistogramHelper(std::vector<T> &events,
const MantidVec &X,
const MantidVec &Y,
458 void convertUnitsQuicklyHelper(
typename std::vector<T> &events,
const double &factor,
const double &power);
const std::vector< double > & rhs
double value
The value of the point.
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
IEventList : Interface to Mantid::DataObjects::EventList class, used to expose to PythonAPI.
A "spectrum" is an object that holds the data for a particular spectrum, in particular:
static void filterByTimeAtSampleHelper(std::vector< T > &events, Types::Core::DateAndTime start, Types::Core::DateAndTime stop, double tofFactor, double tofOffset, std::vector< T > &output)
std::vector< WeightedEventNoTime > weightedEventsNoTime
List of WeightedEvent's.
HistogramData::Histogram m_histogram
Histogram object holding the histogram data. Currently only X.
Mantid::API::EventType eventType
What type of event is in our list.
EventList(const std::vector< Types::Event::TofEvent > &events)
std::vector< Types::Event::TofEvent > events
List of TofEvent (no weights).
EventWorkspaceMRU * mru
MRU lists of the parent EventWorkspace.
EventSortType order
Last sorting order.
EventList & operator+=(const Types::Event::TofEvent &event)
MantidVec & dataE() override
Deprecated, use mutableE() instead.
static void compressFatEventsHelper(const std::vector< T > &events, std::vector< WeightedEvent > &out, const double tolerance, const Mantid::Types::Core::DateAndTime &timeStart, const double seconds)
MantidVec & dataY() override
Deprecated, use mutableY() instead.
std::mutex m_sortMutex
Mutex that is locked while sorting an event list.
static void filterByPulseTimeHelper(std::vector< T > &events, Types::Core::DateAndTime start, Types::Core::DateAndTime stop, std::vector< T > &output)
void addEventQuickly(const WeightedEvent &event)
Append an event to the histogram, without clearing the cache, to make it faster.
EventList & operator+=(const std::vector< Types::Event::TofEvent > &more_events)
std::vector< WeightedEvent > weightedEvents
List of WeightedEvent's.
void addEventQuickly(const WeightedEventNoTime &event)
Append an event to the histogram, without clearing the cache, to make it faster.
const HistogramData::Histogram & histogramRef() const override
void addEventQuickly(const Types::Event::TofEvent &event)
Append an event to the histogram, without clearing the cache, to make it faster.
This is a container for the MRU (most-recently-used) list of generated histograms.
1D histogram implementation.
Info about a single neutron detection event, including a weight and error value, but excluding the pu...
Info about a single neutron detection event, including a weight and error value:
The base units (abstract) class.
Implements a copy on write data template.
bool MANTID_API_DLL equals(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs, double tolerance=0.0)
Performs a comparison operation on two workspaces, using the CompareWorkspaces algorithm.
MatrixWorkspace_sptr MANTID_API_DLL operator/=(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Divide two workspaces.
MatrixWorkspace_sptr MANTID_API_DLL operator+=(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Adds two workspaces.
MatrixWorkspace_sptr MANTID_API_DLL operator-=(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Subtracts two workspaces.
MatrixWorkspace_sptr MANTID_API_DLL operator*=(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Multiply two workspaces.
EventType
What kind of event list is being stored.
DLLExport void getEventsFrom(EventList &el, std::vector< Types::Event::TofEvent > *&events)
EventSortType
How the event list is sorted.
@ PULSETIMETOF_DELTA_SORT
std::vector< SplittingInterval > TimeSplitterType
A typedef for splitting events according their pulse time.
Helper class which provides the Collimation Length for SANS instruments.
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
int32_t specnum_t
Typedef for a spectrum Number.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr bool operator!=(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)