# Machine learning the derivative discontinuity of density-functional theory

Johannes Gedeon  Jonathan Schmidt  Institut für Physik, Martin-Luther-
Universität Halle-Wittenberg, 06120 Halle (Saale), Germany  Matthew J. P.
Hodgson  Department of Physics, Durham University, South Road, Durham, DH1
3LE, United Kingdom  Jack Wetherell  LSI, École Polytechnique, CNRS, Institut
Polytechnique de Paris, F-97728 Palaiseau  Carlos L. Benavides-Riveros  Max
Planck Institute for the Physics of Complex Systems, Nöthnitzer Str. 38,
01187, Dresden, Germany  NR-ISM, Division of Ultrafast Processes in Materials
(FLASHit), Area della Ricerca di Roma 1, Via Salaria Km 29.3, I-00016
Monterotondo Scalo, Italy  Miguel A. L. Marques<EMAIL_ADDRESS>halle.de Institut für Physik, Martin-Luther-Universität Halle-Wittenberg,
06120 Halle (Saale), Germany

###### Abstract

Machine learning is a powerful tool to design accurate, highly non-local,
exchange-correlation functionals for density functional theory. So far, most
of those machine learned functionals are trained for systems with an integer
number of particles. As such, they are unable to reproduce some crucial and
fundamental aspects, such as the explicit dependency of the functionals on the
particle number or the infamous derivative discontinuity at integer particle
numbers. Here we propose a solution to these problems by training a neural
network as the universal functional of density-functional theory that (i)
depends explicitly on the number of particles with a piece-wise linearity
between the integer numbers and (ii) reproduces the derivative discontinuity
of the exchange-correlation energy. This is achieved by using an ensemble
formalism, a training set containing fractional densities, and an explicitly
discontinuous formulation.

##  I Introduction

In their now famous paper, Hohenberg and Kohn proved that the electron density
$\rho(\bm{r})$ suffices to compute all observables of a system of interacting
electrons Hohenberg and Kohn (1964). Due to a remarkable balance of
computational cost and numerical precision, first principles modeling of
electronic systems based on this density functional theory (DFT) is nowadays a
daily practice, with great impact in material science, quantum chemistry or
condensed matter Jones (2015). The success of DFT is to a large extent based
on the Kohn-Sham formulation, that utilizes a system of non-interacting
electrons that has the same density as the interacting one Kohn and Sham
(1965). The main ingredient of this formulation is $E_{\rm xc}[\rho]$, the
universal exchange-correlation (xc) functional, whose functional derivative
provides an effective external potential for the non-interacting particles.
Yet, while the Hohenberg-Kohn theorem proves the uniqueness of such a
functional, it does not give any indication regarding its specific form. To
circumvent this issue, a very large number of approximate functionals were
developed in the last decades Lehtola  _et al._ (2018); Perdew and Schmidt
(2001), often combining empirical knowledge, exact mathematical conditions,
and a great deal of ingenuity.

Inspired by the success of machine learning (ML) in various technological
applications, including image and speech recognition Deng and Li (2013), the
last couple of years have seen the development of several neural-network-based
approximations to $E_{\rm xc}[\rho]$. Indeed, it is now firmly established
that machine-learning offers a new generation of accurate, highly non-local,
xc functionals Kalita  _et al._ (2021). While those functionals are designed
to perform tasks of different degree of complexity, all share the aim of
learning one of the maps of DFT, namely, the Hohenberg-Kohn map between the
external potential $v(\bm{r})$ and the density $\rho(\bm{r})$ Brockherde  _et
al._ (2017); Li  _et al._ (2021); Margraf and Reuter (2021); Moreno  _et al._
(2020); Ryczko  _et al._ (2019), or the Kohn-Sham map between the density
$\rho(\bm{r})$ and the xc functional $E_{\rm xc}[\rho(\bm{r})]$ and its
functional derivative $v_{\rm xc}[\rho(\bm{r})]=\delta E_{\rm
xc}[\rho(\bm{r})]/\delta\rho(\bm{r})$ Schmidt  _et al._ (2019); Nagai  _et
al._ (2020); Denner  _et al._ (2020).

The functionals delivered by machine-learning DFT (ML-DFT) are in general non-
local, in the sense that they use multiple density points as input, and can be
efficiently trained with data from reference methods. Yet, since ML-DFT
functionals are mostly trained in Hilbert spaces with an integer number of
particles, they are still unable to reproduce some critical and fundamental
aspects of DFT. For instance, it is known that any satisfactory definition of
the energy functional must depend explicitly on the particle number Lieb
(1983); Ludeña and Karasiev (2002); Kraisler and Kronik (2013). Furthermore,
the derivative of the xc functional in terms of the number of particles
exhibits a discontinuity that plays a crucial role in the description of
electronic bandgaps Sham and Schlüter (1983); Perdew  _et al._ (1982); Grüning
_et al._ (2006); Andrade and Aspuru-Guzik (2011), charge-transfer excitations
Hodgson  _et al._ (2017); Mirtschink  _et al._ (2013), molecular dissociation
Mori-Sánchez and Cohen (2014); Mosquera and Wasserman (2014); Baerends (2020);
Perdew (1985), or even Mott insulators Cohen  _et al._ (2012), to name but a
few examples.

Systems with non-integer (fractional) number of electrons ($N+\epsilon$) are
defined as statistical mixtures of systems with integer number of particles
Perdew  _et al._ (1982); Yang  _et al._ (2000). As such, the density
$\rho_{N+\epsilon}(\bm{r})$ and total energy $E(N+\epsilon)$ are piecewise
linear functions of $\epsilon$, namely:

$\displaystyle\rho_{N+\epsilon}(\bm{r})$
$\displaystyle=(1-\epsilon)\rho_{N}(\bm{r})+\epsilon\rho_{N+1}(\bm{r}),$ (1a)
$\displaystyle E(N+\epsilon)$ $\displaystyle=(1-\epsilon)E(N)+\epsilon
E(N+1)\,$ (1b)

with $0\leq\epsilon\leq 1$. At integer $N$ (i.e., when $\epsilon=0$), the
derivatives of the density and the energy exhibit a discontinuity, and the xc
potential $v_{\rm xc}(\bm{r})$ jumps by a finite value Perdew and Levy (1983).
The difference in the slope on the left/right side of the total energy at
integer values is equal to the fundamental gap Perdew  _et al._ (1982):

$I-A=\left.\frac{\partial E}{\partial N}\right|_{+}-\left.\frac{\partial
E}{\partial N}\right|_{-}\,,$ (2)

where $I$ is the ionization energy and $A$ the electron affinity. Yet, in
practice, standard approximations to the xc functionals that depend explicitly
on the electronic density, such as the local-density (LDA) and generalized-
gradient (GGA) approximations, are continuously differentiable functions of
$N$ and lack therefore a derivative discontinuity. Meta-GGAs can exhibit a
discontinuity due to their dependence on the kinetic-energy density, but it is
usually too small or even negative Eich and Hellgren (2014). Due to their
dependence on the Kohn-Sham orbitals, orbital functionals are discontinuous
Kümmel and Kronik (2008), but this comes at the price of a much higher
computational effort.

