15#include "MantidIndexing/IndexInfo.h"
22#include <unordered_set>
47 auto props = from->mutableRun().getLogData();
48 for (
auto &prop : props) {
49 if (!to->mutableRun().hasProperty(prop->name())) {
50 to->mutableRun().addLogData(prop->clone());
70 eventWS->initialize(1, 1, 1);
73 eventWS->getAxis(0)->unit() = UnitFactory::Instance().create(
"TOF");
74 eventWS->setYUnit(
"Counts");
86 std::vector<int> periodNumbers = periodLog->valuesAsVector();
87 std::unordered_set<int> uniquePeriods(periodNumbers.begin(), periodNumbers.end());
88 const bool addBoolTimeSeries = (uniquePeriods.size() ==
nPeriods);
91 logCreator.addStatusLog(temp->mutableRun());
93 for (
size_t i = 0; i <
m_WsVec.size(); ++i) {
94 const auto periodNumber = int(i + 1);
96 m_WsVec[i]->copyExperimentInfoFrom(temp.get());
97 if (addBoolTimeSeries) {
100 }
catch (
const std::runtime_error &e) {
111 m_WsVec[i]->setInstrument(temp->getInstrument());
117 ws->getSpectrum(wi).reserve(size);
130 auto wsg = std::make_shared<API::WorkspaceGroup>();
131 for (
const auto &ws :
m_WsVec) {
132 wsg->addWorkspace(ws);
151 for (
auto spectrum : uniqueSpectra) {
160 auto &spec = ws->getSpectrum(spectrumNumber);
161 spec.setSpectrumNo(specid);
167 auto &spec = ws->getSpectrum(spectrumNumber);
168 spec.setDetectorID(
id);
176 const size_t periodNumber)
const {
177 return m_WsVec[periodNumber]->getSpectrum(workspace_index);
181 return m_WsVec[periodNumber]->getSpectrum(workspace_index);
185 return m_WsVec[0]->getSpectrumToWorkspaceIndexVector(offset);
188 bool dothrow)
const {
189 return m_WsVec[0]->getDetectorIDToWorkspaceIndexVector(offset, dothrow);
203 const HistogramData::BinEdges edges(2);
205 [&indexInfo, &edges](
auto &ws) { ws = create<EventWorkspace>(*ws, indexInfo, edges); });
209 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [&inst](
auto &ws) { ws->setInstrument(inst); });
212 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [&monitorWS](
auto &ws) { ws->setMonitorWorkspace(monitorWS); });
216 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [&map](
auto &ws) { ws->updateSpectraUsing(map); });
220 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [flag](
auto &ws) { ws->mutableSample().setGeometryFlag(flag); });
224 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [flag](
auto &ws) { ws->mutableSample().setThickness(flag); });
227 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [flag](
auto &ws) { ws->mutableSample().setHeight(flag); });
230 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [flag](
auto &ws) { ws->mutableSample().setWidth(flag); });
234 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [&title](
auto &ws) { ws->setTitle(title); });
238 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [&func](
auto &ws) { func(ws); });
243 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [&func](
auto &ws) { ws = func(ws); });
std::map< DeltaEMode::Type, std::string > index
Class to represent the axis of a workspace.
Defines a class to aid in creating ISIS specific run logs for periods, status etc.
void setSpectrumNo(specnum_t num)
Sets the spectrum number of this spectrum.
This class stores information regarding an experimental run as a series of log entries.
This class stores information about the sample used in particular run.
A minimal class to hold the mapping between the spectrum number and its related detector ID numbers f...
void applyFilterInPlace(const boost::function< void(API::MatrixWorkspace_sptr)> &func)
void setDetectorIdsForAllPeriods(const size_t spectrumNumber, const detid_t id)
std::vector< DataObjects::EventWorkspace_sptr > m_WsVec
Vector of EventWorkspaces.
void setGeometryFlag(const int flag)
void setWidth(const float flag)
void setAllX(const HistogramData::BinEdges &x)
void setIndexInfo(const Indexing::IndexInfo &indexInfo)
DataObjects::EventWorkspace_sptr createEmptyEventWorkspace() const
Create Empty EventWorkspaces.
std::vector< size_t > getDetectorIDToWorkspaceIndexVector(Mantid::specnum_t &offset, bool dothrow) const
Geometry::Instrument_const_sptr getInstrument() const
void setHeight(const float flag)
Types::Core::DateAndTime getFirstPulseTime() const
void setMonitorWorkspace(const std::shared_ptr< API::MatrixWorkspace > &monitorWS)
API::Workspace_sptr combinedWorkspace()
API::Sample & mutableSample()
EventWorkspaceCollection()
Constructor.
void setThickness(const float flag)
Mantid::API::Axis * getAxis(const size_t &i) const
const API::Run & run() const
void updateSpectraUsing(const API::SpectrumDetectorMapping &map)
const DataObjects::EventList & getSpectrum(const size_t workspace_index, const size_t periodNumber) const
void setSpectrumNumberForAllPeriods(const size_t spectrumNumber, const specnum_t specid)
void setInstrument(const Geometry::Instrument_const_sptr &inst)
void setNPeriods(size_t nPeriods, std::unique_ptr< const Kernel::TimeSeriesProperty< int > > &periodLog)
size_t getNumberEvents() const
size_t getNumberHistograms() const
void setTitle(const std::string &title)
void reserveEventListAt(size_t wi, size_t size)
virtual bool threadSafe() const
Returns true if the EventWorkspace is safe for multithreaded operations.
void setSpectrumNumbersFromUniqueSpectra(const std::set< int > &uniqueSpectra)
void applyFilter(const boost::function< DataObjects::EventWorkspace_sptr(DataObjects::EventWorkspace_sptr)> &func)
DataObjects::EventWorkspace_sptr getSingleHeldWorkspace()
std::vector< size_t > getSpectrumToWorkspaceIndexVector(Mantid::specnum_t &offset) const
std::size_t getNumberEvents() const override
Return the number of events in the list.
This class is intended to fulfill the design specified in <https://github.com/mantidproject/documents...
The Logger class is in charge of the publishing messages from the framework through various channels.
void warning(const std::string &msg)
Logs at warning level.
A specialised Property class for holding a series of time-value pairs.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class
std::shared_ptr< const Instrument > Instrument_const_sptr
Shared pointer to an const instrument object.
int32_t detid_t
Typedef for a detector ID.
int32_t specnum_t
Typedef for a spectrum Number.