BornAgain  1.19.79
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/Model/Device/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_MODEL_DEVICE_DETECTORITEMS_H
16 #define BORNAGAIN_GUI_MODEL_DEVICE_DETECTORITEMS_H
17 
21 #include <heinz/Vectors3D.h>
22 
23 class MaskContainerItem;
24 class IDetector;
25 class IResolutionFunction2D;
26 class DetectorItem;
28 
29 class DetectorItem {
30 public:
31  virtual ~DetectorItem() = default;
32 
33  std::unique_ptr<IDetector> createDetector() const;
34  virtual void serialize(Streamer& s) = 0;
35 
36  //! Returns the size of x-axis of the detector
37  virtual int xSize() const = 0;
38 
39  //! Returns the size of y-axis of the detector
40  virtual int ySize() const = 0;
41 
42  //! sets the size of x-axis of the detector
43  virtual void setXSize(size_t nx) = 0;
44 
45  //! sets the size of y-axis of the detector
46  virtual void setYSize(size_t ny) = 0;
47 
48  void importMasks(const MaskContainerItem* maskContainer);
50 
53  template <typename T>
55 
56  //! Scales the values provided by axes (to perform deg->rad conversion on the way to domain).
57  virtual double axesToCoreUnitsFactor() const { return 1.0; }
58 
59 protected:
60  DetectorItem();
61 
62  virtual std::unique_ptr<IDetector> createDomainDetector() const = 0;
63  std::unique_ptr<IResolutionFunction2D> createResolutionFunction() const;
64 
65  void addMasksToCore(IDetector* detector) const;
66 
67 protected:
68  MaskItems m_maskItems; //!< for creation of domain detector; only filled and relevant in jobs
70 };
71 
72 template <typename T>
74 {
76  return dynamic_cast<T*>(m_resolutionFunction.get());
77 }
78 
79 #endif // BORNAGAIN_GUI_MODEL_DEVICE_DETECTORITEMS_H
Defines MaskItems classes.
Defines family of ResolutionFunctionItem.
Defines class SelectionProperty.
MaskItems & maskItems()
virtual double axesToCoreUnitsFactor() const
Scales the values provided by axes (to perform deg->rad conversion on the way to domain).
Definition: DetectorItems.h:57
virtual ~DetectorItem()=default
virtual int xSize() const =0
Returns the size of x-axis of the detector.
void importMasks(const MaskContainerItem *maskContainer)
MaskItems m_maskItems
for creation of domain detector; only filled and relevant in jobs
Definition: DetectorItems.h:68
virtual void setYSize(size_t ny)=0
sets the size of y-axis of the detector
std::unique_ptr< IResolutionFunction2D > createResolutionFunction() const
ResolutionFunctionItem * resolutionFunction() const
virtual void serialize(Streamer &s)=0
SelectionDescriptor< ResolutionFunctionItem * > resolutionFunctionSelection() const
virtual std::unique_ptr< IDetector > createDomainDetector() const =0
SelectionProperty< ResolutionFunctionItem * > m_resolutionFunction
Definition: DetectorItems.h:69
void addMasksToCore(IDetector *detector) const
virtual int ySize() const =0
Returns the size of y-axis of the detector.
T * setResolutionFunctionType()
Definition: DetectorItems.h:73
std::unique_ptr< IDetector > createDetector() const
virtual void setXSize(size_t nx)=0
sets the size of x-axis of the detector
Container holding various masks as children.
Definition: MaskItems.h:202
List of MaskItems.
Definition: MaskItems.h:232
Describes a selection (various possibilities and the current one).
void set(T t, bool callInitializer=false)
Directly set the new item.
T get() const
Direct access to the stored pointer.
Supports serialization to or deserialization from QXmlStream.
Definition: Streamer.h:36