Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static 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.
 
void addEventQuickly (const WeightedEvent &event)
 Append an event to the histogram, without clearing the cache, to make it faster.
 
void addEventQuickly (const WeightedEventNoTime &event)
 Append an event to the histogram, without clearing the cache, to make it faster.
 
void addPulsetime (const double seconds) override
 Add an offset to the pulsetime (wall-clock time) of each event in the list.
 
void addPulsetimes (const std::vector< double > &seconds) override
 Add an offset to the pulsetime (wall-clock time) of each event in the list.
 
void addTof (const double offset) override
 Add an offset to the TOF of each event in the list.
 
void clear (const bool removeDetIDs=true) override
 Clear the list of events and any associated detector ID's.
 
void clearData () override
 Mask the spectrum to this value. Removes all events.
 
void clearUnused ()
 Clear any unused event lists (the ones that do not match the currently used type).
 
void compressEvents (double tolerance, EventList *destination)
 Compress the event list by grouping events with the same TOF (within a given tolerance).
 
void compressEvents (double tolerance, EventList *destination, const std::shared_ptr< std::vector< double > > histogram_bin_edges)
 
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.
 
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.
 
void convertUnitsViaTof (Mantid::Kernel::Unit const *fromUnit, Mantid::Kernel::Unit const *toUnit)
 Converts the X units in each event by going through TOF.
 
void copyDataFrom (const ISpectrum &source) override
 Copy data from another EventList, via ISpectrum reference.
 
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.
 
const MantidVecdataDx () const override
 Deprecated, use dx() instead.
 
MantidVecdataDx () override
 Deprecated, use mutableDx() instead.
 
const MantidVecdataE () const override
 Deprecated, use e() instead.
 
MantidVecdataE () override
 Deprecated, use mutableE() instead.
 
const MantidVecdataX () const override
 Deprecated, use x() instead.
 
MantidVecdataX () override
 Deprecated, use mutableX() instead.
 
const MantidVecdataY () const override
 Deprecated, use y() instead.
 
MantidVecdataY () override
 Deprecated, use mutableY() instead.
 
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.
 
void divide (const MantidVec &X, const MantidVec &Y, const MantidVec &E) override
 Divide the weights in this event list by a histogram.
 
const HistogramData::HistogramE & e () const override
 
bool empty () const
 Much like stl containers, returns true if there is nothing in the event list.
 
bool equals (const EventList &rhs, const double tolTof, const double tolWeight, const int64_t tolPulse) const
 
 EventList (const EventList &rhs)
 Constructor copying from an existing event list.
 
 EventList (const Mantid::API::EventType event_type=Mantid::API::EventType::TOF)
 Constructor (empty)
 
 EventList (const std::vector< Types::Event::TofEvent > &events)
 Constructor, taking a vector of events.
 
 EventList (const std::vector< WeightedEvent > &events)
 Constructor, taking a vector of events.
 
 EventList (const std::vector< WeightedEventNoTime > &events)
 Constructor, taking a vector of events.
 
 EventList (EventWorkspaceMRU *mru, specnum_t specNo)
 Constructor with a MRU list.
 
template<typename UnaryOperation >
std::vector< DateAndTime > eventTimesCalculator (const UnaryOperation &timesCalc) const
 Compute a time (for instance, pulse-time plus TOF) associated to each event in the list.
 
void filterByPulseTime (Kernel::TimeROI const *timeRoi, EventList *output) const
 Filter this EventList into an output EventList, using TimeROI keeping only events within the >= start and < end pulse times.
 
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.
 
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.
 
void filterInPlace (const Kernel::TimeROI *timeRoi)
 Use a SplittingIntervalVec to filter the event list in place.
 
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.
 
void generateHistogram (const double step, const MantidVec &X, MantidVec &Y, MantidVec &E, bool skipError=false) const
 Generates both the Y and E (error) histograms w.r.t TOF for an EventList with or without WeightedEvents.
 
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.
 
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.
 
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.
 
WeightedEvent getEvent (size_t event_number)
 Return the given event in the list.
 
std::vector< Types::Event::TofEvent > & getEvents ()
 Return the list of TofEvents contained.
 
const std::vector< Types::Event::TofEvent > & getEvents () const
 Return the const list of TofEvents contained.
 
Mantid::API::EventType getEventType () const override
 Return the type of Event vector contained within.
 
HistogramData::Histogram getHistogram () const
 Returns a copy of the Histogram associated with this spectrum.
 
size_t getMemorySize () const override
 Memory used by this event list.
 
std::size_t getNumberEvents () const override
 Return the number of events in the list.
 
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< Types::Core::DateAndTime > getPulseTimes () const override
 Get the pulse times of each event in this EventList.
 
std::vector< Types::Core::DateAndTime > getPulseTOFTimes () const
 Get the Pulse-time + TOF for each event in this EventList.
 
std::vector< Types::Core::DateAndTime > getPulseTOFTimesAtSample (const double &factor, const double &shift) const
 Get the Pulse-time + time-of-flight of the neutron up to the sample, for each event in this EventList.
 
EventSortType getSortType () const
 Return the type of sorting used in this event list.
 
Mantid::Types::Core::DateAndTime getTimeAtSampleMax (const double &tofFactor, const double &tofOffset) const override
 Get the maximum time at sample.
 
Mantid::Types::Core::DateAndTime getTimeAtSampleMin (const double &tofFactor, const double &tofOffset) const override
 Get the minimum time at sample.
 
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.
 
void getTofs (std::vector< double > &tofs) const override
 Fill a vector with the list of TOFs.
 
std::vector< WeightedEvent > & getWeightedEvents ()
 Return the list of WeightedEvent contained.
 
const std::vector< WeightedEvent > & getWeightedEvents () const
 Return the list of WeightedEvent contained.
 
std::vector< WeightedEventNoTime > & getWeightedEventsNoTime ()
 Return the list of WeightedEvent contained.
 
const std::vector< WeightedEventNoTime > & getWeightedEventsNoTime () const
 Return the list of WeightedEventNoTime contained.
 
std::vector< double > getWeightErrors () const override
 Return the list of event weight error values.
 
void getWeightErrors (std::vector< double > &weightErrors) const override
 Return the list of event weight error values.
 
std::vector< double > getWeights () const override
 Return the list of event weight values.
 
void getWeights (std::vector< double > &weights) const override
 Return the list of event weight values.
 
HistogramData::Histogram histogram () const override
 Returns the Histogram associated with this spectrum.
 
virtual size_t histogram_size () const
 Return the size of the histogram data.
 
void initializePartials (std::map< int, EventList * > partials) const
 Initialize the detector ID's and event type of the destination event lists when splitting this list.
 
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.
 
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.
 
bool isSortedByTof () const override
 Return true if the event list is sorted by TOF.
 
MantidVecmakeDataE () const
 Calculates and returns a pointer to the E histogrammed data.
 
MantidVecmakeDataY () const
 Calculates and returns a pointer to the Y histogrammed data.
 
void maskCondition (const std::vector< bool > &mask) override
 Mask out events by the condition vector.
 
void maskTof (const double tofMin, const double tofMax) override
 Mask out events that have a tof between tofMin and tofMax (inclusively).
 
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.
 
void multiply (const MantidVec &X, const MantidVec &Y, const MantidVec &E) override
 Multiply the weights in this event list by a histogram.
 
bool operator!= (const EventList &rhs) const
 Inequality comparator.
 
EventListoperator*= (const double value)
 Operator to multiply the weights in this EventList by an error-less scalar.
 
EventListoperator+= (const EventList &more_events)
 Append another EventList to this event list.
 
EventListoperator+= (const std::vector< Types::Event::TofEvent > &more_events)
 Append a list of events to the histogram.
 
EventListoperator+= (const std::vector< WeightedEvent > &more_events)
 Append a list of events to the histogram.
 
EventListoperator+= (const std::vector< WeightedEventNoTime > &more_events)
 Append a list of events to the histogram.
 
EventListoperator+= (const Types::Event::TofEvent &event)
 Append an event to the histogram.
 
EventListoperator+= (const WeightedEvent &event)
 Append a WeightedEvent to the histogram.
 
EventListoperator-= (const EventList &more_events)
 SUBTRACT another EventList from this event list.
 
EventListoperator/= (const double value)
 Operator to divide the weights in this EventList by an error-less scalar.
 
EventListoperator= (const EventList &)
 Copy into this event list from another.
 
bool operator== (const EventList &rhs) const
 Equality operator between EventList's.
 
Kernel::cow_ptr< HistogramData::HistogramX > ptrX () const override
 Deprecated, use sharedX() instead. Returns a pointer to the x data.
 
const MantidVecreadDx () const override
 Deprecated, use dx() instead.
 
const MantidVecreadX () const override
 Deprecated, use x() instead. Returns the x data const.
 
void reserve (size_t num) override
 Reserve a certain number of entries in event list of the specified eventType.
 
void reverse ()
 Reverse the histogram boundaries and the associated events if they are sorted by time-of-flight.
 
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.
 
