BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
RectangularDetector Class Reference

A flat rectangular detector with axes and resolution function. More...

+ Inheritance diagram for RectangularDetector:

Public Types

enum  EDetectorArrangement {
  GENERIC , PERPENDICULAR_TO_SAMPLE , PERPENDICULAR_TO_DIRECT_BEAM , PERPENDICULAR_TO_REFLECTED_BEAM ,
  PERPENDICULAR_TO_REFLECTED_BEAM_DPOS
}
 
- Public Types inherited from IDetector
using const_iterator = const SimulationAreaIterator &
 

Public Member Functions

 RectangularDetector (size_t nxbins, double width, size_t nybins, double height)
 Rectangular detector constructor. More...
 
 RectangularDetector (const RectangularDetector &other)
 
RectangularDetectorclone () const override
 
void accept (INodeVisitor *visitor) const final
 Calls the INodeVisitor's visit method.
 
void init (const Beam &beam) override
 Inits detector with the beam settings.
 
void setPosition (const kvector_t normal_to_detector, double u0, double v0, const kvector_t direction=kvector_t(0.0, -1.0, 0.0))
 
void setPerpendicularToSampleX (double distance, double u0, double v0)
 
void setPerpendicularToDirectBeam (double distance, double u0, double v0)
 
void setPerpendicularToReflectedBeam (double distance, double u0=0.0, double v0=0.0)
 
void setDirectBeamPosition (double u0, double v0)
 
double getWidth () const
 
double getHeight () const
 
size_t getNbinsX () const
 
size_t getNbinsY () const
 
kvector_t getNormalVector () const
 
double getU0 () const
 
double getV0 () const
 
kvector_t getDirectionVector () const
 
double getDistance () const
 
double getDirectBeamU0 () const
 
double getDirectBeamV0 () const
 
EDetectorArrangement getDetectorArrangment () const
 
Axes::Units defaultAxesUnits () const override
 return default axes units
 
RectangularPixelregionOfInterestPixel () const
 
- Public Member Functions inherited from IDetector2D
void setDetectorParameters (size_t n_x, double x_min, double x_max, size_t n_y, double y_min, double y_max)
 Sets detector parameters using angle ranges.
 
void removeMasks ()
 Removes all masks from the detector.
 
const DetectorMaskdetectorMask () const override
 Returns detector masks container.
 
void addMask (const IShape2D &shape, bool mask_value=true)
 Adds mask of given shape to the stack of detector masks. More...
 
void maskAll ()
 Put the mask for all detector channels (i.e. exclude whole detector from the analysis)
 
const RegionOfInterestregionOfInterest () const override
 Returns region of interest if exists.
 
void setRegionOfInterest (double xlow, double ylow, double xup, double yup)
 Sets rectangular region of interest with lower left and upper right corners defined.
 
void resetRegionOfInterest () override
 Resets region of interest making whole detector plane available for the simulation.
 
std::vector< size_t > active_indices () const
 Returns vector of unmasked detector indices.
 
std::unique_ptr< DetectorContextcreateContext () const
 
- Public Member Functions inherited from IDetector
void addAxis (const IAxis &axis)
 
const IAxisgetAxis (size_t index) const
 
size_t dimension () const
 Returns actual dimensionality of the detector (number of defined axes)
 
size_t axisBinIndex (size_t index, size_t selected_axis) const
 Calculate axis index for given global index.
 
size_t totalSize () const
 Returns total number of pixels.
 
void setAnalyzerProperties (const kvector_t direction, double efficiency, double total_transmission)
 Sets the polarization analyzer characteristics of the detector.
 
void setDetectorResolution (const IDetectorResolution &p_detector_resolution)
 Sets the detector resolution.
 
void setResolutionFunction (const IResolutionFunction2D &resFunc)
 
void applyDetectorResolution (OutputData< double > *p_intensity_map) const
 Applies the detector resolution to the given intensity maps.
 
void removeDetectorResolution ()
 Removes detector resolution function.
 
const IDetectorResolutiondetectorResolution () const
 Returns a pointer to detector resolution object.
 
std::unique_ptr< OutputData< double > > createDetectorMap () const
 Returns empty detector map in given axes units.
 
const DetectionPropertiesdetectionProperties () const
 Returns detection properties.
 
OutputData< double > * createDetectorIntensity (const std::vector< SimulationElement > &elements) const
 Returns new intensity map with detector resolution applied. More...
 
