From 2bc032899f73240b24f7a3a2308ab2fff5c249ee Mon Sep 17 00:00:00 2001
From: Simon Heybrock <simon.heybrock@esss.se>
Date: Mon, 16 Jan 2017 08:44:35 +0100
Subject: [PATCH] Re #18436. Use non-virtual interface for
 (FileBacked)ExperimentInfo.

---
 Framework/API/inc/MantidAPI/ExperimentInfo.h  |  89 +++---
 .../inc/MantidAPI/FileBackedExperimentInfo.h  |  66 +----
 Framework/API/src/ExperimentInfo.cpp          |  44 +++
 .../API/src/FileBackedExperimentInfo.cpp      | 258 ------------------
 4 files changed, 90 insertions(+), 367 deletions(-)

diff --git a/Framework/API/inc/MantidAPI/ExperimentInfo.h b/Framework/API/inc/MantidAPI/ExperimentInfo.h
index 62956b8caca..23a67104bca 100644
--- a/Framework/API/inc/MantidAPI/ExperimentInfo.h
+++ b/Framework/API/inc/MantidAPI/ExperimentInfo.h
@@ -53,103 +53,99 @@ public:
   virtual ExperimentInfo *cloneExperimentInfo() const;
 
   /// Returns a string description of the object
-  virtual const std::string toString() const;
+  const std::string toString() const;
 
   /// Instrument accessors
   void setInstrument(const Geometry::Instrument_const_sptr &instr);
   /// Returns the parameterized instrument
-  virtual Geometry::Instrument_const_sptr getInstrument() const;
+  Geometry::Instrument_const_sptr getInstrument() const;
 
   /// Returns the set of parameters modifying the base instrument
   /// (const-version)
-  virtual const Geometry::ParameterMap &instrumentParameters() const;
+  const Geometry::ParameterMap &instrumentParameters() const;
   /// Returns a modifiable set of instrument parameters
-  virtual Geometry::ParameterMap &instrumentParameters();
+  Geometry::ParameterMap &instrumentParameters();
   /// Const version
-  virtual const Geometry::ParameterMap &constInstrumentParameters() const;
+  const Geometry::ParameterMap &constInstrumentParameters() const;
   // Add parameters to the instrument parameter map
-  virtual void populateInstrumentParameters();
+  void populateInstrumentParameters();
 
-  virtual void replaceInstrumentParameters(const Geometry::ParameterMap &pmap);
-  virtual void swapInstrumentParameters(Geometry::ParameterMap &pmap);
+  void replaceInstrumentParameters(const Geometry::ParameterMap &pmap);
+  void swapInstrumentParameters(Geometry::ParameterMap &pmap);
 
   /// Cache a lookup of grouped detIDs to member IDs
-  virtual void cacheDetectorGroupings(const det2group_map &mapping);
+  void cacheDetectorGroupings(const det2group_map &mapping);
   /// Returns the detector IDs that make up the group that this ID is part of
-  virtual const std::set<detid_t> &getGroupMembers(const detid_t detID) const;
+  const std::set<detid_t> &getGroupMembers(const detid_t detID) const;
   /// Get a detector or detector group from an ID
-  virtual Geometry::IDetector_const_sptr
-  getDetectorByID(const detid_t detID) const;
+  Geometry::IDetector_const_sptr getDetectorByID(const detid_t detID) const;
 
   /// Set an object describing the source properties and take ownership
-  virtual void setModeratorModel(ModeratorModel *source);
+  void setModeratorModel(ModeratorModel *source);
   /// Returns a reference to the source properties object
-  virtual ModeratorModel &moderatorModel() const;
+  ModeratorModel &moderatorModel() const;
 
   /// Set a chopper description specified by index where 0 is closest to the
   /// source
-  virtual void setChopperModel(ChopperModel *chopper, const size_t index = 0);
+  void setChopperModel(ChopperModel *chopper, const size_t index = 0);
   /// Returns a reference to a chopper description
-  virtual ChopperModel &chopperModel(const size_t index = 0) const;
+  ChopperModel &chopperModel(const size_t index = 0) const;
 
   /// Sample accessors
-  virtual const Sample &sample() const;
+  const Sample &sample() const;
   /// Writable version of the sample object