void setMRU (EventWorkspaceMRU *newMRU)
 Sets the MRU list for this event list.
 
void setSortOrder (const EventSortType order) const
 Manually set the event list sort order value.
 
void setTofs (const MantidVec &tofs) override
 Set a list of TOFs to the current event list.
 
void setX (const Kernel::cow_ptr< HistogramData::HistogramX > &X) override
 Deprecated, use setSharedX() instead.
 
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.
 
void sortPulseTime () const
 Sort events by Frame.
 
void sortPulseTimeTOF () const
 
void sortTimeAtSample (const double &tofFactor, const double &tofShift, bool forceResort=false) const
 Sort events by time at sample.
 
void sortTof () const
 Sort events by TOF in one thread.
 
void switchTo (Mantid::API::EventType newType) override
 Switch the EventList to use the given EventType (TOF, WEIGHTED, or WEIGHTED_NOTIME)
 
const HistogramData::HistogramY & y () const override
 
 ~EventList () override
 Destructor.
 
- Public Member Functions inherited from Mantid::API::IEventList
 IEventList ()
 Empty constructor.
 
 IEventList (specnum_t specNo)
 Constructor.
 
- Public Member Functions inherited from Mantid::API::ISpectrum
void addDetectorID (const detid_t detID)
 Add a detector ID to the set of detector IDs.
 
void addDetectorIDs (const std::set< detid_t > &detIDs)
 Add a set of detector IDs to the set of detector IDs.
 
void addDetectorIDs (const std::vector< detid_t > &detIDs)
 Add a vector of detector IDs to the set of detector IDs.
 
HistogramData::BinEdges binEdges () const
 
void clearDetectorIDs ()
 Clear the detector IDs set.
 
void convertToCounts ()
 
void convertToFrequencies ()
 
void copyInfoFrom (const ISpectrum &other)
 Copy spectrum number and detector IDs, but not X vector, from another ISpectrum.
 
const HistogramData::HistogramDx & dx () const
 
const std::set< detid_t > & getDetectorIDs () const
 Get a const reference to the detector IDs set.
 
specnum_t getSpectrumNo () const
 
virtual std::pair< double, double > getXDataRange () const
 Return the min/max X values for this spectrum.
 
bool hasDetectorID (const detid_t detID) const
 Return true if the given detector ID is in the list for this ISpectrum.
 
bool hasDx () const
 Gets the value of the use flag.
 
 ISpectrum ()=default
 
 ISpectrum (const specnum_t specNo)
 Constructor with spectrum number.
 
HistogramData::HistogramDx & mutableDx () &
 
HistogramData::HistogramE & mutableE () &
 
HistogramData::HistogramX & mutableX () &
 
HistogramData::HistogramY & mutableY () &
 
HistogramData::Points points () const
 
HistogramData::PointStandardDeviations pointStandardDeviations () const
 
virtual const MantidVecreadE () const
 Deprecated, use e() instead. Returns the y error data const.
 
virtual const MantidVecreadY () const
 Deprecated, use y() instead. Returns the y data const.
 
void resetHasDx ()
 Resets the hasDx flag.
 
void resize (size_t n)
 
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.
 
void setDetectorIDs (const std::set< detid_t > &detIDs)
 Set the detector IDs to be the set given.
 
void setDetectorIDs (std::set< detid_t > &&detIDs)
 Set the detector IDs to be the set given (move version).
 
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.
 
void setMatrixWorkspace (MatrixWorkspace *matrixWorkspace, const size_t index)
 Sets the MatrixWorkspace pointer (pointer to the owning workspace).
 
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 spectrum number of this spectrum.
 
void setYMode (HistogramData::Histogram::YMode ymode)
 
Kernel::cow_ptr< HistogramData::HistogramDx > sharedDx () const
 
Kernel::cow_ptr< HistogramData::HistogramX > sharedX () const
 
size_t size () const
 
const HistogramData::HistogramX & x () const
 
HistogramData::Histogram::YMode yMode () const
 
virtual ~ISpectrum ()=default
 

Static Public Member Functions

static std::optional< size_t > findLinearBin (const MantidVec &X, const double tof, const double divisor, const double offset, const bool findExact=true)
 Find the bin which this TOF value falls in with linear binning, assumes TOF is in range of X.
 
static std::optional< size_t > findLogBin (const MantidVec &X, const double tof, const double divisor, const double offset, const bool findExact=true)
 Find the bin which this TOF value falls in with log binning, assumes TOF is in range of X.
 

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
 ISpectrum (const ISpectrum &other)
 Copy constructor.
 
 ISpectrum (ISpectrum &&other)
 Move constructor.
 
