Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Mantid::DataObjects::EventList Class Reference

A class for holding : More...

#include <EventList.h>

Inheritance diagram for Mantid::DataObjects::EventList:
Mantid::API::IEventList Mantid::API::ISpectrum

Public Member Functions

void addEventQuickly (const Types::Event::TofEvent &event)
 Append an event to the histogram, without clearing the cache, to make it faster. More...
 
void addEventQuickly (const WeightedEvent &event)
 Append an event to the histogram, without clearing the cache, to make it faster. More...
 
void addEventQuickly (const WeightedEventNoTime &event)
 Append an event to the histogram, without clearing the cache, to make it faster. More...
 
void addPulsetime (const double seconds) override
 Add an offset to the pulsetime (wall-clock time) of each event in the list. More...
 
void addPulsetimes (const std::vector< double > &seconds) override
 Add an offset to the pulsetime (wall-clock time) of each event in the list. More...
 
void addTof (const double offset) override
 Add an offset to the TOF of each event in the list. More...
 
void clear (const bool removeDetIDs=true) override
 Clear the list of events and any associated detector ID's. More...
 
void clearData () override
 Mask the spectrum to this value. Removes all events. More...
 
void clearUnused ()
 Clear any unused event lists (the ones that do not match the currently used type). More...
 
void compressEvents (double tolerance, EventList *destination)
 Compress the event list by grouping events with the same TOF (within a given tolerance). More...
 
void compressFatEvents (const double tolerance, const Types::Core::DateAndTime &timeStart, const double seconds, EventList *destination)
 
template<class T >
void compressFatEventsHelper (const std::vector< T > &events, std::vector< WeightedEvent > &out, const double tolerance, const Types::Core::DateAndTime &timeStart, const double seconds)
 
void convertTof (const double factor, const double offset=0.) override
 Convert the time of flight by tof'=tof*factor+offset. More...
 
void convertTof (std::function< double(double)> func, const int sorting=0) override
 
void convertUnitsQuickly (const double &factor, const double &power)
 Convert the event's TOF (x) value according to a simple output = a * (input^b) relationship. More...
 
void convertUnitsViaTof (Mantid::Kernel::Unit *fromUnit, Mantid::Kernel::Unit *toUnit)
 Converts the X units in each event by going through TOF. More...
 
void copyDataFrom (const ISpectrum &source) override
 Copy data from another EventList, via ISpectrum reference. More...
 
HistogramData::Counts counts () const override
 
HistogramData::CountStandardDeviations countStandardDeviations () const override
 
HistogramData::CountVariances countVariances () const override
 
void createFromHistogram (const ISpectrum *inSpec, bool GenerateZeros, bool GenerateMultipleEvents, int MaxEventsPerBin)
 Create an EventList from a histogram. More...
 
const MantidVecdataDx () const override
 Deprecated, use dx() instead. More...
 
MantidVecdataDx () override
 Deprecated, use mutableDx() instead. More...
 
const MantidVecdataE () const override
 Deprecated, use e() instead. More...
 
MantidVecdataE () override
 Deprecated, use mutableE() instead. More...
 
const MantidVecdataX () const override
 Deprecated, use x() instead. More...
 
MantidVecdataX () override
 Deprecated, use mutableX() instead. More...
 
const MantidVecdataY () const override
 Deprecated, use y() instead. More...
 
MantidVecdataY () override
 Deprecated, use mutableY() instead. More...
 
void divide (const double value, const double error=0.0) override
 Divide the weights in this event list by a scalar with an (optional) error. More...
 
void divide (const MantidVec &X, const MantidVec &Y, const MantidVec &E) override
 Divide the weights in this event list by a histogram. More...
 
const HistogramData::HistogramE & e () const override
 
bool empty () const
 Much like stl containers, returns true if there is nothing in the event list. More...
 
bool equals (const EventList &rhs, const double tolTof, const double tolWeight, const int64_t tolPulse) const
 
 EventList ()
 Constructor (empty) More...
 
 EventList (const EventList &rhs)
 Constructor copying from an existing event list. More...
 
 EventList (const std::vector< Types::Event::TofEvent > &events)
 
 EventList (const std::vector< WeightedEvent > &events)
 Constructor, taking a vector of events. More...
 
 EventList (const std::vector< WeightedEventNoTime > &events)
 Constructor, taking a vector of events. More...
 
 EventList (EventWorkspaceMRU *mru, specnum_t specNo)
 Constructor with a MRU list. More...
 
void filterByPulseTime (Types::Core::DateAndTime start, Types::Core::DateAndTime stop, EventList &output) const
 Filter this EventList into an output EventList, using keeping only events within the >= start and < end pulse times. More...
 
template<class T >
void filterByPulseTimeHelper (std::vector< T > &events, DateAndTime start, DateAndTime stop, std::vector< T > &output)
 Filter a vector of events into another based on pulse time. More...
 
void filterByTimeAtSample (Types::Core::DateAndTime start, Types::Core::DateAndTime stop, double tofFactor, double tofOffset, EventList &output) const
 
template<class T >
void filterByTimeAtSampleHelper (std::vector< T > &events, DateAndTime start, DateAndTime stop, double tofFactor, double tofOffset, std::vector< T > &output)
 Filter a vector of events into another based on time at sample. More...
 
void filterInPlace (Kernel::TimeSplitterType &splitter)
 Use a TimeSplitterType to filter the event list in place. More...
 
HistogramData::Frequencies frequencies () const override
 
HistogramData::FrequencyStandardDeviations frequencyStandardDeviations () const override
 
HistogramData::FrequencyVariances frequencyVariances () const override
 
void generateCountsHistogramPulseTime (const double &xMin, const double &xMax, MantidVec &Y, const double TofMin=std::numeric_limits< double >::lowest(), const double TofMax=std::numeric_limits< double >::max()) const
 With respect to PulseTime fill a histogram given equal histogram bins. More...
 
void generateHistogram (const MantidVec &X, MantidVec &Y, MantidVec &E, bool skipError=false) const override
 Generates both the Y and E (error) histograms w.r.t TOF for an EventList with or without WeightedEvents. More...
 
void generateHistogramPulseTime (const MantidVec &X, MantidVec &Y, MantidVec &E, bool skipError=false) const override
 Generates both the Y and E (error) histograms w.r.t Pulse Time for an EventList with or without WeightedEvents. More...
 
void generateHistogramTimeAtSample (const MantidVec &X, MantidVec &Y, MantidVec &E, const double &tofFactor, const double &tofOffset, bool skipError=false) const override
 Generates both the Y and E (error) histograms w.r.t Time at sample position. More...
 
WeightedEvent getEvent (size_t event_number)
 Return the given event in the list. More...
 
std::vector< Types::Event::TofEvent > & getEvents ()
 Return the list of TofEvents contained. More...
 
const std::vector< Types::Event::TofEvent > & getEvents () const
 Return the const list of TofEvents contained. More...
 
Mantid::API::EventType getEventType () const override
 Return the type of Event vector contained within. More...
 
size_t getMemorySize () const override
 Memory used by this event list. More...
 
std::size_t getNumberEvents () const override
 Return the number of events in the list. More...
 
Mantid::Types::Core::DateAndTime getPulseTimeMax () const override
 
Mantid::Types::Core::DateAndTime getPulseTimeMin () const override
 
void getPulseTimeMinMax (Mantid::Types::Core::DateAndTime &tMin, Mantid::Types::Core::DateAndTime &tM) const
 
std::vector< Mantid::Types::Core::DateAndTime > getPulseTimes () const override
 Get the pulse times of each event in this EventList. More...
 
EventSortType getSortType () const
 Return the type of sorting used in this event list. More...
 
Mantid::Types::Core::DateAndTime getTimeAtSampleMax (const double &tofFactor, const double &tofOffset) const override
 Get the maximum time at sample. More...
 
Mantid::Types::Core::DateAndTime getTimeAtSampleMin (const double &tofFactor, const double &tofOffset) const override
 Get the minimum time at sample. More...
 
double getTofMax () const override
 
double getTofMin () const override
 
std::vector< double > getTofs () const override
 Get the times-of-flight of each event in this EventList. More...
 
void getTofs (std::vector< double > &tofs) const override
 Fill a vector with the list of TOFs. More...
 
std::vector< WeightedEvent > & getWeightedEvents ()
 Return the list of WeightedEvent contained. More...
 
const std::vector< WeightedEvent > & getWeightedEvents () const
 Return the list of WeightedEvent contained. More...
 
std::vector< WeightedEventNoTime > & getWeightedEventsNoTime ()
 Return the list of WeightedEvent contained. More...
 
const std::vector< WeightedEventNoTime > & getWeightedEventsNoTime () const
 Return the list of WeightedEventNoTime contained. More...
 
std::vector< double > getWeightErrors () const override
 Return the list of event weight error values. More...
 
void getWeightErrors (std::vector< double > &weightErrors) const override
 Return the list of event weight error values. More...
 
std::vector< double > getWeights () const override
 Return the list of event weight values. More...
 
void getWeights (std::vector< double > &weights) const override
 Return the list of event weight values. More...
 
HistogramData::Histogram histogram () const override
 Returns the Histogram associated with this spectrum. More...
 
virtual size_t histogram_size () const
 Return the size of the histogram data. More...
 
double integrate (const double minX, const double maxX, const bool entireRange) const override
 Integrate the events between a range of X values, or all events. More...
 
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. More...
 
bool isSortedByTof () const override
 Return true if the event list is sorted by TOF. More...
 
MantidVecmakeDataE () const
 Calculates and returns a pointer to the E histogrammed data. More...
 
MantidVecmakeDataY () const
 Calculates and returns a pointer to the Y histogrammed data. More...
 
void maskCondition (const std::vector< bool > &mask) override
 Mask out events by the condition vector. More...
 
void maskTof (const double tofMin, const double tofMax) override
 Mask out events that have a tof between tofMin and tofMax (inclusively). More...
 
void multiply (const double value, const double error=0.0) override
 Multiply the weights in this event list by a scalar variable with an error; though the error can be 0.0. More...
 
void multiply (const MantidVec &X, const MantidVec &Y, const MantidVec &E) override
 Multiply the weights in this event list by a histogram. More...
 
bool operator!= (const EventList &rhs) const
 Inequality comparator. More...
 
EventListoperator*= (const double value)
 Operator to multiply the weights in this EventList by an error-less scalar. More...
 
EventListoperator+= (const EventList &more_events)
 Append another EventList to this event list. More...
 
EventListoperator+= (const std::vector< Types::Event::TofEvent > &more_events)
 
EventListoperator+= (const std::vector< WeightedEvent > &more_events)
 Append a list of events to the histogram. More...
 
EventListoperator+= (const std::vector< WeightedEventNoTime > &more_events)
 Append a list of events to the histogram. More...
 
EventListoperator+= (const Types::Event::TofEvent &event)
 
EventListoperator+= (const WeightedEvent &event)
 Append a WeightedEvent to the histogram. More...
 
EventListoperator-= (const EventList &more_events)
 SUBTRACT another EventList from this event list. More...
 
EventListoperator/= (const double value)
 Operator to divide the weights in this EventList by an error-less scalar. More...
 
EventListoperator= (const EventList &)
 Copy into this event list from another. More...
 
bool operator== (const EventList &rhs) const
 Equality operator between EventList's. More...
 
Kernel::cow_ptr< HistogramData::HistogramX > ptrX () const override
 Deprecated, use sharedX() instead. Returns a pointer to the x data. More...
 
const MantidVecreadDx () const override
 Deprecated, use dx() instead. More...
 
const MantidVecreadX () const override
 Deprecated, use x() instead. Returns the x data const. More...
 
void reserve (size_t num) override
 Reserve a certain number of entries in event list of the specified eventType. More...
 
void reverse ()
 Reverse the histogram boundaries and the associated events if they are sorted by time-of-flight. More...
 
void scaleTof (const double factor) override
 Convert the units in the TofEvent's m_tof field to some other value, by scaling by a multiplier. More...
 
void setMRU (EventWorkspaceMRU *newMRU)
 Sets the MRU list for this event list. More...
 
void setSortOrder (const EventSortType order) const
 Manually set the event list sort order value. More...
 
void setTofs (const MantidVec &tofs) override
 Set a list of TOFs to the current event list. More...
 
void setX (const Kernel::cow_ptr< HistogramData::HistogramX > &X) override
 Deprecated, use setSharedX() instead. More...
 
Kernel::cow_ptr< HistogramData::HistogramE > sharedE () const override
 
Kernel::cow_ptr< HistogramData::HistogramY > sharedY () const override
 
void sort (const EventSortType order) const
 Sort events by TOF or Frame. More...
 
void sortPulseTime () const
 Sort events by Frame. More...
 
void sortPulseTimeTOF () const
 
void sortTimeAtSample (const double &tofFactor, const double &tofShift, bool forceResort=false) const
 Sort events by time at sample. More...
 
void sortTof () const
 Sort events by TOF in one thread. More...
 
void splitByFullTime (Kernel::TimeSplitterType &splitter, std::map< int, EventList * > outputs, bool docorrection, double toffactor, double tofshift) const
 Split the event list into n outputs by event's full time (tof + pulse time) More...
 
std::string splitByFullTimeMatrixSplitter (const std::vector< int64_t > &vec_splitters_time, const std::vector< int > &vecgroups, std::map< int, EventList * > vec_outputEventList, bool docorrection, double toffactor, double tofshift) const
 Split ... More...
 
void splitByPulseTime (Kernel::TimeSplitterType &splitter, std::map< int, EventList * > outputs) const
 Split events by pulse time. More...
 
void splitByPulseTimeWithMatrix (const std::vector< int64_t > &vec_times, const std::vector< int > &vec_target, std::map< int, EventList * > outputs) const
 Split events by pulse time with Matrix splitters. More...
 
void splitByTime (Kernel::TimeSplitterType &splitter, std::vector< EventList * > outputs) const
 Split the event list into n outputs. More...
 
void switchTo (Mantid::API::EventType newType) override
 Switch the EventList to use the given EventType (TOF, WEIGHTED, or WEIGHTED_NOTIME) More...
 
const HistogramData::HistogramY & y () const override
 
 ~EventList () override
 Destructor. More...
 
- Public Member Functions inherited from Mantid::API::IEventList
virtual void addPulsetime (const double seconds)=0
 Add a value to the pulse time values. More...
 
virtual void addPulsetimes (const std::vector< double > &seconds)=0
 Add a separate value to each of the pulse time values. More...
 
virtual void addTof (const double offset)=0
 Add a value to the TOF values. More...
 
virtual void clear (const bool removeDetIDs)=0
 Clear the event list. More...
 
virtual void convertTof (const double factor, const double offset=0.)=0
 Convert the TOF values. More...
 
virtual void convertTof (std::function< double(double)> func, const int sorting=0)=0
 Convert the TOF values. More...
 
virtual void divide (const double value, const double error=0.0)=0
 Divide event list by a constant with error. More...
 
virtual void divide (const MantidVec &X, const MantidVec &Y, const MantidVec &E)=0
 Divide event list by a histogram. More...
 
virtual void generateHistogram (const MantidVec &X, MantidVec &Y, MantidVec &E, bool skipError=false) const =0
 Get copy of counts and errors, rebinned using on the given X values. More...
 
virtual void generateHistogramPulseTime (const MantidVec &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. More...
 
virtual void generateHistogramTimeAtSample (const MantidVec &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. More...
 
virtual Mantid::API::EventType getEventType () const =0
 Return the current event type for the list. More...
 
size_t getMemorySize () const override=0
 Get memory size of event list. More...
 
virtual std::size_t getNumberEvents () const =0
 Get the number of events from the list. More...
 
virtual Mantid::Types::Core::DateAndTime getPulseTimeMax () const =0
 Get the maximum pulse time from the list. More...
 
virtual Mantid::Types::Core::DateAndTime getPulseTimeMin () const =0
 Get the minimum pulse time from the list. More...
 
virtual std::vector< Mantid::Types::Core::DateAndTime > getPulseTimes () const =0
 Return the list of pulse time values. More...
 
virtual Mantid::Types::Core::DateAndTime getTimeAtSampleMax (const double &tofFactor, const double &tofOffset) const =0
 Get the maximum time at sample. More...
 
virtual Mantid::Types::Core::DateAndTime getTimeAtSampleMin (const double &tofFactor, const double &tofOffset) const =0
 Get the minimum time at sample. More...
 
virtual double getTofMax () const =0
 Get the maximum TOF from the list. More...
 
virtual double getTofMin () const =0
 Get the minimum TOF from the list. More...
 
virtual std::vector< double > getTofs () const =0
 Return the list of TOF values. More...
 
virtual void getTofs (std::vector< double > &tofs) const =0
 Return the list of TOF values. More...
 
virtual std::vector< double > getWeightErrors () const =0
 Return the list of event weight error values. More...
 
virtual void getWeightErrors (std::vector< double > &weightErrors) const =0
 Return the list of event weight error values. More...
 
virtual std::vector< double > getWeights () const =0
 Return the list of event weight values. More...
 
virtual void getWeights (std::vector< double > &weights) const =0
 Return the list of event weight values. More...
 
 IEventList ()
 Empty constructor. More...
 
 IEventList (specnum_t specNo)
 Constructor. More...
 
virtual double integrate (const double minX, const double maxX, const bool entireRange) const =0
 Integrate the event list. More...
 
virtual bool isSortedByTof () const =0
 IS the list sorted by TOF? More...
 
virtual void maskCondition (const std::vector< bool > &mask)=0
 Mask the events by the condition vector. More...
 
virtual void maskTof (const double tofMin, const double tofMax)=0
 Mask a given TOF range. More...
 
virtual void multiply (const double value, const double error=0.0)=0
 Multiply event list by a constant with error. More...
 
virtual void multiply (const MantidVec &X, const MantidVec &Y, const MantidVec &E)=0
 Multiply event list by a histogram. More...
 
virtual void reserve (size_t num)=0
 Reserve a fixed size for the list. More...
 
virtual void scaleTof (const double factor)=0
 Scale the TOF values by a constant. More...
 
virtual void setTofs (const MantidVec &tofs)=0
 Set the TOFs from the given list. More...
 
virtual void switchTo (Mantid::API::EventType newType)=0
 Switch to a new event type within the list. More...
 
- Public Member Functions inherited from Mantid::API::ISpectrum
void addDetectorID (const detid_t detID)
 Add a detector ID to the set of detector IDs. More...
 
void addDetectorIDs (const std::set< detid_t > &detIDs)
 Add a set of detector IDs to the set of detector IDs. More...
 
void addDetectorIDs (const std::vector< detid_t > &detIDs)
 Add a vector of detector IDs to the set of detector IDs. More...
 
HistogramData::BinEdges binEdges () const
 
virtual void clearData ()=0
 
void clearDetectorIDs ()
 Clear the detector IDs set. More...
 
void convertToCounts ()
 
void convertToFrequencies ()
 
virtual void copyDataFrom (const ISpectrum &source)=0
 Copy data from another ISpectrum with double-dynamic dispatch. More...
 
virtual void copyDataInto (DataObjects::EventList &) const
 Override in child classes for polymorphic copying of data. More...
 
virtual void copyDataInto (DataObjects::Histogram1D &) const
 Override in child classes for polymorphic copying of data. More...
 
virtual void copyDataInto (SpectrumTester &) const
 Override in child classes for polymorphic copying of data. More...
 
void copyInfoFrom (const ISpectrum &other)
 Copy spectrum number and detector IDs, but not X vector, from another ISpectrum. More...
 
virtual HistogramData::Counts counts () const
 
virtual HistogramData::CountStandardDeviations countStandardDeviations () const
 
virtual HistogramData::CountVariances countVariances () const
 
virtual const MantidVecdataDx () const =0
 
virtual MantidVecdataDx ()=0
 
virtual const MantidVecdataE () const =0
 
virtual MantidVecdataE ()=0
 
virtual const MantidVecdataX () const =0
 
virtual MantidVecdataX ()=0
 
virtual const MantidVecdataY () const =0
 
virtual MantidVecdataY ()=0
 
const HistogramData::HistogramDx & dx () const
 
virtual const HistogramData::HistogramE & e () const
 
virtual HistogramData::Frequencies frequencies () const
 
virtual HistogramData::FrequencyStandardDeviations frequencyStandardDeviations () const
 
virtual HistogramData::FrequencyVariances frequencyVariances () const
 
const std::set< detid_t > & getDetectorIDs () const
 Get a const reference to the detector IDs set. More...
 
virtual size_t getMemorySize () const =0
 
specnum_t getSpectrumNo () const
 
virtual std::pair< double, double > getXDataRange () const
 Return the min/max X values for this spectrum. More...
 
bool hasDetectorID (const detid_t detID) const
 Return true if the given detector ID is in the list for this ISpectrum. More...
 
bool hasDx () const
 Gets the value of the use flag. More...
 
virtual HistogramData::Histogram histogram () const
 Returns the Histogram associated with this spectrum. More...
 
 ISpectrum ()=default
 
 ISpectrum (const specnum_t specNo)
 Constructor with spectrum number. More...
 
HistogramData::HistogramDx & mutableDx () &
 
HistogramData::HistogramE & mutableE () &
 
HistogramData::HistogramX & mutableX () &
 
HistogramData::HistogramY & mutableY () &
 
HistogramData::Points points () const
 
HistogramData::PointStandardDeviations pointStandardDeviations () const
 
virtual Kernel::cow_ptr< HistogramData::HistogramX > ptrX () const =0
 
virtual const MantidVecreadDx () const =0
 
virtual const MantidVecreadE () const
 Deprecated, use e() instead. Returns the y error data const. More...
 
virtual const MantidVecreadX () const =0
 
virtual const MantidVecreadY () const
 Deprecated, use y() instead. Returns the y data const. More...
 
void resetHasDx ()
 Resets the hasDx flag. More...
 
template<typename... T>
void setBinEdges (T &&...data) &
 
template<typename... T>
void setCounts (T &&...data) &
 
template<typename... T>
void setCountStandardDeviations (T &&...data) &
 
template<typename... T>
void setCountVariances (T &&...data) &
 
void setDetectorID (const detid_t detID)
 Clear the list of detector IDs, then add one. More...
 
void setDetectorIDs (const std::set< detid_t > &detIDs)
 Set the detector IDs to be the set given. More...
 
void setDetectorIDs (std::set< detid_t > &&detIDs)
 Set the detector IDs to be the set given (move version). More...
 
template<typename... T>
void setFrequencies (T &&...data) &
 
template<typename... T>
void setFrequencyStandardDeviations (T &&...data) &
 
template<typename... T>
void setFrequencyVariances (T &&...data) &
 
template<typename... T>
void setHistogram (T &&...data)
 Sets the Histogram associated with this spectrum. More...
 
void setMatrixWorkspace (MatrixWorkspace *matrixWorkspace, const size_t index)
 Sets the MatrixWorkspace pointer (pointer to the owning workspace). More...
 
template<typename... T>
void setPoints (T &&...data) &
 
template<typename... T>
void setPointStandardDeviations (T &&...data) &
 
template<typename... T>
void setPointVariances (T &&...data) &
 
void setSharedDx (const Kernel::cow_ptr< HistogramData::HistogramDx > &dx) &
 
void setSharedE (const Kernel::cow_ptr< HistogramData::HistogramE > &e) &
 
void setSharedX (const Kernel::cow_ptr< HistogramData::HistogramX > &x) &
 
void setSharedY (const Kernel::cow_ptr< HistogramData::HistogramY > &y) &
 
void setSpectrumNo (specnum_t num)
 Sets the the spectrum number of this spectrum. More...
 
virtual void setX (const Kernel::cow_ptr< HistogramData::HistogramX > &X)=0
 
void setYMode (HistogramData::Histogram::YMode ymode)
 
Kernel::cow_ptr< HistogramData::HistogramDx > sharedDx () const
 
virtual Kernel::cow_ptr< HistogramData::HistogramE > sharedE () const
 
Kernel::cow_ptr< HistogramData::HistogramX > sharedX () const
 
virtual Kernel::cow_ptr< HistogramData::HistogramY > sharedY () const
 
const HistogramData::HistogramX & x () const
 
virtual const HistogramData::HistogramY & y () const
 
HistogramData::Histogram::YMode yMode () const
 
virtual ~ISpectrum ()=default
 

Protected Member Functions

void checkAndSanitizeHistogram (HistogramData::Histogram &histogram) override
 
void checkIsYAndEWritable () const override
 
void checkWorksWithPoints () const override
 
- Protected Member Functions inherited from Mantid::API::ISpectrum
virtual void checkAndSanitizeHistogram (HistogramData::Histogram &)
 
virtual void checkIsYAndEWritable () const
 
virtual void checkWorksWithPoints () const
 
 ISpectrum (const ISpectrum &other)
 Copy constructor. More...
 
 ISpectrum (ISpectrum &&other)
 Move constructor. More...
 
ISpectrumoperator= (const ISpectrum &other)
 Copy assignment. More...
 
ISpectrumoperator= (ISpectrum &&other)
 Move assignment. More...
 

Private Member Functions

template<class T >
void addPulsetimeHelper (std::vector< T > &events, const double seconds)
 Add an offset to the pulsetime (wall-clock time) of each event in the list. More...
 
template<class T >
void addPulsetimesHelper (std::vector< T > &events, const std::vector< double > &seconds)
 Add an offset per event to the pulsetime (wall-clock time) of each event in the list. More...
 
template<class T >
void compressEventsParallelHelper (const std::vector< T > &events, std::vector< WeightedEventNoTime > &out, double tolerance)
 Compress the event list by grouping events with the same TOF. More...
 
template<class T >
void convertTofHelper (std::vector< T > &events, const double factor, const double offset)
 Function to do the conversion factor work on either the TofEvent list or the WeightedEvent list. More...
 
template<class T >
void convertTofHelper (std::vector< T > &events, const std::function< double(double)> &func)
 
template<class T >
void convertUnitsQuicklyHelper (typename std::vector< T > &events, const double &factor, const double &power)
 Convert the event's TOF (x) value according to a simple output = a * (input^b) relationship. More...
 
template<class T >
void convertUnitsViaTofHelper (typename std::vector< T > &events, Mantid::Kernel::Unit *fromUnit, Mantid::Kernel::Unit *toUnit)
 Helper function for the conversion to TOF. More...
 
virtual void copyDataInto (DataObjects::EventList &) const
 Override in child classes for polymorphic copying of data. More...
 
virtual void copyDataInto (DataObjects::Histogram1D &) const
 Override in child classes for polymorphic copying of data. More...
 
void copyDataInto (EventList &sink) const override
 Used by copyDataFrom for dynamic dispatch for its source. More...
 
void copyDataInto (Histogram1D &sink) const override
 Used by Histogram1D::copyDataFrom for dynamic dispatch for other. More...
 
virtual void copyDataInto (SpectrumTester &) const
 Override in child classes for polymorphic copying of data. More...
 
template<class T >
void filterInPlaceHelper (Kernel::TimeSplitterType &splitter, typename std::vector< T > &events)
 Perform an in-place filtering on a vector of either TofEvent's or WeightedEvent's. More...
 
template<class T >
std::vector< T >::const_iterator findFirstTimeAtSampleEvent (const std::vector< T > &events, const double seek_time, const double &tofFactor, const double &tofOffset) const
 Utility function: Returns the iterator into events of the first TofEvent with time at sample > seek_time Will return events.end() if nothing is found! More...
 
void generateCountsHistogram (const MantidVec &X, MantidVec &Y) const
 Fill a histogram given specified histogram bounds. More...
 
void generateCountsHistogramPulseTime (const MantidVec &X, MantidVec &Y) const
 With respect to PulseTime Fill a histogram given specified histogram bounds. More...
 
void generateCountsHistogramTimeAtSample (const MantidVec &X, MantidVec &Y, const double &tofFactor, const double &tofOffset) const
 With respect to Time at Sample, fill a histogram given specified histogram bounds. More...
 
void generateErrorsHistogram (const MantidVec &Y, MantidVec &E) const
 Generate the Error histogram for the provided counts histogram. More...
 
const HistogramData::Histogram & histogramRef () const override
 
HistogramData::Histogram & mutableHistogramRef () override
 
void sortPulseTimeTOFDelta (const Types::Core::DateAndTime &start, const double seconds) const
 Sort by the pulse time with a tolerance. More...
 
template<class T >
void splitByFullTimeHelper (Kernel::TimeSplitterType &splitter, std::map< int, EventList * > outputs, typename std::vector< T > &events, bool docorrection, double toffactor, double tofshift) const
 Split the event list into n outputs, operating on a vector of either TofEvent's or WeightedEvent's The comparison between neutron event and splitter is based on neutron event's pulse time plus. More...
 
template<class T >
std::string splitByFullTimeSparseVectorSplitterHelper (const std::vector< int64_t > &vectimes, const std::vector< int > &vecgroups, std::map< int, EventList * > outputs, typename std::vector< T > &vecEvents, bool docorrection, double toffactor, double tofshift) const
 Split the event list into n outputs, operating on a vector of either TofEvent's or WeightedEvent's The comparison between neutron event and splitter is based on neutron event's pulse time plus. More...
 
template<class T >
std::string splitByFullTimeVectorSplitterHelper (const std::vector< int64_t > &vectimes, const std::vector< int > &vecgroups, std::map< int, EventList * > outputs, typename std::vector< T > &vecEvents, bool docorrection, double toffactor, double tofshift) const
 Split the event list into n outputs, operating on a vector of either TofEvent's or WeightedEvent's The comparison between neutron event and splitter is based on neutron event's pulse time plus. More...
 
template<class T >
void splitByPulseTimeHelper (Kernel::TimeSplitterType &splitter, std::map< int, EventList * > outputs, typename std::vector< T > &events) const
 Split events by pulse time. More...
 
template<class T >
void splitByPulseTimeWithMatrixHelper (const std::vector< int64_t > &vec_split_times, const std::vector< int > &vec_split_target, std::map< int, EventList * > outputs, typename std::vector< T > &events) const
 Split events (template) by pulse time with matrix splitters. More...
 
template<class T >
void splitByTimeHelper (Kernel::TimeSplitterType &splitter, std::vector< EventList * > outputs, typename std::vector< T > &events) const
 Split the event list into n outputs, operating on a vector of either TofEvent's or WeightedEvent's Only event's pulse time is used to compare with splitters. More...
 
void switchToWeightedEvents ()
 Switch the EventList to use WeightedEvents instead of TofEvent. More...
 
void switchToWeightedEventsNoTime ()
 Switch the EventList to use WeightedEventNoTime's instead of TofEvent. More...
 

Static Private Member Functions

template<class T >
static void compressEventsHelper (const std::vector< T > &events, std::vector< WeightedEventNoTime > &out, double tolerance)
 Compress the event list by grouping events with the same TOF. More...
 
template<class T >
static void compressFatEventsHelper (const std::vector< T > &events, std::vector< WeightedEvent > &out, const double tolerance, const Mantid::Types::Core::DateAndTime &timeStart, const double seconds)
 
template<class T >
static void divideHistogramHelper (std::vector< T > &events, const MantidVec &X, const MantidVec &Y, const MantidVec &E)
 Helper method for dividing an event list by a histogram with error. More...
 
template<class T >
static void filterByPulseTimeHelper (std::vector< T > &events, Types::Core::DateAndTime start, Types::Core::DateAndTime stop, std::vector< T > &output)
 
template<class T >
static void filterByTimeAtSampleHelper (std::vector< T > &events, Types::Core::DateAndTime start, Types::Core::DateAndTime stop, double tofFactor, double tofOffset, std::vector< T > &output)
 
template<class T >
static std::vector< T >::const_iterator findFirstPulseEvent (const std::vector< T > &events, const double seek_pulsetime)
 Utility function: Returns the iterator into events of the first TofEvent with pulsetime() > seek_pulsetime Will return events.end() if nothing is found! More...
 
template<class T >
static void getPulseTimesHelper (const std::vector< T > &events, std::vector< Mantid::Types::Core::DateAndTime > &times)
 Get the pulsetimes of all events in a list. More...
 
template<class T >
static void getTofsHelper (const std::vector< T > &events, std::vector< double > &tofs)
 Get the m_tof member of all events in a list. More...
 
template<class T >
static void getWeightErrorsHelper (const std::vector< T > &events, std::vector< double > &weightErrors)
 Get the weight error member of all events in a list. More...
 
template<class T >
static void getWeightsHelper (const std::vector< T > &events, std::vector< double > &weights)
 Get the weight member of all events in a list. More...
 
template<class T >
static void histogramForWeightsHelper (const std::vector< T > &events, const MantidVec &X, MantidVec &Y, MantidVec &E)
 Generates both the Y and E (error) histograms for an EventList with WeightedEvents. More...
 
template<class T >
static double integrateHelper (std::vector< T > &events, const double minX, const double maxX, const bool entireRange)
 Integrate the events between a range of X values, or all events. More...
 
template<class T >
static void integrateHelper (std::vector< T > &events, const double minX, const double maxX, const bool entireRange, double &sum, double &error)
 Integrate the events between a range of X values, or all events. More...
 
template<class T >
static std::size_t maskConditionHelper (std::vector< T > &events, const std::vector< bool > &mask)
 Mask out events by the condition vector. More...
 
template<class T >
static std::size_t maskTofHelper (std::vector< T > &events, const double tofMin, const double tofMax)
 Mask out events that have a tof between tofMin and tofMax (inclusively). More...
 
template<class T1 , class T2 >
static void minusHelper (std::vector< T1 > &events, const std::vector< T2 > &more_events)
 SUBTRACT another EventList from this event list. More...
 
template<class T >
static void multiplyHelper (std::vector< T > &events, const double value, const double error=0.0)
 Helper method for multiplying an event list by a scalar value with/without error. More...
 
template<class T >
static void multiplyHistogramHelper (std::vector< T > &events, const MantidVec &X, const MantidVec &Y, const MantidVec &E)
 Helper method for multiplying an event list by a histogram with error. More...
 
template<class T >
static void setTofsHelper (std::vector< T > &events, const std::vector< double > &tofs)
 Set a list of TOFs to the current event list. More...
 

Private Attributes

std::vector< Types::Event::TofEvent > events
 List of TofEvent (no weights). More...
 
Mantid::API::EventType eventType
 What type of event is in our list. More...
 
HistogramData::Histogram m_histogram
 Histogram object holding the histogram data. Currently only X. More...
 
std::mutex m_sortMutex
 Mutex that is locked while sorting an event list. More...
 
EventWorkspaceMRUmru
 MRU lists of the parent EventWorkspace. More...
 
EventSortType order
 Last sorting order. More...
 
std::vector< WeightedEventweightedEvents
 List of WeightedEvent's. More...
 
std::vector< WeightedEventNoTimeweightedEventsNoTime
 List of WeightedEvent's. More...
 

Detailed Description

A class for holding :

This class can switch from holding regular TofEvent's (implied weight of 1.0) or WeightedEvent (where each neutron can have a non-1 weight). This is done transparently.

Author
Janik Zikovsky, SNS ORNL
Date
4/02/2010

Definition at line 56 of file EventList.h.

Constructor & Destructor Documentation

◆ EventList() [1/6]

Mantid::DataObjects::EventList::EventList ( )

Constructor (empty)

Definition at line 140 of file EventList.cpp.

◆ EventList() [2/6]

Mantid::DataObjects::EventList::EventList ( EventWorkspaceMRU mru,
specnum_t  specNo 
)

Constructor with a MRU list.

Parameters
mru:: pointer to the MRU of the parent EventWorkspace
specNo:: the spectrum number for the event list

Definition at line 148 of file EventList.cpp.

◆ EventList() [3/6]

Mantid::DataObjects::EventList::EventList ( const EventList rhs)

Constructor copying from an existing event list.

Parameters
rhs:: EventList object to copy

Definition at line 155 of file EventList.cpp.

References operator=().

◆ EventList() [4/6]

Mantid::DataObjects::EventList::EventList ( const std::vector< Types::Event::TofEvent > &  events)

◆ EventList() [5/6]

Mantid::DataObjects::EventList::EventList ( const std::vector< WeightedEvent > &  events)

Constructor, taking a vector of events.

Parameters
events:: Vector of WeightedEvent's

Definition at line 173 of file EventList.cpp.

References events, eventType, order, Mantid::DataObjects::UNSORTED, Mantid::API::WEIGHTED, and weightedEvents.

◆ EventList() [6/6]

Mantid::DataObjects::EventList::EventList ( const std::vector< WeightedEventNoTime > &  events)

Constructor, taking a vector of events.

Parameters
events:: Vector of WeightedEventNoTime's

Definition at line 182 of file EventList.cpp.

References events, eventType, order, Mantid::DataObjects::UNSORTED, Mantid::API::WEIGHTED_NOTIME, and weightedEventsNoTime.

◆ ~EventList()

Mantid::DataObjects::EventList::~EventList ( )
override

Destructor.

Definition at line 190 of file EventList.cpp.

References clear().

Member Function Documentation

◆ addEventQuickly() [1/3]

void Mantid::DataObjects::EventList::addEventQuickly ( const Types::Event::TofEvent &  event)
inline

◆ addEventQuickly() [2/3]

void Mantid::DataObjects::EventList::addEventQuickly ( const WeightedEvent event)
inline

Append an event to the histogram, without clearing the cache, to make it faster.

Parameters
event:: WeightedEvent to add at the end of the list.

Definition at line 114 of file EventList.h.

References Mantid::DataObjects::UNSORTED.

◆ addEventQuickly() [3/3]

void Mantid::DataObjects::EventList::addEventQuickly ( const WeightedEventNoTime event)
inline

Append an event to the histogram, without clearing the cache, to make it faster.

Parameters
event:: WeightedEventNoTime to add at the end of the list.

Definition at line 124 of file EventList.h.

References Mantid::DataObjects::UNSORTED.

◆ addPulsetime()

void Mantid::DataObjects::EventList::addPulsetime ( const double  seconds)
overridevirtual

Add an offset to the pulsetime (wall-clock time) of each event in the list.

Parameters
seconds:: The value to shift the pulsetime by, in seconds

Implements Mantid::API::IEventList.

Definition at line 2525 of file EventList.cpp.

References addPulsetimeHelper(), eventType, getNumberEvents(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, and weightedEvents.

◆ addPulsetimeHelper()

template<class T >
void Mantid::DataObjects::EventList::addPulsetimeHelper ( std::vector< T > &  events,
const double  seconds 
)
private

Add an offset to the pulsetime (wall-clock time) of each event in the list.

Parameters
events:: reference to a vector of events to change.
seconds:: The value to shift the pulsetime by, in seconds

Definition at line 2499 of file EventList.cpp.

References events.

Referenced by addPulsetime().

◆ addPulsetimes()

void Mantid::DataObjects::EventList::addPulsetimes ( const std::vector< double > &  seconds)
overridevirtual

Add an offset to the pulsetime (wall-clock time) of each event in the list.

Parameters
seconds:: A set of values to shift the pulsetime by, in seconds

Implements Mantid::API::IEventList.

Definition at line 2550 of file EventList.cpp.

References addPulsetimesHelper(), eventType, getNumberEvents(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, and weightedEvents.

◆ addPulsetimesHelper()

template<class T >
void Mantid::DataObjects::EventList::addPulsetimesHelper ( std::vector< T > &  events,
const std::vector< double > &  seconds 
)
private

Add an offset per event to the pulsetime (wall-clock time) of each event in the list.

It is assumed that the vector sizes match.

Parameters
events:: reference to a vector of events to change.
seconds:: The set of values to shift the pulsetime by, in seconds

Definition at line 2512 of file EventList.cpp.

References events.

Referenced by addPulsetimes().

◆ addTof()

void Mantid::DataObjects::EventList::addTof ( const double  offset)
overridevirtual

Add an offset to the TOF of each event in the list.

Parameters
offset:: The value to shift the time-of-flight by

Implements Mantid::API::IEventList.

Definition at line 2491 of file EventList.cpp.

References convertTof().

Referenced by Mantid::Algorithms::ChangeBinOffset::exec().

◆ checkAndSanitizeHistogram()

void Mantid::DataObjects::EventList::checkAndSanitizeHistogram ( HistogramData::Histogram &  histogram)
overrideprotectedvirtual

Reimplemented from Mantid::API::ISpectrum.

Definition at line 4690 of file EventList.cpp.

References histogram(), and m_histogram.

◆ checkIsYAndEWritable()

void Mantid::DataObjects::EventList::checkIsYAndEWritable ( ) const
overrideprotectedvirtual

Reimplemented from Mantid::API::ISpectrum.

Definition at line 4710 of file EventList.cpp.

◆ checkWorksWithPoints()

void Mantid::DataObjects::EventList::checkWorksWithPoints ( ) const
overrideprotectedvirtual

Reimplemented from Mantid::API::ISpectrum.

Definition at line 4705 of file EventList.cpp.

◆ clear()

void Mantid::DataObjects::EventList::clear ( const bool  removeDetIDs = true)
overridevirtual

◆ clearData()

void Mantid::DataObjects::EventList::clearData ( )
overridevirtual

Mask the spectrum to this value. Removes all events.

Implements Mantid::API::ISpectrum.

Definition at line 880 of file EventList.cpp.

References clear().

Referenced by Mantid::Algorithms::WorkspaceJoiners::execEvent(), and operator-=().

◆ clearUnused()

void Mantid::DataObjects::EventList::clearUnused ( )

Clear any unused event lists (the ones that do not match the currently used type).

Memory is freed.

Definition at line 864 of file EventList.cpp.

References eventType, Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

Referenced by compressEvents(), compressFatEvents(), and switchTo().

◆ compressEvents()

void Mantid::DataObjects::EventList::compressEvents ( double  tolerance,
EventList destination 
)

Compress the event list by grouping events with the same TOF (within a given tolerance).

PulseTime is ignored. The event list will be switched to WeightedEventNoTime.

Parameters
tolerance:: how close do two event's TOF have to be to be considered the same.
destination:: EventList that will receive the compressed events. Can be == this.

Definition at line 1676 of file EventList.cpp.

References clearUnused(), compressEventsHelper(), empty(), eventType, order, sortTof(), Mantid::API::TOF, Mantid::DataObjects::TOF_SORT, tolerance, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

Referenced by Mantid::MDAlgorithms::IntegrateEllipsoidsTwoStep::qListFromEventWS(), Mantid::MDAlgorithms::IntegrateEllipsoidsV1::qListFromEventWS(), and Mantid::MDAlgorithms::IntegrateEllipsoidsV2::qListFromEventWS().

◆ compressEventsHelper()

template<class T >
void Mantid::DataObjects::EventList::compressEventsHelper ( const std::vector< T > &  events,
std::vector< WeightedEventNoTime > &  out,
double  tolerance 
)
inlinestaticprivate

Compress the event list by grouping events with the same TOF.

Parameters
events:: input event list.
out:: output WeightedEventNoTime vector.
tolerance:: how close do two event's TOF have to be to be considered the same.

Definition at line 1410 of file EventList.cpp.

References events, and tolerance.

Referenced by compressEvents().

◆ compressEventsParallelHelper()

template<class T >
void Mantid::DataObjects::EventList::compressEventsParallelHelper ( const std::vector< T > &  events,
std::vector< WeightedEventNoTime > &  out,
double  tolerance 
)
private

Compress the event list by grouping events with the same TOF.

Performs the compression in parallel.

Parameters
events:: input event list.
out:: output WeightedEventNoTime vector.
tolerance:: how close do two event's TOF have to be to be considered the same.

Definition at line 1485 of file EventList.cpp.

References events, Mantid::DataHandling::numEvents(), PARALLEL_FOR_NO_WSP_CHECK, PARALLEL_GET_MAX_THREADS, and tolerance.

◆ compressFatEvents()

void Mantid::DataObjects::EventList::compressFatEvents ( const double  tolerance,
const Types::Core::DateAndTime &  timeStart,
const double  seconds,
EventList destination 
)

◆ compressFatEventsHelper() [1/2]

template<class T >
static void Mantid::DataObjects::EventList::compressFatEventsHelper ( const std::vector< T > &  events,
std::vector< WeightedEvent > &  out,
const double  tolerance,
const Mantid::Types::Core::DateAndTime &  timeStart,
const double  seconds 
)
staticprivate

Referenced by compressFatEvents().

◆ compressFatEventsHelper() [2/2]

template<class T >
void Mantid::DataObjects::EventList::compressFatEventsHelper ( const std::vector< T > &  events,
std::vector< WeightedEvent > &  out,
const double  tolerance,
const Types::Core::DateAndTime &  timeStart,
const double  seconds 
)
inline

◆ convertTof() [1/2]

void Mantid::DataObjects::EventList::convertTof ( const double  factor,
const double  offset = 0. 
)
overridevirtual

Convert the time of flight by tof'=tof*factor+offset.

Parameters
factor:: The value to scale the time-of-flight by
offset:: The value to shift the time-of-flight by

Implements Mantid::API::IEventList.

Definition at line 2435 of file EventList.cpp.

References convertTofHelper(), eventType, getNumberEvents(), getSortType(), Mantid::API::ISpectrum::mutableX(), reverse(), Mantid::API::TOF, Mantid::DataObjects::TOF_SORT, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, weightedEventsNoTime, and Mantid::Geometry::x.

◆ convertTof() [2/2]

void Mantid::DataObjects::EventList::convertTof ( std::function< double(double)>  func,
const int  sorting = 0 
)
overridevirtual
Parameters
funcFunction to do the conversion.
sortingHow the events are sorted after the operation. 0 = unsorted (default), positive = unchanged, negative = reverse.

Implements Mantid::API::IEventList.

Definition at line 2390 of file EventList.cpp.

References convertTofHelper(), dataX(), eventType, getNumberEvents(), getSortType(), reverse(), setSortOrder(), Mantid::API::TOF, Mantid::DataObjects::TOF_SORT, Mantid::DataObjects::UNSORTED, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, weightedEventsNoTime, and Mantid::Geometry::x.

Referenced by addTof(), Mantid::Algorithms::EQSANSCorrectFrame::exec(), and scaleTof().

◆ convertTofHelper() [1/2]

template<class T >
void Mantid::DataObjects::EventList::convertTofHelper ( std::vector< T > &  events,
const double  factor,
const double  offset 
)
private

Function to do the conversion factor work on either the TofEvent list or the WeightedEvent list.

Does NOT reverse the event list if the factor < 0

Parameters
events:: reference to a vector of events to change.
factor:: multiply by this
offset:: add this

Definition at line 2470 of file EventList.cpp.

References events.

◆ convertTofHelper() [2/2]

template<class T >
void Mantid::DataObjects::EventList::convertTofHelper ( std::vector< T > &  events,
const std::function< double(double)> &  func 
)
private
Parameters
events
func

Definition at line 2423 of file EventList.cpp.

References events.

Referenced by convertTof().

◆ convertUnitsQuickly()

void Mantid::DataObjects::EventList::convertUnitsQuickly ( const double &  factor,
const double &  power 
)

Convert the event's TOF (x) value according to a simple output = a * (input^b) relationship.

Parameters
factor:: the conversion factor a to apply
power:: the Power b to apply to the conversion

Definition at line 4670 of file EventList.cpp.

References convertUnitsQuicklyHelper(), eventType, Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

◆ convertUnitsQuicklyHelper()

template<class T >
void Mantid::DataObjects::EventList::convertUnitsQuicklyHelper ( typename std::vector< T > &  events,
const double &  factor,
const double &  power 
)
private

Convert the event's TOF (x) value according to a simple output = a * (input^b) relationship.

Parameters
events:: templated class for the list of events
factor:: the conversion factor a to apply
power:: the Power b to apply to the conversion

Definition at line 4657 of file EventList.cpp.

References events.

Referenced by convertUnitsQuickly().

◆ convertUnitsViaTof()

void Mantid::DataObjects::EventList::convertUnitsViaTof ( Mantid::Kernel::Unit fromUnit,
Mantid::Kernel::Unit toUnit 
)

Converts the X units in each event by going through TOF.

Note: if the unit conversion reverses the order, use "reverse()" to flip it back.

Parameters
fromUnit:: the Unit describing the input unit. Must be initialized.
toUnit:: the Unit describing the output unit. Must be initialized.

Definition at line 4627 of file EventList.cpp.

References convertUnitsViaTofHelper(), eventType, Mantid::Kernel::Unit::isInitialized(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

◆ convertUnitsViaTofHelper()

template<class T >
void Mantid::DataObjects::EventList::convertUnitsViaTofHelper ( typename std::vector< T > &  events,
Mantid::Kernel::Unit fromUnit,
Mantid::Kernel::Unit toUnit 
)
private

Helper function for the conversion to TOF.

This handles the different event types.

Parameters
eventsthe list of events
fromUnitthe unit to convert from
toUnitthe unit to convert to

Definition at line 4607 of file EventList.cpp.

References events, Mantid::Kernel::Unit::singleFromTOF(), and Mantid::Kernel::Unit::singleToTOF().

Referenced by convertUnitsViaTof().

◆ copyDataFrom()

void Mantid::DataObjects::EventList::copyDataFrom ( const ISpectrum source)
overridevirtual

Copy data from another EventList, via ISpectrum reference.

Implements Mantid::API::ISpectrum.

Definition at line 202 of file EventList.cpp.

References Mantid::API::ISpectrum::copyDataInto().

◆ copyDataInto() [1/5]

void Mantid::API::ISpectrum::copyDataInto ( DataObjects::EventList ) const
privatevirtual

Override in child classes for polymorphic copying of data.

Reimplemented from Mantid::API::ISpectrum.

Definition at line 203 of file ISpectrum.cpp.

◆ copyDataInto() [2/5]

void Mantid::API::ISpectrum::copyDataInto ( DataObjects::Histogram1D ) const
privatevirtual

Override in child classes for polymorphic copying of data.

Reimplemented from Mantid::API::ISpectrum.

Definition at line 204 of file ISpectrum.cpp.

◆ copyDataInto() [3/5]

void Mantid::DataObjects::EventList::copyDataInto ( EventList sink) const
overrideprivatevirtual

Used by copyDataFrom for dynamic dispatch for its source.

Reimplemented from Mantid::API::ISpectrum.

Definition at line 205 of file EventList.cpp.

References events, eventType, m_histogram, order, weightedEvents, and weightedEventsNoTime.

◆ copyDataInto() [4/5]

void Mantid::DataObjects::EventList::copyDataInto ( Histogram1D sink) const
overrideprivatevirtual

Used by Histogram1D::copyDataFrom for dynamic dispatch for other.

Reimplemented from Mantid::API::ISpectrum.

Definition at line 215 of file EventList.cpp.

References histogram(), and Mantid::API::ISpectrum::setHistogram().

◆ copyDataInto() [5/5]

void Mantid::API::ISpectrum::copyDataInto ( SpectrumTester ) const
privatevirtual

Override in child classes for polymorphic copying of data.

Reimplemented from Mantid::API::ISpectrum.

Definition at line 205 of file ISpectrum.cpp.

◆ counts()

HistogramData::Counts Mantid::DataObjects::EventList::counts ( ) const
overridevirtual

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1278 of file EventList.cpp.

References histogram().

◆ countStandardDeviations()

HistogramData::CountStandardDeviations Mantid::DataObjects::EventList::countStandardDeviations ( ) const
overridevirtual

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1282 of file EventList.cpp.

References histogram().

◆ countVariances()

HistogramData::CountVariances Mantid::DataObjects::EventList::countVariances ( ) const
overridevirtual

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1280 of file EventList.cpp.

References histogram().

◆ createFromHistogram()

void Mantid::DataObjects::EventList::createFromHistogram ( const ISpectrum inSpec,
bool  GenerateZeros,
bool  GenerateMultipleEvents,
int  MaxEventsPerBin 
)

Create an EventList from a histogram.

This converts bins to weighted events. Any existing events are cleared.

Parameters
inSpec:: ISpectrum ptr to histogram data.
GenerateZeros:: if true, generate event(s) for empty bins
GenerateMultipleEvents:: if true, create several evenly-spaced fake events inside the bin
MaxEventsPerBin:: max number of events to generate in one bin, if GenerateMultipleEvents

Definition at line 229 of file EventList.cpp.

References clear(), Mantid::API::ISpectrum::copyInfoFrom(), error, Mantid::DataHandling::numEvents(), Mantid::API::ISpectrum::ptrX(), Mantid::API::ISpectrum::readE(), Mantid::API::ISpectrum::readX(), Mantid::API::ISpectrum::readY(), setSortOrder(), setX(), switchTo(), Mantid::DataObjects::TOF_SORT, Mantid::API::WEIGHTED_NOTIME, weightedEventsNoTime, Mantid::Geometry::X, and Mantid::Geometry::Y.

Referenced by Mantid::MDAlgorithms::ConvertToDiffractionMDWorkspace::convertSpectrum(), and Mantid::Algorithms::ConvertToEventWorkspace::exec().

◆ dataDx() [1/2]

const MantidVec & Mantid::DataObjects::EventList::dataDx ( ) const
overridevirtual

Deprecated, use dx() instead.

Implements Mantid::API::ISpectrum.

Definition at line 1237 of file EventList.cpp.

References m_histogram.

◆ dataDx() [2/2]

MantidVec & Mantid::DataObjects::EventList::dataDx ( )
overridevirtual

Deprecated, use mutableDx() instead.

Implements Mantid::API::ISpectrum.

Definition at line 1235 of file EventList.cpp.

References m_histogram.

Referenced by Mantid::DataObjects::EventWorkspace::dataDx().

◆ dataE() [1/2]

const MantidVec & Mantid::DataObjects::EventList::dataE ( ) const
overridevirtual

Deprecated, use e() instead.

Look in the MRU to see if the E histogram has been generated before.

Return a read-only E histogram view of an event list

If so, return that. If not, calculate, cache and return it.

Returns
reference to the E vector.

Implements Mantid::API::ISpectrum.

Definition at line 1380 of file EventList.cpp.

References mru, and sharedE().

◆ dataE() [2/2]

MantidVec & Mantid::DataObjects::EventList::dataE ( )
inlineoverridevirtual

Deprecated, use mutableE() instead.

Disallowed data accessors - can't modify Y/E on a EventList

Implements Mantid::API::ISpectrum.

Definition at line 183 of file EventList.h.

◆ dataX() [1/2]

const MantidVec & Mantid::DataObjects::EventList::dataX ( ) const
overridevirtual

Deprecated, use x() instead.

Returns a const reference to the x data.

Returns
a reference to the X (bin) vector.

Implements Mantid::API::ISpectrum.

Definition at line 1226 of file EventList.cpp.

References m_histogram.

◆ dataX() [2/2]

MantidVec & Mantid::DataObjects::EventList::dataX ( )
overridevirtual

Deprecated, use mutableX() instead.

Returns a reference to the x data.

Returns
a reference to the X (bin) vector.

Implements Mantid::API::ISpectrum.

Definition at line 1218 of file EventList.cpp.

References Mantid::DataObjects::EventWorkspaceMRU::deleteIndex(), m_histogram, and mru.

Referenced by convertTof(), Mantid::DataObjects::EventWorkspace::dataX(), and reverse().

◆ dataY() [1/2]

const MantidVec & Mantid::DataObjects::EventList::dataY ( ) const
overridevirtual

Deprecated, use y() instead.

Look in the MRU to see if the Y histogram has been generated before.

Return a read-only Y histogram view of an event list

If so, return that. If not, calculate, cache and return it.

Returns
reference to the Y vector.

Implements Mantid::API::ISpectrum.

Definition at line 1366 of file EventList.cpp.

References mru, and sharedY().

◆ dataY() [2/2]

MantidVec & Mantid::DataObjects::EventList::dataY ( )
inlineoverridevirtual

Deprecated, use mutableY() instead.

Disallowed data accessors - can't modify Y/E on a EventList

Implements Mantid::API::ISpectrum.

Definition at line 180 of file EventList.h.

◆ divide() [1/2]

void Mantid::DataObjects::EventList::divide ( const double  value,
const double  error = 0.0 
)
overridevirtual

Divide the weights in this event list by a scalar with an (optional) error.

The event list switches to WeightedEvent's if needed. This simply calls the equivalent function: multiply(1.0/value, error/(value*value)).

Parameters
valuedivide all weights by this amount.
errorerror on 'value'. Can be 0.
Exceptions
std::invalid_argumentif value == 0; cannot divide by zero.

Implements Mantid::API::IEventList.

Definition at line 3633 of file EventList.cpp.

References error, multiply(), and value.

Referenced by Mantid::Algorithms::NormaliseToMonitor::normaliseBinByBin(), and Mantid::Algorithms::Divide::performEventBinaryOperation().

◆ divide() [2/2]

void Mantid::DataObjects::EventList::divide ( const MantidVec X,
const MantidVec Y,
const MantidVec E 
)
overridevirtual

Divide the weights in this event list by a histogram.

The event list switches to WeightedEvent's if needed. NOTE: no unit checks are made (or possible to make) to compare the units of X and tof() in the EventList.

The formula used for calculating the error on the neutron weight is:

\[ \sigma_{f}^2 = (A / B)^2 * (\sigma_A^2 / A^2 + \sigma_B^2 / B^2) \]

where:

  • A is the weight of the event
  • B is the weight of the BIN that the event falls in
  • \(\sigma_A\) is the error (not squared) of the weight of the event
  • \(\sigma_B\) is the error (not squared) of the bin B
  • f is the resulting weight of the divided event
Parameters
Xbins of the multiplying histogram.
Yvalue to multiply the weights.
Eerror on the value to multiply.
Exceptions
invalid_argumentif the sizes of X, Y, E are not consistent.

Implements Mantid::API::IEventList.

Definition at line 3586 of file EventList.cpp.

References divideHistogramHelper(), eventType, sortTof(), switchTo(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, weightedEventsNoTime, and Mantid::Geometry::Y.

◆ divideHistogramHelper()

template<class T >
void Mantid::DataObjects::EventList::divideHistogramHelper ( std::vector< T > &  events,
const MantidVec X,
const MantidVec Y,
const MantidVec E 
)
staticprivate

Helper method for dividing an event list by a histogram with error.

Parameters
eventsvector of events (with weights)
Xbins of the dividing histogram.
Yvalue to dividing the weights.
Eerror on the value to dividing.
Exceptions
invalid_argumentif the sizes of X, Y, E are not consistent.

Definition at line 3480 of file EventList.cpp.

References error, events, Mantid::DataObjects::findFirstEvent(), value, Mantid::Geometry::X, and Mantid::Geometry::Y.

Referenced by divide().

◆ e()

const HistogramData::HistogramE & Mantid::DataObjects::EventList::e ( ) const
overridevirtual

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1300 of file EventList.cpp.

References mru, and sharedE().

◆ empty()

bool Mantid::DataObjects::EventList::empty ( ) const

◆ equals()

bool Mantid::DataObjects::EventList::equals ( const EventList rhs,
const double  tolTof,
const double  tolWeight,
const int64_t  tolPulse 
) const

◆ filterByPulseTime()

void Mantid::DataObjects::EventList::filterByPulseTime ( Types::Core::DateAndTime  start,
Types::Core::DateAndTime  stop,
EventList output 
) const

Filter this EventList into an output EventList, using keeping only events within the >= start and < end pulse times.

Detector IDs and the X axis are copied as well.

Parameters
start:: start time (absolute)
stop:: end time (absolute)
output:: reference to an event list that will be output.
Exceptions
std::invalid_argumentIf output is a reference to this EventList

Definition at line 3709 of file EventList.cpp.

References clear(), events, eventType, filterByPulseTimeHelper(), Mantid::API::ISpectrum::getDetectorIDs(), m_histogram, order, Mantid::API::ISpectrum::setDetectorIDs(), Mantid::API::ISpectrum::setHistogram(), setSortOrder(), sortPulseTime(), switchTo(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, and weightedEvents.

Referenced by Mantid::Algorithms::FilterByTime::exec().

◆ filterByPulseTimeHelper() [1/2]

template<class T >
void Mantid::DataObjects::EventList::filterByPulseTimeHelper ( std::vector< T > &  events,
DateAndTime  start,
DateAndTime  stop,
std::vector< T > &  output 
)

Filter a vector of events into another based on pulse time.

TODO: Make this more efficient using STL-fu.

Parameters
events:: input events
start:: start time (absolute)
stop:: end time (absolute)
output:: reference to an event list that will be output.

Definition at line 3659 of file EventList.cpp.

References events.

◆ filterByPulseTimeHelper() [2/2]

template<class T >
static void Mantid::DataObjects::EventList::filterByPulseTimeHelper ( std::vector< T > &  events,
Types::Core::DateAndTime  start,
Types::Core::DateAndTime  stop,
std::vector< T > &  output 
)
staticprivate

Referenced by filterByPulseTime().

◆ filterByTimeAtSample()

void Mantid::DataObjects::EventList::filterByTimeAtSample ( Types::Core::DateAndTime  start,
Types::Core::DateAndTime  stop,
double  tofFactor,
double  tofOffset,
EventList output 
) const

◆ filterByTimeAtSampleHelper() [1/2]

template<class T >
void Mantid::DataObjects::EventList::filterByTimeAtSampleHelper ( std::vector< T > &  events,
DateAndTime  start,
DateAndTime  stop,
double  tofFactor,
double  tofOffset,
std::vector< T > &  output 
)

Filter a vector of events into another based on time at sample.

TODO: Make this more efficient using STL-fu.

Parameters
events:: input events
start:: start time (absolute)
stop:: end time (absolute)
tofFactor:: scaling factor for tof
tofOffset:: offset for tof
output:: reference to an event list that will be output.

Definition at line 3684 of file EventList.cpp.

References events.

◆ filterByTimeAtSampleHelper() [2/2]

template<class T >
static void Mantid::DataObjects::EventList::filterByTimeAtSampleHelper ( std::vector< T > &  events,
Types::Core::DateAndTime  start,
Types::Core::DateAndTime  stop,
double  tofFactor,
double  tofOffset,
std::vector< T > &  output 
)
staticprivate

Referenced by filterByTimeAtSample().

◆ filterInPlace()

void Mantid::DataObjects::EventList::filterInPlace ( Kernel::TimeSplitterType splitter)

Use a TimeSplitterType to filter the event list in place.

Parameters
splitter:: a TimeSplitterType where all the entries (start/end time) indicate events that will be kept. Any other events will be deleted.

Definition at line 3852 of file EventList.cpp.

References eventType, filterInPlaceHelper(), sortPulseTime(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, and weightedEvents.

Referenced by Mantid::Algorithms::FilterByLogValue::exec().

◆ filterInPlaceHelper()

template<class T >
void Mantid::DataObjects::EventList::filterInPlaceHelper ( Kernel::TimeSplitterType splitter,
typename std::vector< T > &  events 
)
private

Perform an in-place filtering on a vector of either TofEvent's or WeightedEvent's.

Parameters
splitter:: a TimeSplitterType where all the entries (start/end time) indicate events that will be kept. Any other events will be deleted.
events:: either this->events or this->weightedEvents.

Definition at line 3781 of file EventList.cpp.

References events, and index.

Referenced by filterInPlace().

◆ findFirstPulseEvent()

template<class T >
std::vector< T >::const_iterator Mantid::DataObjects::EventList::findFirstPulseEvent ( const std::vector< T > &  events,
const double  seek_pulsetime 
)
staticprivate

Utility function: Returns the iterator into events of the first TofEvent with pulsetime() > seek_pulsetime Will return events.end() if nothing is found!

Parameters
events:: event vector in which to look.
seek_pulsetime:: pulse time to find (typically the first bin X[0])
Returns
iterator where the first event matching it is.

Definition at line 1787 of file EventList.cpp.

References events.

Referenced by generateCountsHistogramPulseTime().

◆ findFirstTimeAtSampleEvent()

template<class T >
std::vector< T >::const_iterator Mantid::DataObjects::EventList::findFirstTimeAtSampleEvent ( const std::vector< T > &  events,
const double  seek_time,
const double &  tofFactor,
const double &  tofOffset 
) const
private

Utility function: Returns the iterator into events of the first TofEvent with time at sample > seek_time Will return events.end() if nothing is found!

Parameters
events:: event vector in which to look.
seek_time:: seek time to find (typically the first bin X[0]). Seek time in nanoseconds.
tofFactor:: Time of flight factor
tofOffset:: Time of flight offset
Returns
iterator where the first event matching it is.

Definition at line 1815 of file EventList.cpp.

References events.

Referenced by generateCountsHistogramTimeAtSample().

◆ frequencies()

HistogramData::Frequencies Mantid::DataObjects::EventList::frequencies ( ) const
overridevirtual

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1286 of file EventList.cpp.

References histogram().

◆ frequencyStandardDeviations()

HistogramData::FrequencyStandardDeviations Mantid::DataObjects::EventList::frequencyStandardDeviations ( ) const
overridevirtual

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1290 of file EventList.cpp.

References histogram().

◆ frequencyVariances()

HistogramData::FrequencyVariances Mantid::DataObjects::EventList::frequencyVariances ( ) const
overridevirtual

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1288 of file EventList.cpp.

References histogram().

◆ generateCountsHistogram()

void Mantid::DataObjects::EventList::generateCountsHistogram ( const MantidVec X,
MantidVec Y 
) const
private

Fill a histogram given specified histogram bounds.

Does not modify the eventlist (const method).

Parameters
X:: The x bins
Y:: The generated counts histogram

Definition at line 2213 of file EventList.cpp.

References events, Mantid::DataObjects::findFirstEvent(), sortTof(), Mantid::Geometry::X, Mantid::Geometry::x, and Mantid::Geometry::Y.

Referenced by generateHistogram().

◆ generateCountsHistogramPulseTime() [1/2]

void Mantid::DataObjects::EventList::generateCountsHistogramPulseTime ( const double &  xMin,
const double &  xMax,
MantidVec Y,
const double  TOF_min = std::numeric_limits<double>::lowest(),
const double  TOF_max = std::numeric_limits<double>::max() 
) const

With respect to PulseTime fill a histogram given equal histogram bins.

Number of bins is equal to number of elements in vector Y. Appends values to existing Y values.

Parameters
xMin:: Minimal Pulse time (in nanoseconds, i.e. DateTime->totalNanoseconds()) value to include in binning.
xMax:: Maximal Pulse time value to constrain binning by (include the times smaller than right boundary, excluding equal)
Y:: The generated counts histogram
TOF_min– min TOF to include in histogram.
TOF_max– max TOF to constrain values included in histogram.

Definition at line 2114 of file EventList.cpp.

References Mantid::Geometry::Y.

Referenced by Mantid::Algorithms::CalculateCountRate::calcRateLog(), and generateHistogramPulseTime().

◆ generateCountsHistogramPulseTime() [2/2]

void Mantid::DataObjects::EventList::generateCountsHistogramPulseTime ( const MantidVec X,
MantidVec Y 
) const
private

With respect to PulseTime Fill a histogram given specified histogram bounds.

Does not modify the eventlist (const method).

Parameters
X:: The x bins
Y:: The generated counts histogram

Definition at line 2040 of file EventList.cpp.

References events, findFirstPulseEvent(), sortPulseTime(), Mantid::Geometry::X, and Mantid::Geometry::Y.

◆ generateCountsHistogramTimeAtSample()

void Mantid::DataObjects::EventList::generateCountsHistogramTimeAtSample ( const MantidVec X,
MantidVec Y,
const double &  tofFactor,
const double &  tofOffset 
) const
private

With respect to Time at Sample, fill a histogram given specified histogram bounds.

Does not modify the eventlist (const method).

Parameters
X:: The x bins
Y:: The generated counts histogram
tofFactor:: time of flight factor
tofOffset:: time of flight offset

Definition at line 2148 of file EventList.cpp.

References events, findFirstTimeAtSampleEvent(), sortTimeAtSample(), Mantid::Geometry::X, and Mantid::Geometry::Y.

Referenced by generateHistogramTimeAtSample().

◆ generateErrorsHistogram()

void Mantid::DataObjects::EventList::generateErrorsHistogram ( const MantidVec Y,
MantidVec E 
) const
private

Generate the Error histogram for the provided counts histogram.

It simply returns the sqrt of the number of counts for each bin.

Parameters
Y:: The counts histogram
E:: The generated error histogram

Definition at line 2257 of file EventList.cpp.

References Mantid::Geometry::Y.

Referenced by generateHistogram(), generateHistogramPulseTime(), and generateHistogramTimeAtSample().

◆ generateHistogram()

void Mantid::DataObjects::EventList::generateHistogram ( const MantidVec X,
MantidVec Y,
MantidVec E,
bool  skipError = false 
) const
overridevirtual

Generates both the Y and E (error) histograms w.r.t TOF for an EventList with or without WeightedEvents.

Parameters
Xx-bins supplied
Ycounts returned
Eerrors returned
skipErrorskip calculating the error. This has no effect for weighted events; you can just ignore the returned E vector.

Implements Mantid::API::IEventList.

Definition at line 2010 of file EventList.cpp.

References eventType, generateCountsHistogram(), generateErrorsHistogram(), histogramForWeightsHelper(), sortTof(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, weightedEventsNoTime, and Mantid::Geometry::Y.

Referenced by Mantid::Algorithms::ResampleX::exec(), makeDataE(), makeDataY(), sharedE(), and sharedY().

◆ generateHistogramPulseTime()

void Mantid::DataObjects::EventList::generateHistogramPulseTime ( const MantidVec X,
MantidVec Y,
MantidVec E,
bool  skipError = false 
) const
overridevirtual

Generates both the Y and E (error) histograms w.r.t Pulse Time for an EventList with or without WeightedEvents.

Parameters
Xx-bins supplied
Ycounts returned
Eerrors returned
skipErrorskip calculating the error. This has no effect for weighted events; you can just ignore the returned E vector.

Implements Mantid::API::IEventList.

Definition at line 1946 of file EventList.cpp.

References eventType, generateCountsHistogramPulseTime(), generateErrorsHistogram(), sortPulseTime(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, and Mantid::Geometry::Y.

◆ generateHistogramTimeAtSample()

void Mantid::DataObjects::EventList::generateHistogramTimeAtSample ( const MantidVec X,
MantidVec Y,
MantidVec E,
const double &  tofFactor,
const double &  tofOffset,
bool  skipError = false 
) const
overridevirtual

Generates both the Y and E (error) histograms w.r.t Time at sample position.

Parameters
XX - axis supplied as reference
Ycounts to fill
Eerrors to fill
tofFactor: Time of flight factor. Usually L1/(L1 + L2)
tofOffset: Time of flight offset.
skipError: skip calculating the error. This has no effect for weighted events; you can just ignore the returned E vector.

Implements Mantid::API::IEventList.

Definition at line 1978 of file EventList.cpp.

References eventType, generateCountsHistogramTimeAtSample(), generateErrorsHistogram(), sortTimeAtSample(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, and Mantid::Geometry::Y.

◆ getEvent()

WeightedEvent Mantid::DataObjects::EventList::getEvent ( size_t  event_number)

Return the given event in the list.

Handles the different types of events by converting to WeightedEvent (the most general type).

Parameters
event_number:: the index of the event to retrieve
Returns
a WeightedEvent

Definition at line 740 of file EventList.cpp.

References events, eventType, Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

◆ getEvents() [1/2]

std::vector< TofEvent > & Mantid::DataObjects::EventList::getEvents ( )

Return the list of TofEvents contained.

NOTE! This should be used for testing purposes only, as much as possible. The EventList may contain weighted events, requiring use of getWeightedEvents() instead.

Returns
a reference to the list of non-weighted events

Definition at line 780 of file EventList.cpp.

References events, eventType, and Mantid::API::TOF.

Referenced by Mantid::MDAlgorithms::SaveIsawQvector::exec(), Mantid::DataHandling::FilterEventsByLogValuePreNexus::filterEvents(), Mantid::DataObjects::getEventsFrom(), Mantid::Algorithms::CalculateCountRate::histogramEvents(), Mantid::DataHandling::FilterEventsByLogValuePreNexus::procEvents(), Mantid::DataHandling::LoadEventPreNexus2::procEvents(), and Mantid::NeXus::NexusFileIO::writeEventList().

◆ getEvents() [2/2]

const std::vector< TofEvent > & Mantid::DataObjects::EventList::getEvents ( ) const

Return the const list of TofEvents contained.

NOTE! This should be used for testing purposes only, as much as possible. The EventList may contain weighted events, requiring use of getWeightedEvents() instead.

Returns
a const reference to the list of non-weighted events

Definition at line 765 of file EventList.cpp.

References events, eventType, and Mantid::API::TOF.

◆ getEventType()

EventType Mantid::DataObjects::EventList::getEventType ( ) const
overridevirtual

◆ getMemorySize()

size_t Mantid::DataObjects::EventList::getMemorySize ( ) const
overridevirtual

Memory used by this event list.

Note: It reports the CAPACITY of the vectors, rather than their size, since that is a more accurate representation of the size used.

Returns
:: the memory used by the EventList, in bytes.

Implements Mantid::API::IEventList.

Definition at line 1177 of file EventList.cpp.

References eventType, Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

◆ getNumberEvents()

size_t Mantid::DataObjects::EventList::getNumberEvents ( ) const
overridevirtual

Return the number of events in the list.

NOTE: If the events have weights, this returns the NUMBER of WeightedEvent's in the list, and NOT the sum of their weights (which may be two different numbers).

Returns
the number of events in the list.

Implements Mantid::API::IEventList.

Definition at line 1143 of file EventList.cpp.

References eventType, Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

Referenced by addPulsetime(), addPulsetimes(), Mantid::Algorithms::CompareWorkspaces::compareEventsListInDetails(), Mantid::Algorithms::CompareWorkspaces::compareEventWorkspaces(), Mantid::MDAlgorithms::ConvertToDiffractionMDWorkspace::convertEventList(), Mantid::MDAlgorithms::ConvToMDEventsWS::convertEventList(), Mantid::MDAlgorithms::ConvertToDetectorFaceMD::convertEventList(), Mantid::MDAlgorithms::ConvToMDEventsWSIndexing::convertEvents(), convertTof(), equals(), Mantid::Algorithms::FilterEvents::examineAndSortEventWS(), Mantid::Algorithms::EQSANSCorrectFrame::exec(), Mantid::Algorithms::ModeratorTzero::execEvent(), Mantid::Algorithms::GenerateEventsFilter::findRunEnd(), Mantid::MDAlgorithms::IntegrateFlux::getMaxNumberOfPoints(), getPulseTimeMax(), getPulseTimeMin(), getPulseTimeMinMax(), getPulseTimes(), getTimeAtSampleMax(), getTimeAtSampleMin(), getTofMax(), getTofMin(), getTofs(), getWeightErrors(), getWeights(), maskCondition(), maskTof(), operator==(), splitByFullTimeMatrixSplitter(), and Mantid::NeXus::NexusFileIO::writeEventList().

◆ getPulseTimeMax()

DateAndTime Mantid::DataObjects::EventList::getPulseTimeMax ( ) const
overridevirtual

◆ getPulseTimeMin()

DateAndTime Mantid::DataObjects::EventList::getPulseTimeMin ( ) const
overridevirtual

◆ getPulseTimeMinMax()

void Mantid::DataObjects::EventList::getPulseTimeMinMax ( Mantid::Types::Core::DateAndTime &  tMin,
Mantid::Types::Core::DateAndTime &  tM 
) const

◆ getPulseTimes()

std::vector< Mantid::Types::Core::DateAndTime > Mantid::DataObjects::EventList::getPulseTimes ( ) const
overridevirtual

Get the pulse times of each event in this EventList.

Returns
by copy a vector of DateAndTime times

Implements Mantid::API::IEventList.

Definition at line 2872 of file EventList.cpp.

References eventType, getNumberEvents(), getPulseTimesHelper(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

◆ getPulseTimesHelper()

template<class T >
void Mantid::DataObjects::EventList::getPulseTimesHelper ( const std::vector< T > &  events,
std::vector< Mantid::Types::Core::DateAndTime > &  times 
)
staticprivate

Get the pulsetimes of all events in a list.

Parameters
events:: source vector of events
times:: vector to fill

Definition at line 2860 of file EventList.cpp.

References events.

Referenced by getPulseTimes().

◆ getSortType()

EventSortType Mantid::DataObjects::EventList::getSortType ( ) const

Return the type of sorting used in this event list.

Definition at line 1104 of file EventList.cpp.

References order.

Referenced by convertTof(), and Mantid::NeXus::NexusFileIO::writeEventList().

◆ getTimeAtSampleMax()

DateAndTime Mantid::DataObjects::EventList::getTimeAtSampleMax ( const double &  tofFactor,
const double &  tofOffset 
) const
overridevirtual

◆ getTimeAtSampleMin()

DateAndTime Mantid::DataObjects::EventList::getTimeAtSampleMin ( const double &  tofFactor,
const double &  tofOffset 
) const
overridevirtual

◆ getTofMax()

double Mantid::DataObjects::EventList::getTofMax ( ) const
overridevirtual

◆ getTofMin()

double Mantid::DataObjects::EventList::getTofMin ( ) const
overridevirtual

◆ getTofs() [1/2]

std::vector< double > Mantid::DataObjects::EventList::getTofs ( ) const
overridevirtual

Get the times-of-flight of each event in this EventList.

Returns
by copy a vector of doubles of the tof() value

Implements Mantid::API::IEventList.

Definition at line 2756 of file EventList.cpp.

References getTofs().

Referenced by getTofs().

◆ getTofs() [2/2]

void Mantid::DataObjects::EventList::getTofs ( std::vector< double > &  tofs) const
overridevirtual

Fill a vector with the list of TOFs.

Parameters
tofs:: A reference to the vector to be filled

Implements Mantid::API::IEventList.

Definition at line 2734 of file EventList.cpp.

References eventType, getNumberEvents(), getTofsHelper(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

Referenced by Mantid::Algorithms::ModeratorTzero::execEvent(), and Mantid::DataHandling::makeTimeOfFlightDataFuzzy().

◆ getTofsHelper()

template<class T >
void Mantid::DataObjects::EventList::getTofsHelper ( const std::vector< T > &  events,
std::vector< double > &  tofs 
)
staticprivate

Get the m_tof member of all events in a list.

Parameters
events:: source vector of events
tofs:: vector to fill

Definition at line 2725 of file EventList.cpp.

References events.

Referenced by getTofs().

◆ getWeightedEvents() [1/2]

std::vector< WeightedEvent > & Mantid::DataObjects::EventList::getWeightedEvents ( )

Return the list of WeightedEvent contained.

NOTE! This should be used for testing purposes only, as much as possible. The EventList may contain un-weighted events, requiring use of getEvents() instead.

Returns
a reference to the list of weighted events

Definition at line 795 of file EventList.cpp.

References eventType, Mantid::API::WEIGHTED, and weightedEvents.

Referenced by Mantid::Algorithms::Bin2DPowderDiffraction::createOutputWorkspace(), Mantid::DataObjects::getEventsFrom(), and Mantid::NeXus::NexusFileIO::writeEventList().

◆ getWeightedEvents() [2/2]

const std::vector< WeightedEvent > & Mantid::DataObjects::EventList::getWeightedEvents ( ) const

Return the list of WeightedEvent contained.

NOTE! This should be used for testing purposes only, as much as possible. The EventList may contain un-weighted events, requiring use of getEvents() instead.

Returns
a const reference to the list of weighted events

Definition at line 810 of file EventList.cpp.

References eventType, Mantid::API::WEIGHTED, and weightedEvents.

◆ getWeightedEventsNoTime() [1/2]

std::vector< WeightedEventNoTime > & Mantid::DataObjects::EventList::getWeightedEventsNoTime ( )

◆ getWeightedEventsNoTime() [2/2]

const std::vector< WeightedEventNoTime > & Mantid::DataObjects::EventList::getWeightedEventsNoTime ( ) const

Return the list of WeightedEventNoTime contained.

NOTE! This should be used for testing purposes only, as much as possible.

Returns
a const reference to the list of weighted events

Definition at line 836 of file EventList.cpp.

References eventType, Mantid::API::WEIGHTED_NOTIME, and weightedEventsNoTime.

◆ getWeightErrors() [1/2]

std::vector< double > Mantid::DataObjects::EventList::getWeightErrors ( ) const
overridevirtual

Return the list of event weight error values.

Get the weight error of each event in this EventList.

Returns
by copy a vector of doubles of the weight() value

Implements Mantid::API::IEventList.

Definition at line 2847 of file EventList.cpp.

References getWeightErrors().

Referenced by getWeightErrors().

◆ getWeightErrors() [2/2]

void Mantid::DataObjects::EventList::getWeightErrors ( std::vector< double > &  weightErrors) const
overridevirtual

Return the list of event weight error values.

Fill a vector with the list of Weight Errors.

Parameters
weightErrors:: A reference to the vector to be filled

Implements Mantid::API::IEventList.

Definition at line 2824 of file EventList.cpp.

References eventType, getNumberEvents(), getWeightErrorsHelper(), Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

◆ getWeightErrorsHelper()

template<class T >
void Mantid::DataObjects::EventList::getWeightErrorsHelper ( const std::vector< T > &  events,
std::vector< double > &  weightErrors 
)
staticprivate

Get the weight error member of all events in a list.

Parameters
events:: source vector of events
weightErrors:: vector to fill

Definition at line 2814 of file EventList.cpp.

References events.

Referenced by getWeightErrors().

◆ getWeights() [1/2]

std::vector< double > Mantid::DataObjects::EventList::getWeights ( ) const
overridevirtual

Return the list of event weight values.

Get the weight of each event in this EventList.

Returns
by copy a vector of doubles of the weight() value

Implements Mantid::API::IEventList.

Definition at line 2801 of file EventList.cpp.

References getWeights().

Referenced by getWeights().

◆ getWeights() [2/2]

void Mantid::DataObjects::EventList::getWeights ( std::vector< double > &  weights) const
overridevirtual

Return the list of event weight values.

Fill a vector with the list of Weights.

Parameters
weights:: A reference to the vector to be filled

Implements Mantid::API::IEventList.

Definition at line 2778 of file EventList.cpp.

References eventType, getNumberEvents(), getWeightsHelper(), Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

◆ getWeightsHelper()

template<class T >
void Mantid::DataObjects::EventList::getWeightsHelper ( const std::vector< T > &  events,
std::vector< double > &  weights 
)
staticprivate

Get the weight member of all events in a list.

Parameters
events:: source vector of events
weights:: vector to fill

Definition at line 2768 of file EventList.cpp.

References events.

Referenced by getWeights().

◆ histogram()

HistogramData::Histogram Mantid::DataObjects::EventList::histogram ( ) const
overridevirtual

Returns the Histogram associated with this spectrum.

Y and E data is computed from the event list.

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1271 of file EventList.cpp.

References m_histogram, sharedE(), and sharedY().

Referenced by checkAndSanitizeHistogram(), copyDataInto(), counts(), countStandardDeviations(), countVariances(), frequencies(), frequencyStandardDeviations(), and frequencyVariances().

◆ histogram_size()

size_t Mantid::DataObjects::EventList::histogram_size ( ) const
virtual

Return the size of the histogram data.

Returns
the size of the histogram representation of the data (size of Y)

Definition at line 1192 of file EventList.cpp.

References readX().

◆ histogramForWeightsHelper()

template<class T >
void Mantid::DataObjects::EventList::histogramForWeightsHelper ( const std::vector< T > &  events,
const MantidVec X,
MantidVec Y,
MantidVec E 
)
staticprivate

Generates both the Y and E (error) histograms for an EventList with WeightedEvents.

Parameters
eventsvector of events (with weights)
XX-bins supplied
Ycounts returned
Eerrors returned
Exceptions
runtime_errorif the EventList does not have weighted events

Definition at line 1854 of file EventList.cpp.

References events, Mantid::DataObjects::findFirstEvent(), Mantid::Geometry::X, and Mantid::Geometry::Y.

Referenced by generateHistogram().

◆ histogramRef()

const HistogramData::Histogram & Mantid::DataObjects::EventList::histogramRef ( ) const
inlineoverrideprivatevirtual

Implements Mantid::API::ISpectrum.

Definition at line 326 of file EventList.h.

◆ integrate() [1/2]

double Mantid::DataObjects::EventList::integrate ( const double  minX,
const double  maxX,
const bool  entireRange 
) const
overridevirtual

Integrate the events between a range of X values, or all events.

Parameters
minX:: minimum X bin to use in integrating.
maxX:: maximum X bin to use in integrating.
entireRange:: set to true to use the entire range. minX and maxX are then ignored!
Returns
the integrated number of events.

Implements Mantid::API::IEventList.

Definition at line 2338 of file EventList.cpp.

References error, and integrate().

◆ integrate() [2/2]

void Mantid::DataObjects::EventList::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.

Parameters
minX:: minimum X bin to use in integrating.
maxX:: maximum X bin to use in integrating.
entireRange:: set to true to use the entire range. minX and maxX are then ignored!
sum:: place holder for the resulting sum
error:: place holder for the resulting sum of errors
Returns
the integrated number of events.

Definition at line 2354 of file EventList.cpp.

References error, eventType, integrateHelper(), sortTof(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

Referenced by Mantid::DataObjects::EventWorkspace::getIntegratedSpectra(), and integrate().

◆ integrateHelper() [1/2]

template<class T >
double Mantid::DataObjects::EventList::integrateHelper ( std::vector< T > &  events,
const double  minX,
const double  maxX,
const bool  entireRange 
)
staticprivate

Integrate the events between a range of X values, or all events.

Parameters
events:: reference to a vector of events to change.
minX:: minimum X bin to use in integrating.
maxX:: maximum X bin to use in integrating.
entireRange:: set to true to use the entire range. minX and maxX are then ignored!
Returns
the integrated number of events.

Definition at line 2275 of file EventList.cpp.

References error, events, and integrateHelper().

◆ integrateHelper() [2/2]

template<class T >
void Mantid::DataObjects::EventList::integrateHelper ( std::vector< T > &  events,
const double  minX,
const double  maxX,
const bool  entireRange,
double &  sum,
double &  error 
)
staticprivate

Integrate the events between a range of X values, or all events.

Parameters
events:: reference to a vector of events to change.
minX:: minimum X bin to use in integrating.
maxX:: maximum X bin to use in integrating.
entireRange:: set to true to use the entire range. minX and maxX are then ignored!
sum:: reference to a double to put the sum in.
error:: reference to a double to put the error in.

Definition at line 2293 of file EventList.cpp.

References error, and events.

Referenced by integrate(), and integrateHelper().

◆ isSortedByTof()

bool Mantid::DataObjects::EventList::isSortedByTof ( ) const
overridevirtual

Return true if the event list is sorted by TOF.

Implements Mantid::API::IEventList.

Definition at line 1100 of file EventList.cpp.

References order, and Mantid::DataObjects::TOF_SORT.

Referenced by reverse().

◆ makeDataE()

MantidVec * Mantid::DataObjects::EventList::makeDataE ( ) const

Calculates and returns a pointer to the E histogrammed data.

Remember to delete your pointer after use!

Returns
a pointer to a MantidVec

Definition at line 1263 of file EventList.cpp.

References generateHistogram(), readX(), and Mantid::Geometry::Y.

◆ makeDataY()

MantidVec * Mantid::DataObjects::EventList::makeDataY ( ) const

Calculates and returns a pointer to the Y histogrammed data.

Remember to delete your pointer after use!

Returns
a pointer to a MantidVec

Definition at line 1250 of file EventList.cpp.

References generateHistogram(), readX(), and Mantid::Geometry::Y.

◆ maskCondition()

void Mantid::DataObjects::EventList::maskCondition ( const std::vector< bool > &  mask)
overridevirtual

Mask out events by the condition vector.

Events are removed from the list.

Parameters
mask:: condition vector

Implements Mantid::API::IEventList.

Definition at line 2687 of file EventList.cpp.

References clear(), eventType, getNumberEvents(), maskConditionHelper(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

◆ maskConditionHelper()

template<class T >
std::size_t Mantid::DataObjects::EventList::maskConditionHelper ( std::vector< T > &  events,
const std::vector< bool > &  mask 
)
staticprivate

Mask out events by the condition vector.

Events are removed from the list.

Parameters
events:: reference to a vector of events to change.
mask:: condition vector
Returns
The number of events deleted.

Definition at line 2659 of file EventList.cpp.

References events, and n.

Referenced by maskCondition().

◆ maskTof()

void Mantid::DataObjects::EventList::maskTof ( const double  tofMin,
const double  tofMax 
)
overridevirtual

Mask out events that have a tof between tofMin and tofMax (inclusively).

Events are removed from the list.

Parameters
tofMin:: lower bound of TOF to filter out
tofMax:: upper bound of TOF to filter out

Implements Mantid::API::IEventList.

Definition at line 2619 of file EventList.cpp.

References clear(), eventType, getNumberEvents(), maskTofHelper(), sortTof(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

◆ maskTofHelper()

template<class T >
std::size_t Mantid::DataObjects::EventList::maskTofHelper ( std::vector< T > &  events,
const double  tofMin,
const double  tofMax 
)
staticprivate

Mask out events that have a tof between tofMin and tofMax (inclusively).

Events are removed from the list.

Parameters
events:: reference to a vector of events to change.
tofMin:: lower bound of TOF to filter out
tofMax:: upper bound of TOF to filter out
Returns
The number of events deleted.

Definition at line 2582 of file EventList.cpp.

References events, and tmp.

Referenced by maskTof().

◆ minusHelper()

template<class T1 , class T2 >
void Mantid::DataObjects::EventList::minusHelper ( std::vector< T1 > &  events,
const std::vector< T2 > &  more_events 
)
staticprivate

SUBTRACT another EventList from this event list.

The event lists are concatenated, but the weights of the incoming list are multiplied by -1.0.

Template Parameters
T1,T2:: TofEvent, WeightedEvent or WeightedEventNoTime
Parameters
events:: The event vector being changed.
more_events:: Another event vector being subtracted from this.
Returns
reference to this

Definition at line 502 of file EventList.cpp.

References events.

Referenced by operator-=().

◆ multiply() [1/2]

void Mantid::DataObjects::EventList::multiply ( const double  value,
const double  error = 0.0 
)
overridevirtual

Multiply the weights in this event list by a scalar variable with an error; though the error can be 0.0.

The event list switches to WeightedEvent's if needed. Note that if the multiplier is exactly 1.0 and the error is exactly 0.0, the list is NOT switched to WeightedEvents - nothing happens.

Given:

  • A is the weight, variance \(\sigma_A \)
  • B is the scalar multiplier, variance \(\sigma_B \)

The error propagation formula used is:

\[ \left(\frac{\sigma_f}{f}\right)^2 = \left(\frac{\sigma_A}{A}\right)^2 + *\left(\frac{\sigma_B}{B}\right)^2 + 2\frac{\sigma_A\sigma_B}{AB}\rho_{AB} \]

\( \rho_{AB} \) is the covariance between A and B, which we take to be 0 (uncorrelated variables). Therefore, this reduces to:

\[ \sigma_{AB}^2 = B^2 \sigma_A^2 + A^2 \sigma_B ^ 2 \]

In the case of no error:

  • The weight is simply \( aA \)
  • The error \( \sigma_A \) becomes \( \sigma_{aA} = a \sigma_{A} \)
Parameters
valuemultiply all weights by this amount.
errorerror on 'value'. Can be 0.

Implements Mantid::API::IEventList.

Definition at line 3324 of file EventList.cpp.

References error, eventType, multiplyHelper(), switchTo(), Mantid::API::TOF, value, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

Referenced by divide(), operator*=(), operator/=(), and Mantid::Algorithms::Multiply::performEventBinaryOperation().

◆ multiply() [2/2]

void Mantid::DataObjects::EventList::multiply ( const MantidVec X,
const MantidVec Y,
const MantidVec E 
)
overridevirtual

Multiply the weights in this event list by a histogram.

The event list switches to WeightedEvent's if needed. NOTE: no unit checks are made (or possible to make) to compare the units of X and tof() in the EventList.

The formula used for calculating the error on the neutron weight is:

\[ \sigma_{f}^2 = B^2 \sigma_A^2 + A^2 \sigma_B ^ 2 \]

where:

  • A is the weight of the event
  • B is the weight of the BIN that the event falls in
  • \(\sigma_A\) is the error (not squared) of the weight of the event
  • \(\sigma_B\) is the error (not squared) of the bin B
  • f is the resulting weight of the multiplied event
Parameters
Xbins of the multiplying histogram.
Yvalue to multiply the weights.
Eerror on the value to multiply.
Exceptions
invalid_argumentif the sizes of X, Y, E are not consistent.

Implements Mantid::API::IEventList.

Definition at line 3449 of file EventList.cpp.

References eventType, multiplyHistogramHelper(), sortTof(), switchTo(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, weightedEventsNoTime, and Mantid::Geometry::Y.

◆ multiplyHelper()

template<class T >
void Mantid::DataObjects::EventList::multiplyHelper ( std::vector< T > &  events,
const double  value,
const double  error = 0.0 
)
staticprivate

Helper method for multiplying an event list by a scalar value with/without error.

Parameters
eventsvector of events (with weights)
valuemultiply all weights by this amount.
errorerror on 'value'. Can be 0.

Definition at line 3255 of file EventList.cpp.

References error, events, and value.

Referenced by multiply().

◆ multiplyHistogramHelper()

template<class T >
void Mantid::DataObjects::EventList::multiplyHistogramHelper ( std::vector< T > &  events,
const MantidVec X,
const MantidVec Y,
const MantidVec E 
)
staticprivate

Helper method for multiplying an event list by a histogram with error.

Parameters
eventsvector of events (with weights)
Xbins of the multiplying histogram.
Yvalue to multiply the weights.
Eerror on the value to multiply.
Exceptions
invalid_argumentif the sizes of X, Y, E are not consistent.

Definition at line 3355 of file EventList.cpp.

References error, events, Mantid::DataObjects::findFirstEvent(), value, Mantid::Geometry::X, and Mantid::Geometry::Y.

Referenced by multiply().

◆ mutableHistogramRef()

HistogramData::Histogram & Mantid::DataObjects::EventList::mutableHistogramRef ( )
overrideprivatevirtual

◆ operator!=()

bool Mantid::DataObjects::EventList::operator!= ( const EventList rhs) const

Inequality comparator.

Parameters
rhs:: other EventList to compare
Returns
:: true if not equal.

Definition at line 600 of file EventList.cpp.

◆ operator*=()

EventList & Mantid::DataObjects::EventList::operator*= ( const double  value)

Operator to multiply the weights in this EventList by an error-less scalar.

Use multiply(value,error) if you wish to multiply by a real variable with an error!

The event list switches to WeightedEvent's if needed. Note that if the multiplier is exactly 1.0, the list is NOT switched to WeightedEvents - nothing happens.

Parameters
value:: multiply by this
Returns
reference to this

Definition at line 3290 of file EventList.cpp.

References multiply().

◆ operator+=() [1/6]

EventList & Mantid::DataObjects::EventList::operator+= ( const EventList more_events)

Append another EventList to this event list.

The event lists are concatenated, and a union of the sets of detector ID's is done. Switching of event types may occur if the two are different.

Parameters
more_events:: Another EventList.
Returns
reference to this

Definition at line 468 of file EventList.cpp.

References Mantid::API::ISpectrum::addDetectorIDs(), events, Mantid::API::ISpectrum::getDetectorIDs(), getEventType(), operator+=(), order, Mantid::API::TOF, Mantid::DataObjects::UNSORTED, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

◆ operator+=() [2/6]

EventList & Mantid::DataObjects::EventList::operator+= ( const std::vector< Types::Event::TofEvent > &  more_events)

◆ operator+=() [3/6]

EventList & Mantid::DataObjects::EventList::operator+= ( const std::vector< WeightedEvent > &  more_events)

Append a list of events to the histogram.

Note: The whole list will switch to weights (a possibly lengthy operation) if it did not have weights before.

Parameters
more_events:: A vector of events to append.
Returns
reference to this

Definition at line 407 of file EventList.cpp.

References eventType, order, switchTo(), Mantid::API::TOF, Mantid::DataObjects::UNSORTED, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

◆ operator+=() [4/6]

EventList & Mantid::DataObjects::EventList::operator+= ( const std::vector< WeightedEventNoTime > &  more_events)

Append a list of events to the histogram.

Note: The whole list will switch to weights (a possibly lengthy operation) if it did not have weights before.

Parameters
more_events:: A vector of events to append.
Returns
reference to this

Definition at line 441 of file EventList.cpp.

References eventType, order, switchTo(), Mantid::API::TOF, Mantid::DataObjects::UNSORTED, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, and weightedEventsNoTime.

◆ operator+=() [5/6]

EventList & Mantid::DataObjects::EventList::operator+= ( const Types::Event::TofEvent &  event)

Referenced by operator+=().

◆ operator+=() [6/6]

EventList & Mantid::DataObjects::EventList::operator+= ( const WeightedEvent event)

Append a WeightedEvent to the histogram.

Note: The whole list will switch to weights (a possibly lengthy operation) if it did not have weights before.

Parameters
event:: WeightedEvent to add at the end of the list.
Returns
reference to this

Definition at line 392 of file EventList.cpp.

References order, switchTo(), Mantid::DataObjects::UNSORTED, Mantid::API::WEIGHTED, and weightedEvents.

◆ operator-=()

EventList & Mantid::DataObjects::EventList::operator-= ( const EventList more_events)

SUBTRACT another EventList from this event list.

The event lists are concatenated, but the weights of the incoming list are multiplied by -1.0.

Parameters
more_events:: Another EventList.
Returns
reference to this

Definition at line 524 of file EventList.cpp.

References clearData(), events, getEventType(), minusHelper(), order, switchTo(), Mantid::API::TOF, Mantid::DataObjects::UNSORTED, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

◆ operator/=()

EventList & Mantid::DataObjects::EventList::operator/= ( const double  value)

Operator to divide the weights in this EventList by an error-less scalar.

Use divide(value,error) if your scalar has an error! This simply calls the equivalent function: multiply(1.0/value).

Parameters
value:: divide by this
Returns
reference to this
Exceptions
std::invalid_argumentif value == 0; cannot divide by zero.

Definition at line 3616 of file EventList.cpp.

References multiply(), and value.

◆ operator=()

EventList & Mantid::DataObjects::EventList::operator= ( const EventList rhs)

Copy into this event list from another.

Parameters
rhs:: We will copy all the events from that into this object.
Returns
reference to this

Definition at line 309 of file EventList.cpp.

References events, eventType, m_histogram, order, rhs, weightedEvents, and weightedEventsNoTime.

Referenced by EventList().

◆ operator==()

bool Mantid::DataObjects::EventList::operator== ( const EventList rhs) const

Equality operator between EventList's.

Parameters
rhs:: other EventList to compare
Returns
:: true if equal.

Definition at line 581 of file EventList.cpp.

References events, eventType, getNumberEvents(), rhs, weightedEvents, and weightedEventsNoTime.

◆ ptrX()

Kernel::cow_ptr< HistogramData::HistogramX > Mantid::DataObjects::EventList::ptrX ( ) const
overridevirtual

Deprecated, use sharedX() instead. Returns a pointer to the x data.

Implements Mantid::API::ISpectrum.

Definition at line 1232 of file EventList.cpp.

References m_histogram.

Referenced by Mantid::DataObjects::EventWorkspace::refX().

◆ readDx()

const MantidVec & Mantid::DataObjects::EventList::readDx ( ) const
overridevirtual

Deprecated, use dx() instead.

Implements Mantid::API::ISpectrum.

Definition at line 1239 of file EventList.cpp.

References m_histogram.

Referenced by Mantid::DataObjects::EventWorkspace::dataDx().

◆ readX()

const MantidVec & Mantid::DataObjects::EventList::readX ( ) const
overridevirtual

Deprecated, use x() instead. Returns the x data const.

Implements Mantid::API::ISpectrum.

Definition at line 1229 of file EventList.cpp.

References m_histogram.

Referenced by Mantid::DataObjects::EventWorkspace::dataX(), histogram_size(), makeDataE(), makeDataY(), sharedE(), and sharedY().

◆ reserve()

void Mantid::DataObjects::EventList::reserve ( size_t  num)
overridevirtual

◆ reverse()

void Mantid::DataObjects::EventList::reverse ( )

Reverse the histogram boundaries and the associated events if they are sorted by time-of-flight.

Does nothing if sorted otherwise or unsorted.

Definition at line 1112 of file EventList.cpp.

References dataX(), eventType, isSortedByTof(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, weightedEventsNoTime, and Mantid::Geometry::x.

Referenced by convertTof().

◆ scaleTof()

void Mantid::DataObjects::EventList::scaleTof ( const double  factor)
overridevirtual

Convert the units in the TofEvent's m_tof field to some other value, by scaling by a multiplier.

Parameters
factor:: conversion factor (e.g. multiply TOF by this to get d-spacing)

Implements Mantid::API::IEventList.

Definition at line 2484 of file EventList.cpp.

References convertTof().

◆ setMRU()

void Mantid::DataObjects::EventList::setMRU ( EventWorkspaceMRU newMRU)

Sets the MRU list for this event list.

Parameters
newMRU:: new MRU for the workspace containing this EventList

Definition at line 886 of file EventList.cpp.

References mru.

◆ setSortOrder()

void Mantid::DataObjects::EventList::setSortOrder ( const EventSortType  order) const

Manually set the event list sort order value.

No actual sorting takes place. SHOULD ONLY BE USED IN TESTS or if you know what you are doing.

Parameters
order:: sort order to set.

Definition at line 943 of file EventList.cpp.

References order.

Referenced by convertTof(), createFromHistogram(), Mantid::DataHandling::LoadBBY::exec(), Mantid::Algorithms::ModeratorTzero::execEvent(), filterByPulseTime(), filterByTimeAtSample(), Mantid::DataHandling::LoadEMU< FD >::prepareEventStorage(), Mantid::DataHandling::LoadPLN::prepareEventStorage(), and Mantid::DataHandling::LoadNexusMonitors2::readEventMonitorEntry().

◆ setTofs()

void Mantid::DataObjects::EventList::setTofs ( const MantidVec tofs)
overridevirtual

Set a list of TOFs to the current event list.

Modify the units if necessary.

Parameters
tofs:: The vector of doubles to set the tofs to.

Implements Mantid::API::IEventList.

Definition at line 3226 of file EventList.cpp.

References eventType, order, setTofsHelper(), Mantid::API::TOF, Mantid::DataObjects::UNSORTED, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

Referenced by Mantid::Algorithms::ModeratorTzero::execEvent(), and Mantid::DataHandling::makeTimeOfFlightDataFuzzy().

◆ setTofsHelper()

template<class T >
void Mantid::DataObjects::EventList::setTofsHelper ( std::vector< T > &  events,
const std::vector< double > &  tofs 
)
staticprivate

Set a list of TOFs to the current event list.

Parameters
events:: source vector of events
tofs:: The vector of doubles to set the tofs to.

Definition at line 3208 of file EventList.cpp.

References events.

Referenced by setTofs().

◆ setX()

void Mantid::DataObjects::EventList::setX ( const Kernel::cow_ptr< HistogramData::HistogramX > &  X)
overridevirtual

Deprecated, use setSharedX() instead.

Set the x-component for the histogram view. This will NOT cause the histogram to be calculated.

Parameters
X:: The vector of doubles to set as the histogram limits.

Implements Mantid::API::ISpectrum.

Definition at line 1209 of file EventList.cpp.

References Mantid::DataObjects::EventWorkspaceMRU::deleteIndex(), m_histogram, mru, and Mantid::Geometry::X.

Referenced by createFromHistogram().

◆ sharedE()

Kernel::cow_ptr< HistogramData::HistogramE > Mantid::DataObjects::EventList::sharedE ( ) const
overridevirtual

◆ sharedY()

Kernel::cow_ptr< HistogramData::HistogramY > Mantid::DataObjects::EventList::sharedY ( ) const
overridevirtual

◆ sort()

void Mantid::DataObjects::EventList::sort ( const EventSortType  order) const

◆ sortPulseTime()

void Mantid::DataObjects::EventList::sortPulseTime ( ) const

◆ sortPulseTimeTOF()

void Mantid::DataObjects::EventList::sortPulseTimeTOF ( ) const

◆ sortPulseTimeTOFDelta()

void Mantid::DataObjects::EventList::sortPulseTimeTOFDelta ( const Types::Core::DateAndTime &  start,
const double  seconds 
) const
private

Sort by the pulse time with a tolerance.

The pulsetime to compare is a constant binning of seconds from start. This will set the sort order to UNSORTED upon completion rather than storing the call parameters.

Parameters
startThe absolute start time
secondsThe tolerance of pulse time in seconds.

Definition at line 1077 of file EventList.cpp.

References events, eventType, m_sortMutex, order, Mantid::API::TOF, Mantid::DataObjects::UNSORTED, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, and weightedEvents.

Referenced by compressFatEvents().

◆ sortTimeAtSample()

void Mantid::DataObjects::EventList::sortTimeAtSample ( const double &  tofFactor,
const double &  tofShift,
bool  forceResort = false 
) const

Sort events by time at sample.

Parameters
tofFactor: For the elastic case, L1 / (L1 + L2)
tofShift: Tof offset in Seconds
forceResort: If the tofFactor, or tofShift are different from a previous run of the same sort type, you need to trigger a full resort using forceResort = true. False by default.

Definition at line 982 of file EventList.cpp.

References events, eventType, m_sortMutex, order, Mantid::DataObjects::TIMEATSAMPLE_SORT, Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

Referenced by filterByTimeAtSample(), generateCountsHistogramTimeAtSample(), and generateHistogramTimeAtSample().

◆ sortTof()

void Mantid::DataObjects::EventList::sortTof ( ) const

◆ splitByFullTime()

void Mantid::DataObjects::EventList::splitByFullTime ( Kernel::TimeSplitterType splitter,
std::map< int, EventList * >  outputs,
bool  docorrection,
double  toffactor,
double  tofshift 
) const

Split the event list into n outputs by event's full time (tof + pulse time)

Parameters
splitter:: a TimeSplitterType giving where to split
outputs:: a map of where the split events will end up. The # of entries in there should be big enough to accommodate the indices.
docorrection:: a boolean to indiciate whether it is need to do correction
toffactora correction factor for each TOF to multiply with
tofshifta correction shift for each TOF to add with

Definition at line 4070 of file EventList.cpp.

References clear(), eventType, Mantid::API::ISpectrum::getDetectorIDs(), m_histogram, Mantid::API::ISpectrum::setDetectorIDs(), Mantid::API::ISpectrum::setHistogram(), sortPulseTimeTOF(), splitByFullTimeHelper(), switchTo(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, and weightedEvents.

Referenced by Mantid::Algorithms::FilterEvents::filterEventsBySplitters().

◆ splitByFullTimeHelper()

template<class T >
void Mantid::DataObjects::EventList::splitByFullTimeHelper ( Kernel::TimeSplitterType splitter,
std::map< int, EventList * >  outputs,
typename std::vector< T > &  events,
bool  docorrection,
double  toffactor,
double  tofshift 
) const
private

Split the event list into n outputs, operating on a vector of either TofEvent's or WeightedEvent's The comparison between neutron event and splitter is based on neutron event's pulse time plus.

Parameters
splitter:: a TimeSplitterType giving where to split
outputs:: a vector of where the split events will end up. The # of entries in there should be big enough to accommodate the indices.
events:: either this->events or this->weightedEvents.
docorrection:: flag to determine whether or not to apply correction
toffactor:: factor to correct TOF in formula toffactor*tof+tofshift
tofshift:: amount to shift (in SECOND) to correct TOF in formula: toffactor*tof+tofshift

Definition at line 3992 of file EventList.cpp.

References addEventQuickly(), events, and index.

Referenced by splitByFullTime().

◆ splitByFullTimeMatrixSplitter()

std::string Mantid::DataObjects::EventList::splitByFullTimeMatrixSplitter ( const std::vector< int64_t > &  vec_splitters_time,
const std::vector< int > &  vecgroups,
std::map< int, EventList * >  vec_outputEventList,
bool  docorrection,
double  toffactor,
double  tofshift 
) const

Split ...

EventList::splitByFullTimeMatrixSplitter.

Parameters
vec_splitters_time:: vector of splitting times
vecgroups:: vector of index group for splitters
vec_outputEventList:: vector of groups of splitted events
docorrection:: flag to do TOF correction from detector to sample
toffactor:: factor multiplied to TOF for correction
tofshift:: shift to TOF in unit of SECOND for correction
Returns

Definition at line 4290 of file EventList.cpp.

References clear(), eventType, Mantid::API::ISpectrum::getDetectorIDs(), getNumberEvents(), m_histogram, Mantid::API::ISpectrum::setDetectorIDs(), Mantid::API::ISpectrum::setHistogram(), sortPulseTimeTOF(), splitByFullTimeSparseVectorSplitterHelper(), splitByFullTimeVectorSplitterHelper(), switchTo(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, and weightedEvents.

Referenced by Mantid::Algorithms::FilterEvents::filterEventsByVectorSplitters().

◆ splitByFullTimeSparseVectorSplitterHelper()

template<class T >
std::string Mantid::DataObjects::EventList::splitByFullTimeSparseVectorSplitterHelper ( const std::vector< int64_t > &  vectimes,
const std::vector< int > &  vecgroups,
std::map< int, EventList * >  outputs,
typename std::vector< T > &  vecEvents,
bool  docorrection,
double  toffactor,
double  tofshift 
) const
private

Split the event list into n outputs, operating on a vector of either TofEvent's or WeightedEvent's The comparison between neutron event and splitter is based on neutron event's pulse time plus.

Parameters
vectimes:: a vector of absolute time in nanoseconds serving as boundaries of splitters
vecgroups:: a vector of integer serving as the target workspace group for splitters
outputs:: a vector of where the split events will end up. The # of entries in there should be big enough to accommodate the indices.
vecEvents:: either this->events or this->weightedEvents.
docorrection:: flag to determine whether or not to apply correction
toffactor:: factor multiplied to TOF for correcting event time from detector to sample
tofshift:: shift in SECOND to TOF for correcting event time from detector to sample

Definition at line 4199 of file EventList.cpp.

References addEventQuickly().

Referenced by splitByFullTimeMatrixSplitter().

◆ splitByFullTimeVectorSplitterHelper()

template<class T >
std::string Mantid::DataObjects::EventList::splitByFullTimeVectorSplitterHelper ( const std::vector< int64_t > &  vectimes,
const std::vector< int > &  vecgroups,
std::map< int, EventList * >  outputs,
typename std::vector< T > &  vecEvents,
bool  docorrection,
double  toffactor,
double  tofshift 
) const
private

Split the event list into n outputs, operating on a vector of either TofEvent's or WeightedEvent's The comparison between neutron event and splitter is based on neutron event's pulse time plus.

Parameters
vectimes:: a vector of absolute time in nanoseconds serving as boundaries of splitters
vecgroups:: a vector of integer serving as the target workspace group for splitters
outputs:: a vector of where the split events will end up. The # of entries in there should be big enough to accommodate the indices.
vecEvents:: either this->events or this->weightedEvents.
docorrection:: flag to determine whether or not to apply correction
toffactor:: factor multiplied to TOF for correcting event time from detector to sample
tofshift:: shift in SECOND to TOF for correcting event time from detector to sample

Definition at line 4132 of file EventList.cpp.

References addEventQuickly(), and index.

Referenced by splitByFullTimeMatrixSplitter().

◆ splitByPulseTime()

void Mantid::DataObjects::EventList::splitByPulseTime ( Kernel::TimeSplitterType splitter,
std::map< int, EventList * >  outputs 
) const

◆ splitByPulseTimeHelper()

template<class T >
void Mantid::DataObjects::EventList::splitByPulseTimeHelper ( Kernel::TimeSplitterType splitter,
std::map< int, EventList * >  outputs,
typename std::vector< T > &  events 
) const
private

Split events by pulse time.

Split the event list into n outputs by each event's pulse time only.

Definition at line 4360 of file EventList.cpp.

References addEventQuickly(), events, and index.

Referenced by splitByPulseTime().

◆ splitByPulseTimeWithMatrix()

void Mantid::DataObjects::EventList::splitByPulseTimeWithMatrix ( const std::vector< int64_t > &  vec_times,
const std::vector< int > &  vec_target,
std::map< int, EventList * >  outputs 
) const

◆ splitByPulseTimeWithMatrixHelper()

template<class T >
void Mantid::DataObjects::EventList::splitByPulseTimeWithMatrixHelper ( const std::vector< int64_t > &  vec_split_times,
const std::vector< int > &  vec_split_target,
std::map< int, EventList * >  outputs,
typename std::vector< T > &  events 
) const
private

Split events (template) by pulse time with matrix splitters.

Definition at line 4504 of file EventList.cpp.

References addEventQuickly(), events, and index.

Referenced by splitByPulseTimeWithMatrix().

◆ splitByTime()

void Mantid::DataObjects::EventList::splitByTime ( Kernel::TimeSplitterType splitter,
std::vector< EventList * >  outputs 
) const

Split the event list into n outputs.

Parameters
splitter:: a TimeSplitterType giving where to split
outputs:: a vector of where the split events will end up. The # of entries in there should be big enough to accommodate the indices.

Definition at line 3941 of file EventList.cpp.

References eventType, Mantid::API::ISpectrum::getDetectorIDs(), m_histogram, sortPulseTime(), splitByTimeHelper(), Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, and weightedEvents.

Referenced by Mantid::Algorithms::FilterByLogValue::exec().

◆ splitByTimeHelper()

template<class T >
void Mantid::DataObjects::EventList::splitByTimeHelper ( Kernel::TimeSplitterType splitter,
std::vector< EventList * >  outputs,
typename std::vector< T > &  events 
) const
private

Split the event list into n outputs, operating on a vector of either TofEvent's or WeightedEvent's Only event's pulse time is used to compare with splitters.

It is a faster and simple version of splitByFullTimeHelper

Parameters
splitter:: a TimeSplitterType giving where to split
outputs:: a vector of where the split events will end up. The # of entries in there should be big enough to accommodate the indices.
events:: either this->events or this->weightedEvents.

Definition at line 3884 of file EventList.cpp.

References addEventQuickly(), events, and index.

Referenced by splitByTime().

◆ switchTo()

void Mantid::DataObjects::EventList::switchTo ( Mantid::API::EventType  newType)
overridevirtual

◆ switchToWeightedEvents()

void Mantid::DataObjects::EventList::switchToWeightedEvents ( )
private

Switch the EventList to use WeightedEvents instead of TofEvent.

Definition at line 675 of file EventList.cpp.

References events, eventType, Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

Referenced by switchTo().

◆ switchToWeightedEventsNoTime()

void Mantid::DataObjects::EventList::switchToWeightedEventsNoTime ( )
private

Switch the EventList to use WeightedEventNoTime's instead of TofEvent.

Definition at line 703 of file EventList.cpp.

References events, eventType, Mantid::API::TOF, Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, weightedEvents, and weightedEventsNoTime.

Referenced by switchTo().

◆ y()

const HistogramData::HistogramY & Mantid::DataObjects::EventList::y ( ) const
overridevirtual

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1294 of file EventList.cpp.

References mru, and sharedY().

Member Data Documentation

◆ events

std::vector<Types::Event::TofEvent> Mantid::DataObjects::EventList::events
mutableprivate

◆ eventType

Mantid::API::EventType Mantid::DataObjects::EventList::eventType
private

◆ m_histogram

HistogramData::Histogram Mantid::DataObjects::EventList::m_histogram
private

◆ m_sortMutex

std::mutex Mantid::DataObjects::EventList::m_sortMutex
mutableprivate

Mutex that is locked while sorting an event list.

Definition at line 351 of file EventList.h.

Referenced by sortPulseTime(), sortPulseTimeTOF(), sortPulseTimeTOFDelta(), sortTimeAtSample(), and sortTof().

◆ mru

EventWorkspaceMRU* Mantid::DataObjects::EventList::mru
mutableprivate

MRU lists of the parent EventWorkspace.

Definition at line 348 of file EventList.h.

Referenced by clear(), dataE(), dataX(), dataY(), e(), mutableHistogramRef(), setMRU(), setX(), sharedE(), sharedY(), and y().

◆ order

EventSortType Mantid::DataObjects::EventList::order
mutableprivate

◆ weightedEvents

std::vector<WeightedEvent> Mantid::DataObjects::EventList::weightedEvents
mutableprivate

◆ weightedEventsNoTime

std::vector<WeightedEventNoTime> Mantid::DataObjects::EventList::weightedEventsNoTime
mutableprivate

The documentation for this class was generated from the following files: