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

1D histogram implementation. More...

#include <Histogram1D.h>

Inheritance diagram for Mantid::DataObjects::Histogram1D:
Mantid::API::ISpectrum

Public Member Functions

void clearData () override
 Zero the data (Y&E) in this spectrum. More...
 
void copyDataFrom (const ISpectrum &source) override
 Copy data from a Histogram1D or EventList, via ISpectrum reference. More...
 
const MantidVecdataDx () const override
 Deprecated, use dx() instead. More...
 
MantidVecdataDx () override
 Deprecated, use mutableDx() instead. More...
 
const MantidVecdataE () const override
 Deprecated, use e() instead. Returns the error data const. More...
 
MantidVecdataE () override
 Deprecated, use mutableE() instead. Returns the error data. More...
 
const MantidVecdataX () const override
 Deprecated, use x() instead. Returns the x data const. More...
 
MantidVecdataX () override
 Deprecated, use mutableX() instead. Returns the x data. More...
 
const MantidVecdataY () const override
 Deprecated, use y() instead. Returns the y data const. More...
 
MantidVecdataY () override
 Deprecated, use mutableY() instead. Returns the y data. More...
 
size_t getMemorySize () const override
 Gets the memory size of the histogram. More...
 
 Histogram1D (const Histogram1D &)=default
 
 Histogram1D (const ISpectrum &other)
 Construct from ISpectrum. More...
 
 Histogram1D (Histogram1D &&)=default
 
 Histogram1D (HistogramData::Histogram::XMode xmode, HistogramData::Histogram::YMode ymode)
 Construct empty. More...
 
bool isError () const
 Checks for errors. More...
 
Histogram1Doperator= (const Histogram1D &)=default
 
Histogram1Doperator= (const ISpectrum &rhs)
 Assignment from ISpectrum. More...
 
Histogram1Doperator= (Histogram1D &&)=default
 
Kernel::cow_ptr< HistogramData::HistogramX > ptrX () const override
 Deprecated, use sharedX() instead. Returns a pointer to the x data. More...
 
const MantidVecreadDx () const override
 Deprecated, use dx() instead. More...
 
const MantidVecreadX () const override
 Deprecated, use x() instead. Returns the x data const. More...
 
void setX (const Kernel::cow_ptr< HistogramData::HistogramX > &X) override
 Deprecated, use setSharedX() instead. More...
 
virtual std::size_t size () const
 get pseudo size More...
 
- Public Member Functions inherited from Mantid::API::ISpectrum
void addDetectorID (const detid_t detID)
 Add a detector ID to the set of detector IDs. More...
 
void addDetectorIDs (const std::set< detid_t > &detIDs)
 Add a set of detector IDs to the set of detector IDs. More...
 
void addDetectorIDs (const std::vector< detid_t > &detIDs)
 Add a vector of detector IDs to the set of detector IDs. More...
 
HistogramData::BinEdges binEdges () const
 
virtual void clearData ()=0
 
void clearDetectorIDs ()
 Clear the detector IDs set. More...
 
void convertToCounts ()
 
void convertToFrequencies ()
 
virtual void copyDataFrom (const ISpectrum &source)=0
 Copy data from another ISpectrum with double-dynamic dispatch. More...
 
virtual void copyDataInto (DataObjects::EventList &) const
 Override in child classes for polymorphic copying of data. More...
 
virtual void copyDataInto (DataObjects::Histogram1D &) const
 Override in child classes for polymorphic copying of data. More...
 
virtual void copyDataInto (SpectrumTester &) const
 Override in child classes for polymorphic copying of data. More...
 
void copyInfoFrom (const ISpectrum &other)
 Copy spectrum number and detector IDs, but not X vector, from another ISpectrum. More...
 
virtual HistogramData::Counts counts () const
 
virtual HistogramData::CountStandardDeviations countStandardDeviations () const
 
virtual HistogramData::CountVariances countVariances () const
 
virtual const MantidVecdataDx () const =0
 
virtual MantidVecdataDx ()=0
 
virtual const MantidVecdataE () const =0
 
virtual MantidVecdataE ()=0
 
virtual const MantidVecdataX () const =0
 
virtual MantidVecdataX ()=0
 
