If negative thoughts dominate over positive ones like "OMG not again" or "Why does this happen to me all the time" or "How can he call with that hand" (and then win), then you are probably tilted, and its time to take a break. A simple way to think about it is, that poker is supposed to be fun and enjoyable. So if you are not enjoying to play, then something is not right, and its better to stop and do something else.
Of course if you are playing tournaments, you need to finish them first. But you can stop registering for more tournaments and try to force yourself to get out of the negative mindset. Like maybe think about your last big tournament win, how much you are up overall, or something completely non poker related, that makes you happy.