PAST PERFECT CONTINUOUS
Past Perfect Continuous is used to talk about an event that happened in the past and continued happening until a second moment in the past. The action that came first is the past perfect (or, past of the past). We can identify the past perfect continuous by its structure.
Adding these structures (have + [to be in past participle = been] + verb -ing).
Thus, the structure for past perfect continuous is (auxiliary verb 'have' in past = had + [to be in past participle = been] + verb -ing):
Had been + verb in -ING
She went to the doctor because she had been having terrible headaches.
Where had she been staying?
They had not been working for long before the results appeared.