-  virtual Sample &mutableSample();
+  Sample &mutableSample();
 
   /// Run details object access
-  virtual const Run &run() const;
+  const Run &run() const;
   /// Writable version of the run object
-  virtual Run &mutableRun();
+  Run &mutableRun();
   /// Access a log for this experiment.
-  virtual Kernel::Property *getLog(const std::string &log) const;
+  Kernel::Property *getLog(const std::string &log) const;
   /// Access a single value from a log for this experiment.
-  virtual double getLogAsSingleValue(const std::string &log) const;
+  double getLogAsSingleValue(const std::string &log) const;
 
   /// Utility method to get the run number
-  virtual int getRunNumber() const;
+  int getRunNumber() const;
   /// Returns the emode for this run
-  virtual Kernel::DeltaEMode::Type getEMode() const;
+  Kernel::DeltaEMode::Type getEMode() const;
   /// Easy access to the efixed value for this run & detector ID
-  virtual double getEFixed(const detid_t detID) const;
+  double getEFixed(const detid_t detID) const;
   /// Easy access to the efixed value for this run & optional detector
-  virtual double
-  getEFixed(const Geometry::IDetector_const_sptr
-                detector = Geometry::IDetector_const_sptr()) const;
+  double getEFixed(const Geometry::IDetector_const_sptr detector =
+                       Geometry::IDetector_const_sptr()) const;
   /// Set the efixed value for a given detector ID
-  virtual void setEFixed(const detid_t detID, const double value);
+  void setEFixed(const detid_t detID, const double value);
 
   /// Saves this experiment description to the open NeXus file
-  virtual void saveExperimentInfoNexus(::NeXus::File *file) const;
+  void saveExperimentInfoNexus(::NeXus::File *file) const;
   /// Loads an experiment description from the open NeXus file
-  virtual void loadExperimentInfoNexus(const std::string &nxFilename,
-                                       ::NeXus::File *file,
-                                       std::string &parameterStr);
+  void loadExperimentInfoNexus(const std::string &nxFilename,
+                               ::NeXus::File *file, std::string &parameterStr);
   /// Load the instrument from an open NeXus file.
-  virtual void loadInstrumentInfoNexus(const std::string &nxFilename,
-                                       ::NeXus::File *file,
-                                       std::string &parameterStr);
+  void loadInstrumentInfoNexus(const std::string &nxFilename,
+                               ::NeXus::File *file, std::string &parameterStr);
   /// Load the instrument from an open NeXus file without reading any parameters
-  virtual void loadInstrumentInfoNexus(const std::string &nxFilename,
-                                       ::NeXus::File *file);
+  void loadInstrumentInfoNexus(const std::string &nxFilename,
+                               ::NeXus::File *file);
   /// Load instrument parameters from an open Nexus file in Instument group if
   /// found there
-  virtual void loadInstrumentParametersNexus(::NeXus::File *file,
-                                             std::string &parameterStr);
+  void loadInstrumentParametersNexus(::NeXus::File *file,
+                                     std::string &parameterStr);
 
   /// Load the sample and log info from an open NeXus file.
-  virtual void loadSampleAndLogInfoNexus(::NeXus::File *file);
+  void loadSampleAndLogInfoNexus(::NeXus::File *file);
   /// Populate the parameter map given a string
-  virtual void readParameterMap(const std::string &parameterStr);
+  void readParameterMap(const std::string &parameterStr);
 
   /// Returns the start date for this experiment (or current time if no info
   /// available)
-  virtual std::string getWorkspaceStartDate() const;
+  std::string getWorkspaceStartDate() const;
 
   // run/experiment stat time if available, empty otherwise
-  virtual std::string getAvailableWorkspaceStartDate() const;
+  std::string getAvailableWorkspaceStartDate() const;
   // run end time if available, empty otherwise
