Mantid
Loading...
Searching...
No Matches
LeanElasticPeaksWorkspace.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
8#include "MantidAPI/Run.h"
9#include "MantidAPI/Sample.h"
14#include "MantidKernel/Logger.h"
16#include "MantidNexus/NexusFile.h"
17
18#include <cmath>
19
20using namespace Mantid::API;
21using namespace Mantid::Kernel;
22using namespace Mantid::Geometry;
23
24namespace Mantid::DataObjects {
27
28//---------------------------------------------------------------------------------------------
32 : IPeaksWorkspace(), m_peaks(), m_columns(), m_columnNames(), m_coordSystem(None) {
33 initColumns();
34 // LeanElasticPeaksWorkspace does not use the grouping mechanism of
35 // ExperimentInfo.
36 setNumberOfDetectorGroups(0);
37}
38
39//---------------------------------------------------------------------------------------------
45 : IPeaksWorkspace(other), m_peaks(other.m_peaks), m_columns(), m_columnNames(), m_coordSystem(other.m_coordSystem) {
47 // LeanElasticPeaksWorkspace does not use the grouping mechanism of
48 // ExperimentInfo.
50}
51
55public:
57 std::vector<ColumnAndDirection> &criteria;
58
63 explicit PeakComparator(std::vector<ColumnAndDirection> &criteria) : criteria(criteria) {}
64
66 inline bool operator()(const LeanElasticPeak &a, const LeanElasticPeak &b) {
67 for (const auto &name : criteria) {
68 const auto &col = name.first;
69 const bool ascending = name.second;
70 bool lessThan = false;
71 // General double comparison
72 const double valA = a.getValueByColName(col);
73 const double valB = b.getValueByColName(col);
74 // Move on to lesser criterion if equal
75 if (valA == valB)
76 continue;
77 lessThan = (valA < valB);
78 // Flip the sign of comparison if descending.
79 if (ascending)
80 return lessThan;
81 else
82 return !lessThan;
83 }
84 // If you reach here, all criteria were ==; so not <, so return false
85 return false;
86 }
87};
88
89//---------------------------------------------------------------------------------------------
97void LeanElasticPeaksWorkspace::sort(std::vector<ColumnAndDirection> &criteria) {
98 PeakComparator comparator(criteria);
99 std::stable_sort(m_peaks.begin(), m_peaks.end(), comparator);
100}
101
102//---------------------------------------------------------------------------------------------
105int LeanElasticPeaksWorkspace::getNumberPeaks() const { return int(m_peaks.size()); }
106
107//---------------------------------------------------------------------------------------------
111
112//---------------------------------------------------------------------------------------------
117 if (peakNum >= static_cast<int>(m_peaks.size()) || peakNum < 0) {
118 throw std::invalid_argument("LeanElasticPeaksWorkspace::removePeak(): peakNum is out of range.");
119 }
120 m_peaks.erase(m_peaks.begin() + peakNum);
121}
122
126void LeanElasticPeaksWorkspace::removePeaks(std::vector<int> badPeaks) {
127 if (badPeaks.empty())
128 return;
129 // if index of peak is in badPeaks remove
130 int ip = -1;
131 auto it = std::remove_if(m_peaks.begin(), m_peaks.end(), [&ip, badPeaks](const LeanElasticPeak &pk) {
132 (void)pk;
133 ip++;
134 return std::any_of(badPeaks.cbegin(), badPeaks.cend(), [ip](int badPeak) { return badPeak == ip; });
135 });
136 m_peaks.erase(it, m_peaks.end());
137}
138
139//---------------------------------------------------------------------------------------------
144 if (dynamic_cast<const LeanElasticPeak *>(&ipeak)) {
145 m_peaks.emplace_back(static_cast<const LeanElasticPeak &>(ipeak));
146 } else {
147 m_peaks.emplace_back(LeanElasticPeak(ipeak));
148 }
149}
150
151//---------------------------------------------------------------------------------------------
157 auto peak = createPeak(position, frame);
158 addPeak(*peak);
159}
160
161//---------------------------------------------------------------------------------------------
166
167//---------------------------------------------------------------------------------------------
173 if (peakNum >= m_peaks.size()) {
174 throw std::invalid_argument("LeanElasticPeaksWorkspace::getPeak(): peakNum is out of range.");
175 }
176 return m_peaks[peakNum];
177}
178
179//---------------------------------------------------------------------------------------------
184const LeanElasticPeak &LeanElasticPeaksWorkspace::getPeak(size_t const peakNum) const {
185 if (peakNum >= m_peaks.size()) {
186 throw std::invalid_argument("LeanElasticPeaksWorkspace::getPeak(): peakNum is out of range.");
187 }
188 return m_peaks[peakNum];
189}
190
191//---------------------------------------------------------------------------------------------
198std::unique_ptr<Geometry::IPeak> LeanElasticPeaksWorkspace::createPeak(const Kernel::V3D &,
199 std::optional<double>) const {
200 throw Exception::NotImplementedError("LeanElasticPeak should be create in q sample frame");
201}
202
203//---------------------------------------------------------------------------------------------
210std::unique_ptr<Geometry::IPeak>
212 if (frame == Mantid::Kernel::HKL) {
213 return createPeakHKL(position);
214 } else if (frame == Mantid::Kernel::QLab) {
215 return createPeak(position);
216 } else {
218 }
219}
220
221//---------------------------------------------------------------------------------------------
228std::unique_ptr<IPeak> LeanElasticPeaksWorkspace::createPeakQSample(const V3D &position) const {
229 // Create a peak from QSampleFrame
230 std::unique_ptr<IPeak> peak = std::make_unique<LeanElasticPeak>(position, run().getGoniometer().getR());
231 // Take the run number from this
232 peak->setRunNumber(getRunNumber());
233 return peak;
234}
235
251std::vector<std::pair<std::string, std::string>> LeanElasticPeaksWorkspace::peakInfo(const Kernel::V3D &, bool) const {
253}
254
262std::unique_ptr<IPeak> LeanElasticPeaksWorkspace::createPeakHKL(const V3D &HKL) const {
263 /*
264 The following allows us to add peaks where we have a single UB to work from.
265 */
266 const auto &lattice = this->sample().getOrientedLattice();
267 const auto &goniometer = this->run().getGoniometer();
268
269 // Calculate qSample from q HKL. As per Busing and Levy 1967, q_sample_frame =
270 // 2pi * UB * HKL
271 const V3D qSampleFrame = lattice.getUB() * HKL * 2 * M_PI;
272
273 // create a peak using the qSample frame
274 std::unique_ptr<IPeak> peak = std::make_unique<LeanElasticPeak>(qSampleFrame, goniometer.getR());
275 // We need to set HKL separately to keep things consistent.
276 peak->setHKL(HKL[0], HKL[1], HKL[2]);
277 peak->setIntHKL(peak->getHKL());
278 // Take the run number from this
279 peak->setRunNumber(this->getRunNumber());
280
281 return peak;
282}
283
289std::unique_ptr<IPeak> LeanElasticPeaksWorkspace::createPeak() const { return std::make_unique<LeanElasticPeak>(); }
290
309
310//---------------------------------------------------------------------------------------------
312std::vector<LeanElasticPeak> &LeanElasticPeaksWorkspace::getPeaks() { return m_peaks; }
313
315const std::vector<LeanElasticPeak> &LeanElasticPeaksWorkspace::getPeaks() const { return m_peaks; }
316
321 bool ret = false;
322 const std::string peaksIntegrated = "PeaksIntegrated";
323 if (this->run().hasProperty(peaksIntegrated)) {
324 const auto value = boost::lexical_cast<int>(this->run().getProperty(peaksIntegrated)->value());
325 ret = (value != 0);
326 }
327 return ret;
328}
329
330//---------------------------------------------------------------------------------------------
333
334//---------------------------------------------------------------------------------------------
345
346//---------------------------------------------------------------------------------------------
349 // Note: The column types are controlled in PeakColumn.cpp
350 addPeakColumn("RunNumber");
351 addPeakColumn("h");
352 addPeakColumn("k");
353 addPeakColumn("l");
354 addPeakColumn("Wavelength");
355 addPeakColumn("Energy");
356 addPeakColumn("DSpacing");
357 addPeakColumn("Intens");
358 addPeakColumn("SigInt");
359 addPeakColumn("Intens/SigInt");
360 addPeakColumn("BinCount");
361 addPeakColumn("QLab");
362 addPeakColumn("QSample");
363 addPeakColumn("PeakNumber");
364 addPeakColumn("IntHKL");
365 addPeakColumn("IntMNP");
366}
367
368//---------------------------------------------------------------------------------------------
374 // Create the PeakColumn.
375 m_columns.emplace_back(std::make_shared<DataObjects::PeakColumn<LeanElasticPeak>>(this->m_peaks, name));
376 // Cache the names
377 m_columnNames.emplace_back(name);
378}
379
380//---------------------------------------------------------------------------------------------
382size_t LeanElasticPeaksWorkspace::getColumnIndex(const std::string &name) const {
383 for (size_t i = 0; i < m_columns.size(); i++)
384 if (m_columns[i]->name() == name)
385 return i;
386 throw std::invalid_argument("Column named " + name + " was not found in the LeanElasticPeaksWorkspace.");
387}
388
389//---------------------------------------------------------------------------------------------
391std::shared_ptr<Mantid::API::Column> LeanElasticPeaksWorkspace::getColumn(size_t index) {
392 if (index >= m_columns.size())
393 throw std::invalid_argument("LeanElasticPeaksWorkspace::getColumn() called with invalid index.");
394 return m_columns[index];
395}
396
397//---------------------------------------------------------------------------------------------
399std::shared_ptr<const Mantid::API::Column> LeanElasticPeaksWorkspace::getColumn(size_t index) const {
400 if (index >= m_columns.size())
401 throw std::invalid_argument("LeanElasticPeaksWorkspace::getColumn() called with invalid index.");
402 return m_columns[index];
403}
404
405void LeanElasticPeaksWorkspace::saveNexus(Nexus::File *file) const {
406
407 // Number of Peaks
408 const size_t np(m_peaks.size());
409
410 // Column vectors for peaks table
411 std::vector<double> H(np);
412 std::vector<double> K(np);
413 std::vector<double> L(np);
414 std::vector<double> intensity(np);
415 std::vector<double> sigmaIntensity(np);
416 std::vector<double> binCount(np);
417 std::vector<double> waveLength(np);
418 std::vector<double> scattering(np);
419 std::vector<double> dSpacing(np);
420 std::vector<int> runNumber(np);
421 std::vector<int> peakNumber(np);
422 std::vector<double> tbar(np);
423 std::vector<double> intHKL(3 * np);
424 std::vector<double> intMNP(3 * np);
425 std::vector<double> goniometerMatrix(9 * np);
426 std::vector<std::string> shapes(np);
427 std::vector<double> qlabs(3 * np);
428
429 // Populate column vectors
430 size_t maxShapeJSONLength = 0;
431 for (size_t i = 0; i < np; i++) {
433 H[i] = p.getH();
434 K[i] = p.getK();
435 L[i] = p.getL();
436 intensity[i] = p.getIntensity();
437 sigmaIntensity[i] = p.getSigmaIntensity();
438 binCount[i] = p.getBinCount();
439 waveLength[i] = p.getWavelength();
440 scattering[i] = p.getScattering();
441 dSpacing[i] = p.getDSpacing();
442 runNumber[i] = p.getRunNumber();
443 peakNumber[i] = p.getPeakNumber();
445 {
446 V3D hkl = p.getIntHKL();
447 intHKL[3 * i + 0] = hkl[0];
448 intHKL[3 * i + 1] = hkl[1];
449 intHKL[3 * i + 2] = hkl[2];
450 V3D mnp = p.getIntMNP();
451 intMNP[3 * i + 0] = mnp[0];
452 intMNP[3 * i + 1] = mnp[1];
453 intMNP[3 * i + 2] = mnp[2];
455 goniometerMatrix[9 * i + 0] = gm[0][0];
456 goniometerMatrix[9 * i + 1] = gm[1][0];
457 goniometerMatrix[9 * i + 2] = gm[2][0];
458 goniometerMatrix[9 * i + 3] = gm[0][1];
459 goniometerMatrix[9 * i + 4] = gm[1][1];
460 goniometerMatrix[9 * i + 5] = gm[2][1];
461 goniometerMatrix[9 * i + 6] = gm[0][2];
462 goniometerMatrix[9 * i + 7] = gm[1][2];
463 goniometerMatrix[9 * i + 8] = gm[2][2];
464 }
465 const std::string shapeJSON = p.getPeakShape().toJSON();
466 shapes[i] = shapeJSON;
467 if (shapeJSON.size() > maxShapeJSONLength) {
468 maxShapeJSONLength = shapeJSON.size();
469 }
470 {
471 qlabs[3 * i + 0] = p.getQLabFrame().X();
472 qlabs[3 * i + 1] = p.getQLabFrame().Y();
473 qlabs[3 * i + 2] = p.getQLabFrame().Z();
474 }
475 }
476
477 // Start Peaks Workspace in Nexus File
478 const std::string specifyInteger = "An integer";
479 const std::string specifyDouble = "A double";
480 const std::string specifyString = "A string";
481 file->makeGroup("peaks_workspace", "NXentry",
482 true); // For when peaksWorkspace can be loaded
483
484 // Coordinate system
485 file->writeData("coordinate_system", static_cast<uint32_t>(m_coordSystem));
486
487 // Write out the Qconvention
488 // ki-kf for Inelastic convention; kf-ki for Crystallography convention
489 std::string m_QConvention = this->getConvention();
490 file->putAttr("QConvention", m_QConvention);
491
492 // H column
493 file->writeData("column_1", H);
494 file->openData("column_1");
495 file->putAttr("name", "H");
496 file->putAttr("interpret_as", specifyDouble);
497 file->putAttr("units", "Not known"); // Units may need changing when known
498 file->closeData();
499
500 // K column
501 file->writeData("column_2", K);
502 file->openData("column_2");
503 file->putAttr("name", "K");
504 file->putAttr("interpret_as", specifyDouble);
505 file->putAttr("units", "Not known"); // Units may need changing when known
506 file->closeData();
507
508 // L column
509 file->writeData("column_3", L);
510 file->openData("column_3");
511 file->putAttr("name", "L");
512 file->putAttr("interpret_as", specifyDouble);
513 file->putAttr("units", "Not known"); // Units may need changing when known
514 file->closeData();
515
516 // Intensity column
517 file->writeData("column_4", intensity);
518 file->openData("column_4");
519 file->putAttr("name", "Intensity");
520 file->putAttr("interpret_as", specifyDouble);
521 file->putAttr("units", "Not known"); // Units may need changing when known
522 file->closeData();
523
524 // Sigma Intensity column
525 file->writeData("column_5", sigmaIntensity);
526 file->openData("column_5");
527 file->putAttr("name", "Sigma Intensity");
528 file->putAttr("interpret_as", specifyDouble);
529 file->putAttr("units", "Not known"); // Units may need changing when known
530 file->closeData();
531
532 // Bin Count column
533 file->writeData("column_6", binCount);
534 file->openData("column_6");
535 file->putAttr("name", "Bin Count");
536 file->putAttr("interpret_as", specifyDouble);
537 file->putAttr("units", "Not known"); // Units may need changing when known
538 file->closeData();
539
540 // Wave Length Column
541 file->writeData("column_7", waveLength);
542 file->openData("column_7");
543 file->putAttr("name", "Wave Length");
544 file->putAttr("interpret_as", specifyDouble);
545 file->putAttr("units", "Not known"); // Units may need changing when known
546 file->closeData();
547
548 // Scattering Column
549 file->writeData("column_8", scattering);
550 file->openData("column_8");
551 file->putAttr("name", "Scattering");
552 file->putAttr("interpret_as", specifyDouble);
553 file->putAttr("units", "Not known"); // Units may need changing when known
554 file->closeData();
555
556 // D Spacing Column
557 file->writeData("column_9", dSpacing);
558 file->openData("column_9");
559 file->putAttr("name", "D Spacing");
560 file->putAttr("interpret_as", specifyDouble);
561 file->putAttr("units", "Not known"); // Units may need changing when known
562 file->closeData();
563
564 // Run Number column
565 file->writeData("column_10", runNumber);
566 file->openData("column_10");
567 file->putAttr("name", "Run Number");
568 file->putAttr("interpret_as", specifyInteger);
569 file->putAttr("units", "Not known"); // Units may need changing when known
570 file->closeData();
571
572 // Peak Number column
573 file->writeData("column_11", peakNumber);
574 file->openData("column_11");
575 file->putAttr("name", "Peak Number");
576 file->putAttr("interpret_as", specifyInteger);
577 file->putAttr("units", "Not known"); // Units may need changing when known
578 file->closeData();
579
580 // TBar column
581 file->writeData("column_12", tbar);
582 file->openData("column_12");
583 file->putAttr("name", "TBar");
584 file->putAttr("interpret_as", specifyDouble);
585 file->putAttr("units", "Not known"); // Units may need changing when known
586 file->closeData();
587
588 // Goniometer Matrix Column
589 const Nexus::DimVector array_dims{m_peaks.size(), 9};
590 file->writeData("column_13", goniometerMatrix, array_dims);
591 file->openData("column_13");
592 file->putAttr("name", "Goniometer Matrix");
593 file->putAttr("interpret_as", "A matrix of 3x3 doubles");
594 file->putAttr("units", "Not known"); // Units may need changing when known
595 file->closeData();
596
597 // Shape
598 Nexus::DimVector dims;
599 dims.emplace_back(np);
600 dims.emplace_back(static_cast<int>(maxShapeJSONLength));
601 const std::string name = "column_14";
602 file->makeData(name, NXnumtype::CHAR, dims, false);
603 file->openData(name);
604
605 auto toNexus = new char[maxShapeJSONLength * np];
606 for (size_t ii = 0; ii < np; ii++) {
607 std::string rowStr = shapes[ii];
608 for (size_t ic = 0; ic < rowStr.size(); ic++)
609 toNexus[ii * maxShapeJSONLength + ic] = rowStr[ic];
610 for (size_t ic = rowStr.size(); ic < static_cast<size_t>(maxShapeJSONLength); ic++)
611 toNexus[ii * maxShapeJSONLength + ic] = ' ';
612 }
613
614 file->putData(toNexus);
615
616 delete[] toNexus;
617 file->putAttr("units", "Not known"); // Units may need changing when known
618 file->putAttr("name", "Shape");
619 file->putAttr("interpret_as", specifyString);
620 file->closeData();
621
622 // Qlab
623 const Nexus::DimVector qlab_dims{m_peaks.size(), 3};
624 file->writeData("column_15", qlabs, qlab_dims);
625 file->openData("column_15");
626 file->putAttr("name", "Q LabFrame");
627 file->putAttr("interpret_as", "A vector of 3 doubles");
628 file->putAttr("units", "angstrom^-1");
629 file->closeData();
630
631 // Integer HKL column
632 file->writeData("column_16", intHKL, qlab_dims);
633 file->openData("column_16");
634 file->putAttr("name", "IntHKL");
635 file->putAttr("interpret_as", "A vector of 3 doubles");
636 file->putAttr("units", "r.l.u.");
637 file->closeData();
638
639 // Integer HKL column
640 file->writeData("column_17", intMNP, qlab_dims);
641 file->openData("column_17");
642 file->putAttr("name", "IntMNP");
643 file->putAttr("interpret_as", "A vector of 3 doubles");
644 file->putAttr("units", "r.l.u.");
645 file->closeData();
646
647 file->closeGroup(); // end of peaks workpace
648}
649
655 m_coordSystem = coordinateSystem;
656}
657
662
663// prevent shared pointer from deleting this
665 template <typename T> void operator()(T * /*unused*/) {}
666};
671
678
679ITableWorkspace *LeanElasticPeaksWorkspace::doCloneColumns(const std::vector<std::string> & /*colNames*/) const {
680 throw Kernel::Exception::NotImplementedError("LeanElasticPeaksWorkspace cannot clone columns.");
681}
682} // namespace Mantid::DataObjects
683
685
686namespace Mantid::Kernel {
687
688template <>
690IPropertyManager::getValue<Mantid::DataObjects::LeanElasticPeaksWorkspace_sptr>(const std::string &name) const {
692 getPointerToProperty(name));
693 if (prop) {
694 return *prop;
695 } else {
696 std::string message =
697 "Attempt to assign property " + name + " to incorrect type. Expected shared_ptr<LeanElasticPeaksWorkspace>.";
698 throw std::runtime_error(message);
699 }
700}
701
702template <>
704IPropertyManager::getValue<Mantid::DataObjects::LeanElasticPeaksWorkspace_const_sptr>(const std::string &name) const {
706 getPointerToProperty(name))) {
707 return prop->operator()();
708 } else {
709 std::string message = "Attempt to assign property " + name +
710 " to incorrect type. Expected const "
711 "shared_ptr<LeanElasticPeaksWorkspace>.";
712 throw std::runtime_error(message);
713 }
714}
715
716} // namespace Mantid::Kernel
717
std::string name
Definition Run.cpp:60
double value
The value of the point.
Definition FitMW.cpp:51
double position
Definition GetAllEi.cpp:154
std::map< DeltaEMode::Type, std::string > index
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Definition System.h:37
#define DECLARE_WORKSPACE(classname)
Run & mutableRun()
Writable version of the run object.
const Run & run() const
Run details object access.
const Sample & sample() const
Sample accessors.
int getRunNumber() const
Utility method to get the run number.
void setNumberOfDetectorGroups(const size_t count) const
Sets the number of detector groups.
Interface to the class Mantid::DataObjects::PeaksWorkspace.
ITableWorkspace is an implementation of Workspace in which the data are organised in columns of same ...
This class contains the information about the log entries.
Definition LogManager.h:44
const Geometry::Goniometer & getGoniometer() const
Return reference to the first const Goniometer object for this run.
Definition Run.cpp:525
const Geometry::OrientedLattice & getOrientedLattice() const
Get a reference to the sample's OrientedLattice.
Definition Sample.cpp:153
Mantid::Kernel::V3D getIntMNP() const override
Return the int MNP vector.
Definition BasePeak.cpp:115
double getL() const override
Get the L index of the peak.
Definition BasePeak.cpp:99
double getIntensity() const override
Return the integrated peak intensity.
Definition BasePeak.cpp:184
double getAbsorptionWeightedPathLength() const override
Gets the absorption weighted path length.
Definition BasePeak.cpp:347
double getSigmaIntensity() const override
Return the error on the integrated peak intensity.
Definition BasePeak.cpp:187
double getK() const override
Get the K index of the peak.
Definition BasePeak.cpp:96
int getPeakNumber() const override
Returns the unique peak number Returns -1 if it could not find it.
Definition BasePeak.cpp:233
int getRunNumber() const override
Return the run number this peak was measured at.
Definition BasePeak.cpp:77
double getH() const override
Get the H index of the peak.
Definition BasePeak.cpp:93
double getBinCount() const override
Return the # of counts in the bin at its peak.
Definition BasePeak.cpp:181
Mantid::Kernel::Matrix< double > getGoniometerMatrix() const override
Get the goniometer rotation matrix at which this peak was measured.
Definition BasePeak.cpp:209
const Mantid::Geometry::PeakShape & getPeakShape() const override
Get the peak shape.
Definition BasePeak.cpp:297
Mantid::Kernel::V3D getIntHKL() const override
Return the int HKL vector.
Definition BasePeak.cpp:112
virtual double getValueByColName(std::string colName) const
Helper function for displaying/sorting peaks.
Definition BasePeak.cpp:249
Structure describing a single-crystal peak.
double getWavelength() const override
Return the neutron wavelength (in angstroms)
double getScattering() const override
Calculate the scattering angle of the peak
double getDSpacing() const override
Calculate the d-spacing of the peak, in 1/Angstroms
Mantid::Kernel::V3D getQLabFrame() const final
Return the Q change (of the lattice, k_i - k_f) for this peak.
The class LeanElasticPeaksWorkspace stores information about a set of SCD lean peaks.
int peakInfoNumber(const Kernel::V3D &qFrame, bool labCoords) const override
Returns selected information for a "peak" at QLabFrame.
std::unique_ptr< Geometry::IPeak > createPeakQSample(const Kernel::V3D &position) const override
Creates an instance of a Peak BUT DOES NOT ADD IT TO THE WORKSPACE.
bool hasIntegratedPeaks() const override
Getter for the integration status.
API::ITableWorkspace_sptr createDetectorTable() const override
Creates a new TableWorkspace giving the IDs of the detectors that contribute to the peaks within the ...
std::unique_ptr< Geometry::IPeak > createPeak() const override
Create a Peak using default values.
std::vector< std::pair< std::string, std::string > > peakInfo(const Kernel::V3D &qFrame, bool labCoords) const override
Returns selected information for a "peak" at QLabFrame.
std::shared_ptr< Mantid::API::Column > getColumn(const std::string &name) override
Gets the shared pointer to a column by name.
API::LogManager_sptr logs() override
Get access to shared pointer containing workspace porperties.
void setCoordinateSystem(const Kernel::SpecialCoordinateSystem coordinateSystem) override
Set the special coordinate system.
Kernel::SpecialCoordinateSystem m_coordSystem
Coordinates.
void sort(std::vector< ColumnAndDirection > &criteria) override
Sort the peaks by one or more criteria.
std::vector< std::string > m_columnNames
Column names.
void removePeak(int peakNum) override
Removes the indicated peak.
void removePeaks(std::vector< int > badPeaks) override
Removes multiple peaks.
size_t getMemorySize() const override
Return the memory used in bytes.
std::vector< std::shared_ptr< Mantid::DataObjects::PeakColumn< LeanElasticPeak > > > m_columns
Column shared pointers.
void addPeak(const Geometry::IPeak &peak) override
Add a peak to the list.
std::vector< LeanElasticPeak > m_peaks
Vector of Peak contained within.
std::unique_ptr< Geometry::IPeak > createPeakHKL(const Kernel::V3D &HKL) const override
Create a Peak from a HKL value provided by the client.
LeanElasticPeaksWorkspace()
Register the workspace as a type.
API::LogManager_const_sptr getLogs() const override
Get constant access to shared pointer containing workspace porperties; Copies logs into new LogManage...
LeanElasticPeak & getPeak(size_t const peakNum) override
Return a reference to the Peak.
std::vector< LeanElasticPeak > & getPeaks()
Return a reference to the Peaks vector.
ITableWorkspace * doCloneColumns(const std::vector< std::string > &colNames) const override
Kernel::SpecialCoordinateSystem getSpecialCoordinateSystem() const override
Get the special coordinate system.
virtual size_t getColumnIndex(const std::string &name) const
void addPeakColumn(const std::string &name)
Adds a new PeakColumn of the given type.
PeakColumn : a Column sub-class used to display peak information as a TableWorkspace.
Definition PeakColumn.h:28
Comparator class for sorting peaks by one or more criteria.
PeakComparator(std::vector< ColumnAndDirection > &criteria)
Constructor for the comparator for sorting peaks.
LeanElasticPeaksWorkspace::ColumnAndDirection ColumnAndDirection
bool operator()(const LeanElasticPeak &a, const LeanElasticPeak &b)
Compare two peaks using the stored criteria.
std::vector< ColumnAndDirection > & criteria
HKL : HKL MDFrame.
Definition HKL.h:20
Structure describing a single-crystal peak.
Definition IPeak.h:26
virtual std::string toJSON() const =0
Serialize.
Marks code as not implemented yet.
Definition Exception.h:138
Numerical Matrix class.
Definition Matrix.h:42
The concrete, templated class for properties.
Class for 3D vectors.
Definition V3D.h:34
constexpr double X() const noexcept
Get x.
Definition V3D.h:238
constexpr double Y() const noexcept
Get y.
Definition V3D.h:239
constexpr double Z() const noexcept
Get z.
Definition V3D.h:240
static unsigned short constexpr CHAR
std::shared_ptr< const LogManager > LogManager_const_sptr
shared pointer to the logManager base class (const version)
Definition LogManager.h:233
std::shared_ptr< LogManager > LogManager_sptr
shared pointer to the logManager base class
Definition LogManager.h:231
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< LeanElasticPeaksWorkspace > LeanElasticPeaksWorkspace_sptr
Typedef for a shared pointer to a peaks workspace.
std::shared_ptr< const LeanElasticPeaksWorkspace > LeanElasticPeaksWorkspace_const_sptr
Typedef for a shared pointer to a const peaks workspace.
SpecialCoordinateSystem
Special coordinate systems for Q3D.
std::vector< dimsize_t > DimVector