In addition to the discontinuity, a universally useful approximation for the
xc functional must be “$N$-electron self-interaction-free” for all positive
integer $N$ Ruzsinszky  _et al._ (2006), meaning that the total energy of a
system with $N+\epsilon$ electrons in the range $(N,\,N+1)$ should exhibit a
linear variation with respect to $\epsilon$. For attractive interactions the
energy is a convex function with straight lines joining subsets of ground-
state energies Perfetto and Stefanucci (2012). Yet, approximate functionals
deviate from such a correct behavior. It has been shown that semi-local
density functionals are in general convex with perhaps small concave pieces Li
and Yang (2017). Even the Hartree Fock theory leads to piecewise concave
curves between integers Li and Yang (2017). We note that the relatively well-
defined curvature of the curves is ultimately the reason for the success of
the Slater half-occupation scheme Slater and Johnson (1972) or the LDA-$1/2$
method Ferreira  _et al._ (2008). In fact, these schemes use the derivative at
the midpoint (i.e., at $N-0.5$), that can be shown to be equal to the slope of
the straight line between $E(N-1)$ and $E(N)$ if the curvature is constant,
irrespective of its sign Baerends (2018). The centrality of these pressing
issues in DFT can be further highlighted by the fact that a rigorous
description of the delocalization error can be related with the energy curve
of the xc functionals lying below the straight energy lines Li and Yang
(2017); Hait and Head-Gordon (2018).

In this work, we propose a way to train a neural network as the ensemble
universal functional of a system of fractional electron numbers that describes
correctly the derivative discontinuity and the piecewise linear behavior. The
ML functionals we present contain explicitly the physics of the derivative
discontinuity of DFT, are highly non-local, and are trained for systems with
fractional densities. For this reason, our functionals can potentially address
the well known delocalization and static correlation errors of DFT Cohen  _et
al._ (2008); Mori-Sánchez  _et al._ (2008); Benavides-Riveros  _et al._ (2017)
simultaneously.

##  II Results and discussion

Inspired by the neural network topology proposed in Ref. Schmidt  _et al._
(2019), our neural network takes an electronic density as an input and returns
the corresponding xc energy, whose functional derivative can in turn be used
to solve the Kohn-Sham equations. The network is a sliding window convolution
(SWC) network. For a 1D system of discrete spatial points
$\\{r_{1},...,r_{W}\\}$, a window with a certain kernel size $\kappa$ scans
each data point $\rho_{\sigma}(r_{j})$ and its $\kappa-1$ nearest neighbors
$\eta_{\sigma}(r_{j},\kappa)=\\{\rho_{\sigma}(r_{j-(\kappa-1)/2}),...,\rho_{\sigma}(r_{j+(\kappa-1)/2})\\}$
with $\sigma=\uparrow,\downarrow$ to calculate a local energy
$\epsilon^{\theta}_{\mathrm{loc}}\big{[}\eta_{\uparrow}(r_{j},\kappa),\eta_{\downarrow}(r_{j},\kappa)\big{]}$.
The total xc energy is calculated by summing over the local energies:

$E_{\mathrm{xc}}\left[\rho_{\uparrow},\rho_{\downarrow}\right]=\sum_{j}\rho(r_{j})\,\epsilon^{\theta}_{\mathrm{loc}}\big{[}\eta_{\uparrow}(r_{j},\kappa),\eta_{\downarrow}(r_{j},\kappa)\big{]}\,.$
(3)

Here, $\theta$ denotes the trainable parameters. The input channels can be the
total electronic density $\rho=\rho_{\uparrow}+\rho_{\downarrow}$ or the spin
densities $\rho_{\uparrow}$ and $\rho_{\downarrow}$. The corresponding xc
potentials can be computed using automatic differentiation, as shown in Ref.
Schmidt  _et al._ (2019). The parameters of the neural network are updated
according to the loss function:

$\displaystyle\mathcal{L}(\theta;\alpha,\beta)$
$\displaystyle=\alpha\,\mathrm{MSE}(v^{\uparrow}_{\mathrm{xc}}[\rho_{\uparrow},\rho_{\downarrow}],v^{\downarrow}_{\mathrm{xc}}[\rho_{\uparrow},\rho_{\downarrow}])$
$\displaystyle\qquad+\beta\,\mathrm{MSE}(E_{\mathrm{xc}}[\rho_{\uparrow},\rho_{\downarrow}])\,,$
(4)

where $\alpha$ and $\beta$ are fixed weights that can be adjusted to expedite
convergence, and MSE is the mean squared error. A more detailed description of
our networks can be found in the Methods section.

We improve the performance of this architecture by (i) training our neural
network with non-integer densities, (ii) introducing the jump of the xc
potential at integer numbers into the loss function, and (iii) adding an
explicit discontinuity at integer electron numbers. In the following we
discuss the details of these new approaches.

###  II.1 Fractional particle numbers

Figure 1:  Comparison of the total energy for a certain external potential
(top) as well as its derivative with respect to the particle number (bottom)
for two different models: Model A has been trained with integer densities
only. Model B has been trained with fractional densities, the exact
$\Delta_{\mathrm{xc}}$-shift, and employs the AF (see text).

In general, neural networks do not extrapolate well outside the distribution
of the samples used for their training . Consequently, we can not expect that
machines trained solely for integer densities (as usually done) will exhibit
the correct linear behaviour of the energy. To illustrate this behavior we
plot, in Fig. 1, the total energy calculated with a neural network trained
solely with integer densities (model A in the figure) as a function of the
number of particles for a 1-dimensional system. Besides the fact that model A
is far from linear, we can also note that the sign of the curvature is not
constant, with both concave and convex parts. This is somehow to be expected,
as the network, in contrast to the usual xc functionals, only incorporates
physical knowledge through the training examples with integer densities. As
such, we can easily see that approaches such as LDA-$1/2$ are bound to fail in
this case.

As a first strategy to solve this problem, we decided to include samples
calculated within ensemble-DFT at fractional densities in our training. To
obtain this data we created a set of total energies and electronic densities
for a series of 1-dimensional exact calculations. We then constructed ensemble
densities and inverted the ensemble Kohn-Sham equations, in order to compute
the exact xc energy and potential for these systems. We used an inversion
algorithm based on Ref. Kanungo  _et al._ (2019) that we extended for both
spin-DFT von Barth and Hedin (1972) and to ensemble systems. As a result, we
created exact training and testing data with particle numbers between 1 and 3
electrons, that we used to train our models.

Figure 2:  Comparison of the mean absolute error (MAE) of the total energy
between two different models (averaged over 100 external potentials). The
model “FDs” (blue) includes fractional densities
$\epsilon=(0.05,0.2,0.5,0.8,0.95)$ in the training. The second model (red)
includes only integer densities in the training. Both models were trained
within the spin-DFT framework.

In Fig. 2 we compare the mean absolute error (MAE) of the total energy for a
functional trained with fractional densities (blue) and a functional trained
only for systems with integer densities (red) (averaged over a test set of 100
external potentials). As we can see, the model trained at integer densities
yields an excellent prediction for the total energy at those integers, but
exhibits a considerably larger error at fractional numbers. Remarkably, by
simply adding fractional densities to the training set, the error decreases by
more than one order of magnitude, and the MAE over the entire $[1,3]$-range
remains below $2\times 10^{-3}$ a.u. We note in passing that we trained the
networks both for spin-restricted and spin-unrestricted DFT with similar
results. As such, we decided to use the spin-restricted formalism in the
following.

While this strategy resolved, to a large extent, the many-electron self-
interaction error, a problem still remains in the vicinity of the integer
particle numbers. In fact, our network is fully differentiable, and does not
(in fact can not) exhibit a true derivative discontinuity (in a mathematical
sense) as a function of $N$.

###  II.2 Jump in the xc potential

We can easily relate the discontinuity of the total energy at integer particle
numbers with an uniform shift in the potential. Indeed, the exact uniform
shift $\Delta^{N}_{\mathrm{xc}}$ of $v_{\mathrm{xc}}$ at integer particle
number $N$ obeys the relation Hellgren and Gross (2012):

$\left.\frac{\partial E}{\partial N}\right|_{+}-\left.\frac{\partial
E}{\partial N}\right|_{-}=\varepsilon^{N}_{\rm s}+\Delta^{N}_{\rm xc}\,,$ (5)

