BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
DetectorContext.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
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 BORNAGAIN_CORE_DETECTOR_DETECTORCONTEXT_H
16 #define BORNAGAIN_CORE_DETECTOR_DETECTORCONTEXT_H
17 
18 #include "Base/Pixel/IPixel.h"
19 #include "Base/Vector/EigenCore.h"
20 #include <memory>
21 #include <vector>
22 
23 class IDetector2D;
24 
25 //! Holds precalculated information for faster SimulationElement generation.
26 //! @ingroup detector
27 
29 {
30 public:
31  DetectorContext(const IDetector2D* detector);
32 
33  DetectorContext(const DetectorContext& other) = delete;
34  DetectorContext& operator=(const DetectorContext& other) = delete;
35 
36  size_t numberOfSimulationElements() 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 IDetector2D* detector);
44 
45  Eigen::Matrix2cd analyzer_operator;
46  std::vector<std::unique_ptr<IPixel>> pixels; //! All unmasked pixels inside ROI.
47  std::vector<size_t> active_indices; //! The sequence of detector bin indices (unmasked, in ROI)
48 };
49 
50 #endif // BORNAGAIN_CORE_DETECTOR_DETECTORCONTEXT_H
Include to deal with Eigen alignment centrally.
Defines pure virtual interface IPixel (has no cpp file)
Holds precalculated information for faster SimulationElement generation.
DetectorContext(const IDetector2D *detector)
DetectorContext & operator=(const DetectorContext &other)=delete
std::vector< size_t > active_indices
All unmasked pixels inside ROI.
std::vector< std::unique_ptr< IPixel > > pixels
void setup_context(const IDetector2D *detector)
size_t detectorIndex(size_t element_index) const
std::unique_ptr< IPixel > createPixel(size_t element_index) const
Creates pixel for given element index.
size_t numberOfSimulationElements() const
DetectorContext(const DetectorContext &other)=delete
Eigen::Matrix2cd analyzer_operator
Abstract 2D detector interface.
Definition: IDetector2D.h:31