提 纲 一、Geant4运行模式 “purely hard-coded” batch mode Batch mode,macro commands Interactive mode,command lines 二、材料定义 简单物质 分子定义 混合物 同位素 Geant4自定义 三、Geant4中使用物理量的单位 基本单位 输入 输出 四、几何结构定义 简单结构定义 复杂结构定义 颜色显示 五PrimaryGeneratorAction 一、Geant4运行模式 Geant4运行模式: “purely hard-coded” batch mode Batch mode,macro commands Interactive mode,command lines 每种模式的选择必须在Main文件中编制相应的代码 以实现其对应模式。通常采用混合模式。 ……. 头文件 Purely batch-coded mode ……. int main() { . . ….. G4runManager初始化… . . ….. class初始化… ………G4核初始化… runManager->Initialize(); //start run G4int numberOfEvent = 3; runManager->BeamOn(numberOfEvent); delete runManager; return 0; } ……. 头文件 Batch-coded with macro file mode ……. int main(int argc,char** argv) { . . ….. G4runManager初始化… . . ….. class初始化… ………G4核初始化… runManager->Initialize(); // Get the pointer to the UI manager G4UImanager* UI = G4UImanager::GetUIpointer(); G4String command = "/control/execute "; G4String fileName = argv[1]; UI->applyCommand(command+fileName); delete runManager; return 0; } ……. 头文件 Interactive by command line mode ……. #include "G4UIterminal.hh" #include "G4UIsession.hh" int main(int argc,char** argv) { . . ….. G4runManager初始化… . . ….. class初始化… ………G4核初始化… runManager->Initialize(); // Terminal initialization; G4UIsession* session = new G4UIterminal; session->SessionStart(); delete runManager; return 0; } Macro file: 命令行序列: #2008.6.9 #mac file for visulization /vis/scene/create /vis/open OGLIX /vis/scene/add/trajectories /vis/scene/add/hits /vis/scene/endOfEventAction accumulate /vis/viewer/set/viewpointThetaPhi 72 25 /vis/viewer/zoom 16 /run/beamOn 10000 /vis/viewer/set/style w /vis/viewer/set/style s 以文本格式保存 #include "G4UImanager.hh " Mixed mode #include "G4RunManager.hh" ……………. #include "G4VisManager.hh" #include "G4VisExecutive.hh" #include "G4UItcsh.hh" #include "G4UIterminal.hh" #include "G4UIsession.hh" int main(int argc,char** argv) { G4RunManager* MyRun = new G4RunManager; //this part is for the visualization G4VisManager
geant4 射线源定义_Geant4系列讲座二.ppt
最新推荐文章于 2023-09-01 22:13:55 发布