Dual weighted residual method for optimal control of hyperbolic equations of second order