37 auto mustBePositive = std::make_shared<BoundedValidator<double>>();
38 mustBePositive->setLower(0.0);
39 auto reasonableAngle = std::make_shared<BoundedValidator<double>>();
40 reasonableAngle->setLower(5.0);
41 reasonableAngle->setUpper(175.0);
42 auto mustBe3D = std::make_shared<ArrayLengthValidator<double>>(3);
43 auto threeVthree = std::make_shared<ArrayLengthValidator<double>>(9);
44 std::vector<double> zeroes(9, 0.), u0(3, 0), v0(3, 0);
48 "An input workspace.");
51 "Lattice parameter a");
54 "Lattice parameter b");
57 "Lattice parameter c");
60 "Lattice parameter alpha (degrees)");
63 "Lattice parameter beta (degrees)");
66 "Lattice parameter gamma(degrees) ");
68 "Vector along k_i, when goniometer is at 0");
70 "In plane vector perpendicular to k_i, when goniometer is at 0");
73 "For an MD workspace, the sample number to wich to "
74 "attach an oriented lattice (starting from 0). No "
75 "number, or negative number, means that it will copy "
83 std::unique_ptr<Mantid::Geometry::OrientedLattice> lattice;
86 if (UBMatrix == zeroMatrix) {
87 double a, b, c, alpha, beta, gamma;
97 lattice = std::make_unique<OrientedLattice>(a, b, c, alpha, beta, gamma);
100 if (UBMatrix.determinant() == 0)
101 throw std::invalid_argument(
"UB matrix determinant is 0");
103 lattice = std::make_unique<OrientedLattice>();
104 lattice->setUB(UBMatrix);
113 if (mdws !=
nullptr) {
115 if ((sampleNumber ==
EMPTY_INT()) || (sampleNumber < 0))
117 for (uint16_t i = 0; i < mdws->getNumExperimentInfo(); i++) {
118 mdws->getExperimentInfo(i)->mutableSample().setOrientedLattice(std::make_unique<OrientedLattice>(*lattice));
122 if (
static_cast<uint16_t
>(sampleNumber) > (mdws->getNumExperimentInfo() - 1)) {
123 g_log.
warning() <<
"Number greater than the number of last sample in "
125 << (mdws->getNumExperimentInfo() - 1) <<
"). Will use sample number 0 instead\n";
128 mdws->getExperimentInfo(
static_cast<uint16_t
>(sampleNumber))
130 .setOrientedLattice(std::move(lattice));
136 throw std::invalid_argument(
"Wrong type of workspace");
137 ei->mutableSample().setOrientedLattice(std::move(lattice));