ISpectrumoperator= (const ISpectrum &other)
 Copy assignment.
 
ISpectrumoperator= (ISpectrum &&other)
 Move assignment.
 

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.
 
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.
 
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.
 
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.
 
template<class T >
void convertUnitsViaTofHelper (typename std::vector< T > &events, Mantid::Kernel::Unit const *fromUnit, Mantid::Kernel::Unit const *toUnit)
 Helper function for the conversion to TOF.
 
virtual void copyDataInto (DataObjects::EventList &) const
 Override in child classes for polymorphic copying of data.
 
virtual void copyDataInto (DataObjects::Histogram1D &) const
 Override in child classes for polymorphic copying of data.
 
void copyDataInto (EventList &sink) const override
 Used by copyDataFrom for dynamic dispatch for its source.
 
void copyDataInto (Histogram1D &sink) const override
 Used by Histogram1D::copyDataFrom for dynamic dispatch for other.
 
virtual void copyDataInto (SpectrumTester &) const
 Override in child classes for polymorphic copying of data.
 
template<typename UnaryOperation >
std::vector< Types::Core::DateAndTime > eventTimesCalculator (const UnaryOperation &timesCalc) const
 Compute a time (for instance, pulse-time plus TOF) associated to each event in the list.
 
template<class T >
void filterInPlaceHelper (Kernel::TimeROI const *timeRoi, typename std::vector< T > &events)
 Perform an in-place filtering on a vector of either TofEvent's or WeightedEvent's.
 
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!
 
void generateCountsHistogram (const double step, const MantidVec &X, MantidVec &Y) const
 Fill a histogram given specified histogram bounds.
 
void generateCountsHistogram (const MantidVec &X, MantidVec &Y) const
 Fill a histogram given specified histogram bounds.
 
void generateCountsHistogramPulseTime (const MantidVec &X, MantidVec &Y) const
 With respect to PulseTime Fill a histogram given specified histogram bounds.
 
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.
 
void generateErrorsHistogram (const MantidVec &Y, MantidVec &E) const
 Generate the Error histogram for the provided counts histogram.
 
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.
 
void switchToWeightedEvents ()
 Switch the EventList to use WeightedEvents instead of TofEvent.
 
void switchToWeightedEventsNoTime ()
 Switch the EventList to use WeightedEventNoTime's instead of TofEvent.
 

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.
 
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 createWeightedEvents (std::vector< WeightedEventNoTime > &out, const std::vector< double > &tof, const std::vector< T > &weight, const std::vector< T > &error)
 
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.
 
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 filterByTimeROIHelper (std::vector< T > &events, const std::vector< Kernel::TimeInterval > &intervals, EventList *output)
 Filter a vector of events into another based on TimeROI.
 
static size_t findExactBin (const MantidVec &X, const double tof, const size_t n_bin)
 Find the exact bin which a TOF falls in starting from the provided estimated one.
 
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!
 
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.
 
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.
 
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.
 
template<class T >
static void histogramForWeightsHelper (const std::vector< T > &events, const double step, const MantidVec &X, MantidVec &Y, MantidVec &E)
 Generates both the Y and E (error) histograms for an EventList with WeightedEvents.
 
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.
 
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.
 
template<class T >
static std::size_t maskConditionHelper (std::vector< T > &events, const std::vector< bool > &mask)
 Mask out events by the condition vector.
 
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).
 
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.
 
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.
 
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.
 
template<class T >
static void processWeightedEvents (const std::vector< T > &events, std::vector< WeightedEventNoTime > &out, const std::shared_ptr< std::vector< double > > histogram_bin_edges, struct FindBin findBin)
 
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.
 

Private Attributes

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

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 57 of file EventList.h.

Constructor & Destructor Documentation

◆ EventList() [1/6]

Mantid::DataObjects::EventList::EventList ( const Mantid::API::EventType  event_type = Mantid::API::EventType::TOF)

◆ 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 193 of file EventList.cpp.

References events.

◆ 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 202 of file EventList.cpp.

References operator=().

◆ EventList() [4/6]

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

Constructor, taking a vector of events.

Parameters
events:: Vector of TofEvent's

Definition at line 210 of file EventList.cpp.

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

◆ 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 220 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 230 of file EventList.cpp.

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

◆ ~EventList()

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

Member Function Documentation

◆ addEventQuickly() [1/3]

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

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

NOTE: Only call this on a un-weighted event list!

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

Definition at line 105 of file EventList.h.

