Mantid
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Mantid::DataObjects::MDLeanEvent< nd > Class Template Reference

Templated class holding data about a neutron detection event in N-dimensions (for example, Qx, Qy, Qz, E). More...

#include <MDLeanEvent.h>

Inheritance diagram for Mantid::DataObjects::MDLeanEvent< nd >:
Mantid::DataObjects::MDEvent< nd >

Classes

struct  AccessFor
 Internal structure to avoid the direct exposing of API functions, which change the state of event (switch between union fields) More...
 

Public Types

enum  { is_full_mdevent = false }
 
using IntT = typename morton_index::IndexTypes< nd, coord_t >::IntType
 Additional index type defenitions. More...
 
using MortonT = typename morton_index::IndexTypes< nd, coord_t >::MortonType
 

Public Member Functions

const coord_tgetCenter () const
 Returns the array of coordinates. More...
 
coord_t getCenter (const size_t n) const
 
coord_tgetCenterNonConst ()
 Returns the array of coordinates, as a pointer to a non-const array. More...
 
int32_t getDetectorID () const
 
float getError () const
 Returns the error (not squared) of this event. More...
 
float getErrorSquared () const
 Returns the error (squared) of this event. More...
 
uint16_t getExpInfoIndex () const
 
uint16_t getGoniometerIndex () const
 
size_t getNumDims () const
 Returns the number of dimensions in the event. More...
 
float getSignal () const
 Returns the signal (weight) of this event. More...
 
 MDLeanEvent ()
 Empty constructor. More...
 
 MDLeanEvent (const double signal, const double errorSquared)
 Constructor with signal and error. More...
 
 MDLeanEvent (const double signal, const double errorSquared, const coord_t *centers)
 Constructor with signal and error and an array of centers. More...
 
 MDLeanEvent (const float signal, const float errorSquared)
 Constructor with signal and error. More...
 
 MDLeanEvent (const float signal, const float errorSquared, const coord_t *centers)
 Constructor with signal and error and an array of centers. More...
 
 MDLeanEvent (const MDLeanEvent &rhs)
 Copy constructor. More...
 
MDLeanEventoperator= (MDLeanEvent other)
 
void setCenter (const size_t n, const coord_t value)
 Sets the n-th coordinate axis value. More...
 
void setCoords (const coord_t *centers)
 Sets all the coordinates. More...
 
void setErrorSquared (const float newerrorSquared)
 Set the squared error of the event. More...
 
void setSignal (const float newSignal)
 Set the signal of the event. More...
 

Static Public Member Functions

static void dataToEvents (const std::vector< coord_t > &coord, std::vector< MDLeanEvent< nd > > &events, bool reserveMemory=true)
 
static void eventsToData (const std::vector< MDLeanEvent< nd > > &mdLeanEvents, std::vector< coord_t > &data, size_t &ncols, double &totalSignal, double &totalErrSq)
 
static std::string getTypeName ()
 

Protected Attributes

union {
   coord_t   center [nd]
 
   MortonT   index = 0
 
}; 
 The N-dimensional coordinates of the center of the event. More...
 
float errorSquared
 The square of the error carried in this event. More...
 
float signal
 The signal (aka weight) from the neutron event. More...
 

Private Member Functions

void convertToCoordinates (const morton_index::MDSpaceBounds< nd > &space)
 Calculate coordinates of the center of event from it Morton index in known space and oveerride index with coordinates in memory. More...
 
void convertToIndex (const morton_index::MDSpaceBounds< nd > &space)
 Calculate Morton index for center coordinates for given space and ovveride the memory used for storing center with index. More...
 

Friends

template<class Accessor >
struct AccessFor
 
void swap (MDLeanEvent &first, MDLeanEvent &second)
 

Detailed Description

template<size_t nd>
class Mantid::DataObjects::MDLeanEvent< nd >

Templated class holding data about a neutron detection event in N-dimensions (for example, Qx, Qy, Qz, E).

