25 uint32_t detID =
m_detID[workspaceIndex];
28 std::vector<coord_t> locCoord(
m_Coord);
31 if (!
m_QConverter->calcYDepCoordinates(locCoord, workspaceIndex))
37 std::vector<coord_t> allCoord;
38 std::vector<float> sig_err;
39 std::vector<uint16_t> expInfoIndex;
40 std::vector<uint16_t> goniometer_index;
41 std::vector<uint32_t> det_ids;
43 allCoord.reserve(this->
m_NDims * numEvents);
51 typename std::vector<T>
const *events_ptr;
53 const typename std::vector<T> &events = *events_ptr;
56 for (
auto it = events.cbegin(); it != events.cend(); it++) {
58 double signal = it->weight();
59 double errorSq = it->errorSquared();
62 if (!
m_QConverter->calcMatrixCoord(val, locCoord, signal, errorSq))
65 sig_err.emplace_back(
static_cast<float>(signal));
66 sig_err.emplace_back(
static_cast<float>(errorSq));
67 expInfoIndex.emplace_back(expInfoIndexLoc);
68 goniometer_index.emplace_back(0);
69 det_ids.emplace_back(detID);
70 allCoord.insert(allCoord.end(), locCoord.begin(), locCoord.end());
74 size_t n_added_events = expInfoIndex.size();
75 m_OutWSWrapper->addMDData(sig_err, expInfoIndex, goniometer_index, det_ids, allCoord, n_added_events);
76 return n_added_events;
83 switch (
m_EventWS->getSpectrum(workspaceIndex).getEventType()) {
85 return this->convertEventList<Mantid::Types::Event::TofEvent>(workspaceIndex);
87 return this->convertEventList<Mantid::DataObjects::WeightedEvent>(workspaceIndex);
89 return this->convertEventList<Mantid::DataObjects::WeightedEventNoTime>(workspaceIndex);
91 throw std::runtime_error(
"EventList had an unexpected data type!");
106 bool ignoreZeros,
bool useLogTimes) {
109 m_EventWS = std::dynamic_pointer_cast<const DataObjects::EventWorkspace>(
m_InWS2D);
111 throw(std::logic_error(
" ConvertToMDEventWS should work with defined event workspace"));
159 size_t lastNumBoxes = bc->getTotalNumMDBoxes();
168 bool runMultithreaded =
false;
170 runMultithreaded =
true;
181 size_t eventsAdded = 0;
185 eventsAdded += nConverted;
186 nEventsInWS += nConverted;
188 if (bc->shouldSplitBoxes(nEventsInWS, eventsAdded, lastNumBoxes)) {
189 if (runMultithreaded) {
200 lastNumBoxes =
m_OutWSWrapper->pWorkspace()->getBoxController()->getTotalNumMDBoxes();
206 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
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.
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
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
Mantid::Kernel::SpecialCoordinateSystem getCoordinateSystem() 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
Counter clockwise rotation.