Skip to content

Commit

Permalink
Refs #9949. Replace pointer by reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Jul 17, 2014
1 parent 206267d commit 3a20748
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Expand Up @@ -208,7 +208,7 @@ namespace Mantid
const std::string & top_entry_name, Algorithm * alg);

static BankPulseTimes * runLoadNexusLogs(const std::string &nexusfilename, API::MatrixWorkspace_sptr localWorkspace,
Algorithm * alg);
Algorithm &alg);

/// Load a spectra mapping from the given file
bool loadSpectraMapping(const std::string& filename, const bool monitorsOnly, const std::string& entry_name);
Expand Down
14 changes: 7 additions & 7 deletions Code/Mantid/Framework/DataHandling/src/LoadEventNexus.cpp
Expand Up @@ -1342,7 +1342,7 @@ void LoadEventNexus::loadEvents(API::Progress * const prog, const bool monitors)
if (loadlogs)
{
prog->doReport("Loading DAS logs");
m_allBanksPulseTimes = runLoadNexusLogs(m_filename, WS, this);
m_allBanksPulseTimes = runLoadNexusLogs(m_filename, WS, *this);
run_start = WS->getFirstPulseTime();
}
else
Expand Down Expand Up @@ -1965,17 +1965,17 @@ bool LoadEventNexus::runLoadInstrument(const std::string &nexusfilename, MatrixW
* @return the BankPulseTimes object created, NULL if it failed.
*/
BankPulseTimes * LoadEventNexus::runLoadNexusLogs(const std::string &nexusfilename, API::MatrixWorkspace_sptr localWorkspace,
Algorithm * alg)
Algorithm& alg)
{
// --------------------- Load DAS Logs -----------------
//The pulse times will be empty if not specified in the DAS logs.
BankPulseTimes * out = NULL;
IAlgorithm_sptr loadLogs = alg->createChildAlgorithm("LoadNexusLogs");
IAlgorithm_sptr loadLogs = alg.createChildAlgorithm("LoadNexusLogs");

// Now execute the Child Algorithm. Catch and log any error, but don't stop.
try
{
alg->getLogger().information() << "Loading logs from NeXus file..." << endl;
alg.getLogger().information() << "Loading logs from NeXus file..." << endl;
loadLogs->setPropertyValue("Filename", nexusfilename);
loadLogs->setProperty<MatrixWorkspace_sptr> ("Workspace", localWorkspace);
loadLogs->execute();
Expand All @@ -1989,7 +1989,7 @@ BankPulseTimes * LoadEventNexus::runLoadNexusLogs(const std::string &nexusfilena
if (!temp.empty())
{
if (temp[0] < Kernel::DateAndTime("1991-01-01T00:00:00"))
alg->getLogger().warning() << "Found entries in the proton_charge sample log with invalid pulse time!\n";
alg.getLogger().warning() << "Found entries in the proton_charge sample log with invalid pulse time!\n";

Kernel::DateAndTime run_start = localWorkspace->getFirstPulseTime();
// add the start of the run as a ISO8601 date/time string. The start = first non-zero time.
Expand All @@ -1998,7 +1998,7 @@ BankPulseTimes * LoadEventNexus::runLoadNexusLogs(const std::string &nexusfilena
}
else
{
alg->getLogger().warning() << "Empty proton_charge sample log. You will not be able to filter by time.\n";
alg.getLogger().warning() << "Empty proton_charge sample log. You will not be able to filter by time.\n";
}
/// Attempt to make a gonoimeter from the logs
try
Expand All @@ -2013,7 +2013,7 @@ BankPulseTimes * LoadEventNexus::runLoadNexusLogs(const std::string &nexusfilena
}
catch (...)
{
alg->getLogger().error() << "Error while loading Logs from SNS Nexus. Some sample logs may be missing." << std::endl;
alg.getLogger().error() << "Error while loading Logs from SNS Nexus. Some sample logs may be missing." << std::endl;
return out;
}
return out;
Expand Down
7 changes: 6 additions & 1 deletion Code/Mantid/Framework/DataHandling/src/LoadTOFRawNexus.cpp
Expand Up @@ -520,7 +520,12 @@ void LoadTOFRawNexus::exec()
// Load the logs
prog->doReport("Loading DAS logs");
g_log.debug() << "Loading DAS logs" << std::endl;
LoadEventNexus::runLoadNexusLogs(filename, WS, this);

// boost::shared_ptr<const Algorithm> pt = boost::dynamic_pointer_cast<const Algorithm>(boost::make_shared<const Algorithm>(this));

// LoadEventNexus::runLoadNexusLogs(filename, WS, this);

LoadEventNexus::runLoadNexusLogs(filename, WS, *this);

// Load the instrument
prog->report("Loading instrument");
Expand Down

0 comments on commit 3a20748

Please sign in to comment.