B1したい(examples/basic/B1/
)
$ tree B1 -L 2
B1
├── CMakeLists.txt
├── GNUmakefile
├── History
├── README
├── exampleB1.cc
├── include
│ ├── ActionInitialization.hh
│ ├── DetectorConstruction.hh
│ ├── EventAction.hh
│ ├── PrimaryGeneratorAction.hh
│ ├── RunAction.hh
│ └── SteppingAction.hh
├── src
│ ├── ActionInitialization.cc
│ ├── DetectorConstruction.cc
│ ├── EventAction.cc
│ ├── PrimaryGeneratorAction.cc
│ ├── RunAction.cc
│ └── SteppingAction.cc
├── init_vis.mac
├── vis.mac
├── exampleB1.in
├── exampleB1.out
├── run1.mac
├── run2.mac
└── tsg_offscreen.mac
B1のディレクトリ構造は上のようになっています。
メインのプログラムはexampleB1.cc
で、include/*.hh
とsrc/*.cc
に関係するソースコードが格納されています。
*.mac
は実行ファイルの引数に指定できるマクロファイルです。
exampleB1.in
もマクロファイルです。
これを読み込んだときの出力がexampleB1.out
です。
ビルドした(cmake
)
$ cd B1
(B1) $ mkdir build
(B1) $ cd build
(B1/build) $ cmake ..
(B1/build) $ make
(B1/build) $ ./exampleB1 run1.mac
(B1/build) $ ./exampleB1 run2.mac
exampleB1
アプリケーションもGeant4本体と同じようにcmake
でビルドします。
examples/basic/B1/
の中にビルド用ディレクトリを(build
)を作成します。
その中で、cmake ..
とmake
して実行ファイルを生成します。
メインンプログラム
1//////////////////////////////////////////////////
2// exampleB1.cc
3//////////////////////////////////////////////////
4auto *runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default)
5// Detector construction
6runManager->SetUserInitialization(new DetectorConstruction());
7
8// Physics list
9G4VModularPhysicsList* physicsList = new QBBC;
10physicsList->SetVerboseLevel(1);
11runManager->SetUserInitialization(physicsList);
12
13// User action initialization
14runManager->SetUserInitialization(new ActionInitialization());
15
16G4UIExecutive *ui = new G4UIExecutive(argc, argv);
17G4VisManager *visManager = new G4VisExecutive;
18G4UImanager *uiManager = G4UImanager::GetUIpointer();
メインプログラムはexampleB1.cc
です。
その中のマネージャーの仕事を集めてみました。
exampleB1.cc
で使われているマネージャーたちを集めてみました。
4種類のマネージャーがいました。ランの管理人がG4RunManagerFactory
クラスで、その他はビジュアライズ関係の管理人たちです。