BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
DetectorContext.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Device/Detector/DetectorContext.h
6 //! @brief Define DetectorContext class.
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 USER_API
16 #ifndef BORNAGAIN_DEVICE_DETECTOR_DETECTORCONTEXT_H
17 #define BORNAGAIN_DEVICE_DETECTOR_DETECTORCONTEXT_H
18 
19 #include "Base/Pixel/IPixel.h"
20 #include "Base/Spin/SpinMatrix.h"
21 #include <memory>
22 #include <vector>
23 
24 class IDetector;
25 
26 //! Holds precalculated information for faster DiffuseElement generation.
27 //! @ingroup detector
28 
30 public:
31  DetectorContext(const IDetector* detector);
32 
33  DetectorContext(const DetectorContext& other) = delete;
34  DetectorContext& operator=(const DetectorContext& other) = delete;
35 
36  size_t numberOfElements() const;
37 
38  std::unique_ptr<IPixel> createPixel(size_t element_index) const;
39 
40  size_t detectorIndex(size_t element_index) const;
41 
42 private:
43  void setup_context(const IDetector* detector);
44 
46  std::vector<std::unique_ptr<IPixel>> m_pixels; //! All unmasked pixels inside ROI.
47  std::vector<size_t> m_active_indices; //! The sequence of bin indices (unmasked, in ROI)
48 };
49 
50 #endif // BORNAGAIN_DEVICE_DETECTOR_DETECTORCONTEXT_H
51 #endif // USER_API
Defines and implements interface IPixel.
Defines class SpinMatrix.
Holds precalculated information for faster DiffuseElement generation.
size_t numberOfElements() const
DetectorContext & operator=(const DetectorContext &other)=delete
void setup_context(const IDetector *detector)
std::vector< size_t > m_active_indices
All unmasked pixels inside ROI.
DetectorContext(const IDetector *detector)
size_t detectorIndex(size_t element_index) const
std::vector< std::unique_ptr< IPixel > > m_pixels
std::unique_ptr< IPixel > createPixel(size_t element_index) const
Creates pixel for given element index. Element index is sequential index in a vector of DiffuseElemen...
DetectorContext(const DetectorContext &other)=delete
SpinMatrix m_analyzer_operator
Abstract detector interface.
Definition: IDetector.h:57