19namespace DataObjects {
21#ifndef __INTEL_COMPILER
73 void setFileBacked(
const uint64_t ,
const size_t ,
const bool )
override;
97 bool isBox()
const override {
return true; }
103 void setChildren(
const std::vector<API::IMDNode *> & ,
const size_t ,
104 const size_t )
override {
105 throw std::runtime_error(
"MDBox cannot have children.");
132 void getEventsData(std::vector<coord_t> &coordTable,
size_t &nColumns)
const override;
139 size_t addEvents(
const std::vector<MDE> &events)
override;
146 uint16_t expInfoIndex, uint16_t goniometerIndex, uint32_t detectorId)
override;
148 uint16_t expInfoIndex, uint16_t goniometernIndex, uint32_t detectorId)
override;
149 size_t buildAndAddEvents(
const std::vector<signal_t> &sigErrSq,
const std::vector<coord_t> &Coord,
150 const std::vector<uint16_t> &expInfoIndex,
const std::vector<uint16_t> &goniometernIndex,
151 const std::vector<uint32_t> &detectorId)
override;
170 const bool useOnePercentBackgroundCorrection =
true)
const override;
174 signal_t &signal,
signal_t &errorSquared, std::vector<signal_t> &signal_fit)
const override;
178 void getBoxes(std::vector<API::IMDNode *> &boxes,
size_t ,
bool )
override;
182 void getBoxes(std::vector<API::IMDNode *> &boxes,
size_t maxDepth,
bool leafOnly,
185 void getBoxes(std::vector<API::IMDNode *> &outBoxes,
const std::function<
bool(
API::IMDNode *)> &cond)
final override;
218 using sptr = std::shared_ptr<MDBox<MDE, nd>>;
224#ifndef __INTEL_COMPILER
231template <
typename MDE,
size_t nd>
struct IF {
235 static inline void EXEC(std::vector<MDE> &data,
const std::vector<signal_t> &sigErrSq,
236 const std::vector<coord_t> &Coord,
const std::vector<uint16_t> &expInfoIndex,
237 const std::vector<uint16_t> &goniometerIndex,
const std::vector<uint32_t> &detectorId,
239 for (
size_t i = 0; i < nEvents; i++) {
240 data.emplace_back(sigErrSq[2 * i], sigErrSq[2 * i + 1], expInfoIndex[i], goniometerIndex[i], detectorId[i],
246 const uint16_t expInfoIndex,
const uint16_t goniometerIndex,
247 const uint32_t detectorId) {
248 return MDE(Signal, Error, expInfoIndex, goniometerIndex, detectorId, Coord);
256 const std::vector<coord_t> &Coord,
const std::vector<uint16_t> & ,
257 const std::vector<uint16_t> & ,
258 const std::vector<uint32_t> & ,
size_t nEvents) {
259 for (
size_t i = 0; i < nEvents; i++) {
260 data.emplace_back(sigErrSq[2 * i], sigErrSq[2 * i + 1], &Coord[i * nd]);
265 const uint16_t ,
const uint16_t ,
#define TMDE_CLASS
Macro to make declaring template classes faster.
This class is used by MDBox and MDGridBox in order to intelligently determine optimal behavior.
The header describes interface to IO Operations perfomed by the box controller May be replaced by a b...
MDBin : Class describing a single bin in a dense, Multidimensional histogram.
Templated super-class of a multi-dimensional event "box".
Templated class for a multi-dimensional event "box".
void loadAndAddFrom(API::IBoxControllerIO *const, uint64_t, size_t, std::vector< coord_t > &) override
void generalBin(MDBin< MDE, nd > &bin, Mantid::Geometry::MDImplicitFunction &function) const override
General binning method for any shape.
void setEventsData(const std::vector< coord_t > &coordTable) override
void loadAndAddFrom(API::IBoxControllerIO *const, uint64_t, size_t) override
std::vector< MDE > vec_t
Typedef for a vector of the conatined events.
void saveAt(API::IBoxControllerIO *const, uint64_t) const override
Kernel::ISaveable * getISaveable() override
bool getIsMasked() const override
bool m_bIsMasked
Flag indicating that masking has been applied.
void calculateCentroid(coord_t *centroid, const int expInfoIndex) const override
size_t getNumChildren() const override
Get the # of children MDBoxBase'es (non-recursive)
void mask() override
Setter for masking the box.
void unmask() override
Setter for unmasking the box.
API::IMDNode * getChild(size_t) override
Return the indexth child MDBoxBase.
const std::vector< MDE > & getConstEvents() const
Get vector of constant events to use.
coord_t * getCentroid() const override
void getBoxes(std::vector< MDBoxBase< MDE, nd > * > &boxes, size_t, bool)
void reserveMemoryForLoad(uint64_t) override
size_t buildAndAddEvents(const std::vector< signal_t > &sigErrSq, const std::vector< coord_t > &Coord, const std::vector< uint16_t > &expInfoIndex, const std::vector< uint16_t > &goniometernIndex, const std::vector< uint32_t > &detectorId) override
void calculateCentroid(coord_t *centroid) const override
const std::vector< MDE > & getEvents() const
bool isBox() const override
MDBox(Mantid::API::BoxController *const bc, const uint32_t depth, const std::vector< Mantid::Geometry::MDDimensionExtents< coord_t > > &extentsVector, EventIterator begin, EventIterator end)
size_t addEvent(const MDE &Evnt) override
Add a single event.
size_t getNumDims() const override
void transformDimensions(std::vector< double > &scaling, std::vector< double > &offset) override
MDBox(Mantid::API::BoxController *const splitter, const uint32_t depth=0, const size_t nBoxEvents=UNDEF_SIZET, const size_t boxID=UNDEF_SIZET)
MDBox(Mantid::API::BoxController *const splitter, const uint32_t depth, const std::vector< Mantid::Geometry::MDDimensionExtents< coord_t > > &extentsVector, const size_t nBoxEvents=UNDEF_SIZET, const size_t boxID=UNDEF_SIZET)
MDBox(Mantid::API::BoxController_sptr &splitter, const uint32_t depth, const std::vector< Mantid::Geometry::MDDimensionExtents< coord_t > > &extentsVector, const size_t nBoxEvents=UNDEF_SIZET, const size_t boxID=UNDEF_SIZET)
void splitAllIfNeeded(Mantid::Kernel::ThreadScheduler *=nullptr) override
std::unique_ptr< Kernel::ISaveable > m_Saveable
size_t addEventUnsafe(const MDE &Evnt) override
Add a single event, with no mutex locking.
size_t addEvents(const std::vector< MDE > &events) override
uint64_t getNPoints() const override
void getEventsData(std::vector< coord_t > &coordTable, size_t &nColumns) const override
void getBoxes(std::vector< API::IMDNode * > &boxes, size_t maxDepth, bool leafOnly, Mantid::Geometry::MDImplicitFunction *function) override
MDBox(const MDBox< MDE, nd > &other, Mantid::API::BoxController *const otherBC)
void getBoxes(std::vector< API::IMDNode * > &boxes, size_t, bool) override
std::vector< MDE > & getEvents()
Get vector of events to change.
size_t addEventsUnsafe(const std::vector< MDE > &events) override
void getBoxes(std::vector< API::IMDNode * > &outBoxes, const std::function< bool(API::IMDNode *)> &cond) final override
void integrateSphere(Mantid::API::CoordTransform &radiusTransform, const coord_t radiusSquared, signal_t &signal, signal_t &errorSquared, const coord_t innerRadiusSquared=0.0, const bool useOnePercentBackgroundCorrection=true) const override
Sphere (peak) integration.
uint64_t getTotalDataSize() const override
std::shared_ptr< MDBox< MDE, nd > > sptr
Typedef for a shared pointer to a MDBox.
void initMDBox(const size_t nBoxEvents)
common part of mdBox constructor
Kernel::ISaveable * getISaveable() const override
std::vector< MDE > * getEventsCopy() override
Return a copy of contained events.
MDBox(Mantid::API::BoxController_sptr &splitter, const uint32_t depth=0, const size_t nBoxEvents=UNDEF_SIZET, const size_t boxID=UNDEF_SIZET)
void setFileBacked(const uint64_t, const size_t, const bool) override
void centerpointBin(MDBin< MDE, nd > &bin, bool *fullyContained) const override
Perform centerpoint binning of events.
void clearFileBacked(bool loadDiskBackedData) override
void buildAndAddEventUnsafe(const signal_t Signal, const signal_t errorSq, const std::vector< coord_t > &point, uint16_t expInfoIndex, uint16_t goniometernIndex, uint32_t detectorId) override
void refreshCache(Kernel::ThreadScheduler *=nullptr) override
Recalculate signal and various averages dependent on signal and the signal coordinates.
std::vector< coord_t > m_tableData
member to avoid reallocation
void clearDataFromMemory() override
drop events data from memory but keep averages (and file-backed info)
void calculateDimensionStats(MDDimensionStats *stats) const
void getBoxes(std::vector< MDBoxBase< MDE, nd > * > &boxes, size_t maxDepth, bool leafOnly, Mantid::Geometry::MDImplicitFunction *function)
void setChildren(const std::vector< API::IMDNode * > &, const size_t, const size_t) override
Sets the children from a vector of children.
void centroidSphere(Mantid::API::CoordTransform &radiusTransform, const coord_t radiusSquared, coord_t *centroid, signal_t &signal) const override
Find the centroid around a sphere.
void integrateCylinder(Mantid::API::CoordTransform &radiusTransform, const coord_t radius, const coord_t length, signal_t &signal, signal_t &errorSquared, std::vector< signal_t > &signal_fit) const override
Cylinder (peak) integration.
void buildAndAddEvent(const signal_t Signal, const signal_t errorSq, const std::vector< coord_t > &point, uint16_t expInfoIndex, uint16_t goniometerIndex, uint32_t detectorId) override
std::vector< MDE > data
Vector of MDEvent's, in no particular order.
size_t getNumMDBoxes() const override
typename std::vector< MDE >::const_iterator EventIterator
void setFileBacked() override
size_t getDataInMemorySize() const override
MDBox(const MDBox &)
private default copy constructor as the only correct constructor is the one with the boxController;
A simple class holding some statistics on the distribution of events in a particular dimension.
Templated class holding data about a neutron detection event in N-dimensions (for example,...
Simple class that holds the extents (min/max) of a given dimension in a MD workspace or MDBox.
An "ImplicitFunction" defining a hyper-cuboid-shaped region in N dimensions.
An interface for objects that can be cached or saved to disk.
The ThreadScheduler object defines how tasks are allocated to threads and in what order.
std::shared_ptr< BoxController > BoxController_sptr
Shared ptr to BoxController.
Helper class which provides the Collimation Length for SANS instruments.
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
double signal_t
Typedef for the signal recorded in a MDBox, etc.
static MDLeanEvent< nd > BUILD_EVENT(const signal_t Signal, const signal_t Error, const coord_t *Coord, const uint16_t, const uint16_t, const uint32_t)
static void EXEC(std::vector< MDLeanEvent< nd > > &data, const std::vector< signal_t > &sigErrSq, const std::vector< coord_t > &Coord, const std::vector< uint16_t > &, const std::vector< uint16_t > &, const std::vector< uint32_t > &, size_t nEvents)
static MDE BUILD_EVENT(const signal_t Signal, const signal_t Error, const coord_t *Coord, const uint16_t expInfoIndex, const uint16_t goniometerIndex, const uint32_t detectorId)
static void EXEC(std::vector< MDE > &data, const std::vector< signal_t > &sigErrSq, const std::vector< coord_t > &Coord, const std::vector< uint16_t > &expInfoIndex, const std::vector< uint16_t > &goniometerIndex, const std::vector< uint32_t > &detectorId, size_t nEvents)