Each neutron has a signal (a float, can be != 1) and an error. This is the same principle as the WeightedEvent in EventWorkspace's

This class is meant to be as small in memory as possible, since there will be (many) billions of it. No virtual methods! This adds a pointer to a vtable = 8 bytes of memory per event (plus the overhead of vtable lookups for calls)

Template Parameters
nd:: the number of dimensions that each MDLeanEvent will be tracking. an int > 0.
Author
Janik Zikovsky, SNS
Date
Dec 3, 2010

Definition at line 60 of file MDLeanEvent.h.

Member Typedef Documentation

◆ IntT

template<size_t nd>
using Mantid::DataObjects::MDLeanEvent< nd >::IntT = typename morton_index::IndexTypes<nd, coord_t>::IntType

Additional index type defenitions.

Definition at line 65 of file MDLeanEvent.h.

◆ MortonT

template<size_t nd>
using Mantid::DataObjects::MDLeanEvent< nd >::MortonT = typename morton_index::IndexTypes<nd, coord_t>::MortonType

Definition at line 66 of file MDLeanEvent.h.

Member Enumeration Documentation

◆ anonymous enum

template<size_t nd>
anonymous enum
Enumerator
is_full_mdevent 

Definition at line 143 of file MDLeanEvent.h.

Constructor & Destructor Documentation

◆ MDLeanEvent() [1/6]

template<size_t nd>
Mantid::DataObjects::MDLeanEvent< nd >::MDLeanEvent ( )
inline

Empty constructor.

Definition at line 147 of file MDLeanEvent.h.

◆ MDLeanEvent() [2/6]

template<size_t nd>
Mantid::DataObjects::MDLeanEvent< nd >::MDLeanEvent ( const double  signal,
const double  errorSquared 
)
inline

Constructor with signal and error.

Parameters
signal:: signal (aka weight)
errorSquared:: square of the error on the weight

Definition at line 155 of file MDLeanEvent.h.

◆ MDLeanEvent() [3/6]

template<size_t nd>
Mantid::DataObjects::MDLeanEvent< nd >::MDLeanEvent ( const float  signal,
const float  errorSquared 
)
inline

Constructor with signal and error.

Parameters
signal:: signal (aka weight)
errorSquared:: square of the error on the weight

Definition at line 164 of file MDLeanEvent.h.

◆ MDLeanEvent() [4/6]

template<size_t nd>
Mantid::DataObjects::MDLeanEvent< nd >::MDLeanEvent ( const float  signal,
const float  errorSquared,
const coord_t centers 
)
inline

Constructor with signal and error and an array of centers.

Parameters
signal:: signal (aka weight)
errorSquared:: square of the error on the weight
centers:: pointer to a nd-sized array of values to set for all coordinates.

Definition at line 174 of file MDLeanEvent.h.

◆ MDLeanEvent() [5/6]

template<size_t nd>
Mantid::DataObjects::MDLeanEvent< nd >::MDLeanEvent ( const double  signal,
const double  errorSquared,
const coord_t centers 
)
inline

Constructor with signal and error and an array of centers.

Parameters
signal:: signal (aka weight)
errorSquared:: square of the error on the weight
centers:: pointer to a nd-sized array of values to set for all coordinates.

Definition at line 187 of file MDLeanEvent.h.

◆ MDLeanEvent() [6/6]

template<size_t nd>
Mantid::DataObjects::MDLeanEvent< nd >::MDLeanEvent ( const MDLeanEvent< nd > &  rhs)
inline

Copy constructor.

Parameters
rhs:: mdevent to copy

Definition at line 212 of file MDLeanEvent.h.

References rhs.

Member Function Documentation

◆ convertToCoordinates()

template<size_t nd>
void Mantid::DataObjects::MDLeanEvent< nd >::convertToCoordinates ( const morton_index::MDSpaceBounds< nd > &  space)
inlineprivate

Calculate coordinates of the center of event from it Morton index in known space and oveerride index with coordinates in memory.