References Mantid::DataObjects::UNSORTED.

Referenced by Mantid::Algorithms::GenerateGoniometerIndependentBackground::filterAndAddEvents(), filterByTimeROIHelper(), Mantid::DataHandling::LoadSwans::loadDataIntoTheWorkspace(), Mantid::DataHandling::LoadNexusProcessed::loadEventEntry(), Mantid::DataHandling::LoadNexusMonitors2::readEventMonitorEntry(), and Mantid::Algorithms::ExportTimeSeriesLog::setupEventWorkspace().

◆ 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 116 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 127 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 2991 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 2965 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 3016 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 2978 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 2957 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 4541 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 4561 of file EventList.cpp.

◆ checkWorksWithPoints()

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

Reimplemented from Mantid::API::ISpectrum.

Definition at line 4556 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 1015 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 1002 of file EventList.cpp.

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

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

◆ compressEvents() [1/2]

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 1830 of file EventList.cpp.

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

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

◆ compressEvents() [2/2]

void Mantid::DataObjects::EventList::compressEvents ( double  tolerance,
EventList destination,
const std::shared_ptr< std::vector< double > >  histogram_bin_edges 
)

◆ 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. Negative implies log grouping.

Definition at line 1580 of file EventList.cpp.

References events, fabs, rhs, and tolerance.

Referenced by compressEvents().

◆ 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 2901 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 2856 of file EventList.cpp.

References convertTofHelper(), dataX(), events, 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 2936 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 2889 of file EventList.cpp.

References events.

Referenced by convertTof(), and 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 4521 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 4508 of file EventList.cpp.

References events.

Referenced by convertUnitsQuickly().

◆ convertUnitsViaTof()

void Mantid::DataObjects::EventList::convertUnitsViaTof ( Mantid::Kernel::Unit const *  fromUnit,
Mantid::Kernel::Unit const *  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 4478 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 const *  fromUnit,
Mantid::Kernel::Unit const *  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 4460 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 256 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 205 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 206 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 259 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 281 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 207 of file ISpectrum.cpp.

◆ counts()

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

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1448 of file EventList.cpp.

References histogram().

◆ countStandardDeviations()

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

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1452 of file EventList.cpp.

References histogram().

◆ countVariances()

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

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1450 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 295 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().

◆ createWeightedEvents()

template<class T >
void Mantid::DataObjects::EventList::createWeightedEvents ( std::vector< WeightedEventNoTime > &  out,
const std::vector< double > &  tof,
const std::vector< T > &  weight,
const std::vector< T > &  error 
)
inlinestaticprivate

Definition at line 1889 of file EventList.cpp.

References error.

Referenced by compressEvents(), and processWeightedEvents().

◆ dataDx() [1/2]

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

Deprecated, use dx() instead.

Implements Mantid::API::ISpectrum.

Definition at line 1404 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 1402 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 1550 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 187 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 1393 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 1385 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 1536 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 184 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 4114 of file EventList.cpp.

References error, multiply(), and value.

Referenced by Mantid::Algorithms::NormaliseToMonitor::normaliseBinByBin(), Mantid::Algorithms::Divide::performEventBinaryOperation(), Mantid::Algorithms::Divide::performEventBinaryOperation(), 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 4067 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 3961 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 1470 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

◆ eventTimesCalculator() [1/2]

template<typename UnaryOperation >
std::vector< Types::Core::DateAndTime > Mantid::DataObjects::EventList::eventTimesCalculator ( const UnaryOperation &  timesCalc) const
private

Compute a time (for instance, pulse-time plus TOF) associated to each event in the list.

Referenced by getPulseTimes(), getPulseTOFTimes(), and getPulseTOFTimesAtSample().

◆ eventTimesCalculator() [2/2]

template<typename UnaryOperation >
std::vector< DateAndTime > Mantid::DataObjects::EventList::eventTimesCalculator ( const UnaryOperation &  timesCalc) const

Compute a time (for instance, pulse-time plus TOF) associated to each event in the list.

Parameters
timesCalc: anonymous function that computes a time from an input event
Returns
: vector of times for all events in the list

Definition at line 3324 of file EventList.cpp.

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

◆ filterByPulseTime() [1/2]

void Mantid::DataObjects::EventList::filterByPulseTime ( Kernel::TimeROI const *  timeRoi,
EventList output 
) const

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

Since a TimeROI object may contain more than one time interval, the function is keeping events with pulse times within any of the ROI time intervals and discarding events within any of the masked time intervals. Detector IDs and the X axis are copied as well.

Parameters
timeRoi:: reference to TimeROI to be used for filtering
output:: reference to an event list that will be output.
Exceptions
std::invalid_argumentIf output is a reference to this EventList

Definition at line 4185 of file EventList.cpp.

References clear(), eventType, filterByTimeROIHelper(), Mantid::API::ISpectrum::getDetectorIDs(), m_histogram, Mantid::API::ISpectrum::setDetectorIDs(), Mantid::API::ISpectrum::setHistogram(), sortPulseTime(), switchTo(), Mantid::API::TOF, Mantid::Kernel::TimeROI::toTimeIntervals(), Mantid::Kernel::TimeROI::useAll(), Mantid::API::WEIGHTED, Mantid::API::WEIGHTED_NOTIME, and weightedEvents.

◆ filterByPulseTime() [2/2]

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 4142 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::FilterByLogValue::exec(), and 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 4225 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().

◆ filterByTimeROIHelper()

template<class T >
void Mantid::DataObjects::EventList::filterByTimeROIHelper ( std::vector< T > &  events,
const std::vector< Kernel::TimeInterval > &  intervals,
EventList output 
)
staticprivate

Filter a vector of events into another based on TimeROI.

TODO: Make this more efficient using STL-fu.

Parameters
events:: input events
intervals:: Interval vec of start and stop times
output:: reference to an event list that will be output.

Definition at line 4238 of file EventList.cpp.

References addEventQuickly(), and events.

Referenced by filterByPulseTime().

◆ filterInPlace()

void Mantid::DataObjects::EventList::filterInPlace ( const Kernel::TimeROI timeRoi)

Use a SplittingIntervalVec to filter the event list in place.

Parameters
timeRoi:: a TimeROI that will be used to filter events

Definition at line 4281 of file EventList.cpp.

References eventType, filterInPlaceHelper(), sortPulseTime(), Mantid::API::TOF, Mantid::Kernel::TimeROI::useAll(), 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::TimeROI const *  timeRoi,
typename std::vector< T > &  events 
)
private

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

