Optimization of the planar hall effect in ferromagnetic thin films for device design