1. A method of measuring dimensions for an optical system to measure a critical dimension of a sample object, comprising: preparing a plurality of standard objects, each standard object having a grating-shaped standard pattern with a predetermined pitch and line width; selecting a predetermined focus metric algorithm; performing an analyzing process on each standard object, said step of performing an analyzing process comprising: moving the standard object to a plurality of predetermined positions with respect to an on-focus position of the optical system; capturing a plurality of images of the standard object on the predetermined positions using the optical system; and analyzing the images using the predetermined focus metric algorithm to generate a plurality of distributions of focus metric values on the predetermined positions, each focus metric distribution having at least one extreme value; analyzing the focus metric distributions to determine target orders from the extreme value and a plurality of characteristic values corresponding to the target orders of the focus metric distributions; generating a reference relation correlating the characteristic values with the line widths of the standard objects; measuring the sample object to acquire a measured characteristic value; and determining the critical dimension of the sample object based on the measured characteristic value and the reference relation.