Nigel gave an excellent reply but as an appendix I would like to add that when thinking of past perfect tense you must understood that its usage is in reference to another past event, literally or inferred. Therefore, go back to that past event and the idea/verb would have been in present perfect usage.
I like to use a time-line when explaining this to students. Mmm, i do not have the facility to show a time-line, and I am not sure you have been taught this... therefore:
Imagine a mathematical graph. You know, a vertical line representing present, and a horizontal line representing time: to the left, past; and to the right, future. Position the usage of tense thus... Mmm, good luck.