Loading src/core/geometry/DetectorField.tpp +13 −6 Original line number Diff line number Diff line Loading @@ -28,16 +28,17 @@ namespace allpix { return {}; } if(type_ == FieldType::CONSTANT) { // Constant field - return value: return function_({}); } else if(type_ == FieldType::LINEAR || type_ == FieldType::CUSTOM1D) { // Check if we need to extrapolate along the z axis or if is inside thickness domain: auto z = (extrapolate_z ? std::clamp(pos.z(), thickness_domain_.first, thickness_domain_.second) : pos.z()); if(z < thickness_domain_.first || thickness_domain_.second < z) { return {}; } if(type_ == FieldType::CONSTANT) { // Constant field - return value: return function_({}); } else if(type_ == FieldType::LINEAR || type_ == FieldType::CUSTOM1D) { // Linear field or custom field function with z dependency only - calculate value from configured function: return function_(ROOT::Math::XYZPoint(0, 0, z)); } else { Loading @@ -52,6 +53,12 @@ namespace allpix { return getRelativeTo(pos, ref, extrapolate_z); } // Check if we need to extrapolate along the z axis or if is inside thickness domain: auto z = (extrapolate_z ? std::clamp(pos.z(), thickness_domain_.first, thickness_domain_.second) : pos.z()); if(z < thickness_domain_.first || thickness_domain_.second < z) { return {}; } // Shift the coordinates by the offset configured for the field: auto x = pos.x() + offset_[0]; auto y = pos.y() + offset_[1]; Loading Loading
src/core/geometry/DetectorField.tpp +13 −6 Original line number Diff line number Diff line Loading @@ -28,16 +28,17 @@ namespace allpix { return {}; } if(type_ == FieldType::CONSTANT) { // Constant field - return value: return function_({}); } else if(type_ == FieldType::LINEAR || type_ == FieldType::CUSTOM1D) { // Check if we need to extrapolate along the z axis or if is inside thickness domain: auto z = (extrapolate_z ? std::clamp(pos.z(), thickness_domain_.first, thickness_domain_.second) : pos.z()); if(z < thickness_domain_.first || thickness_domain_.second < z) { return {}; } if(type_ == FieldType::CONSTANT) { // Constant field - return value: return function_({}); } else if(type_ == FieldType::LINEAR || type_ == FieldType::CUSTOM1D) { // Linear field or custom field function with z dependency only - calculate value from configured function: return function_(ROOT::Math::XYZPoint(0, 0, z)); } else { Loading @@ -52,6 +53,12 @@ namespace allpix { return getRelativeTo(pos, ref, extrapolate_z); } // Check if we need to extrapolate along the z axis or if is inside thickness domain: auto z = (extrapolate_z ? std::clamp(pos.z(), thickness_domain_.first, thickness_domain_.second) : pos.z()); if(z < thickness_domain_.first || thickness_domain_.second < z) { return {}; } // Shift the coordinates by the offset configured for the field: auto x = pos.x() + offset_[0]; auto y = pos.y() + offset_[1]; Loading