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

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

#include "G4Types.hh"
#include "ExP02DetectorConstruction.hh"
#include "ExP02DetConstrReader.hh"
#include "ExP02PrimaryGeneratorAction.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/P02 example.

Definition in file exampleP02.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 51 of file exampleP02.cc.

52{
53
54 if(argc==1)
55 {
56 G4cout << "Please give 'write' or 'read' as argument " << G4endl;
57 return 0;
58 }
59
61
62 if(std::string(argv[1]) == "read")
63 {
64 det = new ExP02DetConstrReader;
65 }
66 else if(std::string(argv[1]) == "write")
67 {
69 }
70 else
71 {
72 G4cout << "Wrong argument!" << G4endl;
73 return 0;
74 }
75
76 // User interface
77 G4UIExecutive* ui = new G4UIExecutive(argc, argv);
78
79 // Run manager
80 auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::SerialOnly);
81
82 // UserInitialization classes (mandatory)
83 runManager->SetUserInitialization(det);
84
85 G4VModularPhysicsList* physicsList = new FTFP_BERT;
86 runManager->SetUserInitialization(physicsList);
87
88 // Visualization
89 G4VisManager* visManager = new G4VisExecutive;
90 visManager->Initialize();
91
92 // UserAction classes
93 runManager->SetUserAction(new ExP02PrimaryGeneratorAction());
94
95 //Initialize G4 kernel
96 runManager->Initialize();
97
98 //get the pointer to the User Interface manager
99 G4UImanager * UImanager = G4UImanager::GetUIpointer();
100
101 UImanager->ApplyCommand("/control/execute vis.mac");
102 ui->SessionStart();
103 delete ui;
104
105 delete visManager;
106 delete runManager;
107
108 return 0;
109}
Detector construction reader using ROOT I/O.

Applications | User Support | Publications | Collaboration