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

Main program of the RE05 example. More...

#include "G4Types.hh"
#include "G4RunManagerFactory.hh"
#include "RE05SteppingVerbose.hh"
#include "G4UImanager.hh"
#include "RE05DetectorConstruction.hh"
#include "RE05CalorimeterParallelWorld.hh"
#include "QBBC.hh"
#include "G4ParallelWorldPhysics.hh"
#include "RE05ActionInitialization.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the RE05 example.

Definition in file exampleRE05.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 50 of file exampleRE05.cc.

51{
52 // Instantiate G4UIExecutive if there are no arguments (interactive mode)
53 G4UIExecutive* ui = nullptr;
54 if ( argc == 1 ) {
55 ui = new G4UIExecutive(argc, argv);
56 }
57
58 // Setting the application-sepcific SteppingVerbose
59 auto verbosity = new RE05SteppingVerbose;
60
61 // Creating the run manager
62 auto runManager = G4RunManagerFactory::CreateRunManager();
63
64 G4String parallelWorldName = "ReadoutWorld";
65 // User Initialization classes (mandatory)
66 //
67 auto detector = new RE05DetectorConstruction();
68 detector->RegisterParallelWorld
69 (new RE05CalorimeterParallelWorld(parallelWorldName));
70 runManager->SetUserInitialization(detector);
71 //
72 auto physicsList = new QBBC;
73 physicsList
74 ->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
75 runManager->SetUserInitialization(physicsList);
76 //
77 auto actions = new RE05ActionInitialization;
78 runManager->SetUserInitialization(actions);
79
80 runManager->Initialize();
81
82 auto visManager = new G4VisExecutive;
83 visManager->Initialize();
84
85 //get the pointer to the User Interface manager
86 auto UImanager = G4UImanager::GetUIpointer();
87
88 if (!ui) // batch mode
89 {
90 G4String command = "/control/execute ";
91 G4String fileName = argv[1];
92 UImanager->ApplyCommand(command+fileName);
93 }
94 else // interactive mode : define UI session
95 {
96 UImanager->ApplyCommand("/control/execute vis.mac");
97 ui->SessionStart();
98 delete ui;
99 }
100
101 // Job termination
102 // Free the store: user actions, physics_list and detector_description are
103 // owned and deleted by the run manager, so they should not
104 // be deleted in the main() program !
105 delete visManager;
106 delete runManager;
107 delete verbosity;
108
109 return 0;
110}
This class manages the verbose outputs in G4SteppingManager.

Applications | User Support | Publications | Collaboration