virtual const MantidVecdataY () const =0
 
virtual MantidVecdataY ()=0
 
const HistogramData::HistogramDx & dx () const
 
virtual const HistogramData::HistogramE & e () const
 
virtual HistogramData::Frequencies frequencies () const
 
virtual HistogramData::FrequencyStandardDeviations frequencyStandardDeviations () const
 
virtual HistogramData::FrequencyVariances frequencyVariances () const
 
const std::set< detid_t > & getDetectorIDs () const
 Get a const reference to the detector IDs set. More...
 
virtual size_t getMemorySize () const =0
 
specnum_t getSpectrumNo () const
 
virtual std::pair< double, double > getXDataRange () const
 Return the min/max X values for this spectrum. More...
 
bool hasDetectorID (const detid_t detID) const
 Return true if the given detector ID is in the list for this ISpectrum. More...
 
bool hasDx () const
 Gets the value of the use flag. More...
 
virtual HistogramData::Histogram histogram () const
 Returns the Histogram associated with this spectrum. More...
 
 ISpectrum ()=default
 
 ISpectrum (const specnum_t specNo)
 Constructor with spectrum number. More...
 
HistogramData::HistogramDx & mutableDx () &
 
HistogramData::HistogramE & mutableE () &
 
HistogramData::HistogramX & mutableX () &
 
HistogramData::HistogramY & mutableY () &
 
HistogramData::Points points () const
 
HistogramData::PointStandardDeviations pointStandardDeviations () const
 
virtual Kernel::cow_ptr< HistogramData::HistogramX > ptrX () const =0
 
virtual const MantidVecreadDx () const =0
 
virtual const MantidVecreadE () const
 Deprecated, use e() instead. Returns the y error data const. More...
 
virtual const MantidVecreadX () const =0
 
virtual const MantidVecreadY () const
 Deprecated, use y() instead. Returns the y data const. More...
 
void resetHasDx ()
 Resets the hasDx flag. More...
 
template<typename... T>
void setBinEdges (T &&...data) &
 
template<typename... T>
void setCounts (T &&...data) &
 
template<typename... T>
void setCountStandardDeviations (T &&...data) &
 
template<typename... T>
void setCountVariances (T &&...data) &
 
void setDetectorID (const detid_t detID)
 Clear the list of detector IDs, then add one. More...
 
void setDetectorIDs (const std::set< detid_t > &detIDs)
 Set the detector IDs to be the set given. More...
 
void setDetectorIDs (std::set< detid_t > &&detIDs)
 Set the detector IDs to be the set given (move version). More...
 
template<typename... T>
void setFrequencies (T &&...data) &
 
template<typename... T>
void setFrequencyStandardDeviations (T &&...data) &
 
template<typename... T>
void setFrequencyVariances (T &&...data) &
 
template<typename... T>
void setHistogram (T &&...data)
 Sets the Histogram associated with this spectrum. More...
 
void setMatrixWorkspace (MatrixWorkspace *matrixWorkspace, const size_t index)
 Sets the MatrixWorkspace pointer (pointer to the owning workspace). More...
 
template<typename... T>
void setPoints (T &&...data) &
 
template<typename... T>
void setPointStandardDeviations (T &&...data) &
 
template<typename... T>
void setPointVariances (T &&...data) &
 
void setSharedDx (const Kernel::cow_ptr< HistogramData::HistogramDx > &dx) &
 
void setSharedE (const Kernel::cow_ptr< HistogramData::HistogramE > &e) &
 
void setSharedX (const Kernel::cow_ptr< HistogramData::HistogramX > &x) &
 
void setSharedY (const Kernel::cow_ptr< HistogramData::HistogramY > &y) &
 
void setSpectrumNo (specnum_t num)
 Sets the the spectrum number of this spectrum. More...
 
virtual void setX (const Kernel::cow_ptr< HistogramData::HistogramX > &X)=0
 
void setYMode (HistogramData::Histogram::YMode ymode)
 
Kernel::cow_ptr< HistogramData::HistogramDx > sharedDx () const
 
virtual Kernel::cow_ptr< HistogramData::HistogramE > sharedE () const
 
Kernel::cow_ptr< HistogramData::HistogramX > sharedX () const
 