where $\varepsilon^{N}_{\rm s}$ is the Kohn-Sham gap, i.e. the difference
between the lowest unoccupied (LUMO) and the highest occupied (HOMO) molecular
orbital energies. Noticeably, $E(N)$ and $E(N\pm 1)$, as well as the
eigenvalues corresponding to the LUMO and HOMO can be computed while creating
the training sets.

Our second strategy consists of computing, in our learning process, both
$\rho_{N+\epsilon}$, and the exact shift
$v_{\mathrm{xc}}(N_{+})-v_{\mathrm{xc}}(N_{-})$. The corresponding mean
squared error is then used to extend the loss function in Eq. (4)

$\mathcal{L}\rightarrow\mathcal{L}+\lambda\,\mathrm{MSE}(v_{\mathrm{xc}}(N+\epsilon)-v_{\mathrm{xc}}(N))\,,$
(6)

where $\lambda$ is an additional hyperparameter.

We expect that this extended loss function can help the functional to learn
the correct shift in the derivative. Unfortunately training our basic SWC
network with this loss function failed for any learning rate tested. This can
be understood from the fact that our network is still fully differentiable,
and can not be forced to learn a discontinuous function. It is clear that to
resolve this issue we have to allow explicitly for a discontinuous behaviour
in the neural network topology.

###  II.3 Incorporating the discontinuity

Figure 3: Integration of the non-differentiable auxiliary function
$u\left[\rho_{\uparrow},\rho_{\downarrow}\right]$ as a third channel to the
basic SWC unit. The input data contains two channels for both spin-densities
$\rho_{\uparrow}$ and $\rho_{\downarrow}$ respectively.

An intuitive way to introduce a discontinuity in the derivatives of the neural
network is to use non-differentiable activation functions (e.g., the rectified
linear unit Nair and Hinton (2010)). But there is no obvious reason why a non-
differentiability at integer particle numbers will appear – and these networks
will most likely become non-differentiable with respect to the density $\rho$.
To overcome this problem we take an alternative route: We define an auxiliary
function (AF), which we force to be non-differentiable at all integer particle
numbers:

$\displaystyle u\left[\rho_{\uparrow},\rho_{\downarrow}\right]$
$\displaystyle=a+\frac{\left|\sin(\pi\tilde{n})\right|}{\tilde{n}+b}\sum_{j}u^{\theta^{\prime}}_{\mathrm{loc}}\big{[}\eta_{\uparrow}(r_{j},\kappa),\eta_{\downarrow}(r_{j},\kappa)\big{]}\,,$

where $\tilde{n}=\int(\rho_{\uparrow}+\rho_{\downarrow})\,\mathrm{d}r$ is the
(fractional) number of particles and $a$ and $b$ are arbitrary positive
constants. Notice that the non-differentiability of the AF comes from the non-
differentiability of the function $|\sin(\pi\tilde{n})|$. The local functions
$u^{\theta^{\prime}}_{\text{loc }}$ are obtained by using another SWC neural
network. We then replace the functional
$E_{\mathrm{xc}}\left[\rho_{\uparrow},\rho_{\downarrow}\right]$ in Eq. (3) by
$E^{\prime}_{\mathrm{xc}}[\rho_{\uparrow},\rho_{\downarrow}]\equiv
E_{\mathrm{xc}}\left[\rho_{\uparrow},\rho_{\downarrow},u\left[\rho_{\uparrow},\rho_{\downarrow}\right]\right]$,
where the additional channel has been appended to the spin channels. Here each
point carries the (same) information of the value of the non-differentiable AF
as illustrated in Fig. 3. As we show below, this procedure ensures that the
machine can learn the non-differentiable function in an efficient manner.

Figure 4:  Comparison of the derivatives of the energy with respect to the
particle number $N$ for three different models evaluated at a randomly chosen
external potential: the first model uses only fractional densities, the second
incorporates the exact xc shift in the loss function, and the third one uses a
non-differentiable AF, in addition to the exact xc shift and the fractional
densities. Figure 5:  Comparison between the predicted jump of the xc
potential at $N=2$ for Model A and Model B (as explained in the main text).
The results correspond to the same external potential used in Fig. 1.

To study the performance of our approach, Fig. 4 presents the predicted
derivative of the total energy for three different training models: (1) a
model trained only with fractional densities, (2) a model using the AF in the
network architecture and trained with fractional densities, and (3) a model
using the AF, the shift in the loss function and fractional densities. First,
we should note that the inclusion of the AF solved the training problems
discussed in the previous section. As expected, the first model does not
predict the correct derivative discontinuity, despite yielding very good
errors at fractional particle numbers. While the second model already
demonstrates major improvements, especially at $N=2$, our most important
finding is that the third model does exhibit a remarkable agreement with the
exact results.

In Fig. 1 the energy as a function of the particle number is displayed for two
models: (A) a model trained with integer densities only and (B) a model using
fractional densities, the shift in the loss function and the AF. The situation
is clearly much better for model B, as the energy is very close to linear
between integers and shows a cusp at $N=2$. As shown in Fig. 5, this model is
also able to reproduce the correct jump in the xc potential: Here we display
the xc potentials and densities for a randomly selected external potential at
2 and 2.01 electrons. On the left panel of Fig. 5 we can see that the xc
potential of the basic model A is correct at 2 electrons but barely changes
when going from 2 to 2.01. Model B, on the other hand, shows the correct
uniform shift in its xc potential.

##  III Conclusions

We trained a neural network as an exchange correlation functional that (i)
depends explicitly on the number of particles; (ii) yields total energies that
are piece-wise linear between the integers and (iii) reproduces the infamous
derivative discontinuity of the exchange-correlation energy with remarkable
accuracy. To do so we extended the sliding window convolution algorithm to
systems with fractional number of particles, and developed a non-
differentiable auxiliary function that allows the network to learn correctly
the derivative discontinuity. The most efficient way to train a model yielding
highly accurate predictions for the energy in the entire range of particle
numbers is by (i) adding multiple fractional densities into the training data,
(ii) training for the correct shift in the xc potential at integer particle
numbers, and (iii) incorporating an auxiliary function with a discontinuous
derivative with respect to the particle number at integers.

Our work pushes forward the on-going research on machine-learning functionals
by incorporating the correct physics into the training process, thereby
improving the path towards an exact functional Medvedev  _et al._ (2017). As
an outlook, we think it will be important to incorporate and test our results
for realistic 3D systems. We also expect that our results can stimulate
research on similar problems for ensemble DFT (understood as mixtures of
ground and excites states), orbital free DFT or functional theories of reduced
density matrices Senjean and Fromager (2018); Loos and Fromager (2020);
Benavides-Riveros  _et al._ (2020); Kraisler and Schild (2020); Cioslowski
(2020).

##  IV Methods

In this section we present all methods and computational details necessary to
arrive at our results. First we discuss the generation of the training data
and second the details of the network implementation.

###  IV.1 Exact calculations

To train and test our models we created a set of 1-dimensional exact
calculations and Kohn-Sham inversions. We sampled 1500 external (Coulomb-)
potentials and computed the exact electronic ground state densities as well as
the corresponding energies by solving the eigenvalue problem for the
electronic Hamiltonian

$H=-\sum_{i=1}^{N}\frac{\mathbf{\nabla}_{i}^{2}}{2}-\sum_{j=1}^{K}\sum_{i=1}^{N}\frac{Z_{j}}{\sqrt{1+\left|R_{j}-r_{i}\right|^{2}}}\\\
+\sum_{i<j}\frac{1}{\sqrt{1+\left|r_{i}-r_{j}\right|^{2}}}\,,$ (7)

