Loading...
Searching...
No Matches
Functions
exampleGB03.cc File Reference
#include "G4Types.hh"
#include "G4RunManagerFactory.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "GB03DetectorConstruction.hh"
#include "GB03PrimaryGeneratorAction.hh"
#include "GB03ActionInitialization.hh"
#include "FTFP_BERT.hh"
#include "G4GenericBiasingPhysics.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 42 of file exampleGB03.cc.

43{
44 // Instantiate G4UIExecutive if interactive mode
45 G4UIExecutive* ui = nullptr;
46 if ( argc == 1 ) {
47 ui = new G4UIExecutive(argc, argv);
48 }
49
50 // -- Construct the run manager : MT or sequential one
51 auto* runManager = G4RunManagerFactory::CreateRunManager();
52 runManager->SetNumberOfThreads(4);
53
54 // -- Set mandatory initialization classes
56 runManager->SetUserInitialization(detector);
57 G4VModularPhysicsList* physicsList = new FTFP_BERT;
58 // -- Setup biasing for neutron only. As will not bias any
59 // -- physics process, require the G4GenericBiasingPhysics()
60 // -- to modify the physics list just for "non-physics" biasing:
62 biasingPhysics->NonPhysicsBias("neutron");
63 physicsList->RegisterPhysics(biasingPhysics);
64 runManager->SetUserInitialization(physicsList);
65
66 // -- Set user action initialization class
68 runManager->SetUserInitialization(actions);
69
70 // Visualization manager
71 //
72 G4VisManager* visManager = new G4VisExecutive;
73 visManager->Initialize();
74
75 // Initialize G4 kernel
76 //
77 runManager->Initialize();
78
79 // Get the pointer to the User Interface manager
80 //
81 G4UImanager* UImanager = G4UImanager::GetUIpointer();
82
83 if (ui) // Define UI session for interactive mode
84 {
85 UImanager->ApplyCommand("/control/execute vis.mac");
86 ui->SessionStart();
87 delete ui;
88 }
89 else // Batch mode
90 {
91 G4String command = "/control/execute ";
92 G4String fileName = argv[1];
93 UImanager->ApplyCommand(command+fileName);
94 }
95
96 delete visManager;
97 delete runManager;
98
99 return 0;
100}

Applications | User Support | Publications | Collaboration