It's called inappropriate affect and is seen with schizophrenia. It's like the wiring between your emotions and your affect get crossed and so the wrong affect comes out. I find it really upsetting when it happens to me because I can't control it no matter how hard I try.
It is different to when I *choose* to display a positive affect to a sad situation. I do that a lot as a coping mechanism. I don't know how they tell the difference cos from the outside it would look the same, but inside it feels very different.
Anyway, hope that helps
*Willow*