I know that gerunds can be used with before or after in the present tense when talking about facts:
I always turn off the lights before going to bed.
But can I use a gerund with "after" or "before" to explain specific events that occurred in the past, or the past perfect tense is always required?
After getting up yesterday, I brushed my teeth.
After I had gotten up yesterday, I brushed my teeth.
If both sentences are grammatically correct, when should I use one over the other?