The officer was (in my opinion) justified in hitting the girl. However, it was still incredibly stupid. He didn't have to hit her, and the consequences of hitting her (like a riot) could have certainly outweighed any benefits of compliance. I am pretty skeptical of the police, but even I don't think you can hold them to a standard of "the officer should have done the optimal thing."
This is a different video of the same incident. I think it adds some more context. I would like to see even more.