BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
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 
22 //! A detector with coordinate axes along angles phi and alpha.
23 //! @ingroup detector
24 
25 class SphericalDetector : public IDetector {
26 public:
27  SphericalDetector() = default;
28 
29  //! Returns a detector with given phi and alpha axes.
30  //! @param n_phi number of phi-axis bins
31  //! @param phi_min low edge of first phi-bin
32  //! @param phi_max upper edge of last phi-bin
33  //! @param n_alpha number of alpha-axis bins
34  //! @param alpha_min low edge of first alpha-bin
35  //! @param alpha_max upper edge of last alpha-bin
36  SphericalDetector(size_t n_phi, double phi_min, double phi_max, size_t n_alpha,
37  double alpha_min, double alpha_max);
38 
39  //! Returns a detector with phi and alpha axes that have equal width and binning.
40  //! @param n_bin number of bins per direction
41  //! @param width full width of angular range in phi or alpha
42  //! @param phi central phi angle
43  //! @param alpha central alpha angle
44  SphericalDetector(size_t n_bin, double width, double phi, double alpha);
45 
47  ~SphericalDetector() override = default;
48 
49  SphericalDetector* clone() const override;
50  std::string className() const override { return "SphericalDetector"; }
51 
52  //! Returns default axes units
53  Coords defaultCoords() const override { return Coords::RADIANS; }
54 
55  ICoordSystem* offspecCoords(IAxis* beamAxis, const Direction& beamDirection) const override;
56  CoordSystem2D* scatteringCoords(const Beam& beam) const override;
57 
58 private:
59  //! Creates an IPixel for the given Datafield 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 common detector interface.
An incident neutron or x-ray beam.
Definition: Beam.h:28
Interface for objects that provide axis translations to different units for IDetector objects.
Definition: CoordSystem2D.h:32
A direction in three-dimensional space.
Definition: Direction.h:24
Abstract base class for one-dimensional axes.
Definition: IAxis.h:27
Interface to provide axis translations to different units for simulation output.
Definition: ICoordSystem.h:40
Abstract detector interface.
Definition: IDetector.h:57
Interface for a function that maps [0,1]x[0,1] to the kvectors in a pixel. Abstract base class for Sp...
Definition: IPixel.h:29
A detector with coordinate axes along angles phi and alpha.
~SphericalDetector() override=default
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. If no pixel contains this specular wave...
IPixel * createPixel(size_t index) const override
Creates an IPixel for the given Datafield object and index.
SphericalDetector(const SphericalDetector &other)
Coords defaultCoords() const override
Returns default axes units.
std::string className() const override
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
SphericalDetector()=default
SphericalDetector * clone() const override
ICoordSystem * offspecCoords(IAxis *beamAxis, const Direction &beamDirection) const override
CoordSystem2D * scatteringCoords(const Beam &beam) const override
Coords
Definition: Tags.h:20