During my research [on inventory management policies, i.e., something really applied ;-) ] I stumbled on integrals of the following type and I'm curious under which circumstances there are convex.

Let $f$ be a the density of a probability distribution w.r.t. to the Lebesgue measure on $\mathbb{ R }$. Let $a,e,h,p$ be positive real numbers.

$$C(r,q) = h\int_0^{r/e} \Big(\frac{q}{2} +r - ex\Big)f(x) dx + \int_{r/e}^{(r+q)/e} \Big(\frac{p(ex-r)^2}{2q}+ \frac{h(q+r-ex)^2}{2q}\Big)f(x)dx $$ $$+ \int_{(r+q)/e}^\infty p(ex-r-q/2)f(x)dx + da/q$$

Can anyone give a condition (on $f$), when $C(r,q)$ is (strictly) convex in $r$ and $q$? Does this hold if $f$ is the density of a Gamma (an Erlang) distribution?