BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
DetectorContext Class Reference

Description

Holds precalculated information for faster DiffuseElement generation.

Definition at line 29 of file DetectorContext.h.

Collaboration diagram for DetectorContext:
[legend]

Public Member Functions

 DetectorContext (const DetectorContext &other)=delete
 
 DetectorContext (const IDetector *detector)
 
std::unique_ptr< IPixelcreatePixel (size_t element_index) const
 Creates pixel for given element index. Element index is sequential index in a vector of DiffuseElements. Corresponds to sequence of detector bins inside ROI and outside of masked areas. More...
 
size_t detectorIndex (size_t element_index) const
 
size_t numberOfElements () const
 
DetectorContextoperator= (const DetectorContext &other)=delete
 

Private Member Functions

void setup_context (const IDetector *detector)
 

Private Attributes

std::vector< size_t > m_active_indices
 All unmasked pixels inside ROI. More...
 
SpinMatrix m_analyzer_operator
 
std::vector< std::unique_ptr< IPixel > > m_pixels
 

Constructor & Destructor Documentation

◆ DetectorContext() [1/2]

DetectorContext::DetectorContext ( const IDetector detector)

Definition at line 18 of file DetectorContext.cpp.

19 {
20  setup_context(detector);
21 }
void setup_context(const IDetector *detector)

References setup_context().

Here is the call graph for this function:

◆ DetectorContext() [2/2]

DetectorContext::DetectorContext ( const DetectorContext other)
delete

Member Function Documentation

◆ createPixel()

std::unique_ptr< IPixel > DetectorContext::createPixel ( size_t  element_index) const

Creates pixel for given element index. Element index is sequential index in a vector of DiffuseElements. Corresponds to sequence of detector bins inside ROI and outside of masked areas.

Definition at line 32 of file DetectorContext.cpp.

33 {
34  return std::unique_ptr<IPixel>(m_pixels[element_index]->clone());
35 }
std::vector< std::unique_ptr< IPixel > > m_pixels

References m_pixels.

◆ detectorIndex()

size_t DetectorContext::detectorIndex ( size_t  element_index) const

Definition at line 37 of file DetectorContext.cpp.

38 {
39  return m_active_indices[element_index];
40 }
std::vector< size_t > m_active_indices
All unmasked pixels inside ROI.

References m_active_indices.

◆ numberOfElements()

size_t DetectorContext::numberOfElements ( ) const

Definition at line 23 of file DetectorContext.cpp.

24 {
25  return m_active_indices.size();
26 }

References m_active_indices.

◆ operator=()

DetectorContext& DetectorContext::operator= ( const DetectorContext other)
delete

◆ setup_context()

void DetectorContext::setup_context ( const IDetector detector)
private

Definition at line 42 of file DetectorContext.cpp.

43 {
44  m_active_indices = detector->active_indices();
45  m_analyzer_operator = detector->analyzer().matrix();
46  m_pixels.reserve(m_active_indices.size());
47  for (auto detector_index : m_active_indices)
48  m_pixels.emplace_back(detector->createPixel(detector_index));
49 }
SpinMatrix m_analyzer_operator
const PolFilter & analyzer() const
Returns detection properties.
Definition: IDetector.h:204
std::vector< size_t > active_indices() const
Returns vector of unmasked detector indices.
Definition: IDetector.cpp:346
virtual IPixel * createPixel(size_t index) const =0
Creates an IPixel for the given Datafield object and index.
SpinMatrix matrix() const
Return the polarization density matrix (in spin basis along z-axis)
Definition: PolFilter.cpp:40

References IDetector::active_indices(), IDetector::analyzer(), IDetector::createPixel(), m_active_indices, m_analyzer_operator, m_pixels, and PolFilter::matrix().

Referenced by DetectorContext().

Here is the call graph for this function:

Member Data Documentation

◆ m_active_indices

std::vector<size_t> DetectorContext::m_active_indices
private

All unmasked pixels inside ROI.

Definition at line 47 of file DetectorContext.h.

Referenced by detectorIndex(), numberOfElements(), and setup_context().

◆ m_analyzer_operator

SpinMatrix DetectorContext::m_analyzer_operator
private

Definition at line 45 of file DetectorContext.h.

Referenced by setup_context().

◆ m_pixels

std::vector<std::unique_ptr<IPixel> > DetectorContext::m_pixels
private

Definition at line 46 of file DetectorContext.h.

Referenced by createPixel(), and setup_context().


The documentation for this class was generated from the following files: