14#include "MantidMDAlgorithms/DllConfig.h"
18#include <unordered_map>
27namespace MDAlgorithms {
39 :
a(static_cast<int64_t>(q[0] / cellSize)),
b(static_cast<int64_t>(q[1] / cellSize)),
40 c(static_cast<int64_t>(q[2] / cellSize)) {}
46 int64_t
getHash() {
return 1000000000000 *
a + 100000000 *
b + 10000 *
c; }
51 std::vector<int64_t> neighbors;
52 for (int64_t ia =
a - 1; ia <=
a + 1; ia++)
53 for (int64_t ib =
b - 1; ib <=
b + 1; ib++)
54 for (int64_t ic =
c - 1; ic <=
c + 1; ic++) {
55 int64_t key = 1000000000000 * ia + 100000000 * ib + 10000 * ic;
56 neighbors.emplace_back(key);
99 const bool useOnePercentBackgroundCorrection =
true);
102 static bool isOrigin(
const V3D &q,
const double &cellSize);
105 void setRadius(
const double &
radius);
147 PeakShape_const_sptr ellipseIntegrateEvents(
const std::vector<V3D> &E1Vec,
V3D const &peak_q,
bool specify_size,
148 double peak_radius,
double back_inner_radius,
double back_outer_radius,
149 std::vector<double> &axes_radii,
double &inti,
double &sigi,
150 std::pair<double, double> &backi);
158 void populateCellsWithPeaks();
172 static std::pair<double, double> numInEllipsoid(
SlimEvents const &events, std::vector<V3D>
const &directions,
173 std::vector<double>
const &sizes);
190 static std::pair<double, double> numInEllipsoidBkg(
SlimEvents const &events, std::vector<V3D>
const &directions,
191 std::vector<double>
const &sizes,
192 std::vector<double>
const &sizesIn,
193 const bool useOnePercentBackgroundCorrection);
222 static void getEigenVectors(
Kernel::DblMatrix const &cov_matrix, std::vector<V3D> &eigen_vectors,
223 std::vector<double> &eigen_values);
261 SlimEvents const &ev_list, std::vector<V3D>
const &directions,
262 std::vector<double>
const &sigmas,
bool specify_size,
263 double peak_radius,
double back_inner_radius,
264 double back_outer_radius, std::vector<double> &axes_radii,
265 double &inti,
double &sigi, std::pair<double, double> &backi);
278 double detectorQ(
const std::vector<V3D> &E1Vec,
const V3D &QLabFrame,
const std::vector<double> &r);
This is a low-level class to construct a map with lists of events near each peak Q-vector in the lab ...
std::unordered_map< size_t, SlimEvents > m_cellsWithEvents
list of cells occupied with events
double m_cellSize
size of the square cell unit, holding at most one single peak
const bool m_useOnePercentBackgroundCorrection
if one percent culling of the background should be performed.
std::unordered_map< size_t, OccupiedCell > m_cellsWithPeaks
list the occupied cells in an unordered map for fast searching
std::shared_ptr< const PeakShapeEllipsoid > PeakShapeEllipsoid_const_sptr
std::shared_ptr< const PeakShape > PeakShape_const_sptr
std::vector< SlimEvent > SlimEvents
std::pair< std::pair< double, double >, V3D > SlimEvent
Helper class which provides the Collimation Length for SANS instruments.
Partition QLab space into a cubic lattice.
bool isOrigin()
Check if all cell coords are zero.
std::vector< int64_t > nearbyCellHashes()
Hashes for the 26 first neighbor coordinates plus the coordinates themselves.
CellCoords(const V3D &q, const double cellSize)
int64_t getHash()
cast coordinates to scalar, to be used as key in an unordered map