Author: Lufenhua
Language: C++
To compile and link this program, you must have Geant4.10 (or a compatible version) installed on your system.
Run the program in batch mode with the provided macro file:
bash ./MUSIC -m ./run.mac
Or run it in the background using nohup:
bash nohup ./MUSIC -m ./run.mac &
To run with visualization, simply execute:
bash ./MUSIC
Then press the "run" button in the Geant4 visualization interface.
- Set the absorber material.
- Define the particle type and energy for the particle gun.
- Configure the ionization model (PAIPhot or PAI in Geant4, Heed in Garfield++).
- Set valid particle types and energy ranges.
| File | Purpose |
|---|---|
GarfieldDetectorConstruction.cc |
Modify detector geometry. |
GarfieldG4FastSimulationModel.CC |
Output particle position and energy on each call to DoIt() (invokes Garfield). |
GarfieldPhysics.cc |
Output related simulation information. |
GarfieldPrimaryGeneratorAction.cc |
Change particle source (Fe, He, or P emission). |
GarfieldSteppingAction.cc |
Output particle type, position, energy loss, etc., for each step. |
GarfieldEventAction.cc |
Store information after each event ends. |
-
In
GarfieldG4FastSimulationModel::DoIt()(fileGarfieldG4FastSimulationModel.cc), setting
cpp fGarfieldPhysics->EnableCreateSecondariesInGeant4(true)will return particles generated by Garfield to Geant4 to create secondary particles for further simulation.
-
The coordinate origin for the Geant4–Garfield interface is the center of the fast‑simulation logical volume defined in Geant4.
In GarfieldPhysics::InitializePhysics() (file GarfieldPhysics.cc), the following preprocessor defines can be set:
| Define | Effect |
|---|---|
#define ar_ch4 |
Use Ar/CH₄ gas mixture. Note: also change the material in GarfieldDetectorConstruction.cc accordingly. |
#define MC |
Use Garfield::AvalancheMC for simulation. |
#define plot |
(Single‑event debugging) Plot electric field, potential, and readout signals; also output signal data to a text file. |
#define CoutMessageToDebug |
Print additional simulation‑process messages for debugging. |
This code is derived from exampleGeant4Interface.
For more detailed information, refer to the comments in the source files, especially the debug‑related defines in GarfieldPhysics.cc.