BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
DetectorItems.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Models/DetectorItems.h
6 //! @brief Defines classes DetectorItems
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_GUI_COREGUI_MODELS_DETECTORITEMS_H
16 #define BORNAGAIN_GUI_COREGUI_MODELS_DETECTORITEMS_H
17 
19 
20 class MaskContainerItem;
21 class IDetector2D;
23 class DetectorItem;
24 
25 class BA_CORE_API_ DetectorItem : public SessionItem {
26 public:
27  static const QString T_MASKS;
28  static const QString P_RESOLUTION_FUNCTION;
29  static const QString P_ANALYZER_DIRECTION;
30  static const QString P_ANALYZER_EFFICIENCY;
31  static const QString P_ANALYZER_TOTAL_TRANSMISSION;
32  explicit DetectorItem(const QString& modelType);
33 
34  std::unique_ptr<IDetector2D> createDetector() const;
35 
36  // TODO: consider using index-based access functions
37 
38  //! returns the size of x-axis of the detector
39  virtual int xSize() const = 0;
40 
41  //! returns the size of y-axis of the detector
42  virtual int ySize() const = 0;
43 
44  //! sets the size of x-axis of the detector
45  virtual void setXSize(int nx) = 0;
46 
47  //! sets the size of y-axis of the detector
48  virtual void setYSize(int ny) = 0;
49 
50  void clearMasks();
51 
52  MaskContainerItem* maskContainerItem() const;
53 
54  void createMaskContainer();
55 
56  void importMasks(const MaskContainerItem* maskContainer);
57 
58 protected:
59  void register_resolution_function();
60  void update_resolution_function_tooltips();
61 
62  virtual std::unique_ptr<IDetector2D> createDomainDetector() const = 0;
63  std::unique_ptr<IResolutionFunction2D> createResolutionFunction() const;
64 
65  //! Scales the values provided by axes (to perform deg->rad conversion on the way to domain).
66  virtual double axesToDomainUnitsFactor() const { return 1.0; }
67 
68  void addMasksToDomain(IDetector2D* detector) const;
69 };
70 
71 #endif // BORNAGAIN_GUI_COREGUI_MODELS_DETECTORITEMS_H
Defines class SessionItem.
virtual void setXSize(int nx)=0
sets the size of x-axis of the detector
virtual int xSize() const =0
returns the size of x-axis of the detector
static const QString P_ANALYZER_EFFICIENCY
Definition: DetectorItems.h:30
virtual std::unique_ptr< IDetector2D > createDomainDetector() const =0
static const QString P_ANALYZER_DIRECTION
Definition: DetectorItems.h:29
virtual double axesToDomainUnitsFactor() const
Scales the values provided by axes (to perform deg->rad conversion on the way to domain).
Definition: DetectorItems.h:66
static const QString P_RESOLUTION_FUNCTION
Definition: DetectorItems.h:28
static const QString P_ANALYZER_TOTAL_TRANSMISSION
Definition: DetectorItems.h:31
static const QString T_MASKS
Definition: DetectorItems.h:27
virtual int ySize() const =0
returns the size of y-axis of the detector
virtual void setYSize(int ny)=0
sets the size of y-axis of the detector
Abstract 2D detector interface.
Definition: IDetector2D.h:31
Interface providing two-dimensional resolution function.
Container holding various masks as children.
Definition: MaskItems.h:24