BornAgain  1.19.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 reflection and scattering
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 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_DEVICE_RESOLUTION_CONVOLUTIONDETECTORRESOLUTION_H
21 #define BORNAGAIN_DEVICE_RESOLUTION_CONVOLUTIONDETECTORRESOLUTION_H
22 
25 
26 //! Convolutes the intensity in 1 or 2 dimensions with a resolution function.
27 //! @ingroup detector
28 
29 //! Limitation: this class assumes that the data points are evenly distributed on each axis
30 
32 public:
33  typedef double (*cumulative_DF_1d)(double);
34 
35  //! Constructor taking a 1 dimensional resolution function as argument.
37 
38  //! Constructor taking a 2 dimensional resolution function as argument.
39  ConvolutionDetectorResolution(const IResolutionFunction2D& p_res_function_2d);
40 
42 
43  //! Convolve given intensities with the encapsulated resolution.
44  virtual void applyDetectorResolution(OutputData<double>* p_intensity_map) const;
45 
46  virtual ConvolutionDetectorResolution* clone() const;
47 
48  void accept(INodeVisitor* visitor) const final { visitor->visit(this); }
49 
51 
52  std::vector<const INode*> getChildren() const;
53 
54 protected:
56 
57 private:
58  void setResolutionFunction(const IResolutionFunction2D& resFunc);
59  void apply1dConvolution(OutputData<double>* p_intensity_map) const;
60  void apply2dConvolution(OutputData<double>* p_intensity_map) const;
61  double getIntegratedPDF1d(double x, double step) const;
62  double getIntegratedPDF2d(double x, double step_x, double y, double step_y) const;
63 
64  size_t m_dimension;
66  std::unique_ptr<IResolutionFunction2D> m_res_function_2d;
67 };
68 
70 {
71  return m_res_function_2d.get();
72 }
73 
74 #endif // BORNAGAIN_DEVICE_RESOLUTION_CONVOLUTIONDETECTORRESOLUTION_H
75 #endif // USER_API
Defines interface 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 > m_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.
double getIntegratedPDF2d(double x, double step_x, double y, double step_y) const
Interface for detector resolution algorithms.
Visitor interface to visit ISampleNode objects.
Definition: INodeVisitor.h:146
Interface providing two-dimensional resolution function.