where $K$ is the total number of nuclei, the variables $R_{j}$ and $Z_{j}$
denote the position and charge of the $j$th nuclei respectively,
$N\in\\{1,2,3\\}$ is the total number of electrons, and $r_{i}$ is the
position of the $i$th electron. We solve the exact ground-state problem with
Octopus Andrade  _et al._ (2015), using a grid spacing of $0.1$ a.u. and a box
size of 23 a.u. (leading to a grid with 231 points). To circumvent the
integrability problem of the Coulomb interaction in 1D we used a softened
interaction. The total number of nuclei $K$ were set to be 1, 2 or 3, such
that their individual charges satisfy $\sum_{k}Z_{k}=3$. Their positions were
randomly distributed with $|R_{k}|\leq 4$ a.u.

###  IV.2 Spin densities

As Octopus Andrade  _et al._ (2015) only provides directly spin-densities and
wave-functions for two-particle systems we now discuss the problem of
obtaining the spin densities for the three particle systems.

We start by noticing that solving the eigenvalue problem $\hat{H}\Phi=E\Phi$
for the Hamiltonian (7) yields all many-particle solutions, including both
fermionic and bosonic states. A spin-adapted fermionic solution of the form
$\Psi\left(r_{1}\sigma_{1},\ldots,r_{N}\sigma_{N}\right)$ can be obtained by
projecting any spatial solution $\Phi$ on the Young diagrams belonging to
certain spin quantum numbers ($S$, $M$), with $S$ being the total spin and
$M=\sum_{i}\sigma_{i}$ Pauncz (2000); Whitfield (2013). For a detailed
description we refer to Pauncz (2000); Greiner (1994); McWeeny (1992). Let us
denote a set of $f$ primitive, degenerated, but orthogonal spin functions as
$\\{X(N,S,M;i)\\}_{i=1\cdots f}$. A permutation $\mathbf{P}$ acting on a spin
function can be expressed as a linear combination of all primitive spin
functions:

$\mathbf{P}X(N,S,M;i)=\sum_{j=1}^{f}X(N,S,M;j)U(P)_{ji}^{S}\,.$ (8)

The expansion coefficients $U(P)_{ji}^{S}$ can be calculated using the
orthogonality of $X(N,S,M;j)$ Porter (2009). By taking into account the
antisymmetrization $\mathcal{A}=\frac{1}{\sqrt{N!}}\sum_{P}(-1)^{P}\mathbf{P}$
of the product of the spin and spatial parts $\Phi X(N,S,M;i)$ one obtains a
sum of products of spatial and spin functions, as follows:

$\displaystyle\Psi_{i}$ $\displaystyle=\mathcal{A}\Phi X(N,S,M;i)$
$\displaystyle=\frac{1}{\sqrt{N!}}\sum_{P}(-1)^{p}\mathbf{P}^{r}\Phi\mathbf{P}^{\sigma}X(N,S,M;i)$
$\displaystyle=\frac{1}{\sqrt{f}}\sum_{j=1}^{f}X(N,S,M;j)\Phi_{ji}^{S}\,,$ (9)

where $\mathbf{P}^{r}$ and $\mathbf{P}^{\sigma}$ denote that the permutations
operates on spatial and spin coordinates respectively, and

$\Phi_{ji}^{S}=\sqrt{\frac{f}{N!}}\sum_{P}U(P)_{ji}^{S}(-1)^{p}\mathbf{P}^{r}\Phi\left(\mathbf{r}_{1},\ldots,\mathbf{r}_{N}\right)\,.$
(10)

For the ground state of $N=3$ two linear independent spin-eigenfunctions can
be chosen:

$\displaystyle X\left(3,\nicefrac{{1}}{{2}},\nicefrac{{1}}{{2}};1\right)$
$\displaystyle=\frac{1}{\sqrt{6}}\bigl{[}2\uparrow\uparrow\downarrow-(\uparrow\downarrow\uparrow+\downarrow\uparrow\uparrow)\bigr{]}\,,$
(11a) $\displaystyle
X\left(3,\nicefrac{{1}}{{2}},\nicefrac{{1}}{{2}};2\right)$
$\displaystyle=\frac{1}{\sqrt{2}}\bigl{(}\uparrow\downarrow\uparrow-\downarrow\uparrow\uparrow\bigr{)}\,.$
(11b)

The (normalized) spatial parts in Eq. (9) and the corresponding spin densities
$\rho_{\uparrow}(x)$ and $\rho_{\downarrow}(x)$ can then be found. For
instance,

$\displaystyle\rho_{\uparrow}(x)$
$\displaystyle=\iint\Bigl{[}5|\tilde{\Phi}_{1}|^{2}+9|\tilde{\Phi}_{2}|^{2}\Bigr{]}(\mathrm{d}x_{2}\mathrm{d}x_{3}+\mathrm{d}x_{1}\mathrm{d}x_{3})$
$\displaystyle\qquad\quad+\iint\Bigl{[}2|\tilde{\Phi}_{1}|^{2}+18|\tilde{\Phi}_{2}|^{2}\Bigr{]}\mathrm{d}x_{1}\mathrm{d}x_{2}\,,$
(12)

with $\tilde{\Phi}_{1}=2\,\Phi^{S=\nicefrac{{1}}{{2}}}_{11}$ and
$\tilde{\Phi}_{2}=2\Phi^{S=\nicefrac{{1}}{{2}}}_{21}/\sqrt{3}$.

Figure 6: Densities and corresponding xc potentials for a certain external
potential for different integer particle numbers. Figure 7: Densities and
corresponding xc potentials for a certain external potential for different
fractional particle numbers.

###  IV.3 Kohn-Sham inversion

For the inversion of the densities we used the optimization algorithm proposed
in Ref. Kanungo  _et al._ (2019), that casts the inverse DFT problem of
finding the $v_{\mathrm{xc}}(\bm{r})$ that yields a given density
$\rho(\bm{r})$ as a constrained optimization problem. The conjugate gradient
method was used to update the xc potentials
$v_{\mathrm{xc}}^{\sigma}(\bm{r})$. A constant weight function $w\equiv 1$ was
also used.

The densities of $N=1,2,3$ particles were mixed, allowing us to generate a
fractional densities for each external potential. For instance, the set
$\\{1,1.5,2,2.5,3\\}$ contains additional $\epsilon=0.5$ fractional densities
beside the integer ones. If the inversion algorithm did not converge to a MSE
below $1.5\times 10^{-7}$ for a given density, we removed all samples
corresponding to that external potential. The computed xc potentials were
shifted by a constant to be in agreement with Koopman’s theorem Gritsenko and
Baerends (2002).

In Fig. 6 we show a few examples of such spin-densities and inverted xc
potentials. For the fractional densities plotted in Fig. 7 the shift of the xc
potential caused by the $\Delta_{\mathrm{xc}}$ jump is clearly visible.

###  IV.4 Network implementation

The neural networks were implemented in pytorch Paszke  _et al._ (2019) using
pytorch-lightning Falcon  _et al._ (2019) to simplify the training process. As
discussed before we used the sliding window convolution as proposed in Ref.
Schmidt  _et al._ (2019). For each network the number of zero-paddings at the
system’s boundaries was set to $(\kappa-1)/2$ ($\kappa$ is an odd number in
our calculations). For all models presented in this paper, we chose a kernel
size of $\kappa=201$, corresponding to highly nonlocal funtionals. Each local
density was fed into a fully connected network with SILU Hendrycks and Gimpel
(2020) activation functions, and the output layer returned the local functions
described in the previous sections. The use of SILU activation functions
guaranteed the smoothness of the exchange correlation potential and its higher
order derivatives. All hidden layer sizes were set to 32. Including the window
convolution we used 4 hidden layers. The additional SWC unit for the AF shared
the same hyperparameters. The network weights were optimized with Adam while
using a cyclic learning rate scheduler. We used a learning rate of $7\times
10^{-4}$ with a batch size of 30. The only exceptions were models trained with
the xc-jump in the loss function. In this case each batch contained one
density, corresponding to a random external potential. If the
$\Delta_{\mathrm{xc}}$-shift was incorporated in the loss function, the
densities per batch consisted of all fractional densities of a certain
external potential. For these networks we kept the learning rate used before,
but changed the batch size to one. The models were trained for $30\,000$
epochs and the model with the best validation loss was selected for testing.

