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

Main program of the visualization/userVisAction example. More...

#include "B1DetectorConstruction.hh"
#include "B1ActionInitialization.hh"
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "QBBC.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"
#include "UVA_VisAction.hh"
#include "Randomize.hh"
#include "G4SystemOfUnits.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the visualization/userVisAction example.

Definition in file userVisAction.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 46 of file userVisAction.cc.

47{
48 // Detect interactive mode (if no arguments) and define UI session
49 //
50 G4UIExecutive* ui = 0;
51 if ( argc == 1 ) {
52 ui = new G4UIExecutive(argc, argv);
53 }
54
55 // Choose the Random engine
56 //
57 G4Random::setTheEngine(new CLHEP::RanecuEngine);
58
59 // Construct the default run manager
60 //
61 auto* runManager = G4RunManagerFactory::CreateRunManager();
62
63 // Set mandatory initialization classes
64 //
65 // Detector construction
66 runManager->SetUserInitialization(new B1DetectorConstruction());
67
68 // Physics list
69 G4VModularPhysicsList* physicsList = new QBBC;
70 physicsList->SetVerboseLevel(1);
71 runManager->SetUserInitialization(physicsList);
72
73 // User action initialization
74 runManager->SetUserInitialization(new B1ActionInitialization());
75
76 // Initialize visualization
77 G4VisManager* visManager = new G4VisExecutive;
78 // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
79 // G4VisManager* visManager = new G4VisExecutive("Quiet");
80 // Register User Vis Action with optional extent
81 visManager->RegisterRunDurationUserVisAction
82 ("My nice logo",
83 new UVA_VisAction,
84 G4VisExtent(-20*cm,-10*cm,-25*cm,-15*cm,20*cm,40*cm));
85 visManager->Initialize();
86
87 // Get the pointer to the User Interface manager
88 G4UImanager* UImanager = G4UImanager::GetUIpointer();
89
90 if ( ! ui ) {
91 // batch mode
92 G4String command = "/control/execute ";
93 G4String fileName = argv[1];
94 UImanager->ApplyCommand(command+fileName);
95 }
96 else {
97 // interactive mode
98 UImanager->ApplyCommand("/control/execute init_vis.mac");
99 ui->SessionStart();
100 delete ui;
101 }
102
103 // Job termination
104 // Free the store: user actions, physics_list and detector_description are
105 // owned and deleted by the run manager, so they should not be deleted
106 // in the main() program !
107
108 delete visManager;
109 delete runManager;
110
111 return 0;
112}
Action initialization class.
Detector construction class to define materials and geometry.

Applications | User Support | Publications | Collaboration