Geant4 Tutorial: Particle Types and Macro File Usage
Geant4 Tutorial: Particle Types and Macro File Usage
🎓 Geant4 Training Series – Particle Definitions and Macro File Syntax
In this part of the Geant4 training series by Partoyar Academy, we explore one of the most fundamental aspects of Monte Carlo simulations: particles in Geant4. Understanding the classification of particles and how to define them in macro files is the first step toward building a successful simulation.
🧪 Particle Categories in Geant4
Geant4 provides a wide range of predefined particles, including elementary particles, composite particles, ions, and even virtual test particles. Here's a breakdown of the main categories:
1. Leptons
Light particles with no strong interaction:
-
Electron:
e- -
Positron:
e+ -
Muons:
mu-,mu+ -
Neutrinos:
nu_e,nu_mu,nu_tau
2. Photons
Massless, chargeless particles:
-
Gamma photon:
gamma -
Optical photon:
opticalphoton
3. Mesons
Medium-mass composite particles:
-
Pions:
pi+,pi-,pi0 -
Kaons:
K+,K-,K0
4. Baryons
Heavier particles like:
-
Proton:
proton -
Neutron:
neutron -
Antiproton, antineutron, and other baryons
5. Ions
Atomic nuclei with specific charge:
-
Defined using the
/gun/ioncommand
6. Test and Virtual Particles
Used for geometry testing without physical interaction:
-
geantino -
chargedgeantino
📄 How to Define Particles in Geant4 Macro Files
Macro files (with .mac extension) allow users to run simulations without writing C++ code. To specify a particle type, use:
/gun/particle [particle_name]
For ions, use the extended syntax:
/gun/particle ion
/gun/ion [Z] [A] [Q] [E]
Example: Nitrogen-14 ion with charge +1 and energy 100 MeV:
/gun/particle ion
/gun/ion 7 14 1 100 MeV
📊 Particle Name Table for Macro Files
| Category | Geant4 Particle Name | Macro Command |
|---|---|---|
| Leptons | e-, e+ |
/gun/particle e- |
mu-, mu+ |
/gun/particle mu+ |
|
nu_e, nu_mu |
/gun/particle nu_mu |
|
| Photons | gamma |
/gun/particle gamma |
opticalphoton |
/gun/particle opticalphoton |
|
| Mesons | pi+, pi-, pi0 |
/gun/particle pi0 |
K+, K-, K0 |
/gun/particle K+ |
|
| Baryons | proton, neutron |
/gun/particle proton |
anti_proton |
/gun/particle anti_proton |
|
| Ions | ion |
/gun/particle ion |
/gun/ion Z A Q E |
||
| Test Particles | geantino |
/gun/particle geantino |
chargedgeantino |
/gun/particle chargedgeantino |
✅ Summary
Mastering particle definitions and macro syntax is a foundational skill for any Geant4 user. This tutorial, part of the Partoyar Academy’s Geant4 series, helps you build more accurate, reliable, and scalable simulations.