Symmetry adapted analysis of lattice dynamics and local distortions in perovskite related materials