16 std::vector<coord_t> &localCoord)
const {
22 auto logval =
m_Logs[idxLog]->getSingleValue(pT);
44 uint32_t detID =
m_detID[workspaceIndex];
47 std::vector<coord_t> locCoord(
m_Coord);
50 if (!
m_QConverter->calcYDepCoordinates(locCoord, workspaceIndex))
56 std::vector<coord_t> allCoord;
57 std::vector<float> sig_err;
58 std::vector<uint16_t> expInfoIndex;
59 std::vector<uint16_t> goniometer_index;
60 std::vector<uint32_t> det_ids;
62 allCoord.reserve(this->
m_NDims * numEvents);
70 typename std::vector<T>
const *events_ptr;
72 const typename std::vector<T> &events = *events_ptr;
74 for (
auto it = events.cbegin(); it != events.cend(); it++) {
76 double signal = it->weight();
77 double errorSq = it->errorSquared();
82 if (!
m_QConverter->calcMatrixCoord(val, locCoord, signal, errorSq))
85 sig_err.emplace_back(
static_cast<float>(signal));
86 sig_err.emplace_back(
static_cast<float>(errorSq));
87 expInfoIndex.emplace_back(expInfoIndexLoc);
88 goniometer_index.emplace_back(0);
89 det_ids.emplace_back(detID);
90 allCoord.insert(allCoord.end(), locCoord.begin(), locCoord.end());
94 size_t n_added_events = expInfoIndex.size();
95 m_OutWSWrapper->addMDData(sig_err, expInfoIndex, goniometer_index, det_ids, allCoord, n_added_events);
96 return n_added_events;
103 switch (
m_EventWS->getSpectrum(workspaceIndex).getEventType()) {
105 return this->convertEventList<Mantid::Types::Event::TofEvent>(workspaceIndex);
107 return this->convertEventList<Mantid::DataObjects::WeightedEvent>(workspaceIndex);
109 return this->convertEventList<Mantid::DataObjects::WeightedEventNoTime>(workspaceIndex);
111 throw std::runtime_error(
"EventList had an unexpected data type!");
126 bool ignoreZeros,
bool useLogTimes) {
129 m_EventWS = std::dynamic_pointer_cast<const DataObjects::EventWorkspace>(
m_InWS2D);
131 throw(std::logic_error(
" ConvertToMDEventWS should work with defined event workspace"));
191 size_t lastNumBoxes = bc->getTotalNumMDBoxes();
200 bool runMultithreaded =
false;
202 runMultithreaded =
true;
217 size_t eventsAdded = 0;
221 eventsAdded += nConverted;
222 nEventsInWS += nConverted;
224 if (frequentReport && wi % div == 0) {
225 pProgress->
report(
static_cast<int>(wi));
229 if (bc->shouldSplitBoxes(nEventsInWS, eventsAdded, lastNumBoxes)) {
230 if (runMultithreaded) {
241 lastNumBoxes =
m_OutWSWrapper->pWorkspace()->getBoxController()->getTotalNumMDBoxes();
243 pProgress->
report(
static_cast<int>(wi));
247 if (runMultithreaded) {
static std::unique_ptr< QThreadPool > tp
bool hasProperty(const std::string &name) const
Does the property exist on the object.
Kernel::TimeSeriesProperty< T > * getTimeSeriesProperty(const std::string &name) const
Returns a property as a time series property.
Helper class for reporting progress from algorithms.
This class stores information regarding an experimental run as a series of log entries.
const Geometry::Goniometer & getGoniometer() const
Return reference to the first const Goniometer object for this run.
std::size_t getNumberEvents() const override
Return the number of events in the list.
size_t getNumberAxes() const
const GoniometerAxis & getAxis(size_t axisnumber) const
Get GoniometerAxis obfject using motor number.
void resetNumSteps(int64_t nsteps, double start, double end)
Change the number of steps between start/end.
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
A Thread Pool implementation that keeps a certain number of threads running (normally,...
A First-In-First-Out Thread Scheduler.
size_t size() override
Returns the size of the queue.
A specialised Property class for holding a series of time-value pairs.
API::MatrixWorkspace_const_sptr m_InWS2D
std::vector< std::string > m_timeLogsName
virtual size_t initialize(const MDWSDescription &WSD, std::shared_ptr< MDEventWSWrapper > inWSWrapper, bool ignoreZeros, bool useLogTimes=false)
method which initiates all main class variables
std::vector< int32_t > m_detID
Mantid::Kernel::SpecialCoordinateSystem m_coordinateSystem
Any special coordinate system used.
MDTransf_sptr m_QConverter
bool m_useLogTimes
Flag to use log values corresponding to event pulse time instead of average values.
std::vector< coord_t > m_Coord
size_t m_NDims
number of target ws dimensions
std::shared_ptr< MDEventWSWrapper > m_OutWSWrapper
UnitsConversionHelper m_UnitConversion
std::vector< std::unique_ptr< Kernel::TimeSeriesProperty< double > > > m_Logs
size_t initialize(const MDWSDescription &WSD, std::shared_ptr< MDEventWSWrapper > inWSWrapper, bool ignoreZeros, bool useLogTimes) override
method sets up all internal variables necessary to convert from Event Workspace to MDEvent workspace
Kernel::DblMatrix m_tmpRot
size_t convertEventList(size_t workspaceIndex)
function converts particular type of events into MD space and add these events to the workspace itsel...
bool setGoniometersFromLogs(const T &ev)
size_t conversionChunk(size_t workspaceIndex) override
The method runs conversion for a single event list, corresponding to a particular workspace index.
unsigned int m_NMatrixDimensions
std::vector< std::pair< coord_t, coord_t > > m_extraDimBounds
DataObjects::EventWorkspace_const_sptr m_EventWS
Kernel::DblMatrix m_Wtransf
virtual void appendEventsFromInputWS(API::Progress *pProgress, const API::BoxController_sptr &bc)
std::vector< size_t > m_GonioIndex
Geometry::Goniometer m_Goniometer
bool setGenericVariableFromLogs(const Mantid::Types::Core::DateAndTime &pT, std::vector< coord_t > &localCoord) const
void runConversion(API::Progress *pProgress) override
method which starts the conversion procedure
helper class describes the properties of target MD workspace, which should be obtained as the result ...
API::MatrixWorkspace_const_sptr getInWS() const
std::vector< std::string > getDimNames() const
Mantid::Kernel::SpecialCoordinateSystem getCoordinateSystem() const
Kernel::DeltaEMode::Type getEMode() const
Kernel::DblMatrix m_Wtransf
void updateConversion(size_t i)
Method updates unit conversion given the index of detector parameters in the array of detectors.
double convertUnits(double val) const
do actual unit conversion from input to oputput data
std::shared_ptr< BoxController > BoxController_sptr
Shared ptr to BoxController.
std::size_t numEvents(Nexus::File &file, bool &hasTotalCounts, bool &oldNeXusFileNames, const std::string &prefix)
Get the number of events in the currently opened group.
DLLExport void getEventsFrom(EventList &el, std::vector< Types::Event::TofEvent > *&events)
Mantid::Kernel::Matrix< double > DblMatrix
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
Counter clockwise rotation.