Difference between revisions of "Single-arm simulation"
(New page: == Hall A single-arm simulation package == This page documented my ongoing work on the single-arm simulation with Dien, Thir, under the guidance of Eric Christy. I don't own the code. ===...) |
(→Hall A single-arm simulation package) |
||
Line 1: | Line 1: | ||
== Hall A single-arm simulation package == | == Hall A single-arm simulation package == | ||
− | This page | + | This page reflects my ongoing work on the single-arm simulation with Dien, Thir, under the guidance of Eric Christy. |
I don't own the code. | I don't own the code. | ||
Revision as of 23:25, 19 December 2016
Contents
Hall A single-arm simulation package
This page reflects my ongoing work on the single-arm simulation with Dien, Thir, under the guidance of Eric Christy. I don't own the code.
SUMMARY
The code comes with 3 directories:
phase_space_fall16_LHRS/ rad_corr/ weighting/
- phase_space_fall16_LHRS is the Monte Carlo phase space generator adapted from Hall C, which is essentially a single-arm version of SIMC with the updated spectrometer package for Hall A LHRS (lhrs/). It's now set up for optics tests of the left arm for the Fall run. The default target is single carbon foil. No multi-scattering and energy loss considered.
- rad_corr is used to generate cross section tables with radiative correction factors. The code uses a new Born model from Eric Christy. That is an updated version of Bosted model. The radiation part of code is from Simona Malace.
- weighting will weigh phase space variables with cross sections, and calculate the scaling factor.
RUN THE CODE
- First generate the phase space.
cd phase_space_fall16_LHRS/ make clean;make
The code needs to read kinematics and target settings from infiles/<name>.inp. For example, to simulate a single carbon foil run 13900:
./mc_hrs_single >>Enter input filename (assumed to be in infiles dir) >>carbon_foil_13900
The output ntuple is created in worksim/. To convert it to rootfile:
h2root worksim/carbon_foil_13900.rzdat
- The second step is to prepare the cross section table. The code may takes hours to run. But hopefully you need only run it once for one run settings. Update target radiation length in eg1b.targ before you run the code.
cd ../rad_corr make clean; make ./radcorr.sh <run_number>
In the script radcorr.sh:
#!/bin/csh #$1 is for run number it is expecting 5 digit run number echo "enter 5 digits run number" set RUN = $< rm infile.inp ln -s ../phase_space_fall16_LHRS/infiles/carbon_foil_${RUN}.inp infile.inp ./grid ${RUN} rm eg1b.inp ln -s table_${RUN}.inp eg1b.inp echo "--start generating cross section table. May take a while...\n" ./externals_all_new mv extern.out table_$(RUN).out echo "Done! Table is stored at table_${RUN}.out"
Two programs are called. grid.f reads kinematics from the simulation infile, and slices the phase space into grids of theta and W2. dtheta = 1 degree, and dW2 = 0.02 GeV2 is the defaut setting. Information of each grid points is stored in table_<run_number>.inp. Then externals_all_new.f will calculate Born cross section and radiative correction factor on each grid point, and write results in table_<run_number>.out.
- Now we are ready for weighting. Before run the code, make sure you have:
1) the simulation infile (*.inp). Later ./create_input(called in weighting.sh) will read run information from it to generate input.dat;
2) simulation results (*.rzdat) from step 1;
3) the cross section table (table_*.out) from step 2;
4) targetdata.dat to provide your target information;
5) and reconmc.in to provide your run information. Make sure your target id here matches the id in targetdata.dat.
Then run:
cd ../weighting make clean; make #compile create_input and recon_mc in the subdir SRC.new/ ./weighting.sh <run_number>
The script weighting.sh called ./recon_mc to weigh each kinematic point in simulation. weighting factor for Kinematic points between grid points are obtained by interpolation.
You will find the MC scaling factor in screen output, and a new ntuple mc13900.root to be compared with data.
HOW TO
RUN WITH A DIFFERENT TARGET
If it's another solid target, follow the steps above to update target information in:
phase_space_fall16_LHRS/infiles/*.inp rad_corr/eg1b.targ weighting/reconmc.in targetdata.dat
If it's a target cell, you will need to modify the target definition in mc_hrs_single.f, and add multi-scattering and energy loss code (hint: borrow code from SIMC).
RUN WITH A DIFFERENT SPECTROMETER/OPTICS
Put your new spectrometer package (with forward/backward optics matrices) in phase_space_fall16_LHRS/, tell main code and Makefile to reach it. Again, you should be able to find packages for Hall A/C from SIMC.