BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Instrument.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Device/Instrument/Instrument.h
6 //! @brief Defines class Instrument.
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_INSTRUMENT_INSTRUMENT_H
21 #define BORNAGAIN_DEVICE_INSTRUMENT_INSTRUMENT_H
22 
23 #include "Device/Beam/Beam.h"
24 #include <memory>
25 
26 class IDetector;
27 class IDetector2D;
28 
29 //! Assembles beam, detector and their relative positions with respect to the sample.
30 //! @ingroup simulation_internal
31 
32 class Instrument : public INode {
33 public:
34  Instrument();
35  Instrument(const Beam& beam, const IDetector& detector);
36  Instrument(const Instrument& other);
37  Instrument& operator=(const Instrument& other);
38 
39  virtual ~Instrument();
40 
41  void accept(INodeVisitor* visitor) const final { visitor->visit(this); }
42 
43  Beam& beam() { return m_beam; }
44  const Beam& beam() const { return m_beam; }
45  void setBeam(const Beam& beam);
46 
47  //! Sets the beam wavelength and incoming angles
48  void setBeamParameters(double wavelength, double alpha_i, double phi_i);
49 
51  const IDetector* getDetector() const;
53  const IDetector& detector() const;
54 
55  //! Sets the detector (axes can be overwritten later)
56  void setDetector(const IDetector& detector);
57 
58  //! init detector with beam settings
59  void initDetector();
60 
61  std::vector<const INode*> getChildren() const;
62 
63 protected:
65  std::unique_ptr<IDetector> m_detector;
66 };
67 
68 #endif // BORNAGAIN_DEVICE_INSTRUMENT_INSTRUMENT_H
69 #endif // USER_API
Defines class Beam.
An incident neutron or x-ray beam.
Definition: Beam.h:27
Abstract 2D detector interface.
Definition: IDetector2D.h:31
Abstract detector interface.
Definition: IDetector.h:36
Visitor interface to visit ISampleNode objects.
Definition: INodeVisitor.h:146
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49
Assembles beam, detector and their relative positions with respect to the sample.
Definition: Instrument.h:32
IDetector * getDetector()
Definition: Instrument.cpp:96
virtual ~Instrument()
void setBeamParameters(double wavelength, double alpha_i, double phi_i)
Sets the beam wavelength and incoming angles.
Definition: Instrument.cpp:76
void setDetector(const IDetector &detector)
Sets the detector (axes can be overwritten later)
Definition: Instrument.cpp:52
void accept(INodeVisitor *visitor) const final
Calls the INodeVisitor's visit method.
Definition: Instrument.h:41
IDetector & detector()
Definition: Instrument.cpp:107
void initDetector()
init detector with beam settings
Definition: Instrument.cpp:59
std::vector< const INode * > getChildren() const
Returns a vector of children.
Definition: Instrument.cpp:67
Beam & beam()
Definition: Instrument.h:43
void setBeam(const Beam &beam)
Definition: Instrument.cpp:84
const Beam & beam() const
Definition: Instrument.h:44
Instrument & operator=(const Instrument &other)
Definition: Instrument.cpp:41
std::unique_ptr< IDetector > m_detector
Definition: Instrument.h:65
Beam m_beam
Definition: Instrument.h:64