Best Geometric Focus

Introduction

The best geometric focus calculation can be made from the GUI ( Menu > Analysis > Best Geometric Focus ) and from the scripting language using the BestFocus subroutine.

Performing this analysis using the scripting language can be quite useful because the calculation and any element re-positioning can be done in a single step. In this article, the detector element is automatically re-positioned at the best focus position of a singlet found using the scripting language.

Download the FRED file: computeBestFocus.frd

Initial trace and the trace after moving the surface to the position of best focus

Script Pseudo-code

The script demonstrating the geometric best focus calculation performs the following steps:

  1. Specify the detector surface and the coordinate system of the best focus results
  2. Delete existing rays and raytrace the sources
  3. Wait for 3 seconds to show the result in the 3D view
  4. Compute the best focus
  5. Loop over the ray buffer to get the ray count
  6. Move the detector entity to the best focus position
  7. Delete existing rays and raytrace the sources to show the new position in the 3D view
  8. Print the best focus results to the output window

Note that the BestFocus subroutine places the results of the calculation into a data structure of the type T_BESTFOCUS.

Still need help? Contact Us Contact Us