## References

  * Hohenberg and Kohn (1964) P. Hohenberg and W. Kohn, Phys. Rev. 136, B864 (1964).
  * Jones (2015) R. O. Jones, Rev. Mod. Phys. 87, 897 (2015).
  * Kohn and Sham (1965) W. Kohn and L. Sham, Phys. Rev. 140, A1133 (1965).
  * Lehtola  _et al._ (2018) S. Lehtola, C. Steigemann, M. J. Oliveira, and M. A. Marques, SoftwareX 7, 1 (2018).
  * Perdew and Schmidt (2001) J. Perdew and K. Schmidt, AIP Conf. Proc. 577, 1 (2001).
  * Deng and Li (2013) L. Deng and X. Li, IEEE-ACM T. Audio Spe. 21, 1060 (2013).
  * Kalita  _et al._ (2021) B. Kalita, L. Li, R. J. McCarty, and K. Burke, Acc. Chem. Res. 54, 818 (2021).
  * Brockherde  _et al._ (2017) F. Brockherde, L. Vogt, L. Li, M. Tuckerman, K. Burke, and K.-R. Müller, Nat. Comm. 8, 872 (2017).
  * Li  _et al._ (2021) L. Li, S. Hoyer, R. Pederson, R. Sun, E. Cubuk, P. Riley, and K. Burke, Phys. Rev. Lett. 126, 036401 (2021).
  * Margraf and Reuter (2021) J. Margraf and K. Reuter, Nature Comm. 12, 344 (2021).
  * Moreno  _et al._ (2020) J. R. Moreno, G. Carleo, and A. Georges, Phys. Rev. Lett. 125, 076402 (2020).
  * Ryczko  _et al._ (2019) K. Ryczko, D. A. Strubbe, and I. Tamblyn, Phys. Rev. A 100, 022512 (2019).
  * Schmidt  _et al._ (2019) J. Schmidt, C. L. Benavides-Riveros, and M. A. L. Marques, J. Phys. Chem. Lett. 10, 6425 (2019).
  * Nagai  _et al._ (2020) R. Nagai, R. Akashi, and O. Sugino, npj Comput. Mater. 6, 43 (2020).
  * Denner  _et al._ (2020) M. M. Denner, M. H. Fischer, and T. Neupert, Phys. Rev. Research 2, 033388 (2020).
  * Lieb (1983) E. Lieb, Int. J. Quantum Chem. 24, 243 (1983).
  * Ludeña and Karasiev (2002) E. Ludeña and V. Karasiev, Kinetic energy functionals: History, challenges and prospects, in  _Reviews of Modern Quantum Chemistry_, edited by K. Sen (World Scientific, 2002) pp. 612–665.
  * Kraisler and Kronik (2013) E. Kraisler and L. Kronik, Phys. Rev. Lett. 110, 126403 (2013).
  * Sham and Schlüter (1983) L. J. Sham and M. Schlüter, Phys. Rev. Lett. 51, 1888 (1983).
  * Perdew  _et al._ (1982) J. Perdew, R. Parr, M. Levy, and J. Balduz, Phys. Rev. Lett. 49, 1691 (1982).
  * Grüning  _et al._ (2006) M. Grüning, A. Marini, and A. Rubio, Phys. Rev. B 74, 161103 (2006).
  * Andrade and Aspuru-Guzik (2011) X. Andrade and A. Aspuru-Guzik, Phys. Rev. Lett. 107, 183002 (2011).
  * Hodgson  _et al._ (2017) M. J. P. Hodgson, E. Kraisler, A. Schild, and E. K. U. Gross, J. Phys. Chem. Lett. 8, 5974 (2017).
  * Mirtschink  _et al._ (2013) A. Mirtschink, M. Seidl, and P. Gori-Giorgi, Phys. Rev. Lett. 111, 126402 (2013).
  * Mori-Sánchez and Cohen (2014) P. Mori-Sánchez and A. Cohen, Phys. Chem. Chem. Phys. 16, 14378 (2014).
  * Mosquera and Wasserman (2014) M. Mosquera and A. Wasserman, Mol. Phys. 112, 2997 (2014).
  * Baerends (2020) E. J. Baerends, Mol. Phys. 118, e1612955 (2020).
  * Perdew (1985) J. Perdew, in  _Density Functional Methods In Physics_, edited by R. Dreizler and J. d. Providência (Plenum Press, 1985) pp. 265–308.
  * Cohen  _et al._ (2012) A. J. Cohen, P. Mori-Sánchez, and W. Yang, Chem. Rev. 112, 289 (2012).
  * Yang  _et al._ (2000) W. Yang, Y. Zhang, and P. Ayers, Phys. Rev. Lett. 84, 5172 (2000).
  * Perdew and Levy (1983) J. Perdew and M. Levy, Phys. Rev. Lett. 51, 1884 (1983).
  * Eich and Hellgren (2014) F. Eich and M. Hellgren, J. Chem. Phys. 141, 224107 (2014).
  * Kümmel and Kronik (2008) S. Kümmel and L. Kronik, Rev. Mod. Phys. 80, 3 (2008).
  * Ruzsinszky  _et al._ (2006) A. Ruzsinszky, J. Perdew, G. Csonka, O. Vydrov, and G. Scuseria, J. Chem. Phys. 125, 194112 (2006).
  * Perfetto and Stefanucci (2012) E. Perfetto and G. Stefanucci, Phys. Rev. B 86, 081409 (2012).
  * Li and Yang (2017) C. Li and W. Yang, J. Chem. Phys. 146, 074107 (2017).
  * Slater and Johnson (1972) J. C. Slater and K. H. Johnson, Phys. Rev. B 5, 844 (1972).
  * Ferreira  _et al._ (2008) L. G. Ferreira, M. Marques, and L. K. Teles, Phys. Rev. B 78, 125116 (2008).
  * Baerends (2018) E. J. Baerends, J. Chem. Phys. 149, 054105 (2018).
  * Hait and Head-Gordon (2018) D. Hait and M. Head-Gordon, J. Phys. Chem. Lett. 9, 6280 (2018).
  * Cohen  _et al._ (2008) A. Cohen, P. Mori-Sánchez, and W. Yang, Science 321, 792 (2008).
  * Mori-Sánchez  _et al._ (2008) P. Mori-Sánchez, A. J. Cohen, and W. Yang, Phys. Rev. Lett. 100, 146401 (2008).
  * Benavides-Riveros  _et al._ (2017) C. L. Benavides-Riveros, N. N. Lathiotakis, and M. A. L. Marques, Phys. Chem. Chem. Phys. 19, 12655 (2017).
  * Kanungo  _et al._ (2019) B. Kanungo, P. M. Zimmerman, and V. Gavini, Nature Comm. 10, 4497 (2019).
  * von Barth and Hedin (1972) U. von Barth and L. Hedin, J. Phys. C 5, 1629 (1972).
  * Hellgren and Gross (2012) M. Hellgren and E. K. U. Gross, Phys. Rev. A 85, 022514 (2012).
  * Nair and Hinton (2010) V. Nair and G. Hinton (2010) pp. 807–814.
  * Medvedev  _et al._ (2017) M. Medvedev, I. Bushmarinov, J. Sun, J. Perdew, and K. Lyssenko, Science 355, 49 (2017).
  * Senjean and Fromager (2018) B. Senjean and E. Fromager, Phys. Rev. A 98, 022513 (2018).
  * Loos and Fromager (2020) P.-F. Loos and E. Fromager, J. Chem. Phys. 152, 214101 (2020).
  * Benavides-Riveros  _et al._ (2020) C. L. Benavides-Riveros, J. Wolff, M. A. L. Marques, and C. Schilling, Phys. Rev. Lett. 124, 180603 (2020).
  * Kraisler and Schild (2020) E. Kraisler and A. Schild, Phys. Rev. Research 2, 013159 (2020).
  * Cioslowski (2020) J. Cioslowski, J. Chem. Phys. 153, 154108 (2020).
  * Andrade  _et al._ (2015) X. Andrade _et al._ , Phys. Chem. Chem. Phys. 17, 31371 (2015).
  * Pauncz (2000) R. Pauncz,  _The Construction of Spin Eigenfunctions_ (CRC Press, 2000).
  * Whitfield (2013) J. Whitfield, J. Chem. Phys. 139, 021105 (2013).
  * Greiner (1994) W. Greiner,  _Quantum Mechanics. Symmetries_ (Springer, 1994).
  * McWeeny (1992) R. McWeeny,  _Methods of molecular quantum mechanics_ (Academic Press, 1992).
  * Porter (2009) F. Porter, Group Theory (2009).
  * Gritsenko and Baerends (2002) O. Gritsenko and E. Baerends, J. Chem. Phys. 117, 9154 (2002).
  * Paszke  _et al._ (2019) A. Paszke _et al._ , in  _Advances in Neural Information Processing Systems 32_ (Curran Associates, Inc., 2019) pp. 8024–8035.
  * Falcon  _et al._ (2019) W. A. Falcon _et al._ , GitHub. Note: https://github.com/PyTorchLightning/pytorch-lightning 3 (2019).
  * Hendrycks and Gimpel (2020) D. Hendrycks and K. Gimpel, Gaussian error linear units (gelus) (2020), arXiv:1606.08415 .

