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

Main program of the Common example without visualization. More...

#include "DetectorConstruction.hh"
#include "GeantinoPhysicsList.hh"
#include "GpsPrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "G4UImanager.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 Common example without visualization.

Definition in file exampleCommonNoVis.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 40 of file exampleCommonNoVis.cc.

41{
42 // Detect interactive mode (if no arguments) and define UI session
43 //
44 G4UIExecutive* ui = nullptr;
45 if ( argc == 1 ) { ui = new G4UIExecutive(argc, argv); }
46
47 // Construct the default run manager
48 G4RunManager* runManager = new G4RunManager;
49
50 // Set mandatory initialization classes
51 runManager->SetUserInitialization(new DetectorConstruction);
52 runManager->SetUserInitialization(new GeantinoPhysicsList);
53
54 // Set mandatory user action class
55 runManager->SetUserAction(new GpsPrimaryGeneratorAction);
56
57 // Get the pointer to the User Interface manager
58 G4UImanager* UImanager = G4UImanager::GetUIpointer();
59
60 // Process macro or start UI session
61 //
62 if ( ! ui ) {
63 // batch mode
64 G4String command = "/control/execute ";
65 G4String fileName = argv[1];
66 UImanager->ApplyCommand(command+fileName);
67 }
68 else {
69 // interactive mode
70 UImanager->ApplyCommand("/control/execute init.mac");
71 ui->SessionStart();
72 delete ui;
73 }
74
75 // Job termination
76 // Free the store: user actions, physics_list and detector_description are
77 // owned and deleted by the run manager, so they should not be deleted
78 // in the main() program !
79 delete runManager;
80}
Simple detector construction with a box volume placed in a world.
Physics list with geantino and charged geantino only.
The primary generator class with general particle source.

Applications | User Support | Publications | Collaboration