Skip to content

Commit

Permalink
Refs #4980 append option for events
Browse files Browse the repository at this point in the history
  • Loading branch information
VickieLynch committed Mar 26, 2012
1 parent 07a10b9 commit 92d1e31
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions Code/Mantid/Framework/MPIAlgorithms/src/GatherWorkspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,22 @@ void GatherWorkspaces::execEvent()
{
if ( included.rank() == 0 )
{
outputWorkspace->dataX(wi) = eventW->readX(wi);
// How do we accumulate the data?
std::string accum = this->getPropertyValue("AccumulationMethod");
std::vector<Mantid::DataObjects::EventList> out_values;
gather(included, eventW->getEventList(wi), out_values, 0);
for (int n = 0; n < included.size(); n++)
outputWorkspace->getOrAddEventList(wi) += out_values[n];
const ISpectrum * inSpec = eventW->getSpectrum(wi);
ISpectrum * outSpec = outputWorkspace->getSpectrum(wi);
outSpec->clearDetectorIDs();
outSpec->addDetectorIDs( inSpec->getDetectorIDs() );
for (int i = 0; i < included.size(); i++)
{
size_t index = wi; // accum == "Add"
if (accum == "Append")
index = wi + i * totalSpec;
outputWorkspace->dataX(index) = eventW->readX(wi);
outputWorkspace->getOrAddEventList(index) += out_values[i];
const ISpectrum * inSpec = eventW->getSpectrum(wi);
ISpectrum * outSpec = outputWorkspace->getSpectrum(index);
outSpec->clearDetectorIDs();
outSpec->addDetectorIDs( inSpec->getDetectorIDs() );
}
}
else
{
Expand Down

0 comments on commit 92d1e31

Please sign in to comment.