size_t numberOfSimulationElements () const
 Returns number of simulation elements.
 
std::vector< const INode * > getChildren () const override
 Returns a vector of children (const).
 
void iterate (std::function< void(const_iterator)> func, bool visit_masks=false) const
 
- Public Member Functions inherited from ICloneable
 ICloneable (const ICloneable &)=delete
 
 ICloneable (ICloneable &&)=default
 
virtual void transferToCPP ()
 Used for Python overriding of clone (see swig/tweaks.py)
 
- Public Member Functions inherited from INode
 INode (const NodeMeta &meta, const std::vector< double > &PValues)
 
virtual std::string treeToString () const
 Returns multiline string representing tree structure below the node.
 
void registerChild (INode *node)
 
virtual void setParent (const INode *newParent)
 
const INodeparent () const
 
INodeparent ()
 
int copyNumber (const INode *node) const
 Returns copyNumber of child, which takes into account existence of children with same name.
 
std::string displayName () const
 Returns display name, composed from the name of node and it's copy number.
 
ParameterPoolcreateParameterTree () const
 Creates new parameter pool, with all local parameters and those of its children.
 
- Public Member Functions inherited from IParameterized
 IParameterized (const std::string &name="")
 
 IParameterized (const IParameterized &other)
 
IParameterizedoperator= (const IParameterized &other)=delete
 
ParameterPoolparameterPool () const
 Returns pointer to the parameter pool.
 
std::string parametersToString () const
 Returns multiline string representing available parameters.
 
RealParameterregisterParameter (const std::string &name, double *parpointer)
 
void registerVector (const std::string &base_name, kvector_t *p_vec, const std::string &units="nm")
 
void setParameterValue (const std::string &name, double value)
 
void setVectorValue (const std::string &base_name, kvector_t value)
 
RealParameterparameter (const std::string &name) const
 Returns parameter with given 'name'.
 
virtual void onChange ()
 Action to be taken in inherited class when a parameter has changed.
 
void removeParameter (const std::string &name)
 
void removeVector (const std::string &base_name)
 
void setName (const std::string &name)
 
const std::string & getName () const
 

Protected Member Functions

IPixelcreatePixel (size_t index) const override
 Creates an IPixel for the given OutputData object and index.
 
std::string axisName (size_t index) const override
 Returns the name for the axis with given index.
 
size_t indexOfSpecular (const Beam &beam) const override
 Returns index of pixel that contains the specular wavevector. More...
 
void swapContent (RectangularDetector &other)
 swap function
 
- Protected Member Functions inherited from IDetector2D
 IDetector2D (const IDetector2D &other)
 
size_t getGlobalIndex (size_t x, size_t y) const
 Calculate global index from two axis indices.
 
- Protected Member Functions inherited from IDetector
 IDetector (const IDetector &other)
 
void clear ()
 
virtual std::unique_ptr< IAxiscreateAxis (size_t index, size_t n_bins, double min, double max) const
 Generates an axis with correct name and default binning for given index.
 

Additional Inherited Members

- Static Public Member Functions inherited from IParameterized
static std::string XComponentName (const std::string &base_name)
 
static std::string YComponentName (const std::string &base_name)
 
static std::string ZComponentName (const std::string &base_name)
 
- Protected Attributes inherited from INode
const size_t m_NP
 
std::vector< double > m_P
 

Detailed Description

A flat rectangular detector with axes and resolution function.

Definition at line 26 of file RectangularDetector.h.

Constructor & Destructor Documentation

◆ RectangularDetector()

RectangularDetector::RectangularDetector ( size_t  nxbins,
double  width,
size_t  nybins,
double  height 
)

Rectangular detector constructor.

Parameters
nxbinsNumber of bins (pixels) in x-direction
widthWidth of the detector in mm along x-direction
nybinsNumber of bins (pixels) in y-direction
heightHeight of the detector in mm along y-direction

Definition at line 24 of file RectangularDetector.cpp.

Member Function Documentation

◆ indexOfSpecular()

size_t RectangularDetector::indexOfSpecular ( const Beam beam) const
overrideprotectedvirtual

Returns index of pixel that contains the specular wavevector.

If no pixel contains this specular wavevector, the number of pixels is returned. This corresponds to an overflow index.

Implements IDetector2D.

Definition at line 213 of file RectangularDetector.cpp.


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