BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
DetectorContext Class Reference
Collaboration diagram for DetectorContext:

Public Member Functions

 DetectorContext (const IDetector2D *detector)
 
 DetectorContext (const DetectorContext &other)=delete
 
DetectorContextoperator= (const DetectorContext &other)=delete
 
size_t numberOfSimulationElements () const
 
std::unique_ptr< IPixelcreatePixel (size_t element_index) const
 
size_t detectorIndex (size_t element_index) const
 

Private Member Functions

void setup_context (const IDetector2D *detector)
 

Private Attributes

Eigen::Matrix2cd analyzer_operator
 
std::vector< std::unique_ptr< IPixel > > pixels
 
std::vector< size_t > active_indices
 

Detailed Description

Holds precalculated information for faster SimulationElement generation.

Definition at line 28 of file DetectorContext.h.

Constructor & Destructor Documentation

◆ DetectorContext() [1/2]

DetectorContext::DetectorContext ( const IDetector2D detector)

Definition at line 18 of file DetectorContext.cpp.

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

References setup_context().

Here is the call graph for this function:

◆ DetectorContext() [2/2]

DetectorContext::DetectorContext ( const DetectorContext other)
delete

Member Function Documentation

◆ operator=()

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

◆ numberOfSimulationElements()

size_t DetectorContext::numberOfSimulationElements ( ) const

Definition at line 23 of file DetectorContext.cpp.

24 {
25  return active_indices.size();
26 }
std::vector< size_t > active_indices
All unmasked pixels inside ROI.

References active_indices.

◆ createPixel()

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

Creates pixel for given element index.

Element index is sequetial index in a vector of SimulationElements. 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>(pixels[element_index]->clone());
35 }
std::vector< std::unique_ptr< IPixel > > pixels

References pixels.

◆ detectorIndex()

size_t DetectorContext::detectorIndex ( size_t  element_index) const

Definition at line 37 of file DetectorContext.cpp.

38 {
39  return active_indices[element_index];
40 }

References active_indices.

◆ setup_context()

void DetectorContext::setup_context ( const IDetector2D detector)
private

Definition at line 42 of file DetectorContext.cpp.

43 {
44  active_indices = detector->active_indices();
46  pixels.reserve(active_indices.size());
47  for (auto detector_index : active_indices)
48  pixels.emplace_back(detector->createPixel(detector_index));
49 }
Eigen::Matrix2cd analyzerOperator() const
Return the polarization density matrix (in spin basis along z-axis)
Eigen::Matrix2cd analyzer_operator
virtual IPixel * createPixel(size_t index) const =0
Creates an IPixel for the given OutputData object and index.
std::vector< size_t > active_indices() const
Returns vector of unmasked detector indices.
Definition: IDetector2D.cpp:60
const DetectionProperties & detectionProperties() const
Returns detection properties.
Definition: IDetector.h:93

References active_indices, IDetector2D::active_indices(), analyzer_operator, DetectionProperties::analyzerOperator(), IDetector2D::createPixel(), IDetector::detectionProperties(), and pixels.

Referenced by DetectorContext().

Here is the call graph for this function:

Member Data Documentation

◆ analyzer_operator

Eigen::Matrix2cd DetectorContext::analyzer_operator
private

Definition at line 45 of file DetectorContext.h.

Referenced by setup_context().

◆ pixels

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

Definition at line 46 of file DetectorContext.h.

Referenced by createPixel(), and setup_context().

◆ active_indices

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

All unmasked pixels inside ROI.

Definition at line 47 of file DetectorContext.h.

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


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