diff --git a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsReduction.cpp b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsReduction.cpp index 400b4ed0c7a188676152479328e23bfd8dfeb3b2..9d802b4ee8a898135add284656bdb49e29fb9c2b 100644 --- a/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsReduction.cpp +++ b/Code/Mantid/Framework/WorkflowAlgorithms/src/DgsReduction.cpp @@ -71,185 +71,250 @@ namespace WorkflowAlgorithms */ void DgsReduction::init() { - declareProperty(new FileProperty("SampleFile", "", FileProperty::OptionalLoad, "_event.nxs"), + // Sample setup options + std::string sampleSetup = "Sample Setup"; + this->declareProperty(new FileProperty("SampleFile", "", + FileProperty::OptionalLoad, "_event.nxs"), "File containing the data to reduce"); - declareProperty(new WorkspaceProperty<>("InputWorkspace", "", Direction::Input, PropertyMode::Optional), + this->declareProperty(new WorkspaceProperty<>("InputWorkspace", "", + Direction::Input, PropertyMode::Optional), "Workspace to be reduced"); - //declareProperty("SampleData", "", "Run numbers, files or workspaces of the data sets to be reduced"); auto mustBePositive = boost::make_shared<BoundedValidator<double> >(); mustBePositive->setLower(0.0); - declareProperty("IncidentEnergyGuess", EMPTY_DBL(), mustBePositive, + this->declareProperty("IncidentEnergyGuess", EMPTY_DBL(), mustBePositive, "Set the value of the incident energy guess in meV."); - declareProperty("UseIncidentEnergyGuess", false, + this->declareProperty("UseIncidentEnergyGuess", false, "Use the incident energy guess as the actual value (will not be calculated)."); - declareProperty(new ArrayProperty<double>("EnergyTransferRange", + this->declareProperty(new ArrayProperty<double>("EnergyTransferRange", boost::make_shared<RebinParamsValidator>(true)), "A comma separated list of first bin boundary, width, last bin boundary.\n" "Negative width value indicates logarithmic binning."); - declareProperty("SofPhiEIsDistribution", true, + this->declareProperty("SofPhiEIsDistribution", true, "The final S(Phi, E) data is made to be a distribution."); - declareProperty("HardMaskFile", "", "A file or workspace containing a hard mask."); - declareProperty("GroupingFile", "", "A file containing grouping (mapping) information."); - declareProperty("FilterBadPulses", false, "If true, filter bad pulses from data."); + this->declareProperty("HardMaskFile", "", "A file or workspace containing a hard mask."); + this->declareProperty("GroupingFile", "", "A file containing grouping (mapping) information."); + + this->setPropertyGroup("SampleFile", sampleSetup); + this->setPropertyGroup("InputWorkspace", sampleSetup); + this->setPropertyGroup("IncidentEnergyGuess", sampleSetup); + this->setPropertyGroup("UseIncidentEnergyGuess", sampleSetup); + this->setPropertyGroup("EnergyTransferRange", sampleSetup); + this->setPropertyGroup("SofPhiEIsDistribution", sampleSetup); + this->setPropertyGroup("HardMaskFile", sampleSetup); + this->setPropertyGroup("GroupingFile", sampleSetup); + + // Data corrections + std::string dataCorr = "Data Corrections"; + this->declareProperty("FilterBadPulses", false, "If true, filter bad pulses from data."); std::vector<std::string> incidentBeamNormOptions; incidentBeamNormOptions.push_back("None"); incidentBeamNormOptions.push_back("ByCurrent"); incidentBeamNormOptions.push_back("ToMonitor"); - declareProperty("IncidentBeamNormalisation", "None", + this->declareProperty("IncidentBeamNormalisation", "None", boost::make_shared<StringListValidator>(incidentBeamNormOptions), "Options for incident beam normalisation on data."); - declareProperty("MonitorIntRangeLow", EMPTY_DBL(), + this->declareProperty("MonitorIntRangeLow", EMPTY_DBL(), "Set the lower bound for monitor integration."); - setPropertySettings("MonitorIntRangeLow", + this->setPropertySettings("MonitorIntRangeLow", new VisibleWhenProperty("IncidentBeamNormalisation", IS_EQUAL_TO, "ToMonitor")); - declareProperty("MonitorIntRangeHigh", EMPTY_DBL(), + this->declareProperty("MonitorIntRangeHigh", EMPTY_DBL(), "Set the upper bound for monitor integration."); - setPropertySettings("MonitorIntRangeHigh", + this->setPropertySettings("MonitorIntRangeHigh", new VisibleWhenProperty("IncidentBeamNormalisation", IS_EQUAL_TO, "ToMonitor")); - declareProperty("TimeIndepBackgroundSub", false, + this->declareProperty("TimeIndepBackgroundSub", false, "If true, time-independent background will be calculated and removed."); - declareProperty("TibTofRangeStart", EMPTY_DBL(), + this->declareProperty("TibTofRangeStart", EMPTY_DBL(), "Set the lower TOF bound for time-independent background subtraction."); - setPropertySettings("TibTofRangeStart", + this->setPropertySettings("TibTofRangeStart", new VisibleWhenProperty("TimeIndepBackgroundSub", IS_EQUAL_TO, "1")); - declareProperty("TibTofRangeEnd", EMPTY_DBL(), + this->declareProperty("TibTofRangeEnd", EMPTY_DBL(), "Set the upper TOF bound for time-independent background subtraction."); - setPropertySettings("TibTofRangeEnd", + this->setPropertySettings("TibTofRangeEnd", new VisibleWhenProperty("TimeIndepBackgroundSub", IS_EQUAL_TO, "1")); - declareProperty("DetectorVanadium", "", "Run numbers, files or workspaces of detector vanadium data."); - declareProperty("UseBoundsForDetVan", false, + this->declareProperty("DetectorVanadium", "", "Run numbers, files or workspaces of detector vanadium data."); + this->declareProperty("UseBoundsForDetVan", false, "If true, integrate the detector vanadium over a given range."); - declareProperty("DetVanIntRangeLow", EMPTY_DBL(), + this->declareProperty("DetVanIntRangeLow", EMPTY_DBL(), "Set the lower bound for integrating the detector vanadium."); - setPropertySettings("DetVanIntRangeLow", + this->setPropertySettings("DetVanIntRangeLow", new VisibleWhenProperty("UseBoundsForDetVan", IS_EQUAL_TO, "1")); - declareProperty("DetVanIntRangeHigh", EMPTY_DBL(), + this->declareProperty("DetVanIntRangeHigh", EMPTY_DBL(), "Set the upper bound for integrating the detector vanadium."); - setPropertySettings("DetVanIntRangeHigh", + this->setPropertySettings("DetVanIntRangeHigh", new VisibleWhenProperty("UseBoundsForDetVan", IS_EQUAL_TO, "1")); std::vector<std::string> detvanIntRangeUnits; detvanIntRangeUnits.push_back("Energy"); detvanIntRangeUnits.push_back("Wavelength"); - declareProperty("DetVanIntRangeUnits", "Energy", + this->declareProperty("DetVanIntRangeUnits", "Energy", boost::make_shared<StringListValidator>(detvanIntRangeUnits), "Options for the units on the detector vanadium integration."); - setPropertySettings("DetVanIntRangeUnits", + this->setPropertySettings("DetVanIntRangeUnits", new VisibleWhenProperty("UseBoundsForDetVan", IS_EQUAL_TO, "1")); - declareProperty("FindBadDetectors", false, + + this->setPropertyGroup("FilterBadPulses", dataCorr); + this->setPropertyGroup("IncidentBeamNormalisation", dataCorr); + this->setPropertyGroup("MonitorIntRangeLow", dataCorr); + this->setPropertyGroup("MonitorIntRangeHigh", dataCorr); + this->setPropertyGroup("TimeIndepBackgroundSub", dataCorr); + this->setPropertyGroup("TibTofRangeStart", dataCorr); + this->setPropertyGroup("TibTofRangeEnd", dataCorr); + this->setPropertyGroup("DetectorVanadium", dataCorr); + this->setPropertyGroup("UseBoundsForDetVan", dataCorr); + this->setPropertyGroup("DetVanIntRangeLow", dataCorr); + this->setPropertyGroup("DetVanIntRangeHigh", dataCorr); + this->setPropertyGroup("DetVanIntRangeUnits", dataCorr); + + // Finding bad detectors + std::string findBadDets = "Finding Bad Detectors"; + this->declareProperty("FindBadDetectors", false, "If true, run all of the detector diagnostics tests and create a mask."); - declareProperty("OutputMaskFile", "", + this->declareProperty("OutputMaskFile", "", "The output mask file name used for the results of the detector tests."); - setPropertySettings("OutputMaskFile", + this->setPropertySettings("OutputMaskFile", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - declareProperty("ErrorBarCriterion", 3.3, mustBePositive, + this->declareProperty("ErrorBarCriterion", 3.3, mustBePositive, "Some selection criteria for the detector tests."); - setPropertySettings("ErrorBarCriterion", + this->setPropertySettings("ErrorBarCriterion", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - declareProperty("DetectorVanadium1", "", + this->declareProperty("DetectorVanadium1", "", "The detector vanadium file to run the tests on."); - setPropertySettings("DetectorVanadium1", + this->setPropertySettings("DetectorVanadium1", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - declareProperty("HighCounts", 1.e+10, mustBePositive, + this->declareProperty("HighCounts", 1.e+10, mustBePositive, "Mask detectors above this threshold."); - setPropertySettings("HighCounts", + this->setPropertySettings("HighCounts", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - declareProperty("LowCounts", 1.e-10, mustBePositive, + this->declareProperty("LowCounts", 1.e-10, mustBePositive, "Mask detectors below this threshold."); - setPropertySettings("LowCounts", + this->setPropertySettings("LowCounts", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - declareProperty("MedianTestHigh", 3.0, mustBePositive, + this->declareProperty("MedianTestHigh", 3.0, mustBePositive, "Mask detectors above this threshold."); - setPropertySettings("MedianTestHigh", + this->setPropertySettings("MedianTestHigh", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - declareProperty("MedianTestLow", 0.1, mustBePositive, + this->declareProperty("MedianTestLow", 0.1, mustBePositive, "Mask detectors below this threshold."); - setPropertySettings("MedianTestLow", + this->setPropertySettings("MedianTestLow", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - declareProperty("DetectorVanadium2", "", + this->declareProperty("DetectorVanadium2", "", "The detector vanadium to check against for time variations."); - setPropertySettings("DetectorVanadium2", + this->setPropertySettings("DetectorVanadium2", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - declareProperty("ProptionalChangeCriterion", 1.1, mustBePositive, + this->declareProperty("ProptionalChangeCriterion", 1.1, mustBePositive, "Mask detectors if the time variation is above this threshold."); - setPropertySettings("ProptionalChangeCriterion", + this->setPropertySettings("ProptionalChangeCriterion", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - declareProperty("BackgroundCheck", false, + this->declareProperty("BackgroundCheck", false, "If true, run a background check on detector vanadium."); - setPropertySettings("BackgroundCheck", + this->setPropertySettings("BackgroundCheck", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - declareProperty("AcceptanceFactor", 5.0, mustBePositive, + this->declareProperty("AcceptanceFactor", 5.0, mustBePositive, "Mask detectors above this threshold."); - setPropertySettings("AcceptanceFactor", + this->setPropertySettings("AcceptanceFactor", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); auto mustBeIntPositive = boost::make_shared<BoundedValidator<size_t> >(); mustBeIntPositive->setLower(0); size_t tof_start = 18000; - declareProperty("BackgroundTofStart", tof_start, mustBeIntPositive, + this->declareProperty("BackgroundTofStart", tof_start, mustBeIntPositive, "Start TOF for the background check."); - setPropertySettings("BackgroundTofStart", + this->setPropertySettings("BackgroundTofStart", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); size_t tof_end = 19500; - declareProperty("BackgroundTofEnd", tof_end, mustBeIntPositive, + this->declareProperty("BackgroundTofEnd", tof_end, mustBeIntPositive, "End TOF for the background check."); - setPropertySettings("BackgroundTofEnd", + this->setPropertySettings("BackgroundTofEnd", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - declareProperty("RejectZeroBackground", true, + this->declareProperty("RejectZeroBackground", true, "If true, check the background region for anomolies."); - setPropertySettings("RejectZeroBackground", + this->setPropertySettings("RejectZeroBackground", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - setPropertySettings("RejectZeroBackground", + this->setPropertySettings("RejectZeroBackground", new VisibleWhenProperty("BackgroundCheck", IS_EQUAL_TO, "1")); - declareProperty("PsdBleed", false, "If true, perform a PSD bleed test."); - setPropertySettings("PsdBleed", + this->declareProperty("PsdBleed", false, "If true, perform a PSD bleed test."); + this->setPropertySettings("PsdBleed", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - declareProperty("MaxFramerate", "", "The maximum framerate to check."); - setPropertySettings("MaxFramerate", + this->declareProperty("MaxFramerate", "", "The maximum framerate to check."); + this->setPropertySettings("MaxFramerate", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - setPropertySettings("MaxFramerate", + this->setPropertySettings("MaxFramerate", new VisibleWhenProperty("PsdBleed", IS_EQUAL_TO, "1")); - declareProperty("IgnoredPixels", "", + this->declareProperty("IgnoredPixels", "", "A list of pixels to ignore in the calculations."); - setPropertySettings("IgnoredPixels", + this->setPropertySettings("IgnoredPixels", new VisibleWhenProperty("FindBadDetectors", IS_EQUAL_TO, "1")); - setPropertySettings("IgnoredPixels", + this->setPropertySettings("IgnoredPixels", new VisibleWhenProperty("PsdBleed", IS_EQUAL_TO, "1")); - declareProperty("DoAbsoluteUnits", false, + + this->setPropertyGroup("FindBadDetectors", findBadDets); + this->setPropertyGroup("OutputMaskFile", findBadDets); + this->setPropertyGroup("ErrorBarCriterion", findBadDets); + this->setPropertyGroup("DetectorVanadium1", findBadDets); + this->setPropertyGroup("HighCounts", findBadDets); + this->setPropertyGroup("LowCounts", findBadDets); + this->setPropertyGroup("MedianTestHigh", findBadDets); + this->setPropertyGroup("MedianTestLow", findBadDets); + this->setPropertyGroup("DetectorVanadium2", findBadDets); + this->setPropertyGroup("ProptionalChangeCriterion", findBadDets); + this->setPropertyGroup("BackgroundCheck", findBadDets); + this->setPropertyGroup("AcceptanceFactor", findBadDets); + this->setPropertyGroup("BackgroundTofStart", findBadDets); + this->setPropertyGroup("BackgroundTofEnd", findBadDets); + this->setPropertyGroup("RejectZeroBackground", findBadDets); + this->setPropertyGroup("PsdBleed", findBadDets); + this->setPropertyGroup("MaxFramerate", findBadDets); + this->setPropertyGroup("IgnoredPixels", findBadDets); + + // Absolute units correction + std::string absUnitsCorr = "Absolute Units Correction"; + this->declareProperty("DoAbsoluteUnits", false, "If true, perform an absolute units normalisation."); - declareProperty("AbsUnitsVanadium" "", + this->declareProperty("AbsUnitsVanadium" "", "The vanadium file used as the sample in the absolute units normalisation."); - setPropertySettings("AbsUnitsVanadium", + this->setPropertySettings("AbsUnitsVanadium", new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); - declareProperty("AbsUnitsGroupingFile", "", + this->declareProperty("AbsUnitsGroupingFile", "", "Grouping file for absolute units normalisation."); - setPropertySettings("AbsUnitsGroupingFile", + this->setPropertySettings("AbsUnitsGroupingFile", new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); - declareProperty("AbsUnitsDetectorVanadium", "", + this->declareProperty("AbsUnitsDetectorVanadium", "", "The detector vanadium file used in the absolute units normalisation."); - setPropertySettings("AbsUnitsDetectorVanadium", + this->setPropertySettings("AbsUnitsDetectorVanadium", new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); - declareProperty("AbsUnitsIncidentEnergy", EMPTY_DBL(), mustBePositive, + this->declareProperty("AbsUnitsIncidentEnergy", EMPTY_DBL(), mustBePositive, "The incident energy for the vanadium sample."); - setPropertySettings("AbsUnitsIncidentEnergy", + this->setPropertySettings("AbsUnitsIncidentEnergy", new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); - declareProperty("AbsUnitsMinimumEnergy", -1.0, + this->declareProperty("AbsUnitsMinimumEnergy", -1.0, "The minimum energy for the integration range."); - setPropertySettings("AbsUnitsMinimumEnergy", + this->setPropertySettings("AbsUnitsMinimumEnergy", new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); - declareProperty("AbsUnitsMaximumEnergy", 1.0, + this->declareProperty("AbsUnitsMaximumEnergy", 1.0, "The maximum energy for the integration range."); - setPropertySettings("AbsUnitsMaximumEnergy", + this->setPropertySettings("AbsUnitsMaximumEnergy", new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); - declareProperty("VanadiumMass", 32.58, "The mass of vanadium."); - setPropertySettings("VanadiumMass", + this->declareProperty("VanadiumMass", 32.58, "The mass of vanadium."); + this->setPropertySettings("VanadiumMass", new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); - declareProperty("SampleMass", 1.0, "The mass of sample."); - setPropertySettings("SampleMass", + this->declareProperty("SampleMass", 1.0, "The mass of sample."); + this->setPropertySettings("SampleMass", new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); - declareProperty("SampleRmm", 1.0, "The rmm of sample."); - setPropertySettings("SampleRmm", + this->declareProperty("SampleRmm", 1.0, "The rmm of sample."); + this->setPropertySettings("SampleRmm", new VisibleWhenProperty("DoAbsoluteUnits", IS_EQUAL_TO, "1")); - declareProperty("ReductionProperties", "__dgs_reduction_properties", - Direction::Input); + + this->setPropertyGroup("DoAbsoluteUnits", absUnitsCorr); + this->setPropertyGroup("AbsUnitsVanadium", absUnitsCorr); + this->setPropertyGroup("AbsUnitsGroupingFile", absUnitsCorr); + this->setPropertyGroup("AbsUnitsDetectorVanadium", absUnitsCorr); + this->setPropertyGroup("AbsUnitsIncidentEnergy", absUnitsCorr); + this->setPropertyGroup("AbsUnitsMinimumEnergy", absUnitsCorr); + this->setPropertyGroup("AbsUnitsMaximumEnergy", absUnitsCorr); + this->setPropertyGroup("VanadiumMass", absUnitsCorr); + this->setPropertyGroup("SampleMass", absUnitsCorr); + this->setPropertyGroup("SampleRmm", absUnitsCorr); + + this->declareProperty("ReductionProperties", "__dgs_reduction_properties", + Direction::Output); } /**