Parameters
timeRoi:: a TimeROI that will be used filter events
events:: either this->events or this->weightedEvents.

This helper function uses a two pointer technique where

  • itOut: the storage pointer
  • itev: the scan pointer When itev is traversing through the list of events, it will check against the current splitter interval identified by itspl.

If itev->m_pulsetime is within the interval, the event, *itev, will be copied to the location pointed by itOut, and itOut will be incremented. When either splitter intervals or events are exhausted, truncate the events list to the current location of itOut.

This linear scanning ensures that

  • it will only traverse the events once in the worst case.
  • overlapping splitter intervals will be handled correctly.
  • the memory usage is capped at the size of the events list.

The splitter intervals must be sorted by start time, which is not enforced in this helper function and is expected to be implicitly followed by the caller.

Definition at line 4333 of file EventList.cpp.

References events, and Mantid::Kernel::TimeROI::toTimeIntervals().

Referenced by filterInPlace().

◆ findExactBin()

size_t Mantid::DataObjects::EventList::findExactBin ( const MantidVec X,
const double  tof,
const size_t  n_bin 
)
staticprivate

Find the exact bin which a TOF falls in starting from the provided estimated one.

Estimated bin is expected to be within 1 of the correct bin

Parameters
X:: The x bins
tof:: TOF of the event we are trying to bin
n_bin:: starting estiamted bin number

Definition at line 2669 of file EventList.cpp.

References Mantid::Geometry::X.

Referenced by findLinearBin(), and findLogBin().

◆ 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 2052 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 2080 of file EventList.cpp.

References events.

Referenced by generateCountsHistogramTimeAtSample().

◆ findLinearBin()

std::optional< size_t > Mantid::DataObjects::EventList::findLinearBin ( const MantidVec X,
const double  tof,
const double  divisor,
const double  offset,
const bool  findExact = true 
)
static

Find the bin which this TOF value falls in with linear binning, assumes TOF is in range of X.

bin_number = (tof - xmin) / step

Parameters
X:: The x bins
tof:: TOF of the event we are trying to bin
divisor:: pre-calculated divisor
offset:: pre-calculated offset
findExact:: do extra check of supplied time-of-flight compared to bin boundaries and move the bin if needed

Definition at line 2622 of file EventList.cpp.

References findExactBin(), and Mantid::Geometry::X.

Referenced by Mantid::DataHandling::CompressEventAccumulator::CompressEventAccumulator(), and Mantid::DataObjects::FindBin::FindBin().

◆ findLogBin()

std::optional< size_t > Mantid::DataObjects::EventList::findLogBin ( const MantidVec X,
const double  tof,
const double  divisor,
const double  offset,
const bool  findExact = true 
)
static

Find the bin which this TOF value falls in with log binning, assumes TOF is in range of X.

formula to get bin_number from TOF

bin_number = log_{abs(step) + 1}(tof/xmin) (that is log base abs(step)+1)

rewritten as

bin_number = log(tof)/log(abs(step)+1) - log(xmin)/log(abs(step)+1)

or bin_number = log(tof)/divisor - offset, where divisor and offset are precalulated

Parameters
X:: The x bins
tof:: TOF of the event we are trying to bin
divisor:: pre-calculated divisor
offset:: pre-calculated offset
findExact:: do extra check of supplied time-of-flight compared to bin boundaries and move the bin if needed

Definition at line 2651 of file EventList.cpp.

References findExactBin(), and Mantid::Geometry::X.

Referenced by Mantid::DataHandling::CompressEventAccumulator::CompressEventAccumulator(), and Mantid::DataObjects::FindBin::FindBin().

◆ frequencies()

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

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1456 of file EventList.cpp.

References histogram().

◆ frequencyStandardDeviations()

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

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1460 of file EventList.cpp.

References histogram().

◆ frequencyVariances()

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

Reimplemented from Mantid::API::ISpectrum.

Definition at line 1458 of file EventList.cpp.

References histogram().

◆ generateCountsHistogram() [1/2]

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

Fill a histogram given specified histogram bounds.

Does not modify the eventlist (const method).

This histogram without sorting the events by using the step size to estimate the bin number. This only works for logarithmic or linear binning.

Parameters
step:: bin step size
X:: The x bins
Y:: The generated counts histogram

Definition at line 2695 of file EventList.cpp.

References events, Mantid::Geometry::X, and Mantid::Geometry::Y.

◆ generateCountsHistogram() [2/2]

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 2575 of file EventList.cpp.

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

Referenced by generateHistogram(), and 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 2476 of file EventList.cpp.

References events, and 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 2402 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 2510 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 2741 of file EventList.cpp.

References Mantid::Geometry::Y.

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

◆ generateHistogram() [1/2]

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

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

This will zero out the Y array as part of the process.

This calculates histogram without sorting the events by using the step size to estimate the bin number. This has been made to only work for logarithmic or linear binning. This falls back to using the sorted histogram method if the events are already sorted, as that will be faster.

Parameters
stepbin step size
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.

Definition at line 2372 of file EventList.cpp.

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

◆ generateHistogram() [2/2]

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.

This will zero out the Y array as part of the process.

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 2334 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::DiffractionFocussing2::exec(), Mantid::Algorithms::RebinRagged::exec(), Mantid::Algorithms::ResampleX::exec(), generateHistogram(), 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 2270 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 2302 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 848 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 890 of file EventList.cpp.

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

Referenced by Mantid::MDAlgorithms::SaveIsawQvector::exec(), Mantid::DataObjects::getEventsFrom(), Mantid::DataObjects::getEventsFrom(), Mantid::Algorithms::CalculateCountRate::histogramEvents(), Mantid::DataHandling::LoadEventPreNexus2::procEvents(), and Mantid::DataObjects::TimeSplitter::splitEventList().

◆ 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 874 of file EventList.cpp.

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

◆ getEventType()

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

◆ getHistogram()

HistogramData::Histogram Mantid::DataObjects::EventList::getHistogram ( ) const

Returns a copy of the Histogram associated with this spectrum.

Definition at line 1439 of file EventList.cpp.

References m_histogram.

Referenced by initializePartials().

◆ 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 1344 of file EventList.cpp.

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

◆ getNumberEvents()

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

◆ 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 3347 of file EventList.cpp.

References eventTimesCalculator().

◆ getPulseTOFTimes()

std::vector< DateAndTime > Mantid::DataObjects::EventList::getPulseTOFTimes ( ) const

Get the Pulse-time + TOF for each event in this EventList.

Definition at line 3353 of file EventList.cpp.

References eventTimesCalculator().

◆ getPulseTOFTimesAtSample()

std::vector< DateAndTime > Mantid::DataObjects::EventList::getPulseTOFTimesAtSample ( const double &  factor,
const double &  shift 
) const

Get the Pulse-time + time-of-flight of the neutron up to the sample, for each event in this EventList.

Parameters
factor: rescale the TOF by this dimensionless quantity
shift: shift the TOF (after rescaling) by this time, in microseconds

Definition at line 3362 of file EventList.cpp.

References eventTimesCalculator().

