Patent Number: 
Section: claims

1. A method for focusing a charged particle beam, the method comprising: (a) altering a focal point of a charged particle beam according to a first focal pattern that varies with time while scanning a first area of a sample and collecting a first set of detection signals; (b) altering the focal point of the charged particle beam according to a second focal pattern that varies with time while scanning a second area that matches the first area and collecting a second set of detection signals; and (c) processing the first set and the second set of detection signals to determine a focal characteristic; wherein the first focal pattern and the second focal pattern differ over time by the location of an optimal focal point. 2. The method according to claim 1 wherein the first focal pattern comprises under-focused points and over-focused points. 3. The method according to claim 1 further comprising repeating stages (a) and (b) such as to collect a third set of detection signals from a third area that matches the first area; wherein the processing further comprises processing the third set of detection signals. 4. The method according to claim 1 further comprising scanning a reference area that matches the first area while maintaining a substantial constant focal point to collect a reference set of detection signals; wherein the processing further comprises processing the reference set of detection signals. 5. The method according to claim 1 wherein the processing comprises estimating a focal change along a first axis and a focal change along a second traverse axis. 6. The method according to claim 5 wherein the focal characteristic is determined in response to the focal change along a first axis and in response to a focal change along the second axis. 7. The method according to claim 1 wherein the processing involves generating a gradient image of the first area and a gradient image of the second area. 8. The method according to claim 1 wherein the altering comprises a mechanical translation. 9. The method according to claim 1 wherein the altering comprises an alteration of a characteristic of an illumination path through which the charged particle beam propagates. 10. The method according to claim 1 wherein the altering is responsive to an estimated spatial relationship between at least one element of a charged beam device and between the surface of the sample. 11. The method according to claim 1 further comprising a preliminary stage of mapping an upper surface of the sample. 12. The method according to claim 1 wherein the first area comprises multiple non-continuous segments. 13. The method according to claim 1 wherein the first area comprises multiple segments and wherein the focal point is maintained substantially fixed in relation to a surface of the sample while scanning a single segment. 14. The method according to claim 1 wherein the processing comprises: generating a first axis gradient image of the first area; generating a second axis gradient image of the first area; calculating a focal grade of the first axis gradient image of the first area; and calculating a focal grade of the second axis gradient image of the first area. 15. The method according to claim 14 wherein the processing further comprises: generating a first axis gradient image of the second area; generating a second axis gradient image of the second area; calculating a focal grade of the first axis gradient image of the second area; calculating a focal grade of the second axis gradient image of the second area; comparing between the focal grade of the first axis gradient image of the first area and the focal grade of the first axis gradient image of the second area; and comparing between the focal grade of the second axis gradient image of the first area and the focal grade of the second axis gradient image of the second area. 16. The method according to claim 1 wherein the first focal pattern comprises a ramp. 17. The method according to claim 1 wherein the first focal pattern comprises limited focal changes. 18. The method according to claim 1 wherein stages (a) and (b) are executed during an inspection session of the sample. 19. The method according to claim 1 wherein the first focal pattern is applied during an inspection session of the sample. 20. The method according to claim 1 wherein the first focal pattern is applied during focal correction sessions between inspection sessions of the sample. 21. The method according to claim 1 wherein the first area comprises a first group of sub-areas and wherein the second area comprises a second group of sub-areas. 22. The method according to claim 21 wherein the processing comprises processing detection signals from each sub-area to provide a sub-area grade and determining the focus characteristic in response to the grades of each sub-area.