virtual Kernel::cow_ptr< HistogramData::HistogramY > sharedY () const
 
const HistogramData::HistogramX & x () const
 
virtual const HistogramData::HistogramY & y () const
 
HistogramData::Histogram::YMode yMode () const
 
virtual ~ISpectrum ()=default
 

Private Member Functions

void checkAndSanitizeHistogram (HistogramData::Histogram &histogram) override
 Makes sure a histogram has valid Y and E data. More...
 
virtual void copyDataInto (DataObjects::EventList &) const
 Override in child classes for polymorphic copying of data. More...
 
virtual void copyDataInto (DataObjects::Histogram1D &) const
 Override in child classes for polymorphic copying of data. More...
 
void copyDataInto (Histogram1D &sink) const override
 Used by copyDataFrom for dynamic dispatch for its source. More...
 
virtual void copyDataInto (SpectrumTester &) const
 Override in child classes for polymorphic copying of data. More...
 
const HistogramData::Histogram & histogramRef () const override
 
HistogramData::Histogram & mutableHistogramRef () override
 

Private Attributes

HistogramData::Histogram m_histogram
 Histogram object holding the histogram data. More...
 

Additional Inherited Members

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

Detailed Description

1D histogram implementation.

Definition at line 18 of file Histogram1D.h.

Constructor & Destructor Documentation

◆ Histogram1D() [1/4]

Mantid::DataObjects::Histogram1D::Histogram1D ( HistogramData::Histogram::XMode  xmode,
HistogramData::Histogram::YMode  ymode 
)

Construct empty.

Definition at line 13 of file Histogram1D.cpp.

References m_histogram.

◆ Histogram1D() [2/4]

Mantid::DataObjects::Histogram1D::Histogram1D ( const Histogram1D )
default

◆ Histogram1D() [3/4]

Mantid::DataObjects::Histogram1D::Histogram1D ( Histogram1D &&  )
default

◆ Histogram1D() [4/4]

Mantid::DataObjects::Histogram1D::Histogram1D ( const ISpectrum other)

Construct from ISpectrum.

Definition at line 27 of file Histogram1D.cpp.

Member Function Documentation

◆ checkAndSanitizeHistogram()

void Mantid::DataObjects::Histogram1D::checkAndSanitizeHistogram ( HistogramData::Histogram &  histogram)
overrideprivatevirtual

Makes sure a histogram has valid Y and E data.

Parameters
histogramA histogram to check.
Exceptions
std::invalid_argumentif Y or E data is NULL.

Reimplemented from Mantid::API::ISpectrum.

Definition at line 77 of file Histogram1D.cpp.

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

◆ clearData()

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

Zero the data (Y&E) in this spectrum.

Implements Mantid::API::ISpectrum.

Definition at line 42 of file Histogram1D.cpp.

References dataE(), and dataY().

◆ copyDataFrom()

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

Copy data from a Histogram1D or EventList, via ISpectrum reference.

Implements Mantid::API::ISpectrum.

Definition at line 37 of file Histogram1D.cpp.

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

◆ copyDataInto() [1/4]

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

Override in child classes for polymorphic copying of data.

Reimplemented from Mantid::API::ISpectrum.

Definition at line 203 of file ISpectrum.cpp.

◆ copyDataInto() [2/4]

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

Override in child classes for polymorphic copying of data.

Reimplemented from Mantid::API::ISpectrum.

Definition at line 204 of file ISpectrum.cpp.

◆ copyDataInto() [3/4]

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

Used by copyDataFrom for dynamic dispatch for its source.

Reimplemented from Mantid::API::ISpectrum.

Definition at line 40 of file Histogram1D.cpp.

References m_histogram.

◆ copyDataInto() [4/4]

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

Override in child classes for polymorphic copying of data.

Reimplemented from Mantid::API::ISpectrum.

Definition at line 205 of file ISpectrum.cpp.

◆ dataDx() [1/2]

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

Deprecated, use dx() instead.

Implements Mantid::API::ISpectrum.

Definition at line 68 of file Histogram1D.cpp.

References m_histogram.

◆ dataDx() [2/2]

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

Deprecated, use mutableDx() instead.

Implements Mantid::API::ISpectrum.

