Mantid
|
Templated class holding data about a neutron detection event in N-dimensions (for example, Qx, Qy, Qz, E). More...
#include <MDLeanEvent.h>
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_t * | getCenter () const |
Returns the array of coordinates. More... | |
coord_t | getCenter (const size_t n) const |
coord_t * | getCenterNonConst () |
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... | |
MDLeanEvent & | operator= (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) |
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)
nd | :: the number of dimensions that each MDLeanEvent will be tracking. an int > 0. |
Definition at line 60 of file MDLeanEvent.h.
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.
using Mantid::DataObjects::MDLeanEvent< nd >::MortonT = typename morton_index::IndexTypes<nd, coord_t>::MortonType |
Definition at line 66 of file MDLeanEvent.h.
anonymous enum |
Enumerator | |
---|---|
is_full_mdevent |
Definition at line 143 of file MDLeanEvent.h.
|
inline |
Empty constructor.
Definition at line 147 of file MDLeanEvent.h.
|
inline |
Constructor with signal and error.
signal | :: signal (aka weight) |
errorSquared | :: square of the error on the weight |
Definition at line 155 of file MDLeanEvent.h.
|
inline |
Constructor with signal and error.
signal | :: signal (aka weight) |
errorSquared | :: square of the error on the weight |
Definition at line 164 of file MDLeanEvent.h.
|
inline |
Constructor with signal and error and an array of centers.
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.
|
inline |
Constructor with signal and error and an array of centers.
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.
|
inline |
Copy constructor.
rhs | :: mdevent to copy |
Definition at line 212 of file MDLeanEvent.h.
References rhs.
|
inlineprivate |
Calculate coordinates of the center of event from it Morton index in known space and oveerride index with coordinates in memory.
space | :: known space |
Definition at line 132 of file MDLeanEvent.h.
References index.
|
inlineprivate |
Calculate Morton index for center coordinates for given space and ovveride the memory used for storing center with index.
space | :: given space |
Definition at line 122 of file MDLeanEvent.h.
References index.
|
inlinestatic |
Definition at line 361 of file MDLeanEvent.h.
References Mantid::DataHandling::numEvents().
|
inlinestatic |
Definition at line 333 of file MDLeanEvent.h.
References Mantid::Geometry::d, and ncols.
|
inline |
Returns the array of coordinates.
Definition at line 234 of file MDLeanEvent.h.
|
inline |
n | :: index (0-based) of the dimension you want. |
Definition at line 228 of file MDLeanEvent.h.
References n.
|
inline |
Returns the array of coordinates, as a pointer to a non-const array.
Definition at line 241 of file MDLeanEvent.h.
|
inline |
Definition at line 321 of file MDLeanEvent.h.
|
inline |
Returns the error (not squared) of this event.
Performance note: This calls sqrt(), which is a slow function. Use getErrorSquared() if possible.
Definition at line 291 of file MDLeanEvent.h.
|
inline |
Returns the error (squared) of this event.
Definition at line 282 of file MDLeanEvent.h.
|
inline |
Definition at line 310 of file MDLeanEvent.h.
|
inline |
Definition at line 316 of file MDLeanEvent.h.
|
inline |
Returns the number of dimensions in the event.
Definition at line 272 of file MDLeanEvent.h.
|
inline |
Returns the signal (weight) of this event.
Definition at line 277 of file MDLeanEvent.h.
Referenced by Mantid::MDAlgorithms::MinusMD::doMinus().
|
inlinestatic |
Definition at line 305 of file MDLeanEvent.h.
Referenced by Mantid::DataObjects::BoxControllerNeXusIO::BoxControllerNeXusIO(), Mantid::MDAlgorithms::SliceMD::doExec(), Mantid::MDAlgorithms::LoadMD::doLoad(), and Mantid::MDAlgorithms::SaveMD::doSaveEvents().
|
inline |
Definition at line 220 of file MDLeanEvent.h.
References Mantid::DataObjects::swap().
|
inline |
Sets the n-th coordinate axis value.
n | :: index (0-based) of the dimension you want to set |
value | :: value to set. |
Definition at line 248 of file MDLeanEvent.h.
|
inline |
Sets all the coordinates.
centers | :: pointer to a nd-sized array of the values to set. |
Definition at line 264 of file MDLeanEvent.h.
|
inline |
Set the squared error of the event.
newerrorSquared | :: the error squared value |
Definition at line 301 of file MDLeanEvent.h.
|
inline |
Set the signal of the event.
newSignal | :: the signal value |
Definition at line 296 of file MDLeanEvent.h.
Referenced by Mantid::MDAlgorithms::MinusMD::doMinus().
Definition at line 89 of file MDLeanEvent.h.
|
friend |
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
coord_t Mantid::DataObjects::MDLeanEvent< nd >::center[nd] |
Definition at line 110 of file MDLeanEvent.h.
|
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().
MortonT Mantid::DataObjects::MDLeanEvent< nd >::index = 0 |
Definition at line 111 of file MDLeanEvent.h.
Referenced by Mantid::DataObjects::swap().
|
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().