29#include "MantidBeamline/ComponentInfo.h"
30#include "MantidBeamline/DetectorInfo.h"
31#include "MantidBeamline/SpectrumInfo.h"
42#include "MantidTypes/SpectrumDefinition.h"
44#include <boost/algorithm/string.hpp>
45#include <boost/lexical_cast.hpp>
46#include <boost/regex.hpp>
49#include <nexus/NeXusException.hpp>
116 }
catch (std::exception &) {
121 std::ostringstream out;
124 const auto instName = inst->getName();
125 out <<
"Instrument: ";
126 if (!instName.empty()) {
127 out << instName <<
" (" << inst->getValidFromDate().toFormattedString(
"%Y-%b-%d") <<
" to "
128 << inst->getValidToDate().toFormattedString(
"%Y-%b-%d") <<
")";
129 const auto instFilename = inst->getFilename();
130 if (!instFilename.empty()) {
131 out <<
"Instrument from: " << instFilename;
141 for (
auto &itFilename : paramFileVector) {
142 out <<
"Parameters from: " << itFilename;
148 std::string msgNA =
"not available";
149 if (runStart.empty())
153 out <<
"Run start: " << runStart <<
"\n";
154 out <<
"Run end: " << runEnd <<
"\n";
156 if (this->
sample().hasOrientedLattice()) {
158 out <<
"Sample: a " << std::fixed << std::setprecision(1) << latt.
a() <<
", b " << latt.
b() <<
", c " << latt.
c();
159 out <<
"; alpha " << std::fixed << std::setprecision(0) << latt.
alpha() <<
", beta " << latt.
beta() <<
", gamma "
170 if (numDets != detInfo.
size())
171 throw std::runtime_error(
"ExperimentInfo: size mismatch between "
172 "DetectorInfo and number of detectors in "
187 if (
sptr_instrument != (instr->isParametrized() ? instr->baseInstrument() : instr))
189 if (instr->isParametrized()) {
194 m_parmap = std::make_shared<ParameterMap>(*instr->getParameterMap());
197 m_parmap = std::make_shared<ParameterMap>();
244 RTP() :
radius(0.0), haveRadius(false), theta(0.0), phi(0.0) {}
251struct ParameterValue {
253 : info(paramInfo), runData(run) {}
256 if (info.m_logfileID.empty())
257 return boost::lexical_cast<double>(info.m_value);
259 return info.createParamValue(runData.getTimeSeriesProperty<
double>(info.m_logfileID));
261 operator int() {
return boost::lexical_cast<int>(info.m_value); }
263 if (boost::iequals(info.m_value,
"true"))
265 else if (boost::iequals(info.m_value,
"yes"))
277bool isPositionParameter(
const std::string &name) {
return ParameterMap::pos() == name; }
279bool isRotationParameter(
const std::string &name) {
return ParameterMap::rot() == name; }
281bool isScaleParameter(
const std::string &name) {
return (name ==
"scalex" || name ==
"scaley"); }
283bool isRedundantPosOrRot(
const std::string &name) {
285 return (name.size() == 4) &&
286 (name ==
"posx" || name ==
"posy" || name ==
"posz" || name ==
"rotx" || name ==
"roty" || name ==
"rotz");
289template <
class T> T getParam(
const std::string ¶mType,
const std::string ¶mValue) {
290 const std::string name =
"dummy";
292 param->fromString(paramValue);
293 return param->value<T>();
299 if (componentInfo.
hasParent(compIndex)) {
300 const auto parentIndex = componentInfo.
parent(compIndex);
311 if (componentInfo.
hasParent(compIndex)) {
312 const auto parentIndex = componentInfo.
parent(compIndex);
319 const std::string ¶mName,
double factor) {
322 if (paramName ==
"scalex")
340 const auto &runData =
run();
351 const auto instrument = parInstrument->baseInstrument();
352 const auto ¶mInfoFromIDF = instrument->getLogfileCache();
354 std::map<const IComponent *, RTP> rtpParams;
364 for (
const auto &item : paramInfoFromIDF) {
365 const auto &nameComp = item.first;
366 const auto ¶mInfo = item.second;
367 const std::string ¶mN = nameComp.first;
373 if (paramN.compare(1, 9,
"-position") == 0) {
374 auto &rtpValues = rtpParams[paramInfo->m_component];
377 double value = ParameterValue(*paramInfo, runData);
378 if (paramN.compare(0, 1,
"r") == 0) {
379 rtpValues.radius =
value;
380 rtpValues.haveRadius =
true;
381 }
else if (paramN.compare(0, 1,
"t") == 0)
382 rtpValues.theta =
value;
383 else if (paramN.compare(0, 1,
"p") == 0)
384 rtpValues.phi =
value;
385 if (rtpValues.haveRadius) {
387 pos.
spherical(rtpValues.radius, rtpValues.theta, rtpValues.phi);
393 }
catch (std::exception &exc) {
394 g_log.
information() <<
"Unable to add component parameter '" << nameComp.first <<
"'. Error: " << exc.what();
398 for (
const auto &item : paramMapForPosAndRot) {
399 if (isPositionParameter(item.second->name())) {
400 const auto newRelPos = item.second->value<
V3D>();
402 }
else if (isRotationParameter(item.second->name())) {
403 const auto newRelRot = item.second->value<
Quat>();
411 for (
const auto &item : paramMap) {
412 if (isScaleParameter(item.second->name()))
413 adjustPositionsFromScaleFactor(
componentInfo, item.first, item.second->
name(), item.second->value<
double>());
445 SpectrumDefinition specDef;
446 for (
const auto detID : detIDs) {
449 specDef.add(detIndex);
450 }
catch (std::out_of_range &) {
466 throw std::runtime_error(
"ExperimentInfo::updateCachedDetectorGrouping: "
467 "Cannot update -- grouping information not "
504 return m_run.access();
535 if (logName.empty()) {
536 throw std::invalid_argument(
"ExperimentInfo::getLog - No instrument parameter named \"" + log +
537 "\". Cannot access full log name");
560 if (logName.empty()) {
561 throw std::invalid_argument(
"ExperimentInfo::getLog - No instrument parameter named \"" + log +
562 "\". Cannot access full log name");
573 const Run &thisRun =
run();
602 static const char *emodeTag =
"deltaE-mode";
603 std::string emodeStr;
604 if (
run().hasProperty(emodeTag)) {
608 emodeStr = param->asString();
643 const std::vector<std::string> ¶meterNames)
const {
645 for (
auto ¶meterName : parameterNames) {
648 efixed = par->value<
double>();
650 std::vector<double> efixedVec = detector->getNumberParameter(parameterName);
651 if (efixedVec.empty()) {
652 int detid = detector->getID();
654 efixedVec = detectorSingle->getNumberParameter(parameterName);
656 if (!efixedVec.empty()) {
662 std::ostringstream os;
663 os <<
"ExperimentInfo::getEFixed - Indirect mode efixed requested but "
664 "detector has no Efixed parameter attached. ID="
665 << detector->getID();
666 throw std::runtime_error(os.str());
682 for (
auto ¶meterName : {
"Ei",
"EnergyRequested",
"EnergyEstimate"}) {
683 if (
run().hasProperty(parameterName)) {
689 throw std::runtime_error(
"Experiment logs do not contain an Ei "
690 "value. Have you run GetEi?");
695 throw std::runtime_error(
"ExperimentInfo::getEFixed - Indirect mode "
696 "efixed requested without a valid detector.");
699 throw std::runtime_error(
"ExperimentInfo::getEFixed - EFixed requested for "
700 "elastic mode, don't know what to do!");
708 pmap.addDouble(det.get(),
"Efixed",
value);
724 }
catch (std::runtime_error &) {
727 date = Types::Core::DateAndTime::getCurrentTime().toISO8601String();
743 }
catch (std::runtime_error &) {
760 }
catch (std::runtime_error &) {
781 return m_parmap->mutableDetectorInfo();
818 [](
char i) { return i == 1; })) {
821 [](
char i) { return i == 1; })) {
823#pragma omp parallel for
824 for (int64_t i = 0; i < size; ++i) {
844 if (spectrumDefinitions) {
845 m_spectrumInfo = std::make_unique<Beamline::SpectrumInfo>(std::move(spectrumDefinitions));
882 size_t specIndex = 0;
883 for (
const auto detID : detIDs) {
886 SpectrumDefinition specDef;
887 specDef.add(detIndex);
888 m_spectrumInfo->setSpectrumDefinition(specIndex, std::move(specDef));
906 if (saveLegacyInstrument) {
907 instrument->saveNexus(file,
"instrument");
920 bool saveLogs)
const {
924 instrument->saveNexus(file,
"instrument");
935 const std::string &prefix) {
938 if (sampleVersion == 0) {
941 file->openGroup(
"sample",
"NXsample");
956 if (sampleVersion == 0) {
959 file->openGroup(
"sample",
"NXsample");
969 std::string ¶meterStr,
971 const std::string &prefix) {
990 std::string ¶meterStr) {
1008 std::string ¶meterStr) {
1011 file->openGroup(
"instrument",
"NXinstrument");
1014 std::string instrumentName;
1015 std::string instrumentXml;
1040 file->openGroup(
"instrument",
"NXinstrument");
1043 std::string instrumentName;
1044 std::string instrumentXml;
1061 std::string &instrumentXml) {
1063 file->readData(
"name", instrumentName);
1066 file->openGroup(
"instrument_xml",
"NXnote");
1067 file->readData(
"data", instrumentXml);
1069 }
catch (NeXus::Exception &ex) {
1070 g_log.
debug(std::string(
"Unable to load instrument_xml: ") + ex.what());
1084 std::string &instrumentXml) {
1088 std::string instrumentFilename;
1089 if (!instrumentXml.empty()) {
1093 instrumentFilename = nxFilename;
1094 g_log.
debug() <<
"Using instrument IDF XML text contained in nexus file.\n";
1104 if (!instrumentXml.empty() && !instrumentName.empty()) {
1122 instr->parseTreeAndCacheBeamline();
1141 }
catch (std::exception &e) {
1142 g_log.
error() <<
"Error loading instrument IDF file: " << filename <<
".\n";
1156 file->openGroup(
"instrument_parameter_map",
"NXnote");
1157 file->readData(
"data", parameterStr);
1159 }
catch (NeXus::Exception &ex) {
1160 g_log.
debug(std::string(
"Unable to load instrument_parameter_map: ") + ex.what());
1161 g_log.
information(
"Parameter map entry missing from NeXus file. Continuing without it.");
1182 auto iend = splitter.
end();
1185 const std::string visibilityKey =
"visible:";
1187 for (
auto itr = splitter.
begin(); itr != iend; ++itr) {
1189 if (tokens.
count() < 4)
1191 std::string comp_name = tokens[0];
1196 if (comp_name.find(
"detID:") != std::string::npos) {
1197 int detID = std::stoi(comp_name.substr(6));
1200 g_log.
warning() <<
"Cannot find detector " << detID <<
'\n';
1206 g_log.
warning() <<
"Cannot find component " << comp_name <<
'\n';
1213 std::string paramValue = tokens[3];
1214 auto size =
static_cast<int>(tokens.
count());
1215 for (
int i = 4; i < size; i++)
1216 paramValue +=
";" + tokens[i];
1217 const auto ¶mType = tokens[1];
1218 const auto ¶mName = tokens[2];
1219 auto ¶mVisibility = tokens[size - 1];
1220 if (paramVisibility.find(visibilityKey) > paramVisibility.size())
1221 paramVisibility =
"true";
1224 paramVisibility.substr(paramVisibility.find(visibilityKey) + visibilityKey.size(), paramVisibility.size());
1225 paramValue = paramValue.substr(0, paramValue.find(visibilityKey) - 1);
1227 const auto paramDescr = std::string(
"");
1228 if (paramName ==
"masked") {
1229 auto value = getParam<bool>(paramType, paramValue);
1234 throw std::runtime_error(
"Found masking for a non-detector "
1235 "component. This is not possible");
1241 }
else if (isPositionParameter(paramName)) {
1246 const auto newRelPos = getParam<V3D>(paramType, paramValue);
1248 }
else if (isRotationParameter(paramName)) {
1253 const auto newRelRot = getParam<Quat>(paramType, paramValue);
1255 }
else if (!isRedundantPosOrRot(paramName)) {
1258 if (isScaleParameter(paramName))
1259 adjustPositionsFromScaleFactor(
componentInfo, comp, paramName, getParam<double>(paramType, paramValue));
1260 pmap.add(paramType, comp, paramName, paramValue, ¶mDescr, paramVisibility);
1278 const std::string &category = paramInfo.
m_type;
1279 ParameterValue paramValue(paramInfo,
1282 const std::string *pDescription =
nullptr;
1285 std::string pVisible =
"true";
1290 if (name ==
"masked") {
1291 bool value(paramValue);
1297 throw std::runtime_error(
"Found masking for a non-detector component. This is not possible");
1303 }
else if (name ==
"x" || name ==
"y" || name ==
"z") {
1305 }
else if (name ==
"rot" || name ==
"rotx" || name ==
"roty" || name ==
"rotz") {
1308 }
else if (category ==
"fitting") {
1309 std::ostringstream str;
1314 paramMap.
add(
"fitting", paramInfo.
m_component, name, str.str(), pDescription, pVisible);
1315 }
else if (category ==
"string") {
1317 }
else if (category ==
"bool") {
1319 }
else if (category ==
"int") {
1320 paramMap.
addInt(paramInfo.
m_component, name, paramValue, pDescription, pVisible);
1337IPropertyManager::getValue<Mantid::API::ExperimentInfo_sptr>(
const std::string &name)
const {
1342 std::string message =
1343 "Attempt to assign property " + name +
" to incorrect type. Expected shared_ptr<ExperimentInfo>.";
1344 throw std::runtime_error(message);
1350IPropertyManager::getValue<Mantid::API::ExperimentInfo_const_sptr>(
const std::string &name)
const {
1353 return prop->operator()();
1355 std::string message =
1356 "Attempt to assign property " + name +
" to incorrect type. Expected const shared_ptr<ExperimentInfo>.";
1357 throw std::runtime_error(message);
double value
The value of the point.
std::map< DeltaEMode::Type, std::string > index
Mantid::Kernel::Quat(ComponentInfo::* rotation)(const size_t) const
This class is shared by a few Workspace types and holds information related to a particular experimen...
Geometry::DetectorInfo & mutableDetectorInfo()
Return a non-const reference to the DetectorInfo object.
Run & mutableRun()
Writable version of the run object.
Kernel::cow_ptr< Sample > m_sample
The information on the sample environment.
const SpectrumInfo & spectrumInfo() const
Return a reference to the SpectrumInfo object.
std::shared_ptr< Geometry::ParameterMap > m_parmap
Parameters modifying the base instrument.
ExperimentInfo()
Default constructor.
void setInstumentFromXML(const std::string &nxFilename, std::string &instrumentName, std::string &instrumentXml)
Set the instrument given the name and XML leading from IDF file if XML string is empty.
Geometry::ComponentInfo & mutableComponentInfo()
const Geometry::DetectorInfo & detectorInfo() const
Return a const reference to the DetectorInfo object.
virtual ExperimentInfo * cloneExperimentInfo() const
Clone us.
std::unordered_map< detid_t, size_t > m_det2group
Detector grouping information.
double getEFixed(const detid_t detID) const
Easy access to the efixed value for this run & detector ID.
void readParameterMap(const std::string ¶meterStr)
Populate the parameter map given a string.
virtual void populateIfNotLoaded() const
Called as the first operation of most public methods.
void invalidateSpectrumDefinition(const size_t index)
Notifies the ExperimentInfo that a spectrum definition has changed.
size_t numberOfDetectorGroups() const
Returns the number of detector groups.
void updateSpectrumDefinitionIfNecessary(const size_t index) const
std::string getAvailableWorkspaceStartDate() const
Return workspace start date as a formatted string (strftime, as returned by Types::Core::DateAndTime)...
std::string loadInstrumentXML(const std::string &filename)
Loads the contents of a file and returns the string The file is assumed to be an IDF,...
virtual ~ExperimentInfo()
Virtual destructor.
virtual void updateCachedDetectorGrouping(const size_t index) const
Update detector grouping for spectrum with given index.
void loadSampleAndLogInfoNexus(::NeXus::File *file, const Mantid::Kernel::NexusHDF5Descriptor &fileInfo, const std::string &prefix)
Load the sample and log info from an open NeXus file.
void loadInstrumentInfoNexus(const std::string &nxFilename, ::NeXus::File *file, std::string ¶meterStr)
Load the instrument from an open NeXus file.
void cacheDefaultDetectorGrouping() const
Sets up a default detector grouping.
std::mutex m_spectrumInfoMutex
void copyExperimentInfoFrom(const ExperimentInfo *other)
Copy everything from the given experiment object.
const Run & run() const
Run details object access.
const Geometry::ParameterMap & constInstrumentParameters() const
Const version.
Geometry::Instrument_const_sptr getInstrument() const
Returns the parameterized instrument.
Kernel::DeltaEMode::Type getEMode() const
Returns the emode for this run.
void loadExperimentInfoNexus(const std::string &nxFilename, ::NeXus::File *file, std::string ¶meterStr, const Mantid::Kernel::NexusHDF5Descriptor &fileInfo, const std::string &prefix)
std::unique_ptr< Beamline::SpectrumInfo > m_spectrumInfo
const Sample & sample() const
Sample accessors.
void setEFixed(const detid_t detID, const double value)
Set the efixed value for a given detector ID.
double getEFixedGivenEMode(const std::shared_ptr< const Geometry::IDetector > &detector, const Kernel::DeltaEMode::Type emode) const
Easy access to the efixed value for this run & detector.
double getEFixedForIndirect(const std::shared_ptr< const Geometry::IDetector > &detector, const std::vector< std::string > ¶meterNames) const
const std::string toString() const
Returns a string description of the object.
const Geometry::ParameterMap & instrumentParameters() const
Returns the set of parameters modifying the base instrument (const-version)
int getRunNumber() const
Utility method to get the run number.
std::string getAvailableWorkspaceEndDate() const
Return workspace end date as a formatted string (strftime style, as returned by Kernel::DateAdnTime) ...
const Geometry::ComponentInfo & componentInfo() const
void loadInstrumentParametersNexus(::NeXus::File *file, std::string ¶meterStr)
Load instrument parameters from an open Nexus file in Instument group if found there.
std::string getWorkspaceStartDate() const
Returns the start date for this experiment (or current time if no info available)
void loadEmbeddedInstrumentInfoNexus(::NeXus::File *file, std::string &instrumentName, std::string &instrumentXml)
Attempt to load instrument embedded in Nexus file.
void setInstrument(const Geometry::Instrument_const_sptr &instr)
Instrument accessors.
std::unique_ptr< SpectrumInfo > m_spectrumInfoWrapper
void setSharedRun(Kernel::cow_ptr< Run > run)
Set the run object. Use in particular to clear run without copying old run.
void saveExperimentInfoNexus(::NeXus::File *file, bool saveLegacyInstrument=true) const
Saves this experiment description to the open NeXus file.
void setDetectorGrouping(const size_t index, const std::set< detid_t > &detIDs) const
Sets the detector grouping for the spectrum with the given index.
Kernel::cow_ptr< Run > sharedRun()
Return the cow ptr of the run.
ExperimentInfo & operator=(const ExperimentInfo &)
Implements the copy assignment operator.
void setSpectrumDefinitions(Kernel::cow_ptr< std::vector< SpectrumDefinition > > spectrumDefinitions)
Sets the SpectrumDefinition for all spectra.
void populateWithParameter(Geometry::ParameterMap ¶mMap, Geometry::ParameterMap ¶mMapForPosAndRot, const std::string &name, const Geometry::XMLInstrumentParameter ¶mInfo, const Run &runData)
Fill with given instrument parameter.
std::vector< char > m_spectrumDefinitionNeedsUpdate
double getLogAsSingleValue(const std::string &log) const
Access a single value from a log for this experiment.
SpectrumInfo & mutableSpectrumInfo()
Return a non-const reference to the SpectrumInfo object.
void setNumberOfDetectorGroups(const size_t count) const
Sets the number of detector groups.
Sample & mutableSample()
Writable version of the sample object.
Geometry::Instrument_const_sptr sptr_instrument
The base (unparametrized) instrument.
void populateInstrumentParameters()
Add parameters to the instrument parameter map that are defined in instrument definition file or para...
Kernel::Property * getLog(const std::string &log) const
Access a log for this experiment.
void invalidateAllSpectrumDefinitions()
Sets flags for all spectrum definitions indicating that they need to be updated.
Kernel::cow_ptr< Run > m_run
The run information.
static std::string getInstrumentFilename(const std::string &instrumentName, const std::string &date="")
Get the IDF using the instrument name and date.
const Types::Core::DateAndTime endTime() const
Return the run end time.
bool hasProperty(const std::string &name) const
Does the property exist on the object.
const Types::Core::DateAndTime startTime() const
Return the run start time.
Kernel::Property * getProperty(const std::string &name) const
Returns the named property as a pointer.
double getPropertyAsSingleValue(const std::string &name, Kernel::Math::StatisticType statistic=Kernel::Math::Mean) const
Returns a property as a single double value from its name.
HeldType getPropertyValueAsType(const std::string &name) const
Get the value of a property as the given TYPE.
This class stores information regarding an experimental run as a series of log entries.
void saveNexus(::NeXus::File *file, const std::string &group, bool keepOpen=false) const override
Save the run to a NeXus file with a given group name.
void loadNexus(::NeXus::File *file, const std::string &group, const Mantid::Kernel::NexusHDF5Descriptor &fileInfo, const std::string &prefix, bool keepOpen=false) override
Load the run from a NeXus file with a given group name.
This class stores information about the sample used in particular run.
void saveNexus(::NeXus::File *file, const std::string &group) const
Save the object to an open NeXus file.
const Geometry::OrientedLattice & getOrientedLattice() const
Get a reference to the sample's OrientedLattice.
int loadNexus(::NeXus::File *file, const std::string &group)
Load the object from an open NeXus file.
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
const Kernel::cow_ptr< std::vector< SpectrumDefinition > > & sharedSpectrumDefinitions() const
std::shared_ptr< const IComponent > getComponentByName(const std::string &cname, int nlevels=0) const override
Returns a pointer to the first component of assembly encountered with the given name.
ComponentInfo : Provides a component centric view on to the instrument.
bool hasParent(const size_t componentIndex) const
void setRotation(size_t componentIndex, const Kernel::Quat &newRotation)
size_t parent(const size_t componentIndex) const
Kernel::Quat rotation(const size_t componentIndex) const
Kernel::V3D position(const size_t componentIndex) const
size_t indexOf(Geometry::IComponent *id) const
bool isDetector(const size_t componentIndex) const
const std::string & name(const size_t componentIndex) const
void setPosition(size_t componentIndex, const Kernel::V3D &newPosition)
Geometry::DetectorInfo is an intermediate step towards a DetectorInfo that is part of Instrument-2....
void setMasked(const size_t index, bool masked)
Set the mask flag of the detector with given index. Not thread safe.
size_t indexOf(const detid_t id) const
Returns the index of the detector with the given detector ID.
size_t size() const
Returns the size of the DetectorInfo, i.e., the number of detectors in the instrument.
base class for Geometric IComponent
virtual ComponentID getComponentID() const =0
Returns the ComponentID - a unique identifier of the component.
Creates an instrument data from a XML instrument description file.
std::shared_ptr< Instrument > parseXML(Kernel::ProgressBase *progressReporter)
Parse XML contents.
std::string getMangledName()
Handle used in the singleton constructor for instrument file should append the value file sha-1 check...
std::size_t getNumberDetectors(bool skipMonitors=false) const
std::shared_ptr< const Instrument > baseInstrument() const
Pointer to the 'real' instrument, for parametrized instruments.
IDetector_const_sptr getDetector(const detid_t &detector_id) const
Gets a pointer to the detector from its ID Note that for getting the detector associated with a spect...
Class to implement UB matrix.
static std::shared_ptr< Instrument > createInstrument(const std::shared_ptr< const Instrument > &base, const std::shared_ptr< ParameterMap > &map)
Create a parameterized instrument from the given base and ParameterMap.
static std::shared_ptr< Parameter > create(const std::string &className, const std::string &name, const std::string &visible="true")
Creates an instance of a parameter.
const std::vector< std::string > & getParameterFilenames() const
Returns a list of all the parameter files loaded.
bool contains(const IComponent *comp, const std::string &name, const std::string &type="") const
Does the named parameter exist for the given component and type (std::string version)
void addInt(const IComponent *comp, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
Adds an int value to the parameter map.
void addPositionCoordinate(const IComponent *comp, const std::string &name, const double value, const std::string *const pDescription=nullptr)
Create or adjust "pos" parameter for a component.
std::shared_ptr< Parameter > getRecursive(const IComponent *comp, const std::string &name, const std::string &type="") const
Use get() recursively to see if can find param in all parents of comp and given type (std::string ver...
static const std::string & rot()
std::string getString(const IComponent *comp, const std::string &name, bool recursive=false) const
Return the value of a parameter as a string.
void addString(const IComponent *comp, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
Adds a std::string value to the parameter map.
void addDouble(const IComponent *comp, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
Adds a double value to the parameter map.
static const std::string & pos()
Return string to be used in the map.
void addRotationParam(const IComponent *comp, const std::string &name, const double deg, const std::string *const pDescription=nullptr)
Create or adjust "rot" parameter for a component.
void add(const std::string &type, const IComponent *comp, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &visible="true")
Method for adding a parameter providing its value as a string.
void addV3D(const IComponent *comp, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr)
Adds a Kernel::V3D value to the parameter map.
void addBool(const IComponent *comp, const std::string &name, const std::string &value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
Adds a bool value to the parameter map.
std::shared_ptr< Parameter > get(const IComponent *comp, const std::string &name, const std::string &type="") const
Get a parameter with a given name and type (std::string version)
double alpha() const
Get lattice parameter.
double a(int nd) const
Get lattice parameter a1-a3 as function of index (0-2)
double c() const
Get lattice parameter.
double beta() const
Get lattice parameter.
double b() const
Get lattice parameter.
double gamma() const
Get lattice parameter.
This class is used to store information about parameters in XML instrument definition files and instr...
const Geometry::IComponent * m_component
value from the log value
const std::string m_value
rather then extracting value from logfile,
const std::string m_type
type of the data, e.g. int, double or string
const std::string m_description
if present, contains help string, describing the parameter
const std::string m_visible
if present, describes whether the parameter shall be visible in InstrumentViewer
std::shared_ptr< Kernel::Interpolation > m_interpolation
evaluating the formula
const std::string m_fittingFunction
specific to fitting parameter
std::string m_penaltyFactor
parameter specify lower and upper bound in that order
const std::string m_formula
specify fitting function
const std::string m_resultUnit
expected result (output) unit from
const std::vector< std::string > m_constraint
specific to fitting
const std::string m_tie
specific to fitting parameter specify any tie
const std::string m_formulaUnit
formula to use for setting this parameter
Exception for when an item is not found in a collection.
The Logger class is in charge of the publishing messages from the framework through various channels.
void debug(const std::string &msg)
Logs at debug level.
void error(const std::string &msg)
Logs at error level.
void warning(const std::string &msg)
Logs at warning level.
void information(const std::string &msg)
Logs at information level.
The concrete, templated class for properties.
Base class for properties.
virtual std::string value() const =0
Returns the value of the property as a string.
void rotate(V3D &) const
Rotate a vector.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
Iterator begin()
Iterator referring to first element in the container.
@ TOK_IGNORE_EMPTY
ignore empty tokens
@ TOK_TRIM
remove leading and trailing whitespace from tokens
Iterator end()
Iterator referring to the past-the-end element in the container.
std::size_t count() const
Get the total number of tokens.
void spherical(const double R, const double theta, const double phi) noexcept
Sets the vector position based on spherical coordinates.
Implements a copy on write data template.
std::shared_ptr< const ExperimentInfo > ExperimentInfo_const_sptr
Shared pointer to const ExperimentInfo.
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< ExperimentInfo > ExperimentInfo_sptr
Shared pointer to ExperimentInfo.
MANTID_API_DLL void applyRectangularDetectorScaleToComponentInfo(Geometry::ComponentInfo &componentInfo, Geometry::IComponent *componentId, const double scaleX, const double scaleY)
Helpers for resizing RectangularDetectors.
std::shared_ptr< Parameter > Parameter_sptr
Typedef for the shared pointer.
std::shared_ptr< const Mantid::Geometry::IDetector > IDetector_const_sptr
Shared pointer to IDetector (const version)
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.
std::shared_ptr< Instrument > Instrument_sptr
Shared pointer to an instrument object.
MANTID_KERNEL_DLL std::string strip(const std::string &A)
strip pre/post spaces
MANTID_KERNEL_DLL std::string loadFile(const std::string &filename)
Loads the entire contents of a text file into a string.
int convert(const std::string &A, T &out)
Convert a string into a number.
int32_t detid_t
Typedef for a detector ID.
Generate a tableworkspace to store the calibration results.
static Type fromString(const std::string &modeStr)
Returns the emode from the given string.
Type
Define the available energy transfer modes It is important to assign enums proper numbers,...