Mantid
Loading...
Searching...
No Matches
IEventList.h
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 +
7#pragma once
8#include "MantidAPI/DllConfig.h"
12#include <functional>
13#include <span>
14
15namespace Mantid {
16namespace API {
17
20
27class MANTID_API_DLL IEventList : public ISpectrum {
28public:
31
33 IEventList(specnum_t specNo) : ISpectrum(specNo) {}
34
38 virtual void switchTo(Mantid::API::EventType newType) = 0;
40 virtual void clear(const bool removeDetIDs) = 0;
42 virtual void reserve(size_t num) = 0;
44 virtual bool isSortedByTof() const = 0;
46 virtual std::size_t getNumberEvents() const = 0;
48 size_t getMemorySize() const override = 0;
52 virtual void generateHistogram(std::span<double const> X, MantidVec &Y, MantidVec &E,
53 bool skipError = false) const = 0;
56 virtual void generateHistogramPulseTime(std::span<double const> X, MantidVec &Y, MantidVec &E,
57 bool skipError = false) const = 0;
60 virtual void generateHistogramTimeAtSample(std::span<double const> X, MantidVec &Y, MantidVec &E,
61 const double &tofFactor, const double &tofOffset,
62 bool skipError = false) const = 0;
64 virtual double integrate(const double minX, const double maxX, const bool entireRange) const = 0;
66 virtual void convertTof(std::function<double(double)> func, const int sorting = 0) = 0;
68 virtual void convertTof(const double factor, const double offset = 0.) = 0;
70 virtual void scaleTof(const double factor) = 0;
72 virtual void addTof(const double offset) = 0;
74 virtual void addPulsetime(const double seconds) = 0;
76 virtual void addPulsetimes(const std::vector<double> &seconds) = 0;
78 virtual void maskTof(const double tofMin, const double tofMax) = 0;
80 virtual void maskCondition(const std::vector<bool> &mask) = 0;
82 virtual std::vector<double> getTofs() const = 0;
84 virtual void getTofs(std::vector<double> &tofs) const = 0;
86 virtual std::vector<double> getWeights() const = 0;
88 virtual void getWeights(std::vector<double> &weights) const = 0;
90 virtual std::vector<double> getWeightErrors() const = 0;
92 virtual void getWeightErrors(std::vector<double> &weightErrors) const = 0;
94 virtual std::vector<Mantid::Types::Core::DateAndTime> getPulseTimes() const = 0;
96 virtual double getTofMin() const = 0;
98 virtual double getTofMax() const = 0;
100 virtual Mantid::Types::Core::DateAndTime getPulseTimeMin() const = 0;
102 virtual Mantid::Types::Core::DateAndTime getPulseTimeMax() const = 0;
104 virtual Mantid::Types::Core::DateAndTime getTimeAtSampleMax(const double &tofFactor,
105 const double &tofOffset) const = 0;
107 virtual Mantid::Types::Core::DateAndTime getTimeAtSampleMin(const double &tofFactor,
108 const double &tofOffset) const = 0;
110 virtual void setTofs(const MantidVec &tofs) = 0;
112 virtual void multiply(const double value, const double error = 0.0) = 0;
114 virtual void divide(const double value, const double error = 0.0) = 0;
117 virtual void multiply(std::span<double const> X, std::span<double const> Y, std::span<double const> E) = 0;
119 virtual void divide(std::span<double const> X, std::span<double const> Y, std::span<double const> E) = 0;
120};
121
122} // namespace API
123} // namespace Mantid
double value
The value of the point.
Definition FitMW.cpp:51
double error
IEventList : Interface to Mantid::DataObjects::EventList class, used to expose to PythonAPI.
Definition IEventList.h:27
virtual void divide(std::span< double const > X, std::span< double const > Y, std::span< double const > E)=0
Divide event list by a histogram.
virtual void addPulsetime(const double seconds)=0
Add a value to the pulse time values.
virtual void addTof(const double offset)=0
Add a value to the TOF values.
virtual Mantid::API::EventType getEventType() const =0
Return the current event type for the list.
virtual Mantid::Types::Core::DateAndTime getPulseTimeMax() const =0
Get the maximum pulse time from the list.
virtual void convertTof(const double factor, const double offset=0.)=0
Convert the TOF values.
virtual std::size_t getNumberEvents() const =0
Get the number of events from the list.
virtual void multiply(std::span< double const > X, std::span< double const > Y, std::span< double const > E)=0
Multiply event list by a histogram.
virtual Mantid::Types::Core::DateAndTime getPulseTimeMin() const =0
Get the minimum pulse time from the list.
virtual void maskCondition(const std::vector< bool > &mask)=0
Mask the events by the condition vector.
virtual void getTofs(std::vector< double > &tofs) const =0
Return the list of TOF values.
virtual void generateHistogramTimeAtSample(std::span< double const > X, MantidVec &Y, MantidVec &E, const double &tofFactor, const double &tofOffset, bool skipError=false) const =0
Get copy of counts and errors rebinning using the given X values w.r.t absolute time at the sample.
virtual void scaleTof(const double factor)=0
Scale the TOF values by a constant.
virtual std::vector< double > getWeights() const =0
Return the list of event weight values.
virtual Mantid::Types::Core::DateAndTime getTimeAtSampleMin(const double &tofFactor, const double &tofOffset) const =0
Get the minimum time at sample.
virtual Mantid::Types::Core::DateAndTime getTimeAtSampleMax(const double &tofFactor, const double &tofOffset) const =0
Get the maximum time at sample.
virtual double integrate(const double minX, const double maxX, const bool entireRange) const =0
Integrate the event list.
virtual std::vector< Mantid::Types::Core::DateAndTime > getPulseTimes() const =0
Return the list of pulse time values.
virtual void maskTof(const double tofMin, const double tofMax)=0
Mask a given TOF range.
IEventList()
Empty constructor.
Definition IEventList.h:30
virtual void multiply(const double value, const double error=0.0)=0
Multiply event list by a constant with error.
virtual bool isSortedByTof() const =0
IS the list sorted by TOF?
virtual void getWeights(std::vector< double > &weights) const =0
Return the list of event weight values.
virtual void convertTof(std::function< double(double)> func, const int sorting=0)=0
Convert the TOF values.
virtual void divide(const double value, const double error=0.0)=0
Divide event list by a constant with error.
virtual void clear(const bool removeDetIDs)=0
Clear the event list.
virtual std::vector< double > getTofs() const =0
Return the list of TOF values.
virtual void switchTo(Mantid::API::EventType newType)=0
Switch to a new event type within the list.
virtual void getWeightErrors(std::vector< double > &weightErrors) const =0
Return the list of event weight error values.
virtual void generateHistogram(std::span< double const > X, MantidVec &Y, MantidVec &E, bool skipError=false) const =0
Get copy of counts and errors, rebinned using on the given X values.
virtual void generateHistogramPulseTime(std::span< double const > X, MantidVec &Y, MantidVec &E, bool skipError=false) const =0
Get copy of counts and errors rebinned using the given X values w.r.t pulse time.
virtual void addPulsetimes(const std::vector< double > &seconds)=0
Add a separate value to each of the pulse time values.
virtual void setTofs(const MantidVec &tofs)=0
Set the TOFs from the given list.
virtual double getTofMin() const =0
Get the minimum TOF from the list.
virtual double getTofMax() const =0
Get the maximum TOF from the list.
size_t getMemorySize() const override=0
Get memory size of event list.
IEventList(specnum_t specNo)
Constructor.
Definition IEventList.h:33
virtual std::vector< double > getWeightErrors() const =0
Return the list of event weight error values.
virtual void reserve(size_t num)=0
Reserve a fixed size for the list.
A "spectrum" is an object that holds the data for a particular spectrum, in particular:
Definition ISpectrum.h:38
EventType
What kind of event list is being stored.
Definition IEventList.h:19
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