Trace theorems for holomorphic semigroups and the second order Cauchy problem