Commit a4a1ed55 authored by Ricardo Ferraz Leal's avatar Ricardo Ferraz Leal
Browse files

Re #9713 Clean up comments

parent 206267d6
......@@ -8,124 +8,124 @@
#include "MantidNexus/NexusClasses.h"
#include "MantidDataHandling/LoadHelper.h"
namespace Mantid {
namespace DataHandling {
/**
Loads an ILL nexus file into a Mantid workspace.
Required properties:
<UL>
<LI> Filename - The ILL nexus file to be read </LI>
<LI> Workspace - The name to give to the output workspace </LI>
</UL>
Copyright &copy; 2010 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport LoadILL: public API::IFileLoader<Kernel::NexusDescriptor> {
public:
/// Constructor
LoadILL(); /// Virtual destructor
virtual ~LoadILL() {
}
/// Algorithm's name
virtual const std::string name() const {
return "LoadILL";
}
///Summary of algorithms purpose
virtual const std::string summary() const {
return "Loads a ILL nexus file.";
}
/// Algorithm's version
virtual int version() const {
return (1);
}
/// Algorithm's category for identification
virtual const std::string category() const {
return "DataHandling";
}
/// Returns a confidence value that this algorithm can load a file
int confidence(Kernel::NexusDescriptor & descriptor) const;
private:
// Initialisation code
void init();
// Execution code
void exec();
int getEPPFromVanadium(const std::string &,
Mantid::API::MatrixWorkspace_sptr);
void loadInstrumentDetails(NeXus::NXEntry&);
std::vector<std::vector<int> > getMonitorInfo(NeXus::NXEntry& firstEntry);
void initWorkSpace(NeXus::NXEntry& entry,
const std::vector<std::vector<int> >&);
void initInstrumentSpecific();
void addAllNexusFieldsAsProperties(std::string filename);
void addEnergyToRun();
void loadExperimentDetails(NeXus::NXEntry & entry);
int getDetectorElasticPeakPosition(const NeXus::NXInt &data);
void loadTimeDetails(NeXus::NXEntry& entry);
NeXus::NXData loadNexusFileData(NeXus::NXEntry& entry);
void loadDataIntoTheWorkSpace(NeXus::NXEntry& entry,
const std::vector<std::vector<int> >&,
int vanaCalculatedDetectorElasticPeakPosition = -1);
void runLoadInstrument();
/// Calculate error for y
static double calculateError(double in) {
return sqrt(in);
}
int validateVanadium(const std::string &);
API::MatrixWorkspace_sptr m_localWorkspace;
namespace Mantid
{
namespace DataHandling
{
/**
Loads an ILL nexus file into a Mantid workspace.
Copyright &copy; 2010 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport LoadILL: public API::IFileLoader<Kernel::NexusDescriptor>
{
public:
/// Constructor
LoadILL(); /// Virtual destructor
virtual ~LoadILL()
{
}
/// Algorithm's name
virtual const std::string name() const
{
return "LoadILL";
}
///Summary of algorithms purpose
virtual const std::string summary() const
{
return "Loads a ILL nexus file.";
}
/// Algorithm's version
virtual int version() const
{
return (1);
}
/// Algorithm's category for identification
virtual const std::string category() const
{
return "DataHandling";
}
/// Returns a confidence value that this algorithm can load a file
int confidence(Kernel::NexusDescriptor & descriptor) const;
private:
// Initialisation code
void init();
// Execution code
void exec();
int getEPPFromVanadium(const std::string &, Mantid::API::MatrixWorkspace_sptr);
void loadInstrumentDetails(NeXus::NXEntry&);
std::vector<std::vector<int> > getMonitorInfo(NeXus::NXEntry& firstEntry);
void initWorkSpace(NeXus::NXEntry& entry, const std::vector<std::vector<int> >&);
void initInstrumentSpecific();
void addAllNexusFieldsAsProperties(std::string filename);
void addEnergyToRun();
void loadExperimentDetails(NeXus::NXEntry & entry);
int getDetectorElasticPeakPosition(const NeXus::NXInt &data);
void loadTimeDetails(NeXus::NXEntry& entry);
NeXus::NXData loadNexusFileData(NeXus::NXEntry& entry);
void loadDataIntoTheWorkSpace(NeXus::NXEntry& entry, const std::vector<std::vector<int> >&,
int vanaCalculatedDetectorElasticPeakPosition = -1);
void runLoadInstrument();
/// Calculate error for y
static double calculateError(double in)
{
return sqrt(in);
}
int validateVanadium(const std::string &);
API::MatrixWorkspace_sptr m_localWorkspace;
// NeXus::NXRoot m_dataRoot;
// NeXus::NXRoot m_vanaRoot;
std::string m_instrumentName; ///< Name of the instrument
std::string m_instrumentPath; ///< Name of the instrument path
std::string m_instrumentName; ///< Name of the instrument
std::string m_instrumentPath; ///< Name of the instrument path
// Variables describing the data in the detector
size_t m_numberOfTubes; // number of tubes - X
size_t m_numberOfPixelsPerTube; //number of pixels per tube - Y
size_t m_numberOfChannels; // time channels - Z
size_t m_numberOfHistograms;
// Variables describing the data in the detector
size_t m_numberOfTubes; // number of tubes - X
size_t m_numberOfPixelsPerTube; //number of pixels per tube - Y
size_t m_numberOfChannels; // time channels - Z
size_t m_numberOfHistograms;
/* Values parsed from the nexus file */
int m_monitorElasticPeakPosition;
double m_wavelength;
double m_channelWidth;
/* Values parsed from the nexus file */
int m_monitorElasticPeakPosition;
double m_wavelength;
double m_channelWidth;
double m_l1; //=2.0;
double m_l2; //=4.0;
double m_l1; //=2.0;
double m_l2; //=4.0;
std::vector<std::string> m_supportedInstruments;
LoadHelper m_loader;
std::vector<std::string> m_supportedInstruments;
LoadHelper m_loader;
};
};
} // namespace DataHandling
} // namespace DataHandling
} // namespace Mantid
#endif /*MANTID_DATAHANDLING_LoadILL_H_*/
......@@ -13,7 +13,7 @@ namespace Mantid
namespace DataHandling
{
/** LoadILLReflectometry : TODO: DESCRIPTION
/** LoadILLReflectometry : Loads a ILL Reflectometry data file.
Copyright &copy; 2014 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
......@@ -80,7 +80,6 @@ namespace Mantid
double m_wavelength;
double m_channelWidth;
std::vector<std::string> m_supportedInstruments;
LoadHelper m_loader;
......
......@@ -29,16 +29,6 @@ namespace Mantid
DECLARE_NEXUS_FILELOADER_ALGORITHM(LoadILL);
/**
* tostring operator to print the contents of NXClassInfo
*
* TODO : This has to go somewhere else
*/
std::ostream& operator<<(std::ostream &strm, const NXClassInfo &c)
{
return strm << "NXClassInfo :: nxname: " << c.nxname << " , nxclass: " << c.nxclass;
}
//---------------------------------------------------
// Private member functions
//---------------------------------------------------
......@@ -54,8 +44,7 @@ namespace Mantid
// fields existent only at the ILL
if (descriptor.pathExists("/entry0/wavelength")
&& descriptor.pathExists("/entry0/experiment_identifier")
&& descriptor.pathExists("/entry0/mode")
&& !descriptor.pathExists("/entry0/dataSD") // This one is for LoadILLIndirect
&& descriptor.pathExists("/entry0/mode") && !descriptor.pathExists("/entry0/dataSD") // This one is for LoadILLIndirect
&& !descriptor.pathExists("/entry0/instrument/VirtualChopper") // This one is for LoadILLReflectometry
)
{
......@@ -373,25 +362,14 @@ namespace Mantid
/*
* Load data about the Experiment.
*
* TODO: This is very incomplete. We need input from scientists to complete the code below
* TODO: Scientists must provide information to complete the code below
*
* @param entry :: The Nexus entry
*/
void LoadILL::loadExperimentDetails(NXEntry & entry)
{
// TODO: Do the rest
// Pick out the geometry information
std::string description = boost::lexical_cast<std::string>(entry.getFloat("sample/description"));
m_localWorkspace->mutableSample().setName(description);
// m_localWorkspace->mutableSample().setThickness(static_cast<double> (isis_raw->spb.e_thick));
// m_localWorkspace->mutableSample().setHeight(static_cast<double> (isis_raw->spb.e_height));
// m_localWorkspace->mutableSample().setWidth(static_cast<double> (isis_raw->spb.e_width));
}
/**
......@@ -401,7 +379,6 @@ namespace Mantid
* It gets a few spectra in the equatorial line of the detector,
* sum them up and finds the maximum = the Elastic peak
*
*
* @param data :: spectra data
* @return detector Elastic Peak Position
*/
......@@ -437,7 +414,6 @@ namespace Mantid
}
else
{
//calculatedDetectorElasticPeakPosition = *it;
calculatedDetectorElasticPeakPosition = static_cast<int>(std::distance(
cumulatedSumOfSpectras.begin(), it));
......@@ -598,9 +574,6 @@ namespace Mantid
// Now execute the Child Algorithm. Catch and log any error, but don't stop.
try
{
// TODO: depending on the m_numberOfPixelsPerTube we might need to load a different IDF
loadInst->setPropertyValue("InstrumentName", m_instrumentName);
loadInst->setProperty<MatrixWorkspace_sptr>("Workspace", m_localWorkspace);
loadInst->execute();
......
......@@ -33,6 +33,8 @@ namespace Mantid
*/
LoadILLReflectometry::LoadILLReflectometry()
{
m_wavelength = 0;
m_channelWidth = 0;
m_numberOfTubes = 0; // number of tubes - X
m_numberOfPixelsPerTube = 0; //number of pixels per tube - Y
m_numberOfChannels = 0; // time channels - Z
......@@ -229,7 +231,6 @@ namespace Mantid
m_numberOfPixelsPerTube = static_cast<size_t>(data.dim1());
m_numberOfChannels = static_cast<size_t>(data.dim2());
}
/**
......@@ -315,7 +316,6 @@ namespace Mantid
double open_offset = entry.getFloat("instrument/VirtualChopper/open_offset"); /* par1[56] */
double chop1_speed = entry.getFloat("instrument/VirtualChopper/chopper1_speed_average"); /* PAR2[109] */
g_log.debug() << "m_numberOfChannels: " << m_numberOfChannels << std::endl;
g_log.debug() << "m_channelWidth: " << m_channelWidth << std::endl;
g_log.debug() << "tof_delay: " << tof_delay << std::endl;
......@@ -326,9 +326,8 @@ namespace Mantid
g_log.debug() << "chop1_speed: " << chop1_speed << std::endl;
// Thanks to Miguel Gonzales/ILL for this TOF formula
double t_TOF2 = - 1.e6 * 60.0 * (POFF - 45.0 + mean_chop_2_phase - mean_chop_1_phase + open_offset)
/
(2.0 * 360 * chop1_speed);
double t_TOF2 = -1.e6 * 60.0 * (POFF - 45.0 + mean_chop_2_phase - mean_chop_1_phase + open_offset)
/ (2.0 * 360 * chop1_speed);
g_log.debug() << "t_TOF2: " << t_TOF2 << std::endl;
......@@ -340,11 +339,10 @@ namespace Mantid
//g_log.debug() << "t_TOF1: " << t_TOF1 << std::endl;
m_localWorkspace->dataX(0)[timechannelnumber] = t_TOF1 + t_TOF2 ;
m_localWorkspace->dataX(0)[timechannelnumber] = t_TOF1 + t_TOF2;
}
// Load monitors
for (size_t im = 0; im < nb_monitors; im++)
{
......@@ -389,8 +387,6 @@ namespace Mantid
} // LoadILLIndirect::loadDataIntoTheWorkSpace
void LoadILLReflectometry::loadNexusEntriesIntoProperties(std::string nexusfilename)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment