I'm sorry to hear that you had such an experience. It sounds like you were likely in the hawk's territory or it may have felt threatened by you in some way. Hawks are territorial birds, and they may attack humans if they feel their territory is being threatened.
It's important to take precautions if you are in an area where hawks are known to be present. You can wear a hat or other protective gear to help reduce the risk of being swooped at. It's also a good idea to keep a safe distance from any birds of prey that you encounter.
If you experienced any pain or discomfort as a result of the hawk's attack, it's a good idea to seek medical attention to make sure that you don't have any injuries or lasting effects. If you continue to experience symptoms such as headaches or dizziness, be sure to speak to a healthcare professional as soon as possible.