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

Main program of the RE06 example. More...

#include "G4Types.hh"
#include "G4RunManagerFactory.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "G4ParallelWorldPhysics.hh"
#include "RE06DetectorConstruction.hh"
#include "RE06ParallelWorld.hh"
#include "RE06PrimaryGeneratorAction.hh"
#include "RE06RunAction.hh"
#include "RE06SteppingVerbose.hh"
#include "RE06ActionInitialization.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the RE06 example.

Definition in file exampleRE06.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 52 of file exampleRE06.cc.

53{
54 // Instantiate G4UIExecutive if there are no arguments (interactive mode)
55 G4UIExecutive* ui = nullptr;
56 if ( argc == 1 ) {
57 ui = new G4UIExecutive(argc, argv);
58 }
59
60 // Construct the stepping verbose class
61 //
62 auto verbosity = new RE06SteppingVerbose;
63
64 // Construct the run manager
65 //
66 auto runManager = G4RunManagerFactory::CreateRunManager();
67
68 // Set mandatory initialization classes
69 //
70 G4String parallelWorldName = "ParallelScoringWorld";
71 auto detector = new RE06DetectorConstruction;
72 detector->RegisterParallelWorld(new RE06ParallelWorld(parallelWorldName));
73 runManager->SetUserInitialization(detector);
74 //
75 auto physics = new FTFP_BERT;
76 physics->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
77 runManager->SetUserInitialization(physics);
78
79 // Set user action classes
80 //
81 runManager->SetUserInitialization(new RE06ActionInitialization);
82
83 // Visualization manager
84 //
85 auto visManager = new G4VisExecutive;
86 visManager->Initialize();
87
88 // Initialize G4 kernel
89 //
90 runManager->Initialize();
91
92 // Get the pointer to the User Interface manager
93 //
94 auto UImanager = G4UImanager::GetUIpointer();
95
96 if (ui) // Define UI session for interactive mode
97 {
98 UImanager->ApplyCommand("/control/execute vis.mac");
99 ui->SessionStart();
100 delete ui;
101 }
102 else // Batch mode
103 {
104 G4String command = "/control/execute ";
105 G4String fileName = argv[1];
106 UImanager->ApplyCommand(command+fileName);
107 }
108
109 // Job termination
110 // Free the store:
111 // user actions, physics_list and detector_description are
112 // owned and deleted by the run manager, so they should not
113 // be deleted in the main() program !
114
115 delete verbosity;
116 delete visManager;
117 delete runManager;
118
119 return 0;
120}

Applications | User Support | Publications | Collaboration