What is trapping used for in field hockey?

you will have to trap the ball many times during a game. If someone hits you the ball you don't always want to sweep it, you have to stop it and bring it into yourself so you can start to do light dribbles. You don't use this for when you know you have to hit the ball and when you pull it to yourself, don't hit your feet!