allpix::DetectorField
Field instance of a detector. More…
#include <DetectorField.hpp>
Public Functions
| Name | |
|---|---|
| DetectorField() =default Constructs a detector field.  | 
|
| bool | isValid() const Check if the field is valid and either a field grid or a field function is configured.  | 
| FieldType | getType() const Return the type of field.  | 
| T | get(const ROOT::Math::XYZPoint & local_pos, const bool extrapolate_z =false) const Get the field value in the sensor at a position provided in local coordinates.  | 
| T | getRelativeTo(const ROOT::Math::XYZPoint & local_pos, const ROOT::Math::XYPoint & reference, const bool extrapolate_z =false) const Get the value of the field at a position provided in local coordinates with respect to the reference.  | 
| void | setGrid(std::shared_ptr< std::vector< double » field, std::array< size_t, 3 > bins, std::array< double, 3 > size, FieldMapping mapping, std::array< double, 2 > scales, std::array< double, 2 > offset, std::pair< double, double > thickness_domain) Set the field in the detector using a grid.  | 
| void | setFunction(FieldFunction< T > function, std::pair< double, double > thickness_domain, FieldType type =FieldType::CUSTOM) Set the field in the detector using a function.  | 
| void | setModel(const std::shared_ptr< DetectorModel > & model) Set the detector model this field is used for.  | 
Protected Functions
| Name | |
|---|---|
| void | set_grid_parameters(std::array< size_t, 3 > bins, std::array< double, 3 > size, FieldMapping mapping, std::array< double, 2 > scales, std::array< double, 2 > offset, std::pair< double, double > thickness_domain) Helper to calculate field size normalization factors and configure them.  | 
Detailed Description
template <typename T ,
size_t N =3>
class allpix::DetectorField;
Field instance of a detector.
Contains the a pointer to the field data along with the field sizes, binning and potential field distortions such as scaling or offset parameters.
Public Functions Documentation
function DetectorField
DetectorField() =default
Constructs a detector field.
function isValid
inline bool isValid() const
Check if the field is valid and either a field grid or a field function is configured.
Return: Boolean indicating field validity
function getType
inline FieldType getType() const
Return the type of field.
Return: The type of the field
Note: The type of the field is set depending on the function used to apply it
function get
T get(
    const ROOT::Math::XYZPoint & local_pos,
    const bool extrapolate_z =false
) const
Get the field value in the sensor at a position provided in local coordinates.
Parameters:
- local_pos Position in the local frame
 - extrapolate_z Extrapolate the field along z when outside the defined region
 
Return: Value(s) of the field at the queried point
function getRelativeTo
T getRelativeTo(
    const ROOT::Math::XYZPoint & local_pos,
    const ROOT::Math::XYPoint & reference,
    const bool extrapolate_z =false
) const
Get the value of the field at a position provided in local coordinates with respect to the reference.
Parameters:
- local_pos Position in the local frame
 - reference Reference position to calculate the field for, x and y coordinate only
 - extrapolate_z Extrapolate the field along z when outside the defined region
 
Return: Value(s) of the field assigned to the reference pixel at the queried point
function setGrid
void setGrid(
    std::shared_ptr< std::vector< double >> field,
    std::array< size_t, 3 > bins,
    std::array< double, 3 > size,
    FieldMapping mapping,
    std::array< double, 2 > scales,
    std::array< double, 2 > offset,
    std::pair< double, double > thickness_domain
)
Set the field in the detector using a grid.
Parameters:
- field Flat array of the field
 - bins The bins of the flat field array
 - size Physical extent of the field
 - mapping Specification of the mapping of the field onto the pixel plane
 - scales Scaling factors for the field size, given in fractions of the field size in x and y
 - offset Offset of the field from the pixel center, given in fractions of the field size in x and y
 - thickness_domain Domain in local coordinates in the thickness direction where the field holds
 
function setFunction
void setFunction(
    FieldFunction< T > function,
    std::pair< double, double > thickness_domain,
    FieldType type =FieldType::CUSTOM
)
Set the field in the detector using a function.
Parameters:
- function Function used to calculate the field
 - type Type of the field function used
 - thickness_domain Domain in local coordinates in the thickness direction where the field holds
 
function setModel
inline void setModel(
    const std::shared_ptr< DetectorModel > & model
)
Set the detector model this field is used for.
Parameters:
- model The detector model
 
Protected Functions Documentation
function set_grid_parameters
void set_grid_parameters(
    std::array< size_t, 3 > bins,
    std::array< double, 3 > size,
    FieldMapping mapping,
    std::array< double, 2 > scales,
    std::array< double, 2 > offset,
    std::pair< double, double > thickness_domain
)
Helper to calculate field size normalization factors and configure them.
Parameters:
- bins The bins of the flat field array
 - size Physical extent of the field
 - mapping Specification of the mapping of the field onto the pixel plane
 - scales Scaling factors for the field size, given in fractions of the field size in x and y
 - offset Offset of the field from the pixel center, given in fractions of the field size in x and y
 - thickness_domain Domain in local coordinates in the thickness direction where the field holds
 
Updated on 2025-05-10 at 19:40:38 +0000