◆ getSortType()

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

Return the type of sorting used in this event list.

Definition at line 1262 of file EventList.cpp.

References order.

Referenced by convertTof(), and convertTof().

◆ 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 3221 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 3199 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 3190 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 907 of file EventList.cpp.

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

Referenced by Mantid::Algorithms::Bin2DPowderDiffraction::createOutputWorkspace(), Mantid::DataObjects::getEventsFrom(), Mantid::DataObjects::getEventsFrom(), and Mantid::DataObjects::TimeSplitter::splitEventList().

◆ 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 924 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 954 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 3312 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 3289 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 3279 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 3266 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 3243 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 3233 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 1441 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 1359 of file EventList.cpp.

References readX().

◆ histogramForWeightsHelper() [1/2]

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

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

This histograms without sorting the events first by using the bin step size to estimate the bin number. This only works for logarithmic or linear binning.

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

Definition at line 2215 of file EventList.cpp.

References events, Mantid::Geometry::X, and Mantid::Geometry::Y.

◆ histogramForWeightsHelper() [2/2]

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 2119 of file EventList.cpp.

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

Referenced by generateHistogram(), and generateHistogram().

◆ histogramRef()

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

Implements Mantid::API::ISpectrum.

Definition at line 326 of file EventList.h.

◆ initializePartials()

void Mantid::DataObjects::EventList::initializePartials ( std::map< int, EventList * >  partials) const

Initialize the detector ID's and event type of the destination event lists when splitting this list.

Parameters
partials: resulting partial lists of events after splitting's done

Definition at line 4394 of file EventList.cpp.

References getEventType(), and getHistogram().

◆ 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 2805 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

Definition at line 2820 of file EventList.cpp.

References error, events, 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()

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 2761 of file EventList.cpp.

References error, and events.

Referenced by integrate().

◆ 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 1258 of file EventList.cpp.

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

Referenced by Mantid::DataHandling::CompressEvents::exec(), generateHistogram(), and 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 1430 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 1417 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 3152 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 3124 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 3084 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 3048 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.

Definition at line 565 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 3805 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/=(), Mantid::Algorithms::Multiply::performEventBinaryOperation(), Mantid::Algorithms::Multiply::performEventBinaryOperation(), 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 3930 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 3736 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 3836 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 682 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 3771 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 525 of file EventList.cpp.

References Mantid::API::ISpectrum::addDetectorIDs(), empty(), 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)

Append a list of events to the histogram.

The internal event list will switch to the required type.

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

Definition at line 417 of file EventList.cpp.

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

◆ 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 466 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 498 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)

Append an event to the histogram.

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

Definition at line 389 of file EventList.cpp.

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

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 451 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 586 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 4097 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 375 of file EventList.cpp.

References m_histogram, and rhs.

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 659 of file EventList.cpp.

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

◆ processWeightedEvents()

template<class T >
void Mantid::DataObjects::EventList::processWeightedEvents ( const std::vector< T > &  events,
std::vector< WeightedEventNoTime > &  out,
const std::shared_ptr< std::vector< double > >  histogram_bin_edges,
struct FindBin  findBin 
)
inlinestaticprivate

Definition at line 1900 of file EventList.cpp.

References createWeightedEvents(), error, and events.

Referenced by compressEvents().

◆ 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 1399 of file EventList.cpp.

References m_histogram.

Referenced by Mantid::DataHandling::CompressEvents::exec(), and Mantid::DataObjects::EventWorkspace::refX().

◆ readDx()

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

Deprecated, use dx() instead.

Implements Mantid::API::ISpectrum.

Definition at line 1406 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 1396 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 1270 of file EventList.cpp.

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

Referenced by convertTof(), and 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 2950 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 1021 of file EventList.cpp.

References mru.

◆ setSortOrder()

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

◆ 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 3707 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 3689 of file EventList.cpp.

References events, and m_tof.

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 1376 of file EventList.cpp.

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

Referenced by createFromHistogram(), and Mantid::DataHandling::CompressEvents::exec().

◆ 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 1235 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 1140 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 generateCountsHistogramTimeAtSample(), and generateHistogramTimeAtSample().

◆ sortTof()

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

◆ 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 774 of file EventList.cpp.

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

Referenced by switchTo().

◆ switchToWeightedEventsNoTime()

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

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

Definition at line 803 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 1464 of file EventList.cpp.

References mru, and sharedY().

Member Data Documentation

◆ events

std::unique_ptr<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(), y(), and ~EventList().

◆ order

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

◆ weightedEvents

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

◆ weightedEventsNoTime

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

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