The past perfect tense is used in unreal or hypothetical stituations, as in the following sentences:
If I had known you were in Groningen, I would have called you.
If I had had enough money, I would have bought you a better present.
(but I didn't have enough money.)
I would have been angy if you had laughed when I got the answer wrong.
(but you didn't laugh, so I wasn't angry.)