In attempting to explain attention and ADHD, Jonah Lehrer explains dopamine's salience function
But the caricature of dopamine as simply the chemical of hedonism is woefully incomplete. For instance, studies have shown that the dopamine reward pathway is also extremely active when people are forced to eat something disgusting, or when a subject is gasping for air after holding their breath. These are intensely unpleasant experiences, and yet our dopamine neurons are pumping out neurotransmitter. This leaves two possibilities: 1) We are all secret masochists, and take pleasure in pain or 2) Dopamine is really about attention and motivation, and is not just the chemical of pleasure and rewards.
I don’t know about you, but I’m betting on hypothesis number two. I think there’s a growing body of evidence suggesting that the real purpose of the dopamine is to help us efficiently assess the outside world. Many dopamine researchers, for instance, refer to the chemical as our “neural currency,” since it allows us to quickly assign a value to the multitudes of things and ideas we perceive. (In other words, dopamine is the price tag of sensory information, and it attaches hefty prices to things that are delicious, beautiful, or reflect some urgent homeostatic need.) When we see something we want - and it doesn’t matter if it’s a chocolate cupcake or a glass of water – the mere sight of the object triggers a wave of emotional desire, which motivates us to act. (Emotion and motivation share the same Latin root, movere, which means “to move.”) The world is full of possibilities, and it is our dopaminergic urges that help us choose between them.
Put simply, dopamine's salience function makes certain stimuli nearly impossible to ignore.