Collimation SixTrack: Proton Collimation without Online Aperture Check
Pascal Hermes
Based on (and partly copied over 1:1 from) the sources listed in the Bibliography.
Overview
Input parameters for collimation SixTrack are divided in three files:
- fort.2 (generated by MAD-X), defining the lattice of the machine without magnetic field errors.
- Collimator database file, containing the details of collimators geometry, material, settings (opening)
- fort.3 (modified from the one used for SixTrack without collimation), including tracking parameters (number of particles and turns), type of beam, type of halo.
Required input for scenarios that were already studied are available on CERN gitlab and can be downloaded via
git clone ssh://git@gitlab.cern.ch:7999/collteam/sixtrack_simulation_material.git
Preparation
The preparation of the tools is only required once. When all are ready they can be re-used for future runs with different optics and collimator settings.
Step 1: Collimation SixTrack Preparation
Download SixTrack source from github:
git clone https://github.com/SixTrack/SixTrack.git
For the compilation we first source the environmental variables:
source /cvmfs/sft.cern.ch/lcg/views/LCG_101/x86_64-centos7-gcc10-opt/setup.sh
Then we can compile the collimation SixTrack without coupling and online-aperture check:
./cmake_six
Step 2: Preparing the post-processing tools
The post-processing is required when running the collimation version of SixTrack without coupling and online aperture check. First we need to download all the tools
git clone ssh://git@gitlab.cern.ch:7999/collteam/post_sixtrack.git
We can compile the codes using
cd post_sixtrack
make
Now we should have the following files
-rwxr-xr-x. 1 pahermes def-cg 2459744 Feb 11 14:44 BeamLossPattern.exe
-rwxr-xr-x. 1 pahermes def-cg 1646824 Feb 11 14:44 CleanCollScatter.exe
-rwxr-xr-x. 1 pahermes def-cg 1646824 Feb 11 14:44 CleanInelastic.exe
-rwxr-xr-x. 1 pahermes def-cg 2438624 Feb 11 14:44 GetAperture.exe
-rwxr-xr-x. 1 pahermes def-cg 433 Feb 10 19:56 correct_coll_summary.sh
-rwxr-xr-x. 1 pahermes def-cg 174 Feb 10 19:56 FirstImpacts--Average.sh
A compiled version of all the post-processing files can be found here:
/afs/cern.ch/work/p/pahermes/public/tools/sixtrack/postprocessing
Running the Simulation
Step 1: Optics preparation
MAD-X is used to generate the LHC lattice, the optics and eventual orbit and focusing errors. Optics input files are available either on afs, for example here:
/afs/cern.ch/eng/lhc/optics
The thin optics suitable for SixTrack simulations must be available. If it is not it must be generated. Let's use a MAD-X file that was already used for runII of the LHC, which is available in the gitlab repository mentioned above. Let's assume we have cloned the repository into
/afs/cern.ch/user/e/exampleuser/private/
We can now run the MAD-X (.madx) file in
/afs/cern.ch/user/e/exampleuser/private/sixtrack_simulation_material/Simulation_scenarios/LHC/RunII/6p5TeV_2018_30cm_160urad/B1_cleaning/MADX
On lxplus we can use a complied version of the current MAD-X release which can be found on afs:
/afs/cern.ch/user/m/mad/bin/madx
For simplicity we can also define an alias for this
madx_current_release="/afs/cern.ch/user/m/mad/bin/madx"
With this alias we can run the current MAD-X release simply by typing
$madx_current_release
With this, we can now run the madx script from the gitlab repo:
$madx_current_release job_2018_optics_30cm.madx
Now we have the following files in the directory:
[pahermes@lxplus745 madx]$ ll
total 9893
-rw-r--r--. 1 pahermes def-cg 0 Feb 11 10:45 fc.3
-rw-r--r--. 1 pahermes def-cg 51405 Feb 11 10:45 fc.34
-rw-r--r--. 1 pahermes def-cg 301 Feb 11 10:45 fc.3.aux
-rw-r--r--. 1 pahermes def-cg 581888 Feb 11 10:45 fort.2
-rw-r--r--. 1 pahermes def-cg 5040 Feb 11 10:39 job_2018_optics_30cm.madx
-rw-r--r--. 1 pahermes def-cg 9489386 Feb 11 10:45 twiss_ats_30cm_thin.b1.tfs
The file fort.2
is the optics input file for SixTrack. If we are not using the online aperture-check (which, in this chapter, we are not), we can simply use this file for our SixTrack run and after having finished this step, we can continue.
Step 2 (optional): Running a single SixTrack job locally
For debugging purposes it might be interesting to run a single job of the entire batch locally. In such a run the entire output can be checked and issues, for example with the fort.3 file, can be identified more easily than when running on the batch system.
The first step is to identify the SixTrack executable that we have complied before. This is stored in build
and can have a long name. For simplicity let's create a folder in which we store the SixTrack input
mkdir /afs/cern.ch/work/p/pahermes/public/test_single_job
cd /afs/cern.ch/work/p/pahermes/public/test_single_job
[pahermes@lxplus745 input]$ ll
total 15708
-rw-r--r--. 1 pahermes def-cg 7394 Feb 11 14:13 CollDB_RunII.data
-rw-r--r--. 1 pahermes def-cg 1548 Feb 11 14:13 CollPositionsRunII.b1.dat
-rw-r--r--. 1 pahermes def-cg 582398 Feb 11 14:13 fort.2
-rw-r--r--. 1 pahermes def-cg 1116 Feb 11 14:13 fort.3
-rw-r--r--. 1 pahermes def-cg 15489455 Feb 11 14:13 SurveyWithCrossing_XP_lowb.dat
ln -s /afs/cern.ch/work/p/pahermes/public/SixTrack_James_210211/SixTrack/build/SixTrack_cmakesix_defaultcompiler_defaultbuildtype/SixTrack_50403-8dde1ea_zlib_crlibm_rn_Linux_gfortran_static_x86_64_64bit_double SixTrack
The last part of the code makes sure that the link appears as SixTrack
in the folder:
[pahermes@lxplus745 input]$ ls
CollDB_RunII.data CollPositionsRunII.b1.dat fort.2 fort.3 SixTrack SurveyWithCrossing_XP_lowb.dat
Running SixTrack
We have now all we need to be running SixTrack. We can do so simply by running
./SixTrack > screenout
The output is then stored in a file named screenout and overall the folder structure should look like this:
[pahermes@lxplus709 B1_cleaning]$ ls
align_error.dat CollPositionsRunII.b1.dat fort.18 fort.9 sim_time.dat
all_absorptions.dat Coll_Scatter.dat fort.19 impact.dat singletrackfile.dat
allapert.b1 collsettings.dat fort.2 jaw_profiles.dat SixTrack
all_impacts.dat coll_summary.dat fort.20 linopt_coupled.dat SurveyWithCrossing_XP_lowb.dat
amplitude.dat colltrack.out fort.21 linopt_dump.dat survival.dat
aperture_losses.dat dist0.dat fort.26 orbitchecking.dat tracks2.dat
CollDB_RunII.data file_units.log fort.3 pencilbeam_distr.dat
CollDB_RunII.data.new FirstImpacts.dat fort.3~ screenout
collgaps.dat FLUKA_impacts_all.dat fort.31 sigmasettings.out
CollPositions.dat FLUKA_impacts.dat fort.4 sim_meta.dat
An example job with all the required inputs is stored here:
/afs/cern.ch/work/p/pahermes/public/example
In this simulation we perform the tracking for 1000 initial particles. In the file coll_summary.dat we find the following information:
# icoll collname nimp nabs imp_av imp_sig length
28 tcp.c6l7.b1 6923 5695 0.1408189E-03 0.6654111E-04 0.60
29 tcp.b6l7.b1 80 64 0.7613685E-04 0.6530139E-04 0.60
30 tcsg.a6l7.b1 139 132 0.7043609E-03 0.7404103E-03 1.00
31 tcsg.b5l7.b1 219 203 0.1632712E-02 0.1494236E-02 1.00
32 tcsg.a5l7.b1 95 88 0.1157184E-02 0.1190544E-02 1.00
33 tcsg.d4l7.b1 27 27 0.4357763E-03 0.3409543E-03 1.00
34 tcsg.b4l7.b1 42 40 0.1508338E-03 0.1307831E-03 1.00
35 tcsg.a4l7.b1 19 18 0.3548064E-03 0.2976376E-03 1.00
36 tcsg.a4r7.b1 18 17 0.4394950E-03 0.3557746E-03 1.00
37 tcsg.b5r7.b1 27 26 0.3491472E-03 0.2759877E-03 1.00
38 tcsg.d5r7.b1 33 30 0.2740720E-03 0.2372699E-03 1.00
39 tcsg.e5r7.b1 13 12 0.5833242E-04 0.9012207E-04 1.00
40 tcsg.6r7.b1 48 45 0.2706816E-03 0.2440558E-03 1.00
41 tcla.a6r7.b1 0 0 0.0000000E+00 0.0000000E+00 1.00
42 tcla.b6r7.b1 0 0 0.0000000E+00 0.0000000E+00 1.00
43 tcla.c6r7.b1 1 1 0.0000000E+00 0.0000000E+00 1.00
44 tcla.d6r7.b1 0 0 0.0000000E+00 0.0000000E+00 1.00
45 tcla.a7r7.b1 0 0 0.0000000E+00 0.0000000E+00 1.00
46 tctph.4l8.b1 2 2 0.1139196E-01 0.8167204E-04 1.00
which tells us that 6923 impacts at the primary collimator (tcp.c6l7.b1
) were observed in the simulation. Out of these impacts 5695 correspond to particles lost in the primary collimator. However, this result is biased because the magnet aperture of the LHC is not taken into account in the SixTrack simulation. This implies that particles could potentially have been scattered out of the primary collimator to such a large amplitude or momentum offset that it would have been lost in the LHC magnets. Aperture restrictions (except from collimators) are not taken into account in the SixTrack simulations. Therefore, in the simulation, such particles can still continue to move along the LHC lattice (unrestricted of the aperture) until they hit a collimator again and are considered to be lost. Obviously, this behavior is unphysical and has to be corrected.
We will identify such particles and correct the summary above such that the correct physical behavior is reproduced.
Running BeamLossPattern: Identify losses in aperture
The output included the tracks2.dat file, which contains the tracks of all particles that were scattered out of the primary collimator (or in general, any collimator). The tracking starts at the moment the particle hits a collimator for the first time, until it is definitely lost (e.g. it undergoes any nuclear inelastic interaction that is not single diffractive scattering).
In order to identify loss locations of such particles in the LHC magnets, we must compare the tracks to the LHC aperture. This is done by using the BeamLossPattern tool.
./BeamLossPattern lowb tracks2.dat BLP_out allapert.b1
The following are the inputs/outputs (see collimation website)
Inputs
Energy --------> "inj" or "lowb" (used to identify the survey file)
Halo.File -----> File with all particle trajectories ("tracks2.dat" output of SixTrack)
Output.Name ---> Desired name for the output (can be any string)
Aperture.File -> Aperture model file. E.g.: "allaper_inj_20050322.b1"
Standard outputs
LP_Output.Name.s ---> Loss Pattern (losses checked at the locations of magnets)
LPI_Output.Name.s --> Loss Pattern with 10 cm spatial resolution (interpolation)
The output files has basically the same format has the input halo file. The only difference is that the last column know gives the number of surviving turns for each particle, i.e. the number of turn between the interaction with the primary collimators and the turn when the particle is lost. If we check the output of the file LPI_BLP_out.s
we see that two particles with the IDs 3048 and 3662 are lost at the positions 20310.4 m and 20310.8 m:
particle_ID turn position[m] x [m] x' [rad] y [m] y' [rad] Enlost
3048 1 20310.4 -0.0220887 -0.00098575 0.000129934 1.8163e-07 -0.0528 1 0
3662 2 20310.8 -0.0220078 -0.00096215 5.03906e-05 -2.5121e-06 -0.0528 1 0
In order to avoid issues with binary characters in the LPI files we use the following perl script:
perl -pi -e 's/\0/ /g' LPI_BLP_out.s
CleanInelastic
The SixTrack version with collimation can provide the locations of inelastic impacts of protons with the collimator jaws, which are used as an input for energy deposition studies. As discussed above, the SixTrack output can overestimate the number of impacts in a given collimator because it does not disregard the particles hitting the ring aperture before reaching the collimator (no aperture checks are carried out during the tracking). CleanInelastic cleans up the "fake" inelastic impacts from the SixTrack output.
Note that several input files are required to reconstruct the longitudinal position of the collimators in the sequence because of the collimator numbering used in SixTrack (which in principle can vary from run to run).
We run the clean_inelastic code using the following command
CleanInelastic FLUKA_impacts.dat LPI_BLP_out.s CollPositionsRunII.b1.dat coll_summary.dat
Inputs:
Impact.file -> SixTrack output with inelastic impacts ("FLUKA_impacts.dat")
Loss.file -> Loss maps as produced by BeamLossPattern
CollPosition -> File with the collimator positions
coll_summary.dat -> Standard SixTrack summary output
Outputs: impacts_fake.dat, impacts_real.dat
In our example case output file impacts_fake.dat
contains the particles that were lost in the aperture:
# 1=icoll 2=c_rotation 3=s 4=x 5=xp 6=y 7=yp 8=nabs 9=np 10=ntu
46 0.000 0.022332 -1.6480134e+01 -2.5417420e-01 -3.1648290e-01 1.7189773e-03 1 3048 1
46 0.000 0.063036 -1.6653390e+01 -2.6859122e-01 2.6593336e-01 -2.2205420e-03 1 3662 2
The first fake impact refers to collimator 46 at the first turn. In the file coll_summary.dat
we can see that collimator 46 is the horizontal TCT in IR8. The second fake impact (the one observed for particle 3662) also occurs at this collimator but in turn 2.
Correct_coll_summary
To take that into account the number of absorbed particles in collimator 46 should be reduced by two. This is accomplished with the last post-processing script:
./correct_coll_summary.sh
Now the coll_summary.dat
file is as follows:
# icoll collname nimp nabs imp_av imp_sig
28 tcp.c6l7.b1 6923 5695 0.1408189E-03 0.6654111E-04 0.60
29 tcp.b6l7.b1 80 64 0.7613685E-04 0.6530139E-04 0.60
30 tcsg.a6l7.b1 139 132 0.7043609E-03 0.7404103E-03 1.00
31 tcsg.b5l7.b1 219 203 0.1632712E-02 0.1494236E-02 1.00
32 tcsg.a5l7.b1 95 88 0.1157184E-02 0.1190544E-02 1.00
33 tcsg.d4l7.b1 27 27 0.4357763E-03 0.3409543E-03 1.00
34 tcsg.b4l7.b1 42 40 0.1508338E-03 0.1307831E-03 1.00
35 tcsg.a4l7.b1 19 18 0.3548064E-03 0.2976376E-03 1.00
36 tcsg.a4r7.b1 18 17 0.4394950E-03 0.3557746E-03 1.00
37 tcsg.b5r7.b1 27 26 0.3491472E-03 0.2759877E-03 1.00
38 tcsg.d5r7.b1 33 30 0.2740720E-03 0.2372699E-03 1.00
39 tcsg.e5r7.b1 13 12 0.5833242E-04 0.9012207E-04 1.00
40 tcsg.6r7.b1 48 45 0.2706816E-03 0.2440558E-03 1.00
41 tcla.a6r7.b1 0 0 0.0000000E+00 0.0000000E+00 1.00
42 tcla.b6r7.b1 0 0 0.0000000E+00 0.0000000E+00 1.00
43 tcla.c6r7.b1 1 1 0.0000000E+00 0.0000000E+00 1.00
44 tcla.d6r7.b1 0 0 0.0000000E+00 0.0000000E+00 1.00
45 tcla.a7r7.b1 0 0 0.0000000E+00 0.0000000E+00 1.00
46 tctph.4l8.b1 2 0 0.1139196E-01 0.8167204E-04 1.00
CleanCollScatter [optional]
If we need the Coll_Scatter.dat
file (providing an overview of all interactions in the collimators), we have to correct for particles lost in the aperture similarly to the CleanInelastic. We run the CleanCollScatter
executable with the same arguments as CleanInelastic
.
CleanCollScatter FLUKA_impacts.dat LPI_BLP_out.s CollPositionsRunII.b1.dat coll_summary.dat
Running on the batch system
Processing of results
Loss maps can be constructed by using the files coll_summary.dat
and `LPI_BLP_out.s'.
Bibliography
http://lhc-collimation-project.web.cern.ch/code-tracking-2012.php