Go directly to the Renfe web sight and you can find out when the trains run out of Barcelona to each of these cities.
They will usually tell you if you need to book ahead. Most of the time there is a commuter train that runs to these places that does not require a booking.Terragona has 50 regional and long distance trains that run from Barcelona each day. Regional trains are a little slower but still only 1 1/2 hours from Barcelona for about 6 Euros. 20 trains to Girona at about the same price. I have been on both and have never had to book ahead with the exception that I usually get my ticket the day before at the train station
www.renfe.es try it you will like it.