First my two cents than a link below that may help.
If it really was a bad beat than you should be grateful. It means that you got your money in a heavy favorite and that your opponent made a mistake. The only way we make money is when our opponents make mistakes.
The thing to be cautious about is, don't mistake poor play for bad beats. It's easy, (I've done it way too often
) to make a borderline play get yourself in a tricky spot and then blame the poker gods.
Also, try to realize that even a 20% long shot (7 2 vs AA) has to come in sometime.
Ed Miller explains it here
https://www.cardschat.com/forum/learning-poker-57/handling-bad-beats-positive-way-article-185901/ very well
Good luck