Skip to content

Commit

Permalink
Refs #8849. Change the type of functions back for consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbekasov committed Mar 4, 2014
1 parent 06b79ed commit 7da3d0a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
Expand Up @@ -430,11 +430,11 @@ private slots:
/// first good bin returned in ms
double firstGoodBin() const;

/// Sets specified option of the algorithm to minimum X value selected by user
void setXMin(IAlgorithm_sptr alg, const std::string& propName) const;
/// Returns start X value as specified by user
double startTime() const;

/// Sets specified option of the algorithm to max X value selected by user
void setXMax(IAlgorithm_sptr alg, const std::string& propName) const;
/// Return finish X value as specified by user
double finishTime() const;

/// time zero returned in ms
double timeZero();
Expand Down
43 changes: 23 additions & 20 deletions Code/Mantid/MantidQt/CustomInterfaces/src/MuonAnalysis.cpp
Expand Up @@ -628,8 +628,14 @@ MatrixWorkspace_sptr MuonAnalysis::prepareAnalysisWorkspace(MatrixWorkspace_sptr
cropAlg->initialize();
cropAlg->setChild(true);
cropAlg->setProperty("InputWorkspace", ws);
setXMin(cropAlg, "Xmin");
setXMax(cropAlg, "Xmax");
cropAlg->setProperty("Xmin", startTime());

double Xmax = finishTime();
if(Xmax != EMPTY_DBL())
{
cropAlg->setProperty("Xmax", Xmax);
}

cropAlg->setPropertyValue("OutputWorkspace", "__IAmNinjaYouDontSeeMe"); // Is not used
cropAlg->execute();

Expand Down Expand Up @@ -2394,11 +2400,10 @@ double MuonAnalysis::firstGoodBin() const
}

/**
* Sets specified option of the algorithm to minimum X value selected by user
* @param alg :: Algorithm to set property for
* @param propName :: Name of the property to set
* Returns min X value as specified by user.
* @return Min X value
*/
void MuonAnalysis::setXMin(IAlgorithm_sptr alg, const std::string& propName) const
double MuonAnalysis::startTime() const
{
auto startTimeType = m_optionTab->getStartTimeType();
double value(0);
Expand All @@ -2419,23 +2424,16 @@ void MuonAnalysis::setXMin(IAlgorithm_sptr alg, const std::string& propName) con
throw std::runtime_error("Unknown start time type");
}

alg->setProperty(propName, value);
return value;
}

/**
* Sets specified option of the algorithm to max X value selected by user. If use doesn't specify
* the value - the option is not set.
* @param alg :: Algorithm to set property for
* @param propName :: Name of the property to set
* Returns max X value as specified by user.
* @return Max X value, or EMPTY_DBL() if not set
*/
void MuonAnalysis::setXMax(IAlgorithm_sptr alg, const std::string& propName) const
double MuonAnalysis::finishTime() const
{
double value = m_optionTab->getCustomFinishTime();

if ( value != EMPTY_DBL() )
{
alg->setProperty(propName, value);
}
return m_optionTab->getCustomFinishTime();
}

/**
Expand Down Expand Up @@ -3401,8 +3399,13 @@ Algorithm_sptr MuonAnalysis::createLoadAlgorithm()
loadAlg->setProperty("DetectorGroupingTable", grouping);

// -- X axis options --------------------------------------------------------
setXMin(loadAlg, "Xmin");
setXMax(loadAlg, "Xmax");
loadAlg->setProperty("Xmin", startTime());

double Xmax = finishTime();
if (Xmax != EMPTY_DBL())
{
loadAlg->setProperty("Xmax", Xmax);
}

double timeZero = m_uiForm.timeZeroFront->text().toDouble();
loadAlg->setProperty("TimeZero", timeZero);
Expand Down

0 comments on commit 7da3d0a

Please sign in to comment.