Take a look at: https://www.cs.rice.edu/~vo9/deeplearning/2019/slides/Rivanna.pdf
Updated Instructions for Generating Monte Carlo Simulations in RUS format for SpinQuest (Last updated on
...
Feb 23, 2025, by Forhad)
If you would like to generate simulated events for SpinQuest experiments and save the output file in RUS format, you should follow these steps.
...
2. Clone the repository:git clone https://github.com/uva-spin/UVA_RUS_Basic
3. Go to the repository:
cd cd UVA_RUS_Basic
4. Set up the environment:
source /project/ptgroup/spinquest/this-e1039.sh
5. Run the simulation macro locally for testing. You can use the package based on your interest. For example, let's use Drell-Yan events, where the beam interaction point is at the target location:
cd DY_Target
root -b 'Fun4Sim.C(1000)'
6. Once the job runs locally and looks alright, you can submit a few jobs on the grid before submitting large jobs:
./jobscript.sh test 2 1000
In the Fun4Sim.C macro, we have used:
const bool count_only_good_events = true;
se->run(nevent, count_only_good_events);
This means that the Fun4All macro will keep running until we get accepted events, as required by the SQGeomAcc condition.The legacy generator has been used as the default for J/Psi productions because it is faster compared to Pythia8. You can use the package based on your interest. For example, let's use Drell-Yan events, where the beam interaction point is at the target location:
cd DY_Target
root -b 'Fun4Sim.C(10)'
6. Once the job runs locally and looks alright, you can submit a few jobs on the grid before submitting large jobs:
./jobscript.sh test 2 10
- "test" is the name of this job, used as the name of a new directory to store job outputs.
- "2" is the number of jobs.
- "10" is the number of events events per job.
- Job outputs
- "test" is the name of this job, used as the name of a new directory to store job outputs.
- "2" is the number of jobs.
- "1000" is the number of events per job.
- Job outputs will appear under /sfs/weka/scratch/<username><user_name>/MC.
- You can use squeue -u user to check the status of your jobs (or use this link: https://ood.hpc.virginia.edu/pun/sys/dashboard/activejobs?jobcluster=all&jobfilter=user
).
7. Once everything looks alright, submit large jobs. For example:
./jobscript.sh DY_Target 100 10000:
./jobscript.sh DY_Target 100 1000
8. Once all the jobs are completed, you can use the hadd or TChain command to merge the ROOT files. Here is an example using the hadd command:
Basic Usage: To merge multiple ROOT files into a single output file, use: hadd output_file.root input_file1.root input_file2.root input_file3.root
- Merging Large File Lists with a Minimum File Size Constraint: To merge only root.root files larger than 20 KB from a directory, use: hadd output_file.root $(find output_file_path -path "*/RUS.root" -size +20k)
Configurations of Event Generation Properly (Last updated on Jan 30, 2025, by Forhad)
Wall time when dimuons are accepted in a top-bottom plane-wise (default).
Vertex Location | Channel | Generator | Acceptance Conditions | Total Events | Rivanna HPC Cluster (Wall Time) in sec |
---|---|---|---|---|---|
Target | DY | Pythia8 | True | 100 | 1038 |
Target | DY | Legacy E906 | True | 100 | 1638 |
Target | JPsi | Pythia8 | True | 10 | 2804 |
Target | JPsi | Legacy E906 | True | 10 | 1394 |
Wall time when dimuons are accepted in SpinQuest spectrometer
Vertex Location | Channel | Generator | Acceptance Conditions | Total Events | Rivanna HPC Cluster (Wall Time) in sec |
---|---|---|---|---|---|
Target | DY | Pythia8 | True | 100 | 593 |
Target | DY | Legacy E906 | True | 100 | 1386 |
Target | JPsi | Pythia8 | True | 10 | 1182 |
Target | JPsi | Legacy E906 | True | 10 | 945 |
Here are the updated instruction of generating Monte Carlo for SpinQuest simulations and analysis
...
- Beam profile
- The profile here means the distribution shape of beam protons in X and Y (= R).
- When "legacyVtxGen SQ_vtx_gen = true" (or the variable name is "legacyVtxGen" in old versions)
- The shape is "Gaussian" at "R < 5*sigma" and "1 / R" at "R >= 5*sigma" (cf. https://github.com/E1039-Collaboration/e1039-core/blob/master/generators/E906LegacyVtxGen/SQPrimaryVertexGen.C#L290 )
- The Gaussian width ("sigma" in cm) is defined by "SIGX) is defined by "SIGX_BEAM" and "SIGY_BEAM" in Fun4Sim.C.
- The Gaussian center is X = Y = 0 cm by default, and can be changed by setting "X_BEAM" and "SIGY"Y_BEAM";in Fun4Sim.C.
rc->set_DoubleFlag("X_BEAM"
, 0.1);
rc->set_DoubleFlag("Y_BEAM", 0.1);
- When "SQ_vtx_gen = false" (or the variable name is "legacyVtxGen" in old versions)When "legacyVtxGen = false"
- The shape is defined by the following functions of event generators.
- "set_vertex_distribution_function()" sets the shape to "Uniform" or "Gaussian".
- "set_vertex_distribution_mean()" sets the mean of the distribution.
- "set_vertex_distribution_width()" sets the half width in case of "Uniform" or "sigma" in case of "Gaussian".
- Distribution of z-vertex
- The z-vertex means the position of each generated event in Z.
- When "legacyVtxGen = true"
- The distribution shape follows the probability of beam-material interaction, namely the product of beam intensity and material amount at Z, where the beam intensity is attenuated over Z.
When "VTX_GEN_MATERIAL_MODE" is set to "Target" (via
rc->set_CharFlag("VTX_GEN_MATERIAL_MODE", "Target")
), events are generated only on the target material.- "VTX_GEN_MATERIAL_MODE" can be set to "Dump" or "TargetDumpGap" to enable only the dump material or the material (i.e. air) in between the target and the dump.
- When "legacyVtxGen = false"
- The distribution shape is defined by "set_vertex_distribution_function()" etc. together with the beam profile.
- Target position
- The z-center and the length of the target is defined by "double target_coil_pos_z" and "double target_l" in Fun4Sim.C (-300 and -7.9 cm by default).
- "target_z" is the position of the target material relative to the target coils. It is 0 cm by default. If you change "target_l", you have to change "target_z" to "0" together, unless you intend to make the relative position non-zero.
- The x,y-center and the angle of the target are 0 by default. If you need to change them,
Copy "G4_Target.C" to your working directory;
cp /project/ptgroup/spinquest/core/default/macros/top/G4_Target.C .
- Edit your "G4_Target.C" file.
- Replace
#include <top/G4_Target.C>
with#include "G4_Target.C"
in "Fun4Sim.C".
...