25bool compareMomentum(
const std::array<double, 4> &v1,
const std::array<double, 4> &v2) {
return (v1[3] < v2[3]); }
29const std::string LOG_CHARGE_NAME(
"proton_charge");
33 : m_hmin(0.0f), m_hmax(0.0f), m_kmin(0.0f), m_kmax(0.0f), m_lmin(0.0f), m_lmax(0.0f), m_dEmin(0.f), m_dEmax(0.f),
34 m_Ei(0.), m_ki(0.), m_kfmin(0.), m_kfmax(0.), m_hIntegrated(true), m_kIntegrated(true), m_lIntegrated(true),
35 m_dEIntegrated(true), m_UB(3, 3, true), m_W(3, 3, true), m_hIdx(-1), m_kIdx(-1), m_lIdx(-1), m_eIdx(-1),
36 m_samplePos(), m_beamDir(), m_numExptInfos(0), m_diffraction(true), m_accumulate(false) {}
44 const size_t nalgs =
history.size();
45 const auto &lastAlgorithm =
history.getAlgorithmHistory(nalgs - 1);
48 if (lastAlgorithm->name() ==
"ConvertToMD") {
50 emode = lastAlgorithm->getPropertyValue(
"dEAnalysisMode");
52 if ((lastAlgorithm->name() ==
"Load" || lastAlgorithm->name() ==
"LoadMD") && nalgs > 1) {
53 const auto &penultimateAlgorithm =
history.getAlgorithmHistory(nalgs - 2);
54 if (penultimateAlgorithm->name() ==
"ConvertToMD") {
55 return penultimateAlgorithm->getPropertyValue(
"dEAnalysisMode");
58 throw std::invalid_argument(
"The last algorithm in the history of the "
59 "input workspace is not ConvertToMD");
72 binMD->setPropertyValue(
"AxisAligned",
"1");
73 for (
auto prop : props) {
74 const auto &propName = prop->name();
75 if (propName !=
"FluxWorkspace" && propName !=
"SolidAngleWorkspace" &&
76 propName !=
"TemporaryNormalizationWorkspace" && propName !=
"OutputNormalizationWorkspace" &&
77 propName !=
"SkipSafetyCheck") {
78 binMD->setPropertyValue(propName, prop->value());
81 binMD->executeAsChildAlg();
83 return std::dynamic_pointer_cast<MDHistoWorkspace>(outputWS);
92 std::shared_ptr<IMDHistoWorkspace>
tmp = this->
getProperty(
"TemporaryNormalizationWorkspace");
93 m_normWS = std::dynamic_pointer_cast<MDHistoWorkspace>(
tmp);
112 const auto ¤tRun =
m_inputWS->getExperimentInfo(expInfoIndex)->run();
114 std::vector<coord_t> otherDimValues;
116 for (
size_t i = lastCol; i <
m_inputWS->getNumDims(); i++) {
117 const auto dimension =
m_inputWS->getDimension(i);
118 auto dimMin =
static_cast<float>(dimension->getMinimum());
119 auto dimMax =
static_cast<float>(dimension->getMaximum());
122 auto value =
static_cast<coord_t>(dimProp->firstValue());
123 otherDimValues.emplace_back(
value);
126 if (value < dimMin || value > dimMax) {
127 skipNormalization =
true;
131 return otherDimValues;
150 for (
size_t row = 0; row < nrm1; row++)
152 const auto dimen =
m_normWS->getDimension(row);
153 const auto dimMin(dimen->getMinimum()), dimMax(dimen->getMaximum());
160 skipNormalization =
true;
169 skipNormalization =
true;
178 skipNormalization =
true;
188 skipNormalization =
true;
191 for (
size_t col = lastCol; col < ncm1; col++)
194 double val = otherDimValues.at(col - lastCol);
195 if (val > dimMax || val < dimMin) {
196 skipNormalization =
true;
210 m_hX = std::vector<double>(hDim.getNBoundaries());
211 for (
size_t i = 0; i <
m_hX.size(); ++i) {
212 m_hX[i] = hDim.getX(i);
217 m_kX = std::vector<double>(kDim.getNBoundaries());
218 for (
size_t i = 0; i <
m_kX.size(); ++i) {
219 m_kX[i] = kDim.getX(i);
224 m_lX = std::vector<double>(lDim.getNBoundaries());
225 for (
size_t i = 0; i <
m_lX.size(); ++i) {
226 m_lX[i] = lDim.getX(i);
232 m_eX = std::vector<double>(eDim.getNBoundaries());
233 for (
size_t i = 0; i <
m_eX.size(); ++i) {
234 double temp =
m_Ei - eDim.getX(i);
235 temp = std::max(temp, 0.);
236 m_eX[i] = std::sqrt(energyToK * temp);
273 const auto ¤tExptInfo = *(
m_inputWS->getExperimentInfo(expInfoIndex));
274 const auto &spectrumInfo = currentExptInfo.spectrumInfo();
276 currentExptInfo,
"RUBW_MATRIX"));
277 Qtransform = currentExptInfo.run().getGoniometerMatrix() * Qtransform;
279 const double protonCharge = currentExptInfo.run().getProtonCharge();
292 uint16_t expInfoIndex) {
293 const auto ¤tExptInfo = *(
m_inputWS->getExperimentInfo(expInfoIndex));
294 std::vector<double> lowValues = getLogValues<VectorDoubleProperty>(currentExptInfo,
"MDNorm_low");
295 std::vector<double> highValues = getLogValues<VectorDoubleProperty>(currentExptInfo,
"MDNorm_high");
301 const double protonCharge = currentExptInfo.run().getProtonCharge();
302 const double protonChargeBkgd =
305 const auto &spectrumInfo = currentExptInfo.spectrumInfo();
307 calculateNormInner(spectrumInfo, otherValues, protonCharge, protonChargeBkgd, Qtransform, lowValues, highValues);
318 const auto ¤tExptInfo = *(
m_inputWS->getExperimentInfo(expInfoIndex));
319 const auto &spectrumInfo = currentExptInfo.spectrumInfo();
320 bool isMDNorm =
false;
321 std::vector<double> lowValues, highValues;
324 UBWSymm = getLogValues<VectorDoubleProperty>(
325 currentExptInfo,
"RUBW_MATRIX");
328 throw std::runtime_error(
"Continuous rotation and background workspace not yet implemented.");
332 lowValues = getLogValues<VectorDoubleProperty>(currentExptInfo,
"MDNorm_low");
333 highValues = getLogValues<VectorDoubleProperty>(currentExptInfo,
"MDNorm_high");
337 const Run &run = currentExptInfo.run();
339 throw std::runtime_error(
"Wokspace does not contain the proton charge log. Cannot continue.");
343 double progressEnd = 0.3 + 0.7 * (expInfoIndex + 1) /
m_numExptInfos;
344 double normfac = 1.0;
345 if (
auto *factor = run.
hasProperty(
"NormalizationFactor")
348 normfac = (*factor)();
350 std::istringstream tosplit;
353 tosplit.str((*logTimesStr)());
355 throw std::runtime_error(
"useLogTimes property needs to be defined for Continuous Normalization");
357 std::vector<TimeSeriesProperty<double> *> logs;
358 std::vector<size_t> movingGonioIndex;
361 std::vector<Types::Core::DateAndTime> protonTimes = protonlog->
timesAsVector();
364 for (std::string
name; std::getline(tosplit,
name,
',');) {
368 movingGonioIndex.push_back(logs.size() - 1);
373 if (protonlog->
units().find(
"picoCoulomb") != std::string::npos) {
377 if (movingGonioIndex.size() == 1) {
381 const auto &gonioAxLog = logs[movingGonioIndex[0]];
382 std::vector<double> filteredVals = gonioAxLog->filteredValuesAsVector(&timeroi);
383 const auto &[min, max] = std::minmax_element(filteredVals.begin(), filteredVals.end());
384 std::vector<double> gonioCharge(
static_cast<int>((*max - *min) /
GONIOBINSTEP) + 1, 0.0);
385 for (
size_t n = 0;
n < protonCharge.size();
n++) {
386 double logval = gonioAxLog->getSingleValue(protonTimes[
n]);
387 if (std::isnan(logval) || logval > *max || logval < *min) {
390 auto idx =
static_cast<size_t>(floor((logval - *min) /
GONIOBINSTEP));
391 gonioCharge[idx] += protonCharge[
n];
393 m_progress->resetNumSteps(
static_cast<int64_t
>(gonioCharge.size()), progressStart, progressEnd);
394 for (
size_t n = 0;
n < gonioCharge.size();
n++) {
398 auto nn =
static_cast<double>(
n);
403 calculateNormInner(spectrumInfo, otherValues, gonioCharge[
n] / normfac, 0., Qtransform, lowValues, highValues);
411 double chargeSum = 0.0;
413 bool skipIter =
false;
414 m_progress->resetNumSteps(
static_cast<int64_t
>(protonCharge.size()), progressStart, progressEnd);
415 for (
size_t n = 0;
n < protonCharge.size();
n++) {
416 chargeSum += protonCharge[
n];
418 size_t index =
static_cast<int>(floor(
static_cast<double>(
n - i0) / 2.)) + i0;
421 double logval = logs[gAx]->getSingleValue(protonTimes[
index]);
422 if (std::isnan(logval)) {
432 calculateNormInner(spectrumInfo, otherValues, chargeSum / normfac, 0., Qtrans, lowValues, highValues);
449 const double protonCharge,
const double protonChargeBkgd,
451 const std::vector<double> &highValues) {
453 const auto ndets =
static_cast<int64_t
>(spectrumInfo.
size());
457 bool thread_safe =
true;
461 fluxDetToIdx = integrFlux->getDetectorIDToWorkspaceIndexMap();
464 if (solidAngleWS !=
nullptr) {
466 solidAngDetToIdx = solidAngleWS->getDetectorIDToWorkspaceIndexMap();
472 throw std::runtime_error(
"N points are different");
475 bool isMDNorm = !lowValues.empty();
486 for (int64_t i = 0; i < ndets; i++) {
492 const auto &detector = spectrumInfo.
detector(i);
494 double phi = detector.getPhi();
496 const auto detID = detector.getID();
501 if (
auto index = fluxDetToIdx.find(detID);
index != fluxDetToIdx.end()) {
502 wsIdx =
index->second;
509 std::vector<std::array<double, 4>> intersections;
510 std::vector<coord_t> pos, posNew;
517 if (intersections.empty())
521 double solid = protonCharge;
522 double bkgdSolid = protonChargeBkgd;
524 double solid_angle_factor = solidAngleWS->y(solidAngDetToIdx.at(detID))[0];
525 solid = solid_angle_factor * protonCharge;
526 bkgdSolid = solid_angle_factor * protonChargeBkgd;
531 std::vector<double> yValues;
534 std::vector<double> xValues(intersections.size());
535 yValues.resize(intersections.size());
536 auto x = xValues.begin();
537 for (
auto it = intersections.begin(); it != intersections.end(); ++it, ++
x) {
548 pos.resize(vmdDims + otherValues.size() + 1);
549 std::copy(otherValues.begin(), otherValues.end(), pos.begin() + vmdDims);
550 pos.emplace_back(1.f);
551 for (
auto it = intersections.begin() + 1; it != intersections.end(); ++it) {
552 const auto &curIntSec = *it;
553 const auto &prevIntSec = *(it - 1);
556 : (curIntSec[3] * curIntSec[3] - prevIntSec[3] * prevIntSec[3]) / energyToK;
561 std::transform(curIntSec.data(), curIntSec.data() + vmdDims, prevIntSec.data(), pos.begin(),
562 [](
const double rhs,
const double lhs) { return static_cast<coord_t>(0.5 * (rhs + lhs)); });
566 pos[3] =
static_cast<coord_t>(
m_Ei - pos[3] * pos[3] / energyToK);
569 size_t linIndex =
m_normWS->getLinearIndexAtCoord(posNew.data());
570 if (linIndex ==
static_cast<size_t>(-1))
575 auto k =
static_cast<size_t>(std::distance(intersections.begin(), it));
576 delta = (yValues[k] - yValues[k - 1]);
599 std::vector<double> &yValues)
const {
600 assert(xValues.size() == yValues.size());
603 const auto &xData = integrFlux.
x(sp);
604 const double xStart = xData.front();
605 const double xEnd = xData.back();
610 const auto &yData = integrFlux.
y(sp);
611 size_t spSize = yData.size();
613 const double yMin = 0.0;
614 const double yMax = yData.back();
616 size_t nData = xValues.size();
618 if (xValues[nData - 1] < xStart) {
619 std::fill(yValues.begin(), yValues.end(), yMin);
624 if (xValues[0] > xEnd) {
625 std::fill(yValues.begin(), yValues.end(), yMax);
631 while (i < nData - 1 && xValues[i] < xStart) {
636 for (; i < nData; i++) {
638 if (j >= spSize - 1) {
641 double xi = xValues[i];
642 while (j < spSize - 1 && xi > xData[j])
645 if (xi == xData[j]) {
646 yValues[i] = yData[j];
647 }
else if (j == spSize - 1) {
652 double x0 = xData[j - 1];
653 double x1 = xData[j];
654 double y0 = yData[j - 1];
655 double y1 = yData[j];
656 yValues[i] = y0 + (y1 - y0) * (xi - x0) / (x1 - x0);
680 double kfmin, kfmax, kimin, kimax;
681 bool isMDNorm = !std::isnan(lowvalue);
683 qout =
V3D(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));
684 qin =
V3D(0., 0., 1.);
686 kimin = kfmin = lowvalue;
687 kimax = kfmax = highvalue;
689 kimin = kimax = std::sqrt(energyToK *
m_Ei);
690 kfmin = std::sqrt(energyToK * (
m_Ei - highvalue));
691 kfmax = std::sqrt(energyToK * (
m_Ei - lowvalue));
695 qin = qout =
V3D(-sin(theta) * cos(phi), -sin(theta) * sin(phi), 1. - cos(theta));
699 qout =
V3D(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));
700 qin =
V3D(0., 0., 1.);
701 kimin = kimax =
m_ki;
707 qout = transform * qout;
708 qin = transform * qin;
713 double hStart = qin.
X() * kimin - qout.
X() * kfmin, hEnd = qin.
X() * kimax - qout.
X() * kfmax;
714 double kStart = qin.
Y() * kimin - qout.
Y() * kfmin, kEnd = qin.
Y() * kimax - qout.
Y() * kfmax;
715 double lStart = qin.
Z() * kimin - qout.
Z() * kfmin, lEnd = qin.
Z() * kimax - qout.
Z() * kfmax;
717 auto hNBins =
m_hX.size();
718 auto kNBins =
m_kX.size();
719 auto lNBins =
m_lX.size();
720 auto eNBins =
m_eX.size();
721 intersections.clear();
722 intersections.reserve(hNBins + kNBins + lNBins + eNBins + 8);
725 if (
fabs(hStart - hEnd) > eps) {
726 double fmom = (kfmax - kfmin) / (hEnd - hStart);
727 double fk = (kEnd - kStart) / (hEnd - hStart);
728 double fl = (lEnd - lStart) / (hEnd - hStart);
730 for (
size_t i = 0; i < hNBins; i++) {
732 if ((hi >=
m_hmin) && (hi <=
m_hmax) && ((hStart - hi) * (hEnd - hi) < 0)) {
735 double ki = fk * (hi - hStart) + kStart;
736 double li = fl * (hi - hStart) + lStart;
738 double momi = fmom * (hi - hStart) + kfmin;
739 intersections.push_back({{hi, ki, li, momi}});
745 double momhMin = fmom * (
m_hmin - hStart) + kfmin;
746 if ((momhMin - kfmin) * (momhMin - kfmax) < 0)
749 double khmin = fk * (
m_hmin - hStart) + kStart;
750 double lhmin = fl * (
m_hmin - hStart) + lStart;
752 intersections.push_back({{
m_hmin, khmin, lhmin, momhMin}});
755 double momhMax = fmom * (
m_hmax - hStart) + kfmin;
756 if ((momhMax - kfmin) * (momhMax - kfmax) <= 0) {
758 double khmax = fk * (
m_hmax - hStart) + kStart;
759 double lhmax = fl * (
m_hmax - hStart) + lStart;
761 intersections.push_back({{
m_hmax, khmax, lhmax, momhMax}});
768 if (
fabs(kStart - kEnd) > eps) {
769 double fmom = (kfmax - kfmin) / (kEnd - kStart);
770 double fh = (hEnd - hStart) / (kEnd - kStart);
771 double fl = (lEnd - lStart) / (kEnd - kStart);
773 for (
size_t i = 0; i < kNBins; i++) {
775 if ((ki >=
m_kmin) && (ki <=
m_kmax) && ((kStart - ki) * (kEnd - ki) < 0)) {
778 double hi = fh * (ki - kStart) + hStart;
779 double li = fl * (ki - kStart) + lStart;
781 double momi = fmom * (ki - kStart) + kfmin;
782 intersections.push_back({{hi, ki, li, momi}});
788 double momkMin = fmom * (
m_kmin - kStart) + kfmin;
789 if ((momkMin - kfmin) * (momkMin - kfmax) < 0) {
791 double hkmin = fh * (
m_kmin - kStart) + hStart;
792 double lkmin = fl * (
m_kmin - kStart) + lStart;
794 intersections.push_back({{hkmin,
m_kmin, lkmin, momkMin}});
797 double momkMax = fmom * (
m_kmax - kStart) + kfmin;
798 if ((momkMax - kfmin) * (momkMax - kfmax) <= 0) {
800 double hkmax = fh * (
m_kmax - kStart) + hStart;
801 double lkmax = fl * (
m_kmax - kStart) + lStart;
803 intersections.push_back({{hkmax,
m_kmax, lkmax, momkMax}});
810 if (
fabs(lStart - lEnd) > eps) {
811 double fmom = (kfmax - kfmin) / (lEnd - lStart);
812 double fh = (hEnd - hStart) / (lEnd - lStart);
813 double fk = (kEnd - kStart) / (lEnd - lStart);
815 for (
size_t i = 0; i < lNBins; i++) {
817 if ((li >=
m_lmin) && (li <=
m_lmax) && ((lStart - li) * (lEnd - li) < 0)) {
820 double hi = fh * (li - lStart) + hStart;
821 double ki = fk * (li - lStart) + kStart;
823 double momi = fmom * (li - lStart) + kfmin;
824 intersections.push_back({{hi, ki, li, momi}});
830 double momlMin = fmom * (
m_lmin - lStart) + kfmin;
831 if ((momlMin - kfmin) * (momlMin - kfmax) <= 0) {
833 double hlmin = fh * (
m_lmin - lStart) + hStart;
834 double klmin = fk * (
m_lmin - lStart) + kStart;
836 intersections.push_back({{hlmin, klmin,
m_lmin, momlMin}});
839 double momlMax = fmom * (
m_lmax - lStart) + kfmin;
840 if ((momlMax - kfmin) * (momlMax - kfmax) < 0) {
842 double hlmax = fh * (
m_lmax - lStart) + hStart;
843 double klmax = fk * (
m_lmax - lStart) + kStart;
845 intersections.push_back({{hlmax, klmax,
m_lmax, momlMax}});
853 for (
size_t i = 0; i < eNBins; i++) {
854 double kfi =
m_eX[i];
855 if ((kfi - kfmin) * (kfi - kfmax) <= 0) {
856 double h = qin.
X() * kimin - qout.
X() * kfi;
857 double k = qin.
Y() * kimin - qout.
Y() * kfi;
858 double l = qin.
Z() * kimin - qout.
Z() * kfi;
860 intersections.push_back({{h, k, l, kfi}});
869 intersections.push_back({{hStart, kStart, lStart, kfmin}});
873 intersections.push_back({{hEnd, kEnd, lEnd, kfmax}});
877 std::stable_sort(intersections.begin(), intersections.end(), compareMomentum);
const std::vector< double > & rhs
double value
The value of the point.
std::map< DeltaEMode::Type, std::string > index
#define PARALLEL_START_INTERRUPT_REGION
Begins a block to skip processing is the algorithm has been interupted Note the end of the block if n...
#define PARALLEL_END_INTERRUPT_REGION
Ends a block to skip processing is the algorithm has been interupted Note the start of the block if n...
#define PRAGMA_OMP(expression)
#define PARALLEL_CHECK_INTERRUPT_REGION
Adds a check after a Parallel region to see if it was interupted.
std::vector< history_type > history
history information
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
const std::vector< Kernel::Property * > & getProperties() const override
Get the list of managed properties.
const std::string name() const override=0
function to return a name of the algorithm, must be overridden in all algorithms
bool hasProperty(const std::string &name) const
Does the property exist on the object.
const Kernel::TimeROI & getTimeROI() const
Kernel::Property * getProperty(const std::string &name) const
Returns the named property as a pointer.
Kernel::TimeSeriesProperty< T > * getTimeSeriesProperty(const std::string &name) const
Returns a property as a time series property.
Base MatrixWorkspace Abstract Class.
const HistogramData::HistogramX & x(const size_t index) const
const HistogramData::HistogramY & y(const size_t index) const
This class stores information regarding an experimental run as a series of log entries.
const Geometry::Goniometer & getGoniometer() const
Return reference to the first const Goniometer object for this run.
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
bool isMonitor(const size_t index) const
Returns true if the detector(s) associated with the spectrum are monitors.
bool hasDetectors(const size_t index) const
Returns true if the spectrum is associated with detectors in the instrument.
bool isMasked(const size_t index) const
Returns true if the detector(s) associated with the spectrum are masked.
const Geometry::IDetector & detector(const size_t index) const
Return a const reference to the detector or detector group of the spectrum with given index.
size_t size() const
Returns the size of the SpectrumInfo, i.e., the number of spectra.
std::unique_ptr< MDHistoWorkspace > clone() const
Returns a clone of the workspace.
Class to represent a particular goniometer setting, which is described by the rotation matrix.
void setRotationAngle(const std::string &name, double value)
Set rotation angle for an axis using motor name.
size_t getNumberAxes() const
const Kernel::DblMatrix & getR() const
Return global rotation matrix.
virtual double getTwoTheta(const Kernel::V3D &observer, const Kernel::V3D &axis) const =0
Gives the angle of this detector object with respect to an axis.
Crystallographic symmetry operations are composed of a rotational component, which is represented by ...
Kernel::V3D transformHKL(const Kernel::V3D &hkl) const
Transforms an index triplet hkl.
T Invert()
LU inversion routine.
void multiplyPoint(const std::vector< T > &in, std::vector< T > &out) const
Multiply M*Vec.
size_t numRows() const
Return the number of rows in the matrix.
void setColumn(const size_t nCol, const std::vector< T > &newCol)
size_t numCols() const
Return the number of columns in the matrix.
The concrete, templated class for properties.
virtual const std::string & units() const
Returns the units of the property, if any, as a string.
TimeROI : Object that holds information about when the time measurement was active.
A specialised Property class for holding a series of time-value pairs.
std::vector< TYPE > valuesAsVector() const
Return the time series's values (unfiltered) as a vector<TYPE>
std::vector< Types::Core::DateAndTime > timesAsVector() const override
Return the time series's times as a vector<DateAndTime>
constexpr double X() const noexcept
Get x.
constexpr double Y() const noexcept
Get y.
constexpr double Z() const noexcept
Get z.
std::vector< std::atomic< signal_t > > m_bkgdSignalArray
API::IMDEventWorkspace_sptr m_inputWS
Input workspace.
bool m_hIntegrated
flag for integrated h,k,l, dE dimensions
void createNormalizationWS(const DataObjects::MDHistoWorkspace &dataWS)
Create & cached the normalization workspace.
bool m_diffraction
Flag indicating if the input workspace is from diffraction.
API::IMDEventWorkspace_sptr m_backgroundWS
Input background workspace.
static constexpr double CHARGEBINSIZE
void calcIntegralsForIntersections(const std::vector< double > &xValues, const API::MatrixWorkspace &integrFlux, size_t sp, std::vector< double > &yValues) const
Linearly interpolate between the points in integrFlux at xValues and save the results in yValues.
void cacheDimensionXValues()
Stores the X values from each H,K,L,E dimension as member variables Energy dimension is transformed t...
Mantid::Kernel::DblMatrix m_W
W matrix.
void findIntegratedDimensions(const std::vector< coord_t > &otherDimValues, bool &skipNormalization)
Checks the normalization workspace against the indices of the original dimensions.
void calculateNormalization(const std::vector< coord_t > &otherValues, uint16_t expInfoIndex)
Computed the normalization for the input workspace (for MDNormSCD/MDNormDirectSC).
DataObjects::MDHistoWorkspace_sptr m_normWS
Normalization workspace.
Kernel::V3D m_samplePos
Sample position.
std::vector< coord_t > getValuesFromOtherDimensions(bool &skipNormalization, uint16_t expInfoIndex=0) const
Retrieve logged values from non-HKL dimensions.
void calculateNormInner(const API::SpectrumInfo &spectrumInfo, const std::vector< coord_t > &otherValues, const double protonCharge, const double protonChargeBkgd, const DblMatrix &Qtransform, const std::vector< double > &lowValues=std::vector< double >(), const std::vector< double > &highValues=std::vector< double >())
std::vector< std::atomic< signal_t > > m_signalArray
internal array to accumulate signals to avoid copying (serial) each loop
bool m_accumulate
Flag to accumulate normalization.
std::vector< double > m_eX
DataObjects::MDHistoWorkspace_sptr binInputWS()
Runs the BinMD algorithm on the input to provide the output workspace All slicing algorithm propertie...
void calculateIntersections(std::vector< std::array< double, 4 > > &intersections, const double theta, const double phi, const DblMatrix &transform, double lowvalue=std::nan(""), double highvalue=0)
Calculate the points of intersection for the given detector with cuboid surrounding the detector posi...
uint16_t m_numExptInfos
number of experiment infos
DataObjects::MDHistoWorkspace_sptr m_bkgdNormWS
Mantid::Kernel::Matrix< coord_t > m_transformation
matrix for transforming from intersections to positions in the normalization workspace
Kernel::V3D m_beamDir
Beam direction.
Mantid::Kernel::DblMatrix m_UB
UB matrix.
coord_t m_hmin
limits for h,k,l, dE dimensions
size_t m_hIdx
index of h,k,l, dE dimensions in the output workspaces
std::vector< double > m_kX
std::vector< double > m_hX
cached X values along dimensions h,k,l. dE
std::unique_ptr< API::Progress > m_progress
Progress bar.
Mantid::Kernel::DblMatrix calQTransform(const Kernel::DblMatrix &R, const Mantid::Geometry::SymmetryOperation &so, bool doInvert=true)
Calculate QTransform = (R * UB * SymmetryOperation * m_W)^-1.
void calculateNormContinuous(const std::vector< coord_t > &otherValues, uint16_t expInfoIndex, const Geometry::SymmetryOperation *so=nullptr)
Computes the normalization for the input workspace for the case of a continous rotation.
static constexpr double STATIONARYANGLIM
std::vector< double > m_lX
static constexpr double MINPROTONCHARGE
std::string inputEnergyMode() const
Currently looks for the ConvertToMD algorithm in the history.
static constexpr double GONIOBINSTEP
std::string m_convention
ki-kf for Inelastic convention; kf-ki for Crystallography convention
double m_Ei
cached values for incident energy and momentum, final momentum min/max
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< MDHistoWorkspace > MDHistoWorkspace_sptr
A shared pointer to a MDHistoWorkspace.
std::enable_if< std::is_pointer< Arg >::value, bool >::type threadSafe(Arg workspace)
Thread-safety check Checks the workspace to ensure it is suitable for multithreaded access.
void AtomicOp(std::atomic< T > &f, T d, BinaryOp op)
Uses std::compare_exchange_weak to update the atomic value f = op(f, d) Used to improve parallel scal...
Mantid::Kernel::Matrix< double > DblMatrix
Kernel::PropertyWithValue< std::vector< double > > VectorDoubleProperty
static constexpr double NeutronMass
Mass of the neutron in kg.
static constexpr double h
Planck constant in J*s.
static constexpr double meV
1 meV in Joules.
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
std::unordered_map< detid_t, size_t > detid2index_map
Map with key = detector ID, value = workspace index.