BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SphericalDetector.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Device/Detector/SphericalDetector.h
6 //! @brief Defines class SphericalDetector.
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_DEVICE_DETECTOR_SPHERICALDETECTOR_H
16 #define BORNAGAIN_DEVICE_DETECTOR_SPHERICALDETECTOR_H
17 
19 
20 class IPixel;
21 class SphericalPixel;
22 
23 //! A detector with coordinate axes along angles phi and alpha.
24 //! @ingroup detector
25 
27 public:
29 
30  //! Returns a detector with given phi and alpha axes.
31  //! @param n_phi number of phi-axis bins
32  //! @param phi_min low edge of first phi-bin
33  //! @param phi_max upper edge of last phi-bin
34  //! @param n_alpha number of alpha-axis bins
35  //! @param alpha_min low edge of first alpha-bin
36  //! @param alpha_max upper edge of last alpha-bin
37  SphericalDetector(size_t n_phi, double phi_min, double phi_max, size_t n_alpha,
38  double alpha_min, double alpha_max);
39 
40  //! Returns a detector with phi and alpha axes that have equal width and binning.
41  //! @param n_bin number of bins per direction
42  //! @param width full width of angular range in phi or alpha
43  //! @param phi central phi angle
44  //! @param alpha central alpha angle
45  SphericalDetector(size_t n_bin, double width, double phi, double alpha);
46 
48 
49  SphericalDetector* clone() const override;
50 
51  void accept(INodeVisitor* visitor) const override { visitor->visit(this); }
52 
53  ~SphericalDetector() override {}
54 
55  //! return default axes units
56  Axes::Units defaultAxesUnits() const override;
57 
58 protected:
59  //! Creates an IPixel for the given OutputData object and index
60  IPixel* createPixel(size_t index) const override;
61 
62  //! Returns the name for the axis with given index
63  std::string axisName(size_t index) const override;
64 
65  //! Returns index of pixel that contains the specular wavevector.
66  //! If no pixel contains this specular wavevector, the number of pixels is
67  //! returned. This corresponds to an overflow index.
68  size_t indexOfSpecular(const Beam& beam) const override;
69 };
70 
71 #endif // BORNAGAIN_DEVICE_DETECTOR_SPHERICALDETECTOR_H
Defines interface IDetector2D.
An incident neutron or x-ray beam.
Definition: Beam.h:27
Abstract 2D detector interface.
Definition: IDetector2D.h:31
Visitor interface to visit ISampleNode objects.
Definition: INodeVisitor.h:146
virtual void visit(const BasicLattice2D *)
Definition: INodeVisitor.h:151
Interface for a function that maps [0,1]x[0,1] to the kvectors in a pixel.
Definition: IPixel.h:25
A detector with coordinate axes along angles phi and alpha.
void accept(INodeVisitor *visitor) const override
Calls the INodeVisitor's visit method.
std::string axisName(size_t index) const override
Returns the name for the axis with given index.
size_t indexOfSpecular(const Beam &beam) const override
Returns index of pixel that contains the specular wavevector.
~SphericalDetector() override
IPixel * createPixel(size_t index) const override
Creates an IPixel for the given OutputData object and index.
Axes::Units defaultAxesUnits() const override
return default axes units
SphericalDetector * clone() const override
A pixel in a SphericalDetector.