Skip to content

Commit

Permalink
Refs #6940 sum events for profile
Browse files Browse the repository at this point in the history
  • Loading branch information
Vickie Lynch committed Jun 25, 2013
1 parent dd9d46e commit e94ec2a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ namespace MDAlgorithms
bool cylinderBool = getProperty("Cylinder");
if (cylinderBool)
{
numSteps = 15;
numSteps = 100;
deltaQ = cylinderLength/static_cast<double>(numSteps-1);
size_t histogramNumber = peakWS->getNumberPeaks();
Workspace_sptr wsFit= WorkspaceFactory::Instance().create("Workspace2D",histogramNumber,numSteps,numSteps);
Expand Down
26 changes: 17 additions & 9 deletions Code/Mantid/Framework/MDEvents/src/MDGridBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1417,20 +1417,28 @@ namespace MDEvents
// Is this box fully contained?
if (verticesContained[i] >= maxVertices)
{
coord_t boxCenter[nd];
box->getCenter(boxCenter);
// transform center of box to cylinder
coord_t out[nd];
radiusTransform.apply(boxCenter, out);
// add event to appropriate y channel
size_t xchannel = static_cast<int>(floor((out[1] / deltaQ))+0.5) + (numSteps / 2);
if (xchannel >= 0 || xchannel < numSteps ) signal_fit[xchannel] += box->getSignal();
std::vector<coord_t> coordTable;
size_t nColumns;
box->getEventsData(coordTable, nColumns);
size_t nEvents = coordTable.size()/nColumns;
for (size_t k=0; k<nEvents; k++)
{
coord_t eventCenter[nd];
eventCenter[0] = coordTable[k*nColumns+2];
eventCenter[1] = coordTable[k*nColumns+3];
eventCenter[2] = coordTable[k*nColumns+4];
coord_t out[nd];
radiusTransform.apply(eventCenter, out);
// add event to appropriate y channel
size_t xchannel = static_cast<int>(floor((out[1] / deltaQ))+0.5) + (numSteps / 2);
if (xchannel >= 0 || xchannel < numSteps ) signal_fit[xchannel] += coordTable[k*nColumns];
}
//box->releaseEvents();
// Use the integrated sum of signal in the box
signal += box->getSignal();
errorSquared += box->getErrorSquared();

// std::cout << "box at " << i << " (" << box->getExtentsStr() << ") is fully contained. Vertices = " << verticesContained[i] << "\n";

numFullyContained++;
// Go on to the next box
continue;
Expand Down

0 comments on commit e94ec2a

Please sign in to comment.