You should read this Politico story about President Obama's response to this week's debate. He knew that he did a bad job as soon as the debate was over, but it wasn't until the next day that he realized how bad it was:

At first, Obama didn’t think his performance was a complete disaster. But he began Thursday morning by watching excerpts of his own performance and was especially struck by his own tentative, grim demeanor — especially when he and a more relaxed Mitt Romney were broadcast in split-screen. It was worse than he thought, according to one person close to the situation. He was subdued but positive on a conference call with staff.

But by the end of the day Thursday, he knew what he had to do:

His mood was radically different Thursday — not just calm but buoyant, loose, focused. It reminded several aides close to the president of his response to Hillary Clinton’s stunning comeback win in the New Hampshire primary in 2008. It’s a clichÉ in his camp that Obama only feels really motivated when his own destruction is in sight, but the magnitude of his lousy performance clearly motivated him as he plunged back into campaigning.

Go read the whole thing. It maybe says something about the current state of journalism that I feel the need to applaud Politico for not naming this story "How Obama Got His Groove Back." Good job, you guys.