Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/7505_sinq_code'
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Oct 30, 2013
2 parents d3bf2c8 + b3b66c5 commit 8d3db37
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
Expand Up @@ -4,8 +4,8 @@
//---------------------------------------------------
// Includes
//---------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/DeprecatedAlgorithm.h"
#include "MantidAPI/IFileLoader.h"
#include "MantidNexus/NexusClasses.h"
#include "MantidDataHandling/LoadHelper.h"

Expand Down Expand Up @@ -42,7 +42,8 @@ namespace DataHandling {
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport LoadSINQFocus: public API::Algorithm, public API::DeprecatedAlgorithm
class DLLExport LoadSINQFocus: public API::IFileLoader<Kernel::NexusDescriptor>,
public API::DeprecatedAlgorithm
{
public:
LoadSINQFocus();
Expand All @@ -52,6 +53,9 @@ namespace DataHandling {
virtual int version() const;
virtual const std::string category() const;

/// Returns a confidence value that this algorithm can load a file
virtual int confidence(Kernel::NexusDescriptor & descriptor) const;

private:
virtual void initDocs();
void init();
Expand Down
26 changes: 21 additions & 5 deletions Code/Mantid/Framework/DataHandling/src/LoadSINQFocus.cpp
Expand Up @@ -9,6 +9,7 @@
#include "MantidDataHandling/LoadSINQFocus.h"
#include "MantidAPI/FileProperty.h"
#include "MantidAPI/Progress.h"
#include "MantidAPI/RegisterFileLoader.h"
#include "MantidGeometry/Instrument.h"
#include "MantidKernel/UnitFactory.h"

Expand All @@ -25,16 +26,16 @@ using namespace Kernel;
using namespace API;
using namespace NeXus;

DECLARE_ALGORITHM(LoadSINQFocus);
DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadSINQFocus);

//----------------------------------------------------------------------------------------------
/** Constructor
*/
LoadSINQFocus::LoadSINQFocus() {
m_instrumentName = "";
m_supportedInstruments.push_back("FOCUS");
this->useAlgorithm("CalculateFlatBackground");
this->deprecatedDate("2013-05-21");
this->useAlgorithm("LoadSINQ");
this->deprecatedDate("2013-10-28");
}

//----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -64,8 +65,23 @@ const std::string LoadSINQFocus::category() const {
//----------------------------------------------------------------------------------------------
/// Sets documentation strings for this algorithm
void LoadSINQFocus::initDocs() {
this->setWikiSummary("Loads PSI nexus file.");
this->setOptionalMessage("Loads PSI nexus file.");
this->setWikiSummary("Loads a FOCUS nexus file from the PSI");
this->setOptionalMessage("Loads a FOCUS nexus file from the PSI");
}

/**
* Return the confidence with with this algorithm can load the file
* @param descriptor A descriptor for the file
* @returns An integer specifying the confidence level. 0 indicates it will not be used
*/
int LoadSINQFocus::confidence(Kernel::NexusDescriptor & descriptor) const {

// fields existent only at the SINQ (to date Loader only valid for focus)
if (descriptor.pathExists("/entry1/FOCUS/SINQ") ){
return 80;
} else {
return 0;
}
}

//-----------------------------------------1-----------------------------------------------------
Expand Down

0 comments on commit 8d3db37

Please sign in to comment.