Parameters
space:: known space

Definition at line 132 of file MDLeanEvent.h.

References index.

◆ convertToIndex()

template<size_t nd>
void Mantid::DataObjects::MDLeanEvent< nd >::convertToIndex ( const morton_index::MDSpaceBounds< nd > &  space)
inlineprivate

Calculate Morton index for center coordinates for given space and ovveride the memory used for storing center with index.

Parameters
space:: given space

Definition at line 122 of file MDLeanEvent.h.

References index.

◆ dataToEvents()

template<size_t nd>
static void Mantid::DataObjects::MDLeanEvent< nd >::dataToEvents ( const std::vector< coord_t > &  coord,
std::vector< MDLeanEvent< nd > > &  events,
bool  reserveMemory = true 
)
inlinestatic

Definition at line 361 of file MDLeanEvent.h.

References Mantid::DataHandling::numEvents().

◆ eventsToData()

template<size_t nd>
static void Mantid::DataObjects::MDLeanEvent< nd >::eventsToData ( const std::vector< MDLeanEvent< nd > > &  mdLeanEvents,
std::vector< coord_t > &  data,
size_t &  ncols,
double &  totalSignal,
double &  totalErrSq 
)
inlinestatic

Definition at line 333 of file MDLeanEvent.h.

References Mantid::Geometry::d, and ncols.

◆ getCenter() [1/2]

template<size_t nd>
const coord_t * Mantid::DataObjects::MDLeanEvent< nd >::getCenter ( ) const
inline

Returns the array of coordinates.

Returns
pointer to the fixed-size array.

Definition at line 234 of file MDLeanEvent.h.

◆ getCenter() [2/2]

template<size_t nd>
coord_t Mantid::DataObjects::MDLeanEvent< nd >::getCenter ( const size_t  n) const
inline
Returns
the n-th coordinate axis value.
Parameters
n:: index (0-based) of the dimension you want.

Definition at line 228 of file MDLeanEvent.h.

References n.

◆ getCenterNonConst()

template<size_t nd>
coord_t * Mantid::DataObjects::MDLeanEvent< nd >::getCenterNonConst ( )
inline

Returns the array of coordinates, as a pointer to a non-const array.

Returns
pointer to the fixed-size array.

Definition at line 241 of file MDLeanEvent.h.

◆ getDetectorID()

template<size_t nd>
int32_t Mantid::DataObjects::MDLeanEvent< nd >::getDetectorID ( ) const
inline
Returns
the detectorId of this event. Always 0: this information is not present in a MDLeanEvent.

Definition at line 321 of file MDLeanEvent.h.

◆ getError()

template<size_t nd>
float Mantid::DataObjects::MDLeanEvent< nd >::getError ( ) const
inline

Returns the error (not squared) of this event.

Performance note: This calls sqrt(), which is a slow function. Use getErrorSquared() if possible.

Returns
the error (not squared) of this event.

Definition at line 291 of file MDLeanEvent.h.

◆ getErrorSquared()

template<size_t nd>
float Mantid::DataObjects::MDLeanEvent< nd >::getErrorSquared ( ) const
inline

Returns the error (squared) of this event.

Definition at line 282 of file MDLeanEvent.h.

◆ getExpInfoIndex()

template<size_t nd>
uint16_t Mantid::DataObjects::MDLeanEvent< nd >::getExpInfoIndex ( ) const
inline
Returns
the associated experiment-info index of this event in the containing MDEventWorkspace. Always 0: this information is not present in a MDLeanEvent.

Definition at line 310 of file MDLeanEvent.h.

◆ getGoniometerIndex()

template<size_t nd>
uint16_t Mantid::DataObjects::MDLeanEvent< nd >::getGoniometerIndex ( ) const
inline
Returns
the goniometer index of this event in the containing MDEventWorkspace. Always 0: this information is not present in a MDLeanEvent.

Definition at line 316 of file MDLeanEvent.h.

◆ getNumDims()

template<size_t nd>
size_t Mantid::DataObjects::MDLeanEvent< nd >::getNumDims ( ) const
inline

Returns the number of dimensions in the event.

Definition at line 272 of file MDLeanEvent.h.

◆ getSignal()

template<size_t nd>
float Mantid::DataObjects::MDLeanEvent< nd >::getSignal ( ) const
inline

Returns the signal (weight) of this event.

Definition at line 277 of file MDLeanEvent.h.

Referenced by Mantid::MDAlgorithms::MinusMD::doMinus().

◆ getTypeName()

template<size_t nd>
static std::string Mantid::DataObjects::MDLeanEvent< nd >::getTypeName ( )
inlinestatic

◆ operator=()

template<size_t nd>
MDLeanEvent & Mantid::DataObjects::MDLeanEvent< nd >::operator= ( MDLeanEvent< nd >  other)
inline

Definition at line 220 of file MDLeanEvent.h.

References Mantid::DataObjects::swap().

◆ setCenter()

template<size_t nd>
void Mantid::DataObjects::MDLeanEvent< nd >::setCenter ( const size_t  n,
const coord_t  value 
)
inline

Sets the n-th coordinate axis value.

Parameters
n:: index (0-based) of the dimension you want to set
value:: value to set.

Definition at line 248 of file MDLeanEvent.h.

References n, and value.

◆ setCoords()

template<size_t nd>
void Mantid::DataObjects::MDLeanEvent< nd >::setCoords ( const coord_t centers)
inline

Sets all the coordinates.

Parameters
centers:: pointer to a nd-sized array of the values to set.

Definition at line 264 of file MDLeanEvent.h.

◆ setErrorSquared()

template<size_t nd>
void Mantid::DataObjects::MDLeanEvent< nd >::setErrorSquared ( const float  newerrorSquared)
inline

Set the squared error of the event.

Parameters
newerrorSquared:: the error squared value

Definition at line 301 of file MDLeanEvent.h.

◆ setSignal()

template<size_t nd>
void Mantid::DataObjects::MDLeanEvent< nd >::setSignal ( const float  newSignal)
inline

Set the signal of the event.

Parameters
newSignal:: the signal value

Definition at line 296 of file MDLeanEvent.h.

Referenced by Mantid::MDAlgorithms::MinusMD::doMinus().

Friends And Related Function Documentation

◆ AccessFor

template<size_t nd>
template<class Accessor >
friend struct AccessFor
friend

Definition at line 89 of file MDLeanEvent.h.

◆ swap

template<size_t nd>
void swap ( MDLeanEvent< nd > &  first,
MDLeanEvent< nd > &  second 
)
friend

Member Data Documentation

◆ 

union { ... } Mantid::DataObjects::MDLeanEvent< nd >::@12

The N-dimensional coordinates of the center of the event.

A simple fixed-sized array of (floats or doubles). Second member is an index that can be utilized for faster creating the box structure

◆ center

template<size_t nd>
coord_t Mantid::DataObjects::MDLeanEvent< nd >::center[nd]

Definition at line 110 of file MDLeanEvent.h.

◆ errorSquared

template<size_t nd>
float Mantid::DataObjects::MDLeanEvent< nd >::errorSquared
protected

The square of the error carried in this event.

Will be 1.0 unless modified by arithmetic. The square is used for more efficient calculations.

Definition at line 101 of file MDLeanEvent.h.

Referenced by Mantid::DataObjects::swap().

◆ index

template<size_t nd>
MortonT Mantid::DataObjects::MDLeanEvent< nd >::index = 0

Definition at line 111 of file MDLeanEvent.h.

Referenced by Mantid::DataObjects::swap().

◆ signal

template<size_t nd>
float Mantid::DataObjects::MDLeanEvent< nd >::signal
protected

The signal (aka weight) from the neutron event.

Will be exactly 1.0 unless modified at some point.

Definition at line 95 of file MDLeanEvent.h.

Referenced by Mantid::DataObjects::swap().


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