USE
We use Past Perfect
 
1. to talk about a past action that happened before another past action.
Susan got wet because she had forgotten to take her umbrella.
 
We use Past Perfect for the action that happened earlier (had forgotten).
We use Past Simple for the action that happened later (got wet).
 
2. to talk about an action that happened before a stated time in the past.
He had finished his homework by 7 o'clock.
 
TIME EXPRESSIONS
by
He had finished his homework by seven o'clock.
 
by the time
By the time he got to class, the lesson had started.
 
because
He was happy because he had passed his exam.
 
before
I knew I had seen that woman somewhere before.
 
after
Linda left after she had finished the test.
 
when
Mike left when he had finished the test.
 
just
I had just finished the test when the bell rang.