Avoid all masturbation and use of porn to preserve your sexual energy. Any sexual activities should be carried out with your girlfriend. It may take some time to get your mind refocused on the real world rather than fantasy, but don't give up on extended foreplay and satisfying your girlfriend with other means, if intercourse is not working, in the meantime.