Skip to content

Commit

Permalink
Set peak time to zero in GetEi if no peak is found. Refs #6782
Browse files Browse the repository at this point in the history
Also set initial value of Tzero to 0.0 so that if ei is fixed, this is
the set to 0 automatically.
  • Loading branch information
martyngigg committed Mar 26, 2013
1 parent 2985bcd commit d864a25
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Code/Mantid/Framework/Algorithms/src/GetEi2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ void GetEi2::init()
declareProperty("FirstMonitorIndex", 0,
"The spectrum index of the first montitor in the input workspace.", Direction::Output);

declareProperty("Tzero", EMPTY_DBL(),
"", Direction::Output);
declareProperty("Tzero", 0.0, "", Direction::Output);

}

Expand Down Expand Up @@ -234,11 +233,20 @@ double GetEi2::calculateEi(const double initial_guess)
const double t_min = (1.0 - m_tof_window)*peak_guess;
const double t_max = (1.0 + m_tof_window)*peak_guess;
g_log.information() << "Time-of-flight window for peak " << (i+1) << ": tmin = " << t_min << " microseconds, tmax = " << t_max << " microseconds\n";
peak_times[i] = calculatePeakPosition(ws_index, t_min, t_max);
g_log.information() << "Peak for monitor " << (i+1) << " (at " << det_distances[i] << " metres) = " << peak_times[i] << " microseconds\n";
try
{
peak_times[i] = calculatePeakPosition(ws_index, t_min, t_max);
g_log.information() << "Peak for monitor " << (i+1) << " (at " << det_distances[i] << " metres) = " << peak_times[i] << " microseconds\n";
}
catch(std::invalid_argument &)
{
peak_times[i] = 0.0;
g_log.information() << "No peak found for monitor " << (i+1) << " (at " << det_distances[i] << " metres). Setting peak time to zero\n";
}

if( i == 0 )
{
//Store for later adjustment of bins
// Store for later adjustment of bins
m_peak1_pos = std::make_pair(static_cast<int>(ws_index), peak_times[i]);
if(m_fixedei)
{
Expand Down

0 comments on commit d864a25

Please sign in to comment.