# How do I automate pv reduction/loop integrals in mathematica

So in loop integrals, say over a 4 momentum $$q$$, we end up with terms like $$q.q$$, $$q.p_1 q.p_2$$ and $$q.q q.q$$ and we want to treat each differently. Is there a way we can get Mathematica to do this?