##  V Competing interests

The authors declare no competing interests.


11institutetext: Fermi National Accelerator Laboratory

# Fast Reconstruction and Data Scouting

Javier Duarte orcid.org/0000-0002-5076-70960 11<EMAIL_ADDRESS>
###### Abstract

Data scouting, introduced by CMS in 2011, is the use of specialized data
streams based on reduced event content, enabling LHC experiments to record
unprecedented numbers of proton-proton collision events that would otherwise
be rejected by the usual filters. These streams were created to maintain
sensitivity to new light resonances decaying to jets or muons, while requiring
minimal online and offline resources, and taking advantage of the fast and
accurate online reconstruction algorithms of the high-level trigger. The
viability of this technique was demonstrated by CMS in 2012, when 18.8 fb-1 of
collision data at $\sqrt{s}=8$ TeV were collected and analyzed. For LHC Run 2,
CMS, ATLAS, and LHCb implemented or expanded similar reduced-content data
streams, promoting the concept to an essential and flexible discovery tool for
the LHC.

FERMILAB-CONF-18-370-CMS-E-PPD

##  1 Introduction

The Large Hadron Collider (LHC) provides proton-proton bunch crossings with a
center-of-mass energy $\sqrt{s}=13\leavevmode\nobreak\ \mathrm{TeV}$ at a
maximum rate of 40 MHz. As such, the digital readout of the LHC detectors
generate an enormous amount of raw data per bunch crossing; however, full
reconstruction of all collision events is not feasible with existing computing
resources necessitating the use of a trigger system.

At the LHC, events of interest are selected using a two-tiered trigger system
Khachatryan:2016bia ; Ruiz-Martinez:2133909 . The first level (L1), composed
of custom hardware processors, uses information from the calorimeters and muon
detectors to select events at a rate of around 100 kHz within a time interval
of 2–4 $\mu\mathrm{s}$. The second level, known as the high-level trigger
(HLT), consists of a farm of processors running a version of the full event
reconstruction software optimized for fast processing, and reduces the event
rate to around 1 kHz before data storage.

To make a trigger decision for each event, the HLT performs a real-time
(online) physics object reconstruction and applies a selection based on the
characteristics of the reconstructed objects. The full HLT algorithm is a
collection of independent trigger paths, each intended to serve a different
event selection purpose. Trigger paths consist of sequences of producer
modules, which build collections of objects; and filter modules, which reject
events that do not fulfill certain criteria. Most trigger paths contain
multiple phases of reconstruction and filtering, and generally the later
phases of reconstruction yield physics objects whose performance is closer to
that of their offline counterparts. If an event is accepted by the final
filter of any trigger path, it is accepted by the HLT.

A number of factors restrict the trigger rates that the HLT can achieve:

  * •

The amount of data storage space and the maximum throughput of the data
acquisition system (DAQ)

  * •

The capacity of the prompt reconstruction system

  * •

HLT computing resources, which limit the complexity of the online
reconstruction

Data parking in CMS, or delayed stream in ATLAS, in which selected events are
saved directly to tape with no prompt reconstruction, has also been used in
past LHC runs to increase the amount of data collected. While this strategy
circumvents the restriction on rates imposed by the offline reconstruction
system, it is limited by the other factors listed above.

In this note, we describe data scouting, a technique that leverages online
reconstruction of physics objects in order to attain extremely high trigger
rates. Scouting complements data parking by providing new opportunities for
physics analysis outside the boundaries of the traditional trigger strategy.

Data scouting was first introduced by the CMS collaboration in 2011 CMS-
DP-2012-022 ; CMS-PAS-EXO-11-094 ; Anderson:2016ron ; Mukherjee:2017wcl . The
LHCb and ATLAS collaborations implemented similar data-taking streams for LHC
Run 2 Aaij:2016rxn ; ATLAS-CONF-2016-030 ; Aaboud:2018fzt .

##  2 Data scouting: an alternative trigger paradigm

The aim of data scouting is to record physics events at the highest possible
rate while providing physics objects whose performance is suitable for offline
analysis. To do this, LHC experiments take advantage of the online
reconstruction algorithms. Trigger-level physics objects are slightly less
performant than their offline counterparts, but for certain analyses, the
difference does not significantly affect the sensitivity. Saving only the
trigger-level objects instead of the full raw detector data makes the
throughput and the size on disk much smaller.

The data scouting strategy is implemented via dedicated streams at the HLT.
Each data scouting stream contains a number of trigger paths (scouting
triggers), which perform event reconstruction and selection in the same way as
standard HLT paths. However, the selection criteria are much looser than for
standard paths and thus the rate of events passing the selection is much
greater.

For events passing one or more scouting triggers, additional online
reconstruction sequences are run in order to produce all physics objects
necessary for an offline measurement or search. The produced objects are
converted to a special compact event format and saved to disk. The data
recorded by scouting triggers is made available offline and can be used for
physics analysis. For these events, no offline reconstruction is performed,
and the raw data is not saved.

The scouting approach has the following advantages over the standard trigger
strategy:

  * •

The reduced, compact event format requires negligible space on disk and does
not place any additional strain on the DAQ system. Events are 100 to 1000
times smaller on disk than the standard raw data format.

  * •

No offline reconstruction is required; all reconstruction is performed online

  * •

Scouting trigger paths can run ‘in the shadow’ of standard HLT paths, saving
physics objects, reconstructed by the standard HLT paths even for events that
are rejected by those paths

Scouting has been used to increase the total number of LHC events recorded for
physics by a factor of 2–6 beyond what the standard trigger strategy provides.

##  3 Data scouting in CMS

