Fourier optimization problem related to the Prime Number Theorem Let $\kappa>0$ be given. What is the function
$f:\mathbb{R}\to [0,\infty)$ with $\int_\mathbb{R} f(x) dx = 1$ such that
$$\int_\mathbb{R} |x| f(x) dx + \kappa \int_{|t|\geq T}\left| \frac{\widehat{f}(t)}{t} \right| dt$$
is minimal?

Commentary.
The motivation of this question resides in its applications to bounds in analytic number theory -- for example, explicit versions of the prime number theorem. The question is essentially equivalent to the one I have asked in Best smoothing for the Prime Number Theorem? and Optimizing a smoothing function with the Prime Number Theorem in mind . The main difference is that now I have a plausible candidate: we could work with $$f(x) = \frac{1/\sigma}{\sqrt{2 \pi}} e^{-\frac{1}{2} \left(\frac{x}{\sigma}\right)^2}.$$
Since then
$$\int_{\mathbb{R}} |x| f(x) dx = 2 \int_0^\infty \frac{x/\sigma}{\sqrt{2\pi}} e^{-\frac{1}{2} \left(\frac{x}{\sigma}\right)^2} dx = - \frac{2\sigma}{\sqrt{2\pi}} \int_0^\infty \left(e^{-\frac{1}{2} \left(\frac{x}{\sigma}\right)^2}\right)' dx = \sqrt{\frac{2}{\pi}} \cdot\sigma$$
and, by $\widehat{f}(t) = e^{-2 \pi^2 \sigma^2 t^2}$,
$$\frac{\partial}{\partial \sigma}\int_{|t|\geq T} \left|\frac{\widehat{f}(t)}{t}\right| dt = 2\frac{\partial}{\partial \sigma} \int_{t\geq T} \frac{e^{-2\pi^2 \sigma^2 t^2}}{t} dt
=  - 2 \int_{t\geq T} 4 \pi^2 \sigma t e^{-2\pi^2\sigma^2 t^2} dt = - 2\frac{e^{-2\pi^2 \sigma^2 T^2}}{\sigma}
,$$
we see that the optimal value of $\sigma$ is the one for which $\sigma = \sqrt{2\pi} \kappa \cdot e^{-2 \pi^2 \sigma^2 T^2}$. We write $\sigma = \frac{\sqrt{2 \log T + \eta}}{2 \pi T}$, and see we must solve for $\frac{\sqrt{2 \log T + \eta}}{2\pi} = \sqrt{2\pi} \kappa e^{-\eta/2}$, so $\eta = -2 \log \frac{\sqrt{\log T}}{2\pi^{3/2}\kappa} + O\left(\frac{1}{\log T}\right) = - \log \log T + 2 \log(2 \pi^{3/2} \kappa) + O\left(\frac{1}{\log T}\right)$.
Then
$$\begin{aligned}\int_\mathbb{R} |x| f(x) dx + \kappa \int_{|t|\geq T}\left| \frac{\widehat{f}(t)}{t} \right| dt &= \sqrt{\frac{2}{\pi}} \sigma + 2 \kappa \int_{t\geq T} \frac{e^{-2\pi^2 \sigma^2 t^2}}{t} dt\\ &= 
\sqrt{\frac{2}{\pi}} \sigma - \kappa \textrm{Ei}(-2\pi^2 \sigma^2 T^2)
= \sqrt{\frac{2}{\pi}} \sigma- \kappa \textrm{Ei}(- \log T - \eta/2) \\
&\sim \frac{\sqrt{\log(2\pi^{3/2} \kappa T) - \frac{1}{2} \log \log T}}{\pi^2 T} +
\kappa \sqrt{\frac{2}{\pi}} \frac{e^{-\eta/2}}{T (\log T + \frac{\eta}{2})}\\
&= \frac{1}{\pi^2 T} \left(\sqrt{\log(2\pi^{3/2} \kappa T)} - \frac{\log \log T}{4 \sqrt{\log 2\pi^{3/2} \kappa T}} + \frac{1}{\sqrt{2\log T}} + \dotsc\right). 
\end{aligned}$$
Can one do better?
 A: If you care about the correct order of magnitude only (i.e., don't mind a bounded constant factor separated from both $0$ and infinity), the problem is fairly straightforward.
Scaling By playing with $uf(ux)$ instead of $f$ and choosing $u=1/\kappa$, one can immediately see that the answer for the minimum is $\kappa F(\kappa T)$ where $F$ is the answer with $\kappa=1$, so I'll assume $\kappa=1$ from now on.
The case $T\gtrsim 1$. Take any smooth non-negative even $\psi$ supported on $[-2,2]\setminus[-1,1]$ and such that $\int_{\mathbb R}\psi=1$ and put $\psi_T(t)=T^{-1}\psi(t/T)$. Then the inverse Fourier transform $\Psi_T$ of $\psi_T$ satisfies $\Psi_T(x)\ge 1-2T|x|$. Thus, integrating
$$
(2T)^{-1}=(2T)^{-1}\int_{\mathbb R}f \le \int_{\mathbb R}[|x|+(2T)^{-1}\Psi_T]f =
\\
\int_{\mathbb R}|x|f+(2T)^{-1}\int_{\mathbb R}\psi_T \widehat f
\lesssim \Phi(f)
$$
where $\Phi(f)$ is your functional to be minimized if $T\gtrsim 1$, so in this regime $\Phi(T)\gtrsim T^{-1}$. To get a matching upper bound, just take any positive $f_0$ with integral $1$, Fourier transform supported on $[-1,1]$ and some minimally decent decay like $|f_0(x)|\lesssim \frac 1{1+|x|^3}$ and put $f(x)=Tf_0(Tx)$, so that the Fourier transform of $f$ vanishes outside $[-T,T]$ and we are left with $\int_{\mathbb R}|x|f=T^{-1}\int_{\mathbb R}|x|f_0\approx T^{-1}$.
Now we want to investigate what happens as $T\to 0$.
Note that if $\int_{|x|>T^{-1/2}}|f|\ge T^{1/4}$, say, then $\Phi(f)\ge T^{-1/4}$ already. Otherwise
$$
|\widehat f(t)|\ge 1-T^{-1/2}t-T^{1/4}>1/2
$$
when $t\in (T,T^{3/4})$, say, so the Fourier part of $\Phi(f)$ is $\gtrsim \log(1/T)$.
Hence $\Phi(f)\gtrsim \log(1/T)$ in this case. To have a matching upper bound just take any fixed smooth fast decaying function.
The final answer is that, up to a constant factor, the minimum is $\frac 1T$ if $\kappa T\ge 1$ and $\kappa\log\frac e{\kappa T}$ if $\kappa T<1$.
