Simulation of ion tracks using data computed by TRIM
TRIM is a widely used program for the Monte Carlo simulation of ion transport in matter. It is the most comprehensive program in the SRIM software package. In this example we will use it to simulate trajectories of alpha particles in silicon and import the results in Garfield++.
Running TRIM
In the TRIM setup window (see the screenshot below), we select Helium as projectile and set its initial energy to 5.4 MeV (corresponding to an 241Am source). The target consists of a single layer of silicon with a thickness of 100 μm. In the field "Special EXYZ File Increment (eV)" at the bottom of the window we enter the value 1000. This asks TRIM to create an output file EXYZ.txt
containing for each simulated ion a table of the ion's position in energy intervals of 1000 eV. After having run TRIM, we can find this file in the directory SRIM Outputs
. A description of the format of this file (and the TRIM output files in general) can be found on the SRIM website.
Detector description
For simplicity, we use a uniform electric field and define the active area to be a box with a width of 100 μm along y.
MediumSilicon si;
ComponentConstant cmp;
cmp.SetElectricField(0., 1000., 0.);
// Thickness of the silicon layer [cm]
constexpr double d = 100.e-4;
cmp.SetArea(-d, 0., -d, d, d, d);
cmp.SetMedium(&si);
Sensor sensor(&cmp);
Importing the TRIM data
We now load the tables from the EXYZ.txt
(which we have copied to our working directory) using the method ReadFile
of the class TrackTrim
. For the purposes of our example, we import only the first 100 ion trajectories listed in the file.
TrackTrim tr(&sensor);
const unsigned int nIons = 100;
const unsigned int nSkip = 0;
if (!tr.ReadFile("EXYZ.txt", nIons, nSkip)) {
std::cerr << "Reading TRIM EXYZ file failed.\n";
return 1;
}
We want to visualise the ion trajectories using the class ViewDrift
.
// Plot the tracks.
ViewDrift driftView;
tr.EnablePlotting(&driftView);
We are now ready to simulate tracks and plot the clusters.
// Initial position
double x0 = 0., y0 = 0., z0 = 0., t0 = 0.;
// Direction of the track (parallel to y).
double dx0 = 0., dy0 = 1., dz0 = 0.;
for (unsigned int i = 0; i < nIons; ++i) {
tr.NewTrack(x0, y0, z0, t0, dx0, dy0, dz0));
unsigned int netot = 0;
// Loop over the clusters.
for (const auto& cluster : track.GetClusters()) {
// Count the total number of electrons.
netot += cluster.n;
}
}
driftView.SetArea(-10.e-4, 0., 10.e-4, 50.e-4);
driftView.Plot(true)`
In addition to the number of electrons, the cluster object also contains the coordinates and time of the cluster (x, y, z, t), the energy loss (energy) and the kinetic energy of the projectile at this point in the trajectory (ekin).
Links
- The source code of the example application discussed above can be found in the directory Examples/Srim of the Garfield++ source tree.
TrackTrim
is similar in scope to the "TRIMCAT" interface for Fortran Garfield, described in this paper.