42 "The absolute units sample workspace.");
45 "A monitor workspace associated with the absolute "
46 "units sample workspace");
49 "An absolute units detector vanadium workspace.");
52 "A monitor workspace associated with the absolute units detector "
53 "vanadium workspace.");
56 "A masking workspace to apply to the data.");
59 "A grouping workspace for the absolute units data.");
62 "The integrated absolute units workspace.");
64 "The diagnostic mask from the absolute units workspace");
71 g_log.
notice() <<
"Starting DgsAbsoluteUnitsReduction\n";
73 const std::string reductionManagerName = this->
getProperty(
"ReductionProperties");
74 std::shared_ptr<PropertyManager> reductionManager;
78 throw std::runtime_error(
"DgsAbsoluteUnitsReduction cannot run without a "
79 "reduction PropertyManager.");
94 detVan->setProperty(
"InputWorkspace", absDetVanWS);
95 detVan->setProperty(
"InputMonitorWorkspace", absDetVanMonWS);
96 detVan->setProperty(
"ReductionProperties", reductionManagerName);
98 detVan->setProperty(
"MaskWorkspace", maskWS);
100 detVan->executeAsChildAlg();
101 absIdetVanWS = detVan->getProperty(
"OutputWorkspace");
103 absIdetVanWS = absDetVanWS;
106 const std::string absWsName = absSampleWS->getName() +
"_absunits";
108 etConv->setProperty(
"InputWorkspace", absSampleWS);
109 etConv->setProperty(
"InputMonitorWorkspace", absSampleMonWS);
110 etConv->setProperty(
"OutputWorkspace", absWsName);
111 const double ei = reductionManager->getProperty(
"AbsUnitsIncidentEnergy");
112 etConv->setProperty(
"IncidentEnergyGuess", ei);
113 etConv->setProperty(
"IntegratedDetectorVanadium", absIdetVanWS);
114 etConv->setProperty(
"ReductionProperties", reductionManagerName);
116 etConv->setProperty(
"MaskWorkspace", maskWS);
119 etConv->setProperty(
"GroupingWorkspace", absGroupingWS);
121 etConv->setProperty(
"AlternateGroupingTag",
"AbsUnits");
122 etConv->executeAsChildAlg();
125 const double vanadiumMass =
getDblPropOrParam(
"VanadiumMass", reductionManager,
"vanadium-mass", outputWS);
129 const double vanadiumRmm = vanadium.
mass;
131 outputWS /= (vanadiumMass / vanadiumRmm);
134 double eMin =
getDblPropOrParam(
"AbsUnitsMinimumEnergy", reductionManager,
"monovan-integr-min", outputWS);
135 double eMax =
getDblPropOrParam(
"AbsUnitsMaximumEnergy", reductionManager,
"monovan-integr-max", outputWS);
137 std::vector<double> params{eMin, eMax - eMin, eMax};
140 rebin->setProperty(
"InputWorkspace", outputWS);
141 rebin->setProperty(
"OutputWorkspace", outputWS);
142 rebin->setProperty(
"Params", params);
143 rebin->executeAsChildAlg();
144 outputWS = rebin->getProperty(
"OutputWorkspace");
147 cToMWs->setProperty(
"InputWorkspace", outputWS);
148 cToMWs->setProperty(
"OutputWorkspace", outputWS);
149 outputWS = cToMWs->getProperty(
"OutputWorkspace");
152 const double huge =
getDblPropOrParam(
"HighCounts", reductionManager,
"diag_huge", outputWS);
153 const double tiny =
getDblPropOrParam(
"LowCounts", reductionManager,
"diag_tiny", outputWS);
154 const double vanOutLo =
getDblPropOrParam(
"AbsUnitsLowOutlier", reductionManager,
"monovan_lo_bound", outputWS);
155 const double vanOutHi =
getDblPropOrParam(
"AbsUnitsHighOutlier", reductionManager,
"monovan_hi_bound", outputWS);
156 const double vanLo =
getDblPropOrParam(
"AbsUnitsMedianTestLow", reductionManager,
"monovan_lo_frac", outputWS);
157 const double vanHi =
getDblPropOrParam(
"AbsUnitsMedianTestHigh", reductionManager,
"monovan_hi_frac", outputWS);
158 const double vanSigma =
getDblPropOrParam(
"AbsUnitsErrorBarCriterion", reductionManager,
"diag_samp_sig", outputWS);
161 diag->setProperty(
"InputWorkspace", outputWS);
162 diag->setProperty(
"OutputWorkspace",
"absUnitsDiagMask");
163 diag->setProperty(
"LowThreshold", tiny);
164 diag->setProperty(
"HighThreshold", huge);
165 diag->setProperty(
"LowOutlier", vanOutLo);
166 diag->setProperty(
"HighOutlier", vanOutHi);
167 diag->setProperty(
"LowThresholdFraction", vanLo);
168 diag->setProperty(
"HighThresholdFraction", vanHi);
169 diag->setProperty(
"SignificanceTest", vanSigma);
170 diag->executeAsChildAlg();
174 mask->setProperty(
"Workspace", outputWS);
175 mask->setProperty(
"MaskedWorkspace", absMaskWS);
176 mask->executeAsChildAlg();
177 outputWS = mask->getProperty(
"Workspace");
180 cFrmDist->setProperty(
"Workspace", outputWS);
181 cFrmDist->executeAsChildAlg();
182 outputWS = cFrmDist->getProperty(
"Workspace");
185 wMean->setProperty(
"InputWorkspace", outputWS);
186 wMean->setProperty(
"OutputWorkspace", outputWS);
187 wMean->executeAsChildAlg();
188 outputWS = wMean->getProperty(
"OutputWorkspace");
196 outputWS /= xsection;
197 const double sampleMass = reductionManager->getProperty(
"SampleMass");
198 const double sampleRmm = reductionManager->getProperty(
"SampleRmm");
199 outputWS *= (sampleMass / sampleRmm);
202 this->
setProperty(
"OutputMaskWorkspace", absMaskWS);
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
A property class for workspaces.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void notice(const std::string &msg)
Logs at notice level.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
Struture to hold the common information for an atom.
const uint16_t z_number
The atomic number, or number of protons, for the atom.
const double mass
The atomic mass in units of 'u' (=1g/mol/Na).
DgsAbsoluteUnitsReduction : This is the algorithm responsible for processing and creating the absolut...
int version() const override
Algorithm's version for identification.
void init() override
Initialize the algorithm's properties.
const std::string category() const override
Algorithm's category for identification.
void exec() override
Execute the algorithm.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
A namespace containing physical constants that are required by algorithms and unit routines.
MANTID_KERNEL_DLL const Atom & getAtom(const uint16_t z_number, const uint16_t a_number=0)
MANTID_KERNEL_DLL NeutronAtom getNeutronAtom(const uint16_t z_number, const uint16_t a_number=0)
Retrieve a copy of NeutronAtom.
double getDblPropOrParam(const std::string &pmProp, Mantid::Kernel::PropertyManager_sptr &pm, const std::string &instParam, Mantid::API::MatrixWorkspace_sptr &ws, const double overrideValue=Mantid::EMPTY_DBL())
Function to get double property or instrument parameter value.
@ Input
An input workspace.
@ Output
An output workspace.
Structure to store neutronic scattering information for the various elements.
double inc_scatt_xs
The incoherent scattering cross section in barns.
double coh_scatt_xs
The coherent scattering cross section in barns.