Immigration typically takes up to an hour. You need to give yourself a minimum of 3 hours after landing to board a train if you're leaving from Roissy, 4 hours if you're taking a train from Paris itself. It's usually suggested to allow a minimum of 3 hours to connect with a train leaving from CDG.