As others have said, tilt management is something, that comes with practice. But I also think, its fair to say, that only a few people can completely rid themselfes of tilt. So when its going absolutely terrible, and it gets to much for even the strongest of minds, then just cut your session short and call it a day.
If you are a cash player, sit out on the next big blind on all your tables and then close them down. If you are a tournament player, stop adding more tournaments and focus on finishing those, you still have running. For me personally sometimes the tilt actually fades away, if I only have 1-2 tournaments running. And occationally one of those last tournaments will end in a big win saving the entire session.
If even just losing a single hand, like some crazy runner-runner bad beat, can set you off, thats really not ideal, and its something, you need to work on. As others have said, why focus on the past, when only the future matter. But if you have this problem, then as a temporary solution sit out immedeatly on all your tables, regardless if its cash or tournaments, and then spend 5 minutes to walk around the house and make a cup of coffee or something. Losing a few blinds by sitting out is far less detrimental than losing a full stack because of tilted play.