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

Main program of the persistency/P01 example. More...

#include "G4Types.hh"
#include "ExP01DetectorConstruction.hh"
#include "ExP01PrimaryGeneratorAction.hh"
#include "ExP01RunAction.hh"
#include "ExP01EventAction.hh"
#include "ExP01SteppingAction.hh"
#include "ExP01SteppingVerbose.hh"
#include "FTFP_BERT.hh"
#include "G4RunManagerFactory.hh"
#include "G4UImanager.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 persistency/P01 example.

Definition in file exampleP01.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 54 of file exampleP01.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 //my Verbose output class
63 G4VSteppingVerbose::SetInstance(new ExP01SteppingVerbose);
64
65 // Run manager
66 auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::SerialOnly);
67
68 // UserInitialization classes (mandatory)
70 runManager->SetUserInitialization(ExP01detector);
71
72 G4VModularPhysicsList* physicsList = new FTFP_BERT;
73 runManager->SetUserInitialization(physicsList);
74
75 // Visualization
76 G4VisManager* visManager = new G4VisExecutive;
77 visManager->Initialize();
78
79 // UserAction classes
80 runManager->SetUserAction(new ExP01PrimaryGeneratorAction(ExP01detector));
81 runManager->SetUserAction(new ExP01RunAction);
82 runManager->SetUserAction(new ExP01EventAction);
83 runManager->SetUserAction(new ExP01SteppingAction);
84
85 //Initialize G4 kernel
86 runManager->Initialize();
87
88 //get the pointer to the User Interface manager
89 G4UImanager * UImanager = G4UImanager::GetUIpointer();
90
91 if(ui)
92 // Define (G)UI terminal for interactive mode
93 {
94 UImanager->ApplyCommand("/control/execute vis.mac");
95 ui->SessionStart();
96 delete ui;
97 }
98 else
99 // Batch mode
100 {
101 G4String command = "/control/execute ";
102 G4String fileName = argv[1];
103 UImanager->ApplyCommand(command+fileName);
104 }
105
106 delete visManager;
107
108 delete runManager;
109
110 return 0;
111}
Detector Construction for the persistency example.
Event action for the persistency example.
Primary generator action for the persistency example.
Run action for the persistency example.
Stepping action for the persistency example.
Stepping verbose for the persistency example.

Applications | User Support | Publications | Collaboration