Thanks to visit codestin.com
Credit goes to github.com

Skip to content

lfhCpp/GasDetectorSim

Repository files navigation

Multi-Software Coupling Suite

Author: Lufenhua
Language: C++


⚠️ Prerequisites

To compile and link this program, you must have Geant4.10 (or a compatible version) installed on your system.


🚀 How to Run

Batch Mode

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 &

Visualization Mode

To run with visualization, simply execute:

bash ./MUSIC

Then press the "run" button in the Geant4 visualization interface.


⚙️ Configuration Files

run.mac

  • Set the absorber material.
  • Define the particle type and energy for the particle gun.

physics.mac

  • Configure the ionization model (PAIPhot or PAI in Geant4, Heed in Garfield++).
  • Set valid particle types and energy ranges.

📁 Modified Source Files

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.

🔌 Geant4‑Garfield Interface Notes

  • In GarfieldG4FastSimulationModel::DoIt() (file GarfieldG4FastSimulationModel.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.


🐛 Debugging Options

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.

📄 Based on

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.

About

Full-Chain Gaseous Detector Simulation via Multi-Software Coupling: Application and Validation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages