Commit 9b73e8d2 authored by Lynch, Vickie's avatar Lynch, Vickie
Browse files

Refs #22420 number peaks by banks

parent 35a948e3
......@@ -41,7 +41,9 @@ namespace Crystal {
class DLLExport PredictSatellitePeaks : public API::Algorithm {
public:
/// Algorithm's name for identification
const std::string name() const override { return "PredictSatellitePeaks"; };
const std::string name() const override {
return "PredictSatellitePeaks";
};
/// Summary of algorithms purpose
const std::string summary() const override {
return "The offsets can be from hkl values in a range of hkl values or "
......@@ -49,9 +51,11 @@ public:
}
/// Algorithm's version for identification
int version() const override { return 1; };
int version() const override {
return 1;
};
const std::vector<std::string> seeAlso() const override {
return {"PredictPeaks"};
return { "PredictPeaks" };
}
/// Algorithm's category for identification
......@@ -71,17 +75,16 @@ private:
int iVector, Kernel::V3D offsets, int &maxOrder,
Kernel::V3D &hkl,
Geometry::HKLFilterWavelength &lambdaFilter,
bool &includePeaksInRange, bool &includeOrderZero,
int &seqNum,
std::vector<std::vector<int>> &AlreadyDonePeaks);
bool &includePeaksInRange, bool includeOrderZero,
std::vector<std::vector<int> > &AlreadyDonePeaks);
void predictOffsetsWithCrossTerms(
DataObjects::PeaksWorkspace_sptr Peaks,
boost::shared_ptr<Mantid::API::IPeaksWorkspace> &OutPeaks,
Kernel::V3D offsets1, Kernel::V3D offsets2, Kernel::V3D offsets3,
int &maxOrder, Kernel::V3D &hkl,
Geometry::HKLFilterWavelength &lambdaFilter, bool &includePeaksInRange,
bool &includeOrderZero, int &seqNum,
std::vector<std::vector<int>> &AlreadyDonePeaks);
bool &includeOrderZero,
std::vector<std::vector<int> > &AlreadyDonePeaks);
};
} // namespace Crystal
......
This diff is collapsed.
......@@ -143,10 +143,10 @@ void PredictSatellitePeaks::exec() {
const auto instrument = Peaks->getInstrument();
auto OutPeaks = boost::dynamic_pointer_cast<IPeaksWorkspace>(
auto outPeaks = boost::dynamic_pointer_cast<IPeaksWorkspace>(
WorkspaceFactory::Instance().createPeaks());
OutPeaks->setInstrument(instrument);
OutPeaks->mutableSample().setOrientedLattice(&lattice);
outPeaks->setInstrument(instrument);
outPeaks->mutableSample().setOrientedLattice(&lattice);
Kernel::Matrix<double> goniometer;
goniometer.identityMatrix();
......@@ -183,33 +183,45 @@ void PredictSatellitePeaks::exec() {
vector<vector<int> > AlreadyDonePeaks;
auto orientedUB = goniometer * UB;
HKLFilterWavelength lambdaFilter(orientedUB, lambdaMin, lambdaMax);
int seqNum = 0;
OutPeaks->mutableRun().addProperty<std::vector<double> >("Offset1", offsets1,
outPeaks->mutableRun().addProperty<std::vector<double> >("Offset1", offsets1,
true);
OutPeaks->mutableRun().addProperty<std::vector<double> >("Offset2", offsets2,
outPeaks->mutableRun().addProperty<std::vector<double> >("Offset2", offsets2,
true);
OutPeaks->mutableRun().addProperty<std::vector<double> >("Offset3", offsets3,
outPeaks->mutableRun().addProperty<std::vector<double> >("Offset3", offsets3,
true);
for (auto it = possibleHKLs.begin(); it != possibleHKLs.end(); ++it) {
V3D hkl = *it;
if (crossTerms) {
predictOffsetsWithCrossTerms(Peaks, OutPeaks, offsets1, offsets2,
predictOffsetsWithCrossTerms(Peaks, outPeaks, offsets1, offsets2,
offsets3, maxOrder, hkl, lambdaFilter,
includePeaksInRange, includeOrderZero,
seqNum, AlreadyDonePeaks);
AlreadyDonePeaks);
} else {
predictOffsets(Peaks, OutPeaks, 0, offsets1, maxOrder, hkl, lambdaFilter,
includePeaksInRange, includeOrderZero, seqNum,
predictOffsets(Peaks, outPeaks, 0, offsets1, maxOrder, hkl, lambdaFilter,
includePeaksInRange, includeOrderZero,
AlreadyDonePeaks);
predictOffsets(Peaks, OutPeaks, 1, offsets2, maxOrder, hkl, lambdaFilter,
includePeaksInRange, includeOrderZero, seqNum,
predictOffsets(Peaks, outPeaks, 1, offsets2, maxOrder, hkl, lambdaFilter,
includePeaksInRange, includeOrderZero,
AlreadyDonePeaks);
predictOffsets(Peaks, OutPeaks, 2, offsets3, maxOrder, hkl, lambdaFilter,
includePeaksInRange, includeOrderZero, seqNum,
predictOffsets(Peaks, outPeaks, 2, offsets3, maxOrder, hkl, lambdaFilter,
includePeaksInRange, includeOrderZero,
AlreadyDonePeaks);
}
}
setProperty("SatellitePeaks", OutPeaks);
// Sort peaks by run number so that peaks with equal goniometer matrices are
// adjacent
std::vector<std::pair<std::string, bool>> criteria;
criteria.push_back(std::pair<std::string, bool>("RunNumber", true));
criteria.push_back(std::pair<std::string, bool>("BankName", true));
criteria.push_back(std::pair<std::string, bool>("h", true));
criteria.push_back(std::pair<std::string, bool>("k", true));
criteria.push_back(std::pair<std::string, bool>("l", true));
outPeaks->sort(criteria);
for (int i = 0; i < static_cast<int>(outPeaks->getNumberPeaks()); ++i) {
outPeaks->getPeak(i).setPeakNumber(i);
}
setProperty("SatellitePeaks", outPeaks);
}
void PredictSatellitePeaks::exec_peaks() {
......@@ -238,47 +250,60 @@ void PredictSatellitePeaks::exec_peaks() {
const auto instrument = Peaks->getInstrument();
auto OutPeaks = boost::dynamic_pointer_cast<IPeaksWorkspace>(
auto outPeaks = boost::dynamic_pointer_cast<IPeaksWorkspace>(
WorkspaceFactory::Instance().createPeaks());
OutPeaks->setInstrument(instrument);
OutPeaks->mutableSample().setOrientedLattice(&lattice);
outPeaks->setInstrument(instrument);
outPeaks->mutableSample().setOrientedLattice(&lattice);
vector<vector<int> > AlreadyDonePeaks;
int seqNum = 0;
HKLFilterWavelength lambdaFilter(DblMatrix(3, 3, true), 0.1, 100.);
OutPeaks->mutableRun().addProperty<std::vector<double> >("Offset1", offsets1,
outPeaks->mutableRun().addProperty<std::vector<double> >("Offset1", offsets1,
true);
OutPeaks->mutableRun().addProperty<std::vector<double> >("Offset2", offsets2,
outPeaks->mutableRun().addProperty<std::vector<double> >("Offset2", offsets2,
true);
OutPeaks->mutableRun().addProperty<std::vector<double> >("Offset3", offsets3,
outPeaks->mutableRun().addProperty<std::vector<double> >("Offset3", offsets3,
true);
std::vector<Peak> peaks = Peaks->getPeaks();
for (auto it = peaks.begin(); it != peaks.end(); ++it) {
auto peak = *it;
V3D hkl = peak.getHKL();
if (crossTerms) {
predictOffsetsWithCrossTerms(Peaks, OutPeaks, offsets1, offsets2,
predictOffsetsWithCrossTerms(Peaks, outPeaks, offsets1, offsets2,
offsets3, maxOrder, hkl, lambdaFilter,
includePeaksInRange, includeOrderZero,
seqNum, AlreadyDonePeaks);
AlreadyDonePeaks);
} else {
predictOffsets(Peaks, OutPeaks, 0, offsets1, maxOrder, hkl, lambdaFilter,
includePeaksInRange, includeOrderZero, seqNum,
predictOffsets(Peaks, outPeaks, 0, offsets1, maxOrder, hkl, lambdaFilter,
includePeaksInRange, includeOrderZero,
AlreadyDonePeaks);
predictOffsets(Peaks, OutPeaks, 1, offsets2, maxOrder, hkl, lambdaFilter,
includePeaksInRange, false, seqNum, AlreadyDonePeaks);
predictOffsets(Peaks, OutPeaks, 2, offsets3, maxOrder, hkl, lambdaFilter,
includePeaksInRange, false, seqNum, AlreadyDonePeaks);
predictOffsets(Peaks, outPeaks, 1, offsets2, maxOrder, hkl, lambdaFilter,
includePeaksInRange, false, AlreadyDonePeaks);
predictOffsets(Peaks, outPeaks, 2, offsets3, maxOrder, hkl, lambdaFilter,
includePeaksInRange, false, AlreadyDonePeaks);
}
}
setProperty("SatellitePeaks", OutPeaks);
// Sort peaks by run number so that peaks with equal goniometer matrices are
// adjacent
std::vector<std::pair<std::string, bool>> criteria;
criteria.push_back(std::pair<std::string, bool>("RunNumber", true));
criteria.push_back(std::pair<std::string, bool>("BankName", true));
criteria.push_back(std::pair<std::string, bool>("h", true));
criteria.push_back(std::pair<std::string, bool>("k", true));
criteria.push_back(std::pair<std::string, bool>("l", true));
outPeaks->sort(criteria);
for (int i = 0; i < static_cast<int>(outPeaks->getNumberPeaks()); ++i) {
outPeaks->getPeak(i).setPeakNumber(i);
}
setProperty("SatellitePeaks", outPeaks);
}
void PredictSatellitePeaks::predictOffsets(
DataObjects::PeaksWorkspace_sptr Peaks,
boost::shared_ptr<Mantid::API::IPeaksWorkspace> &OutPeaks, int iVector,
boost::shared_ptr<Mantid::API::IPeaksWorkspace> &outPeaks, int iVector,
V3D offsets, int &maxOrder, V3D &hkl, HKLFilterWavelength &lambdaFilter,
bool &includePeaksInRange, bool &includeOrderZero, int &seqNum,
bool &includePeaksInRange, bool includeOrderZero,
vector<vector<int> > &AlreadyDonePeaks) {
if (offsets == V3D(0, 0, 0))
return;
......@@ -324,22 +349,20 @@ void PredictSatellitePeaks::predictOffsets(
peak->setHKL(satelliteHKL);
peak->setIntHKL(hkl);
peak->setPeakNumber(seqNum);
seqNum++;
peak->setRunNumber(RunNumber);
V3D mnp;
mnp[iVector] = order;
peak->setIntMNP(mnp);
OutPeaks->addPeak(*peak);
outPeaks->addPeak(*peak);
}
}
void PredictSatellitePeaks::predictOffsetsWithCrossTerms(
DataObjects::PeaksWorkspace_sptr Peaks,
boost::shared_ptr<Mantid::API::IPeaksWorkspace> &OutPeaks, V3D offsets1,
boost::shared_ptr<Mantid::API::IPeaksWorkspace> &outPeaks, V3D offsets1,
V3D offsets2, V3D offsets3, int &maxOrder, V3D &hkl,
HKLFilterWavelength &lambdaFilter, bool &includePeaksInRange,
bool &includeOrderZero, int &seqNum,
bool &includeOrderZero,
vector<vector<int> > &AlreadyDonePeaks) {
if (offsets1 == V3D(0, 0, 0) && offsets2 == V3D(0, 0, 0) &&
offsets3 == V3D(0, 0, 0))
......@@ -401,11 +424,9 @@ void PredictSatellitePeaks::predictOffsetsWithCrossTerms(
peak->setHKL(satelliteHKL);
peak->setIntHKL(hkl);
peak->setPeakNumber(seqNum);
seqNum++;
peak->setRunNumber(RunNumber);
peak->setIntMNP(V3D(m, n, p));
OutPeaks->addPeak(*peak);
outPeaks->addPeak(*peak);
}
}
......
......@@ -55,6 +55,7 @@ set ( SRC_FILES
src/ImportMDHistoWorkspaceBase.cpp
src/Integrate3DEvents.cpp
src/IntegrateEllipsoids.cpp
src/IntegrateEllipsoidsWithSatellites.cpp
src/IntegrateEllipsoidsTwoStep.cpp
src/IntegrateFlux.cpp
src/IntegrateMDHistoWorkspace.cpp
......@@ -185,6 +186,7 @@ set ( INC_FILES
inc/MantidMDAlgorithms/ImportMDHistoWorkspaceBase.h
inc/MantidMDAlgorithms/Integrate3DEvents.h
inc/MantidMDAlgorithms/IntegrateEllipsoids.h
inc/MantidMDAlgorithms/IntegrateEllipsoidsWithSatellites.h
inc/MantidMDAlgorithms/IntegrateEllipsoidsTwoStep.h
inc/MantidMDAlgorithms/IntegrateFlux.h
inc/MantidMDAlgorithms/IntegrateMDHistoWorkspace.h
......
......@@ -13,181 +13,192 @@
#include <vector>
namespace Mantid {
namespace Geometry {
class PeakShape;
}
namespace DataObjects {
class PeakShapeEllipsoid;
}
namespace MDAlgorithms {
struct IntegrationParameters {
std::vector<Kernel::V3D> E1Vectors;
double backgroundInnerRadius;
double backgroundOuterRadius;
double regionRadius;
double peakRadius;
bool specifySize;
};
/**
@class Integrate3DEvents
This is a low-level class to construct a map with lists of events near
each peak Q-vector, shifted to be centered at (0,0,0). A method is also
provided to find the principal axes of such a list of events, and to
find the net integrated counts, using ellipsoids with axis lengths
determined from the standard deviations in the directions of the
principal axes.
@author Dennis Mikkelson
@date 2012-12-19
Copyright © 2012 ORNL, STFC Rutherford Appleton Laboratories
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at:
<https://github.com/mantidproject/mantid>
Code Documentation is available at
<http://doxygen.mantidproject.org>
*/
using EventListMap =
std::unordered_map<int64_t,
std::vector<std::pair<double, Mantid::Kernel::V3D>>>;
using PeakQMap = std::unordered_map<int64_t, Mantid::Kernel::V3D>;
class DLLExport Integrate3DEvents {
public:
/// Construct object to store events around peaks and integrate peaks
Integrate3DEvents(
std::vector<std::pair<double, Mantid::Kernel::V3D>> const &peak_q_list,
Kernel::DblMatrix const &UBinv, double radius,
const bool useOnePercentBackgroundCorrection = true);
/// Add event Q's to lists of events near peaks
void
addEvents(std::vector<std::pair<double, Mantid::Kernel::V3D>> const &event_qs,
bool hkl_integ);
/// Find the net integrated intensity of a peak, using ellipsoidal volumes
boost::shared_ptr<const Mantid::Geometry::PeakShape> ellipseIntegrateEvents(
std::vector<Kernel::V3D> E1Vec, Mantid::Kernel::V3D const &peak_q,
bool specify_size, double peak_radius, double back_inner_radius,
double back_outer_radius, std::vector<double> &axes_radii, double &inti,
double &sigi);
/// Find the net integrated intensity of a peak, using ellipsoidal volumes
std::pair<boost::shared_ptr<const Mantid::Geometry::PeakShape>,
namespace Geometry {
class PeakShape;
}
namespace DataObjects {
class PeakShapeEllipsoid;
}
namespace MDAlgorithms {
struct IntegrationParameters {
std::vector<Kernel::V3D> E1Vectors;
double backgroundInnerRadius;
double backgroundOuterRadius;
double regionRadius;
double peakRadius;
bool specifySize;
};
/**
@class Integrate3DEvents
This is a low-level class to construct a map with lists of events near
each peak Q-vector, shifted to be centered at (0,0,0). A method is also
provided to find the principal axes of such a list of events, and to
find the net integrated counts, using ellipsoids with axis lengths
determined from the standard deviations in the directions of the
principal axes.
@author Dennis Mikkelson
@date 2012-12-19
Copyright © 2012 ORNL, STFC Rutherford Appleton Laboratories
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at:
<https://github.com/mantidproject/mantid>
Code Documentation is available at
<http://doxygen.mantidproject.org>
*/
using EventListMap =
std::unordered_map<int64_t,
std::vector<std::pair<double, Mantid::Kernel::V3D>>>;
using PeakQMap = std::unordered_map<int64_t, Mantid::Kernel::V3D>;
class DLLExport Integrate3DEvents {
public:
/// Construct object to store events around peaks and integrate peaks
Integrate3DEvents(std::vector<std::pair<double, Mantid::Kernel::V3D>> const &peak_q_list,
Kernel::DblMatrix const &UBinv, double radius,
const bool useOnePercentBackgroundCorrection = true);
Integrate3DEvents(std::vector<std::pair<double, Mantid::Kernel::V3D>> const &peak_q_list,std::vector<Mantid::Kernel::V3D> const &hkl_list,std::vector<Mantid::Kernel::V3D> const &mnp_list, Kernel::DblMatrix const &UBinv, Kernel::DblMatrix const &ModHKL, double radius_m, double radius_s, int MaxO, const bool CrossT, const bool useOnePercentBackgroundCorrection = true);
/// Add event Q's to lists of events near peaks
void
addEvents(std::vector<std::pair<double, Mantid::Kernel::V3D>> const &event_qs,
bool hkl_integ);
/// Find the net integrated intensity of a peak, using ellipsoidal volumes
boost::shared_ptr<const Mantid::Geometry::PeakShape> ellipseIntegrateEvents(std::vector<Kernel::V3D> E1Vec, Mantid::Kernel::V3D const &peak_q,bool specify_size, double peak_radius, double back_inner_radius,double back_outer_radius, std::vector<double> &axes_radii, double &inti,double &sigi);
/// Find the net integrated intensity of a modulated peak, using ellipsoidal volumes
boost::shared_ptr<const Mantid::Geometry::PeakShape> ellipseIntegrateModEvents(std::vector<Kernel::V3D> E1Vec, Mantid::Kernel::V3D const &peak_q,Mantid::Kernel::V3D const &hkl,Mantid::Kernel::V3D const &mnp,bool specify_size, double peak_radius, double back_inner_radius,double back_outer_radius, std::vector<double> &axes_radii, double &inti,double &sigi);
/// Find the net integrated intensity of a peak, using ellipsoidal volumes
std::pair<boost::shared_ptr<const Mantid::Geometry::PeakShape>,
std::tuple<double, double, double>>
integrateStrongPeak(const IntegrationParameters &params,
const Kernel::V3D &peak_q, double &inti, double &sigi);
boost::shared_ptr<const Geometry::PeakShape>
integrateWeakPeak(const IntegrationParameters &params,
Mantid::DataObjects::PeakShapeEllipsoid_const_sptr shape,
const std::tuple<double, double, double> &libPeak,
const Mantid::Kernel::V3D &peak_q, double &inti,
double &sigi);
double estimateSignalToNoiseRatio(const IntegrationParameters &params,
const Mantid::Kernel::V3D &center);
private:
/// Get a list of events for a given Q
const std::vector<std::pair<double, Mantid::Kernel::V3D>> *
getEvents(const Mantid::Kernel::V3D &peak_q);
bool correctForDetectorEdges(std::tuple<double, double, double> &radii,
const std::vector<Mantid::Kernel::V3D> &E1Vecs,
const Mantid::Kernel::V3D &peak_q,
const std::vector<double> &axesRadii,
const std::vector<double> &bkgInnerRadii,
const std::vector<double> &bkgOuterRadii);
/// Calculate the number of events in an ellipsoid centered at 0,0,0
static double numInEllipsoid(
std::vector<std::pair<double, Mantid::Kernel::V3D>> const &events,
std::vector<Mantid::Kernel::V3D> const &directions,
std::vector<double> const &sizes);
/// Calculate the number of events in an ellipsoid centered at 0,0,0
static double numInEllipsoidBkg(
std::vector<std::pair<double, Mantid::Kernel::V3D>> const &events,
std::vector<Mantid::Kernel::V3D> const &directions,
std::vector<double> const &sizes, std::vector<double> const &sizesIn,
const bool useOnePercentBackgroundCorrection);
/// Calculate the 3x3 covariance matrix of a list of Q-vectors at 0,0,0
static void makeCovarianceMatrix(
std::vector<std::pair<double, Mantid::Kernel::V3D>> const &events,
Kernel::DblMatrix &matrix, double radius);
/// Calculate the eigen vectors of a 3x3 real symmetric matrix
static void getEigenVectors(Kernel::DblMatrix const &cov_matrix,
std::vector<Mantid::Kernel::V3D> &eigen_vectors);
/// Calculate the standard deviation of 3D events in a specified direction
static double
stdDev(std::vector<std::pair<double, Mantid::Kernel::V3D>> const &events,
Mantid::Kernel::V3D const &direction, double radius);
/// Form a map key as 10^12*h + 10^6*k + l from the integers h, k, l
static int64_t getHklKey(int h, int k, int l);
/// Form a map key for the specified q_vector.
int64_t getHklKey(Mantid::Kernel::V3D const &q_vector);
int64_t getHklKey2(Mantid::Kernel::V3D const &hkl);
/// Add an event to the vector of events for the closest h,k,l
void addEvent(std::pair<double, Mantid::Kernel::V3D> event_Q, bool hkl_integ);
/// Find the net integrated intensity of a list of Q's using ellipsoids
boost::shared_ptr<const Mantid::DataObjects::PeakShapeEllipsoid>
ellipseIntegrateEvents(
std::vector<Kernel::V3D> E1Vec, Kernel::V3D const &peak_q,
std::vector<std::pair<double, Mantid::Kernel::V3D>> const &ev_list,
std::vector<Mantid::Kernel::V3D> const &directions,
std::vector<double> const &sigmas, bool specify_size, double peak_radius,
double back_inner_radius, double back_outer_radius,
std::vector<double> &axes_radii, double &inti, double &sigi);
/// Compute if a particular Q falls on the edge of a detector
double detectorQ(std::vector<Kernel::V3D> E1Vec,
const Mantid::Kernel::V3D QLabFrame,
const std::vector<double> &r);
std::tuple<double, double, double>
calculateRadiusFactors(const IntegrationParameters &params,
double max_sigma) const;
// Private data members
PeakQMap m_peak_qs; // hashtable with peak Q-vectors
EventListMap m_event_lists; // hashtable with lists of events for each peak
Kernel::DblMatrix m_UBinv; // matrix mapping from Q to h,k,l
double m_radius; // size of sphere to use for events around a peak
const bool m_useOnePercentBackgroundCorrection =
true; // if one perecent culling of the background should be performed.
};
} // namespace MDAlgorithms
integrateStrongPeak(const IntegrationParameters &params,
const Kernel::V3D &peak_q, double &inti, double &sigi);
boost::shared_ptr<const Geometry::PeakShape>
integrateWeakPeak(const IntegrationParameters &params,
Mantid::DataObjects::PeakShapeEllipsoid_const_sptr shape,
const std::tuple<double, double, double> &libPeak,
const Mantid::Kernel::V3D &peak_q, double &inti,
double &sigi);
double estimateSignalToNoiseRatio(const IntegrationParameters &params,
const Mantid::Kernel::V3D &center);
private:
/// Get a list of events for a given Q
const std::vector<std::pair<double, Mantid::Kernel::V3D>> *
getEvents(const Mantid::Kernel::V3D &peak_q);
bool correctForDetectorEdges(std::tuple<double, double, double> &radii,
const std::vector<Mantid::Kernel::V3D> &E1Vecs,
const Mantid::Kernel::V3D &peak_q,
const std::vector<double> &axesRadii,
const std::vector<double> &bkgInnerRadii,
const std::vector<double> &bkgOuterRadii);
/// Calculate the number of events in an ellipsoid centered at 0,0,0
static double numInEllipsoid(
std::vector<std::pair<double, Mantid::Kernel::V3D>> const &events,
std::vector<Mantid::Kernel::V3D> const &directions,
std::vector<double> const &sizes);
/// Calculate the number of events in an ellipsoid centered at 0,0,0
static double numInEllipsoidBkg(
std::vector<std::pair<double, Mantid::Kernel::V3D>> const &events,
std::vector<Mantid::Kernel::V3D> const &directions,
std::vector<double> const &sizes, std::vector<double> const &sizesIn,
const bool useOnePercentBackgroundCorrection);
/// Calculate the 3x3 covariance matrix of a list of Q-vectors at 0,0,0
static void makeCovarianceMatrix(
std::vector<std::pair<double, Mantid::Kernel::V3D>> const &events,
Kernel::DblMatrix &matrix, double radius);
/// Calculate the eigen vectors of a 3x3 real symmetric matrix
static void getEigenVectors(Kernel::DblMatrix const &cov_matrix,
std::vector<Mantid::Kernel::V3D> &eigen_vectors);
/// Calculate the standard deviation of 3D events in a specified direction
static double
stdDev(std::vector<std::pair<double, Mantid::Kernel::V3D>> const &events,
Mantid::Kernel::V3D const &direction, double radius);
/// Form a map key as 10^12*h + 10^6*k + l from the integers h, k, l
static int64_t getHklKey(int h, int k, int l);