Skip to content
Snippets Groups Projects
Commit a616eec7 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

getDetectorIntensity is moved on board of IDetector2D for the following ROI handling

parent 854fa075
No related branches found
No related tags found
No related merge requests found
......@@ -113,6 +113,27 @@ std::string IDetector2D::addParametersToExternalPool(
return new_path;
}
OutputData<double> *IDetector2D::getDetectorIntensity(const OutputData<double> &data,
const Beam& beam,
IDetector2D::EAxesUnits units_type) const
{
std::unique_ptr<OutputData<double> > result (data.clone());
applyDetectorResolution(result.get());
if(units_type == IDetector2D::DEFAULT) {
return result.release();
}
OutputData<double>* detectorMap = createDetectorMap(beam, units_type);
if(!detectorMap)
throw Exceptions::RuntimeErrorException("Instrument::getDetectorIntensity() -> Error."
"Can't create detector map.");
detectorMap->setRawDataVector(result->getRawDataVector());
return detectorMap;
}
OutputData<double>* IDetector2D::createDetectorMap(const Beam& beam, EAxesUnits units) const
{
std::unique_ptr<OutputData<double>> result(new OutputData<double>);
......
......@@ -127,6 +127,12 @@ public:
virtual std::string addParametersToExternalPool(
const std::string& path, ParameterPool* external_pool, int copy_number = -1) const;
//! Returns clone of the intensity map with detector resolution applied,
//! axes of map will be in requested units
OutputData<double>* getDetectorIntensity(
const OutputData<double>& data, const Beam& beam,
IDetector2D::EAxesUnits units_type=IDetector2D::DEFAULT) const;
//! Returns detector map in given axes units
virtual OutputData<double>* createDetectorMap(const Beam& beam, EAxesUnits units) const;
......
......@@ -122,19 +122,7 @@ void Instrument::applyDetectorResolution(OutputData<double>* p_intensity_map) co
OutputData<double>* Instrument::getDetectorIntensity(
const OutputData<double> &data, IDetector2D::EAxesUnits units_type) const
{
std::unique_ptr<OutputData<double> > result (data.clone());
applyDetectorResolution(result.get());
if(units_type == IDetector2D::DEFAULT) {
return result.release();
} else {
OutputData<double>* detectorMap = mP_detector->createDetectorMap(m_beam, units_type);
if(!detectorMap)
throw Exceptions::RuntimeErrorException("Instrument::getDetectorIntensity() -> Error."
"Can't create detector map.");
detectorMap->setRawDataVector(result->getRawDataVector());
return detectorMap;
}
return mP_detector->getDetectorIntensity(data, m_beam, units_type);
}
void Instrument::print(std::ostream& ostr) const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment