24 uint32_t detID =
m_detID[workspaceIndex];
27 std::vector<coord_t> locCoord(
m_Coord);
30 if (!
m_QConverter->calcYDepCoordinates(locCoord, workspaceIndex))
36 std::vector<coord_t> allCoord;
37 std::vector<float> sig_err;
38 std::vector<uint16_t> expInfoIndex;
39 std::vector<uint16_t> goniometer_index;
40 std::vector<uint32_t> det_ids;
42 allCoord.reserve(this->
m_NDims * numEvents);
50 typename std::vector<T>
const *events_ptr;
52 const typename std::vector<T> &events = *events_ptr;
55 for (
auto it = events.cbegin(); it != events.cend(); it++) {
57 double signal = it->weight();
58 double errorSq = it->errorSquared();
59 if (!
m_QConverter->calcMatrixCoord(val, locCoord, signal, errorSq))
62 sig_err.emplace_back(
static_cast<float>(signal));
63 sig_err.emplace_back(
static_cast<float>(errorSq));
64 expInfoIndex.emplace_back(expInfoIndexLoc);
65 goniometer_index.emplace_back(0);
66 det_ids.emplace_back(detID);
67 allCoord.insert(allCoord.end(), locCoord.begin(), locCoord.end());
71 size_t n_added_events = expInfoIndex.size();
72 m_OutWSWrapper->addMDData(sig_err, expInfoIndex, goniometer_index, det_ids, allCoord, n_added_events);
73 return n_added_events;
80 switch (
m_EventWS->getSpectrum(workspaceIndex).getEventType()) {
82 return this->convertEventList<Mantid::Types::Event::TofEvent>(workspaceIndex);
84 return this->convertEventList<Mantid::DataObjects::WeightedEvent>(workspaceIndex);
86 return this->convertEventList<Mantid::DataObjects::WeightedEventNoTime>(workspaceIndex);
88 throw std::runtime_error(
"EventList had an unexpected data type!");
104 m_EventWS = std::dynamic_pointer_cast<const DataObjects::EventWorkspace>(
m_InWS2D);
106 throw(std::logic_error(
" ConvertToMDEventWS should work with defined event workspace"));
135 size_t lastNumBoxes = bc->getTotalNumMDBoxes();
144 bool runMultithreaded =
false;
146 runMultithreaded =
true;
157 size_t eventsAdded = 0;
161 eventsAdded += nConverted;
162 nEventsInWS += nConverted;
164 if (bc->shouldSplitBoxes(nEventsInWS, eventsAdded, lastNumBoxes)) {
165 if (runMultithreaded) {
176 lastNumBoxes =
m_OutWSWrapper->pWorkspace()->getBoxController()->getTotalNumMDBoxes();
182 if (runMultithreaded) {
static std::unique_ptr< QThreadPool > tp
Helper class for reporting progress from algorithms.
std::size_t getNumberEvents() const override
Return the number of events in the list.
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.
API::MatrixWorkspace_const_sptr m_InWS2D
std::vector< int32_t > m_detID
Mantid::Kernel::SpecialCoordinateSystem m_coordinateSystem
Any special coordinate system used.
MDTransf_sptr m_QConverter
std::vector< coord_t > m_Coord
virtual size_t initialize(const MDWSDescription &WSD, std::shared_ptr< MDEventWSWrapper > inWSWrapper, bool ignoreZeros)
method which initiates all main class variables
size_t m_NDims
number of target ws dimensions
std::shared_ptr< MDEventWSWrapper > m_OutWSWrapper
UnitsConversionHelper m_UnitConversion
size_t convertEventList(size_t workspaceIndex)
function converts particular type of events into MD space and add these events to the workspace itsel...
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
virtual void appendEventsFromInputWS(API::Progress *pProgress, const API::BoxController_sptr &bc)
size_t initialize(const MDWSDescription &WSD, std::shared_ptr< MDEventWSWrapper > inWSWrapper, bool ignoreZeros) override
method sets up all internal variables necessary to convert from Event Workspace to MDEvent workspace
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 ...
Mantid::Kernel::SpecialCoordinateSystem getCoordinateSystem() const
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, const NexusHDF5Descriptor &descriptor)
Get the number of events in the currently opened group.
DLLExport void getEventsFrom(EventList &el, std::vector< Types::Event::TofEvent > *&events)