The first scouting trigger was deployed at the CMS HLT during the last few
proton-proton fills of the 2011 LHC run. The trigger and associated stream
collected data equal to 0.13 fb-1. Events with $H_{\mathrm{T}}$ (defined as
the scalar sum of jet transverse momenta) larger than 350 GeV were recorded
and saved in a reduced format, containing only the set of anti-$k_{t}$ $R=0.5$
jets Cacciari:2008gp ; Cacciari:2011ma  reconstructed from particle-flow (PF)
candidates by the HLT. The data were used to perform a search for heavy
resonances decaying to dijets CMS-PAS-EXO-11-094 . The search demonstrated
sensitivity to resonances with masses between 0.6 and 0.9 TeV, a parameter
region inaccessible to the standard CMS dijet resonance search.

Subsequently, the strategy was repeated for the full 2012 CMS dataset,
lowering the scouting trigger selection to $H_{\mathrm{T}}$ > 250 GeV to
accommodate an even larger rate of events. Due to CPU concerns related to the
high rate, calorimeter jets were reconstructed and saved instead of PF jets.
The collected data, corresponding to 18.8 fb-1, were used to perform another
dijet resonance search Khachatryan:2016ecr , whose results were interpreted as
limits on the mass and coupling of a hypothetical leptophobic
$\mathrm{Z}^{\prime}$ resonance decaying to quarks.

In Run 2, the data scouting strategy was expanded, with an aim to maintain the
ability to search very low in $H_{\mathrm{T}}$ using calorimeter jets, while
also providing an event format capable of supporting a broader range of
scouting analyses. Two streams were deployed at the HLT for data taking in
2015–2018: one saving an event content based on calorimeter jets (the calo-
scouting stream) and one saving an event content based on particle-flow (PF)
jets (the PF-scouting stream). The PF algorithm CMS-PRF-14-001  aims to
reconstruct and identify each individual particle in an event, with an
optimized combination of information from the various elements of the CMS
detector. The PF jet energy resolution amounts typically to 15% at 10 GeV, 8%
at 100 GeV, and 4% at 1 TeV, to be compared to about 40%, 12%, and 5% for
calorimeter jets. In order to run the PF algorithm online within the allotted
CPU time of around $200$ ms, a speed-optimized configuration of the full CMS
track reconstruction is used TOSI20162494 .

Finally, new dedicated scouting event formats were developed, featuring a set
of minimalist C++ objects to store scouting physics objects as vectors of
basic data types, ensuring low overhead and forward compatibility with future
versions of CMS software.

###  3.1 Calo and PF-scouting streams

Triggers in the calo-scouting stream reconstruct jets from calorimeter
deposits and the main signal trigger requires $H_{\mathrm{T}}>250$ GeV. The
event content for this stream includes the reconstructed calorimeter jets, the
missing transverse momentum (MET), and $\rho$, a measure of the average energy
density in the event, as depicted in Fig. 1. Local pixel track reconstruction
provides b-tagging information for the jets. The size of this event content is
about 1.5–3 kB on average.

Similarly, triggers in the PF-scouting stream run the online version of the
full PF sequence to reconstruct selected events and the main signal trigger
selects events with $H_{\mathrm{T}}>410$ GeV. Additionally, the stream
contains a trigger path selecting events with two muons having invariant mass
above 3 GeV, both with and without a primary vertex constraint, allowing the
possibility of searches for prompt and displayed dimuon resonances. The event
content for this stream includes the reconstructed PF jets, the PF MET, the
average energy density in the event $\rho$, a collection of primary vertices,
and all PF candidates with $p_{\mathrm{T}}>0.6$ GeV. It also contains
electron, muon, and photon objects, as depicted in Fig. 1. The size of this
event content is approximately 10–15 kB per event on average.

Auxiliary prescaled trigger paths are also included both in calo and PF
streams in order to facilitate measurements of the signal trigger efficiency.
For example, the measured trigger efficiency of the calo-scouting stream as a
function of dijet invariant mass is shown in Fig. 2.

Figure 1: Calo and PF-scouting event content. The corresponding sizes per
event are approximately 1.5–3 kB and 10–15 kB, respectively

###  3.2 Monitoring stream

To facilitate comparisons of the online physics objects to their offline
reconstructed counterparts, and to use the CMS Data Quality Monitoring (DQM)
framework to monitor the scouting data, a separate monitoring stream was
deployed. This stream contains prescaled versions of all scouting triggers in
the calo-scouting and PF-scouting streams. Events selected for this stream are
both saved in the reduced scouting event format and sent to the CMS prompt
reconstruction system for offline processing, which enables detailed object-
by-object comparisons of the online and offline performance. Representative
rates and bandwidths for all CMS scouting and monitoring streams in 2016 are
shown in Tab. 1.

Data stream | Rate at 1034 cm-2 sec-1 | Bandwidth (MB/s)
---|---|---
Calo-scouting $H_{\mathrm{T}}$ signal | 3700 | 11
PF-scouting $H_{\mathrm{T}}$ signal | 720 | 9
PF-scouting dimuon signal | 480 | 6
Commissioning (PF + Calo) | 30 |  $<$1
Monitoring | 26 | 23
Table 1: CMS rates and bandwidths measured in 2016 data for various scouting
data streams. The row marked ‘Commissioning (PF + Calo)’ represents all
auxiliary (non-signal) trigger paths in either the calo-scouting or PF-
scouting streams.

##  4 Trigger-object-level object analysis in ATLAS and turbo stream in LHCb

In ATLAS, the trigger-object-level analysis (TLA) approach allows jet events
to be recorded at a peak rate of up to twice the total rate of events using
the standard approach, while using less than 1% of the total trigger bandwidth
TRIG-2016-01 . The HLT reconstructs anti-$k_{t}$ $R=0.4$ jets from groups of
contiguous calorimeter cells (topological clusters), in which each cell’s
inclusion is based on the significance of its energy deposit over calorimeter
noise PERF-2014-07 . Trigger-level jets with $p_{\mathrm{T}}>20$ GeV are
stored, including a set of calorimeter variables characterizing the jet ATLAS-
CONF-2015-029 , such as information about the jet quality and structure. The
size of these events is less than 0.5% of the size of full events. All events
containing at least one L1 jet with $E_{\mathrm{T}}>100$ GeV are selected and
recorded in the 2016 dataset. The gain in recorded events from ATLAS TLA is
shown in Fig. 2.

At the beginning of LHC Run 2, LHCb, with its upgraded computing
infrastructure and a more efficient use of the Event Filter Farm (EFF) storage
of 5.2 PB, began providing resources for an online reconstruction with a
similar quality to that of the offline reconstruction. This is achieved
through real-time automated calculation of the final calibrations of the sub-
detectors. In the _turbo stream_ , a compact event record is written directly
from the trigger and is prepared for physics analysis by the Tesla
application. Using the turbo stream, LHCb was able to record
$J/\psi\to\mu^{+}\mu^{-}$ candidates with invariant masses $m(\mu^{+}\mu^{-})$
within 150 MeV of the known value and measure the forward $J/\psi$ production
cross section Aaij:2015rla . The LHCb turbo stream was also used to measure
prompt charm production cross sections Aaij:2015bpa .

Figure 2: Comparison between event acceptance for offline jets and trigger-
level jets for ATLAS (left) and calo-scouting trigger efficiency for CMS
(right).

##  5 Dijet resonance searches in CMS and ATLAS

CMS data collected in the calo-scouting stream in 2012 and 2016 were used to
perform searches for dijet resonances with masses in the range 0.5–1.6
Khachatryan:2016ecr  and 0.6–1.6 TeV Sirunyan:2018xlo , respectively. The 2016
search was carried out with 27 fb-1 of pp collision events111The L1
$H_{\mathrm{T}}$ triggers suffered an inefficiency in 9 fb-1 of data at the
end of the run. satisfying the $H_{\mathrm{T}}>250$ GeV trigger requirement.
Geometrically close anti-$k_{t}$ $R=0.4$ jets are combined into two “wide
jets” with a jet radius of $R=1.1$ and the dijet invariant mass is required to
be $m_{\mathrm{jj}}>0.49$ TeV. Background from $t$-channel dijet events is
suppressed by requiring $|\delta\eta_{\mathrm{jj}}|<1.3$.