Definition at line 66 of file Histogram1D.cpp.

References m_histogram.

◆ dataE() [1/2]

const MantidVec & Mantid::DataObjects::Histogram1D::dataE ( ) const
inlineoverridevirtual

Deprecated, use e() instead. Returns the error data const.

Implements Mantid::API::ISpectrum.

Definition at line 52 of file Histogram1D.h.

Referenced by clearData().

◆ dataE() [2/2]

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

Deprecated, use mutableE() instead. Returns the error data.

Implements Mantid::API::ISpectrum.

Definition at line 57 of file Histogram1D.h.

◆ dataX() [1/2]

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

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

Implements Mantid::API::ISpectrum.

Definition at line 57 of file Histogram1D.cpp.

References m_histogram.

◆ dataX() [2/2]

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

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

Implements Mantid::API::ISpectrum.

Definition at line 54 of file Histogram1D.cpp.

References m_histogram.

◆ dataY() [1/2]

const MantidVec & Mantid::DataObjects::Histogram1D::dataY ( ) const
inlineoverridevirtual

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

Implements Mantid::API::ISpectrum.

Definition at line 50 of file Histogram1D.h.

Referenced by clearData().

◆ dataY() [2/2]

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

Deprecated, use mutableY() instead. Returns the y data.

Implements Mantid::API::ISpectrum.

Definition at line 55 of file Histogram1D.h.

◆ getMemorySize()

size_t Mantid::DataObjects::Histogram1D::getMemorySize ( ) const
inlineoverridevirtual

Gets the memory size of the histogram.

Implements Mantid::API::ISpectrum.

Definition at line 65 of file Histogram1D.h.

◆ histogramRef()

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

Implements Mantid::API::ISpectrum.

Definition at line 74 of file Histogram1D.h.

◆ isError()

bool Mantid::DataObjects::Histogram1D::isError ( ) const
inline

Checks for errors.

Definition at line 62 of file Histogram1D.h.

◆ mutableHistogramRef()

HistogramData::Histogram & Mantid::DataObjects::Histogram1D::mutableHistogramRef ( )
inlineoverrideprivatevirtual

Implements Mantid::API::ISpectrum.

Definition at line 75 of file Histogram1D.h.

◆ operator=() [1/3]

Histogram1D & Mantid::DataObjects::Histogram1D::operator= ( const Histogram1D )
default

◆ operator=() [2/3]

Histogram1D & Mantid::DataObjects::Histogram1D::operator= ( const ISpectrum rhs)

Assignment from ISpectrum.

Definition at line 30 of file Histogram1D.cpp.

References m_histogram, Mantid::API::ISpectrum::operator=(), and rhs.

◆ operator=() [3/3]

Histogram1D & Mantid::DataObjects::Histogram1D::operator= ( Histogram1D &&  )
default

◆ ptrX()

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

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

Implements Mantid::API::ISpectrum.

Definition at line 63 of file Histogram1D.cpp.

References m_histogram.

◆ readDx()

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

Deprecated, use dx() instead.

Implements Mantid::API::ISpectrum.

Definition at line 70 of file Histogram1D.cpp.

References m_histogram.

◆ readX()

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

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

Implements Mantid::API::ISpectrum.

Definition at line 60 of file Histogram1D.cpp.

References m_histogram.

◆ setX()

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

Deprecated, use setSharedX() instead.

Sets the x data.

Parameters
X:: vector of X data

Implements Mantid::API::ISpectrum.

Definition at line 51 of file Histogram1D.cpp.

References m_histogram, and Mantid::Geometry::X.

Referenced by Mantid::DataObjects::Workspace2D::init().

◆ size()

virtual std::size_t Mantid::DataObjects::Histogram1D::size ( ) const
inlinevirtual

get pseudo size

Definition at line 59 of file Histogram1D.h.

Member Data Documentation

◆ m_histogram

HistogramData::Histogram Mantid::DataObjects::Histogram1D::m_histogram
private

Histogram object holding the histogram data.

Definition at line 21 of file Histogram1D.h.

Referenced by copyDataInto(), dataDx(), dataX(), Histogram1D(), operator=(), ptrX(), readDx(), readX(), and setX().


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