Loading...
Searching...
No Matches
Functions
examplePar02.cc File Reference
#include "G4Types.hh"
#include "G4UImanager.hh"
#include "G4RunManagerFactory.hh"
#include "Par02DetectorConstruction.hh"
#include "Par02PhysicsList.hh"
#include "Par02ActionInitialization.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.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 54 of file examplePar02.cc.

54 {
55
56 // Instantiate G4UIExecutive if interactive mode
57 G4UIExecutive* ui = nullptr;
58 if ( argc == 1 ) {
59 ui = new G4UIExecutive(argc, argv);
60 }
61
62 //-------------------------------
63 // Initialization of Run manager
64 //-------------------------------
65 auto* runManager = G4RunManagerFactory::CreateRunManager();
66 runManager->SetNumberOfThreads(4);
67
68 // Detector/mass geometry:
69 auto detector = new Par02DetectorConstruction();
70 runManager->SetUserInitialization( detector );
71
72 // PhysicsList (including G4FastSimulationManagerProcess)
73 auto physicsList = new Par02PhysicsList;
74 runManager->SetUserInitialization( physicsList );
75
76 //-------------------------------
77 // UserAction classes
78 //-------------------------------
79 runManager->SetUserInitialization( new Par02ActionInitialization );
80
81 // Initialize Run manager
82 runManager->Initialize();
83
84 //----------------
85 // Visualization:
86 //----------------
87 G4cout << "Instantiating Visualization Manager......." << G4endl;
88 G4VisManager* visManager = new G4VisExecutive;
89 visManager->Initialize();
90
91 if ( ui ) {
92 //--------------------------
93 // Define (G)UI
94 //--------------------------
95 ui->SessionStart();
96 delete ui;
97 } else {
98 G4String command = "/control/execute ";
99 G4String fileName = argv[1];
100 G4UImanager * UImanager = G4UImanager::GetUIpointer();
101 UImanager->ApplyCommand( command+fileName );
102 }
103
104 // Free the store: user actions, physics_list and detector_description are
105 // owned and deleted by the run manager, so they should not
106 // be deleted in the main() program !
107
108 delete visManager;
109 delete runManager;
110
111 return 0;
112}
Construction of detector geometry.
Construction of a physics list.

Applications | User Support | Publications | Collaboration