15#include "MantidIndexing/IndexInfo.h"
21#include <unordered_set>
43 auto props = from->mutableRun().getLogData();
44 for (
auto &prop : props) {
45 if (!to->mutableRun().hasProperty(prop->name())) {
46 to->mutableRun().addLogData(prop->clone());
66 eventWS->initialize(1, 1, 1);
70 eventWS->setYUnit(
"Counts");
82 std::vector<int> periodNumbers = periodLog->valuesAsVector();
83 std::unordered_set<int> uniquePeriods(periodNumbers.begin(), periodNumbers.end());
84 const bool addBoolTimeSeries = (uniquePeriods.size() ==
nPeriods);
87 logCreator.addStatusLog(temp->mutableRun());
89 for (
size_t i = 0; i <
m_WsVec.size(); ++i) {
90 const auto periodNumber = int(i + 1);
92 m_WsVec[i]->copyExperimentInfoFrom(temp.get());
93 if (addBoolTimeSeries) {
98 m_WsVec[i]->setInstrument(temp->getInstrument());
104 ws->getSpectrum(wi).reserve(size);
117 auto wsg = std::make_shared<API::WorkspaceGroup>();
119 wsg->addWorkspace(ws);
138 for (
auto spectrum : uniqueSpectra) {
139 ws->getSpectrum(counter).setSpectrumNo(spectrum);
147 auto &spec = ws->getSpectrum(spectrumNumber);
148 spec.setSpectrumNo(specid);
154 auto &spec = ws->getSpectrum(spectrumNumber);
155 spec.setDetectorID(
id);
163 const size_t periodNumber)
const {
164 return m_WsVec[periodNumber]->getSpectrum(workspace_index);
168 return m_WsVec[periodNumber]->getSpectrum(workspace_index);
172 return m_WsVec[0]->getSpectrumToWorkspaceIndexVector(offset);
175 bool dothrow)
const {
176 return m_WsVec[0]->getDetectorIDToWorkspaceIndexVector(offset, dothrow);
186 return m_WsVec[0]->getNumberEvents();
190 const HistogramData::BinEdges edges(2);
192 [&indexInfo, &edges](
auto &ws) { ws = create<EventWorkspace>(*ws, indexInfo, edges); });
196 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [&inst](
auto &ws) { ws->setInstrument(inst); });
199 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [&monitorWS](
auto &ws) { ws->setMonitorWorkspace(monitorWS); });
203 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [&map](
auto &ws) { ws->updateSpectraUsing(map); });
207 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [flag](
auto &ws) { ws->mutableSample().setGeometryFlag(flag); });
211 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [flag](
auto &ws) { ws->mutableSample().setThickness(flag); });
214 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [flag](
auto &ws) { ws->mutableSample().setHeight(flag); });
217 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [flag](
auto &ws) { ws->mutableSample().setWidth(flag); });
221 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [&title](
auto &ws) { ws->setTitle(title); });
225 std::for_each(
m_WsVec.begin(),
m_WsVec.end(), [&func](
auto &ws) { func(ws); });
230 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.
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
Defines a class to aid in creating ISIS specific run logs for periods, status etc.
This class is intended to fulfill the design specified in <https://github.com/mantidproject/documents...
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
A specialised Property class for holding a series of time-value pairs.
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
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.