Added energy loss to MC ------------------------ 1. Add code to calculate a random energy loss, enerloss_new.f, taken from SIMC. To calculate the mean energy loss used the code, engine_loss.f, which is the subroutine loss from total_eloss.f in the RSS engine. 2. Added these codes to the Makefile. 3. Changes to mc_hms_single.f for the mean energy loss which is copied from the engine. a. First the target type is determined from the target file. tartype is set to 1 = C+He, 2 = C, 3 = MT + He, 4= MT+ no He, 5 = NH3 and 6 = ND3. The target thickness, target density,target A, target Z and target radiation length is taken from the param file in the RSS engine. b. Using the subroutine loss, the mean energy loss is calculated for the beam in the: i) Scattering chamber window ii) If NH3 or ND3 then 1.25cm of He or if C+He then 1.6cm of He. iii) Half of the target material depending on tartype. Then the mean energy loss is subtracted from the beam energy to and new variable ebeam_mp. ebeam_mp is used for calculating the reconstructed kinematics. c. Using the subroutine enerloss_new the random energy loss is calculated for the beam: i) scattering chamber window ii) loop through each material in the target file. If the material is before the z position of the randomly chosen interaction point then use the thickness and density,A, and Z from the target file. Then random energy loss is subtracted from the beam energy in the input file and put into a new variable ebeam_ran. ebeam_ran is used for the determine the radiative energy loss and calculation of the event kinematics. d. Using the subroutine enerloss_new, the random energy loss is calculated for the scattered electron. For most targets, it loops through the target material and for any material after the z interaction point the energy loss is calculated. NH3 and ND3 are special cases and depending on the z position of the interaction it calculates the path length in the helium before the cell and the path length in the helium after the cell. In addition the path length in the cell is calculated. It is assumed that the packing fraction is 50% and so that path length is divided by 2 and the random energy loss in the NH or ND and the helium is calculated. Then the energy loss for the tailpiece and 4K shield is calculated. For all target the energy loss for the Scattering chamber window, air and HMS entrance window is calculated. e. Using the subroutine loss the mean energy loss is calculated for the scattering electron in the same manner as the engine. i) Half of the target material depending on tartype. ii) If NH3 or ND3 then 1.25cm of He or if C+He then 1.6cm of He. iii) If NH3 or ND3 then cell wall. iv) Scattering chamber window,air and HMS window.