-  virtual std::string getAvailableWorkspaceEndDate() const;
+  std::string getAvailableWorkspaceEndDate() const;
 
   /// Utility to retrieve the validity dates for the given IDF
   static void getValidFromTo(const std::string &IDFfilename,
@@ -166,6 +162,9 @@ public:
   virtual const std::set<detid_t> &detectorIDsInGroup(const size_t index) const;
 
 protected:
+  /// Called as the first operation of most public methods.
+  virtual void populateIfNotLoaded() const;
+
   /// Called when instrument or parameter map is reset to notify child classes.
   virtual void invalidateInstrumentReferences() const {}
 
diff --git a/Framework/API/inc/MantidAPI/FileBackedExperimentInfo.h b/Framework/API/inc/MantidAPI/FileBackedExperimentInfo.h
index 764631e3975..22cc1218733 100644
--- a/Framework/API/inc/MantidAPI/FileBackedExperimentInfo.h
+++ b/Framework/API/inc/MantidAPI/FileBackedExperimentInfo.h
@@ -1,8 +1,6 @@
 #ifndef MANTID_API_FILEBACKEDEXPERIMENTINFO_H_
 #define MANTID_API_FILEBACKEDEXPERIMENTINFO_H_
-//-----------------------------------------------------------------------------
-// Includes
-//-----------------------------------------------------------------------------
+
 #include "MantidAPI/DllConfig.h"
 #include "MantidAPI/ExperimentInfo.h"
 
@@ -36,72 +34,12 @@ namespace API {
   */
 class MANTID_API_DLL FileBackedExperimentInfo : public ExperimentInfo {
 public:
-  /// Constructor
   FileBackedExperimentInfo(const std::string &filename,
                            const std::string &nxpath);
-
   ExperimentInfo *cloneExperimentInfo() const override;
 
-  const std::string toString() const override;
-
-  Geometry::Instrument_const_sptr getInstrument() const override;
-
-  const Geometry::ParameterMap &instrumentParameters() const override;
-
-  Geometry::ParameterMap &instrumentParameters() override;
-
-  const Geometry::ParameterMap &constInstrumentParameters() const override;
-
-  void populateInstrumentParameters() override;
-
-  void replaceInstrumentParameters(const Geometry::ParameterMap &pmap) override;
-
-  void swapInstrumentParameters(Geometry::ParameterMap &pmap) override;
-
-  void cacheDetectorGroupings(const det2group_map &mapping) override;
-
-  const std::set<detid_t> &getGroupMembers(const detid_t detID) const override;
-
-  Geometry::IDetector_const_sptr
-  getDetectorByID(const detid_t detID) const override;
-
-  void setModeratorModel(ModeratorModel *source) override;
-
-  ModeratorModel &moderatorModel() const override;
-
-  void setChopperModel(ChopperModel *chopper, const size_t index = 0) override;
-
-  ChopperModel &chopperModel(const size_t index = 0) const override;
-
-  const Sample &sample() const override;
-
-  Sample &mutableSample() override;
-
-  const Run &run() const override;
-
-  Run &mutableRun() override;
-
-  Kernel::Property *getLog(const std::string &log) const override;
-
-  double getLogAsSingleValue(const std::string &log) const override;
-
-  int getRunNumber() const override;
-
-  Kernel::DeltaEMode::Type getEMode() const override;
-
-  double getEFixed(const detid_t detID) const override;
-
-  double getEFixed(const Geometry::IDetector_const_sptr detector =
-                       Geometry::IDetector_const_sptr()) const override;
-
-  void setEFixed(const detid_t detID, const double value) override;
-
-  size_t numberOfDetectorGroups() const override;
-  const std::set<detid_t> &
-  detectorIDsInGroup(const size_t index) const override;
-
 private:
-  void populateIfNotLoaded() const;
+  void populateIfNotLoaded() const override;
   void populateFromFile() const;
 
   mutable bool m_loaded;
diff --git a/Framework/API/src/ExperimentInfo.cpp b/Framework/API/src/ExperimentInfo.cpp
index a5794163507..a814d36768e 100644
--- a/Framework/API/src/ExperimentInfo.cpp
+++ b/Framework/API/src/ExperimentInfo.cpp
@@ -95,6 +95,13 @@ ExperimentInfo *ExperimentInfo::cloneExperimentInfo() const {
 
 /// @returns A human-readable description of the object
 const std::string ExperimentInfo::toString() const {
+  try {
+    populateIfNotLoaded();
+  } catch (std::exception &) {
+    // Catch any errors so that the string returned has as much information
+    // as possible
+  }
+
   std::ostringstream out;
 
   Geometry::Instrument_const_sptr inst = this->getInstrument();
@@ -205,6 +212,7 @@ void ExperimentInfo::setInstrument(const Instrument_const_sptr &instr) {
 *  @return The instrument class
 */
 Instrument_const_sptr ExperimentInfo::getInstrument() const {
+  populateIfNotLoaded();
   checkDetectorInfoSize(*sptr_instrument, *m_detectorInfo);
   auto instrument = Geometry::ParComponentFactory::createInstrument(
       sptr_instrument, m_parmap);
@@ -216,6 +224,7 @@ Instrument_const_sptr ExperimentInfo::getInstrument() const {
 *    @return a (new) copy of the instruments parameter map
 */
 Geometry::ParameterMap &ExperimentInfo::instrumentParameters() {
+  populateIfNotLoaded();
   // TODO: Here duplicates cow_ptr. Figure out if there's a better way
 
   // Use a double-check for sharing so that we only
@@ -241,6 +250,7 @@ Geometry::ParameterMap &ExperimentInfo::instrumentParameters() {
 *    @return a const reference to the instrument ParameterMap.
 */
 const Geometry::ParameterMap &ExperimentInfo::instrumentParameters() const {
+  populateIfNotLoaded();
   return *m_parmap;
 }
 
@@ -249,6 +259,7 @@ const Geometry::ParameterMap &ExperimentInfo::instrumentParameters() const {
 */
 const Geometry::ParameterMap &
 ExperimentInfo::constInstrumentParameters() const {
+  populateIfNotLoaded();
   return *m_parmap;
 }
 
@@ -300,6 +311,7 @@ struct ParameterValue {
 * method.
 */
 void ExperimentInfo::populateInstrumentParameters() {
+  populateIfNotLoaded();
   // Get instrument and sample
   boost::shared_ptr<const Instrument> instrument =
       getInstrument()->baseInstrument();
@@ -373,6 +385,7 @@ void ExperimentInfo::populateInstrumentParameters() {
  */
 void ExperimentInfo::replaceInstrumentParameters(
     const Geometry::ParameterMap &pmap) {
+  populateIfNotLoaded();
   invalidateInstrumentReferences();
   m_detectorInfoWrapper = nullptr;
   this->m_parmap.reset(new ParameterMap(pmap));
@@ -386,6 +399,7 @@ void ExperimentInfo::replaceInstrumentParameters(
  * current map
  */
 void ExperimentInfo::swapInstrumentParameters(Geometry::ParameterMap &pmap) {
+  populateIfNotLoaded();
   invalidateInstrumentReferences();
   m_detectorInfoWrapper = nullptr;
   this->m_parmap->swap(pmap);
@@ -399,6 +413,7 @@ void ExperimentInfo::swapInstrumentParameters(Geometry::ParameterMap &pmap) {
  * group.
  */
 void ExperimentInfo::cacheDetectorGroupings(const det2group_map &mapping) {
+  populateIfNotLoaded();
   m_detgroups.clear();
   for (const auto &item : mapping) {
     m_det2group[item.first] = m_detgroups.size();
@@ -411,6 +426,7 @@ void ExperimentInfo::cacheDetectorGroupings(const det2group_map &mapping) {
 /// Returns the detector IDs that make up the group that this ID is part of
 const std::set<detid_t> &
 ExperimentInfo::getGroupMembers(const detid_t detID) const {
+  populateIfNotLoaded();
   auto iter = m_det2group.find(detID);
   if (iter != m_det2group.end()) {
     return m_detgroups[iter->second];
@@ -429,6 +445,7 @@ ExperimentInfo::getGroupMembers(const detid_t detID) const {
  */
 Geometry::IDetector_const_sptr
 ExperimentInfo::getDetectorByID(const detid_t detID) const {
+  populateIfNotLoaded();
   if (m_detgroups.empty()) {
     return getInstrument()->getDetector(detID);
   } else {
@@ -443,6 +460,7 @@ ExperimentInfo::getDetectorByID(const detid_t detID) const {
  * transferred to this object
  */
 void ExperimentInfo::setModeratorModel(ModeratorModel *source) {
+  populateIfNotLoaded();
   if (!source) {
     throw std::invalid_argument(
         "ExperimentInfo::setModeratorModel - NULL source object found.");
@@ -452,6 +470,7 @@ void ExperimentInfo::setModeratorModel(ModeratorModel *source) {
 
 /// Returns a reference to the source properties object
 ModeratorModel &ExperimentInfo::moderatorModel() const {
+  populateIfNotLoaded();
   if (!m_moderatorModel) {
     throw std::runtime_error("ExperimentInfo::moderatorModel - No source "
                              "desciption has been defined");
@@ -470,6 +489,7 @@ ModeratorModel &ExperimentInfo::moderatorModel() const {
  */
 void ExperimentInfo::setChopperModel(ChopperModel *chopper,
                                      const size_t index) {
+  populateIfNotLoaded();
   if (!chopper) {
     throw std::invalid_argument(
         "ExperimentInfo::setChopper - NULL chopper object found.");
@@ -492,6 +512,7 @@ void ExperimentInfo::setChopperModel(ChopperModel *chopper,
  * @return A reference to a const chopper object
  */
 ChopperModel &ExperimentInfo::chopperModel(const size_t index) const {
+  populateIfNotLoaded();
   if (index < m_choppers.size()) {
     auto iter = m_choppers.begin();
     std::advance(iter, index);
@@ -508,6 +529,7 @@ ChopperModel &ExperimentInfo::chopperModel(const size_t index) const {
 * @return const reference to Sample object
 */
 const Sample &ExperimentInfo::sample() const {
+  populateIfNotLoaded();
   std::lock_guard<std::recursive_mutex> lock(m_mutex);
   return *m_sample;
 }
@@ -519,6 +541,7 @@ const Sample &ExperimentInfo::sample() const {
 * @return reference to sample object
 */
 Sample &ExperimentInfo::mutableSample() {
+  populateIfNotLoaded();
   // Use a double-check for sharing so that we only
   // enter the critical region if absolutely necessary
   if (!m_sample.unique()) {
@@ -537,6 +560,7 @@ Sample &ExperimentInfo::mutableSample() {
 * @return const reference to run object
 */
 const Run &ExperimentInfo::run() const {
+  populateIfNotLoaded();
   std::lock_guard<std::recursive_mutex> lock(m_mutex);
   return *m_run;
 }
@@ -548,6 +572,7 @@ const Run &ExperimentInfo::run() const {
 * @return reference to Run object
 */
 Run &ExperimentInfo::mutableRun() {
+  populateIfNotLoaded();
   // Use a double-check for sharing so that we only
   // enter the critical region if absolutely necessary
   if (!m_run.unique()) {
@@ -575,6 +600,7 @@ Run &ExperimentInfo::mutableRun() {
  * @return A pointer to the property
  */
 Kernel::Property *ExperimentInfo::getLog(const std::string &log) const {
+  populateIfNotLoaded();
   try {
     return run().getProperty(log);
   } catch (Kernel::Exception::NotFoundError &) {
@@ -601,6 +627,7 @@ Kernel::Property *ExperimentInfo::getLog(const std::string &log) const {
  * @return A pointer to the property
  */
 double ExperimentInfo::getLogAsSingleValue(const std::string &log) const {
+  populateIfNotLoaded();
   try {
     return run().getPropertyAsSingleValue(log);
   } catch (Kernel::Exception::NotFoundError &) {
@@ -623,6 +650,7 @@ double ExperimentInfo::getLogAsSingleValue(const std::string &log) const {
  * @return the run number (int) or 0 if not found.
  */
 int ExperimentInfo::getRunNumber() const {
+  populateIfNotLoaded();
   const Run &thisRun = run();
   if (!thisRun.hasProperty("run_number")) {
     // No run_number property, default to 0
@@ -651,6 +679,7 @@ int ExperimentInfo::getRunNumber() const {
  * checks the sample log & instrument in this order
  */
 Kernel::DeltaEMode::Type ExperimentInfo::getEMode() const {
+  populateIfNotLoaded();
   static const char *emodeTag = "deltaE-mode";
   std::string emodeStr;
   if (run().hasProperty(emodeTag)) {
@@ -677,6 +706,7 @@ Kernel::DeltaEMode::Type ExperimentInfo::getEMode() const {
  * @return The current EFixed value
  */
 double ExperimentInfo::getEFixed(const detid_t detID) const {
+  populateIfNotLoaded();
   IDetector_const_sptr det = getInstrument()->getDetector(detID);
   return getEFixed(det);
 }
@@ -689,6 +719,7 @@ double ExperimentInfo::getEFixed(const detid_t detID) const {
  */
 double
 ExperimentInfo::getEFixed(const Geometry::IDetector_const_sptr detector) const {
+  populateIfNotLoaded();
   Kernel::DeltaEMode::Type emode = getEMode();
   if (emode == Kernel::DeltaEMode::Direct) {
     try {
@@ -730,6 +761,7 @@ ExperimentInfo::getEFixed(const Geometry::IDetector_const_sptr detector) const {
 }
 
 void ExperimentInfo::setEFixed(const detid_t detID, const double value) {
+  populateIfNotLoaded();
   IDetector_const_sptr det = getInstrument()->getDetector(detID);
   Geometry::ParameterMap &pmap = instrumentParameters();
   pmap.addDouble(det.get(), "Efixed", value);
@@ -801,6 +833,7 @@ void ExperimentInfo::getValidFromTo(const std::string &IDFfilename,
 *available)
 */
 std::string ExperimentInfo::getWorkspaceStartDate() const {
+  populateIfNotLoaded();
   std::string date;
   try {
     date = run().startTime().toISO8601String();
@@ -819,6 +852,7 @@ std::string ExperimentInfo::getWorkspaceStartDate() const {
  *  @return workspace start date as a string (empty if no date available)
  */
 std::string ExperimentInfo::getAvailableWorkspaceStartDate() const {
+  populateIfNotLoaded();
   std::string date;
   try {
     date = run().startTime().toFormattedString();
@@ -835,6 +869,7 @@ std::string ExperimentInfo::getAvailableWorkspaceStartDate() const {
  *  @return workspace end date as a string (empty if no date available)
  */
 std::string ExperimentInfo::getAvailableWorkspaceEndDate() const {
+  populateIfNotLoaded();
   std::string date;
   try {
     date = run().endTime().toFormattedString();
@@ -950,6 +985,7 @@ ExperimentInfo::getInstrumentFilename(const std::string &instrumentName,
  * this reference.
  */
 const DetectorInfo &ExperimentInfo::detectorInfo() const {
+  populateIfNotLoaded();
   if (!m_detectorInfoWrapper) {
     std::lock_guard<std::mutex> lock{m_detectorInfoMutex};
     if (!m_detectorInfoWrapper)
@@ -962,6 +998,7 @@ const DetectorInfo &ExperimentInfo::detectorInfo() const {
 /** Return a non-const reference to the DetectorInfo object. Not thread safe.
  */
 DetectorInfo &ExperimentInfo::mutableDetectorInfo() {
+  populateIfNotLoaded();
   // No locking here since this non-const method is not thread safe.
 
   // We get the non-const ParameterMap reference *first* such that no copy is
@@ -991,6 +1028,7 @@ DetectorInfo &ExperimentInfo::mutableDetectorInfo() {
  * information. Grouping information can be cached in ExperimentInfo, or can be
  * obtained from child classes (MatrixWorkspace). */
 size_t ExperimentInfo::numberOfDetectorGroups() const {
+  populateIfNotLoaded();
   std::call_once(m_defaultDetectorGroupingCached,
                  &ExperimentInfo::cacheDefaultDetectorGrouping, this);
 
@@ -1008,6 +1046,7 @@ size_t ExperimentInfo::numberOfDetectorGroups() const {
  * obtained from child classes (MatrixWorkspace). */
 const std::set<detid_t> &
 ExperimentInfo::detectorIDsInGroup(const size_t index) const {
+  populateIfNotLoaded();
   std::call_once(m_defaultDetectorGroupingCached,
                  &ExperimentInfo::cacheDefaultDetectorGrouping, this);
 
@@ -1366,6 +1405,11 @@ void ExperimentInfo::populateWithParameter(
   }
 }
 
+void ExperimentInfo::populateIfNotLoaded() const {
+  // The default implementation does nothing. Used by subclasses
+  // (FileBackedExperimentInfo) to load content from files upon access.
+}
+
 } // namespace Mantid
 } // namespace API
 
diff --git a/Framework/API/src/FileBackedExperimentInfo.cpp b/Framework/API/src/FileBackedExperimentInfo.cpp
index e0e587ff7d1..69aa290c4c6 100644
--- a/Framework/API/src/FileBackedExperimentInfo.cpp
+++ b/Framework/API/src/FileBackedExperimentInfo.cpp
@@ -10,7 +10,6 @@ namespace Mantid {
 namespace API {
 
 namespace {
-
 /// static logger object
 Kernel::Logger g_log("FileBackedExperimentInfo");
 }
@@ -34,263 +33,6 @@ ExperimentInfo *FileBackedExperimentInfo::cloneExperimentInfo() const {
   return new FileBackedExperimentInfo(*this);
 }
 
-/// @returns A human-readable description of the object
-const std::string FileBackedExperimentInfo::toString() const {
-  try {
-    populateIfNotLoaded();
-  } catch (std::exception &) {
-    // Catch any errors so that the string returned has as much information
-    // as possible
-  }
-  return ExperimentInfo::toString();
-}
-
-/// @return A pointer to the parametrized instrument
-Geometry::Instrument_const_sptr
-FileBackedExperimentInfo::getInstrument() const {
-  populateIfNotLoaded();
-  return ExperimentInfo::getInstrument();
-}
-
-/**
- * @return A reference to a const version of the parameter map
- */
-const Geometry::ParameterMap &
-FileBackedExperimentInfo::instrumentParameters() const {
-  populateIfNotLoaded();
-  return ExperimentInfo::constInstrumentParameters();
-}
-
-/**
- * @return A reference to a non-const version of the parameter map
- */
-Geometry::ParameterMap &FileBackedExperimentInfo::instrumentParameters() {
-  populateIfNotLoaded();
-  return ExperimentInfo::instrumentParameters();
-}
-
-/**
- * @return A reference to a const version of the parameter map
- */
-const Geometry::ParameterMap &
-FileBackedExperimentInfo::constInstrumentParameters() const {
-  populateIfNotLoaded();
-  return ExperimentInfo::constInstrumentParameters();
-}
-
-/**
- * Populate object with instrument parameters
- */
-void FileBackedExperimentInfo::populateInstrumentParameters() {
-  populateIfNotLoaded();
-  return ExperimentInfo::populateInstrumentParameters();
-}
-
-/**
- * Populate object and then replace parameter map
- * @param pmap The new parameter map
- */
-void FileBackedExperimentInfo::replaceInstrumentParameters(
-    const Geometry::ParameterMap &pmap) {
-  populateIfNotLoaded();
-  ExperimentInfo::replaceInstrumentParameters(pmap);
-}
-
-/**
- * Populate object and then swap parameter map
- * @param pmap The new parameter map
- */
-void FileBackedExperimentInfo::swapInstrumentParameters(
-    Geometry::ParameterMap &pmap) {
-  populateIfNotLoaded();
-  ExperimentInfo::swapInstrumentParameters(pmap);
-}
-
-/**
- * Populate the object and cache the groupings
- * @param mapping A set of the detector mappings
- */
-void FileBackedExperimentInfo::cacheDetectorGroupings(
-    const det2group_map &mapping) {
-  populateIfNotLoaded();
-  ExperimentInfo::cacheDetectorGroupings(mapping);
-}
-
-/**
- * Populate the object and returns the members of the group for a given ID
- * @param detID A detector ID to lookup
- */
-const std::set<detid_t> &
-FileBackedExperimentInfo::getGroupMembers(const detid_t detID) const {
-  populateIfNotLoaded();
-  return ExperimentInfo::getGroupMembers(detID);
-}
-
-/**
- * Populate the object and return a detector by ID
- * @param detID A detector ID to lookup
- */
-Geometry::IDetector_const_sptr
-FileBackedExperimentInfo::getDetectorByID(const detid_t detID) const {
-  populateIfNotLoaded();
-  return ExperimentInfo::getDetectorByID(detID);
-}
-
-/**
- * Populate the object and set the moderator model
- * @param source A pointer to the model of the moderator
- */
-void FileBackedExperimentInfo::setModeratorModel(ModeratorModel *source) {
-  populateIfNotLoaded();
-  ExperimentInfo::setModeratorModel(source);
-}
-
-/**
- * @return The object governing the moderator model
- */
-ModeratorModel &FileBackedExperimentInfo::moderatorModel() const {
-  populateIfNotLoaded();
-  return ExperimentInfo::moderatorModel();
-}
-
-/**
- * Populate the object & set the model governing the chopper
- * @param chopper The model governing the chopper
- * @param index The index of the chopper
- */
-void FileBackedExperimentInfo::setChopperModel(ChopperModel *chopper,
-                                               const size_t index) {
-  populateIfNotLoaded();
-  ExperimentInfo::setChopperModel(chopper, index);
-}
-
-/**
- * Populate the object & return the model of the chopper
- * @param index The index of the chopper
- */
-ChopperModel &FileBackedExperimentInfo::chopperModel(const size_t index) const {
-  populateIfNotLoaded();
-  return ExperimentInfo::chopperModel(index);
-}
-
-/**
- * Populate object and return the Sample
- * @return A const reference to the Sample
- */
-const Sample &FileBackedExperimentInfo::sample() const {
-  populateIfNotLoaded();
-  return ExperimentInfo::sample();
-}
-
-/**
- * Populate object and return a non-const reference to the sample
- * @return A non-const reference to the Sample
- */
-Sample &FileBackedExperimentInfo::mutableSample() {
-  populateIfNotLoaded();
-  return ExperimentInfo::mutableSample();
-}
-
-/**
- * Populate object and return a const reference to the run
- * @return A const reference to the Run
- */
-const Run &FileBackedExperimentInfo::run() const {
-  populateIfNotLoaded();
-  return ExperimentInfo::run();
-}
-
-/**
- * Populate object and return a non-const reference to the run
- * @return A non-const reference to the Run
- */
-Run &FileBackedExperimentInfo::mutableRun() {
-  populateIfNotLoaded();
-  return ExperimentInfo::mutableRun();
-}
-
-/**
- * Return a pointer to a log entry
- * @param log A string name of the log
- * @return A pointer to the log entry
- */
-Kernel::Property *
-FileBackedExperimentInfo::getLog(const std::string &log) const {
-  populateIfNotLoaded();
-  return ExperimentInfo::getLog(log);
-}
-
-/**
- * Return a pointer to a log entry
- * @param log A string name of the log
- * @return A pointer to the log entry
- */
-double
-FileBackedExperimentInfo::getLogAsSingleValue(const std::string &log) const {
-  populateIfNotLoaded();
-  return ExperimentInfo::getLogAsSingleValue(log);
-}
-
-/**
- * @return The run number
- */
-int FileBackedExperimentInfo::getRunNumber() const {
-  populateIfNotLoaded();
-  return ExperimentInfo::getRunNumber();
-}
-
-/**
- * @return The inelastic energy mode
- */
-Kernel::DeltaEMode::Type FileBackedExperimentInfo::getEMode() const {
-  populateIfNotLoaded();
-  return ExperimentInfo::getEMode();
-}
-
-/**
- * @return The efixed for a given detector
- * @param detID The ID of the detector
- */
-double FileBackedExperimentInfo::getEFixed(const detid_t detID) const {
-  populateIfNotLoaded();
-  return ExperimentInfo::getEFixed(detID);
-}
-
-/**
- * Return the efixed value for a given detector
- * @param detector The detector object
- */
-double FileBackedExperimentInfo::getEFixed(
-    const Geometry::IDetector_const_sptr detector) const {
-  populateIfNotLoaded();
-  return ExperimentInfo::getEFixed(detector);
-}
-
-/**
- * Set the efixed value for a given detector
- * @param detID The ID of the detector
- * @param value The value of EFixed
- */
-void FileBackedExperimentInfo::setEFixed(const detid_t detID,
-                                         const double value) {
-  populateIfNotLoaded();
-  ExperimentInfo::setEFixed(detID, value);
-}
-
-size_t FileBackedExperimentInfo::numberOfDetectorGroups() const {
-  populateIfNotLoaded();
-  return ExperimentInfo::numberOfDetectorGroups();
-}
-
-const std::set<detid_t> &
-FileBackedExperimentInfo::detectorIDsInGroup(const size_t index) const {
-  populateIfNotLoaded();
-  return ExperimentInfo::detectorIDsInGroup(index);
-}
-
-//------------------------------------------------------------------------------------------------------
-// Private members
-//------------------------------------------------------------------------------------------------------
 /**
  * Check if the object has been populated and load the information if
  * it has not
-- 
GitLab