geant4官网:Geant4 (cern.ch)

打开B1实例的方法:

  • 进入用户文件夹/geant4_workspace/B1/build
  • 右键点击在终端中打开
  • 输入 cmake .. 进行编译以及生成配置文件(预编译)
  • 再输入make合并编译器生成的目标exampleB1可执行文件
  • 输入./exampleB1对可执行文件运行,生成可视化界面

配置参数文件(run1.mac)

以下为run1.mac文件

# Macro file for example B1
# 
# Can be run in batch, without graphic
# or interactively: Idle> /control/execute run1.mac
#
# Change the default number of workers (in multi-threading mode) 
#/run/numberOfThreads 4
#
# Initialize kernel
/run/initialize//初始化
#
/control/verbose 2
/run/verbose 2
/event/verbose 0
/tracking/verbose 1
# 
# gamma 6 MeV to the direction (0.,0.,1.)
#
/gun/particle gamma
/gun/energy 6 MeV
#
/run/beamOn 5//发射5个能量为6兆电子伏的γ粒子,此处为第一个模拟
# 
# proton 210 MeV to the direction (0.,0.,1.)
#
/gun/particle proton
/gun/energy 210 MeV
/tracking/verbose 2
#
/run/beamOn 1//发射1个能量为210兆电子伏的质子粒子

 src基础代码

➢假设我们自己来写一个程序进行一一个模拟实验,有哪些必要部分:

构建几何模型,假设想建立4*4*4 cm3的金属铝板   

  •  B1DetectorConstruction

 

设置粒子源,类型,能量,位置...     

  • B1PrimaryGeneratorAction  run1.mac



确定要统计的物理量,能量沉积,能谱

  • 统计结果的输出
  • B1EventAction
  • B1RunAction
  • B1SteppingAction


物理过程
初始化类

  • exampleB1.cc
  • B1 ActionInitialization

 

 

 posted on 2023-04-06 22:15  笨笨刀  阅读(233)  评论(0编辑  收藏  举报