{'fraction_non_alphanumeric': 0.023493975903614458, 'fraction_numerical': 0.005555555555555556, 'mean_word_length': 4.852330591461026, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Upgrading the Fast Calorimeter Simulation in ATLAS

The tremendous need for simulated samples now and even more so in the future, encourages the development of fast simulation techniques. The Fast Calorimeter Simulation is a faster though less accurate alternative to the full calorimeter simulation with GEANT4. It is based on parametrizing the longitudunal and lateral energy deposits of single particles in the ATLAS calorimeter. Principal component analysis and machine learning techniques are used to improve the performance and decrease the memory need compared to the current version of the ATLAS Fast Calorimeter Simulation. The parametrizations are expanded to cover very high energies and very forward detector regions, to increase the applicability of the tool. A prototype of this upgraded Fast Calorimeter Simulation has been developed and first validations with single particles show substantial improvements over the previous version.


Introduction
The success of the physics program of the ATLAS experiment [1] at the Large Hadron Collider (LHC) [2] strongly depends on the availability of simulated Monte Carlo (MC) samples with huge statistics, to accurately predict the detector response of any physics process. The increase of integrated and instantaneous luminosity resulting in a larger number of multiple-interactions (pile-up), as well as limited budgets and thus computing resources, motivate the development of fast simulation techniques. In ATLAS, about 90% of the simulation time with the Geant4 [3] program is spent in the calorimeters. This is due to the complex shower development of an incoming primary particle, during which many additional particles are created. The ATLAS Fast Calorimeter Simulation (FastCaloSim) [4] was developed to provide a parameterized calorimeter response while decreasing the simulation time in the calorimeters by about one order of magnitude. An improved version of FastCaloSim is in development, and its main components and first validations are described in this proceedings contribution. A short outline of the ATLAS simulation infrastructure is given in Section 2. Current fast simulation tools are described in Section 3. The improvements of the upgraded FastCaloSim are discussed in Section 4, and Section 5 is a summary.

The ATLAS Simulation Infrastructure
The ATLAS simulation infrastructure [5] is used to produce and validate the samples to be used in physics and performance studies. The production chain consists of the following steps: • Detector simulation: The Geant4 toolkit is used to step through the various detector volumes and simulate the interactions of particles with the material according to the numerical models provided by the physics lists. It is also referred to as full simulation. Fast simulation can replace Geant4 in defined detector parts. The output is stored in the G4HIT 1 format. Pile-up events typically undergo the full simulation and are then overlayed with the hard scatter event at the hit level. • Digitization: In this step, the hits are converted into digits, which is the same format as that of the real detector. Typically, a digit is produced when a voltage or current on a readout-channel exceeds a given threshold during a time window. Some detector parts also include the signal shape as a function of time. Detector and electronics noise and cross talk effects are modelled as well. The output is raw data objects (RDO). • Reconstruction: At the final step the digits are converted to real physics objects such as jets, muons, electrons, photons, etc., using various algorithms, such as jet finders, tracking or clustering software.
All the steps of the production chain undergo validation to ensure their correct functionality, performance and robustness.

Fast Simulation
While various algorithms for fast simulation exist (see Ref. [5]), only the most relevant ones are described here. In general, fast simulation is faster, less precise and easier to tune to data than the full simulation.
Frozen-showers [8] is a technique that replaces low-energetic particles from electromagnetic (EM) shower produced by Geant4 by pre-simulated showers stored in a library. For the MC production for Run-2, it is used by default in the forward calorimeters (FCAL) in the full simulation.
Fatras [9] is a fast ATLAS track simulation, that employs the simplified reconstruction geometry rather than the simulation geometry, and uses an extrapolation engine to transport the track through the detector.
FastCaloSim [4] is a parameterized calorimeter response, based on the Geant4 simulation of single particles, namely electrons and photons (representing EM showers) and charged pions (representing hadronic showers). The single particles are generated in a fine grid of energies and pseudorapidities 2 . Then, in the simulation step, a fitting parametrization is loaded into memory and the response (such as energy or energy density around the shower axis) is randomly sampled from that. The energy range covers values from 50 MeV to 1 TeV. In the upgraded version, this range is going to be expanded to up to 4 TeV. Each parametrization covers a range in η of size 0.05. A dedicated parametrization of the FCAL is not part of FastCaloSim, but this is planned for the new version.
FastCaloSim is successfully used in ATLAS, mostly for signal samples and systematic variations of backgrounds. During the MC production campaign of the first year of Run-2, about three billion MC events were processed or re-processed with AtlFast2, while about 14 billion events were (re-)processed with the Geant4 simulation. AtlFast2 combines the full simulation in the inner detector and the muon spectrometer with the FastCaloSim. AtlFast2F utilises Fatras and FastCaloSim, but it uses the full simulation in the muon system. FastCaloSim Finally, there are also tools for fast digitization and fast reconstruction. If the entire production chain is replaced by fast tools, which is called the FastChain [6], then a speedup of about a factor 30 compared to using only FastCaloSim can be achieved, however, only in the absence of pile-up. The ATLAS integrated simulation framework (ISF) [7] was developed to provide a flexible configuration of detailed or fast tools at every step of the chain. It also allows to use different simulators for different particles of the same event. This approach can be tailored to the specific needs of the various physics analyses.

The new FastCaloSim
The performance of the previous version of FastCaloSim is discussed for example in Ref. [10]. The new version aims to improve the performance, but also the speed and memory needs. The main features are briefly described here.

Energy parametrization
Along the longitudinal shower direction, energy is deposited in the various layers of the calorimeter that are hit by the shower. The energy distributions are obtained from the Geant4 simulation, and they are converted into cumulative distributions in order to get a well-defined assignment of cumulative value versus the deposited energy, expressed as the fraction of the total shower energy.
The energy deposits per layer are correlated with each other. If, for example a large amount of energy is lost in the first layers, less will be deposited in the layers behind. The details will vary from shower to shower. In order to decorrelate those energy deposits, and to classify the showers by their longitudinal shower development, a principal component analysis (PCA) is used. A PCA is a transformation of a set of variables into a set of orthogonal and uncorrelated, so-called principal components. The first component has the largest variance. In order to achieve a better decorrelation, the events are divided into bins of the first (and/or second) component. The bins have approximately the same number of events, and typically a number of bins between 5 and 10 is chosen. A second PCA transformation is applied to the energy deposits per layer for the events in each of those bins, and hence the components of that second transformation are now largely decorrelated.
The information that needs to be stored, in each bin defined from the 1st PCA transformation, are the cumulative energy distribution and the PCA matrix of the 2nd PCA transformation. The information have to be loaded into memory for the simulation later on; it is therefore desired to keep the storage as small as possible. For that, a neural-network based regression is used. The training and evaluation of the regression is done with a multi-layer perceptron (MLP), as implemented in the TMVA [11] package. An iterative MLP training is employed, starting from two neurons up to ten neurons, using one hidden layer. After each training, the regression is evaluated and the agreement with the original distribution (from Geant4) is tested. If the largest relative deviation between input and output is less than 5%, the iteration stops and the MLP weights are stored. If the regression fails, the histogram holding the cumulative energy distribution is rebinned iteratively and the bin contents and bin borders are stored instead.
Finally, in the simulation step, for each PCA bin a set of uncorrelated random numbers is drawn (one per calorimeter layer), the inverse PCA transformation is applied, and the regression output is calculated from the MLP weights. By construction, each PCA bin has the same probability and thus in the simulation this bin is determined randomly for each call of the energy simulation. A distribution of simulated energies is then a linear superposition of the deposited energy in each of the 5-10 PCA bins.  Figure 1: Example of an average shower shape histogram. This is the second layer of the EM barrel for central pions with 50 GeV total energy. Displayed is the averaged hit energy normalized to unity, in bins of α and r, presented in the x-y plane.

Shower Shape Parametrization
The lateral shower shape is characterised by the energy deposited around the shower axis, in a given calorimeter layer and PCA bin. The variables in which the shape is described are an angle α (around the axis) and a radius r (distance from the axis). The energy is taken from simulation hits, which allows a finer binning of the information than it would be possible with energy deposits on the calorimeter cell level. The binning is optimized such to get approximately same number of hits per bin, but a finer binning is used towards small radii where most of the energy is concentrated. An average 2D shower shape histogram is built from a sample of single particles simulated with Geant4, for a given energy value and a narrow bin in η. An example of an average shower shape is displayed in Figure 1. A large number of these histograms is obtained and then stored. In a future step, these 2D histograms will be replaced by MLP weights from a 2D regression (analogous to the energy parametrisation), to achieve a much more compressed memory usage.
In the simulation step, these histograms are loaded into memory. They serve as probability density functions, and HIT positions are tossed randomly. Each hit is assigned the same amount of energy, i.e. the energy per layer (obtained from the energy simulation) divided by the number of hits.
The number of hits tossed from the 2D histograms is a critical parameter. If too many hits are tossed, the resulting shower shape will resemble the average shower shape, and then the energies don't fluctuate enough. If too few hits are tossed, the energy fluctuations could be too large and results will not be accurate. This parameter is still subject to further studies. The approach implemented to-date is to calculate the number of hits such that their stastistical precision equals the sampling term of the energy resolution in the calorimeter: N is the number of hits, E the energy per layer, and the parameter α depends on the layer, ranging from 10% in the EM barrel to 100% in the FCAL.

Hit-to-Cell Assignment
Once the energy and the shower shape have been modelled, and a hit distribution is simulated, the hits need to be assigned to the calorimeter cells. The cell container is then eventually passed to the digitization step.
The simplified geometry tool is used to assign the hit positions to cells. This tool neglects the accordion shape of the electrodes in the Liquid Argon calorimeter (which assures a crack-less symmetry in phi), and assumes that cells are cuboids. In Geant4 this accordion structure is included. In FastcaloSim, the accordion shape is emulated by applying a hit replacement probability function, also called wiggle function. This function slightly displaces the hit in phi direction before the geometry tool is called. Only if the hit is in the center of given cell, the probability that the hit is assigned to that cell is one. If the hit is positioned toward the edge of a cell, there is a non-zero probability that the hit is assigned to the neighbouring cell. The parameters of this hit replacement depend on the calorimeter layer, and they are tuned to Geant4.

Prototype and First Validations
A first prototype of the upgraded FastCaloSim is available. It is implemented in the ISF, as part of the ATLAS software framework Athena [12]. Currently, the functionality is limited by the availability of the various parametrizations, but all main functionalities are included. To assess the performance of the new tool, first validations are performed on single particles. The goal is to resemble the full simulation as closely as possible. Comparisons are also made to the previous version of FastCaloSim. Figure 2 displays two examples of the validations for single particles in the central region of the calorimeter, i.e. 0.2 < |η| < 0.25. These comparisons are obtained after the full chain, i.e. the events undergo simulation, digitization and finally reconstruction. A better modelling of the inner structure of hadronic showers is achieved, and also a notably better modelling of the longitudinal energy deposited by EM showers is seen. These are just a small subset of the validations that have been performed already, and more extensive studies using complex physics processes will follow.

Summary
FastCaloSim is a parameterized calorimeter response, based on the inputs from the detailed simulation with Geant4, but approximately ten times faster. The improved FastCaloSim employs machine learning techniques to reduce memory need and to improve the modelling of the shower shape. PCA transformations are used to decorrelate the energy deposits per layer, and to define a binning that is used for both the energy and the shower shape parametrization. The accordion structure of some of the calorimeter parts is emulated with a dedicated hit replacement. The prototype is now available and first validations with central single particles show substantial improvements of the new FastCaloSim version compared to the previous version.