I like to think of poker from a mathematical stand point. If you consider that any event in an infinite system can and will occur, then an apparent downswing is inevitable. And let's be honest, we would play forever if we could. With a set of variable that only pertain to the local environment; deck, players, table, time of day, etc., I have found that the best way to get away from a downswing is to change the variables.
First thing that I would do, like many have said so far, is take a break. Continuing to play when the
odds are against you puts you in greater danger of going on tilt. Take a break, get your head right, and come back ready to kill it. One more note on that: If the idea of taking a break seems ridiculous, stop immediately. Your not focused on what is important, and that's winning.
Never chase your money.
Change tables. That will get you a new deck and new opponents. A new set of variables will make you play a tighter game. It will also keep your opponents from exploiting any leaks you have.
I'm not a pro by any means, just a few things I've learned over the years.
Make your own luck.