# Roman Pot Sim

This page gives details of the Roman Pot simulations, which includes acceptance studies, momentum reconstruction studies, and the move towards a full mock analysis of DVCS. The process includes generation of physics events, importing physics events through EicRoot for GEANT tracking of particles through magnetic fields to the detectors, digitizing the raw hit information, and implementing a reconstruction algorithm to determine the pT of the proton from the hits in the Roman Pot. All of the steps have been implemented into a single script that can handle the workflow, which can be found at /direct/eic+u/rmpetti/workarea/roman_pots/condor/run_pot_sim_milou_jobs.csh. The basic steps in the simulation process are described in the sections below.

## MILOU sim

The first step in the simulation study is to generate DVCS physics events. Details of the MILOU Monte Carlo program can be found elsewhere. An example steering file used for this study can be found at /direct/eic+data/rmpetti/milou_sim/dvcs.steer. A quick note about this step. If one desires to run many jobs in parallel with Condor, it is necessary to change the seed for the random number generator that is specified in the steering file (denoted by the SEED keyword). A script (/direct/eic+u/rmpetti/workarea/roman_pots/condor/mod_steering_script.pl) has been written that will take as one of its arguments the desired seed (the script takes four arguments, seed, minimum t, maximum t, and number of events) that will regenerate the steering file automatically replacing the original value of the seed with the one used as an argument in running the script. As it is currently setup when running in Condor, the seed is passed by the process number that is automatically assigned to the Condor job through the scheduler.

Another note if running within Condor. MILOU will generate an integration table that is used for its calculations with BASES, with the table stored in the generated bases.data file. This is time consuming. To increase efficiency, the same bases.data file is used for all the jobs farmed out. In order to achieve this, MILOU first needs to be run once outside of Condor. The point here is just to generate the bases.data file, so it is sufficient to generate just one event. Within the steering file, the keyword IGEN must be set to 0 to generate the table from scratch. Then when running in Condor, the IGEN flag can be set to 4 and the existing bases.data table will be used. This is already setup if running the mod_steering_script.pl script referenced above.

## Divergence smearing

One of the effects that needs to be studied is the impact of the smearing of the angle of the outgoing protons due to the angular divergence of the beams at the IP. In principle, this effect will influence the momentum reconstruction resolution. This is an initial state effect in that the electrons and protons in the beam will collide with some angle compared with the nominal trajectories. This effect is approximated by adding a smearing only of the outgoing proton. This means that the MILOU events are generated with the electron and proton colliding head on, but then an extra rotation is applied, determined by the magnitude of the divergence. This should be sufficient for evaluating the effect of the momentum resolution, but may need to be handled in the initial collision for more detailed studies.

The divergence is calculated from the beam parameters obtained by the machine designers, specifically the (un-normalized) beam emittance, ε, and β*, via the equation $\displaystyle{ \sigma_\theta = \sqrt{\varepsilon/\beta^*} }$. This formula is used to generate the angle which the outgoing proton will be rotated. The angle is chosen randomly from a Gaussian distribution with a width equal to the calculated εθ. The script /direct/eic+u/rmpetti/workarea/roman_pots/MCafterburners/addDivergence.C will take in as input, the ASCII file generated by running MILOU in the previous step and will output a modified event record with the proton rotated by the specified angle. The script also takes in the (un-normalized) emittance and β* in both the x and y direction to calculate the magnitude of the divergence in each direction separately.

## Roman Pot setup

The next described step is the construction of the Roman Pot systems. This can be done by running the script /direct/eic+u/rmpetti/workarea/roman_pots/detectorSetup/tracker.C. This takes many arguments as detailed in the defined function in the script. The script allows for the construction of the Roman Pot through all the arguments supplied, including the position along the lattice in x and z, the rotation of the pot so that the beam comes in perpendicular to the sensors, the denoting of how many layers of sensors should be included in the station and the size of the rectangular "hole" that represents the gap in acceptance due to how close the pots can be placed to the beam (currently assumed to be 10σ of the beam width from the core of the beam and determined from the emittance and β function). Each station is also given an index through the arguments. This script needs to be run inside ROOT. Some more general information of constructing detector geometries inside EicRoot can be found here.

## EicRoot simulation

The next step is to run the GEANT tracking of the events through the magnet setup and the Roman Pots within the EicRoot package. An example script to handle this is found at /direct/eic+u/rmpetti/workarea/roman_pots/sim/simulation.C. This script will use the events generated above in step 1, as well as the detector constructs from step 3. Additionally, the magnetic setup in the IR needs to be defined. Some general information on the importing of magnetic fields into EicRoot can be found here or here.

If one wants to study the effect of the angular divergence, then this step needs to be performed twice. The simulation.C macro will be run once on the event record without divergence and run again on the event record with divergence. The output of simulation.C WITHOUT divergence is simply used to gain access to the original, un-smeared, proton pT and to pass this value along the simulation chain. The actual detector hits that will be analyzed later for acceptance and momentum reconstruction studies will utilize the output of simulation.C WITH divergence applied.

In both cases, the output of simulation.C is a ROOT file containing the standardized EICTree format used by the BNL EIC Task Force group.

## Digitizing hits

The next step is performed to add an additional layer of reality to the simulation. Rather than use the raw exact hits of the protons in the sensors, a digitized hit is used, which takes into account the pixelation of the detector sensor. This step is applied by running the macro /direct/eic+u/rmpetti/workarea/roman_pots/sim/digitization.C. The pixel size in x and y can be adjusted within this script. This macro takes in the output of the previous simulation step and outputs another ROOT file containing TTrees with the hit information in each Roman Pot station. If it is desired to study the effect of divergence, this macro needs to be run with the simulated file which includes the divergence. For more general information on the digitization step in EicRoot, please consult this page.