Loading...
Searching...
No Matches
Functions
RE04.cc File Reference

Main program of the runAndEvent/RE04 example. More...

#include "G4Types.hh"
#include "G4RunManagerFactory.hh"
#include "G4ScoringManager.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "RE04ActionInitialization.hh"
#include "RE04DetectorConstruction.hh"
#include "RE04ParallelWorldConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4ParallelWorldPhysics.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the runAndEvent/RE04 example.

Definition in file RE04.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 46 of file RE04.cc.

47{
48 // Instantiate G4UIExecutive if there are no arguments (interactive mode)
49 G4UIExecutive* ui = nullptr;
50 if ( argc == 1 ) {
51 ui = new G4UIExecutive(argc, argv);
52 }
53
54// Construct the run manager
55 auto* runManager = G4RunManagerFactory::CreateRunManager();
56
57 G4ScoringManager::GetScoringManager();
58
59 G4String paraWorldName = "ParallelWorld";
60
61 // Set mandatory initialization classes
62 //
65 = new RE04ParallelWorldConstruction(paraWorldName);
66 realWorld->RegisterParallelWorld(parallelWorld);
67 runManager->SetUserInitialization(realWorld);
68 //
69 G4VModularPhysicsList* physicsList = new FTFP_BERT;
70 physicsList->RegisterPhysics
71 (new G4ParallelWorldPhysics(paraWorldName,true));
72 runManager->SetUserInitialization(physicsList);
73
74 // Set user action classes
75 //
76 runManager->SetUserInitialization(new RE04ActionInitialization);
77
78 // Visualization manager
79 //
80 G4VisManager* visManager = new G4VisExecutive;
81 visManager->Initialize();
82
83 // Initialize G4 kernel
84 //
85 runManager->Initialize();
86
87 // Get the pointer to the User Interface manager
88 //
89 G4UImanager* pUImanager = G4UImanager::GetUIpointer();
90
91 if (ui) // Define UI session for interactive mode
92 {
93 pUImanager->ApplyCommand("/control/execute vis.mac");
94 ui->SessionStart();
95 delete ui;
96 }
97 else // Batch mode
98 {
99 G4String command = "/control/execute ";
100 G4String fileName = argv[1];
101 pUImanager->ApplyCommand(command+fileName);
102 }
103
104 delete visManager;
105 delete runManager;
106
107 return 0;
108}
User detector construction class.
A parallel world construction class.

Applications | User Support | Publications | Collaboration