30 , m_axes(other.m_axes)
31 , m_detection_properties(other.m_detection_properties)
60 throw std::runtime_error(
"Error in IDetector::getAxis: not so many axes in this detector.");
66 size_t remainder(index);
68 for (
size_t i = 0; i < dim; ++i) {
70 if (selected_axis == i_axis)
71 return remainder %
m_axes[i_axis]->size();
72 remainder /=
m_axes[i_axis]->size();
74 throw std::runtime_error(
"IDetector::getAxisBinIndex() -> "
75 "Error! No axis with given number");
82 throw std::runtime_error(
"IDetector::createAxis() -> Error! max <= min");
84 throw std::runtime_error(
"IDetector::createAxis() -> Error! Number n_bins can't be zero.");
85 return std::make_unique<FixedBinAxis>(
axisName(index), n_bins, min, max);
94 for (
size_t i_axis = 0; i_axis < dim; ++i_axis)
95 result *=
m_axes[i_axis]->size();
100 double total_transmission)
120 if (!p_intensity_map)
121 throw std::runtime_error(
"IDetector::applyDetectorResolution() -> "
122 "Error! Null pointer to intensity map");
128 buff->copyShapeFrom(*p_intensity_map);
148 throw std::runtime_error(
"Instrument::createDetectorIntensity:"
149 "can't create detector map.");
155 return detectorMap.release();
162 throw std::runtime_error(
163 "Error in IDetector::createDetectorMap: dimensions of the detector are undefined");
166 for (
size_t i = 0; i < dim; ++i)
168 result->addAxis(*roi->clipAxisToRoi(i,
axis(i)));
170 result->addAxis(
axis(i));
176 const std::vector<SimulationElement>& elements)
const
178 if (elements.empty())
Defines class ConvolutionDetectorResolution.
Defines class DetectorMask.
Defines common detector interface.
Defines class RegionOfInterest.
Defines class SimulationArea.
Defines class SimulationElement.
Convolutes the intensity in 1 or 2 dimensions with a resolution function.
void setAnalyzerProperties(const kvector_t direction, double efficiency, double total_transmission)
Sets the polarization analyzer characteristics of the detector.
Interface for one-dimensional axes.
virtual IAxis * clone() const =0
clone function
Interface for polymorphic classes that should not be copied, except by explicit cloning.
Interface for detector resolution algorithms.
virtual IDetectorResolution * clone() const =0
Abstract detector interface.
void setDataToDetectorMap(OutputData< double > &detectorMap, const std::vector< SimulationElement > &elements) const
void applyDetectorResolution(OutputData< double > *p_intensity_map) const
Applies the detector resolution to the given intensity maps.
virtual std::string axisName(size_t index) const =0
Returns the name for the axis with given index.
virtual const DetectorMask * detectorMask() const =0
Returns detector masks container.
size_t dimension() const
Returns actual dimensionality of the detector (number of defined axes)
size_t axisBinIndex(size_t index, size_t selected_axis) const
Calculate axis index for given global index.
virtual std::unique_ptr< IAxis > createAxis(size_t index, size_t n_bins, double min, double max) const
Generates an axis with correct name and default binning for given index.
std::vector< const INode * > getChildren() const override
Returns a vector of children.
size_t totalSize() const
Returns total number of pixels.
size_t numberOfSimulationElements() const
Returns number of simulation elements.
std::unique_ptr< IDetectorResolution > m_detector_resolution
const IAxis & axis(size_t index) const
void setResolutionFunction(const IResolutionFunction2D &resFunc)
DetectionProperties m_detection_properties
CloneableVector< IAxis > m_axes
void setAnalyzerProperties(const kvector_t direction, double efficiency, double total_transmission)
Sets the polarization analyzer characteristics of the detector.
void addAxis(const IAxis &axis)
OutputData< double > * createDetectorIntensity(const std::vector< SimulationElement > &elements) const
Returns new intensity map with detector resolution applied.
void setDetectorResolution(const IDetectorResolution &p_detector_resolution)
Sets the detector resolution.
std::unique_ptr< OutputData< double > > createDetectorMap() const
Returns empty detector map in given axes units.
void iterate(std::function< void(const_iterator)> func, bool visit_masks=false) const
const IDetectorResolution * detectorResolution() const
Returns a pointer to detector resolution object.
virtual const RegionOfInterest * regionOfInterest() const =0
Returns region of interest if exists.
Base class for tree-like structures containing parameterized objects.
void registerChild(INode *node)
const std::string & getName() const
void setName(const std::string &name)
Interface providing two-dimensional resolution function.
void setRawDataVector(const std::vector< T > &data_vector)
Sets new values to raw data vector.
An iterator for SimulationArea.
size_t elementIndex() const
Holds iteration logic over active detector channels in the presence of masked areas and RegionOfInter...
SimulationAreaIterator begin()
SimulationAreaIterator end()
Holds iteration logic over active detector channels in the presence of ROI.