Where A is the raw spectrum, Dark is the spectrum obtained under the dark condition, and Si is the spectrum obtained from the bare silicon substrate.
The collected spectra can be sorted based on the region of the pattern that has generated the spectrum, and spectra from some regions can be excluded from the endpoint calculation.