Geant4 Note
Geant4 Note
一般的Program目录结构
+- Program/| CMakeLists.txt //CMake编译时需要的文件| Program.cc // main()函数| +- include| | ...include.hh... //放置头文件,声明需要的类| +- src| | ...source.cc... //放置源文件,定义相应的类和方法
一个活的程序需要什么
+- Program/| CMakeLists.txt // CMake编译时需要的文件| Program.cc // main()函数| +- include // 用来存放头文件| | ProgramDetectorConstruction.hh // 声明探测器结构的类| | ProgramPrimaryGeneratorAction.hh // 声明初始事件类| +- src // C++中,定义函数原型| | ProgramDetectorConstruction.cc //设置探测器结构| | ProgramPrimaryGeneratorAction.cc //设置初始粒子的位置,速度等信息(搭建粒子枪)
main()函数的一般内容:
项目
- runManager
- DetectorConstruction
- PhysicsList
- ActionInitialization
- PrimaryGeneratorAction
- UI mode
- ‘Purely hard-coded’ batch mode 硬编码批处理模式,即完全交由main()函数完成,不存在交互
硬编码是将数据直接嵌入到程序或其他可执行对象的源代码中的软件开发实践,与从外部获取数据或在运行时生成数据不同。 硬编码数据通常只能通过编辑源代码和重新编译可执行文件来修改…… ——百度百科·硬编码
- batch mode, but reading a macro of commands 批处理模式,但读取一个宏。这时用户可以在编译后通过输入不同的宏文本来调整一部分信息,而不需要重新编译源代码
- interactive mode, driven by command lines 命令行交互模式
- interactive mode via a Graphical User Interface GUI用户图形界面交互模式
- ‘Purely hard-coded’ batch mode 硬编码批处理模式,即完全交由main()函数完成,不存在交互
流程
/** Example of main()
*/#include "G4RunManager.hh"
#include "G4UImanager.hh"#include "ExG4DetectorConstruction01.hh"
#include "ExG4PhysicsList00.hh"
#include "ExG4ActionInitialization01.hh"int main()
{// construct the default run managerG4RunManager* runManager = new G4RunManager;// set mandatory initialization classesrunManager->SetUserInitialization(new ExG4DetectorConstruction01);runManager->SetUserInitialization(new ExG4PhysicsList00);runManager->SetUserInitialization(new ExG4ActionInitialization01);// set mandatory user action classesrunManager->SetUserAction(new ExG4PrimaryGeneratorAction);// initialize G4 kernelrunManager->Initialize();// get the pointer to the UI manager and set verbositiesG4UImanager* UI = G4UImanager::GetUIpointer();UI->ApplyCommand("/run/verbose 1");UI->ApplyCommand("/event/verbose 1");UI->ApplyCommand("/tracking/verbose 1");// start a runint numberOfEvent = 3;runManager->BeamOn(numberOfEvent);// job terminationdelete runManager;return 0;
}
探测器构建DetectorConstruction
几何信息
声明用到的粒子与物理过程PhysicsList()
Geant4给出一些常用的PhysicsList方案,分别适用于不同的物理过程。
创建ExPhysicsList()类,继承G4UserPhysicsList()类。
完成两项必要设置:
ConstructParticle(); //construction of particles
ConstructProcess(); //construct processes and register them to particles
以及边界阈值(Range cut value)
SetCuts();
Particale Definition
编辑ExPhysicsList::ConstructParticle()
void ExPhysicsList::ConstructParticle()
{G4Proton::ProtonDefinition();G4Geantino::GeantinoDefinition();
}
或者批量添加某一类型的粒子:
void ExN05PhysicsList::ConstructLeptons()
{
// Construct all leptonsG4LeptonConstructor pConstructor;pConstructor.ConstructParticle();
}/**************************G4BosonConstructor*G4LeptonConstructor*G4MesonConstructor*G4BaryonConstructor*G4IonConstructor*G4ShortlivedConstructor.
*/
Physics Processes
同样是编辑一个方法:
void ExPhysicsList::ConstructProcess()
{// Define transportation processAddTransportation();// electromagnetic processesConstructEM(); //不用区分物理过程在程序实现层面的类别,直接加入物理过程的方法
}void MyPhysicsList::ConstructEM()
{// Get pointer to G4PhysicsListHelperG4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();// Get pointer to gammaG4ParticleDefinition* particle = G4Gamma::GammaDefinition();// Construct and register processes for gammaph->RegisterProcess(new G4PhotoElectricEffect(), particle);ph->RegisterProcess(new G4ComptonScattering(), particle);ph->RegisterProcess(new G4GammaConversion(), particle);ph->RegisterProcess(new G4RayleighScattering(), particle);
}
设置初始粒子源信息PrimaryGeneratorAction
设置UI
编译运行
输出?
geant4.10.05-install 目录结构及功能
- bin: 存放配置文件
- include: 存放基础的头文件,包括各种Geant4基类
- lib: 应该是编译用的东西,暂时用不到
- share: 放了一些例子
Geant4 Note相关推荐
- linux下使用geant4指南,四步轻松安装Geant4 (Linux篇) | 入门
最近开始为订阅号"Geant4不完全学习指南"写一些文章. 正文开始. 四步轻松安装Geant4 (Linux篇) | 入门 软件版本:Ubuntu16.04,Geant4.10. ...
- geant4安装以及Root配置
geant4安装以及Root配置 先贴一个豆瓣链接:https://www.douban.com/note/431788626/ ROOT 按照cern root 安装:https://leeyeel ...
- Geant4基础安装
Geant4不做过多介绍.当转主流版本是geant4.10.06. 1.检查环境: cmake≥3.8 GCC >=4.9.3, >=5.4, >=6.3, >=7.3, &g ...
- linux运行geant4例子,四步轻松安装Geant4 (Linux篇) | 入门
最近开始为订阅号"Geant4不完全学习指南"写一些文章. 正文开始. 四步轻松安装Geant4 (Linux篇) | 入门 软件版本:Ubuntu16.04,Geant4.10. ...
- Paddle Release Note
Paddle Release Note 重要更新 飞桨paddle框架2.0.0版本有如下重要更新: • 编程范式:默认开启动态图模式进行模型开发和训练,通过动转静的方式进行模型部署和训练加速.如果需 ...
- 机器学习与高维信息检索 - Note 7 - 核主成分分析(Kernel Principal Component Analysis,K-PCA)
Note 7 - 核主成分分析(Kernel Principal Component Analysis) 核主成分分析 Note 7 - 核主成分分析(Kernel Principal Compone ...
- 机器学习与高维信息检索 - Note 6 - 核, 核方法与核函数(Kernels and the Kernel Trick)
Note 6 核, 核方法与核函数 到目前为止,我们所讨论的机器学习算法的成功都依赖于对输入数据分布的假设.例如,PCA的效果越好,数据围绕线性子空间分布.或者在线性判别分析中,我们假设类的高斯分布, ...
- ADPRL - 近似动态规划和强化学习 - Note 10 - 蒙特卡洛法和时序差分学习及其实例 (Monte Carlo and Temporal Difference)
Note 10 蒙特卡洛法和时序差分学习 Monte Carlo and Temporal Difference 蒙特卡洛法和时序差分学习 Note 10 蒙特卡洛法和时序差分学习 Monte Car ...
- 机器学习与高维信息检索 - Note 5 - (深度)前馈神经网络((Deep) Feedforward Neural Networks)及基于CVXOPT的相关实例
Note 5 - (深度)前馈神经网络((Deep) Feedforward Neural Networks)及相关实例 5.1 FNN的定义和动机 粗略地说,前馈神经网络(FNN)是一种特殊的函数类 ...
最新文章
- 每秒能捕捉万亿帧的相机
- pandas模块学习
- FPGA_进阶篇开篇
- iptables tcp wrappers
- R并行做大数据时间序列分析与bootstrap
- Matlab图像处理函数:regionprops
- Ubuntu:Terminal终端命令
- 基于自抗扰控制的高速列车自动驾驶速度控制
- 筚路蓝缕的十九年,天翎经历了什么?
- 读书笔记-可靠性工程师前言
- 当AD(Altium Designer)画PCB时Ctrl+H快捷键无法选中连线时的解决办法
- 鞍部在哪里_富春江,富春江在哪里_富春江在哪个省_属于哪个省_就去旅游网
- Ubuntu16.04安装搜狗拼音及可能出现的错误解决
- 电感与磁珠(补充中)
- 入门数据分析、人工智能前 所需要掌握的知识视频链接。
- 贪心(基于检索式问答系统)
- Windows11不插耳机、音箱提示无法找到输出设备的问题解决方法
- JAVA虚拟机JVM工作原理
- 高速公路收费运营安全风险管控与突发事件应急处置 PPT
- zrender使用问题