My assumption is that you have found this expansion by solving the sturm louville equation with weight function $\sigma =1$. In which case, the $\tanh(\ldots)\sinh(\ldots)$ are the riven functions, since they are orthonormal, taking an inner product with the $m$-th eigenfunction would yield $$\beta_m=-\int_0^Lg(x)\tanh(m\pi L/H)\sin(m\pi L/H)\,dx.$$ If the weight function is not $1$ it would also sit in the integral.