According to Wikipedia
"Happiness is a cigar called Hamlet" is one of the most famous British advertising campaigns for a tobacco product.
It was a long-running campaign for Hamlet Cigars, lasting on television until all tobacco advertising on television was banned in the UK in 1991. They returned in cinemas in 1996, continuing there until 1999.
Commercials used an excerpt from a jazzy rendition of Bach's Air on the G String, played by the then young Jacques Loussier, which is still frequently associated with the brand.
The premise is that a man finds himself in an awkward or embarrassing situation and lights a Hamlet cigar. Lighting and smoking this cigar makes him smile and forget his woes.
The term has entered public consciousness and is sometimes used as a "don't worry about it" motto.