50 size_t nAddedEvents(0), nBufEvents(0);
54 const size_t specSize = this->
m_InWS2D->blocksize();
62 std::vector<coord_t> locCoord(
m_Coord);
71 size_t n_coordinates = 0;
74 if (nSpectraToProcess > nValidSpectra)
75 nSpectraToProcess = nValidSpectra;
78 for (
size_t i = startSpectra; i < nSpectraToProcess; ++i) {
83 const auto &Signal =
m_InWS2D->y(iSpctr);
84 const auto &Error =
m_InWS2D->e(iSpctr);
91 if (
X.size() == Signal.size())
96 std::vector<double> XtargetUnits;
97 XtargetUnits.resize(
X.size());
101 for (
size_t j = 1; j < XtargetUnits.size(); j++) {
103 XtargetUnits[j - 1] = 0.5 * (xm + xm1);
106 XtargetUnits.back() = xm1;
108 for (
size_t j = 0; j < XtargetUnits.size(); j++)
112 for (
size_t j = 0; j < specSize; ++j) {
113 double signal = Signal[j];
118 if (ignoreZeros && (signal == 0.))
120 double errorSq = Error[j] * Error[j];
122 if (!
m_QConverter->calcMatrixCoord(XtargetUnits[j], locCoord, signal, errorSq))
126 sig_err[2 * nBufEvents + 0] = float(signal);
127 sig_err[2 * nBufEvents + 1] = float(errorSq);
129 goniometer_index[nBufEvents] = 0;
130 det_ids[nBufEvents] = det_id;
132 for (
size_t ii = 0; ii <
m_NDims; ii++)
133 allCoord[n_coordinates++] = locCoord[ii];
138 m_OutWSWrapper->addMDData(sig_err, expInfoIndex, goniometer_index, det_ids, allCoord, nBufEvents);
139 nAddedEvents += nBufEvents;
147 if (nBufEvents > 0) {
148 m_OutWSWrapper->addMDData(sig_err, expInfoIndex, goniometer_index, det_ids, allCoord, nBufEvents);
149 nAddedEvents += nBufEvents;
159 size_t nAddedEvents(0);
162 size_t lastNumBoxes = bc->getTotalNumMDBoxes();
166 const size_t specSize =
m_InWS2D->blocksize();
181 bool runMultithreaded =
false;
183 runMultithreaded =
true;
194 if (runMultithreaded)
195 nThreads =
static_cast<int>(
tp.getNumPhysicalCores());
201 size_t eventsChunkNum = bc->getSignificantEventsNumber();
207 nAddedEvents += nThreadEv;
208 nEventsInWS += nThreadEv;
210 if (bc->shouldSplitBoxes(nEventsInWS, nAddedEvents, lastNumBoxes)) {
211 if (runMultithreaded) {
224 lastNumBoxes = bc->getTotalNumMDBoxes();
226 pProgress->
report(i,
"Adding Events");
244 if (runMultithreaded) {
size_t initialize(const MDWSDescription &WSD, std::shared_ptr< MDEventWSWrapper > inWSWrapper, bool ignoreZeros) override
method sets up all internal variables necessary to convert from Matrix2D workspace to MDEvent workspa...