Let $$\Omega = \left\{f(x) \in \mathcal{L}^2[0,T]: \frac{1}{T}\int_0^Tf(x)dx = \mu,~ a \le f(x) \le b,~\forall x \in [0,T]\right\},$$ where $\mathcal{L}^2[0,T]$ is the set of Lebesgue square-integrable functions on $[0,T]$ and $0 \le a \le \mu \le b$ are real numbers. Let $P_\tau(\Omega)$ denote the projection of $\Omega$ onto the space of $\mathcal{L}^2[0,\tau]$ functions for $\tau < T$; i.e., if $g \in P_\tau(\Omega)$ then there exists another function $\tilde{g}$ defined on $(\tau,T]$ where $$\hat{g}(t) = \begin{cases} g(t),&t\in [0,\tau] \\ \tilde{g}(t), & t \in (\tau,T] \end{cases} \qquad \textrm{and}\qquad \hat{g} \in \Omega. $$
My question: If $h(t) \ge 0$ is defined on $[0,\tau]$ and $h \not \in P_\tau(\Omega)$, then I want to solve: $$f^* = \begin{array}{rl} \arg \min & \|f - h\| \\ \textrm{s.t.} & f \in P_\tau(\Omega), \end{array} $$ where $\langle f,h\rangle = \int_0^\tau f(t)h(t)dt$ is an inner product with induced norm $\|f\| = \sqrt{\langle f,f \rangle}$.
I am pretty sure $f^*$ exists and is unique, but I would really like to characterize it as much as possible as a function of $h$.
Progress thus far: If $\tau/T$ is small enough, then for $x \in [0,\tau]$, (1) if $h(x) > b$, then $f(x) = b$, (2) if $h(x) < a$, then $f(x)=a$, and (3) otherwise $f(x)=h(x)$. Unfortunately, I can't figure out how $\mu$ comes into play when $\tau/T$ is larger.