BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ConvolutionDetectorResolution.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Device/Resolution/ConvolutionDetectorResolution.h
6 //! @brief Defines class ConvolutionDetectorResolution.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
15 #ifndef BORNAGAIN_CORE_DETECTOR_CONVOLUTIONDETECTORRESOLUTION_H
16 #define BORNAGAIN_CORE_DETECTOR_CONVOLUTIONDETECTORRESOLUTION_H
17 
20 
21 //! Convolutes the intensity in 1 or 2 dimensions with a resolution function.
22 //! @ingroup detector
23 
24 //! Limitation: this class assumes that the data points are evenly distributed on each axis
25 
27 {
28 public:
29  typedef double (*cumulative_DF_1d)(double);
30 
31  //! Constructor taking a 1 dimensional resolution function as argument.
33 
34  //! Constructor taking a 2 dimensional resolution function as argument.
35  ConvolutionDetectorResolution(const IResolutionFunction2D& p_res_function_2d);
36 
38 
39  //! Convolve given intensities with the encapsulated resolution.
40  virtual void applyDetectorResolution(OutputData<double>* p_intensity_map) const;
41 
42  virtual ConvolutionDetectorResolution* clone() const;
43 
44  void accept(INodeVisitor* visitor) const final { visitor->visit(this); }
45 
47 
48  std::vector<const INode*> getChildren() const;
49 
50 protected:
52 
53 private:
54  void setResolutionFunction(const IResolutionFunction2D& resFunc);
55  void apply1dConvolution(OutputData<double>* p_intensity_map) const;
56  void apply2dConvolution(OutputData<double>* p_intensity_map) const;
57  double getIntegratedPDF1d(double x, double step) const;
58  double getIntegratedPDF2d(double x, double step_x, double y, double step_y) const;
59 
60  size_t m_dimension;
62  std::unique_ptr<IResolutionFunction2D> mp_res_function_2d;
63 };
64 
66 {
67  return mp_res_function_2d.get();
68 }
69 
70 #endif // BORNAGAIN_CORE_DETECTOR_CONVOLUTIONDETECTORRESOLUTION_H
Defines class IDetectorResolution.
Defines interface class IResolutionFunction2D.
Convolutes the intensity in 1 or 2 dimensions with a resolution function.
void accept(INodeVisitor *visitor) const final
Calls the INodeVisitor's visit method.
double getIntegratedPDF1d(double x, double step) const
void setResolutionFunction(const IResolutionFunction2D &resFunc)
const IResolutionFunction2D * getResolutionFunction2D() const
void apply1dConvolution(OutputData< double > *p_intensity_map) const
std::unique_ptr< IResolutionFunction2D > mp_res_function_2d
void apply2dConvolution(OutputData< double > *p_intensity_map) const
ConvolutionDetectorResolution(cumulative_DF_1d res_function_1d)
Constructor taking a 1 dimensional resolution function as argument.
virtual ConvolutionDetectorResolution * clone() const
virtual void applyDetectorResolution(OutputData< double > *p_intensity_map) const
Convolve given intensities with the encapsulated resolution.
std::vector< const INode * > getChildren() const
Returns a vector of children (const).
double getIntegratedPDF2d(double x, double step_x, double y, double step_y) const
Interface for detector resolution algorithms.
Visitor interface to visit ISample objects.
Definition: INodeVisitor.h:149
Interface providing two-dimensional resolution function.