简单通量探测器
本示例使用 flux 数字化处理将真值信息和数字化信息保存到输出中。
快速开始
将示例复制到当前目录。 要创建几何结构、运行 10 个事例并生成 ROOT 和 CSV 输出文件:
cp -r $GEMC_HOME/examples/basic/simple_flux .
cd simple_flux
./simple_flux.py
gemc simple_flux.yaml -n=10
几何结构
如下所示的几何结构定义在 simple_flux.py 中。
世界体(一个名为 root 的长方体)包含:
- target,一个圆柱形液氢靶(G4_lH2)
- FluxPlane,一个由空气(G4_AIR)构成并指定使用 flux 数字化处理的长方体
交互式查看器:
物理过程列表
默认使用 QBBC,在 YAML 文件中通过 phys_list: QBBC 选择。
phys_list
The physics list can be selected using the option
gemc -phys_list <value>where
<value>can be a combination of the Geant4 physics constructors separated by the+sign. For examplegemc -phys_list="FTFP_BERT + G4NeutronCrossSectionXS"To see a list of the available Geant4 constructors:
gemc -showPhysics
发生器
粒子的运动学参数在 YAML 文件中定义:
gparticle:
- name: proton
p: 2000*MeV
vz: -3*cm
delta_vx: 0.1*cm
delta_vy: 0.1*cm
multiplicity: 10
更多信息请参阅内部发生器文档。
数字化
FluxPlane 的灵敏探测器响应通过 flux 数字化处理(GEMC 预置例程之一)
在 simple_flux.py 中指定,其标识符为 flux_plane = 1。
gvolume.digitization = "flux"
gvolume.set_identifier("flux_plane", 1)
在本例中,identifier 包含一个名称:flux_plane。
更多信息请参阅通量文档。
除数字化变量外,真值信息也会保存到输出流中。
True Information
The true information is processed by GEMC and, in some cases, averaged and weighted by the energy deposition. For variables like
pid,tid, orprocessName, the data come from the first step in the hit.The complete list of variables is:
- the sensitive element
identifier, assigned by the user. For example:
sectorlayerhitn: hit numberpid: particle IDtid: track IDavgTime: average timeavglx: average local x positionavgly: average local y positionavglz: average local z positionavgx: average global x positionavgy: average global y positionavgz: average global z positiontotalEDeposited: total energy depositedprocessName: process name creating the first step of this hit
用法
构建探测器
使用 Python 脚本 simple_flux.py 构建探测器。默认情况下,探测器配置存储在名为
gemc.db 的 SQLite 文件中。命令行选项可以指定数据库类型、变体和运行编号。
更多信息请参阅构建几何结构。
运行 GEMC
可以使用文件 simple_flux.yaml 来运行该探测器配置。添加 -gui 以交互方式运行:
gemc simple_flux.yaml -gui
根据需要修改 simple_flux.yaml,尤其是添加粒子、控制线程数或更改输出。
运行事例
输出
gstreamer 选项用于选择输出文件名和格式:
gstreamer:
- format: csv
filename: simple_flux
由于 flux 按事例进行数字化处理,GEMC 将为每个线程生成一个输出文件。
对于 ROOT 文件,你可以使用 hadd 来合并这些文件。
更多信息请参阅输出文档。
使用 GEMC 分析器绘图
请先使用 GEMC 运行 10,000 个事例。默认的 YAML 文件会输出供分析器使用的 CSV 数据流。
gemc simple_flux.yaml -n=10000
绘制每次击中所沉积的总能量:
gemc-analyzer simple_flux_t0_digitized.csv totEdep --kind csv

绘制粒子径迹的真实能量:
gemc-analyzer simple_flux_t0_true_info.csv E --kind csv --data true_info
