title: megas: development and validation of a new simulation tool for the Micromegas detectors
authors: Dan A. Ciubotaru Michele Renda
text: 
  
  
  
  
  
  
  address-ub,address-ifin]Dan Andrei Ciubotarumycorrespondingauthor
  [mycorrespondingauthor]Corresponding author
  dan.andrei.ciubotaru@cern.ch
  address-ifin]Michele Renda
  
  [address-ub]Faculty of Physics, University of Bucharest, Bucharest - Măgurele, Romania 
  [address-ifin]Departament of Elementary Particle Physics, IFIN-HH, Reactorului 30, RO-077125, P.O.B. MG-6, Măgurele, Romania
  
  
  
  We present , a new software tool that improves the simulation of the Micromegas gas detectors. Our tool offers the possibility to configure multiple arrangements with one or more layers of MM detectors. A series of simple commands can easily modify the constructive properties of each of these detectors, such as dimensions, gas composition, and electric field.  is based on  <cit.>, an open-source library that simulates the step by step movement of electrons in an electric field using Monte-Carlo methods.
  A real-life example was simulated, and to validate our application, we perform a detailed analysis of our data compared with the actual experimental results. We present a selection of data obtained simulating real user-case scenarios, compared with results available in the literature, especially in the upgrade phase of the Muon spectrometer of the ATLAS detector at LHC.
  
  
  
  gas detectors micromegas simulation
  [2010] 00-0199-00
  
  
  
  
  
  
  
  
  
  
  § INTRODUCTION
  
  Detectors using  Micromegas (MM) technology represents on of the best options in experimental physics when considering the detection of ionizing particles. This reputation was built in the past years based on the fast signal generation  (<1 ) at high particle rates and good spatial resolution with values under 100  <cit.>. This detector technology consists of two parallel sectors separated by a micromesh and limited at both ends by a cathode and an anode. The first region, commonly about 5, is called the drift region and the second one, considerably smaller, about 128, is named avalanche region. The voltage applied to these electrodes has the role of creating a conversion space in the drift region and a multiplication effect in the avalanche region, generating the signal. These unique aspects, together with the relatively low cost per sensitive area, qualified this technology as the best option for the New Small Wheel <cit.> detector of the ATLAS experiment at the Large Hadron Collider (LHC) <cit.>.
  
  The increased use  of this detector required the development of specific computer simulation software that can be used to facilitate improvements and optimizations. These should be efficient in terms of resources and development time. While there are tools that allow the simulation of the gas detectors, at this time, none of them are suitable for the analysis presented in this article.
  
   <cit.> may be considered the first choice when simulating the passage of a particle through matter, but it is unable to perform microscopic simulations of electrons in gaseous medium, essential for performance studies (resolution, response time, etc.) of gas-filled detectors.
  
   <cit.> and a most recent version of it,  <cit.>, are some of the tools utilized to simulate gas detectors in high energy physics.  uses an analytical approach when determining the electrical field, and there is an integration with  <cit.><cit.> to calculate the Townsend coefficient. This configuration comes with several limitations:
  
  	
    * the electrical field is determined analytically and can only be uniform; [a possible integration with a three-dimensional filed solver  <cit.> is considered <cit.>]
  	
    * the simulated gas mixtures are limited and are hard-coded into ;
  	
    * consist in a mixture of programming languages in particular C++ and Fortran, with the latter being quite difficult to maintain;
  	
    * is unable to run on multi-core, making it difficult to take advantage of modern CPU architectures.
  
  	
  Given these shortcomings, we designed an application focused on simulating Micromegas detectors, highly customizable through specific parameters (see table <ref>).
  
  This application is written in C++ 17, runs on multi-core and integrates the  library <cit.> to make use of a microscopic simulation approach. 
  
  Since  reads the cross-section tables required to reproduce the interaction processes from  <cit.>, the number of gases is limited only to the availability of the data in the database or literature. 
  
  Currently, the electrical field is considered uniform, but any field can be expressed analytically (through a specialization of the class ).
  
  This article is organized as follows. Section <ref> describes how the application was implemented, along with how we configured the simulation setup: from the core components of the application, the experimental setup used along with the input parameters, to how the spatial resolution and drift speed were determined.
  
  Section <ref> is reserved for the presentation of the results obtained when modifying some of the detector constructive parameters: the electrical field of the drift region, the angle of the incident particle, the gas mixture used, and the number of primary particles used.
  
  In section <ref>, we present the conclusions obtained from the development and validation of this application.
  
  
  
  
  § SIMULATION SETUP AND IMPLEMENTATION
  
  
  In this section, we describe the  application and the tools used to obtain the results presented in the next section.
  
  
  
   §.§ Program summary
  
  
  Program title: 
  
  Licensing provisions: LGPL v3
  
  Programming language: C++17
  
  URL: https://gitlab.com/dan.ciubotaru/megas.git <cit.>
  
  
  
   §.§ Simulation framework
  
  The new proposed tool is developed in C++ and relies on the  library to simulate the movement of electrons and ions in the sensitive area of the Micromegas detector. Figure <ref> outlines the  workflow from input parameters to analysis results.
  
  
  
  The core application functionality relies on three classes: 
  
  	
    * ; 
  	
    * ;
  	
    * .
  
  This design extends the abstract classes available in the  framework. This approach allowed us to have only the code specific for Micromegas simulation, delegating to  the code common to general gas detector simulation, making  more maintainable and compact.
  
  : within this class all the technical details of the MM detector are described, including dimensions, electric field, and gas mixture. Although more information about the geometry is related in the next section, it is worth mentioning that our application uses volumes  (see fig. <ref>) to describe the regions of the MM detector: avalanche, drift, and the 'upper' section [we use this term to express the area above the cathode]. In this way, we created the  method to know precisely when the electron changes a certain region or leaves the sensitive area, and simulation needs to be halted.
  
  Starting from the concept of volumes presented above, through the  method, the application is designed to be able to change the electric field separately for each volume by controlling the mesh, cathode, and anode voltage.
  
  : through this class, we can configure one or multiple layers of MM detectors in different arrangements and orientations, the particle gun angle, and the number of the primary interactions in each detector.
  
   is overriding the  method from  class, inherited from  and it makes possible to halt the simulation when all electrons leave the drift region - the sensitive area of the simulated detector.
  
  The number of primary electrons (N_p) generated by the incident particles, in our case, muons, remains an essential factor in our application. To estimate this value, we relied on a simple composition law for gas mixtures described by Claus Grupen and Irene Buvat <cit.>. For the chosen height of 5 of the drift region, we obtained a value of 50 primary electrons generated in this region, distributed uniformly and random across the muon path.
  
  
  
   §.§ Geometry and layout
  
  
  
  Our tool offers the possibility to configure multiple setups with one or more layers of MM detectors. For this study, we choose to replicate a real-life scenario, presented in ATLAS New Small Wheel Technical Design Report <cit.>. The setup consists of two Micromegas detectors 20 x 20 , stacked one atop the other, with the same orientation (see fig. <ref>) and a distance of 1 between  them. The gap separating the detector layers is void and does not affect the simulation results. The height of the amplification space is 128, and the height of the drift region is 5.
  
  The reference gas mixture is Ar:CO_2 in a proportion of 93:7 at normal temperature and pressure conditions (NTP), 20 and 101.325. The scattering cross sections dataset for Ar was taken from Biagi <cit.> and for CO_2 from Phelps <cit.>.
  Using the voltage of  -300 for the cathode, 0 on the mesh, and 550 on the anode, we induce an electrical field of 40 in the amplification region and 0.6 on the drift region, in the normal direction to the detector plane.
  
  
  
  
  
   §.§ Simulation configuration and parameters
  
  While the default parameters are listed in the previous section, we implemented the possibility to change them through arguments passed to the main program (see table <ref>). This feature offers the possibility to test different simulation scenarios easily.
  
  
  
  
  
   §.§ Determining the spatial resolution and the longitudinal drift velocity
  
  
  
    §.§.§ Spatial resolution
  
  To calculate the spatial resolution, we used the μTPC method <cit.>. This procedure estimates the coordinate of the primary ionization z_i for each electron i as z_i = t_i ×  v_drift. Knowing the drift velocity v_drift in Ar:CO_2 (93:7) as 4.7 <cit.>, time (t_i = t_i^finish - t_i^start), and the position x_i where the electron leaves the drift volume, we are able to compute z_i. Identifying all z_i positions we can reconstruct a local track by fitting with a straight line (see fig. <ref>). The hit position, x_half, is determined for each detector as the intersection of the fitted line with the half-height plane of the drift region, in our case at 2.5. The distribution of the difference between the two x_half values is fitted adequately by a gaussian, and the spatial resolution for one chamber is calculated as the standard deviation of this fit divided by √(2) (std is computed using the  method from   package).
  
  
  
  We want to point out that the spatial resolution calculated with our application is an intrinsic one and is specific to the gas mixture used for the given drift height. Consequently, the calculated intrinsic resolution is not influenced by the mesh transparency, strips width, and strips gap.
  
  
  
    §.§.§ Drift velocity
  
  Similarly, with the calculation of spatial resolution, we rely on the same initial and final values of the time and position for each primary interaction to determine the electron path. The distance vector is computed and we obtain the component along the z-axis, normal to the electrical field. The longitudinal drift velocity is expressed as the distance divided by time, averaged for all interactions in a given simulation.
  
  
  
   §.§ Limitations of  
  
  Regardless of how accurately one tries to model real-life Micromegas detector, there are always some drawbacks that come with a simulation software. In particular, for , we identified a few limitations:
  
  	
    * the primary generated electrons (10/mm) are distributed randomly and evenly along the muon path;
  	
    * delta ray that can potentially cause secondary ionizations are not considered;
  	
    * the simulation does not take into account the pillars and mesh transparency;
  	
    * to reduce the computing time, the avalanche is not simulated, and the electron path is stopped when it leaves the drift region;
  	
    * we decided not to calculate the signal induced on the readout strips.
  
  
  
  
  
  § RESULTS
  
  
  
  To test and validate the application, several simulation scenarios were considered. This was done by modifying the essential parameters, focusing on two particular properties of the Miromegas detector: the drift velocity along the electrical field and the spatial resolution (see section <ref>). In fig. <ref> it is possible to visualize the path of the primary electrons generated by an incident muon producing 9.7pair withing the sensitive area. It is possible to see how the transversal drift of the electrons directly affects the reconstruction of the muon path, limiting the intrinsic detector resolution. While single event simulation may be useful to get qualitative knowledge of the processes taking place within the detectors' sensitive region, a quantitative description can only be done if we perform an average over multiple events. In the next subsection are presented some different simulation setups where we modified one detector parameter. We analyzed the different response averaged over a high number of collision events.
  
  
  
  
  
   §.§ Simulation of  the voltage changes on the cathode
  
  
  megas –angle 20 –events 3000 –interactions 10 –cathode-voltage voltage
  
  One of the most critical parameters of the MM detector construction is the voltage applied between the cathode and the mesh, in the drift region.  For this simulation, we maintain all the application parameters to the default values, except the number of simulated events and the voltage applied to the drift cathode.
  
  
  We can observe that for voltages below 1000 V, the results obtained for the longitudinal drift velocity (see fig. <ref>) are in accordance with ATLAS data<cit.>. When talking about the spatial resolution (fig. <ref>), for the same threshold of 1000  the obtaining values fall under the limit of 100 established in the upgrade specifications for the New Small Wheel <cit.>.
  
  
  
   §.§ Simulation of  the incident particle angle
  
  megas –angle angle –events 3000 –interactions 10
  
  One important application of the Micromegas detector is for the New Small Wheel sector of the ATLAS detector, tracking muons coming at different angles in the pseudorapidity interval of1.0 < |η| < 2.7, relative to the beam axis. In this situation, it is important to study the spatial resolution and the drift velocity when changing the angle of the incident particles.
  
  We notice that when changing the incident angle (see fig. <ref>), there is a decrease in the spatial resolution from approx. 70 at 0 to approx. 50 at 45. This drop in resolution is due to the increasing number of primary interactions generated by the incident particle traversing a longer distance in the drift region. Compared with ATLASμTPC data, the spatial resolution achieved is below 100 following ATLAS New Small Wheel Technical Design Report <cit.> upgrade specification.
  
  
  
   §.§ Simulation of different gas mixtures
  
  megas –angle 20 –events 5000  –gases "Ar:((ratio)):Biagi,CO2:((100-ratio)):Biagi"
  
  megas –angle 20 –events 5000  –gases "Ar:((ratio)):Biagi,CO2:((100-ratio)):Bordage"
  
  megas –angle 20 –events 5000  –gases "Ar:((ratio)):Biagi,CO2:((100-ratio)):Hayashi"
  
  The possibility of modifying the gas mixture is a significant advantage that  offers, gas mixtures representing the most important operating parameter of this detector technology. We focused on simulating different gas compoundsAr:CO_2,Ar:CH_4, andAr:CF_4in which we varied the proportion of Argon in each mixture from 50% to 100%.
  
  
  The results obtained showed us that the chosen gas mixture has a substantial impact both on longitudinal drift velocity and spatial resolution. 
  TheAr:CO_2gas mixture in 93:7 proportion used in the ATLAS experiment represents a good trade-off - lower drift velocity (see fig. <ref>) to obtain a great spatial resolution (see fig. <ref>). Although the mixture ofAr: CH_4has better values, we should not neglect thatCH_4is a flammable gas even at low concentrations, and does not suit being used in this type of detectors where electrical discharges often occur.
  
  
  
   §.§ Simulation of the number of primary particles
  
  megas –angle 20 –events 3000 –interactions int
  
  The number of primary electrons generated per  is strictly correlated with the gas mixture and the drift height, and is specific for this detector geometry. Still, for this simulation, we wanted to see how this particular value influences the spatial resolution in this detector (see figure <ref>).
  
  
  
  Results shows that the number of primary electrons has a significant impact on the spatial resolution, and they are highly correlated. The minimum number of interactions required to obtain a resolution under 100 is five per mm, and 25 for the whole drift region. This distribution can be roughly fitted by the functiony = 270mm^2/x + 30mm.
  
  
  
  
  
  § CONLUSIONS
  
  We presented , a new software tool for modeling Micromegas gas detectors. The application uses a microscopic approach by integrating the  library. We simulated several scenarios by modifying the essential parameters like voltage, incident particle angle, gas mixture, and the number of created primary electrons. Each scenario was evaluated by looking at two 
  particular properties of the Miromegas detector:  drift velocity along the electrical field and the spatial resolution. 
  
  According to the results presented in this paper,  can accurately simulate MM detectors yielding results that are comparable with the available experimental data. Simultaneously, our tool can be used to create different simulation scenarios easily, from the number of MM layers to variations in all constructive and operative parameters of the detector.
  
  We demonstrated the functionality of this new simulation tool. With respect to the existing Micromegas detector simulation tools, its significant accomplishments are:
  
    *  provides a microscopic simulation of electrons in the drift region;
  	
    *  able to reproduce experimental results;
  	
    *  simulation setups easy to customize via input parameters;
  	
    *  provides  improved performances due to faster code execution and support for multi-core execution.
  
  
  § ACKNOWLEDGMENTS
  
  We would like to specially thank Prof. Călin Alexa for his valuable suggestions and support, and to thank our IFIN-HH ATLAS group colleagues, for the constructively and friendly environment they create every day. This work was supported by the Romanian Ministry of Research and Innovation thought the research grants  and .
  
  
  
  § REFERENCES