Skip to content
Snippets Groups Projects
Commit e862beae authored by Lynch, Vickie's avatar Lynch, Vickie
Browse files

Refs #24333 over a factor of 10 faster

parent a5a2429c
No related branches found
No related tags found
No related merge requests found
......@@ -153,6 +153,12 @@ private:
// OptRuns setup
void setUpOptRuns();
mutable boost::shared_ptr<Geometry::Instrument> instChange;
mutable bool hasParameterMap = false;
mutable Kernel::V3D sampPos;
mutable boost::shared_ptr<const Geometry::ParameterMap> pmapSv;
};
} // namespace Crystal
} // namespace Mantid
......
......@@ -190,26 +190,31 @@ boost::shared_ptr<Geometry::Instrument>
PeakHKLErrors::getNewInstrument(PeaksWorkspace_sptr Peaks) const {
Geometry::Instrument_const_sptr instSave = Peaks->getPeak(0).getInstrument();
auto pmap = boost::make_shared<Geometry::ParameterMap>();
boost::shared_ptr<const Geometry::ParameterMap> pmapSv =
instSave->getParameterMap();
if (!instSave) {
g_log.error(" Peaks workspace does not have an instrument");
throw std::invalid_argument(" Not all peaks have an instrument");
}
auto instChange = boost::shared_ptr<Geometry::Instrument>();
if (!instSave->isParametrized()) {
boost::shared_ptr<Geometry::Instrument> instClone(instSave->clone());
auto Pinsta = boost::make_shared<Geometry::Instrument>(instSave, pmap);
instChange = Pinsta;
} else // catch(... )
{
auto P1 = boost::make_shared<Geometry::Instrument>(
instSave->baseInstrument(), instSave->makeLegacyParameterMap());
instChange = P1;
if (!hasParameterMap) {
pmapSv = instSave->getParameterMap();
hasParameterMap = true;
if (!instSave->isParametrized()) {
boost::shared_ptr<Geometry::Instrument> instClone(instSave->clone());
auto Pinsta = boost::make_shared<Geometry::Instrument>(instSave, pmap);
instChange = Pinsta;
IComponent_const_sptr sample = instChange->getSample();
sampPos = sample->getRelativePos();
} else // catch(... )
{
auto P1 = boost::make_shared<Geometry::Instrument>(
instSave->baseInstrument(), instSave->makeLegacyParameterMap());
instChange = P1;
IComponent_const_sptr sample = instChange->getSample();
sampPos = sample->getRelativePos();
}
}
if (!instChange) {
......@@ -219,11 +224,10 @@ PeakHKLErrors::getNewInstrument(PeaksWorkspace_sptr Peaks) const {
//------------------"clone" orig instruments pmap -------------------
cLone(pmap, instSave, pmapSv);
IComponent_const_sptr sample = instChange->getSample();
V3D sampPos = sample->getRelativePos();
V3D sampOffsets(getParameter("SampleXOffset"), getParameter("SampleYOffset"),
getParameter("SampleZOffset"));
IComponent_const_sptr sample = instChange->getSample();
pmap->addPositionCoordinate(sample.get(), std::string("x"),
sampPos.X() + sampOffsets.X());
pmap->addPositionCoordinate(sample.get(), std::string("y"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment