File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -678,13 +678,24 @@ void SmoothNeighbours::execEvent(Mantid::DataObjects::EventWorkspace_sptr &ws) {
678
678
679
679
this ->setProperty (" OutputWorkspace" , std::dynamic_pointer_cast<MatrixWorkspace>(outWS));
680
680
681
+ // Calculate total number of events for each EventList
682
+ std::vector<size_t > outputEvents (numberOfSpectra, 0 );
683
+ for (int i = 0 ; i < int (numberOfSpectra); i++) {
684
+ const std::vector<weightedNeighbour> &neighbours = m_neighbours[i];
685
+ for (const auto &neighbour : neighbours) {
686
+ size_t inWI = neighbour.first ;
687
+ outputEvents[i] += ws->getSpectrum (inWI).getNumberEvents ();
688
+ }
689
+ }
690
+
681
691
// Go through all the output workspace
682
692
PARALLEL_FOR_IF (Kernel::threadSafe (*ws, *outWS))
683
693
for (int outWIi = 0 ; outWIi < int (numberOfSpectra); outWIi++) {
684
694
PARALLEL_START_INTERRUPT_REGION
685
695
686
696
// Create the output event list (empty)
687
697
EventList &outEL = outWS->getSpectrum (outWIi);
698
+ outEL.reserve (outputEvents[outWIi]);
688
699
689
700
// Which are the neighbours?
690
701
std::vector<weightedNeighbour> &neighbours = m_neighbours[outWIi];
You can’t perform that action at this time.
0 commit comments