The jet energy scale of the HLT calorimeter jets was calibrated to be the same
as the jet energy scale of the offline PF jets using the monitoring dataset
and a dijet balance “tag-and-probe” method Khachatryan:2016kdb .

Fig. 3 shows the parametric fits to the scouting dijet mass spectra in both
2012 and 2016.

Figure 3: Parametric fits of CMS low-mass calo-scouting 2012 data (left)
Khachatryan:2016ecr  and 2016 data (right) Sirunyan:2018xlo .

The analogous dijet search in ATLAS used 29.3 fb-1 of 2015 and 2016 data and
required at least two trigger-level jets with leading (subleading)
$p_{\mathrm{T}}>220$ ($85$) GeV and $|\eta|<2.8$. The analysis search for
dijet resonances with a masses between 450 GeV and 1800 GeV. To search for
resonances with $700<m_{\mathrm{jj}}<1800$ GeV, events are required to have
$|y^{\ast}|<0.6$, where $y^{\ast}=(y_{1}-y_{2})/2$ and $y_{1}$ and $y_{2}$ are
the rapidities222The rapidity, $y$, is defined as
$\frac{1}{2}\log[(E+p_{z})/(E-p_{z})]$ of the highest- and second-
highest-$p_{\mathrm{T}}$ trigger-level jets. To search for lower-mass
resonances, with $m_{\mathrm{jj}}>450$ GeV, events with $|y^{\ast}|<0.3$ are
selected from the 2015 data sample.

The trigger-level jet energy and direction are corrected to those of simulated
particle-level jets built from stable particles, excluding muons and
neutrinos. The custom calibration recipe includes the standard calibrations
applied to offline jets as well as any residual difference between trigger-
level jets and offline jets is accounted for in a dedicated trigger-to-offline
correction, based on the $p_{\mathrm{T}}$ response and derived from data in
bins of jet $\eta$ and $p_{\mathrm{T}}$. After the full calibration procedure,
the energy of trigger-level jets is equivalent to that of offline jets to
better than 0.05% for invariant masses of 400 GeV.

Finally, the SM background distribution is determined using a sliding-window
fit EXOT-2016-21  as shown in Fig. 4.

Figure 4: Sliding window fits of ATLAS trigger-object-level analysis in 2015
and 2016 data Aaboud:2018fzt .

Upper limits on the coupling as a function of mass for a model of a
leptophobic $\mathrm{Z}^{\prime}$ resonance with a universal quark coupling,
$g^{\prime}_{\mathrm{q}}$ Dobrescu:2013coa ; Abercrombie:2015wmb ;
Boveia:2016mrp  are derived for both analyses. The interaction Lagrangian for
this model is

$\displaystyle\mathcal{L}_{\mathrm{Z}^{\prime}}$
$\displaystyle=\sum_{\mathrm{q}}g^{\prime}_{\mathrm{q}}\mathrm{Z}^{\prime}_{\mu}\bar{\mathrm{q}}\gamma^{\mu}\mathrm{q}\leavevmode\nobreak\
.$ (1)

A summary of the constraints from these searches as well as others is shown in
Fig. 5. In particular, the impact of the scouting and trigger-level analyses
on the $g^{\prime}_{\mathrm{q}}$ sensitivity can be seen for masses between
$0.45$ and $1$ TeV. Over this mass range, the sensitivity to the coupling to
the universal quark coupling is improved by a factor of two or more compared
to pre-LHC searches.

Figure 5: Summary of 95% CL upper bounds on the universal quark coupling for a
leptophobic $\mathrm{Z}^{\prime}$ mediator.

##  6 Summary

Data scouting allows physics events to be collected at a rate dramatically
higher than what is nominally achievable with the standard LHC trigger
systems. It is implemented with no changes needed to the basic software-based
high-level-trigger infrastructure and does not place an additional strain on
the DAQ, disk resources, or the reconstruction system.

In CMS, the two scouting streams deployed for Run 2 of the LHC strike a
balance between specialization and versatility, with one stream oriented
towards dijet resonance searches and the other designed to support arbitrary
searches based on hadronic final states. The first physics results using the
LHC Run 2 data scouting have been published from CMS, ATLAS, and LHCb, and it
is hoped that analyzers will take full advantage of this tool to search in
other previously unexplored regions at the LHC.

## References

  * (1) V. Khachatryan et al. (CMS), JINST 12, P01020 (2017), 1609.02366
  * (2) A. Ruiz-Martinez, A. Collaboration, Tech. Rep. ATL-DAQ-PROC-2016-003, CERN, Geneva (2016), https://cds.cern.ch/record/2133909
  * (3) Tech. rep. (2012), https://cds.cern.ch/record/1480607
  * (4) Tech. Rep. CMS-PAS-EXO-11-094, CERN, Geneva (2012), https://cds.cern.ch/record/1461223
  * (5) D. Anderson (CMS), _Data Scouting in CMS_ , in _Proceedings, 38th International Conference on High Energy Physics (ICHEP 2016): Chicago, IL, USA, August 3-10, 2016_ (2016), Vol. ICHEP2016, p. 190
  * (6) S. Mukherjee (CMS), _Data Scouting : A New Trigger Paradigm_ , in _5th Large Hadron Collider Physics Conference (LHCP 2017) Shanghai, China, May 15-20, 2017_ (2017), 1708.06925, https://inspirehep.net/record/1618341/files/arXiv:1708.06925.pdf
  * (7) R. Aaij et al., Comput. Phys. Commun. 208, 35 (2016), 1604.05596
  * (8) Tech. Rep. ATLAS-CONF-2016-030, CERN, Geneva (2016), http://cds.cern.ch/record/2161135
  * (9) M. Aaboud et al. (ATLAS) (2018), 1804.03496
  * (10) M. Cacciari, G.P. Salam, G. Soyez, JHEP 04, 063 (2008), 0802.1189
  * (11) M. Cacciari, G.P. Salam, G. Soyez, Eur. Phys. J. C 72, 1896 (2012), 1111.6097
  * (12) V. Khachatryan et al. (CMS), Phys. Rev. Lett. 117, 031802 (2016), 1604.08907
  * (13) A.M. Sirunyan et al. (CMS), JINST 12, P10003 (2017), 1706.04965
  * (14) M. Tosi, Nuclear and Particle Physics Proceedings 273-275, 2494 (2016), 37th International Conference on High Energy Physics (ICHEP)
  * (15) M. Aaboud et al. (ATLAS), Eur. Phys. J. C77, 317 (2017), 1611.09661
  * (16) G. Aad et al. (ATLAS), Eur. Phys. J. C77, 490 (2017), 1603.02934
  * (17) Tech. Rep. ATLAS-CONF-2015-029, CERN, Geneva (2015), http://cds.cern.ch/record/2037702
  * (18) R. Aaij et al. (LHCb), JHEP 10, 172 (2015), [Erratum: JHEP05,063(2017)], 1509.00771
  * (19) R. Aaij et al. (LHCb), JHEP 03, 159 (2016), [Erratum: JHEP05,074(2017)], 1510.01707
  * (20) A.M. Sirunyan et al. (CMS) (2018), 1806.00843
  * (21) V. Khachatryan et al. (CMS), JINST 12, P02014 (2017), 1607.03663
  * (22) M. Aaboud et al. (ATLAS), Phys. Rev. D96, 052004 (2017), 1703.09127
  * (23) B.A. Dobrescu, F. Yu, Phys. Rev. D88, 035021 (2013), [Erratum: Phys. Rev.D90,no.7,079901(2014)], 1306.2629
  * (24) Abercrombie et al. (2015), 1507.00966
  * (25) G. Busoni et al. (2016), 1603.04156