Skip to content

Commit

Permalink
refs #5167. Normalise by largest intensity.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed Oct 1, 2012
1 parent 4b22bd7 commit 8dafc8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace MantidQt
{
namespace SliceViewer
{
typedef std::vector< boost::shared_ptr<PeakOverlayView> > VecPeakOverlayView;
/*---------------------------------------------------------
ConcretePeaksPresenter
Expand All @@ -21,7 +22,6 @@ namespace MantidQt
virtual void update();
virtual void updateWithSlicePoint(const double& slicePoint);
private:
typedef std::vector< boost::shared_ptr<PeakOverlayView> > VecPeakOverlayView;
/// Peak overlay views.
VecPeakOverlayView m_viewPeaks;
};
Expand Down
12 changes: 6 additions & 6 deletions Code/Mantid/MantidQt/SliceViewer/src/ConcretePeaksPresenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ namespace MantidQt
{
namespace SliceViewer
{
ConcretePeaksPresenter::ConcretePeaksPresenter(PeakOverlayViewFactory* factory, Mantid::API::IPeaksWorkspace_sptr peaksWS)

ConcretePeaksPresenter::ConcretePeaksPresenter(PeakOverlayViewFactory* factory, Mantid::API::IPeaksWorkspace_sptr peaksWS) : m_viewPeaks(peaksWS->getNumberPeaks())
{
if(factory == NULL)
{
throw std::invalid_argument("PeakOverlayViewFactory is null");
}

// Create views for every peak in the workspace.
double sumIntensity = 0;
boost::scoped_ptr<PeakOverlayViewFactory> factory_scptr(factory);
double maxIntensity = peaksWS->getPeak(0).getIntensity();
for(int i = 0; i < peaksWS->getNumberPeaks(); ++i)
{
const Mantid::API::IPeak& peak = peaksWS->getPeak(i);
sumIntensity += peak.getIntensity();
auto view = boost::shared_ptr<PeakOverlayView>( factory_scptr->createView(peak) );
m_viewPeaks.push_back( view );
maxIntensity = peak.getIntensity() > maxIntensity ? peak.getIntensity() : maxIntensity;
m_viewPeaks[i] = boost::shared_ptr<PeakOverlayView>( factory_scptr->createView(peak) );
}

// Set the normalisation. Applies to all peaks with intensity.
for(VecPeakOverlayView::iterator it = m_viewPeaks.begin(); it != m_viewPeaks.end(); ++it)
{
(*it)->setNormalisation(sumIntensity);
(*it)->setNormalisation(maxIntensity);
}

}
Expand Down

0 comments on commit 8dafc8a

Please sign in to comment.