Skip to content

Commit

Permalink
More descriptive name for observation class. Refs #5397
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Aug 3, 2012
1 parent e0af7db commit ee812b4
Show file tree
Hide file tree
Showing 15 changed files with 105 additions and 105 deletions.
10 changes: 5 additions & 5 deletions Code/Mantid/Framework/MDAlgorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ set ( SRC_FILES
src/PlusMD.cpp
src/PowerMD.cpp
src/QuadEnBackground.cpp
src/Quantification/CachedExperimentInfo.cpp
src/Quantification/FitResolutionConvolvedModel.cpp
src/Quantification/ForegroundModel.cpp
src/Quantification/ForegroundModelFactory.cpp
src/Quantification/MDResolutionConvolution.cpp
src/Quantification/MDResolutionConvolutionFactory.cpp
src/Quantification/Models/Strontium122.cpp
src/Quantification/Observation.cpp
src/Quantification/ResolutionConvolvedCrossSection.cpp
src/Quantification/Resolution/ModeratorChopperResolution.cpp
src/Quantification/Resolution/TobyFitBMatrix.cpp
src/Quantification/Resolution/TobyFitResolutionModel.cpp
src/Quantification/Resolution/TobyFitYVector.cpp
src/Quantification/ResolutionConvolvedCrossSection.cpp
src/Quantification/SimulateResolutionConvolvedModel.cpp
src/RunParam.cpp
src/SaveZODS.cpp
Expand Down Expand Up @@ -91,18 +91,18 @@ set ( INC_FILES
inc/MantidMDAlgorithms/PlusMD.h
inc/MantidMDAlgorithms/PowerMD.h
inc/MantidMDAlgorithms/QuadEnBackground.h
inc/MantidMDAlgorithms/Quantification/CachedExperimentInfo.h
inc/MantidMDAlgorithms/Quantification/FitResolutionConvolvedModel.h
inc/MantidMDAlgorithms/Quantification/ForegroundModel.h
inc/MantidMDAlgorithms/Quantification/ForegroundModelFactory.h
inc/MantidMDAlgorithms/Quantification/MDResolutionConvolution.h
inc/MantidMDAlgorithms/Quantification/MDResolutionConvolutionFactory.h
inc/MantidMDAlgorithms/Quantification/Models/Strontium122.h
inc/MantidMDAlgorithms/Quantification/Observation.h
inc/MantidMDAlgorithms/Quantification/ResolutionConvolvedCrossSection.h
inc/MantidMDAlgorithms/Quantification/Resolution/ModeratorChopperResolution.h
inc/MantidMDAlgorithms/Quantification/Resolution/TobyFitBMatrix.h
inc/MantidMDAlgorithms/Quantification/Resolution/TobyFitResolutionModel.h
inc/MantidMDAlgorithms/Quantification/Resolution/TobyFitYVector.h
inc/MantidMDAlgorithms/Quantification/ResolutionConvolvedCrossSection.h
inc/MantidMDAlgorithms/Quantification/SimulateResolutionConvolvedModel.h
inc/MantidMDAlgorithms/RunParam.h
inc/MantidMDAlgorithms/SaveZODS.h
Expand All @@ -126,6 +126,7 @@ set ( TEST_FILES
#test/CreateMDFitWorkspaceTest.h
test/AndMDTest.h
test/BooleanBinaryOperationMDTest.h
test/CachedExperimentInfoTest.h
test/CobaltSWDTest.h
test/CompareMDWorkspacesTest.h
test/ConvertEventsToMDTest.h
Expand Down Expand Up @@ -153,7 +154,6 @@ set ( TEST_FILES
test/ModeratorChopperResolutionTest.h
test/MultiplyMDTest.h
test/NotMDTest.h
test/ObservationTest.h
test/OrMDTest.h
test/PlusMDTest.h
test/PowerMDTest.h
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef MANTID_MDALGORITHMS_OBSERVATION_H_
#define MANTID_MDALGORITHMS_OBSERVATION_H_
#ifndef MANTID_MDALGORITHMS_CACHEDEXPERIMENTINFO_H_
#define MANTID_MDALGORITHMS_CACHEDEXPERIMENTINFO_H_
/**
Copyright © 2012 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
Expand Down Expand Up @@ -37,11 +37,11 @@ namespace Mantid
* It also serves as a cache for storing quicker lookups to frequently
* used distances and values, i.e twoTheta, phi etc.
*/
class DLLExport Observation
class DLLExport CachedExperimentInfo
{
public:
/// Constructor
Observation(const API::ExperimentInfo & exptInfo, const detid_t detID);
CachedExperimentInfo(const API::ExperimentInfo & exptInfo, const detid_t detID);

/// Return the experiment info
inline const API::ExperimentInfo & experimentInfo() const { return m_exptInfo; }
Expand Down Expand Up @@ -74,8 +74,8 @@ namespace Mantid
const Kernel::DblMatrix & sampleToDetectorTransform() const;

private:
DISABLE_DEFAULT_CONSTRUCT(Observation);
DISABLE_COPY_AND_ASSIGN(Observation);
DISABLE_DEFAULT_CONSTRUCT(CachedExperimentInfo);
DISABLE_COPY_AND_ASSIGN(CachedExperimentInfo);

/// Cache frequently used values
void initCaches(const Geometry::Instrument_const_sptr & instrument, const detid_t detID);
Expand Down Expand Up @@ -116,4 +116,4 @@ namespace Mantid
}


#endif /* MANTID_MDALGORITHMS_OBSERVATION_H_ */
#endif /* MANTID_MDALGORITHMS_CACHEDEXPERIMENTINFO_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace Mantid

namespace MDAlgorithms
{
class Observation;
class CachedExperimentInfo;
/**
*
* Calculates the energy resolution for a moderator-chopper
Expand All @@ -51,7 +51,7 @@ namespace Mantid
{
public:
/// Constructor
ModeratorChopperResolution(const Observation & observation);
ModeratorChopperResolution(const CachedExperimentInfo & observation);

/// Destructor
~ModeratorChopperResolution();
Expand All @@ -67,7 +67,7 @@ namespace Mantid
void initCaches();

/// A reference to the observation object
const Observation & m_observation;
const CachedExperimentInfo & m_observation;
/// A pointer to the moderator object
boost::shared_ptr<const API::ModeratorModel> m_moderator;
/// A pointer to the chopper object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Mantid
//-------------------------------------------------------------------------
// Forward declarations
//-------------------------------------------------------------------------
class Observation;
class CachedExperimentInfo;
struct QOmegaPoint;

/**
Expand All @@ -47,7 +47,7 @@ namespace Mantid
TobyFitBMatrix();

/// Calculate the values for this observation & QDeltaE point
void recalculate(const Observation & observation,
void recalculate(const CachedExperimentInfo & observation,
const QOmegaPoint & qOmega);

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
#include "MantidMDAlgorithms/Quantification/MDResolutionConvolution.h"
#include "MantidMDAlgorithms/Quantification/Observation.h"
#include "MantidMDAlgorithms/Quantification/CachedExperimentInfo.h"

#include "MantidMDAlgorithms/Quantification/Resolution/TobyFitYVector.h"
#include "MantidMDAlgorithms/Quantification/Resolution/TobyFitBMatrix.h"
Expand Down Expand Up @@ -96,16 +96,16 @@ namespace Mantid
void setAttribute(const std::string& name, const API::IFunction::Attribute & value);

/// Ensure the run parameters are up to date
void updateRunParameters(const Observation & exptInfo) const;
void updateRunParameters(const CachedExperimentInfo & exptInfo) const;

/// Calculate resolution coefficients
void calculateResolutionCoefficients(const Observation & observation,
void calculateResolutionCoefficients(const CachedExperimentInfo & observation,
const QOmegaPoint & eventPoint) const;
/// Generates the vector of random points
void generateIntegrationVariables(const Observation & observation,
void generateIntegrationVariables(const CachedExperimentInfo & observation,
const QOmegaPoint & eventPoint) const;
/// Map integration variables to perturbed values in Q-E space
void calculatePerturbedQE(const Observation & observation,const QOmegaPoint & eventPoint) const;
void calculatePerturbedQE(const CachedExperimentInfo & observation,const QOmegaPoint & eventPoint) const;

/// Return true if it is time to check for convergence of the
/// current sigma value
Expand Down Expand Up @@ -141,8 +141,8 @@ namespace Mantid
/// A pre-sized vector for the QE position to be evaluated
mutable std::vector<std::vector<double>> m_deltaQE;

/// Cache of detector observations
std::map<std::pair<int, detid_t>, Observation*> m_observations;
/// Cache of experiment info caches
std::map<std::pair<int, detid_t>, CachedExperimentInfo*> m_exptCache;
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace Mantid
// Forward declarations
//
struct QOmegaPoint;
class Observation;
class CachedExperimentInfo;

/**
* Defines a vector of independent integration variables that are transformed using the
Expand Down Expand Up @@ -87,7 +87,7 @@ namespace Mantid
/// Calculate the values of the integration variables for
/// the given random variates
size_t recalculate(const std::vector<double> & randomNums,
const Observation & observation,
const CachedExperimentInfo & observation,
const QOmegaPoint & qOmega);

private:
Expand Down Expand Up @@ -124,7 +124,7 @@ namespace Mantid
/// A pointer to the current set of random numbers
const std::vector<double> * m_curRandNums;
/// A pointer to the current observation
const Observation *m_curObs;
const CachedExperimentInfo *m_curObs;
/// The current point in Q-DeltaE space
const QOmegaPoint *m_curQOmega;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Includes
//
#include "MantidMDAlgorithms/Quantification/Observation.h"
#include "MantidMDAlgorithms/Quantification/CachedExperimentInfo.h"
#include "MantidGeometry/Crystal/OrientedLattice.h"
#include "MantidGeometry/Instrument/ReferenceFrame.h"
#include "MantidGeometry/Instrument/Goniometer.h"
Expand All @@ -17,7 +17,7 @@ namespace Mantid
* @param exptInfo :: The description of the experiment
* @param detID :: An ID a detector within the instrument
*/
Observation::Observation(const API::ExperimentInfo & exptInfo, detid_t detID)
CachedExperimentInfo::CachedExperimentInfo(const API::ExperimentInfo & exptInfo, detid_t detID)
: m_exptInfo(exptInfo), m_efixed(0.0),
m_twoTheta(0.0), m_phi(0.0), m_modToChop(0.0), m_apertureToChop(0.0),
m_chopToSample(0.0), m_sampleToDet(0.0), m_beam(Geometry::Z), m_up(Geometry::Y), m_horiz(Geometry::X),
Expand All @@ -31,15 +31,15 @@ namespace Mantid
* Returns the efixed value for this detector/experiment
* @return
*/
double Observation::getEFixed() const
double CachedExperimentInfo::getEFixed() const
{
return m_efixed;
}
/**
* Returns the scattering angle theta in radians
* @return The scattering angle from the beam direction in radians
*/
double Observation::twoTheta() const
double CachedExperimentInfo::twoTheta() const
{
return m_twoTheta;
}
Expand All @@ -48,7 +48,7 @@ namespace Mantid
* Returns the azimuth angle phi in radians
* @return Phi angle in radians
*/
double Observation::phi() const
double CachedExperimentInfo::phi() const
{
return m_phi;
}
Expand All @@ -57,7 +57,7 @@ namespace Mantid
* @return the distance from the moderator to the first chopper in metres.
* throws if no chopper installed
*/
double Observation::moderatorToFirstChopperDistance() const
double CachedExperimentInfo::moderatorToFirstChopperDistance() const
{
return m_modToChop;
}
Expand All @@ -66,7 +66,7 @@ namespace Mantid
* @return the distance from the first aperture to the first chopper in metres.
* throws if no chopper installed/aperture installed
*/
double Observation::firstApertureToFirstChopperDistance() const
double CachedExperimentInfo::firstApertureToFirstChopperDistance() const
{
return m_apertureToChop;
}
Expand All @@ -75,29 +75,29 @@ namespace Mantid
*
* @return the distance from the chopper to the sample in metres
*/
double Observation::firstChopperToSampleDistance() const
double CachedExperimentInfo::firstChopperToSampleDistance() const
{
return m_chopToSample;
}

/**
* @return the sample to detector distance in metres
*/
double Observation::sampleToDetectorDistance() const
double CachedExperimentInfo::sampleToDetectorDistance() const
{
return m_sampleToDet;
}

/**
* Returns the aperture dimensions
*/
const std::pair<double,double> & Observation::apertureSize() const
const std::pair<double,double> & CachedExperimentInfo::apertureSize() const
{
return m_apertureSize;
}

/// @returns the widths of a cube that encloses the sample
const Kernel::V3D & Observation::sampleCuboid() const
const Kernel::V3D & CachedExperimentInfo::sampleCuboid() const
{
return m_sampleWidths;
}
Expand All @@ -110,7 +110,7 @@ namespace Mantid
* @return A random point of detector in the detector volume. The returned vector is oriented with the instrument's
* reference frame
*/
const Kernel::V3D Observation::sampleOverDetectorVolume(const double randInBeamDir, const double randInUpDir, const double randInHorizontalDir) const
const Kernel::V3D CachedExperimentInfo::sampleOverDetectorVolume(const double randInBeamDir, const double randInUpDir, const double randInHorizontalDir) const
{
const Kernel::V3D & minPoint = m_detBox.minPoint();
const Kernel::V3D & maxPoint = m_detBox.maxPoint();
Expand All @@ -127,15 +127,15 @@ namespace Mantid
* Computes the matrix required to transform from lab coordinates to detector coordinates
* @return The rotation matrix required to transform from lab coordinates to detector coordinates
*/
const Kernel::DblMatrix & Observation::labToDetectorTransform() const
const Kernel::DblMatrix & CachedExperimentInfo::labToDetectorTransform() const
{
return m_gonimeter->getR();
}

/**
* @return the matrix required to move from sample coordinates -> detector coordinates
*/
const Kernel::DblMatrix & Observation::sampleToDetectorTransform() const
const Kernel::DblMatrix & CachedExperimentInfo::sampleToDetectorTransform() const
{
return m_sampleToDetMatrix;
}
Expand All @@ -148,7 +148,7 @@ namespace Mantid
* @param :: The instrument for this run
* @param :: The det ID for this observation
*/
void Observation::initCaches(const Geometry::Instrument_const_sptr & instrument, const detid_t detID)
void CachedExperimentInfo::initCaches(const Geometry::Instrument_const_sptr & instrument, const detid_t detID)
{
// Throws if detector does not exist
IDetector_const_sptr det = instrument->getDetector(detID);
Expand Down Expand Up @@ -183,7 +183,7 @@ namespace Mantid
aperture->getBoundingBox(apertureBox);
if(apertureBox.isNull())
{
throw std::invalid_argument("Observation::initCaches - Aperture has no bounding box, cannot sample from it");
throw std::invalid_argument("CachedExperimentInfo::initCaches - Aperture has no bounding box, cannot sample from it");
}
m_apertureSize.first = apertureBox.maxPoint()[0] - apertureBox.minPoint()[0];
m_apertureSize.second = apertureBox.maxPoint()[1] - apertureBox.minPoint()[1];
Expand All @@ -197,7 +197,7 @@ namespace Mantid
const Geometry::Object_const_sptr detShape = det->shape();
if(!detShape)
{
throw std::invalid_argument("Observation::initCaches - Detector has no bounding box, cannot sample from it. ID:"
throw std::invalid_argument("CachedExperimentInfo::initCaches - Detector has no bounding box, cannot sample from it. ID:"
+ boost::lexical_cast<std::string>(det->getID()));
}
m_detBox = detShape->getBoundingBox();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Includes
#include "MantidMDAlgorithms/Quantification/Resolution/ModeratorChopperResolution.h"
#include "MantidMDAlgorithms/Quantification/Observation.h"
#include "MantidMDAlgorithms/Quantification/CachedExperimentInfo.h"

#include "MantidAPI/ExperimentInfo.h"
#include "MantidAPI/ChopperModel.h"
Expand All @@ -18,7 +18,7 @@ namespace Mantid
* Constructor taking an observation object
* @param observation :: An event containing an experiment description & detector ID
*/
ModeratorChopperResolution::ModeratorChopperResolution(const Observation & observation) :
ModeratorChopperResolution::ModeratorChopperResolution(const CachedExperimentInfo & observation) :
m_observation(observation), m_modChopDist(0.0), m_chopSampleDist(0.0)
{
initCaches();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "MantidMDAlgorithms/Quantification/Resolution/TobyFitBMatrix.h"
#include "MantidMDAlgorithms/Quantification/Resolution/TobyFitResolutionModel.h"
#include "MantidMDAlgorithms/Quantification/Resolution/TobyFitYVector.h"
#include "MantidMDAlgorithms/Quantification/Observation.h"
#include "MantidMDAlgorithms/Quantification/CachedExperimentInfo.h"

#include "MantidAPI/ChopperModel.h"
#include "MantidAPI/ModeratorModel.h"
Expand All @@ -28,7 +28,7 @@ namespace Mantid
* @param observation :: The current observation
* @param qOmega :: The current point in Q-DeltaE space
*/
void TobyFitBMatrix::recalculate(const Observation & observation,
void TobyFitBMatrix::recalculate(const CachedExperimentInfo & observation,
const QOmegaPoint & qOmega)
{
// Compute transformation matrices
Expand Down

0 comments on commit ee812b4

Please sign in to comment.